DataObjects/Cms_comments.php
[Pman.Cms] / Pman.Tab.CmsBlog.bjs
1 {
2  "name" : "Pman.Tab.CmsBlog",
3  "parent" : "Pman.Tab.Cms",
4  "title" : "Pman.Tab.CmsBlog",
5  "path" : "/home/edward/gitlive/Pman.Cms/Pman.Tab.CmsBlog.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "30a2a59b5adaa49803297d4c06e09e67" : "Displaying cms_page{0} - {1} of {2}",
10   "a517747c3d12f99244ae598910d979c5" : "Author",
11   "63a6a88c066880c5ac42394a22803ca6" : "Refresh",
12   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
13   "0eceeb45861f9585dd7a97a3e36f85c6" : "Created",
14   "695e93e1d9db8283a9dd66782625065d" : "Child Elements",
15   "ebd9bec4d70abc789d439c1f136b0538" : "Layout",
16   "30269022e9d8f51beaabb52e5d0de2b7" : "Parent",
17   "a4863ff1cdfa709d5bf80939cd2e6757" : "T#",
18   "d7efa19fbe7d3972fd5adb6024223d74" : "C#",
19   "08d0135e24822f43171ed4944fc3bdda" : "Preview (resize by dragging next to this bar)",
20   "2cbaa804531fc7367ccc699fb1eef52a" : "Page link / Name / Order",
21   "3adbdb3ac060038aa0e6e6c138ef9873" : "Category",
22   "b8a00b5928fbead0626546550667b2b5" : "Pages, Menu and Blog Entries",
23   "c8043f5cd3d28cb76c548338497b06ab" : "Show Deleted",
24   "d645920e395fedad7bbbed0eca3fe2e0" : "40",
25   "be53a0541a6d36f6ecb879fa2c584b08" : "Image",
26   "9b9d8a976b42e0bd66381797644943d5" : "Published",
27   "b78a3223503896721cca1303f776159b" : "Title",
28   "f17755c3f16cb257f7793b9865ebafb3" : "No cms_page found",
29   "a9581db07856efb481fddef1b3e168f8" : "No page found",
30   "ce5bf551379459c1c61d2a204061c455" : "Location",
31   "0ecfa7150815d4ddb07470e3862c92c4" : "Export CMS (ZIP)",
32   "7ee49db2b46c732d681edc761cf487ae" : "Postion",
33   "5fb63579fc981698f97d55bfecb213ea" : "Copy",
34   "040dcb21af4618f18d04e667c07ef314" : "{0} - {1} of {2}",
35   "f46885d21c98f597303699f41b3d7afd" : "Ex?",
36   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
37   "4d3d769b812b6faa6b76e1a8abaece2d" : "Active",
38   "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
39   "f7070be7ec7d2443714a2e5dc63f4de2" : "Links to",
40   "75ae2cfdf786e5577f1b619f4ca8d728" : "To replace"
41  },
42  "items" : [
43   {
44    "title" : "Pages, Menu and Blog Entries",
45    "xtype" : "NestedLayoutPanel",
46    "$ xns" : "Roo",
47    "items" : [
48     {
49      "xtype" : "BorderLayout",
50      "$ xns" : "Roo",
51      "* prop" : "layout",
52      "items" : [
53       {
54        "xtype" : "LayoutRegion",
55        "$ xns" : "Roo",
56        "* prop" : "center"
57       },
58       {
59        "xtype" : "LayoutRegion",
60        "width" : 320,
61        "$ xns" : "Roo",
62        "split" : true,
63        "titlebar" : false,
64        "* prop" : "west"
65       },
66       {
67        "Boolean collapsed" : false,
68        "xtype" : "LayoutRegion",
69        "String collapsedTitle" : "Child Elements",
70        "width" : 500,
71        "$ xns" : "Roo",
72        "Boolean collapsible" : true,
73        "split" : true,
74        "String title" : "Child Elements",
75        "titlebar" : true,
76        "* prop" : "east"
77       },
78       {
79        "listeners" : {
80         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n    \n}"
81        },
82        "bool background" : false,
83        "fitToframe" : true,
84        "region" : "center",
85        "title" : "Pages, Menu and Blog Entries",
86        "xtype" : "GridPanel",
87        "fitContainer" : true,
88        "$ xns" : "Roo",
89        "tableName" : "cms_page",
90        "items" : [
91         {
92          "listeners" : {
93           "rowdblclick" : "function (_self, rowIndex, e)\n{\n    var s = this.dataSource.getAt(rowIndex);\n    /*  \n    if (s.data.language.length) {\n        Roo.log('in lang');\n        _this.dialog.show({ id : s.data.parent_id } , function() {\n            _this.grid.footer.onClick('refresh');\n        });\n        return;\n    }*/\n    if (s.data.is_deleted) {\n        Roo.MessageBox.alert(\"Undelete this\", \"You need to un-delete this item before you can edit it\");\n        return;\n    }\n    \n    \n    \n    _this.dialog.show(s.data, function() {\n        _this.grid.footer.onClick('refresh');\n    }); \n    \n}\n",
94           "cellclick" : "function (g, ri,ci, e)\r\n{\n    var h = this.colModel.getDataIndex(ci);\n    \r\n    if (h != 'is_draft') {\r\n        return;\r\n    }\r\n    var rec = g.ds.getAt(ri);\n    \n    if(rec.data.is_system_page * 1 == 1){\n        Roo.MessageBox.alert('Error', 'You cannot de-active the system page');\n        return;\n    }\r\n    rec.set('is_draft', rec.data.is_draft ? 0 : 1);\r\n    rec.commit();\r\n}",
95           "|render" : "function() \n{\n   _this.grid = this; \n    _this.dialog = Pman.Dialog.CmsBlog;\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
96           "rowclick" : "function (_self, rowIndex, e)\n{\n    var s = this.dataSource.getAt(rowIndex);\n\n    _this.prepanel.el.dom.innerHTML = '';\n    \n    if(s.data.id * 1 < 1){\n        return;\r\n    }\n    if (s.data.is_deleted) {\n        _this.deleteBtn.setText(\"Un-delete\");\n    } else {\n        _this.deleteBtn.setText(\"Delete\");\n    } \n    \n    \n    _this.prepanel.el.dom.src =  baseURL + '/Cms/PageThumb/' +  s.data.id;\n    \n    _this.targetData = s;\n    \n    _this.child_element_grid.footer.onClick('first');\n    \n}"
97          },
98          "autoExpandColumn" : "title",
99          "xtype" : "Grid",
100          "loadMask" : true,
101          "$ xns" : "Roo.grid",
102          "* prop" : "grid",
103          "items" : [
104           {
105            "listeners" : {
106             "update" : "function (_self, record, operation)\n{\n    if (operation != 'commit') {\n        return;\n    }\n    // only used to change active status.\n    \n    new Pman.request({\r\n        method : 'POST',\r\n        url : baseURL + '/Roo/Cms_page',\r\n        params : {\r\n            id : record.data.id,\r\n            is_draft : record.data.is_draft\r\n        },\n        success : function(res) {\n           _this.grid.footer.onClick('refresh');\n       }\r\n    });\n}",
107             "beforeload" : "function (_self, options)\n{\n    if (Pman.building || !Pman.Tab.Cms.panel.active) {\n        return false;\n    }\n    \n    var sel = _this.category_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.pid * 1 < 1){\n        this.removeAll();\n        return false;\n    }\n    \n    options.params._with_primary_image = 1;\n    \n    var cm = _this.grid.colModel;\n    var vis = {\n        category_type_id_name : true,\n        menu_page_id_title : true\n    };\n    \n    var cm = _this.grid.getColumnModel();\n    \n    function cid(str) {\n        return cm.getIndexByDataIndex(str);\n    }\n    \n    options.params['search[name]'] = _this.searchBox.getValue();\n    \n    options.params._exclude_columns = 'body,extended';\n    \n    if(sel.data.type == 'page_type'){\n        options.params._page_type_id = sel.data.pid;\n    }\n    if (sel.data.page_type > 0 ) {\n        options.params._page_type_id = sel.data.page_type;\n    }\n    \n    if(sel.data.type == 'category'){\n        options.params._category_id = sel.data.pid;\n    }\n    \n    var size = _this.image_size_sel.getValue() * 1;\n    \n    cm.setHidden(cid('primary_image_id'), false);\n    cm.setColumnWidth(cid('primary_image_id'), size + 10);\n    \n    if(size == 0){\n        cm.setHidden(cid('primary_image_id'), true);\n    }\n    \n   // options.params._treeview = 1;\n    options.params._pman_short = 1;\n    \n    options.params.translation_of_id = 0;\n    \n    options.params._with_translation_type = 1;\n    \n    //options.params._requestMeta  = 1; // always fetch meta.. as different types return different data..\n    \n    \n    switch(sel.data.name) {\n        case 'page' : \n         //   options.params.limit = 9999;\n      //      _this.grid.footer.pageSize = 9999;\n            vis.menu_page_id_title = false;\n            cm.setHidden(cid('created'), true);\n            cm.setHidden(cid('published'), true);\n            cm.setHidden(cid('template_id_template'), false);   \n            this.sortInfo.field = 'tree_sequence'; // force sort.\n            this.sortInfo.direction = 'ASC'; // force sort.\n                         \n            break;\n        case 'blog' :\n         //   options.params.limit = 20;\n         //   options.params['search[category]'] = _this.category_type.getValue();\n         //   _this.grid.footer.pageSize = 20;\n            vis.menu_page_id_title = false;\n            cm.setHidden(cid('created'), false);\n            cm.setHidden(cid('published'), false);\n            cm.setHidden(cid('template_id_template'), true);\n            this.sortInfo.field = 'published'; // force sort.\n            this.sortInfo.direction = 'DESC'; // force sort.\n            \n            break;\n        \n        case 'menu' :\n        //    options.params.limit = 9999;\n        //    _this.grid.footer.pageSize = 9999;\n            vis.category_type_id_name = false;\n            cm.setHidden(cid('created'), true);\n            cm.setHidden(cid('published'), true);\n            cm.setHidden(cid('template_id_template'), true);\n            this.sortInfo.field = 'tree_sequence'; // force sort.\n            this.sortInfo.direction = 'ASC'; // force sort.\n            \n            break;\n        case 'category' :\n       //     options.params.limit = 20;\n      //      _this.grid.footer.pageSize = 20;\n            vis.menu_page_id_title = false;\n            cm.setHidden(cid('created'), false);\n            cm.setHidden(cid('published'), false);\n            cm.setHidden(cid('template_id_template'), true);\n            this.sortInfo.field = 'tree_sequence'; // force sort.\n            this.sortInfo.direction = 'ASC'; // force sort.\n             \n            break;\n    }\n    \n    if (_this.showDeleted.pressed) {\n        options.params._show_deleted = 1;\n    }\n    \n    for (var i in vis) {\n        cm.setHidden(cm.getIndexByDataIndex(i), !vis[i]);\n    }\n    \n}",
108             "load" : "function (_self, records, options)\n{\n    _this.child_element_panel.region.collapse();\n}"
109            },
110            "xtype" : "Store",
111            "remoteSort" : true,
112            "$ sortInfo" : "{ field : 'created' , direction : 'DESC' }",
113            "$ xns" : "Roo.data",
114            "* prop" : "dataSource",
115            "items" : [
116             {
117              "$ url" : "baseURL + '/Roo/cms_page.php'",
118              "method" : "GET",
119              "xtype" : "HttpProxy",
120              "$ xns" : "Roo.data",
121              "* prop" : "proxy"
122             },
123             {
124              "id" : "id",
125              "root" : "data",
126              "xtype" : "JsonReader",
127              "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'title',\n        'type': 'string'\n    },\n    {\n        'name': 'published',\n        'type': 'date',\n        'format' : 'Y-m-d H:i:s'\n    },\n    {\n        'name': 'body',\n        'type': 'string'\n    },\n    {\n        'name': 'comments_no',\n        'type': 'int'\n    },\n    {\n        'name': 'trackbacks_no',\n        'type': 'int'\n    },\n    {\n        'name': 'extended',\n        'type': 'string'\n    },\n    {\n        'name': 'has_extended',\n        'type': 'int'\n    },\n    {\n        'name': 'author_id',\n        'type': 'int'\n    },\n    {\n        'name': 'category_id',\n        'type': 'int'\n    },\n    {\n        'name': 'category_id_title',\n        'type': 'string'\n    },\n    {\n        'name': 'is_draft',\n        'type': 'int'\n    },\n    {\n        'name': 'updated',\n        'type': 'date',\n        'format' : 'Y-m-d H:i:s'\n    },\n    {\n        'name': 'created',\n        'type': 'date',\n        'format' : 'Y-m-d H:i:s'\n    },\n    {\n        'name': 'to_replace_id',\n        'type': 'int'\n    },\n    {\n        'name': 'page_link',\n        'type': 'string'\n    },\n    {\n        'name': 'in_rss',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id_title',\n        'type': 'string'\n    },\n\n    {\n        'name': 'author_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'author_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'author_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'author_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'author_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'author_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'author_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'author_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'author_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'author_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'author_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'author_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'author_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'author_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'author_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'author_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'category_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'category_id_parent_id',\n        'type': 'int'\n    },\n    {\n        'name': 'category_id_short_name',\n        'type': 'string'\n    },\n    {\n        'name': 'category_id_title',\n        'type': 'string'\n    },\n    {\n        'name': 'category_id_page_text',\n        'type': 'string'\n    },\n    {\n        'name': 'category_id_type',\n        'type': 'string'\n    },\n    {\n        'name': 'category_id_search_on',\n        'type': 'string'\n    },\n    {\n        'name': 'category_id_image_menu_id',\n        'type': 'int'\n    },\n    {\n        'name': 'category_id_image_menuover_id',\n        'type': 'int'\n    },\n    {\n        'name': 'category_id_image_leftactive_id',\n        'type': 'int'\n    },\n    {\n        'name': 'category_id_image_page_id',\n        'type': 'int'\n    },\n    {\n        'name': 'category_id_display_order',\n        'type': 'int'\n    },\n    {\n        'name': 'category_id_more_info_title',\n        'type': 'string'\n    },\n    {\n        'name': 'category_id_more_info_text',\n        'type': 'string'\n    },\n    {\n        'name': 'category_id_visible',\n        'type': 'int'\n    },\n    {\n        'name': 'to_replace_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'to_replace_id_title',\n        'type': 'string'\n    },\n    {\n        'name': 'to_replace_id_published',\n        'type': 'string'\n    },\n    {\n        'name': 'to_replace_id_body',\n        'type': 'string'\n    },\n    {\n        'name': 'to_replace_id_comments_no',\n        'type': 'int'\n    },\n    {\n        'name': 'to_replace_id_trackbacks_no',\n        'type': 'int'\n    },\n    {\n        'name': 'to_replace_id_extended',\n        'type': 'string'\n    },\n    {\n        'name': 'to_replace_id_has_extended',\n        'type': 'int'\n    },\n    {\n        'name': 'to_replace_id_author_id',\n        'type': 'int'\n    },\n    {\n        'name': 'to_replace_id_category_id',\n        'type': 'int'\n    },\n    {\n        'name': 'to_replace_id_is_draft',\n        'type': 'int'\n    },\n    {\n        'name': 'to_replace_id_updated',\n        'type': 'string'\n    },\n    {\n        'name': 'to_replace_id_created',\n        'type': 'string'\n    },\n    {\n        'name': 'to_replace_id_to_replace_id',\n        'type': 'int'\n    },\n    {\n        'name': 'to_replace_id_page_link',\n        'type': 'string'\n    },\n    {\n        'name': 'to_replace_id_in_rss',\n        'type': 'int'\n    },\n    {\n        'name': 'to_replace_id_parent_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id_title',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_id_published',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_id_body',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_id_comments_no',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id_trackbacks_no',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id_extended',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_id_has_extended',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id_author_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id_category_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id_is_draft',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id_updated',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_id_created',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_id_to_replace_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id_page_link',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_id_in_rss',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_id_parent_id',\n        'type': 'int'\n    }\n]",
128              "$ xns" : "Roo.data",
129              "* prop" : "reader",
130              "totalProperty" : "total"
131             }
132            ]
133           },
134           {
135            "pageSize" : 25,
136            "xtype" : "PagingToolbar",
137            "emptyMsg" : "No cms_page found",
138            "$ xns" : "Roo",
139            "displayMsg" : "Displaying cms_page{0} - {1} of {2}",
140            "displayInfo" : true,
141            "* prop" : "footer",
142            "items" : [
143             {
144              "listeners" : {
145               "render" : "function (_self)\n{\n  _this.showDeleted = this;\n}",
146               "click" : "function (_self, e)\n{\n    _this.grid.footer.onClick.defer(100, _this.grid.footer, ['first'] );\n    this.setText( this.pressed ? \"Hide Deleted\" : \"Show Deleted\");\n}"
147              },
148              "xtype" : "Button",
149              "String text" : "Show Deleted",
150              "$ xns" : "Roo.Toolbar",
151              "Boolean enableToggle" : true
152             },
153             {
154              "xtype" : "Separator",
155              "$ xns" : "Roo.Toolbar"
156             },
157             {
158              "listeners" : {
159               "click" : "function (_self, e)\n{\n    new Pman.Download({\n        url: baseURL + '/Roo/Cms_page',\n        newWindow : true,\n        params: {\n            _dump_pages : 1\n        }\n    });\n    \n    Roo.MessageBox.alert(\"Downloading\", \"The file is downloading\");\n}"
160              },
161              "text" : "Export CMS (ZIP)",
162              "xtype" : "Button",
163              "$ xns" : "Roo.Toolbar"
164             },
165             {
166              "xtype" : "Separator",
167              "$ xns" : "Roo.Toolbar"
168             },
169             {
170              "listeners" : {
171               "|render" : "function (_self)\n{\n    _this.image_size_sel = _self;\n}",
172               "|select" : "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
173              },
174              "triggerAction" : "all",
175              "Number width" : 100,
176              "displayField" : "value",
177              "valueField" : "key",
178              "xtype" : "ComboBox",
179              "allowBlank" : false,
180              "editable" : false,
181              "$ xns" : "Roo.form",
182              "Mixed value" : 40,
183              "mode" : "local",
184              "items" : [
185               {
186                "xtype" : "SimpleStore",
187                "$ data" : "[\n     [ 40, \"Small\" ],\n     [ 150, \"Medium\" ],\n     [ 0, \"None\" ]\n]",
188                "$ fields" : "[ 'key', 'value']",
189                "$ xns" : "Roo.data",
190                "* prop" : "store"
191               }
192              ]
193             }
194            ]
195           },
196           {
197            "xtype" : "Toolbar",
198            "$ xns" : "Roo",
199            "* prop" : "toolbar",
200            "items" : [
201             {
202              "listeners" : {
203               "specialkey" : "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}",
204               "render" : "function (_self)\n{\n_this.searchBox=  _self;\n}"
205              },
206              "xtype" : "TextField",
207              "$ xns" : "Roo.form"
208             },
209             {
210              "listeners" : {
211               "|click" : "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
212              },
213              "xtype" : "Button",
214              "cls" : "x-btn-icon",
215              "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
216              "$ xns" : "Roo.Toolbar"
217             },
218             {
219              "listeners" : {
220               "|click" : "function (_self, e)\n{\n    _this.searchBox.setValue('');\n    \n    _this.grid.footer.onClick('first');\n}"
221              },
222              "xtype" : "Button",
223              "cls" : "x-btn-icon",
224              "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
225              "$ xns" : "Roo.Toolbar"
226             },
227             {
228              "xtype" : "Separator",
229              "$ xns" : "Roo.Toolbar"
230             },
231             {
232              "listeners" : {
233               "|click" : "function()\n{\n    var ds = false;\n    \n    \n    if(_this.grid.selModel.getSelections().length == 1){\n       ds = _this.grid.selModel.getSelected().data;\n    }\n    \n    var page_type_id = 0;\n    var page_type_id_name = '';\n    var page_type_id_display_name = '';\n    \n    var sel = _this.category_grid.getSelectionModel().getSelected();\n    \n    if(!ds && sel && sel.data.pid * 1 > 0 && sel.data.type == 'page_type'){\n        page_type_id = sel.data.pid;\n        page_type_id_name = sel.data.name;\n        page_type_id_display_name = sel.data.display_name;\n        \n        if(sel.data.name == 'page'){\n            page_type_id_display_name = 'Pages';\n        }\n        \n        if(sel.data.name == 'blog'){\n            page_type_id_display_name = 'Blog Entries';\n        }\n        \n    }\n\n    /*\n    var s = _this.page_type.selectedData;\n    \n    if(!ds){\n        page_type_id = s.id;\n        page_type_id_name = s.name;\n        page_type_id_display_name = s.display_name;\n        \n        if(s.name == 'page'){\n            page_type_id_display_name = 'Pages';\n        }\n    }\n   */\n   \n    var q =   {\n        id : 0,\n        parent_id : ds ? ds.id : '',\n        parent_id_title : ds ? ds.title : '',\n        page_link : ds && !ds.is_element ? (ds.page_link + '/') : '',\n        page_type_id : ds ? ds.page_type_id : page_type_id,\n        page_type_id_name : ds ? ds.page_type_id_name : page_type_id_name,\n        page_type_id_display_name : ds ? ds.page_type_id_display_name : page_type_id_display_name\n    };\n   \n   _this.dialog.show( q, function() {\n     _this.grid.footer.onClick('first');\n   });\n}\n"
234              },
235              "text" : "Add",
236              "xtype" : "Button",
237              "cls" : "x-btn-text-icon",
238              "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
239              "$ xns" : "Roo.Toolbar"
240             },
241             {
242              "xtype" : "Separator",
243              "$ xns" : "Roo.Toolbar"
244             },
245             {
246              "listeners" : {
247               "|click" : "function()\n{\n    var s = _this.grid.selModel.getSelections();\n    \n    if(_this.grid.selModel.getSelections().length != 1){\n        Roo.MessageBox.alert('Error', 'Please select one row to copy');\n        return;\n    }\n    \n    var sel = _this.grid.selModel.getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Please select one row to copy');\n        return;\n    }\n    \n    var editIt = function() {\n        new Pman.Request({\n            url : baseURL + '/Roo/cms_page.php',\n            method : 'GET',\n            params : {\n                _id : sel.data.id\n            }, \n            success : function(res) {\n                \n                var params = Roo.apply({}, res.data);\n                \n                params.id = 0;\n                params._is_copy = 1;\n                \n                if(params.page_link.length){\n                    params.page_link = params.page_link + '-copy';\n                }\n                \n                if(params.title.length){\n                    params.title = 'Copy of ' + params.title;\n                }\n                \n                _this.dialog.show( params, function() {\n                    _this.grid.footer.onClick('first');\n                });\n            }\n        });\n    }\n    \n    var copyIt = function() {\n        \n        new Pman.Request({\n            url : baseURL + '/Roo/cms_page.php',\n            method : 'POST',\n            params : {\n                _copy_of : sel.data.id\n            }, \n            success : function(res) {\n                \n                Roo.log(res);\n                \n                _this.dialog.show( { id : res.data }, function() {\n                    _this.grid.footer.onClick('first');\n                });\n                \n            }\n        });\n        \n    }\n    \n    Roo.MessageBox.confirm(\n        \"Confirm\", \n        \"Are you wish to copy the child elements as well?\", \n        function(res) {\n            if(res != 'yes') {\n                editIt();\n                return;\n            }\n            \n            copyIt();\n            \n            return;\n        }\n    );\n    \n    \n}\n"
248              },
249              "text" : "Copy",
250              "xtype" : "Button",
251              "cls" : "x-btn-text-icon",
252              "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
253              "$ xns" : "Roo.Toolbar"
254             },
255             {
256              "xtype" : "Fill",
257              "$ xns" : "Roo.Toolbar"
258             },
259             {
260              "listeners" : {
261               "|click" : "function()\n{\n    var ds = false;\n    if(_this.grid.selModel.getSelections().length != 1){\n        Roo.MessageBox.alert(\"Error\", \"Select page to delete\");\n        return;\n    }\n    var  sel = _this.grid.selModel.getSelected();\n    if(sel.data.is_system_page){\n        Roo.MessageBox.alert(\"Error\", \"System pages can not be deleted.\");\n        return;\n    }\n    \n    if (!sel.data.is_deleted) {\n        Roo.MessageBox.confirm(\"Confirm\", \n            \"Are you sure you want to delete this, - to un-delete, select 'Show Deleted' at bottom, select this item and press this button again\", \n            function(res) {\n                if (res != 'yes') {\n                    return;\n                }\n                new Pman.Request({\n                    method : 'POST',\n                    mask : \"Deleting\",\n                    url : baseURL + '/Roo/cms_page',\n                    params : {\n                        id : sel.data.id,\n                        is_deleted : 1  \n                    },\n                    success : function() { \n                        _this.grid.footer.onClick('refresh');\n                    }\n                });\n                \n                    \n            }\n        );\n        return;\n    }\n  \n    \n    new Pman.Request({\n        method : 'POST',\n        url : baseURL + '/Roo/cms_page',\n        mask: 'Un-deleting',\n        params : {\n            id : sel.data.id,\n            is_deleted : 0\n        },\n        success : function() { \n            _this.grid.footer.onClick('refresh');\n        }\n    });\n    \n}\n",
262               "render" : "function (_self)\n{\n    _this.deleteBtn = this;\n}"
263              },
264              "text" : "Delete",
265              "xtype" : "Button",
266              "cls" : "x-btn-text-icon",
267              "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
268              "$ xns" : "Roo.Toolbar"
269             }
270            ]
271           },
272           {
273            "xtype" : "ColumnModel",
274            "header" : "Active",
275            "width" : 75,
276            "$ renderer" : "function(v,x,r) {\n    \n    if (r.data.is_deleted) {\n        return 'DELETED';\n    }\n    \n    var state = v> 0 ?  '' : '-checked';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n}",
277            "$ xns" : "Roo.grid",
278            "* prop" : "colModel[]",
279            "dataIndex" : "is_draft"
280           },
281           {
282            "xtype" : "ColumnModel",
283            "sortable" : false,
284            "header" : "Image",
285            "width" : 75,
286            "$ renderer" : "function(v,x,r) \n{ \n    var size = _this.image_size_sel.getValue() * 1;\n    \n    if(v * 1 < 1 || size == 0){\n        return;\n    }\n    \n    return String.format('<img src=\"{0}/Images/Thumb/{1}/{2}\" width=\"{1}\" height=\"{3}\">', \n            baseURL, size, v, Math.floor(size*0.6)); \n}",
287            "$ xns" : "Roo.grid",
288            "* prop" : "colModel[]",
289            "dataIndex" : "primary_image_id"
290           },
291           {
292            "xtype" : "ColumnModel",
293            "header" : "Created",
294            "width" : 75,
295            "$ renderer" : "function(v) { return v? v.format('d/M/Y') : '--' }",
296            "$ xns" : "Roo.grid",
297            "* prop" : "colModel[]",
298            "dataIndex" : "created"
299           },
300           {
301            "xtype" : "ColumnModel",
302            "header" : "Published",
303            "width" : 75,
304            "$ renderer" : "function(v,x,r) { \n    if (r.data.is_draft) { \n        return '[DRAFT]';\n    }\n\n    return v? v.format('d/M/Y') : '--' \n}",
305            "$ xns" : "Roo.grid",
306            "* prop" : "colModel[]",
307            "dataIndex" : "published"
308           },
309           {
310            "xtype" : "ColumnModel",
311            "header" : "Page link / Name / Order",
312            "width" : 150,
313            "$ renderer" : "function(v,x,r) { \n\n    if (r.data.page_type_id_name == 'page') {\n        return String.format('{0}', v); \n        \n    }\n    \n    if (r.data.page_type_id_name == 'blog') {\n        return String.format('{0}', v); \n    }\n    // what about categories.??\n    \n    // menu, or elements.. ??\n    \n    var d = r.json.depth || 0;\n    var pr = ''; \n    for (i = 0; i < d; i++) {\n      pr += ' ..  ';\n    }\n    if (r.data.page_type_id_name == 'element') {    \n        return String.format('{0}<i>{1}</i>', pr,  v);     \n    }\n    // menu..\n    return String.format('{0}{1}', pr,  v);\n    \n    \n}",
314            "$ xns" : "Roo.grid",
315            "* prop" : "colModel[]",
316            "dataIndex" : "page_link"
317           },
318           {
319            "xtype" : "ColumnModel",
320            "header" : "Title",
321            "width" : 200,
322            "$ renderer" : "function(v,x,r) { \n\n    var d = r.json.tree_depth || 0;\n    var pr = ''; \n    for (i = 0; i < d; i++) {\n      pr += ' ..  ';\n    }\n    \n    var fmt = '<span style=\"color:blue\">{2}{3}</span>' + \n            (r.data.is_draft ? '<s>{0}</s> <b style=\"color:#a94442;\">{1}</b>' : '{0} <b style=\"color:#a94442;\">{1}</b>');\n    \n    return String.format( fmt,\n        pr + v,\n        (r.data.has_child * 1 > 0) ? '[has child]' : '',\n        \n        (r.data.page_type_id_name == 'menu'  ? '('+r.data.seq_id +')' : ''),\n        (r.data.category_page_id *1 ? ( '[' + r.data.category_page_id_title +'] ' ): '')\n        );\n        \n }",
323            "$ xns" : "Roo.grid",
324            "* prop" : "colModel[]",
325            "dataIndex" : "title"
326           },
327           {
328            "xtype" : "ColumnModel",
329            "header" : "Layout",
330            "width" : 75,
331            "$ renderer" : "function(v) { return String.format('{0}', v  || ''); }",
332            "$ xns" : "Roo.grid",
333            "* prop" : "colModel[]",
334            "dataIndex" : "template_id_template"
335           },
336           {
337            "xtype" : "ColumnModel",
338            "header" : "Type",
339            "width" : 100,
340            "$ renderer" : "function(v, x, r) \n{\n    var ret = [];\n    \n    if (r.data.language.length) {\n        ret.push('&gt;&gt; ' + Pman.I18n.toName('l', r.data.language));\n    }\n    \n    if(r.data.translation_type.length){\n    \n        var types = r.data.translation_type.split(',');\n        \n        Roo.each(types, function(t){\n            ret.push('&gt;&gt; ' + Pman.I18n.toName('l', t));\n        });\n    }\n    \n    return ret.join(\"<br/>\");\n    \n    /*\n    if (r.data.language.length) {\n        return '&gt;&gt; ' + Pman.I18n.toName('l', r.data.language);\n    }\n    */\n    \n  /*  if (r.data.in_rss) {\n        return String.format('{0}', v); \n    }\n    if (r.data.is_element) {\n        return String.format('[Element:{0}]', r.data.element_id_name.length ? r.data.element_id_name : ''); \n    }\n    */\n\n}",
341            "$ xns" : "Roo.grid",
342            "* prop" : "colModel[]",
343            "dataIndex" : "category_type_id_name"
344           },
345           {
346            "xtype" : "ColumnModel",
347            "header" : "Links to",
348            "width" : 200,
349            "$ renderer" : "function(v,x,r) { \n\n   if (r.data.is_attachment) {\n        return \"[ATTACHMENT]\";\n    }\n   return String.format('{0}', v); \n }",
350            "$ xns" : "Roo.grid",
351            "* prop" : "colModel[]",
352            "dataIndex" : "menu_page_id_title"
353           },
354           {
355            "xtype" : "ColumnModel",
356            "header" : "Author",
357            "width" : 75,
358            "$ renderer" : "function(v) { return String.format('{0}', v); }",
359            "$ xns" : "Roo.grid",
360            "* prop" : "colModel[]",
361            "dataIndex" : "author_id_name"
362           },
363           {
364            "hidden" : true,
365            "xtype" : "ColumnModel",
366            "header" : "Parent",
367            "width" : 75,
368            "$ renderer" : "function(v) { return String.format('{0}', v  || ''); }",
369            "$ xns" : "Roo.grid",
370            "* prop" : "colModel[]",
371            "dataIndex" : "parent_id_title"
372           },
373           {
374            "hidden" : true,
375            "xtype" : "ColumnModel",
376            "header" : "To replace",
377            "width" : 75,
378            "$ renderer" : "function(v) { return String.format('{0}', v); }",
379            "$ xns" : "Roo.grid",
380            "* prop" : "colModel[]",
381            "dataIndex" : "to_replace_id_title"
382           },
383           {
384            "xtype" : "ColumnModel",
385            "header" : "Ex?",
386            "width" : 25,
387            "$ renderer" : "function(v) { return String.format('{0}', v); }",
388            "$ xns" : "Roo.grid",
389            "* prop" : "colModel[]",
390            "dataIndex" : "has_extended"
391           },
392           {
393            "hidden" : true,
394            "xtype" : "ColumnModel",
395            "header" : "T#",
396            "width" : 25,
397            "$ renderer" : "function(v) { return String.format('{0}', v); }",
398            "$ xns" : "Roo.grid",
399            "* prop" : "colModel[]",
400            "dataIndex" : "trackbacks_no"
401           },
402           {
403            "xtype" : "ColumnModel",
404            "header" : "C#",
405            "width" : 25,
406            "$ renderer" : "function(v) { return String.format('{0}', v); }",
407            "$ xns" : "Roo.grid",
408            "* prop" : "colModel[]",
409            "dataIndex" : "comments_no"
410           },
411           {
412            "xtype" : "ColumnModel",
413            "width" : 50,
414            "header" : "Postion",
415            "$ renderer" : "function(v,x,r) \n{ \n    \n    return v *1;\n    \n}",
416            "$ xns" : "Roo.grid",
417            "* prop" : "colModel[]",
418            "Boolean hidden" : true,
419            "dataIndex" : "seq_id"
420           }
421          ]
422         }
423        ]
424       },
425       {
426        "Boolean fitContainer" : true,
427        "xtype" : "NestedLayoutPanel",
428        "Boolean fitToFrame" : true,
429        "$ xns" : "Roo",
430        "String region" : "west",
431        "Boolean background" : false,
432        "items" : [
433         {
434          "xtype" : "BorderLayout",
435          "$ xns" : "Roo",
436          "* prop" : "layout",
437          "items" : [
438           {
439            "Boolean titlebar" : false,
440            "xtype" : "LayoutRegion",
441            "$ xns" : "Roo",
442            "* prop" : "center"
443           },
444           {
445            "xtype" : "LayoutRegion",
446            "Number height" : 300,
447            "$ xns" : "Roo",
448            "* prop" : "south",
449            "Boolean split" : true
450           },
451           {
452            "listeners" : {
453             "|activate" : "function() {\n\n    _this.category_panel = this;\n    \n    if (_this.category_grid) {\n        _this.category_grid.ds.load({});\n    }\n}"
454            },
455            "bool background" : true,
456            "region" : "center",
457            "fitToframe" : true,
458            "title" : "Category",
459            "xtype" : "GridPanel",
460            "fitContainer" : true,
461            "$ xns" : "Roo",
462            "Boolean autoScroll" : false,
463            "tableName" : "cms_page_category",
464            "items" : [
465             {
466              "listeners" : {
467               "|render" : "function() \n{\n   _this.category_grid = this; \n   \n    if (_this.category_panel.active) {\n       this.ds.load({});\n    }\n}"
468              },
469              "autoExpandColumn" : "display_name",
470              "xtype" : "Grid",
471              "loadMask" : true,
472              "$ xns" : "Roo.grid",
473              "* prop" : "grid",
474              "items" : [
475               {
476                "listeners" : {
477                 "afterselectionchange" : "function (_self)\n{\n    _this.grid.footer.onClick('first');\n}"
478                },
479                "Boolean singleSelect" : true,
480                "xtype" : "RowSelectionModel",
481                "$ xns" : "Roo.grid",
482                "* prop" : "sm"
483               },
484               {
485                "xtype" : "Toolbar",
486                "$ xns" : "Roo",
487                "* prop" : "toolbar",
488                "items" : [
489                 {
490                  "listeners" : {
491                   "click" : "function (_self, e)\n{\n    _this.category_grid.ds.load({});\n}"
492                  },
493                  "xtype" : "Button",
494                  "String text" : "Refresh",
495                  "$ xns" : "Roo.Toolbar"
496                 }
497                ]
498               },
499               {
500                "listeners" : {
501                 "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    o.params._category_list = 1;\n}"
502                },
503                "xtype" : "Store",
504                "remoteSort" : true,
505                "$ sortInfo" : "{ field : 'category_id' , direction : 'ASC' }",
506                "$ xns" : "Roo.data",
507                "* prop" : "dataSource",
508                "items" : [
509                 {
510                  "$ url" : "baseURL + '/Roo/cms_page_category.php'",
511                  "xtype" : "HttpProxy",
512                  "method" : "GET",
513                  "$ xns" : "Roo.data",
514                  "* prop" : "proxy"
515                 },
516                 {
517                  "id" : "id",
518                  "root" : "data",
519                  "xtype" : "JsonReader",
520                  "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'pid',\n        'type': 'int'\n    },\n    {\n        'name': 'display_name',\n        'type': 'string'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'type',\n        'type': 'string'\n    },\n    {\n        'name': 'page_type',\n        'type': 'int'\n    },\n    {\n        'name': 'category_id_is_draft',\n        'type': 'int'\n    }\n]",
521                  "$ xns" : "Roo.data",
522                  "* prop" : "reader",
523                  "totalProperty" : "total"
524                 }
525                ]
526               },
527               {
528                "xtype" : "ColumnModel",
529                "width" : 200,
530                "header" : "Category",
531                "$ renderer" : "function(v,x,r) \n{ \n    if(r.data.category_id_is_draft * 1 == 1){\n        return String.format('<span style=\"text-decoration:line-through\">{0}</span>', v ? v : ''); \n    }\n    \n    return String.format('{0}', v ? v : '');\n}",
532                "$ xns" : "Roo.grid",
533                "* prop" : "colModel[]",
534                "dataIndex" : "display_name"
535               }
536              ]
537             }
538            ]
539           },
540           {
541            "listeners" : {
542             "render" : "function (_self)\n{\n    _this.prepanel = _self;\n    \n    this.el.dom.onload = function(){\n    \n        if(\n            !_this.targetData || \n            !_this.targetData.data.page_link.length ||\n            !uiConfig || \n            typeof(uiConfig.cms_page_preview_base) == 'undefined'\n        ){\n            return;\n        }\n        \n        Roo.get(this.contentDocument.body).on('click', function(){\n            var url = uiConfig.cms_page_preview_base + _this.targetData.data.page_link;\n            window.open(url);\n        });\n    }\n}"
543            },
544            "$ Boolean/Object autoCreate" : "{ tag: 'iframe', src : 'about:blank' }",
545            "region" : "south",
546            "fitToFrame" : true,
547            "title" : "Preview (resize by dragging next to this bar)",
548            "xtype" : "ContentPanel",
549            "fitContainer" : true,
550            "$ xns" : "Roo"
551           }
552          ]
553         }
554        ]
555       },
556       {
557        "listeners" : {
558         "|activate" : "function() {\n    _this.child_element_panel = this;\n    if (_this.child_element_grid) {\n        //_this.child_element_grid.footer.onClick('first');\n    }\n    \n}"
559        },
560        "bool background" : false,
561        "region" : "east",
562        "fitToframe" : true,
563        "title" : "Child Elements",
564        "xtype" : "GridPanel",
565        "fitContainer" : true,
566        "$ xns" : "Roo",
567        "tableName" : "cms_page",
568        "items" : [
569         {
570          "listeners" : {
571           "rowdblclick" : "function (_self, rowIndex, e)\n{\n    var s = this.dataSource.getAt(rowIndex);\n    \n    _this.dialog.show(s.data, function() {\n        _this.child_element_grid.footer.onClick('refresh');\n    }); \n    \n}\n",
572           "|render" : "function() \n{\n   _this.child_element_grid = this; \n    if (_this.child_element_panel.active) {\n      // this.footer.onClick('first');\n    }\n}",
573           "cellclick" : "function (g, ri,ci, e)\r\n{\n    var h = this.colModel.getDataIndex(ci);\n    \n    \n    if(h == 'seq_id'){\n        _this.child_element_grid.trigger_link_click(g, ri, ci, e);\n        return;\n    }\n    \n    \r\n    if (h != 'is_draft') {\r\n        return;\r\n    }\n    \r\n    var rec = g.ds.getAt(ri);\n    \r\n    rec.set('is_draft', rec.data.is_draft ? 0 : 1);\r\n    rec.commit();\n    \r\n}"
574          },
575          "autoExpandColumn" : "title",
576          "| function trigger_link_click" : "function(g, rowIndex, columnIndex, e) \n{ \n    e.preventDefault();\n    \n    var target = e.getTarget();\n    \n    if(target.nodeName.toLowerCase() != 'a'){\n        return;\n    }\n    \n    var rec = _this.grid.ds.getAt(rowIndex);\n    \n    var el = Roo.get(target);\n    \n    if(!el.hasClass('down') && !el.hasClass('up')){\n        return;\n    }\n    \n    var s = this.dataSource.getAt(rowIndex);\n    \n    if(!s || s.data.id * 1 < 1){\n        return;\n    }\n    \n    new Pman.Request({\n        method : 'POST',\n        url : baseURL + '/Roo/cms_page',\n        params : {\n            id : s.data.id,\n            _move : el.hasClass('down') ? 'down' : 'up'\n        },\n        success : function() { \n            _this.child_element_grid.footer.onClick('refresh');\n        }\n    });\n    \n    return;\n    \n}",
577          "xtype" : "Grid",
578          "loadMask" : true,
579          "$ xns" : "Roo.grid",
580          "* prop" : "grid",
581          "items" : [
582           {
583            "Boolean singleSelect" : true,
584            "xtype" : "RowSelectionModel",
585            "$ xns" : "Roo.grid",
586            "* prop" : "sm"
587           },
588           {
589            "listeners" : {
590             "update" : "function (_self, record, operation)\n{\n    if (operation != 'commit') {\n        return;\n    }\n    // only used to change active status.\n    \n    new Pman.request({\r\n        method : 'POST',\r\n        url : baseURL + '/Roo/Cms_page',\r\n        params : {\r\n            id : record.data.id,\r\n            is_draft : record.data.is_draft\r\n        },\n        success : function(res) {\n           _this.child_element_grid.footer.onClick('refresh');\n       }\r\n    });\n}",
591             "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    var  sel = _this.grid.selModel.getSelected();\n    \n    if(\n        !sel || \n        sel.data.id * 1< 1 || \n        sel.data.page_type_id_name != 'page' ||\n        sel.data.template_id * 1 < 1 ||\n        sel.data.has_child_element_type * 1 < 1\n    ){\n        this.removeAll();\n        \n        _this.child_element_panel.region.collapse();\n        \n        return false;\n    }\n    \n    _this.child_element_panel.region.expand();\n    \n    options.params._list_elements = sel.data.id;\n    \n    if (_this.child_show_deleted.pressed) {\n        options.params._show_deleted = 1;\n    }\n    \n}"
592            },
593            "xtype" : "Store",
594            "remoteSort" : true,
595            "$ sortInfo" : "{ field : 'created' , direction : 'DESC' }",
596            "$ xns" : "Roo.data",
597            "* prop" : "dataSource",
598            "items" : [
599             {
600              "$ url" : "baseURL + '/Roo/cms_page.php'",
601              "xtype" : "HttpProxy",
602              "method" : "GET",
603              "$ xns" : "Roo.data",
604              "* prop" : "proxy"
605             },
606             {
607              "id" : "id",
608              "root" : "data",
609              "xtype" : "JsonReader",
610              "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'title',\n        'type': 'string'\n    },\n    {\n        'name': 'element_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'seq_id',\n        'type': 'int'\n    },\n    {\n        'name': 'is_draft',\n        'type': 'int'\n    },\n    {\n        'name': 'is_deleted',\n        'type': 'int'\n    },\n    {\n        'name': 'language',\n        'type': 'string'\n    },\n    {\n        'name': 'translation_type',\n        'type': 'string'\n    },\n    {\n        'name': 'primary_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'template_id_template',\n        'type': 'string'\n    }\n]",
611              "$ xns" : "Roo.data",
612              "* prop" : "reader",
613              "totalProperty" : "total"
614             }
615            ]
616           },
617           {
618            "xtype" : "Toolbar",
619            "$ xns" : "Roo",
620            "* prop" : "toolbar",
621            "items" : [
622             {
623              "listeners" : {
624               "|click" : "function()\n{\n    var s = _this.grid.selModel.getSelected();\n    \n    if(!s || s.data.id * 1 < 1 || s.data.template_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Please select a page');\n        return;\n    }\n    \n    Pman.Dialog.AddChildElementToPage.show({\n        template_id : s.data.template_id\n    }, function(res) {\n        \n        var params =   {\n            id : 0,\n            element_id : res.element_id,\n            element_id_name : res.element_id_name,\n            page_type_id : s.data.element_page_type_id,\n            page_type_id_name : 'element',\n            page_type_id_display_name : 'Elements',\n            parent_id : s.data.id,\n            parent_id_title : s.data.title\n        };\n       \n        _this.dialog.show( params, function() {\n            _this.grid.footer.onClick('first');\n        });\n        \n    });\n    \n    \n}\n"
625              },
626              "text" : "Add",
627              "xtype" : "Button",
628              "cls" : "x-btn-text-icon",
629              "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
630              "$ xns" : "Roo.Toolbar"
631             },
632             {
633              "xtype" : "Fill",
634              "$ xns" : "Roo.Toolbar"
635             },
636             {
637              "listeners" : {
638               "|click" : "function()\n{\n    var sel = _this.child_element_grid.selModel.getSelected();\n    \n    if(!sel || sel.data.id * 1< 1){\n        Roo.MessageBox.alert(\"Error\", \"Select page to delete\");\n        return;\n    }\n    \n    new Pman.Request({\n        method : 'POST',\n        url : baseURL + '/Roo/cms_page',\n        params : {\n            id : sel.data.id,\n            is_deleted : 1\n        },\n        success : function() { \n            _this.child_element_grid.footer.onClick('refresh');\n        }\n    });\n}\n"
639              },
640              "text" : "Delete",
641              "xtype" : "Button",
642              "cls" : "x-btn-text-icon",
643              "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
644              "$ xns" : "Roo.Toolbar"
645             }
646            ]
647           },
648           {
649            "pageSize" : 25,
650            "xtype" : "PagingToolbar",
651            "emptyMsg" : "No page found",
652            "$ xns" : "Roo",
653            "displayMsg" : "{0} - {1} of {2}",
654            "displayInfo" : true,
655            "* prop" : "footer",
656            "items" : [
657             {
658              "listeners" : {
659               "render" : "function (_self)\n{\n  _this.child_show_deleted = this;\n}",
660               "click" : "function (_self, e)\n{\n    _this.child_element_grid.footer.onClick.defer(100, _this.child_element_grid.footer, ['first'] );\n    this.setText( this.pressed ? \"Hide Deleted\" : \"Show Deleted\");\n}"
661              },
662              "xtype" : "Button",
663              "String text" : "Show Deleted",
664              "$ xns" : "Roo.Toolbar",
665              "Boolean enableToggle" : true
666             }
667            ]
668           },
669           {
670            "xtype" : "ColumnModel",
671            "width" : 50,
672            "header" : "Image",
673            "$ renderer" : "function(v,x,r) \n{ \n    if(!v){\n        return '';\n    }\n    \n    return String.format('<img src=\"{0}/Images/Thumb/40/{1}\" width=\"40\">', baseURL, v); \n}",
674            "$ xns" : "Roo.grid",
675            "* prop" : "cm[]",
676            "dataIndex" : "primary_image_id"
677           },
678           {
679            "xtype" : "ColumnModel",
680            "width" : 40,
681            "header" : "Active",
682            "$ renderer" : "function(v,x,r) {\n     \n    var state = v> 0 ?  '' : '-checked';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n}",
683            "$ xns" : "Roo.grid",
684            "* prop" : "cm[]",
685            "dataIndex" : "is_draft"
686           },
687           {
688            "xtype" : "ColumnModel",
689            "width" : 100,
690            "header" : "Location",
691            "$ renderer" : "function(v,x,r) { \n\n    var fmt = '';\n    \n    if(r.data.template_id_template.length){\n        \n        fmt = (r.data.is_deleted ? '<s>{0}<br/>{1}</s>' : '{0}<br/>{1}');\n        \n        return String.format(fmt, v, r.data.template_id_template);\n    }\n    \n    fmt = (r.data.is_deleted ? '<s>{0}</s>' : '{0}');\n    \n    return String.format( fmt, v);\n    \n    \n }",
692            "$ xns" : "Roo.grid",
693            "* prop" : "cm[]",
694            "dataIndex" : "element_id_name"
695           },
696           {
697            "xtype" : "ColumnModel",
698            "header" : "Title",
699            "width" : 75,
700            "$ renderer" : "function(v,x,r) { \n\n    var fmt = (r.data.is_deleted ? '<s>{0}</s>' : '{0}');\n    \n    return String.format( fmt, v);\n }",
701            "$ xns" : "Roo.grid",
702            "* prop" : "cm[]",
703            "dataIndex" : "title"
704           },
705           {
706            "xtype" : "ColumnModel",
707            "width" : 75,
708            "header" : "Type",
709            "$ renderer" : "function(v, x, r) \n{\n    var ret = [];\n    \n    if (r.data.language.length) {\n        ret.push('&gt;&gt; ' + Pman.I18n.toName('l', r.data.language));\n    }\n    \n    if(r.data.translation_type.length){\n    \n        var types = r.data.translation_type.split(',');\n        \n        Roo.each(types, function(t){\n            ret.push('&gt;&gt; ' + Pman.I18n.toName('l', t));\n        });\n    }\n    \n    return ret.join(\"<br/>\");\n    \n}",
710            "$ xns" : "Roo.grid",
711            "* prop" : "cm[]",
712            "dataIndex" : "language"
713           },
714           {
715            "xtype" : "ColumnModel",
716            "width" : 75,
717            "header" : "Postion",
718            "$ renderer" : "function(v,x,r) \n{ \n    \n    var fmt = String.format(\n                '<a href=\"#\" class=\"down\" style=\"font-weight: bold; font-size: 20px; text-decoration: none;\" tooltip=\"Down\">&uarr;</a>' +\n                '<a href=\"#\" class=\"up\" style=\"font-weight: bold; font-size: 20px; text-decoration: none; margin-left: 15px;\" tooltip=\"Up\">&darr;</a>'\n            );\n            \n    return fmt;\n    \n}",
719            "$ xns" : "Roo.grid",
720            "* prop" : "cm[]",
721            "dataIndex" : "seq_id"
722           },
723           {
724            "xtype" : "ColumnModel",
725            "header" : "Postion",
726            "width" : 30,
727            "$ renderer" : "function(v,x,r) \n{ \n    \n    return v *1;\n    \n}",
728            "$ xns" : "Roo.grid",
729            "* prop" : "cm[]",
730            "Boolean hidden" : true,
731            "dataIndex" : "seq_id"
732           }
733          ]
734         }
735        ]
736       }
737      ]
738     }
739    ]
740   }
741  ]
742 }