1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Dialog');
7 Pman.Dialog.CmsBlog = {
10 '2f26e35d61be90501e099089dc533638' :"Select Images",
11 'f3912172e6bf57f8979782f4a2342233' :"Appears in Block",
12 '95cb4f45ab7ff3984f25ab8668499020' :"Select Parent",
13 'c1df1da7a1ce305a3b60af9d5733ac1d' :"Contents",
14 'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
15 'ebd9bec4d70abc789d439c1f136b0538' :"Layout",
16 '20bec77364d863100a1f9325873a8504' :"Select Page Type",
17 'a517747c3d12f99244ae598910d979c5' :"Author",
18 '31fde7b05ac8952dacf4af8a704074ec' :"Preview",
19 '779e2624ddf330fb05b51ae59faf212d' :"Select Status Type",
20 '5834d26e96dbae06029496e5b111dca2' :"Has Extended content?",
21 '6a5b847af3d97df722040debdbccfbed' :"Page Type",
22 '30d1a216420426fcbd43ca70acd4aa48' :"Select interests",
23 'f03ab16cd58372c77ba45a3d9a5a1cb9' :"Draft",
24 'cc6892c9705afcfa61c53698756ba51b' :"Page Class",
25 'e6b391a8d2c4d45902a23a8b6585703d' :"URL",
26 '03368e3c1eb4d2a9048775874301b19f' :"Select category",
27 'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
28 '778551900655782c5c7827332b08cf3f' :"Save and close",
29 '77174410b72decfd0b259961f1f65a8f' :"Attributes:",
30 'b28a711cf7e94ec793ef926633997529' :"Seq",
31 '1243daf593fa297e07ab03bf06d925af' :"Searching...",
32 '8a53accfc94c2500b00575ce0e0d786f' :"Primary Image",
33 '580b21aac58f1b73cece26e272cdfbee' :"Add Link",
34 '8bc84316c4078bf66723fd019616d920' :"Descriptions",
35 '83dad8107f9459efe2b4fabcf5b63108' :"Select Language",
36 '76729937a5eb6b0fd88c42581161facd' :"Select Category ",
37 '0b8d92bc19b720bb1065649535463409' :"Translations",
38 '14c21301c0faf9d5561b8a580be21a13' :"Select class",
39 'd41d8cd98f00b204e9800998ecf8427e' :"",
40 '867343577fa1f33caa632a19543bd252' :"Keywords",
41 '340c2ee497b85d5954b01c64de7f44f6' :"Select Person",
42 '69dd756ae9c23191a5bb9b61f0857432' :"Date to Publish",
43 '3adbdb3ac060038aa0e6e6c138ef9873' :"Category",
44 '57e195426892c5515935f21d97228814' :"Extended Contents",
45 'd88aa1eee60ba140f07d5f81769cec74' :"<< Edit Translations",
46 'b9c49611cfda3259a2b837b39489e650' :"Add Image",
47 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
48 'cfcd208495d565ef66e7dff9f98764da' :"0",
49 'd8e4d1f5e445107e505b2cf63a1fb65c' :"Extra CSS",
50 'bd88a20b53a47f7b5704a83a15ff5506' :"Saved Version",
51 '31bb2f6e9b8fb11cbb7fb63c6025223f' :"Select Template",
52 'c02bd0c22c290ae599ee2f3ff2023fd3' :"Manage Images / Attachments >>",
53 'b78a3223503896721cca1303f776159b' :"Title",
54 '39f64cc9436cacfbceda3b7bdeb8e24c' :"Styles (CSS)",
55 'e64df1d7c22b9638f084ce8a4aff3ff3' :"Target URL",
56 '98e93e8f7adfe14832db6caed713d849' :"Meta Tags",
57 'a240fa27925a635b08dc28c9e4f9216d' :"Order",
58 '287234a1ff35a314b5b6bc4e5828e745' :"Attributes",
59 '99e7707748ae048e17c5810fad119e0b' :"Select Page",
60 '06933067aafd48425d67bcb01bba5cb6' :"Update",
61 '8adedb6a6226807ba810215dd3b3c61b' :"Menu links to Page",
62 'b5216c9b4e0ac0afd9c76eb1d12ad1b9' :"Select Section",
63 '2ad41a2ff4f0dac97d63aff331d5e6e7' :"Downloads first Attachment",
64 '308f2757bfc9ce92fb00ff93fdffd279' :"Images / Attachments",
65 '76eb64a1725ee953c664e15c9213b2fd' :"Extended Content",
66 '1351017ac6423911223bc19a8cb7c653' :"Filename",
67 'c9cc8cce247e49bae79f15173ce97354' :"Save",
68 'e659b52eba1f0299b2d8ca3483919e72' :"Type:",
69 'c70952e4ab3806c049737cd7d2b8896b' :"Interests",
70 'aa6356b678bc4fc78253c9edf65bff03' :"Edit Page / Blog Entry",
71 'd52f80f80467bb575253a5a39ca016a7' :"Page link / Name / Order",
72 'fff0d600f8a0b5e19e88bfb821dd1157' :"Images",
73 '30269022e9d8f51beaabb52e5d0de2b7' :"Parent",
74 'fb3f11443065d5f4d8303ad913db9680' :"Replaces (ignore)"
77 'seq_id_fieldLabel' : 'b28a711cf7e94ec793ef926633997529' /* Seq */ ,
78 'to_replace_id_fieldLabel' : 'fb3f11443065d5f4d8303ad913db9680' /* Replaces (ignore) */ ,
79 'template_id_template_clean_fieldLabel' : 'ebd9bec4d70abc789d439c1f136b0538' /* Layout */ ,
80 'page_cls_name_fieldLabel' : 'cc6892c9705afcfa61c53698756ba51b' /* Page Class */ ,
81 'language_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
82 'template_id_template_clean_qtip' : '76729937a5eb6b0fd88c42581161facd' /* Select Category */ ,
83 'author_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
84 'page_type_id_display_name_fieldLabel' : '6a5b847af3d97df722040debdbccfbed' /* Page Type */ ,
85 'has_extended_boxLabel' : '5834d26e96dbae06029496e5b111dca2' /* Has Extended content? */ ,
86 'language_name_emptyText' : '83dad8107f9459efe2b4fabcf5b63108' /* Select Language */ ,
87 'author_id_name_qtip' : '340c2ee497b85d5954b01c64de7f44f6' /* Select Person */ ,
88 'menu_page_id_page_link_qtip' : '76729937a5eb6b0fd88c42581161facd' /* Select Category */ ,
89 'published_fieldLabel' : '69dd756ae9c23191a5bb9b61f0857432' /* Date to Publish */ ,
90 'author_id_name_fieldLabel' : 'a517747c3d12f99244ae598910d979c5' /* Author */ ,
91 'element_id_name_qtip' : '76729937a5eb6b0fd88c42581161facd' /* Select Category */ ,
92 'parent_id_title_qtip' : '76729937a5eb6b0fd88c42581161facd' /* Select Category */ ,
93 'element_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
94 'author_id_name_emptyText' : '340c2ee497b85d5954b01c64de7f44f6' /* Select Person */ ,
95 'is_attachment_boxLabel' : '2ad41a2ff4f0dac97d63aff331d5e6e7' /* Downloads first Attachment */ ,
96 'extra_css_fieldLabel' : '39f64cc9436cacfbceda3b7bdeb8e24c' /* Styles (CSS) */ ,
97 'template_id_template_clean_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
98 'parent_id_title_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
99 'is_draft_fieldLabel' : '287234a1ff35a314b5b6bc4e5828e745' /* Attributes */ ,
100 'add_link_emptyText' : '580b21aac58f1b73cece26e272cdfbee' /* Add Link */ ,
101 'keywords_fieldLabel' : '867343577fa1f33caa632a19543bd252' /* Keywords */ ,
102 'descriptions_fieldLabel' : '8bc84316c4078bf66723fd019616d920' /* Descriptions */ ,
103 'add_link_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
104 'menu_page_id_page_link_emptyText' : '99e7707748ae048e17c5810fad119e0b' /* Select Page */ ,
105 'element_id_name_fieldLabel' : 'f3912172e6bf57f8979782f4a2342233' /* Appears in Block */ ,
106 'is_element_value' : 'cfcd208495d565ef66e7dff9f98764da' /* 0 */ ,
107 'target_url_fieldLabel' : 'e64df1d7c22b9638f084ce8a4aff3ff3' /* Target URL */ ,
108 'interest_name_fieldLabel' : 'c70952e4ab3806c049737cd7d2b8896b' /* Interests */ ,
109 'language_name_qtip' : '83dad8107f9459efe2b4fabcf5b63108' /* Select Language */ ,
110 'page_type_id_display_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
111 'language_name_fieldLabel' : '83dad8107f9459efe2b4fabcf5b63108' /* Select Language */ ,
112 'element_id_name_emptyText' : 'b5216c9b4e0ac0afd9c76eb1d12ad1b9' /* Select Section */ ,
113 'menu_page_id_page_link_fieldLabel' : '8adedb6a6226807ba810215dd3b3c61b' /* Menu links to Page */ ,
114 'page_type_id_display_name_emptyText' : '779e2624ddf330fb05b51ae59faf212d' /* Select Status Type */ ,
115 'template_id_template_clean_emptyText' : '31bb2f6e9b8fb11cbb7fb63c6025223f' /* Select Template */ ,
116 'menu_page_id_page_link_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
117 'extended_fieldLabel' : '57e195426892c5515935f21d97228814' /* Extended Contents */ ,
118 'add_link_qtip' : '76729937a5eb6b0fd88c42581161facd' /* Select Category */ ,
119 'category_name_fieldLabel' : '3adbdb3ac060038aa0e6e6c138ef9873' /* Category */ ,
120 'page_type_id_display_name_qtip' : '20bec77364d863100a1f9325873a8504' /* Select Page Type */ ,
121 'body_fieldLabel' : 'c1df1da7a1ce305a3b60af9d5733ac1d' /* Contents */ ,
122 'parent_id_title_emptyText' : '95cb4f45ab7ff3984f25ab8668499020' /* Select Parent */ ,
123 'title_fieldLabel' : 'b78a3223503896721cca1303f776159b' /* Title */ ,
124 'is_draft_boxLabel' : 'f03ab16cd58372c77ba45a3d9a5a1cb9' /* Draft */ ,
125 'page_link_fieldLabel' : 'd52f80f80467bb575253a5a39ca016a7' /* Page link / Name / Order */ ,
126 'parent_id_title_fieldLabel' : '30269022e9d8f51beaabb52e5d0de2b7' /* Parent */
132 show : function(data, cb)
140 this.dialog.show(this.data._el);
143 this.form.setValues(data);
144 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
152 this.dialog = Roo.factory({
153 xtype : 'LayoutDialog',
160 setStylesheets : function() {
163 sheets.push(rootURL + '/Pman/Cms/templates/undoreset.css');
165 if(typeof(uiConfig) !== 'undefined' && typeof(uiConfig.cms_css) != 'undefined'){
166 Roo.each(uiConfig.cms_css, function(v){
167 sheets.push(rootURL + v);
172 url : baseURL + '/Roo/Cms_page.php',
177 success : function(res) {
179 if(res.data._stylesheets.length){
180 var setting = res.data._stylesheets.split("\n");
182 Roo.each(setting, function(s){
183 sheets.push(s.replace('{rootURL}', rootURL));
188 _this.form1.findField('body').removeStylesheets();
189 _this.form2.findField('extended').removeStylesheets();
191 _this.form1.findField('body').setStylesheets(sheets);
192 _this.form2.findField('extended').setStylesheets(sheets);
194 _this.trform1.findField('body').removeStylesheets();
195 _this.trform2.findField('extended').removeStylesheets();
197 _this.trform1.findField('body').setStylesheets(sheets);
198 _this.trform2.findField('extended').setStylesheets(sheets);
203 title : _this._strings['aa6356b678bc4fc78253c9edf65bff03'] /* Edit Page / Blog Entry */,
206 show : function (_self)
208 // @see the contentpanel - center - resize handler.
210 _this.centerLayoutPanel.getLayout().getRegion('south').showPanel(0);
212 var w = Roo.lib.Dom.getViewWidth();
213 var h = Roo.lib.Dom.getViewHeight();
214 this.resizeTo(w-50, h-50);
217 _this.centerLayoutPanel.getLayout().getRegion('south').resizeTo(h - 450);
219 _this.westLayoutPanel.getLayout().getRegion('south').resizeTo(h - 450);
221 Pman.Cms.pageEditAddCustomFields();
224 var ew = Math.max(250, w-150); // was 350?/ why?
225 //var eh = Math.max(250, h-350) ;
228 var bd = _this.form1.findField('body');
233 // since render delays resize..
234 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
235 //_this.bodycol.el.setWidth(bd.width+20);
237 var bd = _this.form2.findField('extended');
241 // since render delays resize..
242 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
243 // _this.extendcol.el.setWidth(bd.width+20);
245 var bd = _this.form3.findField('extra_css');
248 //_this.keywordscol.el.setWidth(ew+20);
251 // fix messed up scroll.
252 _this.dialog.layout.el.dom.scrollTop = 0;
260 xtype : 'LayoutRegion',
266 xtype : 'LayoutRegion',
268 collapsedTitle : 'Images / Attachments',
272 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
275 expanded : function (_self)
277 var id = _this.form.findField('id').getValue() * 1;
280 Roo.MessageBox.alert('Error', 'Save first');
285 var w = Roo.lib.Dom.getViewWidth();
286 var h = Roo.lib.Dom.getViewHeight();
288 _self.resizeTo.defer(110, _self,[ w-400, h] );
289 _this.dialog.getLayout().getRegion('west').collapse();
296 xtype : 'LayoutRegion',
298 collapsedTitle : 'Translations',
302 title : _this._strings['0b8d92bc19b720bb1065649535463409'] /* Translations */,
305 beforecollapse : function (_self)
307 if(!_this.trform || !_this.trform1 || !_this.trform2){
312 !_this.trform.isDirty() &&
313 !_this.trform1.isDirty() &&
314 !_this.trform2.isDirty() &&
315 !_this.trform3.isDirty()
320 Roo.MessageBox.confirm(
322 "Do you want to save the translation",
325 _self.collapse(true, true);
335 collapsed : function (_self)
337 _this.trform.reset();
338 _this.trform1.reset();
339 _this.trform2.reset();
340 _this.trform3.reset();
342 expanded : function (_self)
344 var id = _this.form.findField('id').getValue() * 1;
347 Roo.MessageBox.alert('Error', 'Save first');
352 var w = Roo.lib.Dom.getViewWidth();
353 var h = Roo.lib.Dom.getViewHeight();
355 _self.resizeTo.defer(110, _self,[ w-400, h-350] );
357 _this.panel.region.collapse();
367 text : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
371 var page_link = _this.form.findField('page_link').getValue();
373 if(!page_link.length){
374 Roo.MessageBox.alert('Error', 'Please fill in the page link');
378 if(!uiConfig || typeof(uiConfig.cms_page_preview_base) == 'undefined'){
379 Roo.MessageBox.alert('Error', 'Please setup [cms_page_preivew_base] in uiConfig');
383 var url = uiConfig.cms_page_preview_base + page_link;
393 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
398 _this.trform.isDirty() ||
399 _this.trform1.isDirty() ||
400 _this.trform2.isDirty() ||
401 _this.trform3.isDirty()
403 Roo.MessageBox.confirm(
405 "Do you want to save the translation",
431 text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
436 if(!_this.form1.findField('body').editorcore.sourceEditMode){
437 _this.form1.findField('body').syncValue();
438 _this.form2.findField('extended').syncValue();
439 Roo.log('syncValue');
441 _this.form1.findField('body').pushValue();
442 _this.form2.findField('extended').pushValue();
443 Roo.log('pushValue');
446 if(_this.data.page_type_id_name != 'blog' && AppModules.indexOf("Crm") == -1){
447 _this.interests.reset();
451 _this.trform.isDirty() ||
452 _this.trform1.isDirty() ||
453 _this.trform2.isDirty() ||
454 _this.trform3.isDirty()
456 Roo.MessageBox.confirm(
458 "Do you want to save the translation",
461 _this.dialog.el.mask("Saving");
462 _this.form.doAction("submit");
472 _this.dialog.el.mask("Saving");
473 _this.form.doAction("submit");
482 text : _this._strings['778551900655782c5c7827332b08cf3f'] /* Save and close */,
488 if(!_this.form1.findField('body').editorcore.sourceEditMode){
489 _this.form1.findField('body').syncValue();
490 _this.form2.findField('extended').syncValue();
492 _this.form1.findField('body').pushValue();
493 _this.form2.findField('extended').pushValue();
496 if(_this.data.page_type_id_name != 'blog' && AppModules.indexOf("Crm") == -1){
497 _this.interests.reset();
502 _this.trform.isDirty() ||
503 _this.trform1.isDirty() ||
504 _this.trform2.isDirty() ||
505 _this.trform3.isDirty()
507 Roo.MessageBox.confirm(
509 "Do you want to save the translation",
512 _this.dialog.el.mask("Saving");
513 _this.form.doAction("submit");
523 _this.dialog.el.mask("Saving");
524 _this.form.doAction("submit");
534 xtype : 'NestedLayoutPanel',
540 render : function (_self)
542 _this.centerLayoutPanel = this;
549 xtype : 'BorderLayout',
553 xtype : 'LayoutRegion',
559 xtype : 'LayoutRegion',
568 xtype : 'ContentPanel',
573 render : function (_self)
575 _this.cpanel = _self;
577 resize : function (_self, width, height)
579 Roo.log("RESIZE, " + width + ',' + height);
581 var ew = Math.max(250, width - 10);
582 var eh = _this.centerLayoutPanel.getLayout().getRegion('south').el.getHeight() - 30;
589 bd = _this.form1.findField('body');
593 // since render delays resize..
594 Roo.log('resizing body to ' + bd.width);
595 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
596 // _this.bodycol.el.setWidth(bd.width+20);
601 bd = _this.form2.findField('extended');
607 Roo.log('resizing extended to ' + bd.width);
608 // since render delays resize..
609 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
610 // _this.extendcol.el.setWidth(bd.width+20);
615 bd = _this.form3.findField('extra_css');
619 // _this.keywordscol.el.setWidth(ew+20);
621 // fix for messed up rendering of dialog?
625 _this.dialog.layout.el.dom.scrollTop = 0;
627 // noop... - the above sometimes fails...
640 text : _this._strings['d88aa1eee60ba140f07d5f81769cec74'] /* << Edit Translations */,
642 click : function (_self, e)
644 if (_this.dialog.getLayout().getRegion('west').collapsed) {
645 _this.dialog.getLayout().getRegion('west').expand();
647 _this.dialog.getLayout().getRegion('west').collapse();
653 '|xns' : 'Roo.Toolbar'
658 '|xns' : 'Roo.Toolbar'
662 text : _this._strings['c02bd0c22c290ae599ee2f3ff2023fd3'] /* Manage Images / Attachments >> */,
664 click : function (_self, e)
666 if (_this.panel.region.collapsed) {
667 _this.panel.region.expand();
669 _this.panel.region.collapse();
675 '|xns' : 'Roo.Toolbar'
684 _this.form.setValues(_this.data);
688 _this.dialog.el.unmask();
689 _this.grid.getDataSource().load();
691 _this.trform.reset();
692 _this.trform1.reset();
693 _this.trform2.reset();
695 _this.form1.findField('body').originalValue = _this.form1.findField('body').getValue();
696 _this.form2.findField('extended').originalValue = _this.form2.findField('extended').getValue();
699 var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()
700 catlabel.dom.innerHTML = 'Category';
702 if(_this.data.page_type_id_name == 'category'){
703 catlabel.dom.innerHTML = 'Parent Category';
707 var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();
708 catlabel.dom.innerHTML = 'Parent page';
709 if(_this.data.page_type_id_name == 'category'){
710 catlabel.dom.innerHTML = 'Parent';
713 // better if this was not here... - not sure which project uses it?
715 if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf("Crm") !== -1){
716 _this.interestsCol.show();
719 if(typeof(d['interests']) != 'undefined'){
720 _this.form.findField('interest').setValue(Roo.decode(d['interests']));
723 if(typeof(d['categories']) != 'undefined'){
724 _this.form.findField('category').setValue(Roo.decode(d['categories']));
727 if(typeof(d['page_classes']) != 'undefined'){
728 _this.form.findField('page_cls').setValue(Roo.decode(d['page_classes']));
731 _this.trpanel.el.unmask();
732 _this.panel.el.unmask();
735 _this.cpanel.el.dom.scrollTop = 0;
737 // fix messed up scroll.
738 _this.dialog.layout.el.dom.scrollTop = 0;
741 labelAlign : 'right',
744 showHide : function()
751 var page_type_name = _this.form.findField('page_type_id_name').getValue();
753 switch(page_type_name){
776 var is_system_page = _this.form.findField('is_system_page').getValue() * 1;
777 var is_attachment = _this.form.findField('is_attachment').getValue() * 1;
778 var has_extended = _this.form.findField('has_extended').getValue() * 1;
781 is_attachment : !in_rss,
783 category_type_id : in_rss && !is_menu,
784 page_link : 1, //!in_rss, // always show page link.. may not be needed though..
785 target_url : is_menu,
787 category : !is_category,
789 parent_id : !in_rss || is_category ,
792 to_replace_id :false, // !in_rss, // is this used.
793 is_draft : !is_system_page,
794 author_id : in_rss && !is_menu && !is_attachment,
796 template_id : !is_attachment && !is_menu && !is_system_page,
797 element_id : is_element && !is_menu,
798 menu_page_id : is_menu,
799 page_cls : is_element
801 // has_extended : !is_menu && !is_attachment, // always shown.
802 // extended : has_extended && !is_menu && !is_attachment,
803 // body : !is_attachment && !is_menu,
804 //keywords : !is_attachment && !is_menu,
805 // descriptions : !is_attachment && !is_menu
806 // extra_css : !is_attachment && !is_menu
810 var el = _this.form.findField(k);
813 Roo.log("missing field " + k);
817 el.actionMode = 'fieldEl';
827 _this.centerLayoutPanel.getLayout().getRegion('south').show();
828 _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(0);
829 _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(1);
830 _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(2);
831 _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(3);
833 if(is_attachment || is_menu){
835 _this.centerLayoutPanel.getLayout().getRegion('south').hide();
839 if(!has_extended && !is_attachment && !is_menu){
840 _this.centerLayoutPanel.getLayout().getRegion('south').hidePanel(1);
841 _this.centerLayoutPanel.getLayout().getRegion('south').showPanel(0);
845 _this.trform.showHide();
847 if(typeof(_this.form.editors) == 'undefined'){
848 _this.form.editors = {
849 body : _this.form1.findField('body').wrap.isVisible(),
850 extended : _this.form2.findField('extended').wrap.isVisible()
853 if(_this.form.editors.body){
854 setInterval(_this.form1.findField('body').autosave, 60000);
857 if(_this.form.editors.extended){
858 setInterval(_this.form2.findField('extended').autosave, 60000);
862 if(!_this.form.editors.body && _this.form1.findField('body').wrap.isVisible()){
863 setInterval(_this.form1.findField('body').autosave, 60000);
864 _this.form.editors.body = true;
867 if(!_this.form.editors.extended && _this.form2.findField('extended').wrap.isVisible()){
868 setInterval(_this.form2.findField('extended').autosave, 60000);
869 _this.form.editors.extended = true;
875 style : 'margin: 5px',
876 url : baseURL + '/Roo/cms_page.php',
878 actioncomplete : function (_self, action)
881 if (action.type == 'setdata') {
883 _this.form.addForm(_this.form1);
884 _this.form.addForm(_this.form2);
885 _this.form.addForm(_this.form3);
886 _this.form.addForm(_this.form4);
888 _this.dialog.setStylesheets();
890 _this.dialog.getLayout().getRegion('west').collapse();
891 _this.panel.region.collapse();
893 _this.trpanel.el.mask('Save first');
894 _this.panel.el.mask('Save first');
896 _this.loaded = false;
897 _this.interestsCol.hide();
899 //_this.form.findField('category_page_id').fieldEl.select('label',true).first().dom.innerHTML = 'Category';
901 if ( _this.data.id) {
902 _this.dialog.el.mask("Loading");
903 this.load({ method: 'GET', params: { '_id' : _this.data.id, '_with_primary_image' : 1 }});
907 var is_draft = typeof(_this.data.is_draft) != 'undefined' ? _this.data.is_draft : 1;
908 this.findField('is_draft').setValue(is_draft);
909 _this.page_type.setValue(_this.data.page_type_id);
910 _this.page_type.el.dom.value = _this.data.page_type_id_display_name;
912 if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf("Crm") !== -1){
913 _this.interestsCol.show();
916 _this.form.showHide();
919 var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()
920 catlabel.dom.innerHTML = 'Category';
921 if(_this.data.page_type_id_name == 'category'){
922 catlabel.dom.innerHTML = 'Parent Category';
927 var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();
928 catlabel.dom.innerHTML = 'Parent page';
929 if(_this.data.page_type_id_name == 'category'){
930 catlabel.dom.innerHTML = 'Parent';
936 if(_this.data._is_copy){
937 _this.form.is_copy();
943 if (action.type == 'load') {
945 //_this.data = action.result.data;
947 var d = action.result.data;
949 _this.dialog.el.unmask();
950 _this.grid.getDataSource().load();
952 _this.trform.reset();
953 _this.trform1.reset();
954 _this.trform2.reset();
956 _this.trform.addForm(_this.trform1);
957 _this.trform.addForm(_this.trform2);
959 _this.form1.findField('body').originalValue = _this.form1.findField('body').getValue();
960 _this.form2.findField('extended').originalValue = _this.form2.findField('extended').getValue();
961 _this.form3.findField('extra_css').originalValue = _this.form3.findField('extra_css').getValue();
962 _this.form4.findField('keywords').originalValue = _this.form4.findField('keywords').getValue();
963 _this.form4.findField('descriptions').originalValue = _this.form4.findField('descriptions').getValue();
966 var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()
967 catlabel.dom.innerHTML = 'Category';
969 if(_this.data.page_type_id_name == 'category'){
970 catlabel.dom.innerHTML = 'Parent Category';
974 var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();
975 catlabel.dom.innerHTML = 'Parent page';
976 if(_this.data.page_type_id_name == 'category'){
977 catlabel.dom.innerHTML = 'Parent';
980 // better if this was not here... - not sure which project uses it?
982 if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf("Crm") !== -1){
983 _this.interestsCol.show();
986 if(typeof(d['interests']) != 'undefined'){
987 _this.form.findField('interest').setValue(Roo.decode(d['interests']));
990 if(typeof(d['categories']) != 'undefined'){
991 _this.form.findField('category').setValue(Roo.decode(d['categories']));
994 if(typeof(d['page_classes']) != 'undefined'){
995 _this.form.findField('page_cls').setValue(Roo.decode(d['page_classes']));
998 _this.trpanel.el.unmask();
999 _this.panel.el.unmask();
1002 _this.cpanel.el.dom.scrollTop = 0;
1004 // fix messed up scroll.
1005 _this.dialog.layout.el.dom.scrollTop = 0;
1009 if (action.type =='submit') {
1011 _this.dialog.el.unmask();
1014 this.load({ method: 'GET', params: { '_id' : action.result.data.id }});
1018 _this.dialog.hide();
1021 if (_this.callback) {
1022 _this.callback.call(_this, action.result.data);
1028 actionfailed : function (_self, action)
1030 _this.dialog.el.unmask();
1031 Pman.standardActionFailed(_self, action);
1033 rendered : function (_self)
1039 '|xns' : 'Roo.form',
1046 '|xns' : 'Roo.form',
1051 labelAlign : 'right',
1053 style : 'height:30px;overflow:hidden',
1056 '|xns' : 'Roo.form',
1060 fieldLabel : _this._strings['e659b52eba1f0299b2d8ca3483919e72'] /* Type: */,
1069 style : 'height:30px;overflow:hidden',
1072 '|xns' : 'Roo.form',
1077 displayField : 'display_name',
1079 emptyText : _this._strings['779e2624ddf330fb05b51ae59faf212d'] /* Select Status Type */,
1080 fieldLabel : _this._strings['6a5b847af3d97df722040debdbccfbed'] /* Page Type */,
1081 forceSelection : true,
1082 hiddenName : 'page_type_id',
1084 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1086 name : 'page_type_id_display_name',
1088 qtip : _this._strings['20bec77364d863100a1f9325873a8504'] /* Select Page Type */,
1089 selectOnFocus : true,
1090 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>',
1091 triggerAction : 'all',
1095 render : function (_self)
1097 _this.page_type = _self;
1099 select : function (combo, record, index)
1101 // _this.grid.footer.onClick('first');
1102 var page_type_name = record.data.name;
1103 _this.form.findField('page_type_id_name').setValue(page_type_name);
1104 if(page_type_name == 'blog' || page_type_name == 'category'){ // blog || category unset attachment
1105 _this.form.findField('is_attachment').setValue(0);
1109 _this.form.showHide.defer(100, _this.form);
1115 '|xns' : 'Roo.form',
1119 sortInfo : { direction : 'ASC', field: 'seqid' },
1121 beforeload : function (_self, o){
1122 o.params = o.params || {};
1124 o.params.etype = 'cms_page_type';
1128 '|xns' : 'Roo.data',
1130 xtype : 'HttpProxy',
1132 url : baseURL + '/Roo/core_enum.php',
1137 xtype : 'JsonReader',
1138 fields : [{"name":"id","type":"int"},{"name":"display_name","type":"string"}],
1141 totalProperty : 'total',
1150 style : 'padding-left: -70px;',
1153 '|xns' : 'Roo.form',
1156 xtype : 'NumberField',
1157 decimalPrecision : 0,
1158 fieldLabel : _this._strings['b28a711cf7e94ec793ef926633997529'] /* Seq */,
1173 labelAlign : 'right',
1175 style : 'height:30px;overflow:hidden',
1178 '|xns' : 'Roo.form',
1182 fieldLabel : _this._strings['77174410b72decfd0b259961f1f65a8f'] /* Attributes: */,
1191 style : 'height:30px;overflow:hidden',
1194 '|xns' : 'Roo.form',
1198 boxLabel : _this._strings['f03ab16cd58372c77ba45a3d9a5a1cb9'] /* Draft */,
1199 fieldLabel : _this._strings['287234a1ff35a314b5b6bc4e5828e745'] /* Attributes */,
1207 boxLabel : _this._strings['5834d26e96dbae06029496e5b111dca2'] /* Has Extended content? */,
1209 name : 'has_extended',
1212 check : function (_self, checked)
1217 _this.form.showHide();
1218 _this.panel.fireEvent('resize', _this.panel, [ _this.panel.el.getWidth(), _this.panel.el.getHeight() ] );
1229 boxLabel : _this._strings['2ad41a2ff4f0dac97d63aff331d5e6e7'] /* Downloads first Attachment */,
1231 name : 'is_attachment',
1234 check : function (_self, checked)
1238 _this.form.showHide.defer(100, _this.form);
1252 displayField : 'name',
1254 emptyText : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
1255 fieldLabel : _this._strings['a517747c3d12f99244ae598910d979c5'] /* Author */,
1256 forceSelection : true,
1257 hiddenName : 'author_id',
1259 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1261 name : 'author_id_name',
1263 qtip : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
1264 queryParam : 'query[name]',
1265 selectOnFocus : true,
1266 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> - {company_id_name}</div>',
1267 triggerAction : 'all',
1272 '|xns' : 'Roo.form',
1276 sortInfo : { direction : 'ASC', field: 'name' },
1278 beforeload : function (_self, o){
1279 o.params = o.params || {};
1281 o.params.active = 1;
1282 o.params['query[is_owner]'] = 1;
1286 '|xns' : 'Roo.data',
1288 xtype : 'HttpProxy',
1290 url : baseURL + '/Roo/core_person',
1295 xtype : 'JsonReader',
1296 fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
1299 totalProperty : 'total',
1306 xtype : 'ComboBoxArray',
1307 fieldLabel : _this._strings['3adbdb3ac060038aa0e6e6c138ef9873'] /* Category */,
1308 hiddenName : 'category',
1309 name : 'category_name',
1312 '|xns' : 'Roo.form',
1317 displayField : 'display_fullpath',
1319 emptyText : _this._strings['03368e3c1eb4d2a9048775874301b19f'] /* Select category */,
1320 fieldLabel : _this._strings['3adbdb3ac060038aa0e6e6c138ef9873'] /* Category */,
1321 forceSelection : true,
1325 queryParam : 'search[name]',
1326 selectOnFocus : true,
1327 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fullpath}</b> </div>',
1328 triggerAction : 'all',
1332 '|xns' : 'Roo.form',
1336 sortInfo : { field: 'tree_sequence', direction: 'ASC' },
1338 beforeload : function (_self, o){
1339 o.params = o.params || {};
1341 o.params.page_type_id_name= 'CATEGORY';
1343 o.params._with_fullpath = 1;
1347 '|xns' : 'Roo.data',
1349 xtype : 'HttpProxy',
1351 url : baseURL + '/Roo/cms_page.php',
1356 xtype : 'JsonReader',
1358 {"name":"id","type":"int"},
1359 {"name":"name","type":"string"},
1360 {"name":"display_name","type":"string"}
1364 totalProperty : 'total',
1375 displayField : 'page_link',
1377 emptyText : _this._strings['95cb4f45ab7ff3984f25ab8668499020'] /* Select Parent */,
1378 fieldLabel : _this._strings['30269022e9d8f51beaabb52e5d0de2b7'] /* Parent */,
1379 forceSelection : true,
1380 hiddenName : 'parent_id',
1382 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1384 name : 'parent_id_title',
1386 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
1387 selectOnFocus : true,
1388 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>',
1389 triggerAction : 'all',
1394 select : function (combo, record, index)
1396 var page_type_name = _this.form.findField('page_type_id_name').getValue();
1397 if (page_type_name == 'page') { // page
1400 // do not default to put 'Home' at the beginning.
1401 if (!record || !(record.data.parent_id *1)) {
1404 var pl = _this.form.findField('page_link');
1405 var lk = pl.getValue();
1406 var new_link = record.data.page_link + '/';
1408 new_link += lk.split('/').pop();
1410 pl.setValue(new_link);
1415 '|xns' : 'Roo.form',
1419 sortInfo : { field: 'page_link', direction: 'ASC' },
1421 beforeload : function (_self, options)
1423 options.params['search[page_link_no_empty]'] =1;
1425 if(_this.form.findField('page_type_id').getRawValue() == 'Elements'){
1426 options.params._page_type = 'page,element';
1428 options.params.page_type_id = _this.form.findField('page_type_id').getValue() * 1;
1431 var id = _this.form.findField('id').getValue() * 1;
1434 options.params['!id'] = id;
1439 options.params.is_element = 0;
1440 var page_type_name = _this.page_type.findRecord() ? _this.page_type.findRecord().data.name: _this.firstPageType.name;
1441 options.params.is_menuitem = page_type_name == 'menu' ? 1 : 0;
1446 '|xns' : 'Roo.data',
1448 xtype : 'HttpProxy',
1450 url : baseURL + '/Roo/cms_page.php',
1455 xtype : 'JsonReader',
1457 { name: 'id', type: 'int' },
1463 totalProperty : 'total',
1473 '|xns' : 'Roo.form',
1476 xtype : 'DateField',
1477 altFormats : 'Y-m-d H:i:s',
1478 fieldLabel : _this._strings['69dd756ae9c23191a5bb9b61f0857432'] /* Date to Publish */,
1486 xtype : 'TextField',
1487 fieldLabel : _this._strings['fb3f11443065d5f4d8303ad913db9680'] /* Replaces (ignore) */,
1488 name : 'to_replace_id',
1496 xtype : 'TextField',
1497 fieldLabel : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
1501 keyup : function (_self, e)
1503 if (_this.page_type.getRawValue() == 'Category') {
1505 _this.form.findField('page_link').setValue(this.getValue().replace(/[\s]/ig, '-').toLowerCase());
1514 xtype : 'TextField',
1515 fieldLabel : _this._strings['d52f80f80467bb575253a5a39ca016a7'] /* Page link / Name / Order */,
1522 xtype : 'TextField',
1523 fieldLabel : _this._strings['e64df1d7c22b9638f084ce8a4aff3ff3'] /* Target URL */,
1524 name : 'target_url',
1533 displayField : 'template_clean',
1535 emptyText : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
1536 fieldLabel : _this._strings['ebd9bec4d70abc789d439c1f136b0538'] /* Layout */,
1537 forceSelection : true,
1538 hiddenName : 'template_id',
1540 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1542 name : 'template_id_template_clean',
1544 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
1545 selectOnFocus : true,
1546 tpl : '<div class="x-grid-cell-text x-btn button"><b>{template_clean}</b></div>',
1547 triggerAction : 'all',
1552 '|xns' : 'Roo.form',
1556 sortInfo : { field: 'template', direction: 'ASC' },
1558 beforeload : function (_self, options)
1561 options.params._rescan = 1;
1562 options.params._clean_name = 1;
1563 // options.params.lang = 'en';
1564 options.params['!template[0]'] = 'master.html';
1565 //options.params['!template[1]'] = 'index.html';
1569 '|xns' : 'Roo.data',
1571 xtype : 'HttpProxy',
1573 url : baseURL + '/Roo/Cms_template',
1578 xtype : 'JsonReader',
1580 { name: 'id', type: 'int' }, {name: 'template', type: 'string'}
1584 totalProperty : 'total',
1594 displayField : 'name',
1596 emptyText : _this._strings['b5216c9b4e0ac0afd9c76eb1d12ad1b9'] /* Select Section */,
1597 fieldLabel : _this._strings['f3912172e6bf57f8979782f4a2342233'] /* Appears in Block */,
1598 forceSelection : true,
1599 hiddenName : 'element_id',
1601 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1603 name : 'element_id_name',
1605 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
1606 selectOnFocus : true,
1607 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b></div>',
1608 triggerAction : 'all',
1613 '|xns' : 'Roo.form',
1617 sortInfo : { field: 'name', direction: 'ASC' },
1619 beforeload : function (_self, options)
1621 var par = _this.form.findField('parent_id').getValue() * 1;
1623 Roo.MessageBox.alert("Error", "Select on what parent page it appears");
1627 options.params._cms_page_id = par;
1631 '|xns' : 'Roo.data',
1633 xtype : 'HttpProxy',
1635 url : baseURL + '/Roo/Cms_template_element',
1640 xtype : 'JsonReader',
1642 { name: 'id', type: 'int' }, {name: 'template', type: 'string'}
1646 totalProperty : 'total',
1656 displayField : 'page_link',
1658 emptyText : _this._strings['99e7707748ae048e17c5810fad119e0b'] /* Select Page */,
1659 fieldLabel : _this._strings['8adedb6a6226807ba810215dd3b3c61b'] /* Menu links to Page */,
1660 forceSelection : true,
1661 hiddenName : 'menu_page_id',
1663 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1665 name : 'menu_page_id_page_link',
1667 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
1668 selectOnFocus : true,
1669 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>',
1670 triggerAction : 'all',
1675 '|xns' : 'Roo.form',
1679 sortInfo : { field: 'title', direction: 'ASC' },
1681 beforeload : function (_self, options)
1683 options.params = options.params || {};
1685 options.params['search[page_link_no_empty]'] =1;
1687 options.params['page_type_id_name[0]'] = 'page';
1688 options.params['page_type_id_name[1]'] = 'blog';
1690 options.params.is_element = 0;
1691 options.params.is_menuitem = 0;
1696 '|xns' : 'Roo.data',
1698 xtype : 'HttpProxy',
1700 url : baseURL + '/Roo/cms_page.php',
1705 xtype : 'JsonReader',
1720 "name":"page_type_id_display_name",
1726 totalProperty : 'total',
1733 xtype : 'ComboBoxArray',
1734 fieldLabel : _this._strings['cc6892c9705afcfa61c53698756ba51b'] /* Page Class */,
1735 hiddenName : 'page_cls',
1736 name : 'page_cls_name',
1739 '|xns' : 'Roo.form',
1744 displayField : 'display_name',
1746 emptyText : _this._strings['14c21301c0faf9d5561b8a580be21a13'] /* Select class */,
1747 fieldLabel : _this._strings['cc6892c9705afcfa61c53698756ba51b'] /* Page Class */,
1748 forceSelection : true,
1751 queryParam : 'query[search]',
1752 selectOnFocus : true,
1753 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>',
1754 triggerAction : 'all',
1755 valueField : 'name',
1758 '|xns' : 'Roo.form',
1762 sortInfo : { direction : 'ASC', field: 'seqid' },
1764 beforeload : function (_self, o){
1765 o.params = o.params || {};
1767 o.params.etype = 'cms_page_class';
1771 '|xns' : 'Roo.data',
1773 xtype : 'HttpProxy',
1775 url : baseURL + '/Roo/core_enum.php',
1780 xtype : 'JsonReader',
1782 {"name":"id","type":"int"},
1783 {"name":"name","type":"string"},
1784 {"name":"display_name","type":"string"}
1788 totalProperty : 'total',
1802 '|xns' : 'Roo.form',
1808 legend : _this._strings['8a53accfc94c2500b00575ce0e0d786f'] /* Primary Image */,
1809 style : 'width: 165px;',
1811 '|xns' : 'Roo.form',
1814 xtype : 'DisplayField',
1816 icon : 'rootURL + \'images/default/dd/drop-add.gif\'',
1817 name : 'primary_image_id',
1818 style : 'border: 1px solid #ccc;',
1819 valueRenderer : function(v) {
1821 if (!v || v * 1 < 1) {
1822 return '<div style="width: 150px; height: 150px; background-color: grey;" title="Using zero order image"> </div>';
1825 return String.format('<img src="{0}/Images/Thumb/150/{1}" width="150" title="Using zero order image">', baseURL, v);
1838 render : function (_self)
1840 _this.interestsCol = _self;
1844 '|xns' : 'Roo.form',
1847 xtype : 'ComboBoxArray',
1848 fieldLabel : _this._strings['c70952e4ab3806c049737cd7d2b8896b'] /* Interests */,
1849 hiddenName : 'interest',
1850 name : 'interest_name',
1853 render : function (_self)
1855 _this.interests = _self;
1857 _self.combo.addicon.setStyle( {
1858 position : 'absolute',
1867 '|xns' : 'Roo.form',
1872 displayField : 'display_name',
1874 emptyText : _this._strings['30d1a216420426fcbd43ca70acd4aa48'] /* Select interests */,
1875 fieldLabel : _this._strings['c70952e4ab3806c049737cd7d2b8896b'] /* Interests */,
1876 forceSelection : true,
1879 queryParam : 'query[name]',
1880 selectOnFocus : true,
1881 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>',
1882 triggerAction : 'all',
1886 '|xns' : 'Roo.form',
1890 sortInfo : { direction : 'ASC', field: 'name' },
1892 beforeload : function (_self, o){
1893 o.params = o.params || {};
1894 o.params.etype = 'crm_interest';
1898 '|xns' : 'Roo.data',
1900 xtype : 'HttpProxy',
1902 url : baseURL + '/Roo/Core_enum.php',
1907 xtype : 'JsonReader',
1909 {"name":"id","type":"int"},
1910 {"name":"name","type":"string"},
1911 {"name":"display_name","type":"string"}
1915 totalProperty : 'total',
1932 name : 'is_system_page',
1938 name : 'is_menuitem',
1944 name : 'page_type_id_name',
1951 render : function (_self)
1953 _this.user_defined_fields = _self;
1964 xtype : 'ContentPanel',
1966 fitContainer : true,
1969 title : _this._strings['c1df1da7a1ce305a3b60af9d5733ac1d'] /* Contents */,
1978 url : baseURL + '/Roo/cms_page.php',
1980 rendered : function (form)
1986 '|xns' : 'Roo.form',
1992 '|xns' : 'Roo.form',
1995 xtype : 'HtmlEditor',
1996 autosave : function() {
1998 var body = _this.form1.findField('body');
2000 if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){
2001 Roo.log('body not dirty');
2005 Roo.log('body dirty, auto save!');
2007 body.fireEvent('autosave', body);
2011 fieldLabel : _this._strings['c1df1da7a1ce305a3b60af9d5733ac1d'] /* Contents */,
2015 white : [ 'iframe' ],
2018 autosave : function (_self)
2020 Roo.log('autosave');
2022 var id = _this.form.findField('id').getValue() * 1;
2024 if(!_self.editorcore.sourceEditMode){
2031 url : baseURL + '/Roo/Events.php',
2035 action : 'AUTOSAVE',
2036 on_id : (id > 0) ? id : 0,
2037 on_table : 'cms_page',
2039 source: _self.getValue()
2041 success : function() {
2042 _self.originalValue = _self.getValue();
2045 failure : function()
2047 //Roo.MessageBox.alert("Error", "autosave failed");
2048 Roo.log('body autosave failed?!');
2053 savedpreview : function (_self)
2055 Roo.log('saved preview');
2057 var id = _this.form.findField('id').getValue() * 1;
2059 var successFn = function(res){
2060 return res.data.POST.source;
2064 action : 'AUTOSAVE',
2066 on_id : (id < 1) ? 0 : id,
2067 on_table : 'cms_page',
2068 successFn : successFn
2072 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
2073 _self.setValue(res);
2074 _self.originalValue = res;
2077 stylesheetsclick : function (_self)
2079 Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){
2080 _this.dialog.setStylesheets();
2086 '|xns' : 'Roo.form',
2089 xtype : 'ToolbarStandard',
2090 xns : Roo.form.HtmlEditor,
2091 '|xns' : 'Roo.form.HtmlEditor',
2096 displayField : 'name',
2098 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
2099 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
2100 forceSelection : true,
2102 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
2105 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
2106 queryParam : 'search',
2107 selectOnFocus : true,
2108 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>',
2109 triggerAction : 'all',
2114 beforequery : function (combo, query, forceAll, cancel, e)
2117 var id = _this.form.findField('id').getValue() * 1;
2119 Roo.MessageBox.alert("Error", "Save Document First before adding images");
2123 render : function (_self)
2125 _this.bodyimgselect = _self;
2127 select : function (combo, record, index)
2134 var editor = _this.form.findField('body').editorcore;
2136 var curnode = editor.getSelectedNode();
2138 if (curnode && curnode.tagName == 'IMG') {
2139 curnode.src= String.format('{0}/Images/{1}/{2}#attachment-{1}',
2140 baseURL, record.data.id, record.data.filename
2142 // note -forces an update... hopefully...
2143 editor.owner.fireEvent('editorevent', editor, false);
2146 editor.insertAtCursor(
2147 String.format('<img src="{0}/Images/{1}/{2}#attachment-{1}">',
2148 baseURL, record.data.id, record.data.filename
2157 '|xns' : 'Roo.form',
2161 sortInfo : { direction : 'ASC', field: 'id' },
2163 beforeload : function (_self, o){
2164 o.params = o.params || {};
2166 var id = _this.form.findField('id').getValue() * 1;
2168 Roo.MessageBox.alert("Error", "Save press release first");
2172 o.params.ontable = 'cms_page';
2173 // o.params.imgtype = 'PressRelease';
2174 //o.params['query[imagesize]'] = '150x150';
2179 '|xns' : 'Roo.data',
2181 xtype : 'HttpProxy',
2183 url : baseURL + '/Roo/Images.php',
2188 xtype : 'JsonReader',
2189 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
2192 totalProperty : 'total',
2201 displayField : 'page_link',
2203 emptyText : _this._strings['580b21aac58f1b73cece26e272cdfbee'] /* Add Link */,
2204 forceSelection : true,
2205 hiddenName : 'add_link_id',
2207 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
2211 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
2212 selectOnFocus : true,
2213 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>',
2214 triggerAction : 'all',
2219 select : function (combo, record, index)
2225 var editor = _this.form.findField('body');
2226 editor.editorcore.insertAtCursor(
2227 String.format('<a href="#page-{0}">{1}</a>',
2228 record.data.page_link, record.data.title
2236 '|xns' : 'Roo.form',
2240 sortInfo : { field: 'page_link', direction: 'ASC' },
2242 beforeload : function (_self, options)
2244 options.params['search[page_link_no_empty]'] =1;
2246 options.params.is_element = 0;
2247 options.params.is_menuitem = _this.form.findField('is_menuitem').getValue() * 1;
2252 '|xns' : 'Roo.data',
2254 xtype : 'HttpProxy',
2256 url : baseURL + '/Roo/cms_page.php',
2261 xtype : 'JsonReader',
2263 { name: 'id', type: 'int' },
2269 totalProperty : 'total',
2276 xtype : 'Separator',
2278 '|xns' : 'Roo.Toolbar'
2282 cls : 'x-init-enable',
2283 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
2285 click : function (_self, e)
2287 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
2291 '|xns' : 'Roo.Toolbar'
2296 xtype : 'ToolbarContext',
2297 xns : Roo.form.HtmlEditor,
2298 '|xns' : 'Roo.form.HtmlEditor'
2309 xtype : 'ContentPanel',
2311 fitContainer : true,
2314 title : _this._strings['76eb64a1725ee953c664e15c9213b2fd'] /* Extended Content */,
2323 url : baseURL + '/Roo/cms_page.php',
2325 rendered : function (form)
2331 '|xns' : 'Roo.form',
2337 '|xns' : 'Roo.form',
2340 xtype : 'HtmlEditor',
2341 autosave : function() {
2343 var extended = _this.form2.findField('extended');
2345 if(!extended.wrap.isVisible(true) || extended.getValue() == '' || !extended.isDirty()){
2346 Roo.log('extend not dirty');
2351 Roo.log('extend dirty, auto save!');
2353 extended.fireEvent('autosave', extended);
2355 fieldLabel : _this._strings['57e195426892c5515935f21d97228814'] /* Extended Contents */,
2359 white : [ 'iframe' ],
2362 autosave : function (_self)
2364 var id = _this.form.findField('id').getValue() * 1;
2367 if(!_self.editorcore.sourceEditMode){
2374 url : baseURL + '/Roo/Events.php',
2378 action : 'AUTOSAVE',
2379 on_id : (id > 0) ? id : 0,
2380 on_table : 'cms_page',
2381 remarks : 'EXTENDED',
2382 source: _self.getValue()
2384 success : function() {
2385 _self.originalValue = _self.getValue();
2388 failure : function()
2390 //Roo.MessageBox.alert("Error", "autosave failed");
2391 Roo.log('extended autosave failed?!');
2395 savedpreview : function (_self)
2397 var id = _this.form.findField('id').getValue() * 1;
2399 var successFn = function(res){
2400 return res.data.POST.source;
2404 action : 'AUTOSAVE',
2405 remarks : 'EXTENDED',
2406 on_id : (id < 1) ? 0 : id,
2407 on_table : 'cms_page',
2408 successFn : successFn
2412 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
2413 _self.setValue(res);
2414 _self.originalValue = res;
2417 stylesheetsclick : function (_self)
2419 Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){
2420 _this.dialog.setStylesheets();
2426 '|xns' : 'Roo.form',
2429 xtype : 'ToolbarStandard',
2430 xns : Roo.form.HtmlEditor,
2431 '|xns' : 'Roo.form.HtmlEditor',
2436 displayField : 'name',
2438 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
2439 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
2440 forceSelection : true,
2442 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
2445 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
2446 selectOnFocus : true,
2447 tpl : '<div class=\"x-grid-cell-text x-btn button\"><img src=\"{url_thumb}\" height=\"150\" width=\"150\"><b>{filename}</b> </div>',
2448 triggerAction : 'all',
2453 beforequery : function (combo, query, forceAll, cancel, e)
2456 var id = _this.form.findField('id').getValue() * 1;
2458 Roo.MessageBox.alert("Error", "Save Document First before adding images");
2462 render : function (_self)
2464 _this.extendimgselect = _self;
2466 select : function (combo, record, index)
2473 var editor = _this.form.findField('extended').editorcore;
2475 var curnode = editor.getSelectedNode();
2477 if (curnode && curnode.tagName == 'IMG') {
2478 curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',
2479 baseURL, record.data.id, record.data.filename
2481 // note -forces an update... hopefully...
2482 editor.owner.fireEvent('editorevent', editor, false);
2485 editor.insertAtCursor(
2486 String.format('<img src="{0}/Images/{1}/{2}#image-{1}">',
2487 baseURL, record.data.id, record.data.filename
2496 '|xns' : 'Roo.form',
2500 sortInfo : { direction : 'ASC', field: 'id' },
2502 beforeload : function (_self, o){
2503 o.params = o.params || {};
2505 var id = _this.form.findField('id').getValue() * 1;
2507 Roo.MessageBox.alert("Error", "Save press release first");
2511 o.params.ontable = 'cms_page';
2512 // o.params.imgtype = 'PressRelease';
2513 //o.params['query[imagesize]'] = '150x150';
2518 '|xns' : 'Roo.data',
2520 xtype : 'HttpProxy',
2522 url : baseURL + '/Roo/Images.php',
2527 xtype : 'JsonReader',
2528 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
2531 totalProperty : 'total',
2540 displayField : 'page_link',
2542 emptyText : _this._strings['580b21aac58f1b73cece26e272cdfbee'] /* Add Link */,
2543 forceSelection : true,
2544 hiddenName : 'add_link_id',
2546 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
2550 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
2551 selectOnFocus : true,
2552 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>',
2553 triggerAction : 'all',
2558 select : function (combo, record, index)
2564 var editor = _this.form.findField('body');
2565 editor.editorcore.insertAtCursor(
2566 String.format('<a href="#page-{0}">{1}</a>',
2567 record.data.page_link, record.data.title
2575 '|xns' : 'Roo.form',
2579 sortInfo : { field: 'page_link', direction: 'ASC' },
2581 beforeload : function (_self, options)
2583 options.params['search[page_link_no_empty]'] =1;
2585 options.params.is_element = 0;
2586 options.params.is_menuitem = _this.form.findField('is_menuitem').getValue() * 1;
2591 '|xns' : 'Roo.data',
2593 xtype : 'HttpProxy',
2595 url : baseURL + '/Roo/cms_page.php',
2600 xtype : 'JsonReader',
2602 { name: 'id', type: 'int' },
2608 totalProperty : 'total',
2615 xtype : 'Separator',
2617 '|xns' : 'Roo.Toolbar'
2621 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
2623 click : function (_self, e)
2625 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
2629 '|xns' : 'Roo.Toolbar'
2634 xtype : 'ToolbarContext',
2635 styles : typeof(uiConfig) != 'undefined' ? (uiConfig['Roo.form.HtmlEditor.ToolbarContext.styles'] || {}) : {},
2636 xns : Roo.form.HtmlEditor,
2637 '|xns' : 'Roo.form.HtmlEditor'
2648 xtype : 'ContentPanel',
2650 fitContainer : true,
2653 title : _this._strings['d8e4d1f5e445107e505b2cf63a1fb65c'] /* Extra CSS */,
2662 url : baseURL + '/Roo/cms_page.php',
2664 rendered : function (form)
2670 '|xns' : 'Roo.form',
2676 '|xns' : 'Roo.form',
2680 fieldLabel : _this._strings['39f64cc9436cacfbceda3b7bdeb8e24c'] /* Styles (CSS) */,
2694 xtype : 'ContentPanel',
2696 fitContainer : true,
2699 title : _this._strings['98e93e8f7adfe14832db6caed713d849'] /* Meta Tags */,
2708 url : baseURL + '/Roo/cms_page.php',
2710 rendered : function (form)
2716 '|xns' : 'Roo.form',
2721 '|xns' : 'Roo.form',
2725 fieldLabel : _this._strings['867343577fa1f33caa632a19543bd252'] /* Keywords */,
2734 fieldLabel : _this._strings['8bc84316c4078bf66723fd019616d920'] /* Descriptions */,
2736 name : 'descriptions',
2751 xtype : 'GridPanel',
2753 fitContainer : true,
2756 tableName : 'Images',
2757 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
2759 activate : function() {
2762 _this.grid.footer.onClick('first');
2769 xtype : 'EditorGrid',
2770 autoExpandColumn : 'title',
2774 render : function() {
2776 //_this.dialog = Pman.Dialog.FILL_IN
2777 if (_this.panel.active) {
2778 //this.footer.onClick('first');
2781 rowdblclick : function (_self, rowIndex, e)
2783 var rd = _this.grid.getDataSource().getAt(rowIndex);
2784 var id = rd.data.id;
2785 var url = String.format('{0}/Images/{1}/{2}', baseURL, rd.data.id, rd.data.filename);
2786 _this.form.findField('contents').execCmd('insertimage', url);
2791 '|xns' : 'Roo.grid',
2799 cls : 'x-btn-text-icon',
2800 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
2801 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
2805 var id = _this.form.findField('id').getValue() * 1;
2811 Pman.Dialog.Image.show( { id : 0, onid : id, ontable: 'cms_page' }, function() {
2812 _this.grid.ds.load({});
2822 cls : 'x-btn-text-icon',
2823 icon : rootURL + '/Pman/templates/images/trash.gif',
2824 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
2828 var selection = _this.grid.getSelectionModel().getSelectedCell();
2829 var sn = _this.grid.ds.getAt(selection[0]);
2830 if (!sn || isNaN(sn.id *1)) {
2831 Roo.MessageBox.alert("Error", "Select a image");
2834 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
2840 url : baseURL + '/Roo/Images.php',
2845 success : function()
2847 Roo.log('Got Success!!');
2848 _this.grid.ds.load({});
2862 beforeload : function (_self, o)
2864 var id = _this.form.findField('id').getValue() * 1;
2870 o.params = o.params || {};
2871 o.params.limit = 9999;
2873 o.params.ontable = 'cms_page';
2875 update : function (_self, rec, operation)
2879 url : baseURL+'/Roo/Images.php',
2882 success: function(res)
2884 Roo.log("GOT success");
2885 // update the data...
2886 _this.grid.ds.load({});
2888 failure : function(res)
2890 Roo.MessageBox.alert('Error', res.errorMsg);
2891 _this.grid.ds.load({});
2899 '|xns' : 'Roo.data',
2901 xtype : 'HttpProxy',
2903 url : baseURL + '/Roo/Images.php',
2908 xtype : 'JsonReader',
2943 'name': 'displayorder',
2951 'name': 'parent_image_id',
2957 'dateFormat': 'Y-m-d'
2976 'name': 'parent_image_id_id',
2980 'name': 'parent_image_id_filename',
2984 'name': 'parent_image_id_ontable',
2988 'name': 'parent_image_id_onid',
2992 'name': 'parent_image_id_mimetype',
2996 'name': 'parent_image_id_width',
3000 'name': 'parent_image_id_height',
3004 'name': 'parent_image_id_filesize',
3008 'name': 'parent_image_id_displayorder',
3012 'name': 'parent_image_id_language',
3016 'name': 'parent_image_id_parent_image_id',
3020 'name': 'parent_image_id_created',
3024 'name': 'parent_image_id_imgtype',
3028 'name': 'parent_image_id_linkurl',
3032 'name': 'parent_image_id_descript',
3036 'name': 'parent_image_id_title',
3042 totalProperty : 'total',
3049 xtype : 'ColumnModel',
3051 header : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /* */,
3052 renderer : function(v,x,r) {
3053 return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.filename);
3061 xtype : 'ColumnModel',
3062 dataIndex : 'filename',
3063 header : _this._strings['1351017ac6423911223bc19a8cb7c653'] /* Filename */,
3064 renderer : function(v) { return String.format('{0}', v); },
3070 xtype : 'ColumnModel',
3071 dataIndex : 'displayorder',
3072 header : _this._strings['a240fa27925a635b08dc28c9e4f9216d'] /* Order */,
3073 renderer : function(v) { return String.format('{0}', v); },
3076 '|xns' : 'Roo.grid',
3078 xtype : 'GridEditor',
3080 '|xns' : 'Roo.grid',
3082 xtype : 'NumberField',
3083 decimalPrecision : 0,
3085 focus : function (_self)
3087 if (this.value == 0) {
3088 this.el.dom.value = '';
3098 xtype : 'ColumnModel',
3099 dataIndex : 'title',
3100 header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
3101 renderer : function(v) { return String.format('{0}', v); },
3104 '|xns' : 'Roo.grid',
3106 xtype : 'GridEditor',
3108 '|xns' : 'Roo.grid',
3110 xtype : 'TextField',
3117 xtype : 'ColumnModel',
3118 dataIndex : 'linkurl',
3119 header : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
3120 renderer : function(v)
3122 return String.format('{0}', (v) ? v : '');
3126 '|xns' : 'Roo.grid',
3128 xtype : 'GridEditor',
3130 '|xns' : 'Roo.grid',
3132 xtype : 'TextField',
3142 xtype : 'NestedLayoutPanel',
3144 fitContainer : true,
3148 render : function (_self)
3150 _this.westLayoutPanel = this;
3157 xtype : 'BorderLayout',
3161 xtype : 'LayoutRegion',
3162 tabPosition : 'top',
3167 xtype : 'LayoutRegion',
3170 tabPosition : 'top',
3176 xtype : 'ContentPanel',
3181 render : function (_self)
3183 _this.trpanel = _self;
3185 resize : function (_self, width, height)
3187 Roo.log('resize called');
3189 var ew = Math.max(250, width - 10);
3190 var eh = _this.westLayoutPanel.getLayout().getRegion('south').el.getHeight() - 30;
3193 if (!_this.trform) {
3197 var bd = _this.trform1.findField('body');
3202 // since render delays resize..
3203 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
3204 // _this.trbodycol.el.setWidth(bd.width+20);
3206 var bd = _this.trform2.findField('extended');
3210 // since render delays resize..
3211 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
3212 // _this.trextendcol.el.setWidth(bd.width+20);
3222 labelAlign : 'right',
3225 showHide : function() {
3227 // var in_rss= _this.form.findField('in_rss').getValue() * 1;
3228 var has_extended = _this.form.findField('has_extended').getValue() * 1;
3229 var has_lang = _this.trform.findField('language').getValue().length;
3231 _this.westLayoutPanel.getLayout().getRegion('south').show();
3232 _this.westLayoutPanel.getLayout().getRegion('south').unhidePanel(0);
3233 _this.westLayoutPanel.getLayout().getRegion('south').unhidePanel(1);
3234 _this.westLayoutPanel.getLayout().getRegion('south').unhidePanel(2);
3237 _this.westLayoutPanel.getLayout().getRegion('south').hide();
3240 if(!has_extended && has_lang){
3241 _this.westLayoutPanel.getLayout().getRegion('south').hidePanel(1);
3242 _this.westLayoutPanel.getLayout().getRegion('south').showPanel(0);
3250 var el = _this.trform.findField(k);
3251 el.actionMode = 'fieldEl';
3253 Roo.log("show: " + k);
3256 Roo.log("hide: " + k);
3261 _this.updateRow.el[has_lang ? 'show' : 'hide']();
3264 if(typeof(_this.trform.editors) == 'undefined'){
3265 _this.trform.editors = {
3266 body : _this.trform1.findField('body').wrap.isVisible(),
3267 extended : _this.trform2.findField('extended').wrap.isVisible()
3269 if(_this.trform.editors.body){
3270 setInterval(_this.trform1.findField('body').autosave, 60000);
3273 if(_this.trform.editors.extended){
3274 setInterval(_this.trform2.findField('extended').autosave, 60000);
3278 if(!_this.trform.editors.body && _this.trform1.findField('body').wrap.isVisible()){
3279 setInterval(_this.trform1.findField('body').autosave, 60000);
3280 _this.trform.editors.body = true;
3283 if(!_this.trform.editors.extended && _this.trform2.findField('extended').wrap.isVisible()){
3284 setInterval(_this.trform2.findField('extended').autosave, 60000);
3285 _this.trform.editors.extended = true;
3290 style : 'margin: 5px',
3291 trackResetOnLoad : true,
3292 url : baseURL + '/Roo/cms_page.php',
3294 actioncomplete : function (_self, action)
3296 if (action.type =='submit') {
3300 if (action.type == 'setdata') {
3301 _this.trform.addForm(_this.trform1);
3302 _this.trform.addForm(_this.trform2);
3303 _this.trform.addForm(_this.trform3);
3305 if ( _this.data.id) {
3307 this.load({ method: 'GET', params: { '_id' : _this.data.id }});
3309 this.trpanel.el.mask("save first");
3316 if (action.type == 'load') {
3317 // _this.dialog.el.unmask();
3320 _this.trform1.findField('body').originalValue = _this.trform1.findField('body').getValue();
3321 _this.trform2.findField('extended').originalValue = _this.trform2.findField('extended').getValue();
3322 _this.trform3.findField('keywords').originalValue = _this.trform3.findField('keywords').getValue();
3323 _this.trform3.findField('descriptions').originalValue = _this.trform3.findField('descriptions').getValue();
3328 actionfailed : function (_self, action)
3330 _this.dialog.el.unmask();
3332 Pman.standardActionFailed(_self, action);
3334 rendered : function (_self)
3336 _this.trform = _self;
3340 '|xns' : 'Roo.form',
3347 '|xns' : 'Roo.form',
3354 '|xns' : 'Roo.form',
3359 displayField : 'language_name',
3361 emptyText : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
3362 fieldLabel : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
3363 forceSelection : true,
3364 hiddenName : 'language',
3366 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3368 name : 'language_name',
3370 qtip : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
3371 selectOnFocus : true,
3372 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{language_name}</b> </div>',
3373 triggerAction : 'all',
3375 valueField : 'language',
3377 add : function (combo)
3379 Pman.Dialog.CmsLanguagePick.show({_with_name : true}, function( res) {
3382 _this.trform.reset();
3383 _this.trform1.reset();
3384 _this.trform2.reset();
3386 combo.setValue(res.lang);
3387 combo.el.dom.value = res.lang_name;
3390 _this.trform.showHide();
3391 _this.trpanel.fireEvent('resize', _this.trpanel, [ _this.trpanel.el.getWidth(), _this.trpanel.el.getHeight() ] );
3396 render : function (_self)
3398 _this.language = _self;
3400 select : function (combo, record, index)
3403 _this.trform.showHide();
3404 _this.trpanel.fireEvent('resize', _this.trpanel, [ _this.trpanel.el.getWidth(), _this.trpanel.el.getHeight() ] );
3411 'lookup[language]' : record.data.language,
3412 'lookup[translation_of_id]' : _this.data.id,
3419 '|xns' : 'Roo.form',
3423 sortInfo : { direction : 'ASC', field: 'language' },
3425 beforeload : function (_self, o){
3426 o.params = o.params || {};
3428 o.params._distinct = 'language';
3429 o.params._columns ='language_name,language';
3430 o.params._with_name = true;
3432 if(_this.form.findField('id').getValue()*1 > 0){
3433 o.params.translation_of_id = _this.form.findField('id').getValue();
3439 '|xns' : 'Roo.data',
3441 xtype : 'HttpProxy',
3443 url : baseURL + '/Roo/Cms_page.php',
3448 xtype : 'JsonReader',
3449 fields : [{"name":"language","type":"string"}],
3452 totalProperty : 'total',
3460 style : 'padding-top:12px;padding-left:30px;float:left',
3463 render : function (_self)
3465 _this.updateRow = _self;
3469 '|xns' : 'Roo.form',
3473 text : _this._strings['06933067aafd48425d67bcb01bba5cb6'] /* Update */,
3477 // _this.dialog.el.mask("Saving");
3478 if(!_this.trform1.findField('body').editorcore.sourceEditMode){
3479 _this.trform1.findField('body').syncValue();
3480 _this.trform2.findField('extended').syncValue();
3482 _this.trform1.findField('body').pushValue();
3483 _this.trform2.findField('extended').pushValue();
3486 _this.trform.findField('parent_id').setValue(_this.form.findField('parent_id').getValue());
3487 _this.trform.findField('element_id').setValue(_this.form.findField('element_id').getValue());
3488 _this.trform.findField('translation_of_id').setValue(_this.form.findField('id').getValue());
3489 _this.trform.findField('is_menuitem').setValue(_this.form.findField('is_menuitem').getValue());
3490 _this.trform.findField('menu_page_id').setValue(_this.form.findField('menu_page_id').getValue());
3492 if(_this.trform.findField('element_id').getValue()*1 > 0){
3493 _this.trform.findField('is_element').setValue(1);
3496 _this.trform.doAction("submit");
3507 xtype : 'TextField',
3508 fieldLabel : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
3524 name : 'element_id',
3530 name : 'menu_page_id',
3536 name : 'is_menuitem',
3542 name : 'is_element',
3549 name : 'translation_of_id',
3564 xtype : 'ContentPanel',
3566 fitContainer : true,
3569 title : _this._strings['c1df1da7a1ce305a3b60af9d5733ac1d'] /* Contents */,
3578 url : baseURL + '/Roo/cms_page.php',
3580 rendered : function (form)
3582 _this.trform1 = form;
3586 '|xns' : 'Roo.form',
3592 '|xns' : 'Roo.form',
3595 xtype : 'HtmlEditor',
3596 autosave : function() {
3598 var body = _this.trform1.findField('body');
3600 if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){
3601 Roo.log('tr body not dirty');
3605 Roo.log('tr body dirty, auto save!');
3607 body.fireEvent('autosave', body);
3609 fieldLabel : _this._strings['c1df1da7a1ce305a3b60af9d5733ac1d'] /* Contents */,
3613 white : [ 'iframe' ],
3615 autosave : function (_self)
3617 var id = _this.trform.findField('id').getValue() * 1;
3620 if(!_self.editorcore.sourceEditMode){
3627 url : baseURL + '/Roo/Events.php',
3631 action : 'AUTOSAVE',
3632 on_id : (id > 0) ? id : 0,
3633 on_table : 'cms_page',
3635 source: _self.getValue()
3637 success : function() {
3638 _self.originalValue = _self.getValue();
3641 failure : function()
3643 //Roo.MessageBox.alert("Error", "autosave failed");
3644 Roo.log('tr body autosave failed?!');
3648 savedpreview : function (_self)
3650 var id = _this.trform.findField('id').getValue() * 1;
3652 var successFn = function(res){
3653 return res.data.POST.source;
3657 action : 'AUTOSAVE',
3659 on_id : (id < 1) ? 0 : id,
3660 on_table : 'cms_page',
3661 successFn : successFn
3665 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
3666 _self.setValue(res);
3667 _self.originalValue = res;
3670 stylesheetsclick : function (_self)
3672 Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){
3673 _this.dialog.setStylesheets();
3679 '|xns' : 'Roo.form',
3682 xtype : 'ToolbarStandard',
3683 xns : Roo.form.HtmlEditor,
3684 '|xns' : 'Roo.form.HtmlEditor',
3689 displayField : 'name',
3691 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
3692 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
3693 forceSelection : true,
3695 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3698 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
3699 selectOnFocus : true,
3700 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>',
3701 triggerAction : 'all',
3706 beforequery : function (combo, query, forceAll, cancel, e)
3709 var id = _this.form.findField('id').getValue() * 1;
3711 Roo.MessageBox.alert("Error", "Save press release first");
3715 render : function (_self)
3717 _this.trbodyimgselect = _self;
3719 select : function (combo, record, index)
3726 var editor = _this.trform.findField('body').editorcore;
3728 var curnode = editor.getSelectedNode();
3730 if (curnode && curnode.tagName == 'IMG') {
3731 curnode.src= String.format('{0}/Images/{1}/{2}#attachment-{1}',
3732 baseURL, record.data.id, record.data.filename
3734 // note -forces an update... hopefully...
3735 editor.owner.fireEvent('editorevent', editor, false);
3738 editor.insertAtCursor(
3739 String.format('<img src="{0}/Images/{1}/{2}#attachment-{1}">',
3740 baseURL, record.data.id, record.data.filename
3749 '|xns' : 'Roo.form',
3753 sortInfo : { direction : 'ASC', field: 'id' },
3755 beforeload : function (_self, o){
3756 o.params = o.params || {};
3758 var id = _this.form.findField('id').getValue() * 1;
3760 Roo.MessageBox.alert("Error", "Save press release first");
3764 o.params.ontable = 'cms_page';
3765 // o.params.imgtype = 'PressRelease';
3766 //o.params['query[imagesize]'] = '150x150';
3771 '|xns' : 'Roo.data',
3773 xtype : 'HttpProxy',
3775 url : baseURL + '/Roo/Images.php',
3780 xtype : 'JsonReader',
3781 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
3784 totalProperty : 'total',
3793 displayField : 'page_link',
3795 emptyText : _this._strings['580b21aac58f1b73cece26e272cdfbee'] /* Add Link */,
3796 forceSelection : true,
3797 hiddenName : 'add_link_id',
3799 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3803 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
3804 selectOnFocus : true,
3805 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>',
3806 triggerAction : 'all',
3811 select : function (combo, record, index)
3817 var editor = _this.form.findField('body');
3818 editor.insertAtCursor(
3819 String.format('<a href="#page-{0}">{1}</a>',
3820 record.data.page_link, record.data.title
3828 '|xns' : 'Roo.form',
3832 sortInfo : { field: 'page_link', direction: 'ASC' },
3834 beforeload : function (_self, options)
3836 options.params['search[page_link_no_empty]'] =1;
3838 options.params.is_element = 0;
3839 options.params.is_menuitem = _this.form.findField('is_menuitem').getValue() * 1;
3844 '|xns' : 'Roo.data',
3846 xtype : 'HttpProxy',
3848 url : baseURL + '/Roo/cms_page.php',
3853 xtype : 'JsonReader',
3855 { name: 'id', type: 'int' },
3861 totalProperty : 'total',
3868 xtype : 'Separator',
3870 '|xns' : 'Roo.Toolbar'
3874 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
3876 click : function (_self, e)
3878 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
3882 '|xns' : 'Roo.Toolbar'
3887 xtype : 'ToolbarContext',
3888 xns : Roo.form.HtmlEditor,
3889 '|xns' : 'Roo.form.HtmlEditor'
3900 xtype : 'ContentPanel',
3902 fitContainer : true,
3905 title : _this._strings['76eb64a1725ee953c664e15c9213b2fd'] /* Extended Content */,
3914 url : baseURL + '/Roo/cms_page.php',
3916 rendered : function (form)
3918 _this.trform2 = form;
3922 '|xns' : 'Roo.form',
3928 '|xns' : 'Roo.form',
3931 xtype : 'HtmlEditor',
3932 autosave : function() {
3934 var extended = _this.trform2.findField('extended');
3936 if(!extended.wrap.isVisible(true) || extended.getValue() == '' || !extended.isDirty()){
3937 Roo.log('tr extend not dirty');
3942 Roo.log('tr extend dirty, auto save!');
3944 extended.fireEvent('autosave', extended);
3948 fieldLabel : _this._strings['57e195426892c5515935f21d97228814'] /* Extended Contents */,
3952 white : [ 'iframe' ],
3954 autosave : function (_self)
3956 var id = _this.trform.findField('id').getValue() * 1;
3959 if(!_self.editorcore.sourceEditMode){
3967 url : baseURL + '/Roo/Events.php',
3971 action : 'AUTOSAVE',
3972 on_id : (id > 0) ? id : 0,
3973 on_table : 'cms_page',
3974 remarks : 'EXTENDED',
3975 source: _self.getValue()
3977 success : function() {
3978 _self.originalValue = _self.getValue();
3981 failure : function()
3983 //Roo.MessageBox.alert("Error", "autosave failed");
3984 Roo.log('tr extended autosave failed?!');
3988 savedpreview : function (_self)
3990 var id = _this.trform.findField('id').getValue() * 1;
3992 var successFn = function(res){
3993 return res.data.POST.source;
3997 action : 'AUTOSAVE',
3998 remarks : 'EXTENDED',
3999 on_id : (id < 1) ? 0 : id,
4000 on_table : 'cms_page',
4001 successFn : successFn
4005 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
4006 _self.setValue(res);
4007 _self.originalValue = res;
4010 stylesheetsclick : function (_self)
4012 Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){
4013 _this.dialog.setStylesheets();
4019 '|xns' : 'Roo.form',
4022 xtype : 'ToolbarStandard',
4023 xns : Roo.form.HtmlEditor,
4024 '|xns' : 'Roo.form.HtmlEditor',
4027 xtype : 'Separator',
4029 '|xns' : 'Roo.Toolbar'
4033 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
4035 click : function (_self, e)
4037 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
4041 '|xns' : 'Roo.Toolbar'
4046 xtype : 'ToolbarContext',
4047 styles : typeof(uiConfig) != 'undefined' ? (uiConfig['Roo.form.HtmlEditor.ToolbarContext.styles'] || {}) : {},
4048 xns : Roo.form.HtmlEditor,
4049 '|xns' : 'Roo.form.HtmlEditor'
4060 xtype : 'ContentPanel',
4062 fitContainer : true,
4065 title : _this._strings['98e93e8f7adfe14832db6caed713d849'] /* Meta Tags */,
4074 url : baseURL + '/Roo/cms_page.php',
4076 rendered : function (form)
4078 _this.trform3 = form;
4082 '|xns' : 'Roo.form',
4087 '|xns' : 'Roo.form',
4091 fieldLabel : _this._strings['867343577fa1f33caa632a19543bd252'] /* Keywords */,
4100 fieldLabel : _this._strings['8bc84316c4078bf66723fd019616d920'] /* Descriptions */,
4102 name : 'descriptions',