merge changes

This commit is contained in:
j 2011-02-01 18:45:23 +05:30
commit c84de6d0f0
3 changed files with 203 additions and 6 deletions

View file

@ -1485,6 +1485,10 @@ Ox.formatPercent = function(num, total, dec) {
return Ox.formatNumber(num / total * 100, dec) + '%'
};
Ox.formatResolution = function(arr, str) {
return arr[0] + ' x ' + arr[1] + ' ' + str;
}
Ox.formatString = function (s, args) {
/* Python(ish) string formatting:
* >>> format('{0}', ['zzz'])

View file

@ -246,7 +246,6 @@ requires
};
});
that.api.init(getUserData(), function(result) {
// fixme: rename config to site?
config = result.data.config,
user = result.data.user;
document.title = config.site.name;
@ -2984,16 +2983,18 @@ requires
.appendTo(that);
}
self.$input = $('<input>')
self.$input = $(self.options.type == 'textarea' ? '<textarea>' : '<input>')
.addClass('OxInput OxMedium Ox' + Ox.toTitleCase(self.options.style))
.attr({
disabled: self.options.disabled ? 'disabled' : '',
type: self.options.type == 'password' ? 'password' : 'text'
})
.css({
.css($.extend({
width: self.inputWidth + 'px',
textAlign: self.options.textAlign
})
}, self.options.type == 'textarea' ? {
height: self.options.height + 'px'
} : {}))
.val(self.options.value)
.blur(blur)
.change(change)
@ -8047,13 +8048,15 @@ requires
.appendTo($item);
});
function formatValue(value, format) {
if (Ox.isArray(value)) {
value = value.join(', ');
if (value === null) {
value = '';
} else if (format) {
value = Ox.isObject(format) ?
Ox['format' + Ox.toTitleCase(format.type)]
.apply(this, $.merge([value], format.args)) :
format(value);
} else if (Ox.isArray(value)) {
value = value.join(', ');
}
return value;
}
@ -12676,4 +12679,186 @@ requires
};
/*
============================================================================
Pan.do/ra
============================================================================
*/
Ox.FilesView = function(options, self) {
var self = self || {},
that = new Ox.Element('div', self)
.defaults({
id: ''
})
.options(options || {});
self.$toolbar = new Ox.Bar({
size: 24
});
self.$orderButton = new Ox.Button({
title: 'Change Order of Users...'
})
.css({
float: 'left',
margin: '4px'
})
.appendTo(self.$toolbar);
self.$moveButton = new Ox.Button({
disabled: 'true',
title: 'Move Selected Files...'
})
.css({
float: 'right',
margin: '4px'
})
.appendTo(self.$toolbar);
self.$filesList = new Ox.TextList({
columns: [
{
align: 'left',
id: 'users',
operator: '+',
title: 'Users',
visible: true,
width: 120
},
{
align: 'left',
id: 'folder',
operator: '+',
title: 'Folder',
visible: true,
width: 180
},
{
align: 'left',
id: 'name',
operator: '+',
title: 'Name',
visible: true,
width: 360
},
{
align: 'left',
id: 'type',
operator: '+',
title: 'Type',
visible: true,
width: 60
},
{
align: 'right',
id: 'part',
operator: '+',
title: 'Part',
visible: true,
width: 60
},
{
align: 'right',
format: {type: 'value', args: ['B']},
id: 'size',
operator: '-',
title: 'Size',
visible: true,
width: 90
},
{
align: 'right',
format: {type: 'resolution', args: ['px']},
id: 'resolution',
operator: '-',
title: 'Resolution',
visible: true,
width: 90
},
{
align: 'right',
format: {type: 'duration', args: [0, 'short']},
id: 'duration',
operator: '-',
title: 'Duration',
visible: true,
width: 90
},
{
align: 'left',
id: 'hash',
operator: '+',
title: 'Hash',
unique: true,
visible: false,
width: 120
},
{
align: 'left',
id: 'instances',
operator: '+',
title: 'Instances',
visible: false,
width: 120
}
],
columnsMovable: true,
columnsRemovable: true,
columnsResizable: true,
columnsVisible: true,
id: 'files',
request: function(data, callback) {
pandora.api.findFiles($.extend(data, {
query: {
conditions: [{
key: 'id',
value: self.options.id,
operator: '='
}]
}
}), callback);
},
scrollbarVisible: true,
sort: [{key: 'name', operator:'+'}]
})
.bindEvent({
open: openFiles,
select: selectFiles
});
self.$instancesList = new Ox.Element()
.html('No files selected');
that.$element = new Ox.SplitPanel({
elements: [
{
element: self.$toolbar,
size: 24
},
{
element: self.$filesList
},
{
element: self.$instancesList,
size: 80
}
],
orientation: 'vertical'
});
function openFiles(event, data) {
//alert(JSON.stringify(self.$filesList.value(data.ids[0], 'instances')))
}
function selectFiles(event, data) {
//alert(JSON.stringify(self.$filesList.value(data.ids[0], 'instances')))
}
return that;
};
})();

View file

@ -639,6 +639,14 @@ $(function() {
},
title: "Autocomplete with Replace, Correct and Select"
},
{
options: {
height: 128,
type: 'textarea',
width: 256
},
title: 'Textarea'
}
/*
{
options: {