This commit is contained in:
rolux 2011-12-30 15:03:42 +05:30
commit 11cb7b1dc8
11 changed files with 57 additions and 21 deletions

View file

@ -32,8 +32,8 @@ Ox.load('UI', {
} }
}, },
select: function(data) { select: function(data) {
if (data.ids) { if (data.id) {
document.location.hash = data.ids[0]; document.location.hash = data.id;
} }
} }
}); });

View file

@ -313,7 +313,7 @@ Ox.load.UI = function(options, callback) {
} }
}); });
return format; return format;
}, };
Ox.UI.hideLoadingScreen = function() { Ox.UI.hideLoadingScreen = function() {
//Ox.print('hideLoadingScreen') //Ox.print('hideLoadingScreen')
var $div = $('.OxLoadingScreen'), var $div = $('.OxLoadingScreen'),

View file

@ -1124,7 +1124,7 @@ Ox.Calendar = function(options, self) {
} }
function setEventControls(event) { function setEventControls(event) {
var $eventControls = that.$element.find('.OxEventControl'), var $eventControls = that.find('.OxEventControl'),
isVisible = self.$eventControls.name.is(':visible'); isVisible = self.$eventControls.name.is(':visible');
if (event) { if (event) {
self.$eventControls.name.options({title: event.name}); self.$eventControls.name.options({title: event.name});

View file

@ -125,7 +125,7 @@ Ox.DocPanel = function(options, self) {
}); });
self.$list = Ox.TreeList({ self.$list = Ox.TreeList({
items: treeItems, items: treeItems,
width: self.options.width width: self.options.size - Ox.UI.SCROLLBAR_SIZE
}) })
.bindEvent({ .bindEvent({
select: selectItem select: selectItem
@ -184,7 +184,7 @@ Ox.DocPanel = function(options, self) {
@*/ @*/
that.selectItem = function(id) { that.selectItem = function(id) {
self.$list.triggerEvent('select', {'ids': [id]}); self.$list.triggerEvent('select', {'ids': [id]});
} };
return that; return that;
}; };

View file

@ -10,8 +10,7 @@ Ox.JQueryElement <function> Wrapper for jQuery
$element <object> jQuery DOM Element $element <object> jQuery DOM Element
@*/ @*/
// fixme: it seems that children(), find() etc. don't work directly, // fixme: now that children(), find() work, change code to call find directly.
// and still have to be called on the $element
Ox.JQueryElement = function($element) { Ox.JQueryElement = function($element) {
var that = this; var that = this;
@ -48,10 +47,12 @@ Ox.forEach($('<div>'), function(val, key) {
} }
}); });
ret = that.$element[key].apply(that.$element, args); ret = that.$element[key].apply(that.$element, args);
// if the $element of an ox object was returned // if exactly one $element of an ox object was returned
// then return the ox object instead // then return the ox object instead
// so that we can do oxObj.jqFn().oxFn() // so that we can do oxObj.jqFn().oxFn()
return ret && ret.jquery && Ox.UI.elements[id = ret.data('oxid')] return ret && ret.jquery
&& ret.length == 1
&& Ox.UI.elements[id = ret.data('oxid')]
? Ox.UI.elements[id] : ret; ? Ox.UI.elements[id] : ret;
}; };
} }

View file

@ -426,7 +426,7 @@ Ox.List = function(options, self) {
function emptyFirstPage() { function emptyFirstPage() {
if (self.$pages[0]) { if (self.$pages[0]) {
if (self.options.type == 'text') { if (self.options.type == 'text') {
self.$pages[0].$element.find('.OxEmpty').remove(); self.$pages[0].find('.OxEmpty').remove();
} else if (self.options.orientation == 'both') { } else if (self.options.orientation == 'both') {
that.$content.css({height: getListSize() + 'px'}); that.$content.css({height: getListSize() + 'px'});
} }
@ -1507,6 +1507,7 @@ Ox.List = function(options, self) {
}); });
self.options.items.splice.apply(self.options.items, Ox.merge([pos, 0], items)); self.options.items.splice.apply(self.options.items, Ox.merge([pos, 0], items));
self.$items.splice.apply(self.$items, Ox.merge([pos, 0], $items)); self.$items.splice.apply(self.$items, Ox.merge([pos, 0], $items));
self.listLength += length;
//loadItems(); //loadItems();
updatePositions(); updatePositions();
} }
@ -1656,6 +1657,7 @@ Ox.List = function(options, self) {
self.selected[i] -= length; self.selected[i] -= length;
} }
}); });
self.listLength -= length;
updatePositions(); updatePositions();
} }
} }

View file

@ -615,7 +615,7 @@ Ox.TextList = function(options, self) {
function getItem(id) { function getItem(id) {
//Ox.Log('List', 'getItem', id) //Ox.Log('List', 'getItem', id)
var $item = null; var $item = null;
that.$element.find('.OxItem').each(function() { that.find('.OxItem').each(function() {
var $this = $(this); var $this = $(this);
if ($this.data('id') == id) { if ($this.data('id') == id) {
$item = $this; $item = $this;
@ -658,7 +658,7 @@ Ox.TextList = function(options, self) {
? $('.OxHeadCell' + stopSelector).next() ? $('.OxHeadCell' + stopSelector).next()
: $('.OxHeadCell' + stopSelector)); : $('.OxHeadCell' + stopSelector));
$resize.detach().insertAfter($column); $resize.detach().insertAfter($column);
that.$body.$element.find('.OxItem').each(function() { that.$body.find('.OxItem').each(function() {
var $this = $(this); var $this = $(this);
$this.children(startSelector).detach()[insert]( $this.children(startSelector).detach()[insert](
$this.children(stopSelector) $this.children(stopSelector)
@ -672,7 +672,7 @@ Ox.TextList = function(options, self) {
self.visibleColumns.splice(stopPos, 0, visibleColumn); self.visibleColumns.splice(stopPos, 0, visibleColumn);
var pos = getColumnPositionById(self.options.columns[self.selectedColumn].id); var pos = getColumnPositionById(self.options.columns[self.selectedColumn].id);
if (pos > -1) { if (pos > -1) {
that.$element.find('.OxResize .OxSelected').removeClass('OxSelected'); that.find('.OxResize .OxSelected').removeClass('OxSelected');
pos > 0 && self.$heads[pos].prev().children().eq(2).addClass('OxSelected'); pos > 0 && self.$heads[pos].prev().children().eq(2).addClass('OxSelected');
self.$heads[pos].next().children().eq(0).addClass('OxSelected'); self.$heads[pos].next().children().eq(0).addClass('OxSelected');
if (pos == stopPos) { if (pos == stopPos) {
@ -697,7 +697,7 @@ Ox.TextList = function(options, self) {
that.$head.$content.empty(); that.$head.$content.empty();
constructHead(); constructHead();
itemWidth = getItemWidth(); itemWidth = getItemWidth();
that.$body.$element.find('.OxItem').each(function() { that.$body.find('.OxItem').each(function() {
var $this = $(this); var $this = $(this);
$this.children(selector).remove(); $this.children(selector).remove();
$this.css({width: itemWidth + 'px'}); $this.css({width: itemWidth + 'px'});
@ -738,7 +738,7 @@ Ox.TextList = function(options, self) {
width: width - 9 - (i == self.selectedColumn ? 16 : 0) + 'px' width: width - 9 - (i == self.selectedColumn ? 16 : 0) + 'px'
}); });
} }
that.$element.find('.OxCell.OxColumn' + Ox.toTitleCase(self.options.columns[i].id)).css({ that.find('.OxCell.OxColumn' + Ox.toTitleCase(self.options.columns[i].id)).css({
width: width - (self.options.columnsVisible ? 9 : 8) + 'px' width: width - (self.options.columnsVisible ? 9 : 8) + 'px'
}); });
setWidth(); setWidth();

View file

@ -31,7 +31,10 @@ Ox.TreeList = function(options, self) {
selected: [], selected: [],
width: 256 width: 256
}) })
.options(options || {}); .options(options || {})
.bindEvent({
select: selectItem
});
if (self.options.data) { if (self.options.data) {
self.options.items = []; self.options.items = [];
@ -134,6 +137,23 @@ Ox.TreeList = function(options, self) {
return ret; return ret;
} }
function getParent(id, items) {
var ret;
Ox.forEach(items, function(item) {
if(item.items) {
if(Ox.getObjectById(item.items, id)) {
ret = item.id;
} else {
ret = getParent(id, item.items);
}
if(ret) {
return false;
}
}
});
return ret;
}
function parseData(key, value) { function parseData(key, value) {
//Ox.Log('List', 'parseData', key, value) //Ox.Log('List', 'parseData', key, value)
var ret = { var ret = {
@ -178,10 +198,21 @@ Ox.TreeList = function(options, self) {
return ret; return ret;
} }
function selectItem(data) {
var id = data.ids[0], parent = id, parents=[];
while(parent = getParent(parent, self.options.items)) {
parents.push(parent);
}
parents = parents.reverse();
toggleItems({
expanded: true,
ids: parents
});
}
function toggleItem(item, expanded) { function toggleItem(item, expanded) {
var $img, pos; var $img, pos;
item.expanded = expanded; item.expanded = expanded;
that.$element.find('.OxItem').each(function() { that.find('.OxItem').each(function() {
var $item = $(this); var $item = $(this);
if ($item.data('id') == item.id) { if ($item.data('id') == item.id) {
$img = $item.find('.OxToggle'); $img = $item.find('.OxToggle');

View file

@ -13,6 +13,7 @@ Ox.SmallVideoTimeline = function(options, self) {
'in': 0, 'in': 0,
out: 0, out: 0,
paused: false, paused: false,
results: [],
showMilliseconds: 0, showMilliseconds: 0,
timeline: '', timeline: '',
type: 'player', type: 'player',
@ -239,4 +240,4 @@ Ox.SmallVideoTimeline = function(options, self) {
return that; return that;
}; };

View file

@ -442,7 +442,7 @@ Ox.VideoEditor = function(options, self) {
width: 256 width: 256
}).open(); }).open();
} else if (id == 'resolution') { } else if (id == 'resolution') {
self.options.resolution = parseInt(data.value); self.options.resolution = parseInt(data.checked[0].id);
self.$player[0].options({resolution: self.options.resolution}); self.$player[0].options({resolution: self.options.resolution});
} }
} }

View file

@ -173,6 +173,7 @@ Ox.VideoPlayer = function(options, self) {
self.height = self.options.fullscreen ? window.innerHeight : self.options.height; self.height = self.options.fullscreen ? window.innerHeight : self.options.height;
self.videoWidth = self.options.width; self.videoWidth = self.options.width;
self.videoHeight = self.options.height; self.videoHeight = self.options.height;
self.results = [];
/* /*
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
@ -1130,7 +1131,7 @@ Ox.VideoPlayer = function(options, self) {
}); });
showControls(); showControls();
hideControls(); hideControls();
that.$element.find('.OxControls').bind({ that.find('.OxControls').bind({
mouseenter: function() { mouseenter: function() {
self.mouseIsInControls = true; self.mouseIsInControls = true;
}, },