[dss-commits] r8891 - in dss/trunk: data/webroot/images data/webroot/js websrc/dss-setup-interface/dSS/grid
dss-commits at forum.digitalstrom.org
dss-commits at forum.digitalstrom.org
Fri Nov 6 17:10:39 CET 2009
Author: mfernandez
Date: 2009-11-06 17:10:39 +0100 (Fri, 06 Nov 2009)
New Revision: 8891
Added:
dss/trunk/data/webroot/images/page_white_edit.png
Modified:
dss/trunk/data/webroot/js/dss-setup-interface.js
dss/trunk/websrc/dss-setup-interface/dSS/grid/DevicePanel.js
Log:
Device editing added to device grid
Added a context menu with option to edit device.
Added: dss/trunk/data/webroot/images/page_white_edit.png
===================================================================
--- dss/trunk/data/webroot/images/page_white_edit.png (rev 0)
+++ dss/trunk/data/webroot/images/page_white_edit.png 2009-11-06 16:10:39 UTC (rev 8891)
@@ -0,0 +1,6 @@
+PNG
+
+
+IHDR óÿa gAMA ¯È7é tEXtSoftware Adobe ImageReadyqÉe< üIDAT8ËßKSaÇWEDBÔ
Ðá}a? P3B¨î²]t±+$aA I¨ÅX^¤ns\[sK·p;;gçýìÓû¶±É¦øp¼Ï÷sÞç¼ç±6qt ºwá°`¿ÌÔ°U]ù|^)Jr¹L+Ä:N§sb»¤&èá\.®ëu²Ù,Ld2iIâYBÓøùÖÁÒÔ)vÉð>)¦iR(¬»DÓ4E!J¡Åß°áEYyZÌÊ,ǽM®!a ª*?fH¯> °>ÏƧG¾9ÊQ7¾×Ì&h£Þ³|}+ë¤ý÷©nð
+¶¾Ý$øjïÏ÷øùcMí¨¤}w©ôµ+±ÔU;±}92XͶ$ü¢çÅÑjxów?Yÿ=ÂgÑ~ªÇÚZÌ\¸-¶ý32L>vEìdíÙiÔä/«¦ øeÀ{;Ë÷^D°µtðTúßõ]v¼ë5Jhò.ûA¾·zÆ{Ñþ¬ð®Çõã<N
+Þ ¼Ì%óS,ëì(èï9ÀØÕN\ϱ8sl2ji#íÿÚÍA*2Ó8'ÄߧË
½E&°QÐ!%{çrô;dö?!n,üÈp IEND®B`
\ No newline at end of file
Property changes on: dss/trunk/data/webroot/images/page_white_edit.png
___________________________________________________________________
Added: svn:executable
+ *
Modified: dss/trunk/data/webroot/js/dss-setup-interface.js
===================================================================
--- dss/trunk/data/webroot/js/dss-setup-interface.js 2009-11-06 16:10:36 UTC (rev 8890)
+++ dss/trunk/data/webroot/js/dss-setup-interface.js 2009-11-06 16:10:39 UTC (rev 8891)
@@ -403,10 +403,58 @@
this.on(
'rowcontextmenu',
- function() {
+ function(grid, rowIndex, event) {
+ event.preventDefault();
+ event.stopEvent();
+ if(!this.contextMenu) {
+ this.contextMenu = new Ext.menu.Menu({});
+ } else {
+ this.contextMenu.removeAll();
+ }
+
+ var menuItem = new Ext.menu.Item({
+ text: 'Edit Device',
+ icon: '/images/page_white_edit.png',
+ handler: this.editDevice.createDelegate(this, rowIndex, true)
+ });
+ this.contextMenu.add(menuItem)
+ var xy = event.getXY();
+ this.contextMenu.showAt(xy);
},
this
);
+ },
+ editDevice: function(item, event, rowIndex) {
+ var record = this.getStore().getAt(rowIndex);
+ debugger;
+ Ext.Msg.prompt('Edit device', 'Name:', function(btn, text){
+ if(text !== record.get('name')) {
+ Ext.Ajax.request({
+ url: '/json/device/setName',
+ disableCaching: true,
+ method: "GET",
+ params: { dsid: record.get('id'),
+ newName: text},
+ success: function(result, request) {
+ try {
+ var jsonData = Ext.util.JSON.decode(result.responseText);
+ if(jsonData.ok) {
+ record.set('name', text);
+ record.commit();
+ } else {
+ Ext.MessageBox.alert('Error', 'Could not rename device');
+ }
+ }
+ catch (err) {
+ Ext.MessageBox.alert('Error', 'Could not rename device');
+ }
+ },
+ failure: function(result, request) {
+ Ext.MessageBox.alert('Error', 'Could not rename device');
+ },
+ });
+ }
+ }, this, false, record.get('name'));
}
});
Modified: dss/trunk/websrc/dss-setup-interface/dSS/grid/DevicePanel.js
===================================================================
--- dss/trunk/websrc/dss-setup-interface/dSS/grid/DevicePanel.js 2009-11-06 16:10:36 UTC (rev 8890)
+++ dss/trunk/websrc/dss-setup-interface/dSS/grid/DevicePanel.js 2009-11-06 16:10:39 UTC (rev 8891)
@@ -44,11 +44,57 @@
// exist, like event handling.
this.on(
'rowcontextmenu',
- function() {
- //console.log('rowcontextmenu');
+ function(grid, rowIndex, event) {
+ event.preventDefault();
+ event.stopEvent();
+ if(!this.contextMenu) {
+ this.contextMenu = new Ext.menu.Menu({});
+ } else {
+ this.contextMenu.removeAll();
+ }
+
+ var menuItem = new Ext.menu.Item({
+ text: 'Edit Device',
+ icon: '/images/page_white_edit.png',
+ handler: this.editDevice.createDelegate(this, rowIndex, true)
+ });
+ this.contextMenu.add(menuItem)
+ var xy = event.getXY();
+ this.contextMenu.showAt(xy);
},
this
);
+ },
+ editDevice: function(item, event, rowIndex) {
+ var record = this.getStore().getAt(rowIndex);
+ Ext.Msg.prompt('Edit device', 'Name:', function(btn, text){
+ if(text !== record.get('name')) {
+ Ext.Ajax.request({
+ url: '/json/device/setName',
+ disableCaching: true,
+ method: "GET",
+ params: { dsid: record.get('id'),
+ newName: text},
+ success: function(result, request) {
+ try {
+ var jsonData = Ext.util.JSON.decode(result.responseText);
+ if(jsonData.ok) {
+ record.set('name', text);
+ record.commit();
+ } else {
+ Ext.MessageBox.alert('Error', 'Could not rename device');
+ }
+ }
+ catch (err) {
+ Ext.MessageBox.alert('Error', 'Could not rename device');
+ }
+ },
+ failure: function(result, request) {
+ Ext.MessageBox.alert('Error', 'Could not rename device');
+ },
+ });
+ }
+ }, this, false, record.get('name'));
}
});
More information about the dss-commits
mailing list