diff options
| author | anbr <vdr07@deltab.de> | 2011-11-26 21:31:44 +0100 |
|---|---|---|
| committer | anbr <vdr07@deltab.de> | 2011-11-26 21:31:44 +0100 |
| commit | f56a676f9fe0040053f0d351432bc9454fa4377e (patch) | |
| tree | 60726b0cc4a1b2c1dcec895d41f3179b076d9d1a | |
| parent | 8dcebe3b099f86de7c1ad38896b311e160128e15 (diff) | |
| download | xxv-f56a676f9fe0040053f0d351432bc9454fa4377e.tar.gz xxv-f56a676f9fe0040053f0d351432bc9454fa4377e.tar.bz2 | |
jason: allow toggle from any view
| -rw-r--r-- | skins/jason/locale/lang-de.js | 5 | ||||
| -rw-r--r-- | skins/jason/locale/lang-en.js | 7 | ||||
| -rw-r--r-- | skins/jason/locale/lang-it.js | 5 | ||||
| -rw-r--r-- | skins/jason/now.js | 117 | ||||
| -rw-r--r-- | skins/jason/program.js | 33 |
5 files changed, 143 insertions, 24 deletions
diff --git a/skins/jason/locale/lang-de.js b/skins/jason/locale/lang-de.js index ebf8f64..462801a 100644 --- a/skins/jason/locale/lang-de.js +++ b/skins/jason/locale/lang-de.js @@ -108,6 +108,7 @@ Ext.xxv.NowGrid.prototype.szFindReRun = "Suche Wiederholung"; Ext.xxv.NowGrid.prototype.szProgram = "Zeige Programm"; Ext.xxv.NowGrid.prototype.szRecord = "Aufnehmen"; Ext.xxv.NowGrid.prototype.szEditTimer = "Timer bearbeiten"; +Ext.xxv.NowGrid.prototype.szToggleTimer = "Timer de- bzw. aktivieren"; Ext.xxv.NowGrid.prototype.szDeleteTimer = "Timer löschen"; Ext.xxv.NowGrid.prototype.szColPosition = "Position des Kanal"; Ext.xxv.NowGrid.prototype.szColTitle = "Titel"; @@ -118,6 +119,10 @@ Ext.xxv.NowGrid.prototype.szColStop = "Ende"; Ext.xxv.NowGrid.prototype.szLoadException = "Konnte keine Daten holen!\r\n{0}"; Ext.xxv.NowGrid.prototype.szRecordSuccess = "Timer erfolgreich erstellt.\r\n{0}"; Ext.xxv.NowGrid.prototype.szRecordFailure = "Konnte Timer nicht erstellen!\r\n{0}"; +Ext.xxv.NowGrid.prototype.szToggleFailure = "Konnte Timer nicht verändern!\r\n{0}"; +Ext.xxv.NowGrid.prototype.szDeleteSuccess = "Timer erfolgreich gelöscht.\r\n{0}"; +Ext.xxv.NowGrid.prototype.szDeleteFailure = "Konnte Timer nicht löschen!\r\n{0}"; +Ext.xxv.NowGrid.prototype.szDetailsFailure = "Konnte Details der Sendung nicht aktualisieren!\r\n{0}"; /* program.js */ Ext.xxv.programGrid.prototype.szTitle = "Programführer"; diff --git a/skins/jason/locale/lang-en.js b/skins/jason/locale/lang-en.js index 17acb83..a0ecbc4 100644 --- a/skins/jason/locale/lang-en.js +++ b/skins/jason/locale/lang-en.js @@ -108,6 +108,7 @@ Ext.xxv.NowGrid.prototype.szFindReRun = "Find rerun"; Ext.xxv.NowGrid.prototype.szProgram = "Show program"; Ext.xxv.NowGrid.prototype.szRecord = "Record"; Ext.xxv.NowGrid.prototype.szEditTimer = "Edit timer"; +Ext.xxv.NowGrid.prototype.szToggleTimer = "Enable or disable timer"; Ext.xxv.NowGrid.prototype.szDeleteTimer = "Delete timer"; Ext.xxv.NowGrid.prototype.szColPosition = "Channel position"; Ext.xxv.NowGrid.prototype.szColTitle = "Title"; @@ -116,8 +117,12 @@ Ext.xxv.NowGrid.prototype.szColGrpName = "Group of channel"; Ext.xxv.NowGrid.prototype.szColStart = "Start"; Ext.xxv.NowGrid.prototype.szColStop = "Stop"; Ext.xxv.NowGrid.prototype.szLoadException = "Couldn't get data!\r\n{0}"; -Ext.xxv.NowGrid.prototype.szRecordSuccess = "Successful created timer.\r\n{0}"; +Ext.xxv.NowGrid.prototype.szRecordSuccess = "Timer created successful.\r\n{0}"; Ext.xxv.NowGrid.prototype.szRecordFailure = "Couldn't create timer!\r\n{0}"; +Ext.xxv.NowGrid.prototype.szToggleFailure = "Couldn't modify timer!\r\n{0}"; +Ext.xxv.NowGrid.prototype.szDeleteSuccess = "Timer deleted successful.\r\n{0}"; +Ext.xxv.NowGrid.prototype.szDeleteFailure = "Couldn't delete timer!\r\n{0}"; +Ext.xxv.NowGrid.prototype.szDetailsFailure = "Couldn't update details of event!\r\n{0}"; /* program.js */ Ext.xxv.programGrid.prototype.szTitle = "Program guide"; diff --git a/skins/jason/locale/lang-it.js b/skins/jason/locale/lang-it.js index f74b0c1..4341489 100644 --- a/skins/jason/locale/lang-it.js +++ b/skins/jason/locale/lang-it.js @@ -108,6 +108,7 @@ Ext.xxv.NowGrid.prototype.szFindReRun = "Cerca repliche"; Ext.xxv.NowGrid.prototype.szProgram = "Mostra programma"; Ext.xxv.NowGrid.prototype.szRecord = "Registra"; Ext.xxv.NowGrid.prototype.szEditTimer = "Modifica timer"; +/* TODO Ext.xxv.NowGrid.prototype.szToggleTimer = "Enable or disable timer"; */ Ext.xxv.NowGrid.prototype.szDeleteTimer = "Elimina timer"; Ext.xxv.NowGrid.prototype.szColPosition = "Posizione canale"; Ext.xxv.NowGrid.prototype.szColTitle = "Titolo"; @@ -118,6 +119,10 @@ Ext.xxv.NowGrid.prototype.szColStop = "Fine"; Ext.xxv.NowGrid.prototype.szLoadException = "Impossibile recuperare i dati!\r\n{0}"; Ext.xxv.NowGrid.prototype.szRecordSuccess = "Creazione timer riuscita.\r\n{0}"; Ext.xxv.NowGrid.prototype.szRecordFailure = "Impossibile creare timer!\r\n{0}"; +/* TODO Ext.xxv.NowGrid.prototype.szToggleFailure = "Couldn't modify timer!\r\n{0}"; */ +/* TODO Ext.xxv.NowGrid.prototype.szDeleteSuccess = "Timer deleted successful.\r\n{0}"; */ +/* TODO Ext.xxv.NowGrid.prototype.szDeleteFailure = "Couldn't delete timer!\r\n{0}"; */ +/* TODO Ext.xxv.NowGrid.prototype.szDetailsFailure = "Couldn't update details of event!\r\n{0}"; */ /* program.js */ Ext.xxv.programGrid.prototype.szTitle = "Guida programmi"; diff --git a/skins/jason/now.js b/skins/jason/now.js index f93880f..87ffc99 100644 --- a/skins/jason/now.js +++ b/skins/jason/now.js @@ -172,6 +172,7 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { ,szProgram : "Show program" ,szRecord : "Record" ,szEditTimer : "Edit timer" + ,szToggleTimer : "Enable or disable timer" ,szDeleteTimer : "Delete timer" ,szColPosition : "Channel position" ,szColTitle : "Title" @@ -180,8 +181,9 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { ,szColStart : "Start" ,szColStop : "Stop" ,szLoadException : "Couldn't get data!\r\n{0}" - ,szRecordSuccess : "Successful created timer.\r\n{0}" + ,szRecordSuccess : "Timer created successful.\r\n{0}" ,szRecordFailure : "Couldn't create timer!\r\n{0}" + ,szToggleFailure : "Couldn't modify timer!\r\n{0}" ,szDeleteSuccess : "Timer deleted successful.\r\n{0}" ,szDeleteFailure : "Couldn't delete timer!\r\n{0}" ,szDetailsFailure : "Couldn't update details of event!\r\n{0}" @@ -257,7 +259,7 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { ,handler: function(){ var data = {'id':this.ctxRecord.data.chid,'name':this.ctxRecord.data.channel}; this.viewer.openProgram(data); } - },{ + },'-',{ itemId:'tn' ,text: this.szRecord ,iconCls: 'record-icon' @@ -272,6 +274,13 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { ,disabled: true ,handler: function() { this.EditTimer(this.ctxRecord, this.updateTimer, this); } },{ + itemId:'tt' + ,text: this.szToggleTimer + ,iconCls: 'timer-toggle-icon' + ,scope:this + ,disabled: true + ,handler: function() { this.ToogleTimer(this.ctxRecord, this.updateTimer, this); } + },{ itemId:'td' ,text: this.szDeleteTimer ,iconCls: 'timer-delete-icon' @@ -318,6 +327,7 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { } if(f.itemId == 'tn') { if(timerid) f.hide(); else f.show(); } else if(f.itemId == 'te') { if(timerid) f.show(); else f.hide(); } + else if(f.itemId == 'tt') { if(timerid) f.show(); else f.hide(); } else if(f.itemId == 'td') { if(timerid) f.show(); else f.hide(); } if(XXV.help.cmdAllowed(f.itemId)) f.enable(); @@ -428,6 +438,83 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { this.viewer.formwin = new Ext.xxv.Question(item,callback,scope); } /******************************************************************************/ + ,SelectedTimer : function(record) { + var gsm = this.getSelectionModel(); + var sel = gsm.getSelections(); + if(sel.length <= 0) { + gsm.selectRecords([record]); + sel.push(record); + } + var items = ""; + for(var i = 0, len = sel.length; i < len; i++){ + if(i !== 0) + items += ','; + if(sel[i].data.timerid === 0) { + continue; + } + items += sel[i].data.timerid; + } + return items; + } + ,ToggleTimer : function(record) { + this.ToggleTimerId(this.SelectedTimer(record), this.store); + } + ,onToggleSuccess : function( response,options ) + { + this.viewer.loadMask.hide(); + + var o = eval("("+response.responseText+")"); + + if(o && o.data && typeof(o.data) == 'object' + && o.param && o.param.state && o.param.state === 'success') { + + var items = options.params.data.split(","); + for (var j = 0, jlen = options.store.getCount(); j < jlen; j++) { + var record = options.store.getAt(j); + for(var i = 0, len = items.length; i < len; i++){ + if(!record || record.data.timerid != items[i]) { + continue; + } + for(var k = 0, klen = o.data.length; k < klen; k++){ + if(record.data.timerid == o.data[k][0]) { + record.data.timeractiv = o.data[k][1]; + record.data.running = o.data[k][2]; + //record.data.conflict = o.data[k][3]; + record.commit(); + break; + } + } + } + } + this.updateTimer(); + } else { + var msg = ''; + if(o && o.data && typeof(o.data) == 'string') { + msg = o.data; + } + new Ext.xxv.MessageBox().msgFailure(this.szToggleFailure, msg); + } + } + ,onToggleFailure : function( response,options ) { + this.viewer.loadMask.hide(); + new Ext.xxv.MessageBox().msgFailure(this.szToggleFailure, response.statusText); + } + ,ToggleTimerId : function( items,store ) { + if(items.length <= 0) + return; + this.viewer.loadMask.show(); + + Ext.Ajax.request({ + scope: this + ,url: XXV.help.cmdAJAX('tt') + ,timeout: 15000 + ,success: this.onToggleSuccess + ,failure: this.onToggleFailure + ,store: store + ,params:{ data: items } + }); + } + /******************************************************************************/ ,onDeleteSuccess : function( response,options ) { this.viewer.loadMask.hide(); @@ -463,22 +550,7 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { new Ext.xxv.MessageBox().msgFailure(this.szDeleteFailure, response.statusText); } ,DeleteTimer : function(record) { - var gsm = this.getSelectionModel(); - var sel = gsm.getSelections(); - if(sel.length <= 0) { - gsm.selectRecords([record]); - sel.push(record); - } - var items = ""; - for(var i = 0, len = sel.length; i < len; i++){ - if(i !== 0) - items += ','; - if(sel[i].data.timerid === 0) { - continue; - } - items += sel[i].data.timerid; - } - this.DeleteTimerId(items, this.store); + this.DeleteTimerId(this.SelectedTimer(record), this.store); } ,DeleteTimerId : function( items,store ) { if(items.length <= 0) @@ -547,6 +619,15 @@ Ext.xxv.NowPreview = function(viewer,store) { this.gridNow.EditTimer(this.gridNow.getSelectionModel().getSelected(), this.updateTimer, this); } },{ + id:'tt', + tooltip: Ext.xxv.NowGrid.prototype.szToggleTimer, + iconCls: 'timer-toggle-icon', + disabled:true, + scope: viewer, + handler: function(){ + this.gridNow.ToggleTimer(this.gridNow.getSelectionModel().getSelected(), this.updateTimer, this); + } + },{ id:'td', tooltip: Ext.xxv.NowGrid.prototype.szDeleteTimer, iconCls: 'timer-delete-icon', diff --git a/skins/jason/program.js b/skins/jason/program.js index 669ca80..55bb729 100644 --- a/skins/jason/program.js +++ b/skins/jason/program.js @@ -163,7 +163,7 @@ Ext.extend(Ext.xxv.programGrid, Ext.grid.GridPanel, { ,scope:this ,disabled: true ,handler: function(){ this.viewer.searchTab(this.ctxRecord); } - },{ + },'-',{ itemId:'tn' ,text: this.szRecord ,iconCls: 'record-icon' @@ -178,6 +178,13 @@ Ext.extend(Ext.xxv.programGrid, Ext.grid.GridPanel, { ,disabled: true ,handler: function() { this.EditTimer(this.ctxRecord); } },{ + itemId:'tt' + ,text: this.viewer.gridNow.szToggleTimer + ,iconCls: 'timer-toggle-icon' + ,scope:this + ,disabled: true + ,handler: function() { this.ToggleTimer(this.ctxRecord); } + },{ itemId:'td' ,text: this.viewer.gridNow.szDeleteTimer ,iconCls: 'timer-delete-icon' @@ -202,6 +209,7 @@ Ext.extend(Ext.xxv.programGrid, Ext.grid.GridPanel, { if(items) { items.eachKey(function(key, f) { if(f.itemId == 'tn') { if(timerid) f.hide(); else f.show(); } else if(f.itemId == 'te') { if(timerid) f.show(); else f.hide(); } + else if(f.itemId == 'tt') { if(timerid) f.show(); else f.hide(); } else if(f.itemId == 'td') { if(timerid) f.show(); else f.hide(); } if(XXV.help.cmdAllowed(f.itemId)) f.enable(); @@ -267,7 +275,7 @@ Ext.extend(Ext.xxv.programGrid, Ext.grid.GridPanel, { ,EditTimer : function(record) { this.viewer.gridNow.EditTimer(record, this.updateTimer, this); } - ,DeleteTimer : function(record) { + ,SelectedTimer : function(record) { var gsm = this.getSelectionModel(); var sel = gsm.getSelections(); if(sel.length <= 0) { @@ -276,14 +284,20 @@ Ext.extend(Ext.xxv.programGrid, Ext.grid.GridPanel, { } var items = ""; for(var i = 0, len = sel.length; i < len; i++){ - if(i !== 0) + if(i) items += ','; - if(sel[i].data.timerid === 0) { + if(!sel[i].data.timerid) { continue; } items += sel[i].data.timerid; } - this.viewer.gridNow.DeleteTimerId(items, this.store); + return items; + } + ,ToggleTimer : function(record) { + this.viewer.gridNow.ToggleTimerId(this.SelectedTimer(record), this.store); + } + ,DeleteTimer : function(record) { + this.viewer.gridNow.DeleteTimerId(this.SelectedTimer(record), this.store); } }); @@ -318,6 +332,15 @@ Ext.xxv.programPreview = function(viewer,store) { this.gridProgram.EditTimer(this.gridProgram.getSelectionModel().getSelected()); } },{ + id:'tt', + tooltip: Ext.xxv.NowGrid.prototype.szToggleTimer, + iconCls: 'timer-toggle-icon', + disabled:true, + scope: viewer, + handler: function(){ + this.gridProgram.ToggleTimer(this.gridProgram.getSelectionModel().getSelected()); + } + },{ id:'td', tooltip: Ext.xxv.NowGrid.prototype.szDeleteTimer, iconCls: 'timer-delete-icon', |
