DataObjects/Cms_page.php
[Pman.Cms] / Pman.Dialog.CmsBlog.bjs
1 {
2  "name" : "Pman.Dialog.CmsBlog",
3  "parent" : "",
4  "title" : "Cms -Edit Blog Entry",
5  "path" : "/home/alan/gitlive/Pman.Cms/Pman.Dialog.CmsBlog.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "2f26e35d61be90501e099089dc533638" : "Select Images",
10   "f3912172e6bf57f8979782f4a2342233" : "Appears in Block",
11   "95cb4f45ab7ff3984f25ab8668499020" : "Select Parent",
12   "c1df1da7a1ce305a3b60af9d5733ac1d" : "Contents",
13   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
14   "ebd9bec4d70abc789d439c1f136b0538" : "Layout",
15   "20bec77364d863100a1f9325873a8504" : "Select Page Type",
16   "a517747c3d12f99244ae598910d979c5" : "Author",
17   "31fde7b05ac8952dacf4af8a704074ec" : "Preview",
18   "779e2624ddf330fb05b51ae59faf212d" : "Select Status Type",
19   "5834d26e96dbae06029496e5b111dca2" : "Has Extended content?",
20   "6a5b847af3d97df722040debdbccfbed" : "Page Type",
21   "30d1a216420426fcbd43ca70acd4aa48" : "Select interests",
22   "f03ab16cd58372c77ba45a3d9a5a1cb9" : "Draft",
23   "cc6892c9705afcfa61c53698756ba51b" : "Page Class",
24   "e6b391a8d2c4d45902a23a8b6585703d" : "URL",
25   "03368e3c1eb4d2a9048775874301b19f" : "Select category",
26   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
27   "778551900655782c5c7827332b08cf3f" : "Save and close",
28   "77174410b72decfd0b259961f1f65a8f" : "Attributes:",
29   "b28a711cf7e94ec793ef926633997529" : "Seq",
30   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
31   "8a53accfc94c2500b00575ce0e0d786f" : "Primary Image",
32   "580b21aac58f1b73cece26e272cdfbee" : "Add Link",
33   "8bc84316c4078bf66723fd019616d920" : "Descriptions",
34   "83dad8107f9459efe2b4fabcf5b63108" : "Select Language",
35   "76729937a5eb6b0fd88c42581161facd" : "Select Category ",
36   "0b8d92bc19b720bb1065649535463409" : "Translations",
37   "14c21301c0faf9d5561b8a580be21a13" : "Select class",
38   "d41d8cd98f00b204e9800998ecf8427e" : "",
39   "867343577fa1f33caa632a19543bd252" : "Keywords",
40   "340c2ee497b85d5954b01c64de7f44f6" : "Select Person",
41   "69dd756ae9c23191a5bb9b61f0857432" : "Date to Publish",
42   "3adbdb3ac060038aa0e6e6c138ef9873" : "Category",
43   "57e195426892c5515935f21d97228814" : "Extended Contents",
44   "d88aa1eee60ba140f07d5f81769cec74" : "<< Edit Translations",
45   "b9c49611cfda3259a2b837b39489e650" : "Add Image",
46   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
47   "cfcd208495d565ef66e7dff9f98764da" : "0",
48   "d8e4d1f5e445107e505b2cf63a1fb65c" : "Extra CSS",
49   "bd88a20b53a47f7b5704a83a15ff5506" : "Saved Version",
50   "31bb2f6e9b8fb11cbb7fb63c6025223f" : "Select Template",
51   "c02bd0c22c290ae599ee2f3ff2023fd3" : "Manage Images / Attachments >>",
52   "b78a3223503896721cca1303f776159b" : "Title",
53   "39f64cc9436cacfbceda3b7bdeb8e24c" : "Styles (CSS)",
54   "e64df1d7c22b9638f084ce8a4aff3ff3" : "Target URL",
55   "98e93e8f7adfe14832db6caed713d849" : "Meta Tags",
56   "a240fa27925a635b08dc28c9e4f9216d" : "Order",
57   "287234a1ff35a314b5b6bc4e5828e745" : "Attributes",
58   "99e7707748ae048e17c5810fad119e0b" : "Select Page",
59   "06933067aafd48425d67bcb01bba5cb6" : "Update",
60   "8adedb6a6226807ba810215dd3b3c61b" : "Menu links to Page",
61   "b5216c9b4e0ac0afd9c76eb1d12ad1b9" : "Select Section",
62   "2ad41a2ff4f0dac97d63aff331d5e6e7" : "Downloads first Attachment",
63   "308f2757bfc9ce92fb00ff93fdffd279" : "Images / Attachments",
64   "76eb64a1725ee953c664e15c9213b2fd" : "Extended Content",
65   "1351017ac6423911223bc19a8cb7c653" : "Filename",
66   "c9cc8cce247e49bae79f15173ce97354" : "Save",
67   "e659b52eba1f0299b2d8ca3483919e72" : "Type:",
68   "c70952e4ab3806c049737cd7d2b8896b" : "Interests",
69   "aa6356b678bc4fc78253c9edf65bff03" : "Edit Page / Blog Entry",
70   "d52f80f80467bb575253a5a39ca016a7" : "Page link /  Name / Order",
71   "fff0d600f8a0b5e19e88bfb821dd1157" : "Images",
72   "30269022e9d8f51beaabb52e5d0de2b7" : "Parent",
73   "fb3f11443065d5f4d8303ad913db9680" : "Replaces (ignore)"
74  },
75  "named_strings" : {
76   "seq_id_fieldLabel" : "b28a711cf7e94ec793ef926633997529",
77   "to_replace_id_fieldLabel" : "fb3f11443065d5f4d8303ad913db9680",
78   "template_id_template_clean_fieldLabel" : "ebd9bec4d70abc789d439c1f136b0538",
79   "page_cls_name_fieldLabel" : "cc6892c9705afcfa61c53698756ba51b",
80   "language_name_loadingText" : "1243daf593fa297e07ab03bf06d925af",
81   "template_id_template_clean_qtip" : "76729937a5eb6b0fd88c42581161facd",
82   "author_id_name_loadingText" : "1243daf593fa297e07ab03bf06d925af",
83   "page_type_id_display_name_fieldLabel" : "6a5b847af3d97df722040debdbccfbed",
84   "has_extended_boxLabel" : "5834d26e96dbae06029496e5b111dca2",
85   "language_name_emptyText" : "83dad8107f9459efe2b4fabcf5b63108",
86   "author_id_name_qtip" : "340c2ee497b85d5954b01c64de7f44f6",
87   "menu_page_id_page_link_qtip" : "76729937a5eb6b0fd88c42581161facd",
88   "published_fieldLabel" : "69dd756ae9c23191a5bb9b61f0857432",
89   "author_id_name_fieldLabel" : "a517747c3d12f99244ae598910d979c5",
90   "element_id_name_qtip" : "76729937a5eb6b0fd88c42581161facd",
91   "parent_id_title_qtip" : "76729937a5eb6b0fd88c42581161facd",
92   "element_id_name_loadingText" : "1243daf593fa297e07ab03bf06d925af",
93   "author_id_name_emptyText" : "340c2ee497b85d5954b01c64de7f44f6",
94   "is_attachment_boxLabel" : "2ad41a2ff4f0dac97d63aff331d5e6e7",
95   "extra_css_fieldLabel" : "39f64cc9436cacfbceda3b7bdeb8e24c",
96   "template_id_template_clean_loadingText" : "1243daf593fa297e07ab03bf06d925af",
97   "parent_id_title_loadingText" : "1243daf593fa297e07ab03bf06d925af",
98   "is_draft_fieldLabel" : "287234a1ff35a314b5b6bc4e5828e745",
99   "add_link_emptyText" : "580b21aac58f1b73cece26e272cdfbee",
100   "keywords_fieldLabel" : "867343577fa1f33caa632a19543bd252",
101   "descriptions_fieldLabel" : "8bc84316c4078bf66723fd019616d920",
102   "add_link_loadingText" : "1243daf593fa297e07ab03bf06d925af",
103   "menu_page_id_page_link_emptyText" : "99e7707748ae048e17c5810fad119e0b",
104   "element_id_name_fieldLabel" : "f3912172e6bf57f8979782f4a2342233",
105   "is_element_value" : "cfcd208495d565ef66e7dff9f98764da",
106   "target_url_fieldLabel" : "e64df1d7c22b9638f084ce8a4aff3ff3",
107   "interest_name_fieldLabel" : "c70952e4ab3806c049737cd7d2b8896b",
108   "language_name_qtip" : "83dad8107f9459efe2b4fabcf5b63108",
109   "page_type_id_display_name_loadingText" : "1243daf593fa297e07ab03bf06d925af",
110   "language_name_fieldLabel" : "83dad8107f9459efe2b4fabcf5b63108",
111   "element_id_name_emptyText" : "b5216c9b4e0ac0afd9c76eb1d12ad1b9",
112   "menu_page_id_page_link_fieldLabel" : "8adedb6a6226807ba810215dd3b3c61b",
113   "page_type_id_display_name_emptyText" : "779e2624ddf330fb05b51ae59faf212d",
114   "template_id_template_clean_emptyText" : "31bb2f6e9b8fb11cbb7fb63c6025223f",
115   "menu_page_id_page_link_loadingText" : "1243daf593fa297e07ab03bf06d925af",
116   "extended_fieldLabel" : "57e195426892c5515935f21d97228814",
117   "add_link_qtip" : "76729937a5eb6b0fd88c42581161facd",
118   "category_name_fieldLabel" : "3adbdb3ac060038aa0e6e6c138ef9873",
119   "page_type_id_display_name_qtip" : "20bec77364d863100a1f9325873a8504",
120   "body_fieldLabel" : "c1df1da7a1ce305a3b60af9d5733ac1d",
121   "parent_id_title_emptyText" : "95cb4f45ab7ff3984f25ab8668499020",
122   "title_fieldLabel" : "b78a3223503896721cca1303f776159b",
123   "is_draft_boxLabel" : "f03ab16cd58372c77ba45a3d9a5a1cb9",
124   "page_link_fieldLabel" : "d52f80f80467bb575253a5a39ca016a7",
125   "parent_id_title_fieldLabel" : "30269022e9d8f51beaabb52e5d0de2b7"
126  },
127  "items" : [
128   {
129    "listeners" : {
130     "show" : "function (_self)\n{\n    // @see the contentpanel - center - resize handler.\n\n    _this.centerLayoutPanel.getLayout().getRegion('south').showPanel(0);\n    \n    var w = Roo.lib.Dom.getViewWidth();\n    var h = Roo.lib.Dom.getViewHeight();\n    this.resizeTo(w-50, h-50);\n    this.center();\n    \n    _this.centerLayoutPanel.getLayout().getRegion('south').resizeTo(h - 450);\n    _this.westLayoutPanel.getLayout().getRegion('south').resizeTo(h - 450);\n    \n    Pman.Cms.pageEditAddCustomFields();\n    \n    _this.dialog.getLayout().getRegion('east').collapse();\n    _this.dialog.getLayout().getRegion('west').collapse();\n    \n    /*\n    var ew = Math.max(250, w-150); // was 350?/ why?\n    //var eh = Math.max(250, h-350) ;\n    var eh = 200;\n    \n    var bd = _this.form1.findField('body');\n    \n    if (bd.resizeEl) { \n        bd.width = ew;\n        bd.height = eh;\n        // since render delays resize.. \n       bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height  ] );\n        //_this.bodycol.el.setWidth(bd.width+20);\n    }\n    var bd = _this.form2.findField('extended');\n    if (bd.resizeEl) { \n        bd.width = ew;\n        bd.height = eh;\n        // since render delays resize.. \n       bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height  ] );\n     //  _this.extendcol.el.setWidth(bd.width+20);\n    }\n     var bd = _this.form3.findField('extra_css');\n    if (bd) { \n        bd.el.setWidth(ew);\n       //_this.keywordscol.el.setWidth(ew+20);\n    }\n    \n    // fix messed up scroll.\n    _this.dialog.layout.el.dom.scrollTop = 0;\n    \n    */\n}"
131    },
132    "modal" : true,
133    "collapsible" : false,
134    "background" : true,
135    "title" : "Edit Page / Blog Entry",
136    "xtype" : "LayoutDialog",
137    "| function setStylesheets" : "function() {\n    var sheets = [];\n    \n    sheets.push(rootURL + '/Pman/Cms/templates/undoreset.css');\n    \n    if(typeof(uiConfig) !== 'undefined'  && typeof(uiConfig.cms_css) != 'undefined'){\n        Roo.each(uiConfig.cms_css, function(v){\n            sheets.push(rootURL + v);\n        })\n    }\n    \n    new Pman.Request({\n       url : baseURL + '/Roo/Cms_page.php',\n       method : 'GET',\n       params : {\n           _stylesheets : 1\n       }, \n       success : function(res) {\n            Roo.log(res);\n            if(res.data._stylesheets.length){\n                var setting = res.data._stylesheets.split(\"\\n\");\n                \n                Roo.each(setting, function(s){\n                    sheets.push(s.replace('{rootURL}', rootURL));\n                });\n                \n            }\n\n            _this.form1.findField('body').removeStylesheets();\n            _this.form2.findField('extended').removeStylesheets();\n\n            _this.form1.findField('body').setStylesheets(sheets);\n            _this.form2.findField('extended').setStylesheets(sheets);\n\n            _this.trform1.findField('body').removeStylesheets();\n            _this.trform2.findField('extended').removeStylesheets();\n            \n            _this.trform1.findField('body').setStylesheets(sheets);\n            _this.trform2.findField('extended').setStylesheets(sheets);\n       }\n   });\n\n}",
138    "width" : 850,
139    "$ xns" : "Roo",
140    "closable" : true,
141    "resizable" : false,
142    "height" : 600,
143    "items" : [
144     {
145      "xtype" : "LayoutRegion",
146      "$ xns" : "Roo",
147      "* prop" : "center",
148      "titlebar" : false
149     },
150     {
151      "listeners" : {
152       "expanded" : "function (_self)\n{\n    var id = _this.form.findField('id').getValue() * 1;\n    \n    if(id < 1){\n        Roo.MessageBox.alert('Error', 'Save first');\n        this.collapse();\n        return;\n    }\n    \n    var w = Roo.lib.Dom.getViewWidth();\n    var h = Roo.lib.Dom.getViewHeight();\n    \n    _self.resizeTo.defer(110, _self,[ w-400,  h-350] );\n    \n    _this.panel.region.collapse();\n    \n}",
153       "collapsed" : "function (_self)\n{\n    if(_this.trform && _this.trform.isDirty()){\n        _this.trform.reset();\n    }\n    \n    if(_this.trform1 && _this.trform1.isDirty()){\n        _this.trform1.reset();\n    }\n    \n    if(_this.trform2 && _this.trform2.isDirty()){\n        _this.trform2.reset();\n    }\n    \n    if(_this.trform3 && _this.trform3.isDirty()){\n        _this.trform3.reset();\n    }\n    \n}",
154       "beforecollapse" : "function (_self)\n{\n    if(!_this.trform || !_this.trform1 || !_this.trform2){\n        return true;\n    }\n    \n    if(\n        !_this.trform.isDirty() &&\n        !_this.trform1.isDirty() &&\n        !_this.trform2.isDirty() &&\n        !_this.trform3.isDirty()\n    ) {\n        return true;\n    }\n    \n    Roo.MessageBox.confirm(\n        \"Confirm\", \n        \"Do you want to save the translation\",\n        function(res) {\n            if(res != 'yes') {\n                _self.collapse(true, true);\n                return true;\n            }\n            \n            return false;\n        }\n    );\n    \n    return false;\n}"
155      },
156      "collapsedTitle" : "Translations",
157      "collapsible" : true,
158      "fitToFrame" : true,
159      "title" : "Translations",
160      "xtype" : "LayoutRegion",
161      "collapsed" : true,
162      "$ xns" : "Roo",
163      "split" : true,
164      "* prop" : "west",
165      "titlebar" : true
166     },
167     {
168      "listeners" : {
169       "expanded" : "function (_self)\n{\n    var id = _this.form.findField('id').getValue() * 1;\n    \n    if(id < 1){\n        Roo.MessageBox.alert('Error', 'Save first');\n        this.collapse();\n        return;\n    }\n    \n    var w = Roo.lib.Dom.getViewWidth();\n    var h = Roo.lib.Dom.getViewHeight();\n    \n    _self.resizeTo.defer(110, _self,[ w-400,  h] );\n    _this.dialog.getLayout().getRegion('west').collapse();\n}"
170      },
171      "collapsedTitle" : "Images / Attachments",
172      "collapsible" : true,
173      "fitToFrame" : true,
174      "title" : "Images / Attachments",
175      "xtype" : "LayoutRegion",
176      "collapsed" : true,
177      "$ xns" : "Roo",
178      "split" : true,
179      "* prop" : "east",
180      "titlebar" : true
181     },
182     {
183      "listeners" : {
184       "render" : "function (_self)\n{\n    _this.centerLayoutPanel = this;\n    \n}"
185      },
186      "Boolean fitContainer" : true,
187      "xtype" : "NestedLayoutPanel",
188      "Boolean fitToFrame" : true,
189      "$ xns" : "Roo",
190      "String region" : "center",
191      "Boolean background" : false,
192      "items" : [
193       {
194        "xtype" : "BorderLayout",
195        "$ xns" : "Roo",
196        "* prop" : "layout",
197        "items" : [
198         {
199          "String tabPosition" : "top",
200          "xtype" : "LayoutRegion",
201          "$ xns" : "Roo",
202          "* prop" : "center"
203         },
204         {
205          "String tabPosition" : "top",
206          "xtype" : "LayoutRegion",
207          "Number height" : 250,
208          "$ xns" : "Roo",
209          "* prop" : "south",
210          "Boolean split" : true
211         },
212         {
213          "listeners" : {
214           "resize" : "function (_self, width, height)\n{\n    Roo.log(\"RESIZE, \" + width + ',' + height);\n    \n    var ew = Math.max(250, width - 10);\n    var eh = _this.centerLayoutPanel.getLayout().getRegion('south').el.getHeight() - 30;\n    \n    if (!_this.form) {\n        return;\n    }\n    var bd;\n    if (_this.form1) {\n        bd = _this.form1.findField('body');\n        if (bd.resizeEl) { \n            bd.width = ew;\n            bd.height = eh;\n            // since render delays resize.. \n            Roo.log('resizing body to ' + bd.width);        \n           bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height  ] );\n         //   _this.bodycol.el.setWidth(bd.width+20);\n        }\n    }\n    \n    if (_this.form2) {\n        bd = _this.form2.findField('extended');\n        \n        if (bd.resizeEl) { \n            bd.width = ew;\n            bd.height = eh;\n            \n            Roo.log('resizing extended to ' + bd.width);\n            // since render delays resize.. \n           bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height  ] );\n        //   _this.extendcol.el.setWidth(bd.width+20);\n        }\n    }\n    if (_this.form3) {\n        \n        bd = _this.form3.findField('extra_css');\n        if (bd) { \n            bd.el.setWidth(ew);\n            bd.el.setHeight(eh);\n       //    _this.keywordscol.el.setWidth(ew+20);\n        }\n    // fix for messed up rendering of dialog?\n    }\n    \n    try { \n        _this.dialog.layout.el.dom.scrollTop = 0;\n    } catch (e) { \n        // noop... - the above sometimes fails...\n    }\n}",
215           "render" : "function (_self)\n{\n  _this.cpanel = _self;\n}"
216          },
217          "autoScroll" : true,
218          "region" : "center",
219          "fitToFrame" : true,
220          "xtype" : "ContentPanel",
221          "$ xns" : "Roo",
222          "items" : [
223           {
224            "xtype" : "Toolbar",
225            "$ xns" : "Roo",
226            "* prop" : "toolbar",
227            "items" : [
228             {
229              "listeners" : {
230               "click" : "function (_self, e)\n{\n    if (_this.dialog.getLayout().getRegion('west').collapsed) {\n        _this.dialog.getLayout().getRegion('west').expand();\n    } else {\n        _this.dialog.getLayout().getRegion('west').collapse();\n    }\n    \n}"
231              },
232              "text" : "<< Edit Translations",
233              "xtype" : "Button",
234              "$ xns" : "Roo.Toolbar"
235             },
236             {
237              "xtype" : "Fill",
238              "$ xns" : "Roo.Toolbar"
239             },
240             {
241              "listeners" : {
242               "click" : "function (_self, e)\n{\n    if (_this.panel.region.collapsed) {\n        _this.panel.region.expand();\n    } else {\n        _this.panel.region.collapse();\n    }\n    \n}"
243              },
244              "text" : "Manage Images / Attachments >>",
245              "xtype" : "Button",
246              "$ xns" : "Roo.Toolbar"
247             }
248            ]
249           },
250           {
251            "listeners" : {
252             "|actionfailed" : "function (_self, action)\n{\n    _this.dialog.el.unmask(); \n    Pman.standardActionFailed(_self, action);\n}\n",
253             "|actioncomplete" : "function (_self, action)\n{\n\n   if (action.type == 'setdata') {\n\n        _this.form.addForm(_this.form1);\n        _this.form.addForm(_this.form2);\n        _this.form.addForm(_this.form3);\n        _this.form.addForm(_this.form4);\n        \n        _this.dialog.setStylesheets();\n        \n        _this.dialog.getLayout().getRegion('west').collapse();\n        _this.panel.region.collapse();\n        \n        _this.trpanel.el.mask('Save first');\n        _this.panel.el.mask('Save first');\n        \n        _this.loaded = false;\n        _this.interestsCol.hide();\n        \n        //_this.form.findField('category_page_id').fieldEl.select('label',true).first().dom.innerHTML = 'Category';\n        \n        if ( _this.data.id) {\n            _this.dialog.el.mask(\"Loading\");\n            this.load({ method: 'GET', params: { '_id' : _this.data.id, '_with_primary_image' : 1 }});\n        } else {\n\n            _this.loaded = true;\n            var is_draft = typeof(_this.data.is_draft) != 'undefined' ? _this.data.is_draft : 1;\n            this.findField('is_draft').setValue(is_draft);\n            _this.page_type.setValue(_this.data.page_type_id);\n            _this.page_type.el.dom.value = _this.data.page_type_id_display_name;\n            \n            if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf(\"Crm\") !== -1){\n                _this.interestsCol.show();\n            }\n            \n            _this.form.showHide();\n            \n            /*\n            var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()\n            catlabel.dom.innerHTML = 'Category';            \n            if(_this.data.page_type_id_name == 'category'){\n                catlabel.dom.innerHTML = 'Parent Category';\n            } \n            */\n            \n            /*\n            var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();\n            catlabel.dom.innerHTML = 'Parent page';\n            if(_this.data.page_type_id_name == 'category'){\n                catlabel.dom.innerHTML = 'Parent';\n            }\n            */\n            \n        }\n        \n        if(_this.data._is_copy){\n            _this.form.is_copy();\n        }\n        \n        return;\n    }\n    \n    if (action.type == 'load') {\n    \n        //_this.data = action.result.data;\n        \n        var d = action.result.data;\n        \n        _this.dialog.el.unmask();\n       _this.grid.getDataSource().load();\n       \n       _this.trform.reset();\n       _this.trform1.reset();\n       _this.trform2.reset();\n       _this.trform3.reset();\n       \n       _this.trform.addForm(_this.trform1);\n       _this.trform.addForm(_this.trform2);\n        \n       _this.form1.findField('body').originalValue = _this.form1.findField('body').getValue();\n       _this.form2.findField('extended').originalValue = _this.form2.findField('extended').getValue();\n       _this.form3.findField('extra_css').originalValue = _this.form3.findField('extra_css').getValue();\n       _this.form4.findField('keywords').originalValue = _this.form4.findField('keywords').getValue();\n       _this.form4.findField('descriptions').originalValue = _this.form4.findField('descriptions').getValue();\n       \n       /*\n        var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()\n        catlabel.dom.innerHTML = 'Category';            \n        \n        if(_this.data.page_type_id_name == 'category'){\n            catlabel.dom.innerHTML = 'Parent Category';\n        }\n        */\n        /*\n        var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();\n        catlabel.dom.innerHTML = 'Parent page';            \n        if(_this.data.page_type_id_name == 'category'){\n            catlabel.dom.innerHTML = 'Parent';\n        }\n        */\n        // better if this was not here... - not sure which project uses it?\n        \n        if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf(\"Crm\") !== -1){\n            _this.interestsCol.show();\n        }\n        \n        if(typeof(d['interests']) != 'undefined'){\n            _this.form.findField('interest').setValue(Roo.decode(d['interests']));\n        }\n        \n        if(typeof(d['categories']) != 'undefined'){\n            _this.form.findField('category').setValue(Roo.decode(d['categories']));\n        }\n        \n        if(typeof(d['page_classes']) != 'undefined'){\n            _this.form.findField('page_cls').setValue(Roo.decode(d['page_classes']));\n        }\n        \n        _this.trpanel.el.unmask();\n        _this.panel.el.unmask();\n        \n        // fix scrolling..\n        _this.cpanel.el.dom.scrollTop = 0;\n        \n        // fix messed up scroll.\n        _this.dialog.layout.el.dom.scrollTop = 0;\n        \n        return;\n    }\n    if (action.type =='submit') {\n       \n       _this.dialog.el.unmask();\n       \n       if(!_this.exit){\n            this.load({ method: 'GET', params: { '_id' : action.result.data.id }});\n            return;\n       }\n       \n       _this.dialog.hide();\n       \n\n        if (_this.callback) {\n           _this.callback.call(_this, action.result.data);\n        }\n        _this.form.reset();\n        return;\n    }\n}\n",
254             "|rendered" : "function (_self)\n{\n    _this.form = _self;\n}\n"
255            },
256            "| function is_copy" : "function() \n{ \n    _this.form.setValues(_this.data);\n    \n    var d = _this.data;\n\n    _this.dialog.el.unmask();\n   _this.grid.getDataSource().load();\n   \n   _this.trform.reset();\n   _this.trform1.reset();\n   _this.trform2.reset();\n   \n   _this.form1.findField('body').originalValue = _this.form1.findField('body').getValue();\n   _this.form2.findField('extended').originalValue = _this.form2.findField('extended').getValue();\n   \n   /*\n    var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()\n    catlabel.dom.innerHTML = 'Category';            \n    \n    if(_this.data.page_type_id_name == 'category'){\n        catlabel.dom.innerHTML = 'Parent Category';\n    }\n    */\n    /*\n    var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();\n    catlabel.dom.innerHTML = 'Parent page';            \n    if(_this.data.page_type_id_name == 'category'){\n        catlabel.dom.innerHTML = 'Parent';\n    }\n    */\n    // better if this was not here... - not sure which project uses it?\n    \n    if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf(\"Crm\") !== -1){\n        _this.interestsCol.show();\n    }\n    \n    if(typeof(d['interests']) != 'undefined'){\n        _this.form.findField('interest').setValue(Roo.decode(d['interests']));\n    }\n    \n    if(typeof(d['categories']) != 'undefined'){\n        _this.form.findField('category').setValue(Roo.decode(d['categories']));\n    }\n    \n    if(typeof(d['page_classes']) != 'undefined'){\n        _this.form.findField('page_cls').setValue(Roo.decode(d['page_classes']));\n    }\n    \n    _this.trpanel.el.unmask();\n    _this.panel.el.unmask();\n    \n    // fix scrolling..\n    _this.cpanel.el.dom.scrollTop = 0;\n    \n    // fix messed up scroll.\n    _this.dialog.layout.el.dom.scrollTop = 0;\n    return;\n}",
257            "labelAlign" : "right",
258            "$ url" : "baseURL + '/Roo/cms_page.php'",
259            "method" : "POST",
260            "style" : "margin: 5px",
261            "xtype" : "Form",
262            "labelWidth" : 120,
263            "$ showHide" : "function()\n{\n    var in_rss= 0;\n    var is_menu= 0;\n    var is_element  = 0;\n    var is_category = 0;\n    \n    var page_type_name = _this.form.findField('page_type_id_name').getValue();\n    \n    switch(page_type_name){\n        case 'page' :\n            is_element = 0;\n        break;\n        \n        case 'element' :\n            is_element = 1;\n        break;\n        \n        case 'blog' :\n            in_rss = 1;\n        break;\n        \n        case 'menu' :\n            is_menu = 1;\n        break;\n        \n        case 'category' :\n            in_rss = 1;\n            is_category = 1;\n        break;\n    }\n    \n    var is_system_page = _this.form.findField('is_system_page').getValue() * 1;\n    var is_attachment = _this.form.findField('is_attachment').getValue() * 1;\n    var has_extended = _this.form.findField('has_extended').getValue() * 1;\n    \n    var vis = {\n        is_attachment : !in_rss,\n        \n        category_type_id : in_rss && !is_menu,\n        page_link : 1, //!in_rss, // always show page link.. may not be needed though..\n        target_url : is_menu,\n        \n        category : !is_category,\n        \n        parent_id : !in_rss || is_category ,\n        published : in_rss ,\n        \n        to_replace_id :false, // !in_rss, // is this used.\n        is_draft : !is_system_page,\n        author_id : in_rss && !is_menu  && !is_attachment,\n        \n        template_id : !is_attachment && !is_menu && !is_system_page,\n        element_id : is_element &&   !is_menu, \n        menu_page_id : is_menu,\n        page_cls : is_element\n \n      //  has_extended : !is_menu && !is_attachment, // always shown.\n      //  extended : has_extended && !is_menu  && !is_attachment,\n       // body : !is_attachment && !is_menu,\n        //keywords : !is_attachment && !is_menu, \n       // descriptions : !is_attachment && !is_menu\n       // extra_css : !is_attachment && !is_menu\n    };\n\n    for(var k in vis) {\n        var el = _this.form.findField(k);\n        \n        if (!el) {\n            Roo.log(\"missing field \" + k);\n            continue;\n        }\n        \n        el.actionMode = 'fieldEl';\n        \n        if (vis[k]) {\n            el.show();\n        } else{\n            el.hide();\n        }\n        \n    }\n    \n    _this.centerLayoutPanel.getLayout().getRegion('south').show();\n    _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(0);\n    _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(1);\n    _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(2);\n    _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(3);\n    \n    if(is_attachment || is_menu){\n    \n        _this.centerLayoutPanel.getLayout().getRegion('south').hide();\n        \n    }\n    \n    if(!has_extended && !is_attachment && !is_menu){\n        _this.centerLayoutPanel.getLayout().getRegion('south').hidePanel(1);\n        _this.centerLayoutPanel.getLayout().getRegion('south').showPanel(0);\n    }\n    \n    \n    _this.trform.showHide();\n    \n    if(typeof(_this.form.editors) == 'undefined'){\n        _this.form.editors = {\n            body : _this.form1.findField('body').wrap.isVisible(),\n            extended : _this.form2.findField('extended').wrap.isVisible()\n       };\n       \n       if(_this.form.editors.body){\n            setInterval(_this.form1.findField('body').autosave, 60000);\n       }\n       \n       if(_this.form.editors.extended){\n            setInterval(_this.form2.findField('extended').autosave, 60000);\n       }\n   }\n   \n   if(!_this.form.editors.body && _this.form1.findField('body').wrap.isVisible()){\n        setInterval(_this.form1.findField('body').autosave, 60000);\n        _this.form.editors.body = true;\n   }\n   \n   if(!_this.form.editors.extended && _this.form2.findField('extended').wrap.isVisible()){\n        setInterval(_this.form2.findField('extended').autosave, 60000);\n        _this.form.editors.extended = true;\n   }\n    \n    \n    \n}\n",
264            "$ xns" : "Roo.form",
265            "items" : [
266             {
267              "xtype" : "Column",
268              "labelWidth" : 200,
269              "width" : 750,
270              "$ xns" : "Roo.form",
271              "items" : [
272               {
273                "labelAlign" : "right",
274                "hideLabels" : false,
275                "style" : "height:30px;overflow:hidden",
276                "xtype" : "Row",
277                "labelWidth" : 200,
278                "width" : 850,
279                "$ xns" : "Roo.form",
280                "items" : [
281                 {
282                  "fieldLabel" : "Type:",
283                  "xtype" : "Hidden",
284                  "width" : 1,
285                  "$ xns" : "Roo.form"
286                 },
287                 {
288                  "hideLabels" : true,
289                  "style" : "height:30px;overflow:hidden",
290                  "xtype" : "Row",
291                  "labelWidth" : 0,
292                  "width" : 600,
293                  "$ xns" : "Roo.form",
294                  "items" : [
295                   {
296                    "listeners" : {
297                     "render" : "function (_self)\n{\n    _this.page_type = _self;\n}",
298                     "select" : "function (combo, record, index)\n{\n//    _this.grid.footer.onClick('first');\n    var page_type_name = record.data.name;\n    _this.form.findField('page_type_id_name').setValue(page_type_name);\n    if(page_type_name == 'blog' || page_type_name == 'category'){ // blog || category unset attachment\n        _this.form.findField('is_attachment').setValue(0);\n        return;\n    }\n    if (_this.form) { \n        _this.form.showHide.defer(100, _this.form);      \n    } \n    \n}"
299                    },
300                    "alwaysQuery" : true,
301                    "listWidth" : 400,
302                    "triggerAction" : "all",
303                    "fieldLabel" : "Page Type",
304                    "forceSelection" : true,
305                    "selectOnFocus" : true,
306                    "pageSize" : 20,
307                    "displayField" : "display_name",
308                    "emptyText" : "Select Status Type",
309                    "hiddenName" : "page_type_id",
310                    "minChars" : 2,
311                    "valueField" : "id",
312                    "xtype" : "ComboBox",
313                    "typeAhead" : false,
314                    "editable" : false,
315                    "$ xns" : "Roo.form",
316                    "name" : "page_type_id_display_name",
317                    "qtip" : "Select Page Type",
318                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>",
319                    "loadingText" : "Searching...",
320                    "items" : [
321                     {
322                      "listeners" : {
323                       "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params.etype = 'cms_page_type'; \n}\n"
324                      },
325                      "xtype" : "Store",
326                      "remoteSort" : true,
327                      "$ sortInfo" : "{ direction : 'ASC', field: 'seqid' }",
328                      "$ xns" : "Roo.data",
329                      "* prop" : "store",
330                      "items" : [
331                       {
332                        "$ url" : "baseURL + '/Roo/core_enum.php'",
333                        "method" : "GET",
334                        "xtype" : "HttpProxy",
335                        "$ xns" : "Roo.data",
336                        "* prop" : "proxy"
337                       },
338                       {
339                        "id" : "id",
340                        "root" : "data",
341                        "xtype" : "JsonReader",
342                        "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"display_name\",\"type\":\"string\"}]",
343                        "$ xns" : "Roo.data",
344                        "* prop" : "reader",
345                        "totalProperty" : "total"
346                       }
347                      ]
348                     }
349                    ]
350                   },
351                   {
352                    "style" : "padding-left:  -70px;",
353                    "xtype" : "Column",
354                    "labelWidth" : 60,
355                    "width" : 200,
356                    "$ xns" : "Roo.form",
357                    "items" : [
358                     {
359                      "fieldLabel" : "Seq",
360                      "xtype" : "NumberField",
361                      "decimalPrecision" : 0,
362                      "width" : 50,
363                      "$ xns" : "Roo.form",
364                      "name" : "seq_id"
365                     }
366                    ]
367                   }
368                  ]
369                 }
370                ]
371               },
372               {
373                "labelAlign" : "right",
374                "hideLabels" : false,
375                "style" : "height:30px;overflow:hidden",
376                "xtype" : "Row",
377                "labelWidth" : 200,
378                "width" : 800,
379                "$ xns" : "Roo.form",
380                "items" : [
381                 {
382                  "fieldLabel" : "Attributes:",
383                  "xtype" : "Hidden",
384                  "width" : 1,
385                  "$ xns" : "Roo.form"
386                 },
387                 {
388                  "hideLabels" : true,
389                  "style" : "height:30px;overflow:hidden",
390                  "xtype" : "Row",
391                  "labelWidth" : 0,
392                  "width" : 540,
393                  "$ xns" : "Roo.form",
394                  "items" : [
395                   {
396                    "fieldLabel" : "Attributes",
397                    "xtype" : "Checkbox",
398                    "boxLabel" : "Draft",
399                    "width" : 100,
400                    "$ xns" : "Roo.form",
401                    "name" : "is_draft"
402                   },
403                   {
404                    "listeners" : {
405                     "check" : "function (_self, checked)\n{  \n   if (_this.form) {\n\n       (function() { \n            _this.form.showHide();\n            _this.panel.fireEvent('resize', _this.panel, [ _this.panel.el.getWidth(), _this.panel.el.getHeight() ]  );\n            \n       }).defer(100);\n    }\n}"
406                    },
407                    "inputValue" : 1,
408                    "xtype" : "Checkbox",
409                    "boxLabel" : "Has Extended content?",
410                    "width" : 180,
411                    "$ xns" : "Roo.form",
412                    "name" : "has_extended"
413                   },
414                   {
415                    "listeners" : {
416                     "check" : "function (_self, checked)\n{  \n   if (_this.form) { \n \n     _this.form.showHide.defer(100, _this.form);      \n   }\n}"
417                    },
418                    "inputValue" : 1,
419                    "xtype" : "Checkbox",
420                    "boxLabel" : "Downloads first Attachment",
421                    "width" : 180,
422                    "$ xns" : "Roo.form",
423                    "name" : "is_attachment"
424                   }
425                  ]
426                 }
427                ]
428               },
429               {
430                "listWidth" : 400,
431                "triggerAction" : "all",
432                "fieldLabel" : "Author",
433                "forceSelection" : true,
434                "selectOnFocus" : true,
435                "pageSize" : 40,
436                "displayField" : "name",
437                "emptyText" : "Select Person",
438                "hiddenName" : "author_id",
439                "minChars" : 2,
440                "valueField" : "id",
441                "xtype" : "ComboBox",
442                "allowBlank" : true,
443                "typeAhead" : false,
444                "editable" : true,
445                "width" : 300,
446                "$ xns" : "Roo.form",
447                "name" : "author_id_name",
448                "qtip" : "Select Person",
449                "queryParam" : "query[name]",
450                "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b>  - {company_id_name}</div>",
451                "loadingText" : "Searching...",
452                "items" : [
453                 {
454                  "listeners" : {
455                   "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n\n    o.params.active = 1;\n    o.params['query[is_owner]'] = 1;\n}\n"
456                  },
457                  "xtype" : "Store",
458                  "remoteSort" : true,
459                  "$ sortInfo" : "{ direction : 'ASC', field: 'name' }",
460                  "$ xns" : "Roo.data",
461                  "* prop" : "store",
462                  "items" : [
463                   {
464                    "$ url" : "baseURL + '/Roo/core_person'",
465                    "method" : "GET",
466                    "xtype" : "HttpProxy",
467                    "$ xns" : "Roo.data",
468                    "* prop" : "proxy"
469                   },
470                   {
471                    "id" : "id",
472                    "root" : "data",
473                    "xtype" : "JsonReader",
474                    "$ xns" : "Roo.data",
475                    "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]",
476                    "* prop" : "reader",
477                    "totalProperty" : "total"
478                   }
479                  ]
480                 }
481                ]
482               },
483               {
484                "fieldLabel" : "Category",
485                "xtype" : "ComboBoxArray",
486                "hiddenName" : "category",
487                "width" : 400,
488                "$ xns" : "Roo.form",
489                "name" : "category_name",
490                "items" : [
491                 {
492                  "listWidth" : 400,
493                  "Number pageSize" : 40,
494                  "alwaysQuery" : true,
495                  "triggerAction" : "all",
496                  "fieldLabel" : "Category",
497                  "forceSelection" : true,
498                  "selectOnFocus" : true,
499                  "displayField" : "display_fullpath",
500                  "emptyText" : "Select category",
501                  "minChars" : 2,
502                  "valueField" : "id",
503                  "xtype" : "ComboBox",
504                  "allowBlank" : false,
505                  "editable" : true,
506                  "width" : 385,
507                  "$ xns" : "Roo.form",
508                  "* prop" : "combo",
509                  "queryParam" : "search[name]",
510                  "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{fullpath}</b> </div>",
511                  "items" : [
512                   {
513                    "listeners" : {
514                     "beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params.page_type_id_name= 'CATEGORY';\n    \n    o.params._with_fullpath = 1;\n}\n"
515                    },
516                    "xtype" : "Store",
517                    "remoteSort" : true,
518                    "$ sortInfo" : "{ field: 'tree_sequence', direction: 'ASC' }",
519                    "$ xns" : "Roo.data",
520                    "* prop" : "store",
521                    "items" : [
522                     {
523                      "$ url" : "baseURL + '/Roo/cms_page.php'",
524                      "method" : "GET",
525                      "xtype" : "HttpProxy",
526                      "$ xns" : "Roo.data",
527                      "* prop" : "proxy"
528                     },
529                     {
530                      "id" : "id",
531                      "root" : "data",
532                      "xtype" : "JsonReader",
533                      "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"name\",\"type\":\"string\"},\n    {\"name\":\"display_name\",\"type\":\"string\"}\n]",
534                      "$ xns" : "Roo.data",
535                      "* prop" : "reader",
536                      "totalProperty" : "total"
537                     }
538                    ]
539                   }
540                  ]
541                 }
542                ]
543               },
544               {
545                "listeners" : {
546                 "select" : "function (combo, record, index)\n{\n   var page_type_name = _this.form.findField('page_type_id_name').getValue();\n   if (page_type_name == 'page') { // page\n        return;\n   }\n   // do not default to put 'Home' at the beginning.\n   if (!record || !(record.data.parent_id *1)) {\n        return;\n   }\n   var pl = _this.form.findField('page_link');\n   var lk = pl.getValue();\n   var new_link = record.data.page_link + '/';\n   if (lk.length) {\n        new_link += lk.split('/').pop();\n   }\n   pl.setValue(new_link);\n   \n}"
547                },
548                "listWidth" : 600,
549                "triggerAction" : "all",
550                "fieldLabel" : "Parent",
551                "forceSelection" : true,
552                "selectOnFocus" : true,
553                "pageSize" : 40,
554                "displayField" : "page_link",
555                "emptyText" : "Select Parent",
556                "hiddenName" : "parent_id",
557                "minChars" : 2,
558                "valueField" : "id",
559                "xtype" : "ComboBox",
560                "allowBlank" : true,
561                "typeAhead" : true,
562                "Boolean alwaysQuery" : true,
563                "editable" : true,
564                "width" : 400,
565                "$ xns" : "Roo.form",
566                "name" : "parent_id_title",
567                "qtip" : "Select Category ",
568                "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>",
569                "loadingText" : "Searching...",
570                "items" : [
571                 {
572                  "listeners" : {
573                   "beforeload" : "function (_self, options)\n{\n     options.params['search[page_link_no_empty]'] =1;\n     \n     if(_this.form.findField('page_type_id').getRawValue() == 'Elements'){\n        options.params._page_type = 'page,element';\n     } else {\n        options.params.page_type_id = _this.form.findField('page_type_id').getValue() * 1;\n     }\n     \n     var id = _this.form.findField('id').getValue() * 1;\n     \n     if(id > 0){\n        options.params['!id'] = id;\n     }\n     \n     \n     /*\n     options.params.is_element = 0;\n     var page_type_name = _this.page_type.findRecord() ? _this.page_type.findRecord().data.name: _this.firstPageType.name;\n     options.params.is_menuitem = page_type_name == 'menu' ? 1 : 0;    \n     */\n}"
574                  },
575                  "xtype" : "Store",
576                  "remoteSort" : true,
577                  "$ sortInfo" : "{ field: 'page_link', direction: 'ASC' }",
578                  "$ xns" : "Roo.data",
579                  "* prop" : "store",
580                  "items" : [
581                   {
582                    "$ url" : "baseURL + '/Roo/cms_page.php'",
583                    "xtype" : "HttpProxy",
584                    "method" : "GET",
585                    "$ xns" : "Roo.data",
586                    "* prop" : "proxy"
587                   },
588                   {
589                    "id" : "id",
590                    "root" : "data",
591                    "xtype" : "JsonReader",
592                    "$ fields" : "[\n { name: 'id', type: 'int' },\n 'title',\n 'page_link' \n]",
593                    "$ xns" : "Roo.data",
594                    "* prop" : "reader",
595                    "totalProperty" : "total"
596                   }
597                  ]
598                 }
599                ]
600               },
601               {
602                "xtype" : "Row",
603                "labelWidth" : 200,
604                "$ xns" : "Roo.form",
605                "items" : [
606                 {
607                  "format" : "Y-m-d",
608                  "fieldLabel" : "Date to Publish",
609                  "xtype" : "DateField",
610                  "width" : 200,
611                  "$ xns" : "Roo.form",
612                  "altFormats" : "Y-m-d H:i:s",
613                  "name" : "published"
614                 },
615                 {
616                  "fieldLabel" : "Replaces (ignore)",
617                  "xtype" : "TextField",
618                  "width" : 75,
619                  "$ xns" : "Roo.form",
620                  "name" : "to_replace_id"
621                 }
622                ]
623               },
624               {
625                "listeners" : {
626                 "keyup" : "function (_self, e)\n{\n    if (_this.page_type.getRawValue() == 'Category') {\n    \n        _this.form.findField('page_link').setValue(this.getValue().replace(/[\\s]/ig, '-').toLowerCase());\n    \n    }\n}"
627                },
628                "fieldLabel" : "Title",
629                "xtype" : "TextField",
630                "width" : 400,
631                "$ xns" : "Roo.form",
632                "name" : "title"
633               },
634               {
635                "fieldLabel" : "Page link /  Name / Order",
636                "xtype" : "TextField",
637                "width" : 400,
638                "$ xns" : "Roo.form",
639                "name" : "page_link"
640               },
641               {
642                "fieldLabel" : "Target URL",
643                "xtype" : "TextField",
644                "width" : 400,
645                "$ xns" : "Roo.form",
646                "name" : "target_url"
647               },
648               {
649                "alwaysQuery" : true,
650                "listWidth" : 400,
651                "$ tpl" : "'<div class=\"x-grid-cell-text x-btn button\"><b>{template_clean}</b></div>'\n",
652                "triggerAction" : "all",
653                "fieldLabel" : "Layout",
654                "forceSelection" : true,
655                "selectOnFocus" : true,
656                "pageSize" : 20,
657                "displayField" : "template_clean",
658                "emptyText" : "Select Template",
659                "hiddenName" : "template_id",
660                "minChars" : 2,
661                "valueField" : "id",
662                "xtype" : "ComboBox",
663                "allowBlank" : true,
664                "typeAhead" : true,
665                "editable" : true,
666                "width" : 400,
667                "$ xns" : "Roo.form",
668                "name" : "template_id_template_clean",
669                "qtip" : "Select Category ",
670                "loadingText" : "Searching...",
671                "items" : [
672                 {
673                  "listeners" : {
674                   "beforeload" : "function (_self, options)\n{\n \n    options.params._rescan = 1;\n   options.params._clean_name = 1;\n//    options.params.lang = 'en';\n    options.params['!template[0]'] = 'master.html';\n    //options.params['!template[1]'] = 'index.html';\n}"
675                  },
676                  "xtype" : "Store",
677                  "remoteSort" : true,
678                  "$ sortInfo" : "{ field: 'template', direction: 'ASC' }",
679                  "$ xns" : "Roo.data",
680                  "* prop" : "store",
681                  "items" : [
682                   {
683                    "$ url" : "baseURL + '/Roo/Cms_template'",
684                    "xtype" : "HttpProxy",
685                    "method" : "GET",
686                    "$ xns" : "Roo.data",
687                    "* prop" : "proxy"
688                   },
689                   {
690                    "id" : "id",
691                    "root" : "data",
692                    "xtype" : "JsonReader",
693                    "$ fields" : "[\n { name: 'id', type: 'int' }, {name: 'template', type: 'string'}\n]",
694                    "$ xns" : "Roo.data",
695                    "* prop" : "reader",
696                    "totalProperty" : "total"
697                   }
698                  ]
699                 }
700                ]
701               },
702               {
703                "alwaysQuery" : true,
704                "listWidth" : 400,
705                "triggerAction" : "all",
706                "fieldLabel" : "Appears in Block",
707                "forceSelection" : true,
708                "selectOnFocus" : true,
709                "pageSize" : 20,
710                "displayField" : "name",
711                "emptyText" : "Select Section",
712                "hiddenName" : "element_id",
713                "minChars" : 2,
714                "valueField" : "id",
715                "xtype" : "ComboBox",
716                "allowBlank" : true,
717                "typeAhead" : true,
718                "editable" : true,
719                "width" : 400,
720                "$ xns" : "Roo.form",
721                "name" : "element_id_name",
722                "qtip" : "Select Category ",
723                "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b></div>",
724                "loadingText" : "Searching...",
725                "items" : [
726                 {
727                  "listeners" : {
728                   "beforeload" : "function (_self, options)\n{\n    var par = _this.form.findField('parent_id').getValue() * 1;\n    if (!par) {\n        Roo.MessageBox.alert(\"Error\", \"Select on what parent page it appears\");\n        return false;\n    }\n    \n    options.params._cms_page_id = par;\n}"
729                  },
730                  "xtype" : "Store",
731                  "remoteSort" : true,
732                  "$ sortInfo" : "{ field: 'name', direction: 'ASC' }",
733                  "$ xns" : "Roo.data",
734                  "* prop" : "store",
735                  "items" : [
736                   {
737                    "$ url" : "baseURL + '/Roo/Cms_template_element'",
738                    "xtype" : "HttpProxy",
739                    "method" : "GET",
740                    "$ xns" : "Roo.data",
741                    "* prop" : "proxy"
742                   },
743                   {
744                    "id" : "id",
745                    "root" : "data",
746                    "xtype" : "JsonReader",
747                    "$ fields" : "[\n { name: 'id', type: 'int' }, {name: 'template', type: 'string'}\n]",
748                    "$ xns" : "Roo.data",
749                    "* prop" : "reader",
750                    "totalProperty" : "total"
751                   }
752                  ]
753                 }
754                ]
755               },
756               {
757                "alwaysQuery" : true,
758                "listWidth" : 600,
759                "triggerAction" : "all",
760                "fieldLabel" : "Menu links to Page",
761                "forceSelection" : true,
762                "selectOnFocus" : true,
763                "pageSize" : 40,
764                "displayField" : "page_link",
765                "emptyText" : "Select Page",
766                "hiddenName" : "menu_page_id",
767                "minChars" : 2,
768                "valueField" : "id",
769                "xtype" : "ComboBox",
770                "allowBlank" : true,
771                "typeAhead" : true,
772                "editable" : true,
773                "width" : 400,
774                "$ xns" : "Roo.form",
775                "name" : "menu_page_id_page_link",
776                "qtip" : "Select Category ",
777                "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><span style=\"color:#1b809e\">[{page_type_id_display_name}] </span><b>{title} </b><i>{page_link}</i></div>",
778                "loadingText" : "Searching...",
779                "items" : [
780                 {
781                  "listeners" : {
782                   "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    options.params['search[page_link_no_empty]'] =1;\n     \n    options.params['page_type_id_name[0]'] = 'page';\n    options.params['page_type_id_name[1]'] = 'blog';\n     /*\n     options.params.is_element = 0;\n     options.params.is_menuitem = 0;     \n     */\n}"
783                  },
784                  "xtype" : "Store",
785                  "remoteSort" : true,
786                  "$ sortInfo" : "{ field: 'title', direction: 'ASC' }",
787                  "$ xns" : "Roo.data",
788                  "* prop" : "store",
789                  "items" : [
790                   {
791                    "$ url" : "baseURL + '/Roo/cms_page.php'",
792                    "xtype" : "HttpProxy",
793                    "method" : "GET",
794                    "$ xns" : "Roo.data",
795                    "* prop" : "proxy"
796                   },
797                   {
798                    "id" : "id",
799                    "root" : "data",
800                    "xtype" : "JsonReader",
801                    "$ fields" : "[\n    {\n        \"name\":\"id\",\n        \"type\":\"int\"\n    },\n    {\n        \"name\":\"title\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"page_link\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"page_type_id_display_name\",\n        \"type\":\"string\"\n    }\n]",
802                    "$ xns" : "Roo.data",
803                    "* prop" : "reader",
804                    "totalProperty" : "total"
805                   }
806                  ]
807                 }
808                ]
809               },
810               {
811                "fieldLabel" : "Page Class",
812                "hiddenName" : "page_cls",
813                "xtype" : "ComboBoxArray",
814                "width" : 400,
815                "$ xns" : "Roo.form",
816                "name" : "page_cls_name",
817                "items" : [
818                 {
819                  "alwaysQuery" : true,
820                  "listWidth" : 400,
821                  "triggerAction" : "all",
822                  "fieldLabel" : "Page Class",
823                  "forceSelection" : true,
824                  "selectOnFocus" : true,
825                  "displayField" : "display_name",
826                  "emptyText" : "Select class",
827                  "minChars" : 2,
828                  "valueField" : "name",
829                  "xtype" : "ComboBox",
830                  "allowBlank" : true,
831                  "editable" : true,
832                  "width" : 385,
833                  "$ xns" : "Roo.form",
834                  "* prop" : "combo",
835                  "queryParam" : "query[search]",
836                  "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>",
837                  "items" : [
838                   {
839                    "listeners" : {
840                     "beforeload" : "function (_self, o){\n    o.params = o.params || {};\n\n    o.params.etype = 'cms_page_class'; \n}\n"
841                    },
842                    "xtype" : "Store",
843                    "remoteSort" : true,
844                    "$ sortInfo" : "{ direction : 'ASC', field: 'seqid' }",
845                    "$ xns" : "Roo.data",
846                    "* prop" : "store",
847                    "items" : [
848                     {
849                      "$ url" : "baseURL + '/Roo/core_enum.php'",
850                      "xtype" : "HttpProxy",
851                      "method" : "GET",
852                      "$ xns" : "Roo.data",
853                      "* prop" : "proxy"
854                     },
855                     {
856                      "id" : "id",
857                      "root" : "data",
858                      "xtype" : "JsonReader",
859                      "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"name\",\"type\":\"string\"},\n    {\"name\":\"display_name\",\"type\":\"string\"}\n]",
860                      "$ xns" : "Roo.data",
861                      "* prop" : "reader",
862                      "totalProperty" : "total"
863                     }
864                    ]
865                   }
866                  ]
867                 }
868                ]
869               }
870              ]
871             },
872             {
873              "xtype" : "Column",
874              "labelWidth" : 200,
875              "width" : 250,
876              "$ xns" : "Roo.form",
877              "items" : [
878               {
879                "xtype" : "FieldSet",
880                "String labelAlign" : "top",
881                "$ xns" : "Roo.form",
882                "String legend" : "Primary Image",
883                "String/Object/Function style" : "width: 165px;",
884                "Boolean hideLabels" : true,
885                "items" : [
886                 {
887                  "xtype" : "DisplayField",
888                  "style" : "border: 1px solid #ccc;",
889                  "$ valueRenderer" : "function(v) {\n\n    if (!v || v * 1 < 1) {\n        return '<div style=\"width: 150px; height: 150px; background-color: grey;\" title=\"Using zero order image\">&nbsp;</div>';\n    }\n    \n    return String.format('<img src=\"{0}/Images/Thumb/150/{1}\" width=\"150\" title=\"Using zero order image\">', baseURL, v); \n}",
890                  "icon" : "rootURL + 'images/default/dd/drop-add.gif'",
891                  "width" : 150,
892                  "$ xns" : "Roo.form",
893                  "height" : 150,
894                  "name" : "primary_image_id"
895                 }
896                ]
897               }
898              ]
899             },
900             {
901              "listeners" : {
902               "render" : "function (_self)\n{\n    _this.interestsCol = _self;\n}"
903              },
904              "xtype" : "Column",
905              "$ xns" : "Roo.form",
906              "items" : [
907               {
908                "listeners" : {
909                 "render" : "function (_self)\n{\n    _this.interests = _self;\n    /*\n    _self.combo.addicon.setStyle( {\n        position : 'absolute',\n        right: '9px',\n        top : '2px',\n        float : 'left'\n    });\n    */\n}"
910                },
911                "fieldLabel" : "Interests",
912                "hiddenName" : "interest",
913                "xtype" : "ComboBoxArray",
914                "width" : 300,
915                "$ xns" : "Roo.form",
916                "name" : "interest_name",
917                "items" : [
918                 {
919                  "alwaysQuery" : true,
920                  "listWidth" : 400,
921                  "triggerAction" : "all",
922                  "fieldLabel" : "Interests",
923                  "forceSelection" : true,
924                  "selectOnFocus" : true,
925                  "displayField" : "display_name",
926                  "emptyText" : "Select interests",
927                  "minChars" : 2,
928                  "valueField" : "id",
929                  "xtype" : "ComboBox",
930                  "allowBlank" : true,
931                  "editable" : true,
932                  "width" : 285,
933                  "$ xns" : "Roo.form",
934                  "* prop" : "combo",
935                  "queryParam" : "query[name]",
936                  "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>",
937                  "items" : [
938                   {
939                    "listeners" : {
940                     "beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    o.params.etype = 'crm_interest';\n}\n"
941                    },
942                    "xtype" : "Store",
943                    "remoteSort" : true,
944                    "$ sortInfo" : "{ direction : 'ASC', field: 'name' }",
945                    "$ xns" : "Roo.data",
946                    "* prop" : "store",
947                    "items" : [
948                     {
949                      "$ url" : "baseURL + '/Roo/Core_enum.php'",
950                      "xtype" : "HttpProxy",
951                      "method" : "GET",
952                      "$ xns" : "Roo.data",
953                      "* prop" : "proxy"
954                     },
955                     {
956                      "id" : "id",
957                      "root" : "data",
958                      "xtype" : "JsonReader",
959                      "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"name\",\"type\":\"string\"},\n    {\"name\":\"display_name\",\"type\":\"string\"}\n]",
960                      "$ xns" : "Roo.data",
961                      "* prop" : "reader",
962                      "totalProperty" : "total"
963                     }
964                    ]
965                   }
966                  ]
967                 }
968                ]
969               }
970              ]
971             },
972             {
973              "xtype" : "Hidden",
974              "$ xns" : "Roo.form",
975              "name" : "id"
976             },
977             {
978              "xtype" : "Hidden",
979              "$ xns" : "Roo.form",
980              "name" : "is_system_page"
981             },
982             {
983              "xtype" : "Hidden",
984              "$ xns" : "Roo.form",
985              "name" : "is_menuitem"
986             },
987             {
988              "xtype" : "Hidden",
989              "$ xns" : "Roo.form",
990              "name" : "page_type_id_name"
991             },
992             {
993              "listeners" : {
994               "render" : "function (_self)\n{\n    _this.user_defined_fields = _self;\n}"
995              },
996              "xtype" : "Column",
997              "$ xns" : "Roo.form"
998             }
999            ]
1000           }
1001          ]
1002         },
1003         {
1004          "Boolean fitContainer" : true,
1005          "xtype" : "ContentPanel",
1006          "Boolean fitToFrame" : true,
1007          "$ xns" : "Roo",
1008          "String region" : "south",
1009          "String title" : "Contents",
1010          "Boolean background" : false,
1011          "items" : [
1012           {
1013            "listeners" : {
1014             "rendered" : "function (form)\n{\n    _this.form1 = form;\n}"
1015            },
1016            "$ url" : "baseURL + '/Roo/cms_page.php'",
1017            "xtype" : "Form",
1018            "method" : "POST",
1019            "labelWidth" : 80,
1020            "String labelAlign" : "top",
1021            "$ xns" : "Roo.form",
1022            "items" : [
1023             {
1024              "xtype" : "Row",
1025              "$ xns" : "Roo.form",
1026              "Boolean hideLabels" : true,
1027              "items" : [
1028               {
1029                "listeners" : {
1030                 "stylesheetsclick" : "function (_self)\n{\n    Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){\n        _this.dialog.setStylesheets();\n    })\n    \n}",
1031                 "savedpreview" : "function (_self)\n{\n    Roo.log('saved preview');\n    \n    var id = _this.form.findField('id').getValue() * 1;\n    \n    var successFn = function(res){\n        return res.data.POST.source;\n    };\n    \n    var params = {\n        action : 'AUTOSAVE',\n        remarks : 'BODY',\n        on_id : (id < 1) ? 0 : id,\n        on_table : 'cms_page',\n        successFn : successFn\n    };\n    \n    \n    Pman.Dialog.CoreAutoSavePreview.show(params, function(res){\n        _self.setValue(res);\n        _self.originalValue = res;\n    });\n}",
1032                 "autosave" : "function (_self)\n{\n    Roo.log('autosave');\n    \n    var id = _this.form.findField('id').getValue() * 1;\n    /*\n    if(!_self.editorcore.sourceEditMode){\n        _self.syncValue();\n    }else{\n        _self.pushValue();\n    }\n    */\n    new Pman.Request({\n        url : baseURL + '/Roo/Events.php',\n        method :'POST',\n        params : {\n            id : 0,\n            action : 'AUTOSAVE',\n            on_id : (id > 0) ? id : 0,\n            on_table : 'cms_page',\n            remarks : 'BODY',\n            source: _self.getValue()\n        },\n        success : function() {\n            _self.originalValue = _self.getValue();\n            \n        },\n        failure : function() \n        {\n            //Roo.MessageBox.alert(\"Error\", \"autosave failed\");\n            Roo.log('body autosave failed?!');\n        }\n    });\n    \n}"
1033                },
1034                "xtype" : "HtmlEditor",
1035                "$ xns" : "Roo.form",
1036                "width" : 550,
1037                "String fieldLabel" : "Contents",
1038                "resizable" : "s",
1039                "$ autosave" : "function() {\n    \n    var body = _this.form1.findField('body');\n    \n    if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){\n        Roo.log('body not dirty');\n        return;\n    }\n    \n    Roo.log('body dirty, auto save!');\n    \n    body.fireEvent('autosave', body);\n        \n   \n}\n",
1040                "$ array white" : "[ 'iframe' ]",
1041                "name" : "body",
1042                "height" : 150,
1043                "items" : [
1044                 {
1045                  "xtype" : "ToolbarStandard",
1046                  "$ xns" : "Roo.form.HtmlEditor",
1047                  "* prop" : "toolbars[]",
1048                  "items" : [
1049                   {
1050                    "listeners" : {
1051                     "render" : "function (_self)\n{\n    _this.bodyimgselect = _self;\n}",
1052                     "beforequery" : "function (combo, query, forceAll, cancel, e)\n{\n \n    var id = _this.form.findField('id').getValue() * 1;    \n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save Document First before adding images\");\n        return false;\n    }\n}",
1053                     "select" : "function (combo, record, index)\n{\n    Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    \n    var editor = _this.form1.findField('body').editorcore;\n    \n    var curnode = editor.getSelectedNode();\n    \n    if (curnode && curnode.tagName == 'IMG') {\n        curnode.src= String.format('{0}/Images/{1}/{2}#attachment-{1}',\n                baseURL,  record.data.id, record.data.filename\n            );\n            // note -forces an update... hopefully...\n        editor.owner.fireEvent('editorevent', editor, false);\n    } else {\n    \n        editor.insertAtCursor(\n            String.format('<img src=\"{0}/Images/{1}/{2}#attachment-{1}\">',\n            baseURL,  record.data.id, record.data.filename\n            )\n        );\n\n    }\n    \n}"
1054                    },
1055                    "listWidth" : 400,
1056                    "$ tpl" : "'<div class=\\\"x-grid-cell-text x-btn button\\\"><img src=\\\"' + baseURL + '/Images/Thumb/150x150/{id}.jpg\\\" height=\\\"150\\\" width=\\\"150\\\"><br/><b>{filename}</b> </div>'",
1057                    "alwaysQuery" : true,
1058                    "triggerAction" : "all",
1059                    "fieldLabel" : "Images",
1060                    "forceSelection" : true,
1061                    "selectOnFocus" : true,
1062                    "pageSize" : 20,
1063                    "displayField" : "name",
1064                    "emptyText" : "Add Image",
1065                    "minChars" : 2,
1066                    "valueField" : "id",
1067                    "xtype" : "ComboBox",
1068                    "typeAhead" : true,
1069                    "editable" : false,
1070                    "width" : 100,
1071                    "$ xns" : "Roo.form",
1072                    "* prop" : "btns[]",
1073                    "qtip" : "Select Images",
1074                    "queryParam" : "search",
1075                    "loadingText" : "Searching...",
1076                    "items" : [
1077                     {
1078                      "listeners" : {
1079                       "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n\n    var id = _this.form.findField('id').getValue() * 1;    \n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save press release first\");\n        return false;\n    }\n    o.params.onid = id;\n    o.params.ontable = 'cms_page';\n   // o.params.imgtype = 'PressRelease';\n    o.params['query[imagesize]'] = '150x150';\n    // set more here\n}\n"
1080                      },
1081                      "xtype" : "Store",
1082                      "remoteSort" : true,
1083                      "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
1084                      "$ xns" : "Roo.data",
1085                      "* prop" : "store",
1086                      "items" : [
1087                       {
1088                        "$ url" : "baseURL + '/Roo/Images.php'",
1089                        "method" : "GET",
1090                        "xtype" : "HttpProxy",
1091                        "$ xns" : "Roo.data",
1092                        "* prop" : "proxy"
1093                       },
1094                       {
1095                        "id" : "id",
1096                        "root" : "data",
1097                        "xtype" : "JsonReader",
1098                        "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"filename\",\"type\":\"string\"},{\"name\":\"url_thumb\",\"type\":\"string\"}]",
1099                        "$ xns" : "Roo.data",
1100                        "* prop" : "reader",
1101                        "totalProperty" : "total"
1102                       }
1103                      ]
1104                     }
1105                    ]
1106                   },
1107                   {
1108                    "listeners" : {
1109                     "select" : "function (combo, record, index)\n{\n    Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    var editor = _this.form.findField('body');\n    editor.editorcore.insertAtCursor(\n            String.format('<a href=\"#page-{0}\">{1}</a>',\n            record.data.page_link,  record.data.title\n            )\n     );\n\n    \n }"
1110                    },
1111                    "listWidth" : 200,
1112                    "triggerAction" : "all",
1113                    "forceSelection" : true,
1114                    "selectOnFocus" : true,
1115                    "pageSize" : 40,
1116                    "displayField" : "page_link",
1117                    "emptyText" : "Add Link",
1118                    "hiddenName" : "add_link_id",
1119                    "minChars" : 2,
1120                    "valueField" : "id",
1121                    "xtype" : "ComboBox",
1122                    "allowBlank" : true,
1123                    "typeAhead" : true,
1124                    "editable" : true,
1125                    "width" : 100,
1126                    "$ xns" : "Roo.form",
1127                    "* prop" : "btns[]",
1128                    "name" : "add_link",
1129                    "qtip" : "Select Category ",
1130                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>",
1131                    "loadingText" : "Searching...",
1132                    "items" : [
1133                     {
1134                      "listeners" : {
1135                       "beforeload" : "function (_self, options)\n{\n     options.params['search[page_link_no_empty]'] =1;\n     /*\n     options.params.is_element = 0;\n     options.params.is_menuitem = _this.form.findField('is_menuitem').getValue() * 1;     \n     */\n}"
1136                      },
1137                      "xtype" : "Store",
1138                      "remoteSort" : true,
1139                      "$ sortInfo" : "{ field: 'page_link', direction: 'ASC' }",
1140                      "$ xns" : "Roo.data",
1141                      "* prop" : "store",
1142                      "items" : [
1143                       {
1144                        "$ url" : "baseURL + '/Roo/cms_page.php'",
1145                        "xtype" : "HttpProxy",
1146                        "method" : "GET",
1147                        "$ xns" : "Roo.data",
1148                        "* prop" : "proxy"
1149                       },
1150                       {
1151                        "id" : "id",
1152                        "root" : "data",
1153                        "xtype" : "JsonReader",
1154                        "$ fields" : "[\n { name: 'id', type: 'int' },\n 'title',\n 'page_link' \n]",
1155                        "$ xns" : "Roo.data",
1156                        "* prop" : "reader",
1157                        "totalProperty" : "total"
1158                       }
1159                      ]
1160                     }
1161                    ]
1162                   },
1163                   {
1164                    "xtype" : "Separator",
1165                    "$ xns" : "Roo.Toolbar",
1166                    "* prop" : "btns[]"
1167                   },
1168                   {
1169                    "listeners" : {
1170                     "click" : "function (_self, e)\n{\n    this.scope.owner.fireEvent('savedpreview', this.scope.owner);\n}"
1171                    },
1172                    "String cls" : "x-init-enable",
1173                    "text" : "Saved Version",
1174                    "xtype" : "Button",
1175                    "$ xns" : "Roo.Toolbar",
1176                    "* prop" : "btns[]"
1177                   }
1178                  ]
1179                 },
1180                 {
1181                  "xtype" : "ToolbarContext",
1182                  "$ xns" : "Roo.form.HtmlEditor",
1183                  "* prop" : "toolbars[]"
1184                 }
1185                ]
1186               }
1187              ]
1188             }
1189            ]
1190           }
1191          ]
1192         },
1193         {
1194          "Boolean fitContainer" : true,
1195          "xtype" : "ContentPanel",
1196          "Boolean fitToFrame" : true,
1197          "$ xns" : "Roo",
1198          "String region" : "south",
1199          "String title" : "Extended Content",
1200          "Boolean background" : false,
1201          "items" : [
1202           {
1203            "listeners" : {
1204             "rendered" : "function (form)\n{\n    _this.form2 = form;\n}"
1205            },
1206            "$ url" : "baseURL + '/Roo/cms_page.php'",
1207            "xtype" : "Form",
1208            "method" : "POST",
1209            "labelWidth" : 80,
1210            "String labelAlign" : "top",
1211            "$ xns" : "Roo.form",
1212            "items" : [
1213             {
1214              "xtype" : "Row",
1215              "$ xns" : "Roo.form",
1216              "Boolean hideLabels" : true,
1217              "items" : [
1218               {
1219                "listeners" : {
1220                 "stylesheetsclick" : "function (_self)\n{\n    Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){\n        _this.dialog.setStylesheets();\n    })\n    \n}",
1221                 "savedpreview" : "function (_self)\n{\n    var id = _this.form.findField('id').getValue() * 1;\n    \n    var successFn = function(res){\n        return res.data.POST.source;\n    };\n    \n    var params = {\n        action : 'AUTOSAVE',\n        remarks : 'EXTENDED',\n        on_id : (id < 1) ? 0 : id,\n        on_table : 'cms_page',\n        successFn : successFn\n    };\n    \n    \n    Pman.Dialog.CoreAutoSavePreview.show(params, function(res){\n        _self.setValue(res);\n        _self.originalValue = res;\n    });\n}",
1222                 "autosave" : "function (_self)\n{\n    var id = _this.form.findField('id').getValue() * 1;\n    \n    /*\n    if(!_self.editorcore.sourceEditMode){\n        _self.syncValue();\n    }else{\n        _self.pushValue();\n    }\n    */\n    new Pman.Request({\n        url : baseURL + '/Roo/Events.php',\n        method :'POST',\n        params : {\n            id : 0,\n            action : 'AUTOSAVE',\n            on_id : (id > 0) ? id : 0,\n            on_table : 'cms_page',\n            remarks : 'EXTENDED',\n            source: _self.getValue()\n        },\n        success : function() {\n            _self.originalValue = _self.getValue();\n            \n        },\n        failure : function() \n        {\n            //Roo.MessageBox.alert(\"Error\", \"autosave failed\");\n            Roo.log('extended autosave failed?!');\n        }\n    });\n}"
1223                },
1224                "fieldLabel" : "Extended Contents",
1225                "xtype" : "HtmlEditor",
1226                "width" : 550,
1227                "$ xns" : "Roo.form",
1228                "resizable" : "s",
1229                "$ autosave" : "function() {\n    \n    var extended = _this.form2.findField('extended');\n    \n    if(!extended.wrap.isVisible(true) || extended.getValue() == '' || !extended.isDirty()){\n        Roo.log('extend not dirty');\n        return;\n    }\n\n    \n    Roo.log('extend dirty, auto save!');\n    \n    extended.fireEvent('autosave', extended);\n}\n",
1230                "$ array white" : "[ 'iframe' ]",
1231                "name" : "extended",
1232                "height" : 150,
1233                "items" : [
1234                 {
1235                  "xtype" : "ToolbarStandard",
1236                  "$ xns" : "Roo.form.HtmlEditor",
1237                  "* prop" : "toolbars[]",
1238                  "items" : [
1239                   {
1240                    "listeners" : {
1241                     "render" : "function (_self)\n{\n    _this.extendimgselect = _self;\n}",
1242                     "beforequery" : "function (combo, query, forceAll, cancel, e)\n{\n \n    var id = _this.form.findField('id').getValue() * 1;    \n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save Document First before adding images\");\n        return false;\n    }\n}",
1243                     "select" : "function (combo, record, index)\n{\n    Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    \n    var editor = _this.form2.findField('extended').editorcore;\n    \n    var curnode = editor.getSelectedNode();\n    \n    if (curnode && curnode.tagName == 'IMG') {\n        curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',\n                baseURL,  record.data.id, record.data.filename\n            );\n            // note -forces an update... hopefully...\n        editor.owner.fireEvent('editorevent', editor, false);\n    } else {\n    \n        editor.insertAtCursor(\n            String.format('<img src=\"{0}/Images/{1}/{2}#image-{1}\">',\n            baseURL,  record.data.id, record.data.filename\n            )\n        );\n\n    }\n    \n}"
1244                    },
1245                    "alwaysQuery" : true,
1246                    "listWidth" : 400,
1247                    "$ tpl" : "'<div class=\\\"x-grid-cell-text x-btn button\\\"><img src=\\\"' + baseURL + '/Images/Thumb/150x150/{id}.jpg\\\" height=\\\"150\\\" width=\\\"150\\\"><br/><b>{filename}</b> </div>'",
1248                    "triggerAction" : "all",
1249                    "fieldLabel" : "Images",
1250                    "forceSelection" : true,
1251                    "selectOnFocus" : true,
1252                    "pageSize" : 20,
1253                    "displayField" : "name",
1254                    "emptyText" : "Add Image",
1255                    "minChars" : 2,
1256                    "valueField" : "id",
1257                    "xtype" : "ComboBox",
1258                    "typeAhead" : true,
1259                    "editable" : false,
1260                    "width" : 100,
1261                    "$ xns" : "Roo.form",
1262                    "* prop" : "btns[]",
1263                    "qtip" : "Select Images",
1264                    "loadingText" : "Searching...",
1265                    "items" : [
1266                     {
1267                      "listeners" : {
1268                       "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n\n    var id = _this.form.findField('id').getValue() * 1;    \n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save press release first\");\n        return false;\n    }\n    o.params.onid = id;\n    o.params.ontable = 'cms_page';\n   // o.params.imgtype = 'PressRelease';\n     o.params['query[imagesize]'] = '150x150';\n    // set more here\n}\n"
1269                      },
1270                      "xtype" : "Store",
1271                      "remoteSort" : true,
1272                      "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
1273                      "$ xns" : "Roo.data",
1274                      "* prop" : "store",
1275                      "items" : [
1276                       {
1277                        "$ url" : "baseURL + '/Roo/Images.php'",
1278                        "xtype" : "HttpProxy",
1279                        "method" : "GET",
1280                        "$ xns" : "Roo.data",
1281                        "* prop" : "proxy"
1282                       },
1283                       {
1284                        "id" : "id",
1285                        "root" : "data",
1286                        "xtype" : "JsonReader",
1287                        "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"filename\",\"type\":\"string\"},{\"name\":\"url_thumb\",\"type\":\"string\"}]",
1288                        "$ xns" : "Roo.data",
1289                        "* prop" : "reader",
1290                        "totalProperty" : "total"
1291                       }
1292                      ]
1293                     }
1294                    ]
1295                   },
1296                   {
1297                    "listeners" : {
1298                     "select" : "function (combo, record, index)\n{\n    Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    var editor = _this.form.findField('body');\n    editor.editorcore.insertAtCursor(\n            String.format('<a href=\"#page-{0}\">{1}</a>',\n            record.data.page_link,  record.data.title\n            )\n     );\n\n    \n }"
1299                    },
1300                    "listWidth" : 200,
1301                    "triggerAction" : "all",
1302                    "forceSelection" : true,
1303                    "selectOnFocus" : true,
1304                    "pageSize" : 40,
1305                    "displayField" : "page_link",
1306                    "emptyText" : "Add Link",
1307                    "hiddenName" : "add_link_id",
1308                    "minChars" : 2,
1309                    "valueField" : "id",
1310                    "xtype" : "ComboBox",
1311                    "allowBlank" : true,
1312                    "typeAhead" : true,
1313                    "editable" : true,
1314                    "width" : 100,
1315                    "$ xns" : "Roo.form",
1316                    "* prop" : "btns[]",
1317                    "name" : "add_link",
1318                    "qtip" : "Select Category ",
1319                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>",
1320                    "loadingText" : "Searching...",
1321                    "items" : [
1322                     {
1323                      "listeners" : {
1324                       "beforeload" : "function (_self, options)\n{\n     options.params['search[page_link_no_empty]'] =1;\n     /*\n     options.params.is_element = 0;\n     options.params.is_menuitem = _this.form.findField('is_menuitem').getValue() * 1;     \n     */\n}"
1325                      },
1326                      "xtype" : "Store",
1327                      "remoteSort" : true,
1328                      "$ sortInfo" : "{ field: 'page_link', direction: 'ASC' }",
1329                      "$ xns" : "Roo.data",
1330                      "* prop" : "store",
1331                      "items" : [
1332                       {
1333                        "$ url" : "baseURL + '/Roo/cms_page.php'",
1334                        "method" : "GET",
1335                        "xtype" : "HttpProxy",
1336                        "$ xns" : "Roo.data",
1337                        "* prop" : "proxy"
1338                       },
1339                       {
1340                        "id" : "id",
1341                        "root" : "data",
1342                        "xtype" : "JsonReader",
1343                        "$ fields" : "[\n { name: 'id', type: 'int' },\n 'title',\n 'page_link' \n]",
1344                        "$ xns" : "Roo.data",
1345                        "* prop" : "reader",
1346                        "totalProperty" : "total"
1347                       }
1348                      ]
1349                     }
1350                    ]
1351                   },
1352                   {
1353                    "xtype" : "Separator",
1354                    "$ xns" : "Roo.Toolbar",
1355                    "* prop" : "btns[]"
1356                   },
1357                   {
1358                    "listeners" : {
1359                     "click" : "function (_self, e)\n{\n    this.scope.owner.fireEvent('savedpreview', this.scope.owner);\n}"
1360                    },
1361                    "text" : "Saved Version",
1362                    "xtype" : "Button",
1363                    "$ xns" : "Roo.Toolbar",
1364                    "* prop" : "btns[]"
1365                   }
1366                  ]
1367                 },
1368                 {
1369                  "xtype" : "ToolbarContext",
1370                  "$ xns" : "Roo.form.HtmlEditor",
1371                  "$ styles" : "typeof(uiConfig) != 'undefined' ? (uiConfig['Roo.form.HtmlEditor.ToolbarContext.styles'] || {}) : {}",
1372                  "* prop" : "toolbars[]"
1373                 }
1374                ]
1375               }
1376              ]
1377             }
1378            ]
1379           }
1380          ]
1381         },
1382         {
1383          "Boolean fitContainer" : true,
1384          "xtype" : "ContentPanel",
1385          "Boolean fitToFrame" : true,
1386          "$ xns" : "Roo",
1387          "String region" : "south",
1388          "String title" : "Extra CSS",
1389          "Boolean background" : false,
1390          "items" : [
1391           {
1392            "listeners" : {
1393             "rendered" : "function (form)\n{\n    _this.form3 = form;\n}"
1394            },
1395            "$ url" : "baseURL + '/Roo/cms_page.php'",
1396            "method" : "POST",
1397            "xtype" : "Form",
1398            "labelWidth" : 80,
1399            "String labelAlign" : "top",
1400            "$ xns" : "Roo.form",
1401            "items" : [
1402             {
1403              "xtype" : "Row",
1404              "$ xns" : "Roo.form",
1405              "Boolean hideLabels" : true,
1406              "items" : [
1407               {
1408                "fieldLabel" : "Styles (CSS)",
1409                "xtype" : "TextArea",
1410                "width" : 700,
1411                "$ xns" : "Roo.form",
1412                "name" : "extra_css",
1413                "height" : 200
1414               }
1415              ]
1416             }
1417            ]
1418           }
1419          ]
1420         },
1421         {
1422          "Boolean fitContainer" : true,
1423          "xtype" : "ContentPanel",
1424          "Boolean fitToFrame" : true,
1425          "$ xns" : "Roo",
1426          "String region" : "south",
1427          "String title" : "Meta Tags",
1428          "Boolean background" : false,
1429          "items" : [
1430           {
1431            "listeners" : {
1432             "rendered" : "function (form)\n{\n    _this.form4 = form;\n}"
1433            },
1434            "$ url" : "baseURL + '/Roo/cms_page.php'",
1435            "xtype" : "Form",
1436            "method" : "POST",
1437            "labelWidth" : 80,
1438            "String labelAlign" : "top",
1439            "$ xns" : "Roo.form",
1440            "items" : [
1441             {
1442              "xtype" : "Row",
1443              "$ xns" : "Roo.form",
1444              "items" : [
1445               {
1446                "fieldLabel" : "Keywords",
1447                "xtype" : "TextArea",
1448                "width" : 340,
1449                "$ xns" : "Roo.form",
1450                "name" : "keywords",
1451                "height" : 100
1452               },
1453               {
1454                "fieldLabel" : "Descriptions",
1455                "xtype" : "TextArea",
1456                "width" : 340,
1457                "$ xns" : "Roo.form",
1458                "name" : "descriptions",
1459                "height" : 100
1460               }
1461              ]
1462             }
1463            ]
1464           }
1465          ]
1466         }
1467        ]
1468       }
1469      ]
1470     },
1471     {
1472      "listeners" : {
1473       "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
1474      },
1475      "fitToframe" : true,
1476      "background" : false,
1477      "region" : "east",
1478      "title" : "Images / Attachments",
1479      "xtype" : "GridPanel",
1480      "fitContainer" : true,
1481      "$ xns" : "Roo",
1482      "tableName" : "Images",
1483      "items" : [
1484       {
1485        "listeners" : {
1486         "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    var rd = _this.grid.getDataSource().getAt(rowIndex);\n    var id = rd.data.id;\n    var url = String.format('{0}/Images/{1}/{2}', baseURL, rd.data.id, rd.data.filename);\n    _this.form.findField('contents').execCmd('insertimage', url);\n\n}",
1487         "|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}"
1488        },
1489        "autoExpandColumn" : "title",
1490        "xtype" : "EditorGrid",
1491        "loadMask" : true,
1492        "clicksToEdit" : 1,
1493        "$ xns" : "Roo.grid",
1494        "* prop" : "grid",
1495        "items" : [
1496         {
1497          "listeners" : {
1498           "|beforeload" : "function (_self, o)\n{\n    var id = _this.form.findField('id').getValue() * 1;\n\n    if (id < 1) {\n        this.removeAll();\n        return false;\n    } \n    o.params = o.params || {};    \n    o.params.limit = 9999;          \n    o.params.onid = id;\n    o.params.ontable = 'cms_page';\n}",
1499           "update" : "function (_self, rec, operation)\n{\n    \n    new Pman.Request({\n        url : baseURL+'/Roo/Images.php',\n        method : 'POST',\n        params : rec.data,\n        success: function(res)\n        {\n            Roo.log(\"GOT success\");\n            // update the data...\n            _this.grid.ds.load({});\n        },\n        failure : function(res)\n        {\n            Roo.MessageBox.alert('Error', res.errorMsg);\n            _this.grid.ds.load({});\n        }\n        \n        \n    });\n}"
1500          },
1501          "xtype" : "Store",
1502          "$ xns" : "Roo.data",
1503          "* prop" : "dataSource",
1504          "items" : [
1505           {
1506            "$ url" : "baseURL + '/Roo/Images.php'",
1507            "xtype" : "HttpProxy",
1508            "method" : "GET",
1509            "$ xns" : "Roo.data",
1510            "* prop" : "proxy"
1511           },
1512           {
1513            "id" : "id",
1514            "root" : "data",
1515            "xtype" : "JsonReader",
1516            "$ xns" : "Roo.data",
1517            "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'filename',\n        'type': 'string'\n    },\n    {\n        'name': 'ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'onid',\n        'type': 'int'\n    },\n    {\n        'name': 'mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'width',\n        'type': 'int'\n    },\n    {\n        'name': 'height',\n        'type': 'int'\n    },\n    {\n        'name': 'filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'created',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'descript',\n        'type': 'string'\n    },\n    {\n        'name': 'title',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_filename',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_onid',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_width',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_height',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_created',\n        'type': 'date'\n    },\n    {\n        'name': 'parent_image_id_imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_descript',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_title',\n        'type': 'string'\n    }\n]",
1518            "* prop" : "reader",
1519            "totalProperty" : "total"
1520           }
1521          ]
1522         },
1523         {
1524          "xtype" : "Toolbar",
1525          "$ xns" : "Roo",
1526          "* prop" : "toolbar",
1527          "items" : [
1528           {
1529            "listeners" : {
1530             "|click" : "function()\n{\n    var id = _this.form.findField('id').getValue() * 1;\n    \n    if(id < 1){\n        return;\n    }\n    \n    Pman.Dialog.Image.show( { id : 0, onid : id, ontable: 'cms_page' }, function() {\n        _this.grid.ds.load({});\n    }); \n\n}\n        "
1531            },
1532            "text" : "Add",
1533            "xtype" : "Button",
1534            "cls" : "x-btn-text-icon",
1535            "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
1536            "$ xns" : "Roo"
1537           },
1538           {
1539            "listeners" : {
1540             "|click" : "function()\n{\n    var selection = _this.grid.getSelectionModel().getSelectedCell();\n    var sn = _this.grid.ds.getAt(selection[0]);\n    if (!sn || isNaN(sn.id *1)) {\n        Roo.MessageBox.alert(\"Error\", \"Select a image\"); \n        return;\n    }\n    Roo.MessageBox.confirm(\"Confirm\", \"Are sure you want to delete this image?\", function (v){\n        if (v != 'yes') {\n            return;\n        }\n        \n        new Pman.Request({\n            url : baseURL + '/Roo/Images.php',\n            method: 'POST',\n            params : {\n                _delete : sn.id\n            },\n            success : function()\n            {\n                Roo.log('Got Success!!');\n               _this.grid.ds.load({});\n            }\n        });\n    });\n}\n        "
1541            },
1542            "text" : "Delete",
1543            "xtype" : "Button",
1544            "cls" : "x-btn-text-icon",
1545            "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
1546            "$ xns" : "Roo"
1547           }
1548          ]
1549         },
1550         {
1551          "xtype" : "ColumnModel",
1552          "sortable" : false,
1553          "header" : "",
1554          "width" : 75,
1555          "$ renderer" : "function(v,x,r) { \n    return  String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\" height=\"100\">', baseURL, v, r.data.filename); \n}",
1556          "$ xns" : "Roo.grid",
1557          "* prop" : "colModel[]",
1558          "dataIndex" : "id"
1559         },
1560         {
1561          "xtype" : "ColumnModel",
1562          "header" : "Filename",
1563          "width" : 200,
1564          "$ renderer" : "function(v) { return String.format('{0}', v); }",
1565          "$ xns" : "Roo.grid",
1566          "* prop" : "colModel[]",
1567          "dataIndex" : "filename"
1568         },
1569         {
1570          "xtype" : "ColumnModel",
1571          "header" : "Order",
1572          "width" : 50,
1573          "$ renderer" : "function(v) { return String.format('{0}', v); }",
1574          "$ xns" : "Roo.grid",
1575          "* prop" : "colModel[]",
1576          "dataIndex" : "displayorder",
1577          "items" : [
1578           {
1579            "xtype" : "GridEditor",
1580            "$ xns" : "Roo.grid",
1581            "* prop" : "editor",
1582            "items" : [
1583             {
1584              "listeners" : {
1585               "focus" : "function (_self)\n{\n    if (this.value == 0) {\n        this.el.dom.value = '';\n    }\n}"
1586              },
1587              "xtype" : "NumberField",
1588              "decimalPrecision" : 0,
1589              "$ xns" : "Roo.form",
1590              "* prop" : "field"
1591             }
1592            ]
1593           }
1594          ]
1595         },
1596         {
1597          "xtype" : "ColumnModel",
1598          "header" : "Title",
1599          "width" : 100,
1600          "$ renderer" : "function(v) { return String.format('{0}', v); }",
1601          "$ xns" : "Roo.grid",
1602          "* prop" : "colModel[]",
1603          "dataIndex" : "title",
1604          "items" : [
1605           {
1606            "xtype" : "GridEditor",
1607            "$ xns" : "Roo.grid",
1608            "* prop" : "editor",
1609            "items" : [
1610             {
1611              "xtype" : "TextField",
1612              "$ xns" : "Roo.form",
1613              "* prop" : "field"
1614             }
1615            ]
1616           }
1617          ]
1618         },
1619         {
1620          "xtype" : "ColumnModel",
1621          "header" : "URL",
1622          "width" : 300,
1623          "$ renderer" : "function(v)\n{\n    return String.format('{0}', (v) ? v : '');\n}",
1624          "$ xns" : "Roo.grid",
1625          "* prop" : "colModel[]",
1626          "dataIndex" : "linkurl",
1627          "items" : [
1628           {
1629            "xtype" : "GridEditor",
1630            "$ xns" : "Roo.grid",
1631            "* prop" : "editor",
1632            "items" : [
1633             {
1634              "xtype" : "TextField",
1635              "$ xns" : "Roo.form",
1636              "* prop" : "field"
1637             }
1638            ]
1639           }
1640          ]
1641         }
1642        ]
1643       }
1644      ]
1645     },
1646     {
1647      "listeners" : {
1648       "render" : "function (_self)\n{\n    _this.westLayoutPanel = this;\n    \n}"
1649      },
1650      "Boolean fitContainer" : true,
1651      "xtype" : "NestedLayoutPanel",
1652      "Boolean fitToFrame" : true,
1653      "$ xns" : "Roo",
1654      "String region" : "west",
1655      "Boolean background" : false,
1656      "items" : [
1657       {
1658        "xtype" : "BorderLayout",
1659        "$ xns" : "Roo",
1660        "* prop" : "layout",
1661        "items" : [
1662         {
1663          "String tabPosition" : "top",
1664          "xtype" : "LayoutRegion",
1665          "$ xns" : "Roo",
1666          "* prop" : "center"
1667         },
1668         {
1669          "String tabPosition" : "top",
1670          "xtype" : "LayoutRegion",
1671          "Number height" : 250,
1672          "$ xns" : "Roo",
1673          "* prop" : "south",
1674          "Boolean split" : true
1675         },
1676         {
1677          "listeners" : {
1678           "resize" : "function (_self, width, height)\n{\n    Roo.log('resize called');\n    \n    var ew = Math.max(250, width - 10);\n    var eh = _this.westLayoutPanel.getLayout().getRegion('south').el.getHeight() - 30;\n    \n    \n    if (!_this.trform) {\n        return;\n    }\n    \n    var bd = _this.trform1.findField('body');\n    \n    if (bd.resizeEl) { \n        bd.width = ew;\n        bd.height = eh;\n        // since render delays resize.. \n        bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height  ] );\n       // _this.trbodycol.el.setWidth(bd.width+20);\n    }\n    var bd = _this.trform2.findField('extended');\n    if (bd.resizeEl) { \n        bd.width = ew;\n        bd.height = eh;\n        // since render delays resize.. \n        bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height  ] );\n       // _this.trextendcol.el.setWidth(bd.width+20);\n    }\n\n}",
1679           "render" : "function (_self)\n{\n  _this.trpanel = _self;\n}"
1680          },
1681          "autoScroll" : true,
1682          "region" : "center",
1683          "fitToFrame" : true,
1684          "xtype" : "ContentPanel",
1685          "$ xns" : "Roo",
1686          "items" : [
1687           {
1688            "listeners" : {
1689             "|actionfailed" : "function (_self, action)\n{\n    _this.dialog.el.unmask();\n \n    Pman.standardActionFailed(_self, action);\n}\n",
1690             "|actioncomplete" : "function (_self, action)\n{\n    if (action.type =='submit') {\n        return;\n    }\n    \n    if (action.type == 'setdata') {\n        _this.trform.addForm(_this.trform1);\n        _this.trform.addForm(_this.trform2);\n        _this.trform.addForm(_this.trform3);\n        \n        if ( _this.data.id) {\n            \n                this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n        } else {\n            this.trpanel.el.mask(\"save first\");\n        }\n\n       return;\n      \n    }\n    \n    if (action.type == 'load') {\n//        _this.dialog.el.unmask();\n        this.showHide();\n        \n        _this.trform1.findField('body').originalValue = _this.trform1.findField('body').getValue();\n       _this.trform2.findField('extended').originalValue = _this.trform2.findField('extended').getValue();\n       _this.trform3.findField('keywords').originalValue = _this.trform3.findField('keywords').getValue();\n       _this.trform3.findField('descriptions').originalValue = _this.trform3.findField('descriptions').getValue();\n        \n        return;\n    }\n}\n",
1691             "|rendered" : "function (_self)\n{\n    _this.trform = _self;\n}\n"
1692            },
1693            "labelAlign" : "right",
1694            "$ url" : "baseURL + '/Roo/cms_page.php'",
1695            "Boolean trackResetOnLoad" : true,
1696            "method" : "POST",
1697            "style" : "margin: 5px",
1698            "xtype" : "Form",
1699            "labelWidth" : 120,
1700            "$ showHide" : "function() {\n\n  //  var in_rss= _this.form.findField('in_rss').getValue() * 1;\n    var has_extended = _this.form.findField('has_extended').getValue() * 1;\n    var has_lang = _this.trform.findField('language').getValue().length;\n    \n    _this.westLayoutPanel.getLayout().getRegion('south').show();\n    _this.westLayoutPanel.getLayout().getRegion('south').unhidePanel(0);\n    _this.westLayoutPanel.getLayout().getRegion('south').unhidePanel(1);\n    _this.westLayoutPanel.getLayout().getRegion('south').unhidePanel(2);\n    \n    if(!has_lang){\n        _this.westLayoutPanel.getLayout().getRegion('south').hide();\n    }\n    \n    if(!has_extended && has_lang){\n        _this.westLayoutPanel.getLayout().getRegion('south').hidePanel(1);\n        _this.westLayoutPanel.getLayout().getRegion('south').showPanel(0);\n    }\n    \n    var vis = {\n        title : has_lang\n        \n    };\n    for(var k in vis) {\n        var el = _this.trform.findField(k);\n        el.actionMode = 'fieldEl';\n        if (    vis[k]) {\n            Roo.log(\"show: \" + k);\n            el.show();\n        } else{ \n            Roo.log(\"hide: \" + k);\n            el.hide();\n        }\n    }\n\n    _this.updateRow.el[has_lang ? 'show' : 'hide']();\n   \n    \n    if(typeof(_this.trform.editors) == 'undefined'){\n        _this.trform.editors = {\n            body : _this.trform1.findField('body').wrap.isVisible(),\n            extended : _this.trform2.findField('extended').wrap.isVisible()\n       };\n       if(_this.trform.editors.body){\n            setInterval(_this.trform1.findField('body').autosave, 60000);\n       }\n       \n       if(_this.trform.editors.extended){\n            setInterval(_this.trform2.findField('extended').autosave, 60000);\n       }\n   }\n   \n   if(!_this.trform.editors.body && _this.trform1.findField('body').wrap.isVisible()){\n        setInterval(_this.trform1.findField('body').autosave, 60000);\n        _this.trform.editors.body = true;\n   }\n   \n   if(!_this.trform.editors.extended && _this.trform2.findField('extended').wrap.isVisible()){\n        setInterval(_this.trform2.findField('extended').autosave, 60000);\n        _this.trform.editors.extended = true;\n   }\n    \n    \n}\n",
1701            "$ xns" : "Roo.form",
1702            "items" : [
1703             {
1704              "labelAlign" : "top",
1705              "xtype" : "Column",
1706              "width" : 500,
1707              "$ xns" : "Roo.form",
1708              "items" : [
1709               {
1710                "labelAlign" : "top",
1711                "xtype" : "Row",
1712                "width" : 400,
1713                "$ xns" : "Roo.form",
1714                "items" : [
1715                 {
1716                  "listeners" : {
1717                   "add" : "function (combo)\n{\n    Pman.Dialog.CmsLanguagePick.show({_with_name : true}, function( res) {\n       // Roo.log(res);\n       \n       _this.trform.reset();\n        _this.trform1.reset();\n        _this.trform2.reset();\n        \n        combo.setValue(res.lang);\n        combo.el.dom.value = res.lang_name;\n        (function() { \n            \n            _this.trform.showHide();\n           _this.trpanel.fireEvent('resize', _this.trpanel, [ _this.trpanel.el.getWidth(), _this.trpanel.el.getHeight() ]  );\n       }).defer(100); \n    });\n    \n}",
1718                   "render" : "function (_self)\n{\n    _this.language = _self;\n}",
1719                   "select" : "function (combo, record, index)\n{\n    (function() { \n        _this.trform.showHide();\n       _this.trpanel.fireEvent('resize', _this.trpanel, [ _this.trpanel.el.getWidth(), _this.trpanel.el.getHeight() ]  );\n   }).defer(100); \n    \n   _this.trform.load({\n    \n        method: 'GET', \n        params: {\n            'lookup[language]' : record.data.language,\n            'lookup[translation_of_id]' : _this.data.id,\n            'lookup[_id]' : 1\n        }\n   });\n}"
1720                  },
1721                  "alwaysQuery" : true,
1722                  "listWidth" : 400,
1723                  "triggerAction" : "all",
1724                  "fieldLabel" : "Select Language",
1725                  "forceSelection" : true,
1726                  "selectOnFocus" : true,
1727                  "pageSize" : 20,
1728                  "displayField" : "language_name",
1729                  "emptyText" : "Select Language",
1730                  "hiddenName" : "language",
1731                  "minChars" : 2,
1732                  "valueField" : "language",
1733                  "xtype" : "ComboBox",
1734                  "typeAhead" : false,
1735                  "editable" : false,
1736                  "$ xns" : "Roo.form",
1737                  "name" : "language_name",
1738                  "qtip" : "Select Language",
1739                  "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{language_name}</b> </div>",
1740                  "loadingText" : "Searching...",
1741                  "items" : [
1742                   {
1743                    "listeners" : {
1744                     "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params._distinct = 'language';\n    o.params._columns ='language_name,language';\n    o.params._with_name = true;\n    \n    if(_this.form.findField('id').getValue()*1 > 0){\n        o.params.translation_of_id = _this.form.findField('id').getValue();\n    }\n    \n}\n"
1745                    },
1746                    "xtype" : "Store",
1747                    "remoteSort" : true,
1748                    "$ sortInfo" : "{ direction : 'ASC', field: 'language' }",
1749                    "$ xns" : "Roo.data",
1750                    "* prop" : "store",
1751                    "items" : [
1752                     {
1753                      "$ url" : "baseURL + '/Roo/Cms_page.php'",
1754                      "xtype" : "HttpProxy",
1755                      "method" : "GET",
1756                      "$ xns" : "Roo.data",
1757                      "* prop" : "proxy"
1758                     },
1759                     {
1760                      "id" : "id",
1761                      "root" : "data",
1762                      "xtype" : "JsonReader",
1763                      "$ fields" : "[{\"name\":\"language\",\"type\":\"string\"}]",
1764                      "$ xns" : "Roo.data",
1765                      "* prop" : "reader",
1766                      "totalProperty" : "total"
1767                     }
1768                    ]
1769                   }
1770                  ]
1771                 },
1772                 {
1773                  "listeners" : {
1774                   "render" : "function (_self)\n{\n_this.updateRow = _self;\n}"
1775                  },
1776                  "xtype" : "Row",
1777                  "style" : "padding-top:12px;padding-left:30px;float:left",
1778                  "width" : 100,
1779                  "$ xns" : "Roo.form",
1780                  "items" : [
1781                   {
1782                    "listeners" : {
1783                     "click" : " function()\n {\n    //   _this.dialog.el.mask(\"Saving\");\n    if(!_this.trform1.findField('body').editorcore.sourceEditMode){\n        _this.trform1.findField('body').syncValue(); \n        _this.trform2.findField('extended').syncValue();\n    }else{\n        _this.trform1.findField('body').pushValue();\n        _this.trform2.findField('extended').pushValue();\n    }\n    \n    _this.trform.findField('parent_id').setValue(_this.form.findField('parent_id').getValue());\n    _this.trform.findField('element_id').setValue(_this.form.findField('element_id').getValue());\n    _this.trform.findField('translation_of_id').setValue(_this.form.findField('id').getValue());\n    _this.trform.findField('is_menuitem').setValue(_this.form.findField('is_menuitem').getValue());\n    _this.trform.findField('menu_page_id').setValue(_this.form.findField('menu_page_id').getValue());\n    \n    if(_this.trform.findField('element_id').getValue()*1 > 0){\n        _this.trform.findField('is_element').setValue(1);\n    }\n    \n    _this.trform.doAction(\"submit\");\n}\n"
1784                    },
1785                    "text" : "Update",
1786                    "xtype" : "Button",
1787                    "$ xns" : "Roo"
1788                   }
1789                  ]
1790                 }
1791                ]
1792               },
1793               {
1794                "fieldLabel" : "Title",
1795                "xtype" : "TextField",
1796                "width" : 400,
1797                "$ xns" : "Roo.form",
1798                "name" : "title"
1799               }
1800              ]
1801             },
1802             {
1803              "xtype" : "Hidden",
1804              "$ xns" : "Roo.form",
1805              "name" : "id"
1806             },
1807             {
1808              "xtype" : "Hidden",
1809              "$ xns" : "Roo.form",
1810              "name" : "element_id"
1811             },
1812             {
1813              "xtype" : "Hidden",
1814              "$ xns" : "Roo.form",
1815              "name" : "menu_page_id"
1816             },
1817             {
1818              "xtype" : "Hidden",
1819              "$ xns" : "Roo.form",
1820              "name" : "is_menuitem"
1821             },
1822             {
1823              "xtype" : "Hidden",
1824              "value" : 0,
1825              "$ xns" : "Roo.form",
1826              "name" : "is_element"
1827             },
1828             {
1829              "xtype" : "Hidden",
1830              "$ xns" : "Roo.form",
1831              "name" : "translation_of_id"
1832             },
1833             {
1834              "xtype" : "Hidden",
1835              "$ xns" : "Roo.form",
1836              "name" : "parent_id"
1837             }
1838            ]
1839           }
1840          ]
1841         },
1842         {
1843          "Boolean fitContainer" : true,
1844          "xtype" : "ContentPanel",
1845          "Boolean fitToFrame" : true,
1846          "$ xns" : "Roo",
1847          "String region" : "south",
1848          "String title" : "Contents",
1849          "Boolean background" : false,
1850          "items" : [
1851           {
1852            "listeners" : {
1853             "rendered" : "function (form)\n{\n    _this.trform1 = form;\n}"
1854            },
1855            "$ url" : "baseURL + '/Roo/cms_page.php'",
1856            "method" : "POST",
1857            "xtype" : "Form",
1858            "labelWidth" : 80,
1859            "String labelAlign" : "top",
1860            "$ xns" : "Roo.form",
1861            "items" : [
1862             {
1863              "xtype" : "Row",
1864              "$ xns" : "Roo.form",
1865              "Boolean hideLabels" : true,
1866              "items" : [
1867               {
1868                "listeners" : {
1869                 "stylesheetsclick" : "function (_self)\n{\n    Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){\n        _this.dialog.setStylesheets();\n    })\n    \n}",
1870                 "savedpreview" : "function (_self)\n{\n    var id = _this.trform.findField('id').getValue() * 1;\n    \n    var successFn = function(res){\n        return res.data.POST.source;\n    };\n    \n    var params = {\n        action : 'AUTOSAVE',\n        remarks : 'BODY',\n        on_id : (id < 1) ? 0 : id,\n        on_table : 'cms_page',\n        successFn : successFn\n    };\n    \n    \n    Pman.Dialog.CoreAutoSavePreview.show(params, function(res){\n        _self.setValue(res);\n        _self.originalValue = res;\n    });\n}",
1871                 "autosave" : "function (_self)\n{\n    var id = _this.trform.findField('id').getValue() * 1;\n    \n    /*\n    if(!_self.editorcore.sourceEditMode){\n        _self.syncValue();\n    }else{\n        _self.pushValue();\n    }\n    */\n    new Pman.Request({\n        url : baseURL + '/Roo/Events.php',\n        method :'POST',\n        params : {\n            id : 0,\n            action : 'AUTOSAVE',\n            on_id : (id > 0) ? id : 0,\n            on_table : 'cms_page',\n            remarks : 'BODY',\n            source: _self.getValue()\n        },\n        success : function() {\n            _self.originalValue = _self.getValue();\n            \n        },\n        failure : function() \n        {\n            //Roo.MessageBox.alert(\"Error\", \"autosave failed\");\n            Roo.log('tr body autosave failed?!');\n        }\n    });\n}"
1872                },
1873                "fieldLabel" : "Contents",
1874                "xtype" : "HtmlEditor",
1875                "$ xns" : "Roo.form",
1876                "resizable" : "s",
1877                "$ autosave" : "function() {\n    \n    var body = _this.trform1.findField('body');\n    \n    if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){\n        Roo.log('tr body not dirty');\n        return;\n    }\n\n    Roo.log('tr body dirty, auto save!');\n    \n    body.fireEvent('autosave', body);\n}\n",
1878                "$ array white" : "[ 'iframe' ]",
1879                "name" : "body",
1880                "height" : 140,
1881                "items" : [
1882                 {
1883                  "xtype" : "ToolbarStandard",
1884                  "$ xns" : "Roo.form.HtmlEditor",
1885                  "* prop" : "toolbars[]",
1886                  "items" : [
1887                   {
1888                    "listeners" : {
1889                     "render" : "function (_self)\n{\n    _this.trbodyimgselect = _self;\n}",
1890                     "beforequery" : "function (combo, query, forceAll, cancel, e)\n{\n \n    var id = _this.form.findField('id').getValue() * 1;    \n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save press release first\");\n        return false;\n    }\n}",
1891                     "select" : "function (combo, record, index)\n{\n    Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    \n    var editor = _this.trform.findField('body').editorcore;\n    \n    var curnode = editor.getSelectedNode();\n    \n    if (curnode && curnode.tagName == 'IMG') {\n        curnode.src= String.format('{0}/Images/{1}/{2}#attachment-{1}',\n                baseURL,  record.data.id, record.data.filename\n            );\n            // note -forces an update... hopefully...\n        editor.owner.fireEvent('editorevent', editor, false);\n    } else {\n    \n        editor.insertAtCursor(\n            String.format('<img src=\"{0}/Images/{1}/{2}#attachment-{1}\">',\n            baseURL,  record.data.id, record.data.filename\n            )\n        );\n\n    }\n    \n}"
1892                    },
1893                    "alwaysQuery" : true,
1894                    "listWidth" : 400,
1895                    "$ tpl" : "'<div class=\"x-grid-cell-text x-btn button\"><img src=\"' + baseURL + '/Images/Thumb/150x150/{id}.jpg\" height=\"150\" width=\"150\"><b>{filename}</b> </div>'",
1896                    "triggerAction" : "all",
1897                    "fieldLabel" : "Images",
1898                    "forceSelection" : true,
1899                    "selectOnFocus" : true,
1900                    "pageSize" : 20,
1901                    "displayField" : "name",
1902                    "emptyText" : "Add Image",
1903                    "minChars" : 2,
1904                    "valueField" : "id",
1905                    "xtype" : "ComboBox",
1906                    "typeAhead" : true,
1907                    "editable" : false,
1908                    "width" : 100,
1909                    "$ xns" : "Roo.form",
1910                    "* prop" : "btns[]",
1911                    "qtip" : "Select Images",
1912                    "loadingText" : "Searching...",
1913                    "items" : [
1914                     {
1915                      "listeners" : {
1916                       "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n\n    var id = _this.form.findField('id').getValue() * 1;    \n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save press release first\");\n        return false;\n    }\n    o.params.onid = id;\n    o.params.ontable = 'cms_page';\n   // o.params.imgtype = 'PressRelease';\n    //o.params['query[imagesize]'] = '150x150';\n    // set more here\n}\n"
1917                      },
1918                      "xtype" : "Store",
1919                      "remoteSort" : true,
1920                      "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
1921                      "$ xns" : "Roo.data",
1922                      "* prop" : "store",
1923                      "items" : [
1924                       {
1925                        "$ url" : "baseURL + '/Roo/Images.php'",
1926                        "method" : "GET",
1927                        "xtype" : "HttpProxy",
1928                        "$ xns" : "Roo.data",
1929                        "* prop" : "proxy"
1930                       },
1931                       {
1932                        "id" : "id",
1933                        "root" : "data",
1934                        "xtype" : "JsonReader",
1935                        "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"filename\",\"type\":\"string\"},{\"name\":\"url_thumb\",\"type\":\"string\"}]",
1936                        "$ xns" : "Roo.data",
1937                        "* prop" : "reader",
1938                        "totalProperty" : "total"
1939                       }
1940                      ]
1941                     }
1942                    ]
1943                   },
1944                   {
1945                    "listeners" : {
1946                     "select" : "function (combo, record, index)\n{\n  //  Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    var editor = _this.form.findField('body');\n    editor.insertAtCursor(\n            String.format('<a href=\"#page-{0}\">{1}</a>',\n            record.data.page_link,  record.data.title\n            )\n     );\n\n    \n }"
1947                    },
1948                    "listWidth" : 200,
1949                    "triggerAction" : "all",
1950                    "forceSelection" : true,
1951                    "selectOnFocus" : true,
1952                    "pageSize" : 40,
1953                    "displayField" : "page_link",
1954                    "emptyText" : "Add Link",
1955                    "hiddenName" : "add_link_id",
1956                    "minChars" : 2,
1957                    "valueField" : "id",
1958                    "xtype" : "ComboBox",
1959                    "allowBlank" : true,
1960                    "typeAhead" : true,
1961                    "editable" : true,
1962                    "width" : 100,
1963                    "$ xns" : "Roo.form",
1964                    "* prop" : "btns[]",
1965                    "name" : "add_link",
1966                    "qtip" : "Select Category ",
1967                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>",
1968                    "loadingText" : "Searching...",
1969                    "items" : [
1970                     {
1971                      "listeners" : {
1972                       "beforeload" : "function (_self, options)\n{\n     options.params['search[page_link_no_empty]'] =1; \n     /*\n     options.params.is_element = 0;\n     options.params.is_menuitem = _this.form.findField('is_menuitem').getValue() * 1;     \n     */\n}"
1973                      },
1974                      "xtype" : "Store",
1975                      "remoteSort" : true,
1976                      "$ sortInfo" : "{ field: 'page_link', direction: 'ASC' }",
1977                      "$ xns" : "Roo.data",
1978                      "* prop" : "store",
1979                      "items" : [
1980                       {
1981                        "$ url" : "baseURL + '/Roo/cms_page.php'",
1982                        "xtype" : "HttpProxy",
1983                        "method" : "GET",
1984                        "$ xns" : "Roo.data",
1985                        "* prop" : "proxy"
1986                       },
1987                       {
1988                        "id" : "id",
1989                        "root" : "data",
1990                        "xtype" : "JsonReader",
1991                        "$ fields" : "[\n { name: 'id', type: 'int' },\n 'title',\n 'page_link' \n]",
1992                        "$ xns" : "Roo.data",
1993                        "* prop" : "reader",
1994                        "totalProperty" : "total"
1995                       }
1996                      ]
1997                     }
1998                    ]
1999                   },
2000                   {
2001                    "xtype" : "Separator",
2002                    "$ xns" : "Roo.Toolbar",
2003                    "* prop" : "btns[]"
2004                   },
2005                   {
2006                    "listeners" : {
2007                     "click" : "function (_self, e)\n{\n    this.scope.owner.fireEvent('savedpreview', this.scope.owner);\n}"
2008                    },
2009                    "text" : "Saved Version",
2010                    "xtype" : "Button",
2011                    "$ xns" : "Roo.Toolbar",
2012                    "* prop" : "btns[]"
2013                   }
2014                  ]
2015                 },
2016                 {
2017                  "xtype" : "ToolbarContext",
2018                  "$ xns" : "Roo.form.HtmlEditor",
2019                  "* prop" : "toolbars[]"
2020                 }
2021                ]
2022               }
2023              ]
2024             }
2025            ]
2026           }
2027          ]
2028         },
2029         {
2030          "Boolean fitContainer" : true,
2031          "xtype" : "ContentPanel",
2032          "Boolean fitToFrame" : true,
2033          "$ xns" : "Roo",
2034          "String region" : "south",
2035          "String title" : "Extended Content",
2036          "Boolean background" : false,
2037          "items" : [
2038           {
2039            "listeners" : {
2040             "rendered" : "function (form)\n{\n    _this.trform2 = form;\n}"
2041            },
2042            "$ url" : "baseURL + '/Roo/cms_page.php'",
2043            "method" : "POST",
2044            "xtype" : "Form",
2045            "labelWidth" : 80,
2046            "String labelAlign" : "top",
2047            "$ xns" : "Roo.form",
2048            "items" : [
2049             {
2050              "xtype" : "Row",
2051              "$ xns" : "Roo.form",
2052              "Boolean hideLabels" : true,
2053              "items" : [
2054               {
2055                "listeners" : {
2056                 "stylesheetsclick" : "function (_self)\n{\n    Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){\n        _this.dialog.setStylesheets();\n    })\n    \n}",
2057                 "savedpreview" : "function (_self)\n{\n    var id = _this.trform.findField('id').getValue() * 1;\n    \n    var successFn = function(res){\n        return res.data.POST.source;\n    };\n    \n    var params = {\n        action : 'AUTOSAVE',\n        remarks : 'EXTENDED',\n        on_id : (id < 1) ? 0 : id,\n        on_table : 'cms_page',\n        successFn : successFn\n    };\n    \n    \n    Pman.Dialog.CoreAutoSavePreview.show(params, function(res){\n        _self.setValue(res);\n        _self.originalValue = res;\n    });\n}",
2058                 "autosave" : "function (_self)\n{\n    var id = _this.trform.findField('id').getValue() * 1;\n    \n    /*\n    if(!_self.editorcore.sourceEditMode){\n        _self.syncValue();\n    }else{\n        _self.pushValue();\n    }\n    */\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Events.php',\n        method :'POST',\n        params : {\n            id : 0,\n            action : 'AUTOSAVE',\n            on_id : (id > 0) ? id : 0,\n            on_table : 'cms_page',\n            remarks : 'EXTENDED',\n            source: _self.getValue()\n        },\n        success : function() {\n            _self.originalValue = _self.getValue();\n            \n        },\n        failure : function() \n        {\n            //Roo.MessageBox.alert(\"Error\", \"autosave failed\");\n            Roo.log('tr extended autosave failed?!');\n        }\n    });\n}"
2059                },
2060                "fieldLabel" : "Extended Contents",
2061                "xtype" : "HtmlEditor",
2062                "$ xns" : "Roo.form",
2063                "resizable" : "s",
2064                "$ autosave" : "function() {\n    \n    var extended = _this.trform2.findField('extended');\n    \n    if(!extended.wrap.isVisible(true) || extended.getValue() == '' || !extended.isDirty()){\n        Roo.log('tr extend not dirty');\n        return;\n    }\n\n    \n    Roo.log('tr extend dirty, auto save!');\n    \n    extended.fireEvent('autosave', extended);\n        \n   \n}\n",
2065                "$ array white" : "[ 'iframe' ]",
2066                "name" : "extended",
2067                "height" : 140,
2068                "items" : [
2069                 {
2070                  "xtype" : "ToolbarStandard",
2071                  "$ xns" : "Roo.form.HtmlEditor",
2072                  "* prop" : "toolbars[]",
2073                  "items" : [
2074                   {
2075                    "xtype" : "Separator",
2076                    "$ xns" : "Roo.Toolbar",
2077                    "* prop" : "btns[]"
2078                   },
2079                   {
2080                    "listeners" : {
2081                     "click" : "function (_self, e)\n{\n    this.scope.owner.fireEvent('savedpreview', this.scope.owner);\n}"
2082                    },
2083                    "text" : "Saved Version",
2084                    "xtype" : "Button",
2085                    "$ xns" : "Roo.Toolbar",
2086                    "* prop" : "btns[]"
2087                   }
2088                  ]
2089                 },
2090                 {
2091                  "xtype" : "ToolbarContext",
2092                  "$ styles" : "typeof(uiConfig) != 'undefined' ? (uiConfig['Roo.form.HtmlEditor.ToolbarContext.styles'] || {}) : {}",
2093                  "$ xns" : "Roo.form.HtmlEditor",
2094                  "* prop" : "toolbars[]"
2095                 }
2096                ]
2097               }
2098              ]
2099             }
2100            ]
2101           }
2102          ]
2103         },
2104         {
2105          "Boolean fitContainer" : true,
2106          "xtype" : "ContentPanel",
2107          "Boolean fitToFrame" : true,
2108          "$ xns" : "Roo",
2109          "String region" : "south",
2110          "String title" : "Meta Tags",
2111          "Boolean background" : false,
2112          "items" : [
2113           {
2114            "listeners" : {
2115             "rendered" : "function (form)\n{\n    _this.trform3 = form;\n}"
2116            },
2117            "$ url" : "baseURL + '/Roo/cms_page.php'",
2118            "xtype" : "Form",
2119            "method" : "POST",
2120            "labelWidth" : 80,
2121            "String labelAlign" : "top",
2122            "$ xns" : "Roo.form",
2123            "items" : [
2124             {
2125              "xtype" : "Row",
2126              "$ xns" : "Roo.form",
2127              "items" : [
2128               {
2129                "fieldLabel" : "Keywords",
2130                "xtype" : "TextArea",
2131                "width" : 340,
2132                "$ xns" : "Roo.form",
2133                "name" : "keywords",
2134                "height" : 100
2135               },
2136               {
2137                "fieldLabel" : "Descriptions",
2138                "xtype" : "TextArea",
2139                "width" : 340,
2140                "$ xns" : "Roo.form",
2141                "name" : "descriptions",
2142                "height" : 100
2143               }
2144              ]
2145             }
2146            ]
2147           }
2148          ]
2149         }
2150        ]
2151       }
2152      ]
2153     },
2154     {
2155      "listeners" : {
2156       "|click" : "function() {\n    \n    var page_link = _this.form.findField('page_link').getValue();\n    \n    if(!page_link.length){\n        Roo.MessageBox.alert('Error', 'Please fill in the page link');\n        return;\n    }\n    \n    if(!uiConfig || typeof(uiConfig.cms_page_preview_base) == 'undefined'){\n        Roo.MessageBox.alert('Error', 'Please setup [cms_page_preivew_base] in uiConfig');\n        return;\n    }\n    \n    var url = uiConfig.cms_page_preview_base + page_link;\n    \n    window.open(url);\n}\n"
2157      },
2158      "text" : "Preview",
2159      "xtype" : "Button",
2160      "$ xns" : "Roo",
2161      "* prop" : "buttons[]"
2162     },
2163     {
2164      "listeners" : {
2165       "|click" : " function() {\n\n    if(\n        _this.trform.isDirty() ||\n        _this.trform1.isDirty() ||\n        _this.trform2.isDirty() ||\n        _this.trform3.isDirty()\n    ) {\n        Roo.MessageBox.confirm(\n            \"Confirm\", \n            \"Do you want to save the translation\",\n            function(res) {\n                if(res != 'yes') {\n                    _this.form.reset();\n                    _this.dialog.hide();\n                    return;\n                }\n                \n            }\n        );\n        \n        return;\n    }\n    \n    _this.form.reset();\n    _this.dialog.hide();\n\n}\n"
2166      },
2167      "text" : "Cancel",
2168      "xtype" : "Button",
2169      "$ xns" : "Roo",
2170      "* prop" : "buttons[]"
2171     },
2172     {
2173      "listeners" : {
2174       "|click" : " function() {\n    _this.exit = false;\n    \n    if(!_this.form1.findField('body').editorcore.sourceEditMode){\n        _this.form1.findField('body').syncValue();\n        _this.form2.findField('extended').syncValue();\n        Roo.log('syncValue');\n    }else{\n        _this.form1.findField('body').pushValue();\n        _this.form2.findField('extended').pushValue();\n        Roo.log('pushValue');\n    }\n    \n    if(_this.data.page_type_id_name != 'blog' && AppModules.indexOf(\"Crm\") == -1){\n        _this.interests.reset();\n    }\n        \n    if(\n        _this.trform.isDirty() ||\n        _this.trform1.isDirty() ||\n        _this.trform2.isDirty() ||\n        _this.trform3.isDirty()\n    ) {\n        Roo.MessageBox.confirm(\n            \"Confirm\", \n            \"Do you want to save the translation\",\n            function(res) {\n                if(res != 'yes') {\n                    _this.dialog.el.mask(\"Saving\");\n                    _this.form.doAction(\"submit\");\n                    return;\n                }\n                \n            }\n        );\n            \n        return;\n    }\n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}\n"
2175      },
2176      "text" : "Save",
2177      "xtype" : "Button",
2178      "$ xns" : "Roo",
2179      "* prop" : "buttons[]"
2180     },
2181     {
2182      "listeners" : {
2183       "|click" : " function() {\n\n        _this.exit = true;\n       \n       if(!_this.form1.findField('body').editorcore.sourceEditMode){\n            _this.form1.findField('body').syncValue();\n            _this.form2.findField('extended').syncValue();\n        }else{\n            _this.form1.findField('body').pushValue();\n            _this.form2.findField('extended').pushValue();\n        }\n        \n        if(_this.data.page_type_id_name != 'blog' && AppModules.indexOf(\"Crm\") == -1){\n            _this.interests.reset();\n        }\n        \n        \n        if(\n            _this.trform.isDirty() ||\n            _this.trform1.isDirty() ||\n            _this.trform2.isDirty() ||\n            _this.trform3.isDirty()\n        ) {\n            Roo.MessageBox.confirm(\n                \"Confirm\", \n                \"Do you want to save the translation\",\n                function(res) {\n                    if(res != 'yes') {\n                        _this.dialog.el.mask(\"Saving\");\n                        _this.form.doAction(\"submit\");\n                        return;\n                    }\n                    \n                }\n            );\n            \n            return;\n        }\n        \n    _this.dialog.el.mask(\"Saving\");\n     _this.form.doAction(\"submit\");\n\n}\n"
2184      },
2185      "text" : "Save and close",
2186      "xtype" : "Button",
2187      "$ xns" : "Roo",
2188      "* prop" : "buttons[]"
2189     }
2190    ]
2191   }
2192  ]
2193 }