From: KH Lau Date: Fri, 1 Sep 2017 02:46:40 +0000 (+0800) Subject: Pman.Dialog.AdminEnumImages.bjs X-Git-Url: http://git.roojs.org/?p=Pman.Admin;a=commitdiff_plain;h=9db97f003087a9d39186b9412d8bb8df0ec0d58e Pman.Dialog.AdminEnumImages.bjs Pman.Dialog.AdminEnumImages.js --- diff --git a/Pman.Dialog.AdminEnumImages.bjs b/Pman.Dialog.AdminEnumImages.bjs index 372f041..b259c6d 100644 --- a/Pman.Dialog.AdminEnumImages.bjs +++ b/Pman.Dialog.AdminEnumImages.bjs @@ -1,168 +1,181 @@ { - "name" : "Pman.Dialog.AdminEnumImages", - "parent" : "", - "title" : "", - "path" : "/home/michael/gitlive/Pman.Admin/Pman.Dialog.AdminEnumImages.bjs", - "permname" : "", - "modOrder" : "001", - "items" : [ + "name" : "Pman.Dialog.AdminEnumImages", + "parent" : "", + "title" : "", + "path" : "/home/khlau/gitlive/web.coba/Pman.Admin/Pman.Dialog.AdminEnumImages.bjs", + "permname" : "", + "modOrder" : "001", + "strings" : { + "0c81971f67c0bd4b33799c5365ec2bf5" : "No Images found", + "5b94af0908e765fe39e4d0e8f9c99ef8" : "Add / Edit Images", + "fff0d600f8a0b5e19e88bfb821dd1157" : "Images", + "ec211f7c20af43e742bf2570c3cb84f9" : "Add", + "0eceeb45861f9585dd7a97a3e36f85c6" : "Created", + "7dce122004969d56ae2e0245cb754d35" : "Edit", + "be53a0541a6d36f6ecb879fa2c584b08" : "Image", + "b78a3223503896721cca1303f776159b" : "Title", + "d3d2e617335f08df83599665eef8a418" : "Close", + "c0ed345ec857c06b31f7e88745c9bc40" : "Displaying Images {0} - {1} of {2}", + "f2a6c498fb90ee345d997f888fce3b18" : "Delete" + }, + "items" : [ + { + "listeners" : { + "show" : "function (_self)\n{\n _this.grid.footer.onClick('first');\n}" + }, + "modal" : true, + "xtype" : "LayoutDialog", + "title" : "Add / Edit Images", + "width" : 900, + "$ xns" : "Roo", + "height" : 500, + "items" : [ + { + "xtype" : "LayoutRegion", + "$ xns" : "Roo", + "* prop" : "center" + }, + { + "listeners" : { + "|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" + }, + "region" : "center", + "fitToframe" : true, + "background" : false, + "title" : "Images", + "xtype" : "GridPanel", + "fitContainer" : true, + "$ xns" : "Roo", + "tableName" : "Images", + "items" : [ + { + "listeners" : { + "|rowdblclick" : "function (_self, rowIndex, e)\n{\n \n var s = _self.getDataSource().getAt(rowIndex);\n Pman.Dialog.PressReleaseImage.show(s.data, function() {\n _this.grid.footer.onClick('first');\n }); \n}", + "|render" : "function() { \n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n //if (_this.panel.active) {\n // this.footer.onClick('first');\n //}\n}" + }, + "autoExpandColumn" : "title", + "xtype" : "Grid", + "loadMask" : true, + "$ xns" : "Roo.grid", + "* prop" : "grid", + "items" : [ { - "listeners" : { - "show" : "function (_self)\n{\n _this.grid.footer.onClick('first');\n}" - }, - "modal" : true, - "title" : "Add / Edit Images", - "xtype" : "LayoutDialog", - "width" : 900, - "$ xns" : "Roo", - "height" : 500, - "items" : [ - { - "xtype" : "LayoutRegion", - "$ xns" : "Roo", - "* prop" : "center" - }, - { - "listeners" : { - "|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" - }, - "fitToframe" : true, - "background" : false, - "region" : "center", - "title" : "Images", - "xtype" : "GridPanel", - "fitContainer" : true, - "$ xns" : "Roo", - "tableName" : "Images", - "items" : [ - { - "listeners" : { - "|rowdblclick" : "function (_self, rowIndex, e)\n{\n \n var s = _self.getDataSource().getAt(rowIndex);\n Pman.Dialog.PressReleaseImage.show(s.data, function() {\n _this.grid.footer.onClick('first');\n }); \n}", - "|render" : "function() { \n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n //if (_this.panel.active) {\n // this.footer.onClick('first');\n //}\n}" - }, - "autoExpandColumn" : "title", - "xtype" : "Grid", - "loadMask" : true, - "$ xns" : "Roo.grid", - "* prop" : "grid", - "items" : [ - { - "listeners" : { - "|beforeload" : "function (_self, o)\n{\n //o.params.ontable = 'Companies';\n \n // o.params.imgtype = 'PressRelease';\n \n o.params = o.params || {};\n o.params.onid = _this.data.onid;\n o.params.ontable = 'core_enum';\n Roo.log(_this);\n \n}", - "|load" : "function (_self, records, options)\n{\n _this.panel.el.unmask();\n}" - }, - "xtype" : "Store", - "remoteSort" : true, - "$ sortInfo" : "{ field: 'created' , direction: 'DESC' }", - "$ xns" : "Roo.data", - "* prop" : "dataSource", - "items" : [ - { - "id" : "id", - "root" : "data", - "xtype" : "JsonReader", - "$ 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 H:i:s'\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]", - "$ xns" : "Roo.data", - "* prop" : "reader", - "totalProperty" : "total" - }, - { - "$ url" : "baseURL + '/Roo/Images.php'", - "method" : "GET", - "xtype" : "HttpProxy", - "$ xns" : "Roo.data", - "* prop" : "proxy" - } - ] - }, - { - "pageSize" : 25, - "xtype" : "PagingToolbar", - "emptyMsg" : "No Images found", - "$ xns" : "Roo", - "displayInfo" : true, - "displayMsg" : "Displaying Images {0} - {1} of {2}", - "* prop" : "footer" - }, - { - "xtype" : "Toolbar", - "$ xns" : "Roo", - "* prop" : "toolbar", - "items" : [ - { - "listeners" : { - "|click" : "function()\n{\n \n //var sel = Pman.Tab.PressReleaseCompanies ? Pman.Tab.PressReleaseCompanies.grid.getSelectionModel().getSelected() : false\n \n Pman.Dialog.Image.show({\n id : 0, \n ontable: 'core_enum',\n onid: _this.data.onid,\n imgtype : ''\n }, function(data){\n if (!data) { return; } \n _this.grid.footer.onClick('first');\n }); \n\n} " - }, - "text" : "Add", - "xtype" : "Button", - "cls" : "x-btn-text-icon", - "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'", - "$ xns" : "Roo.Toolbar" - }, - { - "listeners" : { - "|click" : "function()\n{\n var s = _this.grid.getSelectionModel().getSelections();\n if (!s || s.length != 1) {\n Roo.MessageBox.alert(\"Error\", \"Select a single image to edit\");\n return;\n }\n var data = _this.grid.getDataSource().getById(s[0].data.id).data;\n \n Pman.Dialog.PressReleaseImage.show(data, function() {\n _this.grid.footer.onClick('first');\n }); \n \n }\n " - }, - "text" : "Edit", - "xtype" : "Button", - "cls" : "x-btn-text-icon", - "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'", - "$ xns" : "Roo" - }, - { - "listeners" : { - "|click" : "function()\n {\n Pman.genericDelete(_this, 'Images'); \n }\n " - }, - "text" : "Delete", - "xtype" : "Button", - "cls" : "x-btn-text-icon", - "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'", - "$ xns" : "Roo.Toolbar" - } - ] - }, - { - "xtype" : "ColumnModel", - "sortable" : true, - "width" : 100, - "header" : "Created", - "$ renderer" : "function(v,x,r) {\n return String.format('{0}
{1}
{2}
{3}x{4}',\n v.format('d/M/Y'), r.data.mimetype, r.data.filename,\n r.data.width, r.data.height\n ); \n}\n ", - "$ xns" : "Roo.grid", - "* prop" : "colModel[]", - "dataIndex" : "created" - }, - { - "xtype" : "ColumnModel", - "header" : "Image", - "width" : 100, - "$ renderer" : "function(v,x,r) { return String.format('', baseURL, v, r.data.filename); }", - "$ xns" : "Roo.grid", - "* prop" : "colModel[]", - "dataIndex" : "id" - }, - { - "xtype" : "ColumnModel", - "header" : "Title", - "width" : 100, - "$ renderer" : "function(v,x,r) {\n// var surl = r.json.url.replace(/\\/release.php\\/Images\\//, '/i/').replace(/\\/([0-9]+)\\/.*$/, '/$1');;\n // var svurl = r.json.url_view.replace(/\\/release.php\\/Images\\//, '/i/').replace(/\\/([0-9]+)\\/.*$/, '/$1');;\n // return String.format(\n // 'Download Url : http://{0}{1}' + \n // '
View Url : http://{0}{2}' + \n //'
{3}
{4}', \n // window.location.host, surl, svurl,\n // v, r.json.descript); \n \n }", - "$ xns" : "Roo.grid", - "* prop" : "colModel[]", - "dataIndex" : "title" - } - ] - } - ] - }, - { - "listeners" : { - "click" : "function (_self, e)\n{\n _this.dialog.hide();\n _this.callback(true);\n}" - }, - "text" : "Close", - "xtype" : "Button", - "$ xns" : "Roo", - "* prop" : "buttons[]" - } - ] + "listeners" : { + "|beforeload" : "function (_self, o)\n{\n //o.params.ontable = 'Companies';\n \n // o.params.imgtype = 'PressRelease';\n \n o.params = o.params || {};\n o.params.onid = _this.data.onid;\n o.params.ontable = 'core_enum';\n Roo.log(_this);\n \n}", + "|load" : "function (_self, records, options)\n{\n _this.panel.el.unmask();\n}" + }, + "xtype" : "Store", + "remoteSort" : true, + "$ sortInfo" : "{ field: 'created' , direction: 'DESC' }", + "$ xns" : "Roo.data", + "* prop" : "dataSource", + "items" : [ + { + "id" : "id", + "root" : "data", + "xtype" : "JsonReader", + "$ 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 H:i:s'\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]", + "$ xns" : "Roo.data", + "* prop" : "reader", + "totalProperty" : "total" + }, + { + "$ url" : "baseURL + '/Roo/Images.php'", + "xtype" : "HttpProxy", + "method" : "GET", + "$ xns" : "Roo.data", + "* prop" : "proxy" + } + ] + }, + { + "pageSize" : 25, + "xtype" : "PagingToolbar", + "emptyMsg" : "No Images found", + "$ xns" : "Roo", + "displayInfo" : true, + "displayMsg" : "Displaying Images {0} - {1} of {2}", + "* prop" : "footer" + }, + { + "xtype" : "Toolbar", + "$ xns" : "Roo", + "* prop" : "toolbar", + "items" : [ + { + "listeners" : { + "|click" : "function()\n{\n \n //var sel = Pman.Tab.PressReleaseCompanies ? Pman.Tab.PressReleaseCompanies.grid.getSelectionModel().getSelected() : false\n \n Pman.Dialog.Image.show({\n id : 0, \n ontable: 'core_enum',\n onid: _this.data.onid,\n imgtype : ''\n }, function(data){\n if (!data) { return; } \n _this.grid.footer.onClick('first');\n }); \n\n} " + }, + "text" : "Add", + "xtype" : "Button", + "cls" : "x-btn-text-icon", + "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'", + "$ xns" : "Roo.Toolbar" + }, + { + "listeners" : { + "|click" : "function()\n{\n var s = _this.grid.getSelectionModel().getSelections();\n if (!s || s.length != 1) {\n Roo.MessageBox.alert(\"Error\", \"Select a single image to edit\");\n return;\n }\n var data = _this.grid.getDataSource().getById(s[0].data.id).data;\n \n Pman.Dialog.PressReleaseImage.show(data, function() {\n _this.grid.footer.onClick('first');\n }); \n \n }\n " + }, + "text" : "Edit", + "xtype" : "Button", + "cls" : "x-btn-text-icon", + "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'", + "$ xns" : "Roo" + }, + { + "listeners" : { + "|click" : "function()\n {\n Pman.genericDelete(_this, 'Images'); \n }\n " + }, + "text" : "Delete", + "xtype" : "Button", + "cls" : "x-btn-text-icon", + "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'", + "$ xns" : "Roo.Toolbar" + } + ] + }, + { + "xtype" : "ColumnModel", + "sortable" : true, + "width" : 100, + "header" : "Created", + "$ renderer" : "function(v,x,r) {\n return String.format('{0}
{1}
{2}
{3}x{4}',\n v.format('d/M/Y'), r.data.mimetype, r.data.filename,\n r.data.width, r.data.height\n ); \n}\n ", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "created" + }, + { + "xtype" : "ColumnModel", + "width" : 100, + "header" : "Image", + "$ renderer" : "function(v,x,r) { return String.format('', baseURL, v, r.data.filename); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "id" + }, + { + "xtype" : "ColumnModel", + "width" : 100, + "header" : "Title", + "$ renderer" : "function(v,x,r) {\n// var surl = r.json.url.replace(/\\/release.php\\/Images\\//, '/i/').replace(/\\/([0-9]+)\\/.*$/, '/$1');;\n // var svurl = r.json.url_view.replace(/\\/release.php\\/Images\\//, '/i/').replace(/\\/([0-9]+)\\/.*$/, '/$1');;\n // return String.format(\n // 'Download Url : http://{0}{1}' + \n // '
View Url : http://{0}{2}' + \n //'
{3}
{4}', \n // window.location.host, surl, svurl,\n // v, r.json.descript); \n \n }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "title" } - ] + ] + } + ] + }, + { + "listeners" : { + "click" : "function (_self, e)\n{\n _this.dialog.hide();\n _this.callback(true);\n}" + }, + "text" : "Close", + "xtype" : "Button", + "$ xns" : "Roo", + "* prop" : "buttons[]" + } + ] + } + ] } \ No newline at end of file diff --git a/Pman.Dialog.AdminEnumImages.js b/Pman.Dialog.AdminEnumImages.js index 52c4009..ea7c555 100644 --- a/Pman.Dialog.AdminEnumImages.js +++ b/Pman.Dialog.AdminEnumImages.js @@ -6,354 +6,354 @@ Roo.namespace('Pman.Dialog'); Pman.Dialog.AdminEnumImages = { - dialog : false, - callback: false, + _strings : { + '0c81971f67c0bd4b33799c5365ec2bf5' :"No Images found", + '5b94af0908e765fe39e4d0e8f9c99ef8' :"Add / Edit Images", + 'fff0d600f8a0b5e19e88bfb821dd1157' :"Images", + 'ec211f7c20af43e742bf2570c3cb84f9' :"Add", + '0eceeb45861f9585dd7a97a3e36f85c6' :"Created", + '7dce122004969d56ae2e0245cb754d35' :"Edit", + 'be53a0541a6d36f6ecb879fa2c584b08' :"Image", + 'b78a3223503896721cca1303f776159b' :"Title", + 'd3d2e617335f08df83599665eef8a418' :"Close", + 'c0ed345ec857c06b31f7e88745c9bc40' :"Displaying Images {0} - {1} of {2}", + 'f2a6c498fb90ee345d997f888fce3b18' :"Delete" + }, - show : function(data, cb) - { - if (!this.dialog) { - this.create(); - } - - this.callback = cb; - this.data = data; - this.dialog.show(this.data._el); - if (this.form) { - this.form.reset(); - this.form.setValues(data); - this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data }); - } - - }, - - create : function() - { - var _this = this; - this.dialog = Roo.factory({ - center : { - '|xns' : 'Roo', - xtype : 'LayoutRegion', - xns : Roo - }, - '|xns' : 'Roo', - modal : true, - title : "Add / Edit Images", - xtype : 'LayoutDialog', - width : 900, - xns : Roo, - height : 500, - buttons : [ - { - '|xns' : 'Roo', - text : "Close", - xtype : 'Button', - xns : Roo, - listeners : { - click : function (_self, e) - { - _this.dialog.hide(); - _this.callback(true); - } - } - } - ], - listeners : { - show : function (_self) - { - _this.grid.footer.onClick('first'); - } - }, - items : [ - { - grid : { - dataSource : { - reader : { - '|xns' : 'Roo.data', - id : 'id', - root : 'data', - xtype : 'JsonReader', - 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 H:i:s' - }, - { - 'name': 'imgtype', - 'type': 'string' - }, - { - 'name': 'linkurl', - 'type': 'string' - }, - { - 'name': 'descript', - 'type': 'string' - }, - { - 'name': 'title', - 'type': 'string' - } - ], - xns : Roo.data, - totalProperty : 'total' - }, - proxy : { - '|xns' : 'Roo.data', - url : baseURL + '/Roo/Images.php', - method : 'GET', - xtype : 'HttpProxy', - xns : Roo.data - }, - '|xns' : 'Roo.data', - xtype : 'Store', - remoteSort : true, - sortInfo : { field: 'created' , direction: 'DESC' }, - xns : Roo.data, - listeners : { - beforeload : function (_self, o) - { - //o.params.ontable = 'Companies'; - - // o.params.imgtype = 'PressRelease'; - - o.params = o.params || {}; - o.params.onid = _this.data.onid; - o.params.ontable = 'core_enum'; - Roo.log(_this); - - }, - load : function (_self, records, options) - { - _this.panel.el.unmask(); - } - }, - items : [ - - ] - - }, - footer : { - '|xns' : 'Roo', - pageSize : 25, - xtype : 'PagingToolbar', - emptyMsg : "No Images found", - xns : Roo, - displayInfo : true, - displayMsg : "Displaying Images {0} - {1} of {2}" - }, - toolbar : { - '|xns' : 'Roo', - xtype : 'Toolbar', - xns : Roo, - items : [ - { - '|xns' : 'Roo.Toolbar', - text : "Add", - xtype : 'Button', - cls : 'x-btn-text-icon', - icon : Roo.rootURL + 'images/default/dd/drop-add.gif', - xns : Roo.Toolbar, - listeners : { - click : function() - { - - //var sel = Pman.Tab.PressReleaseCompanies ? Pman.Tab.PressReleaseCompanies.grid.getSelectionModel().getSelected() : false - - Pman.Dialog.Image.show({ - id : 0, - ontable: 'core_enum', - onid: _this.data.onid, - imgtype : '' - }, function(data){ - if (!data) { return; } - _this.grid.footer.onClick('first'); - }); - - } - } - }, - { - '|xns' : 'Roo', - text : "Edit", - xtype : 'Button', - cls : 'x-btn-text-icon', - icon : Roo.rootURL + 'images/default/tree/leaf.gif', - xns : Roo, - listeners : { - click : function() - { - var s = _this.grid.getSelectionModel().getSelections(); - if (!s || s.length != 1) { - Roo.MessageBox.alert("Error", "Select a single image to edit"); - return; - } - var data = _this.grid.getDataSource().getById(s[0].data.id).data; - - Pman.Dialog.PressReleaseImage.show(data, function() { - _this.grid.footer.onClick('first'); - }); - - } - } - }, - { - '|xns' : 'Roo.Toolbar', - text : "Delete", - xtype : 'Button', - cls : 'x-btn-text-icon', - icon : rootURL + '/Pman/templates/images/trash.gif', - xns : Roo.Toolbar, - listeners : { - click : function() - { - Pman.genericDelete(_this, 'Images'); - } - } - } - ] + dialog : false, + callback: false, - }, - '|xns' : 'Roo.grid', - autoExpandColumn : 'title', - xtype : 'Grid', - loadMask : true, - xns : Roo.grid, - colModel : [ - { - '|xns' : 'Roo.grid', - xtype : 'ColumnModel', - sortable : true, - width : 100, - header : 'Created', - renderer : function(v,x,r) { - return String.format('{0}
{1}
{2}
{3}x{4}', - v.format('d/M/Y'), r.data.mimetype, r.data.filename, - r.data.width, r.data.height - ); - }, - xns : Roo.grid, - dataIndex : 'created' - }, -{ - '|xns' : 'Roo.grid', - xtype : 'ColumnModel', - header : 'Image', - width : 100, - renderer : function(v,x,r) { return String.format('', baseURL, v, r.data.filename); }, - xns : Roo.grid, - dataIndex : 'id' - }, -{ - '|xns' : 'Roo.grid', - xtype : 'ColumnModel', - header : 'Title', - width : 100, - renderer : function(v,x,r) { - // var surl = r.json.url.replace(/\/release.php\/Images\//, '/i/').replace(/\/([0-9]+)\/.*$/, '/$1');; - // var svurl = r.json.url_view.replace(/\/release.php\/Images\//, '/i/').replace(/\/([0-9]+)\/.*$/, '/$1');; - // return String.format( - // 'Download Url : http://{0}{1}' + - // '
View Url : http://{0}{2}' + - //'
{3}
{4}', - // window.location.host, surl, svurl, - // v, r.json.descript); - - }, - xns : Roo.grid, - dataIndex : 'title' - } - ], - listeners : { - rowdblclick : function (_self, rowIndex, e) - { - - var s = _self.getDataSource().getAt(rowIndex); - Pman.Dialog.PressReleaseImage.show(s.data, function() { - _this.grid.footer.onClick('first'); - }); - }, - render : function() { - _this.grid = this; - //_this.dialog = Pman.Dialog.FILL_IN - //if (_this.panel.active) { - // this.footer.onClick('first'); - //} - } - }, - items : [ + show : function(data, cb) + { + if (!this.dialog) { + this.create(); + } - ] + this.callback = cb; + this.data = data; + this.dialog.show(this.data._el); + if (this.form) { + this.form.reset(); + this.form.setValues(data); + this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data }); + } - }, - '|xns' : 'Roo', - fitToframe : true, - background : false, - region : 'center', - title : "Images", - xtype : 'GridPanel', - fitContainer : true, - xns : Roo, - tableName : 'Images', - listeners : { - activate : function() { - _this.panel = this; - if (_this.grid) { - _this.grid.footer.onClick('first'); - } - } - }, - items : [ + }, - ] - - } - ] - - }); - } + create : function() + { + var _this = this; + this.dialog = Roo.factory({ + xtype : 'LayoutDialog', + height : 500, + modal : true, + title : _this._strings['5b94af0908e765fe39e4d0e8f9c99ef8'] /* Add / Edit Images */, + width : 900, + listeners : { + show : function (_self) + { + _this.grid.footer.onClick('first'); + } + }, + xns : Roo, + '|xns' : 'Roo', + center : { + xtype : 'LayoutRegion', + xns : Roo, + '|xns' : 'Roo' + }, + buttons : [ + { + xtype : 'Button', + text : _this._strings['d3d2e617335f08df83599665eef8a418'] /* Close */, + listeners : { + click : function (_self, e) + { + _this.dialog.hide(); + _this.callback(true); + } + }, + xns : Roo, + '|xns' : 'Roo' + } + ], + items : [ + { + xtype : 'GridPanel', + background : false, + fitContainer : true, + fitToframe : true, + region : 'center', + tableName : 'Images', + title : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */, + listeners : { + activate : function() { + _this.panel = this; + if (_this.grid) { + _this.grid.footer.onClick('first'); + } + } + }, + xns : Roo, + '|xns' : 'Roo', + grid : { + xtype : 'Grid', + autoExpandColumn : 'title', + 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) + { + + var s = _self.getDataSource().getAt(rowIndex); + Pman.Dialog.PressReleaseImage.show(s.data, function() { + _this.grid.footer.onClick('first'); + }); + } + }, + xns : Roo.grid, + '|xns' : 'Roo.grid', + footer : { + xtype : 'PagingToolbar', + displayInfo : true, + displayMsg : _this._strings['c0ed345ec857c06b31f7e88745c9bc40'] /* Displaying Images {0} - {1} of {2} */, + emptyMsg : _this._strings['0c81971f67c0bd4b33799c5365ec2bf5'] /* No Images found */, + pageSize : 25, + xns : Roo, + '|xns' : 'Roo' + }, + toolbar : { + xtype : 'Toolbar', + xns : Roo, + '|xns' : 'Roo', + items : [ + { + xtype : 'Button', + cls : 'x-btn-text-icon', + icon : Roo.rootURL + 'images/default/dd/drop-add.gif', + text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */, + listeners : { + click : function() + { + + //var sel = Pman.Tab.PressReleaseCompanies ? Pman.Tab.PressReleaseCompanies.grid.getSelectionModel().getSelected() : false + + Pman.Dialog.Image.show({ + id : 0, + ontable: 'core_enum', + onid: _this.data.onid, + imgtype : '' + }, function(data){ + if (!data) { return; } + _this.grid.footer.onClick('first'); + }); + + } + }, + xns : Roo.Toolbar, + '|xns' : 'Roo.Toolbar' + }, + { + xtype : 'Button', + cls : 'x-btn-text-icon', + icon : Roo.rootURL + 'images/default/tree/leaf.gif', + text : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */, + listeners : { + click : function() + { + var s = _this.grid.getSelectionModel().getSelections(); + if (!s || s.length != 1) { + Roo.MessageBox.alert("Error", "Select a single image to edit"); + return; + } + var data = _this.grid.getDataSource().getById(s[0].data.id).data; + + Pman.Dialog.PressReleaseImage.show(data, function() { + _this.grid.footer.onClick('first'); + }); + + } + }, + xns : Roo, + '|xns' : 'Roo' + }, + { + xtype : 'Button', + cls : 'x-btn-text-icon', + icon : rootURL + '/Pman/templates/images/trash.gif', + text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */, + listeners : { + click : function() + { + Pman.genericDelete(_this, 'Images'); + } + }, + xns : Roo.Toolbar, + '|xns' : 'Roo.Toolbar' + } + ] + }, + dataSource : { + xtype : 'Store', + remoteSort : true, + sortInfo : { field: 'created' , direction: 'DESC' }, + listeners : { + beforeload : function (_self, o) + { + //o.params.ontable = 'Companies'; + + // o.params.imgtype = 'PressRelease'; + + o.params = o.params || {}; + o.params.onid = _this.data.onid; + o.params.ontable = 'core_enum'; + Roo.log(_this); + + }, + load : function (_self, records, options) + { + _this.panel.el.unmask(); + } + }, + xns : Roo.data, + '|xns' : 'Roo.data', + proxy : { + xtype : 'HttpProxy', + method : 'GET', + url : baseURL + '/Roo/Images.php', + xns : Roo.data, + '|xns' : 'Roo.data' + }, + reader : { + xtype : 'JsonReader', + 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 H:i:s' + }, + { + 'name': 'imgtype', + 'type': 'string' + }, + { + 'name': 'linkurl', + 'type': 'string' + }, + { + 'name': 'descript', + 'type': 'string' + }, + { + 'name': 'title', + 'type': 'string' + } + ], + id : 'id', + root : 'data', + totalProperty : 'total', + xns : Roo.data, + '|xns' : 'Roo.data' + } + }, + colModel : [ + { + xtype : 'ColumnModel', + dataIndex : 'created', + header : _this._strings['0eceeb45861f9585dd7a97a3e36f85c6'] /* Created */, + renderer : function(v,x,r) { + return String.format('{0}
{1}
{2}
{3}x{4}', + v.format('d/M/Y'), r.data.mimetype, r.data.filename, + r.data.width, r.data.height + ); + }, + sortable : true, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'id', + header : _this._strings['be53a0541a6d36f6ecb879fa2c584b08'] /* Image */, + renderer : function(v,x,r) { return String.format('', baseURL, v, r.data.filename); }, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'title', + header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */, + renderer : function(v,x,r) { + // var surl = r.json.url.replace(/\/release.php\/Images\//, '/i/').replace(/\/([0-9]+)\/.*$/, '/$1');; + // var svurl = r.json.url_view.replace(/\/release.php\/Images\//, '/i/').replace(/\/([0-9]+)\/.*$/, '/$1');; + // return String.format( + // 'Download Url : http://{0}{1}' + + // '
View Url : http://{0}{2}' + + //'
{3}
{4}', + // window.location.host, surl, svurl, + // v, r.json.descript); + + }, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid' + } + ] + } + } + ] + }); + } };