From: Edward Date: Thu, 8 May 2014 09:24:18 +0000 (+0800) Subject: Pman.Dialog.CoreAutoSavePreview.bjs X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=af3ad041f5d39708ec9023b884c10318a92aa1e7 Pman.Dialog.CoreAutoSavePreview.bjs Pman.Dialog.CoreAutoSavePreview.js --- diff --git a/Pman.Dialog.CoreAutoSavePreview.bjs b/Pman.Dialog.CoreAutoSavePreview.bjs index 16105c2e..0912cf37 100644 --- a/Pman.Dialog.CoreAutoSavePreview.bjs +++ b/Pman.Dialog.CoreAutoSavePreview.bjs @@ -109,6 +109,249 @@ } ] }, + { + "|xns": "Roo", + "xtype": "GridPanel", + "title": "Images", + "fitToframe": true, + "fitContainer": true, + "tableName": "Images", + "background": true, + "region": "center", + "listeners": { + "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" + }, + "items": [ + { + "*prop": "grid", + "xtype": "Grid", + "autoExpandColumn": "filename", + "loadMask": true, + "listeners": { + "|render": "function() \n{\n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}", + "|rowdblclick": "function (_self, rowIndex, e)\n{\n if (!_this.dialog) return;\n _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n _this.grid.footer.onClick('first');\n }); \n}\n" + }, + "|xns": "Roo.grid", + "items": [ + { + "*prop": "dataSource", + "xtype": "Store", + "remoteSort": true, + "|sortInfo": "{ field : 'filename', direction: 'ASC' }", + "|xns": "Roo.data", + "items": [ + { + "*prop": "proxy", + "xtype": "HttpProxy", + "method": "GET", + "|url": "baseURL + '/Roo/Images.php'", + "|xns": "Roo.data" + }, + { + "|xns": "Roo.data", + "xtype": "JsonReader", + "totalProperty": "total", + "root": "data", + "*prop": "reader", + "id": "id", + "|fields": "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'filename',\n 'type': 'string'\n },\n {\n 'name': 'ontable',\n 'type': 'string'\n },\n {\n 'name': 'onid',\n 'type': 'int'\n },\n {\n 'name': 'mimetype',\n 'type': 'string'\n },\n {\n 'name': 'width',\n 'type': 'int'\n },\n {\n 'name': 'height',\n 'type': 'int'\n },\n {\n 'name': 'filesize',\n 'type': 'int'\n },\n {\n 'name': 'displayorder',\n 'type': 'int'\n },\n {\n 'name': 'language',\n 'type': 'string'\n },\n {\n 'name': 'parent_image_id',\n 'type': 'int'\n },\n {\n 'name': 'created',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'imgtype',\n 'type': 'string'\n },\n {\n 'name': 'linkurl',\n 'type': 'string'\n },\n {\n 'name': 'descript',\n 'type': 'string'\n },\n {\n 'name': 'title',\n 'type': 'string'\n },\n {\n 'name': 'parent_image_id_id',\n 'type': 'int'\n },\n {\n 'name': 'parent_image_id_filename',\n 'type': 'string'\n },\n {\n 'name': 'parent_image_id_ontable',\n 'type': 'string'\n },\n {\n 'name': 'parent_image_id_onid',\n 'type': 'int'\n },\n {\n 'name': 'parent_image_id_mimetype',\n 'type': 'string'\n },\n {\n 'name': 'parent_image_id_width',\n 'type': 'int'\n },\n {\n 'name': 'parent_image_id_height',\n 'type': 'int'\n },\n {\n 'name': 'parent_image_id_filesize',\n 'type': 'int'\n },\n {\n 'name': 'parent_image_id_displayorder',\n 'type': 'int'\n },\n {\n 'name': 'parent_image_id_language',\n 'type': 'string'\n },\n {\n 'name': 'parent_image_id_parent_image_id',\n 'type': 'int'\n },\n {\n 'name': 'parent_image_id_created',\n 'type': 'date'\n },\n {\n 'name': 'parent_image_id_imgtype',\n 'type': 'string'\n },\n {\n 'name': 'parent_image_id_linkurl',\n 'type': 'string'\n },\n {\n 'name': 'parent_image_id_descript',\n 'type': 'string'\n },\n {\n 'name': 'parent_image_id_title',\n 'type': 'string'\n }\n]" + } + ] + }, + { + "*prop": "footer", + "xtype": "PagingToolbar", + "pageSize": 25, + "displayInfo": true, + "displayMsg": "Displaying Images{0} - {1} of {2}", + "emptyMsg": "No Images found", + "|xns": "Roo" + }, + { + "*prop": "toolbar", + "xtype": "Toolbar", + "|xns": "Roo", + "items": [ + { + "text": "Add", + "xtype": "Button", + "cls": "x-btn-text-icon", + "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'", + "listeners": { + "|click": "function()\n{\n if (!_this.dialog) return;\n _this.dialog.show( { id : 0 } , function() {\n _this.grid.footer.onClick('first');\n }); \n}\n" + }, + "|xns": "Roo.Toolbar" + }, + { + "text": "Edit", + "xtype": "Button", + "cls": "x-btn-text-icon", + "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'", + "listeners": { + "|click": "function()\n{\n var s = _this.grid.getSelectionModel().getSelections();\n if (!s.length || (s.length > 1)) {\n Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n return;\n }\n if (!_this.dialog) return;\n _this.dialog.show(s[0].data, function() {\n _this.grid.footer.onClick('first');\n }); \n \n}\n" + }, + "|xns": "Roo.Toolbar" + }, + { + "text": "Delete", + "cls": "x-btn-text-icon", + "|icon": "rootURL + '/Pman/templates/images/trash.gif'", + "xtype": "Button", + "listeners": { + "|click": "function()\n{\n Pman.genericDelete(_this, 'Images'); \n}\n " + }, + "|xns": "Roo.Toolbar" + } + ] + }, + { + "xtype": "ColumnModel", + "header": "Id", + "width": 75, + "dataIndex": "id", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Filename", + "width": 200, + "dataIndex": "filename", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Ontable", + "width": 200, + "dataIndex": "ontable", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Onid", + "width": 75, + "dataIndex": "onid", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Mimetype", + "width": 200, + "dataIndex": "mimetype", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Width", + "width": 75, + "dataIndex": "width", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Height", + "width": 75, + "dataIndex": "height", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Filesize", + "width": 75, + "dataIndex": "filesize", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Displayorder", + "width": 75, + "dataIndex": "displayorder", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Language", + "width": 200, + "dataIndex": "language", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Parent image", + "width": 75, + "dataIndex": "parent_image_id", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Created", + "width": 75, + "dataIndex": "created", + "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Imgtype", + "width": 200, + "dataIndex": "imgtype", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Linkurl", + "width": 200, + "dataIndex": "linkurl", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Descript", + "width": 200, + "dataIndex": "descript", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + }, + { + "xtype": "ColumnModel", + "header": "Title", + "width": 200, + "dataIndex": "title", + "|renderer": "function(v) { return String.format('{0}', v); }", + "|xns": "Roo.grid", + "*prop": "colModel[]" + } + ] + } + ] + }, { "listeners": { "render": "function (_self)\n{\n _this.viewPanel = _self;\n}" diff --git a/Pman.Dialog.CoreAutoSavePreview.js b/Pman.Dialog.CoreAutoSavePreview.js index 9609878e..c5af4a06 100644 --- a/Pman.Dialog.CoreAutoSavePreview.js +++ b/Pman.Dialog.CoreAutoSavePreview.js @@ -245,6 +245,392 @@ Pman.Dialog.CoreAutoSavePreview = { ] } }, + { + xtype: 'GridPanel', + xns: Roo, + title : "Images", + fitToframe : true, + fitContainer : true, + tableName : 'Images', + background : true, + region : 'center', + listeners : { + activate : function() { + _this.panel = this; + if (_this.grid) { + _this.grid.footer.onClick('first'); + } + } + }, + grid : { + xtype: 'Grid', + xns: Roo.grid, + autoExpandColumn : 'filename', + loadMask : true, + listeners : { + render : function() + { + _this.grid = this; + //_this.dialog = Pman.Dialog.FILL_IN + if (_this.panel.active) { + this.footer.onClick('first'); + } + }, + rowdblclick : function (_self, rowIndex, e) + { + if (!_this.dialog) return; + _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() { + _this.grid.footer.onClick('first'); + }); + } + }, + dataSource : { + xtype: 'Store', + xns: Roo.data, + remoteSort : true, + sortInfo : { field : 'filename', direction: 'ASC' }, + proxy : { + xtype: 'HttpProxy', + xns: Roo.data, + method : 'GET', + url : baseURL + '/Roo/Images.php' + }, + reader : { + xtype: 'JsonReader', + xns: Roo.data, + totalProperty : 'total', + root : 'data', + id : 'id', + fields : [ + { + 'name': 'id', + 'type': 'int' + }, + { + 'name': 'filename', + 'type': 'string' + }, + { + 'name': 'ontable', + 'type': 'string' + }, + { + 'name': 'onid', + 'type': 'int' + }, + { + 'name': 'mimetype', + 'type': 'string' + }, + { + 'name': 'width', + 'type': 'int' + }, + { + 'name': 'height', + 'type': 'int' + }, + { + 'name': 'filesize', + 'type': 'int' + }, + { + 'name': 'displayorder', + 'type': 'int' + }, + { + 'name': 'language', + 'type': 'string' + }, + { + 'name': 'parent_image_id', + 'type': 'int' + }, + { + 'name': 'created', + 'type': 'date', + 'dateFormat': 'Y-m-d' + }, + { + 'name': 'imgtype', + 'type': 'string' + }, + { + 'name': 'linkurl', + 'type': 'string' + }, + { + 'name': 'descript', + 'type': 'string' + }, + { + 'name': 'title', + 'type': 'string' + }, + { + 'name': 'parent_image_id_id', + 'type': 'int' + }, + { + 'name': 'parent_image_id_filename', + 'type': 'string' + }, + { + 'name': 'parent_image_id_ontable', + 'type': 'string' + }, + { + 'name': 'parent_image_id_onid', + 'type': 'int' + }, + { + 'name': 'parent_image_id_mimetype', + 'type': 'string' + }, + { + 'name': 'parent_image_id_width', + 'type': 'int' + }, + { + 'name': 'parent_image_id_height', + 'type': 'int' + }, + { + 'name': 'parent_image_id_filesize', + 'type': 'int' + }, + { + 'name': 'parent_image_id_displayorder', + 'type': 'int' + }, + { + 'name': 'parent_image_id_language', + 'type': 'string' + }, + { + 'name': 'parent_image_id_parent_image_id', + 'type': 'int' + }, + { + 'name': 'parent_image_id_created', + 'type': 'date' + }, + { + 'name': 'parent_image_id_imgtype', + 'type': 'string' + }, + { + 'name': 'parent_image_id_linkurl', + 'type': 'string' + }, + { + 'name': 'parent_image_id_descript', + 'type': 'string' + }, + { + 'name': 'parent_image_id_title', + 'type': 'string' + } + ] + } + }, + footer : { + xtype: 'PagingToolbar', + xns: Roo, + pageSize : 25, + displayInfo : true, + displayMsg : "Displaying Images{0} - {1} of {2}", + emptyMsg : "No Images found" + }, + toolbar : { + xtype: 'Toolbar', + xns: Roo, + items : [ + { + xtype: 'Button', + xns: Roo.Toolbar, + text : "Add", + cls : 'x-btn-text-icon', + icon : Roo.rootURL + 'images/default/dd/drop-add.gif', + listeners : { + click : function() + { + if (!_this.dialog) return; + _this.dialog.show( { id : 0 } , function() { + _this.grid.footer.onClick('first'); + }); + } + } + }, + { + xtype: 'Button', + xns: Roo.Toolbar, + text : "Edit", + cls : 'x-btn-text-icon', + icon : Roo.rootURL + 'images/default/tree/leaf.gif', + listeners : { + click : function() + { + var s = _this.grid.getSelectionModel().getSelections(); + if (!s.length || (s.length > 1)) { + Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row"); + return; + } + if (!_this.dialog) return; + _this.dialog.show(s[0].data, function() { + _this.grid.footer.onClick('first'); + }); + + } + } + }, + { + xtype: 'Button', + xns: Roo.Toolbar, + text : "Delete", + cls : 'x-btn-text-icon', + icon : rootURL + '/Pman/templates/images/trash.gif', + listeners : { + click : function() + { + Pman.genericDelete(_this, 'Images'); + } + } + } + ] + }, + colModel : [ + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Id', + width : 75, + dataIndex : 'id', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Filename', + width : 200, + dataIndex : 'filename', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Ontable', + width : 200, + dataIndex : 'ontable', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Onid', + width : 75, + dataIndex : 'onid', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Mimetype', + width : 200, + dataIndex : 'mimetype', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Width', + width : 75, + dataIndex : 'width', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Height', + width : 75, + dataIndex : 'height', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Filesize', + width : 75, + dataIndex : 'filesize', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Displayorder', + width : 75, + dataIndex : 'displayorder', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Language', + width : 200, + dataIndex : 'language', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Parent image', + width : 75, + dataIndex : 'parent_image_id', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Created', + width : 75, + dataIndex : 'created', + renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Imgtype', + width : 200, + dataIndex : 'imgtype', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Linkurl', + width : 200, + dataIndex : 'linkurl', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Descript', + width : 200, + dataIndex : 'descript', + renderer : function(v) { return String.format('{0}', v); } + }, + { + xtype: 'ColumnModel', + xns: Roo.grid, + header : 'Title', + width : 200, + dataIndex : 'title', + renderer : function(v) { return String.format('{0}', v); } + } + ] + } + }, { xtype: 'ContentPanel', xns: Roo,