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