diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2010-09-11 16:42:32 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2010-09-11 16:42:32 +0000 |
| commit | 2d07e3db2bb6cbb3d4d48c8702795a613599ecdd (patch) | |
| tree | e44027d22c7331ac995df7b2e795562692b8f1e5 | |
| parent | 2384e06fdf70bfe51fc242fb06edb54be3a3e4e3 (diff) | |
| download | xxv-2d07e3db2bb6cbb3d4d48c8702795a613599ecdd.tar.gz xxv-2d07e3db2bb6cbb3d4d48c8702795a613599ecdd.tar.bz2 | |
jason: keep selection if timer programmed
| -rw-r--r-- | skins/jason/autotimers.js | 2 | ||||
| -rw-r--r-- | skins/jason/channelspanel.js | 2 | ||||
| -rw-r--r-- | skins/jason/common.js | 25 | ||||
| -rw-r--r-- | skins/jason/form.js | 9 | ||||
| -rw-r--r-- | skins/jason/movetimers.js | 2 | ||||
| -rw-r--r-- | skins/jason/now.js | 40 | ||||
| -rw-r--r-- | skins/jason/program.js | 28 | ||||
| -rw-r--r-- | skins/jason/recordings.js | 6 | ||||
| -rw-r--r-- | skins/jason/search.js | 58 | ||||
| -rw-r--r-- | skins/jason/tabpanel.js | 4 | ||||
| -rw-r--r-- | skins/jason/timers.js | 39 | ||||
| -rw-r--r-- | skins/jason/users.js | 2 | ||||
| -rw-r--r-- | skins/jason/vdr.js | 2 | ||||
| -rw-r--r-- | skins/stone/display.tmpl | 3 |
14 files changed, 155 insertions, 67 deletions
diff --git a/skins/jason/autotimers.js b/skins/jason/autotimers.js index 569dc96..76e4859 100644 --- a/skins/jason/autotimers.js +++ b/skins/jason/autotimers.js @@ -327,7 +327,7 @@ Ext.extend(Ext.xxv.autotimerGrid, Ext.grid.EditorGridPanel, { if(this.viewer.formwin){ this.viewer.formwin.close(); } - this.viewer.formwin = new Ext.xxv.Question(item,this.store); + this.viewer.formwin = new Ext.xxv.Question(item,this.store.reload,this.store); }, onEditItem : function(grid, index, e) { e.stopEvent(); diff --git a/skins/jason/channelspanel.js b/skins/jason/channelspanel.js index fe0327c..5f5e69e 100644 --- a/skins/jason/channelspanel.js +++ b/skins/jason/channelspanel.js @@ -331,7 +331,7 @@ Ext.extend(Ext.xxv.channelsPanel, Ext.tree.TreePanel, { if(viewer.formwin){ viewer.formwin.close(); } - viewer.formwin = new Ext.xxv.Question(item,this.store); + viewer.formwin = new Ext.xxv.Question(item,this.store.reload,this.store); } /******************************************************************************/ ,onDeleteSuccess : function( response,options ) diff --git a/skins/jason/common.js b/skins/jason/common.js index 89e4f72..3370862 100644 --- a/skins/jason/common.js +++ b/skins/jason/common.js @@ -221,3 +221,28 @@ function highlightText(node, regex, cls, deep) { } } }; + + + +// helper grouping view, don't scroll to top after editing (reload) +Ext.xxv.GroupingView = function(config) { + Ext.apply(this, config); + Ext.xxv.GroupingView.superclass.constructor.call(this, {} ); +}; + +Ext.extend(Ext.xxv.GroupingView, Ext.grid.GroupingView, { + scrollTop : function() { + this.scroller.dom.scrollTop = 0; + this.scroller.dom.scrollLeft = 0; + } + ,keepSelection : undefined + ,scrollToTop : function () { + if(this.keepSelection) { + delete this.keepSelection; + this.keepSelection = undefined; + } else + Ext.grid.GroupingView.superclass.scrollToTop.call(this); + } + +}); + diff --git a/skins/jason/form.js b/skins/jason/form.js index 7090d2c..44f882f 100644 --- a/skins/jason/form.js +++ b/skins/jason/form.js @@ -7,14 +7,15 @@ * $Id$ */ -Ext.xxv.Question = function(item,parentstore) { +Ext.xxv.Question = function(item,callback,scope) { if(XXV.help.cmdDisabled(item.cmd)) { new Ext.xxv.MessageBox().msgFailure(this.szCommandDeny, item.cmd); return; } - this.parentstore = parentstore; + this.callback = callback; + this.scope = scope; this.item = item; this.store = new Ext.data.Store({ @@ -323,8 +324,8 @@ Ext.extend(Ext.xxv.Question, Ext.Window, { && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szSuccess, o.data); this.hide(); - if(this.parentstore) - this.parentstore.reload(); + if(this.callback) + this.callback.call(this.scope); } else { var msg = ''; if(o && o.data && typeof(o.data) == 'string') { diff --git a/skins/jason/movetimers.js b/skins/jason/movetimers.js index 8725b45..2e30508 100644 --- a/skins/jason/movetimers.js +++ b/skins/jason/movetimers.js @@ -259,7 +259,7 @@ Ext.extend(Ext.xxv.movetimersGrid, Ext.grid.EditorGridPanel, { if(this.viewer.formwin){ this.viewer.formwin.close(); } - this.viewer.formwin = new Ext.xxv.Question(item,this.store); + this.viewer.formwin = new Ext.xxv.Question(item,this.store.reload,this.store); }, onEditItem : function(grid, index, e) { e.stopEvent(); diff --git a/skins/jason/now.js b/skins/jason/now.js index d6841b9..6378c51 100644 --- a/skins/jason/now.js +++ b/skins/jason/now.js @@ -27,6 +27,7 @@ Ext.xxv.NowStore = function() { ,{name: 'timeractiv', type: 'string'} ,{name: 'running', type: 'string'} ,{name: 'vps', type: 'string'} //type:'date', dateFormat:'timestamp'} + ,{name: 'level', type: 'int'} ,{name: 'order', type: 'int'} //dummy field created after onload ] }) @@ -127,7 +128,7 @@ Ext.xxv.NowGrid = function(viewer) { ,sm: new Ext.grid.RowSelectionModel({ singleSelect:true }) - ,view: new Ext.grid.GroupingView({ + ,view: new Ext.xxv.GroupingView({ enableGroupingMenu:false, forceFit:true, showGroupName: false, @@ -186,6 +187,11 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { this.preview.clear(); } ,onLoad : function( store, records, opt ) { + if(this.view.keepSelection) + this.getSelectionModel().selectRow(this.view.keepSelection[0],false); + else + this.getSelectionModel().selectFirstRow(); + if(store.baseParams.data && store.baseParams.cmd != 'nx' && store.reader.meta @@ -197,7 +203,6 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { this.ownerCt.SetPanelTitle(this.szFollowing + " - " + new Date().dateFormat('H:i')); else this.ownerCt.SetPanelTitle(this.szPresent + " - " + new Date().dateFormat('H:i')); - this.getSelectionModel().selectFirstRow(); } ,onSpecialkey : function(f, e) { if(e.getKey() == e.ENTER){ @@ -248,7 +253,7 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { ,iconCls: 'timer-edit-icon' ,scope:this ,disabled: true - ,handler: function() { this.EditTimer(this.ctxRecord, this.store); } + ,handler: function() { this.EditTimer(this.ctxRecord, this.updateTimer, this); } },{ itemId:'td' ,text: this.szDeleteTimer @@ -343,7 +348,8 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { } if(o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szRecordSuccess, o.data); - this.updateTimer(); + if(options.callback) + options.callback.call(options.cbscope); } else { new Ext.xxv.MessageBox().msgFailure(this.szRecordFailure, o.data); } @@ -354,23 +360,35 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { new Ext.xxv.MessageBox().msgFailure(this.szRecordFailure, response.statusText); } ,Record : function(record) { - this.RecordID(record.data.id); + this.RecordID(record.data.id, this.updateTimer, this); } - ,RecordID : function(id) { + ,RecordID : function(id, callback, cbscope) { this.viewer.loadMask.show(); Ext.Ajax.request({ - scope: this + scope: this ,url: XXV.help.cmdAJAX('tn',{ data: id, '__fast':'1' }) ,success: this.onRecordSuccess ,failure: this.onRecordFailure + ,callback: callback + ,cbscope: cbscope }); } ,updateTimer : function() { + var gsm = this.getSelectionModel(); + if(gsm.hasSelection()) { + this.view.keepSelection = new Array(); + for(var i = 0, len = this.store.getCount(); i < len; i++){ + if(gsm.isSelected(i)) { + this.view.keepSelection.push(i); + } + } + } + this.store.reload(); if(this.viewer.gridTimer) { this.viewer.gridTimer.dataDirty = true; } } - ,EditTimer : function(record,store) { + ,EditTimer : function(record,callback,scope) { var item; if(record.data.timerid) { @@ -390,7 +408,7 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { if(this.viewer.formwin){ this.viewer.formwin.close(); } - this.viewer.formwin = new Ext.xxv.Question(item,store); + this.viewer.formwin = new Ext.xxv.Question(item,callback,scope); } /******************************************************************************/ ,onDeleteSuccess : function( response,options ) @@ -502,7 +520,7 @@ Ext.xxv.NowPreview = function(viewer) { iconCls: 'record-icon', disabled:true, scope: viewer, - handler: function(){ this.Record(this.gridNow.getSelectionModel().getSelected()); } + handler: function(){ this.gridNow.Record(this.gridNow.getSelectionModel().getSelected()); } },{ id:'te', tooltip: Ext.xxv.NowGrid.prototype.szEditTimer, @@ -510,7 +528,7 @@ Ext.xxv.NowPreview = function(viewer) { disabled:true, scope: viewer, handler: function(){ - this.gridNow.EditTimer(this.gridNow.getSelectionModel().getSelected()); + this.gridNow.EditTimer(this.gridNow.getSelectionModel().getSelected(), this.updateTimer, this); } },{ id:'td', diff --git a/skins/jason/program.js b/skins/jason/program.js index 8195306..7b9e096 100644 --- a/skins/jason/program.js +++ b/skins/jason/program.js @@ -27,6 +27,7 @@ Ext.xxv.programStore = function(data) { ,{name: 'timerid', type: 'string'} ,{name: 'timeractiv', type: 'string'} ,{name: 'running', type: 'string'} + ,{name: 'level', type: 'int'} ] }), proxy : new Ext.data.HttpProxy({ @@ -92,7 +93,7 @@ Ext.xxv.programGrid = function(viewer, record) { ,sm: new Ext.grid.RowSelectionModel({ singleSelect:false }) - ,view: new Ext.grid.GroupingView({ + ,view: new Ext.xxv.GroupingView({ enableGroupingMenu:false, forceFit:true, showGroupName: false, @@ -137,7 +138,11 @@ Ext.extend(Ext.xxv.programGrid, Ext.grid.GridPanel, { this.preview.clear(); } ,onLoad : function( store, records, opt ) { - this.getSelectionModel().selectFirstRow(); + if(this.view.keepSelection) + this.getSelectionModel().selectRows(this.view.keepSelection,false); + else + this.getSelectionModel().selectFirstRow(); + this.ownerCt.SetPanelTitle(store.title); } ,onContextClick : function(grid, index, e){ @@ -235,10 +240,25 @@ Ext.extend(Ext.xxv.programGrid, Ext.grid.GridPanel, { ids += ','; ids += sel[i].data.id; } - this.viewer.RecordID(ids); + this.viewer.RecordID(ids, this.updateTimer, this); + } + ,updateTimer : function() { + var gsm = this.getSelectionModel(); + if(gsm.hasSelection()) { + this.view.keepSelection = new Array(); + for(var i = 0, len = this.store.getCount(); i < len; i++){ + if(gsm.isSelected(i)) { + this.view.keepSelection.push(i); + } + } + } + this.store.reload(); + if(this.viewer.gridTimer) { + this.viewer.gridTimer.dataDirty = true; + } } ,EditTimer : function(record) { - this.viewer.gridNow.EditTimer(record, this.store); + this.viewer.gridNow.EditTimer(record, this.updateTimer, this); } ,DeleteTimer : function(record) { var gsm = this.getSelectionModel(); diff --git a/skins/jason/recordings.js b/skins/jason/recordings.js index f297c6b..7315ecc 100644 --- a/skins/jason/recordings.js +++ b/skins/jason/recordings.js @@ -1030,7 +1030,7 @@ Ext.extend(Ext.xxv.recordingsDataView, Ext.DataView, { if(this.viewer.formwin){ this.viewer.formwin.close(); } - this.viewer.formwin = new Ext.xxv.Question(item,this.store); + this.viewer.formwin = new Ext.xxv.Question(item,this.store.reload,this.store); } ,ConvertItem : function(record) { @@ -1043,7 +1043,7 @@ Ext.extend(Ext.xxv.recordingsDataView, Ext.DataView, { if(this.viewer.formwin){ this.viewer.formwin.close(); } - this.viewer.formwin = new Ext.xxv.Question(item,this.store); + this.viewer.formwin = new Ext.xxv.Question(item,this.store.reload,this.store); } ,Recover : function() { @@ -1054,7 +1054,7 @@ Ext.extend(Ext.xxv.recordingsDataView, Ext.DataView, { if(this.viewer.formwin){ this.viewer.formwin.close(); } - this.viewer.formwin = new Ext.xxv.Question(item,this.store); + this.viewer.formwin = new Ext.xxv.Question(item,this.store.reload,this.store); } /******************************************************************************/ ,onUpgradeSuccess : function( response,options ) diff --git a/skins/jason/search.js b/skins/jason/search.js index d289267..554a2d2 100644 --- a/skins/jason/search.js +++ b/skins/jason/search.js @@ -13,21 +13,22 @@ Ext.xxv.searchStore = function(lookup) { ,autoLoad:{params:{start:0, limit:configuration.pageSize}} ,reader: new Ext.xxv.jsonReader({ fields: [ - {name: 'id', type: 'string'}, - {name: 'title', type: 'string'}, - {name: 'subtitle', type: 'string'}, - {name: 'channel', type: 'string'}, - {name: 'pos', type: 'int'}, - {name: 'start', type: 'string' }, - {name: 'stop', type: 'string' }, - {name: 'day', type: 'date', convert : function(x){ return new Date(x * 1000);} }, - {name: 'description', type: 'string'}, - {name: 'vps', type: 'string' }, - {name: 'timerid', type: 'string'}, - {name: 'timeractiv', type: 'string'}, - {name: 'running', type: 'string'}, - {name: 'video', type: 'string'}, - {name: 'audio', type: 'string'} + {name: 'id', type: 'string'} + ,{name: 'title', type: 'string'} + ,{name: 'subtitle', type: 'string'} + ,{name: 'channel', type: 'string'} + ,{name: 'pos', type: 'int'} + ,{name: 'start', type: 'string' } + ,{name: 'stop', type: 'string' } + ,{name: 'day', type: 'date', convert : function(x){ return new Date(x * 1000);} } + ,{name: 'description', type: 'string'} + ,{name: 'vps', type: 'string' } + ,{name: 'timerid', type: 'string'} + ,{name: 'timeractiv', type: 'string'} + ,{name: 'running', type: 'string'} + ,{name: 'video', type: 'string'} + ,{name: 'audio', type: 'string'} + ,{name: 'level', type: 'int'} ] }) ,proxy : new Ext.data.HttpProxy({ @@ -83,7 +84,7 @@ Ext.xxv.searchGrid = function(viewer, lookup) { singleSelect:false }), autoExpandColumn:'title', - view: new Ext.grid.GroupingView({ + view: new Ext.xxv.GroupingView({ enableGroupingMenu:false, forceFit:true, showGroupName: false, @@ -127,7 +128,11 @@ Ext.extend(Ext.xxv.searchGrid, Ext.grid.GridPanel, { this.preview.clear(); } ,onLoad : function( store, records, opt ) { - this.getSelectionModel().selectFirstRow(); + if(this.view.keepSelection) + this.getSelectionModel().selectRows(this.view.keepSelection,false); + else + this.getSelectionModel().selectFirstRow(); + this.ownerCt.SetPanelTitle(store.baseParams.data); } @@ -222,10 +227,25 @@ Ext.extend(Ext.xxv.searchGrid, Ext.grid.GridPanel, { ids += ','; ids += sel[i].data.id; } - this.viewer.RecordID(ids); + this.viewer.RecordID(ids, this.updateTimer, this); + } + ,updateTimer : function() { + var gsm = this.getSelectionModel(); + if(gsm.hasSelection()) { + this.view.keepSelection = new Array(); + for(var i = 0, len = this.store.getCount(); i < len; i++){ + if(gsm.isSelected(i)) { + this.view.keepSelection.push(i); + } + } + } + this.store.reload(); + if(this.viewer.gridTimer) { + this.viewer.gridTimer.dataDirty = true; + } } ,EditTimer : function(record) { - this.viewer.gridNow.EditTimer(record, this.store); + this.viewer.gridNow.EditTimer(record, this.updateTimer, this); } ,DeleteTimer : function(record) { var gsm = this.getSelectionModel(); diff --git a/skins/jason/tabpanel.js b/skins/jason/tabpanel.js index 3c26ac8..8952351 100644 --- a/skins/jason/tabpanel.js +++ b/skins/jason/tabpanel.js @@ -166,9 +166,9 @@ Ext.extend(Ext.xxv.tabPanel, Ext.TabPanel, { if(!record || !record.data) return; this.gridNow.Record(record); } - ,RecordID : function(id){ + ,RecordID : function(id, callback, cbscope){ if(!id) return; - this.gridNow.RecordID(id); + this.gridNow.RecordID(id, callback, cbscope); } ,openTeleText : function(name, data){ var id = 'vt'; diff --git a/skins/jason/timers.js b/skins/jason/timers.js index 6c8a9bb..026e537 100644 --- a/skins/jason/timers.js +++ b/skins/jason/timers.js @@ -42,20 +42,6 @@ Ext.xxv.timerStore = function() { }); }; -// helper grouping view, don't scroll to top after editing (reload) -Ext.xxv.editingGroupingView = function(config) { - Ext.apply(this, config); - Ext.xxv.editingGroupingView.superclass.constructor.call(this, {} ); -}; - -Ext.extend(Ext.xxv.editingGroupingView, Ext.grid.GroupingView, { - scrollTop : function() { - this.scroller.dom.scrollTop = 0; - this.scroller.dom.scrollLeft = 0; - }, - scrollToTop : Ext.emptyFn -}); - Ext.xxv.timerGrid = function(viewer) { this.viewer = viewer; @@ -176,7 +162,7 @@ Ext.xxv.timerGrid = function(viewer) { ,sm: new Ext.grid.RowSelectionModel({ singleSelect:false }) - ,view: new Ext.xxv.editingGroupingView({ + ,view: new Ext.xxv.GroupingView({ enableGroupingMenu:false, forceFit:true, showGroupName: false, @@ -246,7 +232,12 @@ Ext.extend(Ext.xxv.timerGrid, Ext.grid.GridPanel, { // Ext.grid.EditorGridPanel } ,onLoad : function( store, records, opt ) { this.dataDirty = false; - this.getSelectionModel().selectFirstRow(); + + if(this.view.keepSelection) + this.getSelectionModel().selectRows(this.view.keepSelection,false); + else + this.getSelectionModel().selectFirstRow(); + this.ownerCt.SetPanelTitle(this.szTitle); } ,refreshPanel : function(panel){ @@ -492,6 +483,18 @@ Ext.extend(Ext.xxv.timerGrid, Ext.grid.GridPanel, { // Ext.grid.EditorGridPanel ,params:{ data: todel } }); } + ,updateTimer : function() { + var gsm = this.getSelectionModel(); + if(gsm.hasSelection()) { + this.view.keepSelection = new Array(); + for(var i = 0, len = this.store.getCount(); i < len; i++){ + if(gsm.isSelected(i)) { + this.view.keepSelection.push(i); + } + } + } + this.store.reload(); + } ,EditItem : function( record ) { this.stopEditing(); var item; @@ -516,7 +519,7 @@ Ext.extend(Ext.xxv.timerGrid, Ext.grid.GridPanel, { // Ext.grid.EditorGridPanel if(this.viewer.formwin){ this.viewer.formwin.close(); } - this.viewer.formwin = new Ext.xxv.Question(item,this.store); + this.viewer.formwin = new Ext.xxv.Question(item, this.updateTimer, this); } ,onEditItem : function(grid, index, e) { e.stopEvent(); @@ -547,7 +550,7 @@ Ext.extend(Ext.xxv.timerGrid, Ext.grid.GridPanel, { // Ext.grid.EditorGridPanel if(this.viewer.formwin){ this.viewer.formwin.close(); } - this.viewer.formwin = new Ext.xxv.Question(item,this.store); + this.viewer.formwin = new Ext.xxv.Question(item, this.updateTimer, this); } ,select : function(sm, index, record){ this.preview.select(record, this.filter.getValue()); diff --git a/skins/jason/users.js b/skins/jason/users.js index 57ceec9..142453d 100644 --- a/skins/jason/users.js +++ b/skins/jason/users.js @@ -264,7 +264,7 @@ Ext.extend(Ext.xxv.usersGrid, Ext.grid.EditorGridPanel, { if(this.viewer.formwin){ this.viewer.formwin.close(); } - this.viewer.formwin = new Ext.xxv.Question(item,this.store); + this.viewer.formwin = new Ext.xxv.Question(item,this.store.reload,this); }, onEditItem : function(grid, index, e) { e.stopEvent(); diff --git a/skins/jason/vdr.js b/skins/jason/vdr.js index 3a77fb0..f8c95db 100644 --- a/skins/jason/vdr.js +++ b/skins/jason/vdr.js @@ -298,7 +298,7 @@ Ext.extend(Ext.xxv.vdrGrid, Ext.grid.EditorGridPanel, { if(this.viewer.formwin){ this.viewer.formwin.close(); } - this.viewer.formwin = new Ext.xxv.Question(item,this.store); + this.viewer.formwin = new Ext.xxv.Question(item,this.store.reload,this.store); }, onEditItem : function(grid, index, e) { e.stopEvent(); diff --git a/skins/stone/display.tmpl b/skins/stone/display.tmpl index 396c148..fe255db 100644 --- a/skins/stone/display.tmpl +++ b/skins/stone/display.tmpl @@ -29,8 +29,9 @@ audio = data.last.8; d = data.last.9; timerid=data.last.10; - recording=data.last.11; + timeractiv=data.last.11; running=data.last.12; + images=data.last.13; pdc = data.last.14; channelid = data.last.15; level = data.last.16; |
