Pman.Dialog.AdminEnumImages.bjs
[Pman.Admin] / Pman.Dialog.AdminEnumImages.bjs
1 {
2  "name" : "Pman.Dialog.AdminEnumImages",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/benny/gitlive/Pman.Admin/Pman.Dialog.AdminEnumImages.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "0c81971f67c0bd4b33799c5365ec2bf5" : "No Images found",
10   "5b94af0908e765fe39e4d0e8f9c99ef8" : "Add / Edit Images",
11   "fff0d600f8a0b5e19e88bfb821dd1157" : "Images",
12   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
13   "0eceeb45861f9585dd7a97a3e36f85c6" : "Created",
14   "7dce122004969d56ae2e0245cb754d35" : "Edit",
15   "be53a0541a6d36f6ecb879fa2c584b08" : "Image",
16   "b78a3223503896721cca1303f776159b" : "Title",
17   "d3d2e617335f08df83599665eef8a418" : "Close",
18   "c0ed345ec857c06b31f7e88745c9bc40" : "Displaying Images  {0} - {1} of {2}",
19   "f2a6c498fb90ee345d997f888fce3b18" : "Delete"
20  },
21  "items" : [
22   {
23    "listeners" : {
24     "show" : "function (_self)\n{\n    _this.grid.footer.onClick('first');\n}"
25    },
26    "modal" : true,
27    "title" : "Add / Edit Images",
28    "xtype" : "LayoutDialog",
29    "width" : 900,
30    "$ xns" : "Roo",
31    "height" : 500,
32    "items" : [
33     {
34      "xtype" : "LayoutRegion",
35      "$ xns" : "Roo",
36      "* prop" : "center"
37     },
38     {
39      "listeners" : {
40       "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
41      },
42      "region" : "center",
43      "fitToframe" : true,
44      "background" : false,
45      "title" : "Images",
46      "xtype" : "GridPanel",
47      "fitContainer" : true,
48      "$ xns" : "Roo",
49      "tableName" : "Images",
50      "items" : [
51       {
52        "listeners" : {
53         "|rowdblclick" : "function (_self, rowIndex, e)\n{\n  \n   var s =  _self.getDataSource().getAt(rowIndex);\n     Pman.Dialog.Image.show(s.data, function() {\n                _this.grid.footer.onClick('first');\n               }); \n}",
54         "|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}"
55        },
56        "autoExpandColumn" : "title",
57        "xtype" : "Grid",
58        "loadMask" : true,
59        "$ xns" : "Roo.grid",
60        "* prop" : "grid",
61        "items" : [
62         {
63          "listeners" : {
64           "|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}",
65           "|load" : "function (_self, records, options)\n{\n _this.panel.el.unmask();\n}"
66          },
67          "xtype" : "Store",
68          "remoteSort" : true,
69          "$ sortInfo" : "{ field: 'created' , direction: 'DESC' }",
70          "$ xns" : "Roo.data",
71          "* prop" : "dataSource",
72          "items" : [
73           {
74            "id" : "id",
75            "root" : "data",
76            "xtype" : "JsonReader",
77            "$ 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]",
78            "$ xns" : "Roo.data",
79            "* prop" : "reader",
80            "totalProperty" : "total"
81           },
82           {
83            "$ url" : "baseURL + '/Roo/Images.php'",
84            "method" : "GET",
85            "xtype" : "HttpProxy",
86            "$ xns" : "Roo.data",
87            "* prop" : "proxy"
88           }
89          ]
90         },
91         {
92          "pageSize" : 25,
93          "xtype" : "PagingToolbar",
94          "emptyMsg" : "No Images found",
95          "$ xns" : "Roo",
96          "displayInfo" : true,
97          "displayMsg" : "Displaying Images  {0} - {1} of {2}",
98          "* prop" : "footer"
99         },
100         {
101          "xtype" : "Toolbar",
102          "$ xns" : "Roo",
103          "* prop" : "toolbar",
104          "items" : [
105           {
106            "listeners" : {
107             "|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}       "
108            },
109            "text" : "Add",
110            "xtype" : "Button",
111            "cls" : "x-btn-text-icon",
112            "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
113            "$ xns" : "Roo.Toolbar"
114           },
115           {
116            "listeners" : {
117             "|click" : "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    \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    console.log(_this);\n     _this.dialog.Image.show(data, function() {\n        _this.grid.footer.onClick('first');\n       });\n            \n}\n        "
118            },
119            "text" : "Edit",
120            "xtype" : "Button",
121            "cls" : "x-btn-text-icon",
122            "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
123            "$ xns" : "Roo"
124           },
125           {
126            "listeners" : {
127             "|click" : "function()\n{\n    var ids = [];\n    \n    var sc = _this.grid.getSelectionModel().getSelections();\n    \n    if (!sc.length) {\n        Roo.MessageBox.alert(\"Error\", \"Select rows by clicking the row\");\n        return;\n    }\n    Roo.each(sc, function(v){\n        ids.push(v.id);\n    });\n    Roo.MessageBox.confirm(\n        \"Confirm\", \n        \"Confirm Deletion of selected rows (some rows can not be deleted if they are referenced elsewhere\", \n        function(res) {\n            if(res != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                method : 'POST',\n                url : baseURL + '/Roo/Images',\n                params : {\n                    _delete  : ids.join(',')\n                },\n                success : function() {\n                    _this.grid.footer.onClick('refresh');\n                }\n            });\n        }\n    );\n}\n        "
128            },
129            "text" : "Delete",
130            "xtype" : "Button",
131            "cls" : "x-btn-text-icon",
132            "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
133            "$ xns" : "Roo.Toolbar"
134           }
135          ]
136         },
137         {
138          "xtype" : "ColumnModel",
139          "sortable" : true,
140          "width" : 100,
141          "header" : "Created",
142          "$ renderer" : "function(v,x,r) {\n       return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',\n            v.format('d/M/Y'), r.data.mimetype, r.data.filename,\n    r.data.width, r.data.height\n    ); \n}\n     ",
143          "$ xns" : "Roo.grid",
144          "* prop" : "colModel[]",
145          "dataIndex" : "created"
146         },
147         {
148          "xtype" : "ColumnModel",
149          "header" : "Image",
150          "width" : 100,
151          "$ renderer" : "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\" width=\"100\">', baseURL, v, r.data.filename); }",
152          "$ xns" : "Roo.grid",
153          "* prop" : "colModel[]",
154          "dataIndex" : "id"
155         },
156         {
157          "xtype" : "ColumnModel",
158          "header" : "Title",
159          "width" : 100,
160          "$ 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 : <a href=\"http://{0}{1}\" target=\"_new\">http://{0}{1}</a>' + \n        //  '<br/>View Url : <a href=\"http://{0}{2}\" target=\"_new\">http://{0}{2}</a>' + \n          //'<br/><b>{3}</b><br/>{4}</i>', \n         // window.location.host, surl, svurl,\n          // v, r.json.descript); \n     \n    }",
161          "$ xns" : "Roo.grid",
162          "* prop" : "colModel[]",
163          "dataIndex" : "title"
164         }
165        ]
166       }
167      ]
168     },
169     {
170      "listeners" : {
171       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n    _this.callback(true);\n}"
172      },
173      "text" : "Close",
174      "xtype" : "Button",
175      "$ xns" : "Roo",
176      "* prop" : "buttons[]"
177     }
178    ]
179   }
180  ]
181 }