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