diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2009-01-02 12:59:49 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2009-01-02 12:59:49 +0000 |
| commit | 905a050ef9a1dbe743a9cb5b39695d6c8dbde61c (patch) | |
| tree | af8d6650c2a83431d660bddadb8157db284aab97 | |
| parent | 196f1c98f8887828a7e5aea7ab676d2390c44ea4 (diff) | |
| download | xxv-905a050ef9a1dbe743a9cb5b39695d6c8dbde61c.tar.gz xxv-905a050ef9a1dbe743a9cb5b39695d6c8dbde61c.tar.bz2 | |
* jason : add movetimers
| -rw-r--r-- | skins/jason/files.lst | 1 | ||||
| -rw-r--r-- | skins/jason/jason.css | 1 | ||||
| -rw-r--r-- | skins/jason/locale/lang-de.js | 18 | ||||
| -rw-r--r-- | skins/jason/menus.js | 4 | ||||
| -rw-r--r-- | skins/jason/movetimers.js | 293 | ||||
| -rw-r--r-- | skins/jason/pic/movetimers.png | bin | 0 -> 966 bytes | |||
| -rw-r--r-- | skins/jason/tabpanel.js | 8 | ||||
| -rw-r--r-- | skins/jason/timers.js | 81 |
8 files changed, 365 insertions, 41 deletions
diff --git a/skins/jason/files.lst b/skins/jason/files.lst index 561299a..222df29 100644 --- a/skins/jason/files.lst +++ b/skins/jason/files.lst @@ -19,6 +19,7 @@ now.js \ program.js \ search.js \ timers.js \ +movetimers.js \ autotimers.js \ recordings.js \ chronicle.js \ diff --git a/skins/jason/jason.css b/skins/jason/jason.css index 1885817..be4da30 100644 --- a/skins/jason/jason.css +++ b/skins/jason/jason.css @@ -104,6 +104,7 @@ display:none; .remote-icon { background-image:url(pic/remote.png) !important; } .monitor-icon { background-image:url(pic/monitor.png) !important; } .setup-icon { background-image:url(pic/setup.png) !important; } +.movetimers-icon { background-image:url(pic/movetimers.png) !important; } .vdr-icon { background-image:url(pic/vdr-logo.png) !important; } .users-icon { background-image:url(pic/users.png) !important; } .view-icon { background-image:url(pic/preview.png) !important; } diff --git a/skins/jason/locale/lang-de.js b/skins/jason/locale/lang-de.js index 176c445..1956598 100644 --- a/skins/jason/locale/lang-de.js +++ b/skins/jason/locale/lang-de.js @@ -158,9 +158,9 @@ Ext.xxv.searchGrid.prototype.szLoadException = "Konnte keine Wiederholung finden Ext.xxv.timerGrid.prototype.szTitle = "Timer"; Ext.xxv.timerGrid.prototype.szFindReRun = "Suche Wiederholung"; Ext.xxv.timerGrid.prototype.szNew = "Neuen Timer anlegen"; -Ext.xxv.timerGrid.prototype.szEdit = "Timer bearbeiten"; -Ext.xxv.timerGrid.prototype.szDelete = "Löschen der Timer"; -Ext.xxv.timerGrid.prototype.szToggle = "De- bzw. Aktivieren der Timer"; +Ext.xxv.timerGrid.prototype.szEdit = "Bearbeiten"; +Ext.xxv.timerGrid.prototype.szDelete = "Löschen"; +Ext.xxv.timerGrid.prototype.szToggle = "De- bzw. Aktivieren"; Ext.xxv.timerGrid.prototype.szColTitle = "Titel";
Ext.xxv.timerGrid.prototype.szColActive = "Aktiv";
Ext.xxv.timerGrid.prototype.szColPDC = "VPS";
@@ -180,6 +180,18 @@ Ext.xxv.timerPreview.prototype.szFindReRun = "Suche Wiederholung"; Ext.xxv.timerPreview.prototype.szEdit = "Bearbeiten"; Ext.xxv.timerPreview.prototype.szDelete = "Löschen"; +Ext.xxv.movetimersGrid.prototype.szTitle = "Regeln zum Verschieben von Timern"; +Ext.xxv.movetimersGrid.prototype.szNew = "Neu"; +Ext.xxv.movetimersGrid.prototype.szEdit = "Bearbeiten"; +Ext.xxv.movetimersGrid.prototype.szDelete = "Löschen"; +Ext.xxv.movetimersGrid.prototype.szColSource = "Quelle"; +Ext.xxv.movetimersGrid.prototype.szColDestination = "Ziel"; +Ext.xxv.movetimersGrid.prototype.szColMove = "Verschieben von Timern"; +Ext.xxv.movetimersGrid.prototype.szColOriginal = "Verändere Original"; +Ext.xxv.movetimersGrid.prototype.szLoadException = "Konnte keine Daten über Regel zum Verschieben von Timern holen!\r\n{0}"; +Ext.xxv.movetimersGrid.prototype.szDeleteSuccess = "Regel zum Verschieben von Timern erfolgreich gelöscht.\r\n{0}"; +Ext.xxv.movetimersGrid.prototype.szDeleteFailure = "Konnte Regel zum Verschieben von Timern nicht löschen!\r\n{0}"; + Ext.xxv.vdrGrid.prototype.szTitle = "Video Disk Rekorder"; Ext.xxv.vdrGrid.prototype.szEdit = "Bearbeiten"; Ext.xxv.vdrGrid.prototype.szDelete = "Löschen"; diff --git a/skins/jason/menus.js b/skins/jason/menus.js index b3daf54..d97406c 100644 --- a/skins/jason/menus.js +++ b/skins/jason/menus.js @@ -52,6 +52,10 @@ Ext.xxv.MainMenu = function(/*config*/){ ,iconCls: 'setup-icon'
,menu: XXV.configMenu },'-',{ + text: Ext.xxv.movetimersGrid.prototype.szTitle, + handler: function() { XXV.tab.MoveTimers(); }, + iconCls:"movetimers-icon" + },{ text: Ext.xxv.vdrGrid.prototype.szTitle, handler: function() { XXV.tab.openVDRList(); }, iconCls:"vdr-icon" diff --git a/skins/jason/movetimers.js b/skins/jason/movetimers.js new file mode 100644 index 0000000..a075694 --- /dev/null +++ b/skins/jason/movetimers.js @@ -0,0 +1,293 @@ +/*
+ * jason - Javascript based skin for xxv
+ * Copyright(c) 2008-2009, anbr
+ *
+ * http://xxv.berlios.de/ + * + * $Id$ + */ + +Ext.xxv.movetimersStore = function() { + + // create the data store + return new Ext.data.Store({ + baseParams:{cmd:'mtl'} + ,autoLoad:{params:{start:0, limit:configuration.pageSize}} + ,reader: new Ext.xxv.jsonReader({
+ fields: [
+ {name: 'id', type: 'int'}, + {name: 'source', type: 'string'}, + {name: 'destination', type: 'string'}, + {name: 'move', type: 'string'}, + {name: 'original', type: 'string'}
+ ] + }) + ,proxy : new Ext.data.HttpProxy({
+ url: XXV.help.baseURL()
+ ,method: 'GET'
+ }) + ,sortInfo:{field:'source', direction:'ASC'} + }); +}; + +Ext.xxv.movetimersGrid = function(viewer) {
+ this.viewer = viewer;
+ //Ext.apply(this, {}); // Apply config
+ + // create the data store + this.store = new Ext.xxv.movetimersStore(); + this.store.setDefaultSort('source', "ASC"); + + this.columns = [ + {
+ header: this.szColSource
+ ,dataIndex: 'source'
+ ,width: 200 + }, + {
header: this.szColDestination
+ ,dataIndex: 'destination'
+ ,width: 200 + }, + {
header: this.szColMove
+ ,dataIndex: 'move'
+ ,width: 200 + }, + {
header: this.szColOriginal
+ ,dataIndex: 'original'
+ ,width: 200 + }, + ];
+ + var cm = new Ext.grid.ColumnModel(this.columns); + cm.defaultSortable = true; + + Ext.xxv.movetimersGrid.superclass.constructor.call(this, {
+ region: 'center'
+ ,id: 'movetimers-view-grid'
+ ,loadMask: true + ,clicksToEdit:1 + ,cm: cm + ,sm: new Ext.grid.RowSelectionModel({
+ singleSelect:false
+ }) + ,tbar:new Ext.PagingToolbar({ + pageSize: this.store.autoLoad.params.limit + ,store: this.store + ,displayInfo: true + ,items: [ + {
+ id:'mtc'
+ ,iconCls: 'new-icon'
+// ,text: this.szNew
+ ,scope: this
+ ,disabled:false
+ ,handler: function(){ this.EditItem(null); }
+ } + ]}) + }); + + this.store.on({
+ 'load' : this.onLoad
+ ,'loadexception' : this.onLoadException
+ ,scope:this
+ }); + + this.on('rowcontextmenu', this.onContextClick, this); + this.on('rowdblclick', this.onEditItem, this);
+}; + +Ext.extend(Ext.xxv.movetimersGrid, Ext.grid.EditorGridPanel, { + + szTitle : "Rules to move timers" + ,szNew : "New" + ,szEdit : "Edit" + ,szDelete : "Delete" + ,szColSource : "Source" + ,szColDestination: "Destination" + ,szColMove : "Move timer" + ,szColOriginal : "Change original timer" + ,szLoadException : "Couldn't get data about rule to move timer!\r\n{0}" + ,szDeleteSuccess : "Rule to move timer deleted successful.\r\n{0}" + ,szDeleteFailure : "Couldn't delete rule to move timer!\r\n{0}" + + ,stateful: true + + ,onLoadException : function( scope, o, arg, e) { + new Ext.xxv.MessageBox().msgFailure(this.szLoadException, e); + } + ,onLoad : function( store, records, opt ) { + this.getSelectionModel().selectFirstRow(); + this.ownerCt.SetPanelTitle(this.szTitle); + } + ,onContextClick : function(grid, index, e){
+ if(!this.menu){ // create context menu on first right click
+ this.menu = new Ext.menu.Menu({
+ id:'grid-ctx',
+ items: [{
+ id:'mte'
+ ,text: this.szEdit
+ ,iconCls: 'edit-icon'
+ ,scope:this
+ ,disabled: true + ,handler: function() { this.EditItem(this.ctxRecord); } + },{
+ id:'mtd'
+ ,text: this.szDelete
+ ,iconCls: 'delete-icon'
+ ,scope:this
+ ,disabled: true + ,handler: function() { this.DeleteItem(this.ctxRecord); }
+ } + ]
+ });
+ this.menu.on('hide', this.onContextHide, this);
+ }
+ e.stopEvent();
+ if(this.ctxRow){
+ Ext.fly(this.ctxRow).removeClass('x-node-ctx');
+ this.ctxRow = null;
+ }
+ this.ctxRow = this.view.getRow(index);
+ this.ctxRecord = this.store.getAt(index);
+ Ext.fly(this.ctxRow).addClass('x-node-ctx');
+ + var items = this.menu.items;
+ if(items) { items.eachKey(function(key, f) { + if(XXV.help.cmdAllowed(key)) f.enable(); + },items); } + + this.menu.showAt(e.getXY());
+ }
+ ,onContextHide : function(){
+ if(this.ctxRow){
+ Ext.fly(this.ctxRow).removeClass('x-node-ctx');
+ this.ctxRow = null;
+ }
+ } + /******************************************************************************/ + ,onDeleteSuccess : function( response,options ) + { + this.loadMask.hide(); + + var o = eval("("+response.responseText+")");
+ + if(o && o.data && typeof(o.data) == 'string' + && o.param && o.param.state && o.param.state == 'success') { + new Ext.xxv.MessageBox().msgSuccess(this.szDeleteSuccess, o.data); + + var gsm = this.getSelectionModel(); + var sel = options.params.data.split(","); + sel.reverse(); + for(var i = 0, len = sel.length; i < len; i++){ + if(gsm.isIdSelected(sel[i])) { + if(gsm.hasPrevious()) { + gsm.selectPrevious(); + } else { + gsm.selectNext(); + } + } + var record = this.store.getById(sel[i]); + this.store.remove(record); + } + } else { + var msg = ''; + if(o && o.data && typeof(o.data) == 'string') { + msg = o.data; + } + new Ext.xxv.MessageBox().msgFailure(this.szDeleteFailure, msg); + } + } + + ,onDeleteFailure : function( response,options ) + { + this.loadMask.hide(); + new Ext.xxv.MessageBox().msgFailure(this.szDeleteFailure, response.statusText); + } + + ,DeleteItem : function( record ) { + this.stopEditing();
+ this.loadMask.show(); + + var gsm = this.getSelectionModel(); + var sel = gsm.getSelections() + if(sel.length <= 0) { + gsm.selectRecords([record]); + sel.push(record); + } + var todel = ""; + for(var i = 0, len = sel.length; i < len; i++){ + if(i != 0) + todel += ','; + todel += sel[i].data.id; + } + Ext.Ajax.request({ + scope: this + ,url: XXV.help.cmdAJAX('mtd') + ,timeout: 15000 + ,success: this.onDeleteSuccess + ,failure: this.onDeleteFailure + ,params:{ data: todel } + }); + } + + /******************************************************************************/ + ,EditItem : function( record ) { + this.stopEditing(); + var item; + + if(record != null) {
+ var gsmTimer = this.getSelectionModel(); + gsmTimer.selectRecords([record]); + + item = { + cmd: 'mte' + ,id: record.data.id + ,title: record.data.source + }; + } else { + item = { + cmd: 'mtc' + ,id: 0 + ,title: this.szNew + }; + } + + if(this.viewer.formwin){ + this.viewer.formwin.close();
+ }
+ this.viewer.formwin = new Ext.xxv.Question(item,this.store);
+ }, + onEditItem : function(grid, index, e) { + e.stopEvent();
+ if(this.ctxRow){
+ Ext.fly(this.ctxRow).removeClass('x-node-ctx');
+ this.ctxRow = null;
+ }
+ var record = this.store.getAt(index); + this.EditItem(record); + }
+}); + +function createMoveTimersView(viewer,id) { + + viewer.gridMoveTimers = new Ext.xxv.movetimersGrid(viewer); + + tab = new Ext.xxv.Panel({
+ id: id, + iconCls:"movetimers-icon", + closable:true,
+ border:false, + layout:'border', + stateful:true,
+ hideMode:'offsets',
+ items:[
+ viewer.gridMoveTimers + ]
+ });
+ + + viewer.add(tab); + + return tab; +} + diff --git a/skins/jason/pic/movetimers.png b/skins/jason/pic/movetimers.png Binary files differnew file mode 100644 index 0000000..30a3fbc --- /dev/null +++ b/skins/jason/pic/movetimers.png diff --git a/skins/jason/tabpanel.js b/skins/jason/tabpanel.js index 71e4df2..358b538 100644 --- a/skins/jason/tabpanel.js +++ b/skins/jason/tabpanel.js @@ -193,6 +193,14 @@ Ext.extend(Ext.xxv.tabPanel, Ext.TabPanel, { if(!id) return; this.gridNow.RecordID(id); } + ,MoveTimers : function(){
+ var id = 'mtl';
+ var tab;
+ if(!(tab = this.getItem(id))){ + tab = createMoveTimersView(this,id); + } + this.setActiveTab(tab);
+ } ,openVDRList : function(){
var id = 'vl';
var tab;
diff --git a/skins/jason/timers.js b/skins/jason/timers.js index 175ed6e..6453ee1 100644 --- a/skins/jason/timers.js +++ b/skins/jason/timers.js @@ -15,21 +15,22 @@ Ext.xxv.timerStore = function() { ,autoLoad:{params:{start:0, limit:configuration.pageSize}} ,reader: new Ext.xxv.jsonReader({
fields: [
- {name: 'id', type: 'string'}, - {name: 'flags', type: 'int'}, - {name: 'channel', type: 'string'},
- {name: 'pos', type: 'string'},
- {name: 'day', type:'date', dateFormat:'timestamp'},
- {name: 'start', type: 'string'},
- {name: 'stop', type: 'string'},
- {name: 'title', type: 'string'},
- {name: 'priority', type: 'int'},
- {name: 'collision', type: 'string'}, - {name: 'eventid', type: 'int'}, - {name: 'autotimerid', type: 'int'}, - {name: 'duration', type: 'int'}, - {name: 'description', type: 'string'}, - {name: 'running', type: 'bool'} + {name: 'id', type: 'string'} + ,{name: 'flags', type: 'int'} + ,{name: 'channel', type: 'string'}
+ ,{name: 'pos', type: 'string'}
+ ,{name: 'day', type:'date', dateFormat:'timestamp'}
+ ,{name: 'start', type: 'string'}
+ ,{name: 'stop', type: 'string'}
+ ,{name: 'title', type: 'string'}
+ ,{name: 'priority', type: 'int'}
+ ,{name: 'collision', type: 'string'} + ,{name: 'eventid', type: 'int'} + ,{name: 'autotimerid', type: 'int'} + ,{name: 'duration', type: 'int'} + ,{name: 'description', type: 'string'} + ,{name: 'running', type: 'bool'} + ,{name: 'host', type: 'string'} ] }) ,proxy : new Ext.data.HttpProxy({
@@ -102,38 +103,41 @@ Ext.xxv.timerGrid = function(viewer) { this.columns = [ {
- header: this.szColTitle,
- dataIndex: 'title',
- width: 150, - renderer: this.formatTitle,
- editor: new Ext.form.TextField({allowBlank: false}) + header: this.szColTitle
+ ,dataIndex: 'title'
+ ,width: 150 + ,renderer: this.formatTitle
+ //,editor: new Ext.form.TextField({allowBlank: false}) }, this.activeColumn,
this.vpsColumn, this.ChannelsCombo,
{
- header: this.szColDay,
- dataIndex: 'day',
- width: 50,
- renderer: Ext.util.Format.dateRenderer(this.szColDayFormat),
- editor: new Ext.form.DateField({
- minValue: Ext.util.Format.date(new Date()) - }), - hidden: true + header: this.szColDay
+ ,dataIndex: 'day'
+ ,width: 50
+ ,renderer: Ext.util.Format.dateRenderer(this.szColDayFormat)
+ //,editor: new Ext.form.DateField({ minValue: Ext.util.Format.date(new Date()) }) + ,hidden: true },{
- header: this.szColStart,
- dataIndex: 'start',
- width: 50, - editor: new Ext.form.TimeField()
+ header: this.szColStart
+ ,dataIndex: 'start'
+ ,width: 50 + //,editor: new Ext.form.TimeField()
},{
- header: this.szColStop,
- dataIndex: 'stop',
- width: 50,
- editor: new Ext.form.TimeField()
+ header: this.szColStop
+ ,dataIndex: 'stop'
+ ,width: 50
+ //,editor: new Ext.form.TimeField()
+ },{
+ header: this.szHost
+ ,dataIndex: 'host'
+ ,width: 190
+ ,hidden: true
}
];
var cm = new Ext.grid.ColumnModel(this.columns); - cm.defaultSortable = true; + cm.defaultSortable = false; Ext.xxv.timerGrid.superclass.constructor.call(this, {
region: 'center'
@@ -193,7 +197,7 @@ Ext.extend(Ext.xxv.timerGrid, Ext.grid.GridPanel, { // Ext.grid.EditorGridPanel ,szNew : "Create new timer" ,szEdit : "Edit timer" ,szDelete : "Delete timer" - ,szToggle : "Enable or disable timer" + ,szToggle : "Enable or disable" ,szColTitle : "Title" ,szColActive : "Active" ,szColPDC : "PDC" @@ -201,6 +205,7 @@ Ext.extend(Ext.xxv.timerGrid, Ext.grid.GridPanel, { // Ext.grid.EditorGridPanel ,szColChannel : "Channel" ,szColStart : "Start"
,szColStop : "Stop" + ,szHost : "Host" ,szColDayFormat : "l, m/d/Y" ,szSelChEmptyText: "Select a channel..."
,szLoadException : "Couldn't get data about timer!\r\n{0}" |
