135 lines
3.1 KiB
JavaScript
135 lines
3.1 KiB
JavaScript
/*
|
|
|
|
*/
|
|
|
|
Ox.ItfPage = function(page, parentPanel) {
|
|
var panelItems = [];
|
|
for (var i=0; i < page.panels.displayed.length; i++) {
|
|
var t = page.panels.displayed[i];
|
|
var displayed = true;
|
|
var panel = new Ox.ItfPanel(t, displayed);
|
|
panelItems.push(panel);
|
|
}
|
|
var hiddenPanel = new Ox.ItfHiddenPanelContainer();
|
|
for (var j=0; j < page.panels.hidden.length; j++) {
|
|
var t = page.panels.hidden[j];
|
|
var displayed = false;
|
|
var panel = new Ox.ItfPanel(t, displayed);
|
|
hiddenPanel.addPanel(panel);
|
|
}
|
|
var that = app.ui['ItfPage'] = new Ox.SplitPanel({
|
|
orientation: 'vertical',
|
|
id: 'ItfPage',
|
|
elements: panelItems
|
|
});
|
|
return that;
|
|
}
|
|
|
|
|
|
Ox.ItfPanel = function(panelData, displayed) {
|
|
var items = [];
|
|
var id = panelData.title;
|
|
for (var i=0; i < panelData.boxes.length; i++) {
|
|
var t = panelData.boxes[i];
|
|
var box = new Ox.ItfBox(t);
|
|
items.push(box);
|
|
}
|
|
var that = new Ox.SplitPanel({
|
|
orientation: 'horizontal',
|
|
id: id,
|
|
elements: items
|
|
});
|
|
that.displayed = displayed;
|
|
};
|
|
|
|
|
|
Ox.HiddenPanelContainer = function() {
|
|
|
|
};
|
|
|
|
|
|
Ox.ItfBox = function(boxData) {
|
|
var self = {};
|
|
boxData.itfId = "Box" + boxData.id;
|
|
var options = {
|
|
'id': boxData.itfId,
|
|
'title': boxData.title
|
|
};
|
|
var that = app.ui[boxData.itfId] = new Ox.Element(options, self);
|
|
var $titlebar = new Ox.Bar({
|
|
orientation: 'horizontal',
|
|
size: '24
|
|
}).appendTo(that);
|
|
var $title = new Ox.Element()
|
|
.addClass('OxTitle')
|
|
.html(title)
|
|
.appendTo($titlebar);
|
|
var $buttons = new Ox.Element().appendTo($title).css({'position': 'absolute', 'top': '1px', 'right': '1px'});
|
|
var boxButtons = Ox.merge(ItfBoxTypes[boxData.type].buttons, boxData.extra_buttons);
|
|
for (var i=0; i<boxButtons.length; i++) {
|
|
var t = boxButtons[i];
|
|
var button = new Ox.ItfButton(t, boxData).appendTo($buttons);
|
|
}
|
|
|
|
$content = ItfBoxTypes[boxData.type].render(boxData);
|
|
$content.appendTo(that);
|
|
that.$content = $content;
|
|
return that;
|
|
}
|
|
|
|
|
|
Ox.ItfButton = function(buttonData, boxData) {
|
|
var button = new Ox.Button({
|
|
'id': boxData.itfId + "Button" + buttonData.id,
|
|
'style': 'symbol',
|
|
'title': buttonData.icon,
|
|
'tooltip': buttonData.mouseover,
|
|
'type': 'image'
|
|
});
|
|
var that = ItfButtonTypes[buttonData.type](button, buttonData, boxData);
|
|
return that;
|
|
}
|
|
|
|
|
|
Ox.ItfList = function(modelData, boxData, size) {
|
|
var size = size || 256;
|
|
var id = "ModelList" + modelData.id;
|
|
var listOptions = {
|
|
'id': id,
|
|
'width': size, //FIXME: don't hardcode width - get these figures on init and set globals or something
|
|
'items': function(data, callback) {
|
|
app.api.find(getFindParams(modelData));
|
|
},
|
|
'max': 1,
|
|
'columns': [
|
|
{
|
|
align: 'left',
|
|
id: 'title',
|
|
operator: '-',
|
|
unique: false,
|
|
visible: true,
|
|
width: 256
|
|
},
|
|
{
|
|
id: 'id',
|
|
visible: false,
|
|
unique: true
|
|
}
|
|
],
|
|
'sort': modelData.sort_options
|
|
}
|
|
var that = new Ox.List(
|
|
}
|
|
|
|
/*
|
|
ItfBoxes.StaticBox = function(boxData) {
|
|
var self = {};
|
|
var that = new Ox.Element(
|
|
|
|
}
|
|
|
|
ItfBoxes.ModelsBox = function(boxData) {
|
|
|
|
}
|
|
*/
|