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();
223 _this.dialog.getLayout().getRegion('east').collapse();
224 _this.dialog.getLayout().getRegion('west').collapse();
228 var ew = Math.max(250, w-150); // was 350?/ why?
229 //var eh = Math.max(250, h-350) ;
232 var bd = _this.form1.findField('body');
237 // since render delays resize..
238 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
239 //_this.bodycol.el.setWidth(bd.width+20);
241 var bd = _this.form2.findField('extended');
245 // since render delays resize..
246 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
247 // _this.extendcol.el.setWidth(bd.width+20);
249 var bd = _this.form3.findField('extra_css');
252 //_this.keywordscol.el.setWidth(ew+20);
255 // fix messed up scroll.
256 _this.dialog.layout.el.dom.scrollTop = 0;
264 xtype : 'LayoutRegion',
270 xtype : 'LayoutRegion',
272 collapsedTitle : 'Images / Attachments',
276 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
279 expanded : function (_self)
281 var id = _this.form.findField('id').getValue() * 1;
284 Roo.MessageBox.alert('Error', 'Save first');
289 var w = Roo.lib.Dom.getViewWidth();
290 var h = Roo.lib.Dom.getViewHeight();
292 _self.resizeTo.defer(110, _self,[ w-400, h] );
293 _this.dialog.getLayout().getRegion('west').collapse();
300 xtype : 'LayoutRegion',
302 collapsedTitle : 'Translations',
306 title : _this._strings['0b8d92bc19b720bb1065649535463409'] /* Translations */,
309 beforecollapse : function (_self)
311 if(!_this.trform || !_this.trform1 || !_this.trform2){
316 !_this.trform.isDirty() &&
317 !_this.trform1.isDirty() &&
318 !_this.trform2.isDirty() &&
319 !_this.trform3.isDirty()
324 Roo.MessageBox.confirm(
326 "Do you want to save the translation",
329 _self.collapse(true, true);
339 collapsed : function (_self)
342 _this.trform.reset();
346 _this.trform1.reset();
350 _this.trform2.reset();
354 _this.trform3.reset();
358 expanded : function (_self)
360 var id = _this.form.findField('id').getValue() * 1;
363 Roo.MessageBox.alert('Error', 'Save first');
368 var w = Roo.lib.Dom.getViewWidth();
369 var h = Roo.lib.Dom.getViewHeight();
371 _self.resizeTo.defer(110, _self,[ w-400, h-350] );
373 _this.panel.region.collapse();
383 text : _this._strings['31fde7b05ac8952dacf4af8a704074ec'] /* Preview */,
387 var page_link = _this.form.findField('page_link').getValue();
389 if(!page_link.length){
390 Roo.MessageBox.alert('Error', 'Please fill in the page link');
394 if(!uiConfig || typeof(uiConfig.cms_page_preview_base) == 'undefined'){
395 Roo.MessageBox.alert('Error', 'Please setup [cms_page_preivew_base] in uiConfig');
399 var url = uiConfig.cms_page_preview_base + page_link;
409 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
414 _this.trform.isDirty() ||
415 _this.trform1.isDirty() ||
416 _this.trform2.isDirty() ||
417 _this.trform3.isDirty()
419 Roo.MessageBox.confirm(
421 "Do you want to save the translation",
447 text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
452 if(!_this.form1.findField('body').editorcore.sourceEditMode){
453 _this.form1.findField('body').syncValue();
454 _this.form2.findField('extended').syncValue();
455 Roo.log('syncValue');
457 _this.form1.findField('body').pushValue();
458 _this.form2.findField('extended').pushValue();
459 Roo.log('pushValue');
462 if(_this.data.page_type_id_name != 'blog' && AppModules.indexOf("Crm") == -1){
463 _this.interests.reset();
467 _this.trform.isDirty() ||
468 _this.trform1.isDirty() ||
469 _this.trform2.isDirty() ||
470 _this.trform3.isDirty()
472 Roo.MessageBox.confirm(
474 "Do you want to save the translation",
477 _this.dialog.el.mask("Saving");
478 _this.form.doAction("submit");
488 _this.dialog.el.mask("Saving");
489 _this.form.doAction("submit");
498 text : _this._strings['778551900655782c5c7827332b08cf3f'] /* Save and close */,
504 if(!_this.form1.findField('body').editorcore.sourceEditMode){
505 _this.form1.findField('body').syncValue();
506 _this.form2.findField('extended').syncValue();
508 _this.form1.findField('body').pushValue();
509 _this.form2.findField('extended').pushValue();
512 if(_this.data.page_type_id_name != 'blog' && AppModules.indexOf("Crm") == -1){
513 _this.interests.reset();
518 _this.trform.isDirty() ||
519 _this.trform1.isDirty() ||
520 _this.trform2.isDirty() ||
521 _this.trform3.isDirty()
523 Roo.MessageBox.confirm(
525 "Do you want to save the translation",
528 _this.dialog.el.mask("Saving");
529 _this.form.doAction("submit");
539 _this.dialog.el.mask("Saving");
540 _this.form.doAction("submit");
550 xtype : 'NestedLayoutPanel',
556 render : function (_self)
558 _this.centerLayoutPanel = this;
565 xtype : 'BorderLayout',
569 xtype : 'LayoutRegion',
575 xtype : 'LayoutRegion',
584 xtype : 'ContentPanel',
589 render : function (_self)
591 _this.cpanel = _self;
593 resize : function (_self, width, height)
595 Roo.log("RESIZE, " + width + ',' + height);
597 var ew = Math.max(250, width - 10);
598 var eh = _this.centerLayoutPanel.getLayout().getRegion('south').el.getHeight() - 30;
605 bd = _this.form1.findField('body');
609 // since render delays resize..
610 Roo.log('resizing body to ' + bd.width);
611 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
612 // _this.bodycol.el.setWidth(bd.width+20);
617 bd = _this.form2.findField('extended');
623 Roo.log('resizing extended to ' + bd.width);
624 // since render delays resize..
625 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
626 // _this.extendcol.el.setWidth(bd.width+20);
631 bd = _this.form3.findField('extra_css');
635 // _this.keywordscol.el.setWidth(ew+20);
637 // fix for messed up rendering of dialog?
641 _this.dialog.layout.el.dom.scrollTop = 0;
643 // noop... - the above sometimes fails...
656 text : _this._strings['d88aa1eee60ba140f07d5f81769cec74'] /* << Edit Translations */,
658 click : function (_self, e)
660 if (_this.dialog.getLayout().getRegion('west').collapsed) {
661 _this.dialog.getLayout().getRegion('west').expand();
663 _this.dialog.getLayout().getRegion('west').collapse();
669 '|xns' : 'Roo.Toolbar'
674 '|xns' : 'Roo.Toolbar'
678 text : _this._strings['c02bd0c22c290ae599ee2f3ff2023fd3'] /* Manage Images / Attachments >> */,
680 click : function (_self, e)
682 if (_this.panel.region.collapsed) {
683 _this.panel.region.expand();
685 _this.panel.region.collapse();
691 '|xns' : 'Roo.Toolbar'
700 _this.form.setValues(_this.data);
704 _this.dialog.el.unmask();
705 _this.grid.getDataSource().load();
707 _this.trform.reset();
708 _this.trform1.reset();
709 _this.trform2.reset();
711 _this.form1.findField('body').originalValue = _this.form1.findField('body').getValue();
712 _this.form2.findField('extended').originalValue = _this.form2.findField('extended').getValue();
715 var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()
716 catlabel.dom.innerHTML = 'Category';
718 if(_this.data.page_type_id_name == 'category'){
719 catlabel.dom.innerHTML = 'Parent Category';
723 var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();
724 catlabel.dom.innerHTML = 'Parent page';
725 if(_this.data.page_type_id_name == 'category'){
726 catlabel.dom.innerHTML = 'Parent';
729 // better if this was not here... - not sure which project uses it?
731 if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf("Crm") !== -1){
732 _this.interestsCol.show();
735 if(typeof(d['interests']) != 'undefined'){
736 _this.form.findField('interest').setValue(Roo.decode(d['interests']));
739 if(typeof(d['categories']) != 'undefined'){
740 _this.form.findField('category').setValue(Roo.decode(d['categories']));
743 if(typeof(d['page_classes']) != 'undefined'){
744 _this.form.findField('page_cls').setValue(Roo.decode(d['page_classes']));
747 _this.trpanel.el.unmask();
748 _this.panel.el.unmask();
751 _this.cpanel.el.dom.scrollTop = 0;
753 // fix messed up scroll.
754 _this.dialog.layout.el.dom.scrollTop = 0;
757 labelAlign : 'right',
760 showHide : function()
767 var page_type_name = _this.form.findField('page_type_id_name').getValue();
769 switch(page_type_name){
792 var is_system_page = _this.form.findField('is_system_page').getValue() * 1;
793 var is_attachment = _this.form.findField('is_attachment').getValue() * 1;
794 var has_extended = _this.form.findField('has_extended').getValue() * 1;
797 is_attachment : !in_rss,
799 category_type_id : in_rss && !is_menu,
800 page_link : 1, //!in_rss, // always show page link.. may not be needed though..
801 target_url : is_menu,
803 category : !is_category,
805 parent_id : !in_rss || is_category ,
808 to_replace_id :false, // !in_rss, // is this used.
809 is_draft : !is_system_page,
810 author_id : in_rss && !is_menu && !is_attachment,
812 template_id : !is_attachment && !is_menu && !is_system_page,
813 element_id : is_element && !is_menu,
814 menu_page_id : is_menu,
815 page_cls : is_element
817 // has_extended : !is_menu && !is_attachment, // always shown.
818 // extended : has_extended && !is_menu && !is_attachment,
819 // body : !is_attachment && !is_menu,
820 //keywords : !is_attachment && !is_menu,
821 // descriptions : !is_attachment && !is_menu
822 // extra_css : !is_attachment && !is_menu
826 var el = _this.form.findField(k);
829 Roo.log("missing field " + k);
833 el.actionMode = 'fieldEl';
843 _this.centerLayoutPanel.getLayout().getRegion('south').show();
844 _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(0);
845 _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(1);
846 _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(2);
847 _this.centerLayoutPanel.getLayout().getRegion('south').unhidePanel(3);
849 if(is_attachment || is_menu){
851 _this.centerLayoutPanel.getLayout().getRegion('south').hide();
855 if(!has_extended && !is_attachment && !is_menu){
856 _this.centerLayoutPanel.getLayout().getRegion('south').hidePanel(1);
857 _this.centerLayoutPanel.getLayout().getRegion('south').showPanel(0);
861 _this.trform.showHide();
863 if(typeof(_this.form.editors) == 'undefined'){
864 _this.form.editors = {
865 body : _this.form1.findField('body').wrap.isVisible(),
866 extended : _this.form2.findField('extended').wrap.isVisible()
869 if(_this.form.editors.body){
870 setInterval(_this.form1.findField('body').autosave, 60000);
873 if(_this.form.editors.extended){
874 setInterval(_this.form2.findField('extended').autosave, 60000);
878 if(!_this.form.editors.body && _this.form1.findField('body').wrap.isVisible()){
879 setInterval(_this.form1.findField('body').autosave, 60000);
880 _this.form.editors.body = true;
883 if(!_this.form.editors.extended && _this.form2.findField('extended').wrap.isVisible()){
884 setInterval(_this.form2.findField('extended').autosave, 60000);
885 _this.form.editors.extended = true;
891 style : 'margin: 5px',
892 url : baseURL + '/Roo/cms_page.php',
894 actioncomplete : function (_self, action)
897 if (action.type == 'setdata') {
899 _this.form.addForm(_this.form1);
900 _this.form.addForm(_this.form2);
901 _this.form.addForm(_this.form3);
902 _this.form.addForm(_this.form4);
904 _this.dialog.setStylesheets();
906 _this.dialog.getLayout().getRegion('west').collapse();
907 _this.panel.region.collapse();
909 _this.trpanel.el.mask('Save first');
910 _this.panel.el.mask('Save first');
912 _this.loaded = false;
913 _this.interestsCol.hide();
915 //_this.form.findField('category_page_id').fieldEl.select('label',true).first().dom.innerHTML = 'Category';
917 if ( _this.data.id) {
918 _this.dialog.el.mask("Loading");
919 this.load({ method: 'GET', params: { '_id' : _this.data.id, '_with_primary_image' : 1 }});
923 var is_draft = typeof(_this.data.is_draft) != 'undefined' ? _this.data.is_draft : 1;
924 this.findField('is_draft').setValue(is_draft);
925 _this.page_type.setValue(_this.data.page_type_id);
926 _this.page_type.el.dom.value = _this.data.page_type_id_display_name;
928 if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf("Crm") !== -1){
929 _this.interestsCol.show();
932 _this.form.showHide();
935 var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()
936 catlabel.dom.innerHTML = 'Category';
937 if(_this.data.page_type_id_name == 'category'){
938 catlabel.dom.innerHTML = 'Parent Category';
943 var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();
944 catlabel.dom.innerHTML = 'Parent page';
945 if(_this.data.page_type_id_name == 'category'){
946 catlabel.dom.innerHTML = 'Parent';
952 if(_this.data._is_copy){
953 _this.form.is_copy();
959 if (action.type == 'load') {
961 //_this.data = action.result.data;
963 var d = action.result.data;
965 _this.dialog.el.unmask();
966 _this.grid.getDataSource().load();
968 _this.trform.reset();
969 _this.trform1.reset();
970 _this.trform2.reset();
972 _this.trform.addForm(_this.trform1);
973 _this.trform.addForm(_this.trform2);
975 _this.form1.findField('body').originalValue = _this.form1.findField('body').getValue();
976 _this.form2.findField('extended').originalValue = _this.form2.findField('extended').getValue();
977 _this.form3.findField('extra_css').originalValue = _this.form3.findField('extra_css').getValue();
978 _this.form4.findField('keywords').originalValue = _this.form4.findField('keywords').getValue();
979 _this.form4.findField('descriptions').originalValue = _this.form4.findField('descriptions').getValue();
982 var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()
983 catlabel.dom.innerHTML = 'Category';
985 if(_this.data.page_type_id_name == 'category'){
986 catlabel.dom.innerHTML = 'Parent Category';
990 var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();
991 catlabel.dom.innerHTML = 'Parent page';
992 if(_this.data.page_type_id_name == 'category'){
993 catlabel.dom.innerHTML = 'Parent';
996 // better if this was not here... - not sure which project uses it?
998 if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf("Crm") !== -1){
999 _this.interestsCol.show();
1002 if(typeof(d['interests']) != 'undefined'){
1003 _this.form.findField('interest').setValue(Roo.decode(d['interests']));
1006 if(typeof(d['categories']) != 'undefined'){
1007 _this.form.findField('category').setValue(Roo.decode(d['categories']));
1010 if(typeof(d['page_classes']) != 'undefined'){
1011 _this.form.findField('page_cls').setValue(Roo.decode(d['page_classes']));
1014 _this.trpanel.el.unmask();
1015 _this.panel.el.unmask();
1018 _this.cpanel.el.dom.scrollTop = 0;
1020 // fix messed up scroll.
1021 _this.dialog.layout.el.dom.scrollTop = 0;
1025 if (action.type =='submit') {
1027 _this.dialog.el.unmask();
1030 this.load({ method: 'GET', params: { '_id' : action.result.data.id }});
1034 _this.dialog.hide();
1037 if (_this.callback) {
1038 _this.callback.call(_this, action.result.data);
1044 actionfailed : function (_self, action)
1046 _this.dialog.el.unmask();
1047 Pman.standardActionFailed(_self, action);
1049 rendered : function (_self)
1055 '|xns' : 'Roo.form',
1062 '|xns' : 'Roo.form',
1067 labelAlign : 'right',
1069 style : 'height:30px;overflow:hidden',
1072 '|xns' : 'Roo.form',
1076 fieldLabel : _this._strings['e659b52eba1f0299b2d8ca3483919e72'] /* Type: */,
1085 style : 'height:30px;overflow:hidden',
1088 '|xns' : 'Roo.form',
1093 displayField : 'display_name',
1095 emptyText : _this._strings['779e2624ddf330fb05b51ae59faf212d'] /* Select Status Type */,
1096 fieldLabel : _this._strings['6a5b847af3d97df722040debdbccfbed'] /* Page Type */,
1097 forceSelection : true,
1098 hiddenName : 'page_type_id',
1100 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1102 name : 'page_type_id_display_name',
1104 qtip : _this._strings['20bec77364d863100a1f9325873a8504'] /* Select Page Type */,
1105 selectOnFocus : true,
1106 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>',
1107 triggerAction : 'all',
1111 render : function (_self)
1113 _this.page_type = _self;
1115 select : function (combo, record, index)
1117 // _this.grid.footer.onClick('first');
1118 var page_type_name = record.data.name;
1119 _this.form.findField('page_type_id_name').setValue(page_type_name);
1120 if(page_type_name == 'blog' || page_type_name == 'category'){ // blog || category unset attachment
1121 _this.form.findField('is_attachment').setValue(0);
1125 _this.form.showHide.defer(100, _this.form);
1131 '|xns' : 'Roo.form',
1135 sortInfo : { direction : 'ASC', field: 'seqid' },
1137 beforeload : function (_self, o){
1138 o.params = o.params || {};
1140 o.params.etype = 'cms_page_type';
1144 '|xns' : 'Roo.data',
1146 xtype : 'HttpProxy',
1148 url : baseURL + '/Roo/core_enum.php',
1153 xtype : 'JsonReader',
1154 fields : [{"name":"id","type":"int"},{"name":"display_name","type":"string"}],
1157 totalProperty : 'total',
1166 style : 'padding-left: -70px;',
1169 '|xns' : 'Roo.form',
1172 xtype : 'NumberField',
1173 decimalPrecision : 0,
1174 fieldLabel : _this._strings['b28a711cf7e94ec793ef926633997529'] /* Seq */,
1189 labelAlign : 'right',
1191 style : 'height:30px;overflow:hidden',
1194 '|xns' : 'Roo.form',
1198 fieldLabel : _this._strings['77174410b72decfd0b259961f1f65a8f'] /* Attributes: */,
1207 style : 'height:30px;overflow:hidden',
1210 '|xns' : 'Roo.form',
1214 boxLabel : _this._strings['f03ab16cd58372c77ba45a3d9a5a1cb9'] /* Draft */,
1215 fieldLabel : _this._strings['287234a1ff35a314b5b6bc4e5828e745'] /* Attributes */,
1223 boxLabel : _this._strings['5834d26e96dbae06029496e5b111dca2'] /* Has Extended content? */,
1225 name : 'has_extended',
1228 check : function (_self, checked)
1233 _this.form.showHide();
1234 _this.panel.fireEvent('resize', _this.panel, [ _this.panel.el.getWidth(), _this.panel.el.getHeight() ] );
1245 boxLabel : _this._strings['2ad41a2ff4f0dac97d63aff331d5e6e7'] /* Downloads first Attachment */,
1247 name : 'is_attachment',
1250 check : function (_self, checked)
1254 _this.form.showHide.defer(100, _this.form);
1268 displayField : 'name',
1270 emptyText : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
1271 fieldLabel : _this._strings['a517747c3d12f99244ae598910d979c5'] /* Author */,
1272 forceSelection : true,
1273 hiddenName : 'author_id',
1275 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1277 name : 'author_id_name',
1279 qtip : _this._strings['340c2ee497b85d5954b01c64de7f44f6'] /* Select Person */,
1280 queryParam : 'query[name]',
1281 selectOnFocus : true,
1282 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> - {company_id_name}</div>',
1283 triggerAction : 'all',
1288 '|xns' : 'Roo.form',
1292 sortInfo : { direction : 'ASC', field: 'name' },
1294 beforeload : function (_self, o){
1295 o.params = o.params || {};
1297 o.params.active = 1;
1298 o.params['query[is_owner]'] = 1;
1302 '|xns' : 'Roo.data',
1304 xtype : 'HttpProxy',
1306 url : baseURL + '/Roo/core_person',
1311 xtype : 'JsonReader',
1312 fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
1315 totalProperty : 'total',
1322 xtype : 'ComboBoxArray',
1323 fieldLabel : _this._strings['3adbdb3ac060038aa0e6e6c138ef9873'] /* Category */,
1324 hiddenName : 'category',
1325 name : 'category_name',
1328 '|xns' : 'Roo.form',
1333 displayField : 'display_fullpath',
1335 emptyText : _this._strings['03368e3c1eb4d2a9048775874301b19f'] /* Select category */,
1336 fieldLabel : _this._strings['3adbdb3ac060038aa0e6e6c138ef9873'] /* Category */,
1337 forceSelection : true,
1341 queryParam : 'search[name]',
1342 selectOnFocus : true,
1343 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fullpath}</b> </div>',
1344 triggerAction : 'all',
1348 '|xns' : 'Roo.form',
1352 sortInfo : { field: 'tree_sequence', direction: 'ASC' },
1354 beforeload : function (_self, o){
1355 o.params = o.params || {};
1357 o.params.page_type_id_name= 'CATEGORY';
1359 o.params._with_fullpath = 1;
1363 '|xns' : 'Roo.data',
1365 xtype : 'HttpProxy',
1367 url : baseURL + '/Roo/cms_page.php',
1372 xtype : 'JsonReader',
1374 {"name":"id","type":"int"},
1375 {"name":"name","type":"string"},
1376 {"name":"display_name","type":"string"}
1380 totalProperty : 'total',
1391 displayField : 'page_link',
1393 emptyText : _this._strings['95cb4f45ab7ff3984f25ab8668499020'] /* Select Parent */,
1394 fieldLabel : _this._strings['30269022e9d8f51beaabb52e5d0de2b7'] /* Parent */,
1395 forceSelection : true,
1396 hiddenName : 'parent_id',
1398 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1400 name : 'parent_id_title',
1402 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
1403 selectOnFocus : true,
1404 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>',
1405 triggerAction : 'all',
1410 select : function (combo, record, index)
1412 var page_type_name = _this.form.findField('page_type_id_name').getValue();
1413 if (page_type_name == 'page') { // page
1416 // do not default to put 'Home' at the beginning.
1417 if (!record || !(record.data.parent_id *1)) {
1420 var pl = _this.form.findField('page_link');
1421 var lk = pl.getValue();
1422 var new_link = record.data.page_link + '/';
1424 new_link += lk.split('/').pop();
1426 pl.setValue(new_link);
1431 '|xns' : 'Roo.form',
1435 sortInfo : { field: 'page_link', direction: 'ASC' },
1437 beforeload : function (_self, options)
1439 options.params['search[page_link_no_empty]'] =1;
1441 if(_this.form.findField('page_type_id').getRawValue() == 'Elements'){
1442 options.params._page_type = 'page,element';
1444 options.params.page_type_id = _this.form.findField('page_type_id').getValue() * 1;
1447 var id = _this.form.findField('id').getValue() * 1;
1450 options.params['!id'] = id;
1455 options.params.is_element = 0;
1456 var page_type_name = _this.page_type.findRecord() ? _this.page_type.findRecord().data.name: _this.firstPageType.name;
1457 options.params.is_menuitem = page_type_name == 'menu' ? 1 : 0;
1462 '|xns' : 'Roo.data',
1464 xtype : 'HttpProxy',
1466 url : baseURL + '/Roo/cms_page.php',
1471 xtype : 'JsonReader',
1473 { name: 'id', type: 'int' },
1479 totalProperty : 'total',
1489 '|xns' : 'Roo.form',
1492 xtype : 'DateField',
1493 altFormats : 'Y-m-d H:i:s',
1494 fieldLabel : _this._strings['69dd756ae9c23191a5bb9b61f0857432'] /* Date to Publish */,
1502 xtype : 'TextField',
1503 fieldLabel : _this._strings['fb3f11443065d5f4d8303ad913db9680'] /* Replaces (ignore) */,
1504 name : 'to_replace_id',
1512 xtype : 'TextField',
1513 fieldLabel : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
1517 keyup : function (_self, e)
1519 if (_this.page_type.getRawValue() == 'Category') {
1521 _this.form.findField('page_link').setValue(this.getValue().replace(/[\s]/ig, '-').toLowerCase());
1530 xtype : 'TextField',
1531 fieldLabel : _this._strings['d52f80f80467bb575253a5a39ca016a7'] /* Page link / Name / Order */,
1538 xtype : 'TextField',
1539 fieldLabel : _this._strings['e64df1d7c22b9638f084ce8a4aff3ff3'] /* Target URL */,
1540 name : 'target_url',
1549 displayField : 'template_clean',
1551 emptyText : _this._strings['31bb2f6e9b8fb11cbb7fb63c6025223f'] /* Select Template */,
1552 fieldLabel : _this._strings['ebd9bec4d70abc789d439c1f136b0538'] /* Layout */,
1553 forceSelection : true,
1554 hiddenName : 'template_id',
1556 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1558 name : 'template_id_template_clean',
1560 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
1561 selectOnFocus : true,
1562 tpl : '<div class="x-grid-cell-text x-btn button"><b>{template_clean}</b></div>',
1563 triggerAction : 'all',
1568 '|xns' : 'Roo.form',
1572 sortInfo : { field: 'template', direction: 'ASC' },
1574 beforeload : function (_self, options)
1577 options.params._rescan = 1;
1578 options.params._clean_name = 1;
1579 // options.params.lang = 'en';
1580 options.params['!template[0]'] = 'master.html';
1581 //options.params['!template[1]'] = 'index.html';
1585 '|xns' : 'Roo.data',
1587 xtype : 'HttpProxy',
1589 url : baseURL + '/Roo/Cms_template',
1594 xtype : 'JsonReader',
1596 { name: 'id', type: 'int' }, {name: 'template', type: 'string'}
1600 totalProperty : 'total',
1610 displayField : 'name',
1612 emptyText : _this._strings['b5216c9b4e0ac0afd9c76eb1d12ad1b9'] /* Select Section */,
1613 fieldLabel : _this._strings['f3912172e6bf57f8979782f4a2342233'] /* Appears in Block */,
1614 forceSelection : true,
1615 hiddenName : 'element_id',
1617 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1619 name : 'element_id_name',
1621 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
1622 selectOnFocus : true,
1623 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b></div>',
1624 triggerAction : 'all',
1629 '|xns' : 'Roo.form',
1633 sortInfo : { field: 'name', direction: 'ASC' },
1635 beforeload : function (_self, options)
1637 var par = _this.form.findField('parent_id').getValue() * 1;
1639 Roo.MessageBox.alert("Error", "Select on what parent page it appears");
1643 options.params._cms_page_id = par;
1647 '|xns' : 'Roo.data',
1649 xtype : 'HttpProxy',
1651 url : baseURL + '/Roo/Cms_template_element',
1656 xtype : 'JsonReader',
1658 { name: 'id', type: 'int' }, {name: 'template', type: 'string'}
1662 totalProperty : 'total',
1672 displayField : 'page_link',
1674 emptyText : _this._strings['99e7707748ae048e17c5810fad119e0b'] /* Select Page */,
1675 fieldLabel : _this._strings['8adedb6a6226807ba810215dd3b3c61b'] /* Menu links to Page */,
1676 forceSelection : true,
1677 hiddenName : 'menu_page_id',
1679 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1681 name : 'menu_page_id_page_link',
1683 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
1684 selectOnFocus : true,
1685 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>',
1686 triggerAction : 'all',
1691 '|xns' : 'Roo.form',
1695 sortInfo : { field: 'title', direction: 'ASC' },
1697 beforeload : function (_self, options)
1699 options.params = options.params || {};
1701 options.params['search[page_link_no_empty]'] =1;
1703 options.params['page_type_id_name[0]'] = 'page';
1704 options.params['page_type_id_name[1]'] = 'blog';
1706 options.params.is_element = 0;
1707 options.params.is_menuitem = 0;
1712 '|xns' : 'Roo.data',
1714 xtype : 'HttpProxy',
1716 url : baseURL + '/Roo/cms_page.php',
1721 xtype : 'JsonReader',
1736 "name":"page_type_id_display_name",
1742 totalProperty : 'total',
1749 xtype : 'ComboBoxArray',
1750 fieldLabel : _this._strings['cc6892c9705afcfa61c53698756ba51b'] /* Page Class */,
1751 hiddenName : 'page_cls',
1752 name : 'page_cls_name',
1755 '|xns' : 'Roo.form',
1760 displayField : 'display_name',
1762 emptyText : _this._strings['14c21301c0faf9d5561b8a580be21a13'] /* Select class */,
1763 fieldLabel : _this._strings['cc6892c9705afcfa61c53698756ba51b'] /* Page Class */,
1764 forceSelection : true,
1767 queryParam : 'query[search]',
1768 selectOnFocus : true,
1769 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>',
1770 triggerAction : 'all',
1771 valueField : 'name',
1774 '|xns' : 'Roo.form',
1778 sortInfo : { direction : 'ASC', field: 'seqid' },
1780 beforeload : function (_self, o){
1781 o.params = o.params || {};
1783 o.params.etype = 'cms_page_class';
1787 '|xns' : 'Roo.data',
1789 xtype : 'HttpProxy',
1791 url : baseURL + '/Roo/core_enum.php',
1796 xtype : 'JsonReader',
1798 {"name":"id","type":"int"},
1799 {"name":"name","type":"string"},
1800 {"name":"display_name","type":"string"}
1804 totalProperty : 'total',
1818 '|xns' : 'Roo.form',
1824 legend : _this._strings['8a53accfc94c2500b00575ce0e0d786f'] /* Primary Image */,
1825 style : 'width: 165px;',
1827 '|xns' : 'Roo.form',
1830 xtype : 'DisplayField',
1832 icon : 'rootURL + \'images/default/dd/drop-add.gif\'',
1833 name : 'primary_image_id',
1834 style : 'border: 1px solid #ccc;',
1835 valueRenderer : function(v) {
1837 if (!v || v * 1 < 1) {
1838 return '<div style="width: 150px; height: 150px; background-color: grey;" title="Using zero order image"> </div>';
1841 return String.format('<img src="{0}/Images/Thumb/150/{1}" width="150" title="Using zero order image">', baseURL, v);
1854 render : function (_self)
1856 _this.interestsCol = _self;
1860 '|xns' : 'Roo.form',
1863 xtype : 'ComboBoxArray',
1864 fieldLabel : _this._strings['c70952e4ab3806c049737cd7d2b8896b'] /* Interests */,
1865 hiddenName : 'interest',
1866 name : 'interest_name',
1869 render : function (_self)
1871 _this.interests = _self;
1873 _self.combo.addicon.setStyle( {
1874 position : 'absolute',
1883 '|xns' : 'Roo.form',
1888 displayField : 'display_name',
1890 emptyText : _this._strings['30d1a216420426fcbd43ca70acd4aa48'] /* Select interests */,
1891 fieldLabel : _this._strings['c70952e4ab3806c049737cd7d2b8896b'] /* Interests */,
1892 forceSelection : true,
1895 queryParam : 'query[name]',
1896 selectOnFocus : true,
1897 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>',
1898 triggerAction : 'all',
1902 '|xns' : 'Roo.form',
1906 sortInfo : { direction : 'ASC', field: 'name' },
1908 beforeload : function (_self, o){
1909 o.params = o.params || {};
1910 o.params.etype = 'crm_interest';
1914 '|xns' : 'Roo.data',
1916 xtype : 'HttpProxy',
1918 url : baseURL + '/Roo/Core_enum.php',
1923 xtype : 'JsonReader',
1925 {"name":"id","type":"int"},
1926 {"name":"name","type":"string"},
1927 {"name":"display_name","type":"string"}
1931 totalProperty : 'total',
1948 name : 'is_system_page',
1954 name : 'is_menuitem',
1960 name : 'page_type_id_name',
1967 render : function (_self)
1969 _this.user_defined_fields = _self;
1980 xtype : 'ContentPanel',
1982 fitContainer : true,
1985 title : _this._strings['c1df1da7a1ce305a3b60af9d5733ac1d'] /* Contents */,
1994 url : baseURL + '/Roo/cms_page.php',
1996 rendered : function (form)
2002 '|xns' : 'Roo.form',
2008 '|xns' : 'Roo.form',
2011 xtype : 'HtmlEditor',
2012 autosave : function() {
2014 var body = _this.form1.findField('body');
2016 if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){
2017 Roo.log('body not dirty');
2021 Roo.log('body dirty, auto save!');
2023 body.fireEvent('autosave', body);
2027 fieldLabel : _this._strings['c1df1da7a1ce305a3b60af9d5733ac1d'] /* Contents */,
2031 white : [ 'iframe' ],
2034 autosave : function (_self)
2036 Roo.log('autosave');
2038 var id = _this.form.findField('id').getValue() * 1;
2040 if(!_self.editorcore.sourceEditMode){
2047 url : baseURL + '/Roo/Events.php',
2051 action : 'AUTOSAVE',
2052 on_id : (id > 0) ? id : 0,
2053 on_table : 'cms_page',
2055 source: _self.getValue()
2057 success : function() {
2058 _self.originalValue = _self.getValue();
2061 failure : function()
2063 //Roo.MessageBox.alert("Error", "autosave failed");
2064 Roo.log('body autosave failed?!');
2069 savedpreview : function (_self)
2071 Roo.log('saved preview');
2073 var id = _this.form.findField('id').getValue() * 1;
2075 var successFn = function(res){
2076 return res.data.POST.source;
2080 action : 'AUTOSAVE',
2082 on_id : (id < 1) ? 0 : id,
2083 on_table : 'cms_page',
2084 successFn : successFn
2088 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
2089 _self.setValue(res);
2090 _self.originalValue = res;
2093 stylesheetsclick : function (_self)
2095 Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){
2096 _this.dialog.setStylesheets();
2102 '|xns' : 'Roo.form',
2105 xtype : 'ToolbarStandard',
2106 xns : Roo.form.HtmlEditor,
2107 '|xns' : 'Roo.form.HtmlEditor',
2112 displayField : 'name',
2114 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
2115 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
2116 forceSelection : true,
2118 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
2121 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
2122 queryParam : 'search',
2123 selectOnFocus : true,
2124 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>',
2125 triggerAction : 'all',
2130 beforequery : function (combo, query, forceAll, cancel, e)
2133 var id = _this.form.findField('id').getValue() * 1;
2135 Roo.MessageBox.alert("Error", "Save Document First before adding images");
2139 render : function (_self)
2141 _this.bodyimgselect = _self;
2143 select : function (combo, record, index)
2150 var editor = _this.form.findField('body').editorcore;
2152 var curnode = editor.getSelectedNode();
2154 if (curnode && curnode.tagName == 'IMG') {
2155 curnode.src= String.format('{0}/Images/{1}/{2}#attachment-{1}',
2156 baseURL, record.data.id, record.data.filename
2158 // note -forces an update... hopefully...
2159 editor.owner.fireEvent('editorevent', editor, false);
2162 editor.insertAtCursor(
2163 String.format('<img src="{0}/Images/{1}/{2}#attachment-{1}">',
2164 baseURL, record.data.id, record.data.filename
2173 '|xns' : 'Roo.form',
2177 sortInfo : { direction : 'ASC', field: 'id' },
2179 beforeload : function (_self, o){
2180 o.params = o.params || {};
2182 var id = _this.form.findField('id').getValue() * 1;
2184 Roo.MessageBox.alert("Error", "Save press release first");
2188 o.params.ontable = 'cms_page';
2189 // o.params.imgtype = 'PressRelease';
2190 //o.params['query[imagesize]'] = '150x150';
2195 '|xns' : 'Roo.data',
2197 xtype : 'HttpProxy',
2199 url : baseURL + '/Roo/Images.php',
2204 xtype : 'JsonReader',
2205 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
2208 totalProperty : 'total',
2217 displayField : 'page_link',
2219 emptyText : _this._strings['580b21aac58f1b73cece26e272cdfbee'] /* Add Link */,
2220 forceSelection : true,
2221 hiddenName : 'add_link_id',
2223 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
2227 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
2228 selectOnFocus : true,
2229 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>',
2230 triggerAction : 'all',
2235 select : function (combo, record, index)
2241 var editor = _this.form.findField('body');
2242 editor.editorcore.insertAtCursor(
2243 String.format('<a href="#page-{0}">{1}</a>',
2244 record.data.page_link, record.data.title
2252 '|xns' : 'Roo.form',
2256 sortInfo : { field: 'page_link', direction: 'ASC' },
2258 beforeload : function (_self, options)
2260 options.params['search[page_link_no_empty]'] =1;
2262 options.params.is_element = 0;
2263 options.params.is_menuitem = _this.form.findField('is_menuitem').getValue() * 1;
2268 '|xns' : 'Roo.data',
2270 xtype : 'HttpProxy',
2272 url : baseURL + '/Roo/cms_page.php',
2277 xtype : 'JsonReader',
2279 { name: 'id', type: 'int' },
2285 totalProperty : 'total',
2292 xtype : 'Separator',
2294 '|xns' : 'Roo.Toolbar'
2298 cls : 'x-init-enable',
2299 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
2301 click : function (_self, e)
2303 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
2307 '|xns' : 'Roo.Toolbar'
2312 xtype : 'ToolbarContext',
2313 xns : Roo.form.HtmlEditor,
2314 '|xns' : 'Roo.form.HtmlEditor'
2325 xtype : 'ContentPanel',
2327 fitContainer : true,
2330 title : _this._strings['76eb64a1725ee953c664e15c9213b2fd'] /* Extended Content */,
2339 url : baseURL + '/Roo/cms_page.php',
2341 rendered : function (form)
2347 '|xns' : 'Roo.form',
2353 '|xns' : 'Roo.form',
2356 xtype : 'HtmlEditor',
2357 autosave : function() {
2359 var extended = _this.form2.findField('extended');
2361 if(!extended.wrap.isVisible(true) || extended.getValue() == '' || !extended.isDirty()){
2362 Roo.log('extend not dirty');
2367 Roo.log('extend dirty, auto save!');
2369 extended.fireEvent('autosave', extended);
2371 fieldLabel : _this._strings['57e195426892c5515935f21d97228814'] /* Extended Contents */,
2375 white : [ 'iframe' ],
2378 autosave : function (_self)
2380 var id = _this.form.findField('id').getValue() * 1;
2383 if(!_self.editorcore.sourceEditMode){
2390 url : baseURL + '/Roo/Events.php',
2394 action : 'AUTOSAVE',
2395 on_id : (id > 0) ? id : 0,
2396 on_table : 'cms_page',
2397 remarks : 'EXTENDED',
2398 source: _self.getValue()
2400 success : function() {
2401 _self.originalValue = _self.getValue();
2404 failure : function()
2406 //Roo.MessageBox.alert("Error", "autosave failed");
2407 Roo.log('extended autosave failed?!');
2411 savedpreview : function (_self)
2413 var id = _this.form.findField('id').getValue() * 1;
2415 var successFn = function(res){
2416 return res.data.POST.source;
2420 action : 'AUTOSAVE',
2421 remarks : 'EXTENDED',
2422 on_id : (id < 1) ? 0 : id,
2423 on_table : 'cms_page',
2424 successFn : successFn
2428 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
2429 _self.setValue(res);
2430 _self.originalValue = res;
2433 stylesheetsclick : function (_self)
2435 Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){
2436 _this.dialog.setStylesheets();
2442 '|xns' : 'Roo.form',
2445 xtype : 'ToolbarStandard',
2446 xns : Roo.form.HtmlEditor,
2447 '|xns' : 'Roo.form.HtmlEditor',
2452 displayField : 'name',
2454 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
2455 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
2456 forceSelection : true,
2458 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
2461 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
2462 selectOnFocus : true,
2463 tpl : '<div class=\"x-grid-cell-text x-btn button\"><img src=\"{url_thumb}\" height=\"150\" width=\"150\"><b>{filename}</b> </div>',
2464 triggerAction : 'all',
2469 beforequery : function (combo, query, forceAll, cancel, e)
2472 var id = _this.form.findField('id').getValue() * 1;
2474 Roo.MessageBox.alert("Error", "Save Document First before adding images");
2478 render : function (_self)
2480 _this.extendimgselect = _self;
2482 select : function (combo, record, index)
2489 var editor = _this.form.findField('extended').editorcore;
2491 var curnode = editor.getSelectedNode();
2493 if (curnode && curnode.tagName == 'IMG') {
2494 curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',
2495 baseURL, record.data.id, record.data.filename
2497 // note -forces an update... hopefully...
2498 editor.owner.fireEvent('editorevent', editor, false);
2501 editor.insertAtCursor(
2502 String.format('<img src="{0}/Images/{1}/{2}#image-{1}">',
2503 baseURL, record.data.id, record.data.filename
2512 '|xns' : 'Roo.form',
2516 sortInfo : { direction : 'ASC', field: 'id' },
2518 beforeload : function (_self, o){
2519 o.params = o.params || {};
2521 var id = _this.form.findField('id').getValue() * 1;
2523 Roo.MessageBox.alert("Error", "Save press release first");
2527 o.params.ontable = 'cms_page';
2528 // o.params.imgtype = 'PressRelease';
2529 //o.params['query[imagesize]'] = '150x150';
2534 '|xns' : 'Roo.data',
2536 xtype : 'HttpProxy',
2538 url : baseURL + '/Roo/Images.php',
2543 xtype : 'JsonReader',
2544 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
2547 totalProperty : 'total',
2556 displayField : 'page_link',
2558 emptyText : _this._strings['580b21aac58f1b73cece26e272cdfbee'] /* Add Link */,
2559 forceSelection : true,
2560 hiddenName : 'add_link_id',
2562 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
2566 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
2567 selectOnFocus : true,
2568 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>',
2569 triggerAction : 'all',
2574 select : function (combo, record, index)
2580 var editor = _this.form.findField('body');
2581 editor.editorcore.insertAtCursor(
2582 String.format('<a href="#page-{0}">{1}</a>',
2583 record.data.page_link, record.data.title
2591 '|xns' : 'Roo.form',
2595 sortInfo : { field: 'page_link', direction: 'ASC' },
2597 beforeload : function (_self, options)
2599 options.params['search[page_link_no_empty]'] =1;
2601 options.params.is_element = 0;
2602 options.params.is_menuitem = _this.form.findField('is_menuitem').getValue() * 1;
2607 '|xns' : 'Roo.data',
2609 xtype : 'HttpProxy',
2611 url : baseURL + '/Roo/cms_page.php',
2616 xtype : 'JsonReader',
2618 { name: 'id', type: 'int' },
2624 totalProperty : 'total',
2631 xtype : 'Separator',
2633 '|xns' : 'Roo.Toolbar'
2637 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
2639 click : function (_self, e)
2641 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
2645 '|xns' : 'Roo.Toolbar'
2650 xtype : 'ToolbarContext',
2651 styles : typeof(uiConfig) != 'undefined' ? (uiConfig['Roo.form.HtmlEditor.ToolbarContext.styles'] || {}) : {},
2652 xns : Roo.form.HtmlEditor,
2653 '|xns' : 'Roo.form.HtmlEditor'
2664 xtype : 'ContentPanel',
2666 fitContainer : true,
2669 title : _this._strings['d8e4d1f5e445107e505b2cf63a1fb65c'] /* Extra CSS */,
2678 url : baseURL + '/Roo/cms_page.php',
2680 rendered : function (form)
2686 '|xns' : 'Roo.form',
2692 '|xns' : 'Roo.form',
2696 fieldLabel : _this._strings['39f64cc9436cacfbceda3b7bdeb8e24c'] /* Styles (CSS) */,
2710 xtype : 'ContentPanel',
2712 fitContainer : true,
2715 title : _this._strings['98e93e8f7adfe14832db6caed713d849'] /* Meta Tags */,
2724 url : baseURL + '/Roo/cms_page.php',
2726 rendered : function (form)
2732 '|xns' : 'Roo.form',
2737 '|xns' : 'Roo.form',
2741 fieldLabel : _this._strings['867343577fa1f33caa632a19543bd252'] /* Keywords */,
2750 fieldLabel : _this._strings['8bc84316c4078bf66723fd019616d920'] /* Descriptions */,
2752 name : 'descriptions',
2767 xtype : 'GridPanel',
2769 fitContainer : true,
2772 tableName : 'Images',
2773 title : _this._strings['308f2757bfc9ce92fb00ff93fdffd279'] /* Images / Attachments */,
2775 activate : function() {
2778 _this.grid.footer.onClick('first');
2785 xtype : 'EditorGrid',
2786 autoExpandColumn : 'title',
2790 render : function() {
2792 //_this.dialog = Pman.Dialog.FILL_IN
2793 if (_this.panel.active) {
2794 //this.footer.onClick('first');
2797 rowdblclick : function (_self, rowIndex, e)
2799 var rd = _this.grid.getDataSource().getAt(rowIndex);
2800 var id = rd.data.id;
2801 var url = String.format('{0}/Images/{1}/{2}', baseURL, rd.data.id, rd.data.filename);
2802 _this.form.findField('contents').execCmd('insertimage', url);
2807 '|xns' : 'Roo.grid',
2815 cls : 'x-btn-text-icon',
2816 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
2817 text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
2821 var id = _this.form.findField('id').getValue() * 1;
2827 Pman.Dialog.Image.show( { id : 0, onid : id, ontable: 'cms_page' }, function() {
2828 _this.grid.ds.load({});
2838 cls : 'x-btn-text-icon',
2839 icon : rootURL + '/Pman/templates/images/trash.gif',
2840 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
2844 var selection = _this.grid.getSelectionModel().getSelectedCell();
2845 var sn = _this.grid.ds.getAt(selection[0]);
2846 if (!sn || isNaN(sn.id *1)) {
2847 Roo.MessageBox.alert("Error", "Select a image");
2850 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
2856 url : baseURL + '/Roo/Images.php',
2861 success : function()
2863 Roo.log('Got Success!!');
2864 _this.grid.ds.load({});
2878 beforeload : function (_self, o)
2880 var id = _this.form.findField('id').getValue() * 1;
2886 o.params = o.params || {};
2887 o.params.limit = 9999;
2889 o.params.ontable = 'cms_page';
2891 update : function (_self, rec, operation)
2895 url : baseURL+'/Roo/Images.php',
2898 success: function(res)
2900 Roo.log("GOT success");
2901 // update the data...
2902 _this.grid.ds.load({});
2904 failure : function(res)
2906 Roo.MessageBox.alert('Error', res.errorMsg);
2907 _this.grid.ds.load({});
2915 '|xns' : 'Roo.data',
2917 xtype : 'HttpProxy',
2919 url : baseURL + '/Roo/Images.php',
2924 xtype : 'JsonReader',
2959 'name': 'displayorder',
2967 'name': 'parent_image_id',
2973 'dateFormat': 'Y-m-d'
2992 'name': 'parent_image_id_id',
2996 'name': 'parent_image_id_filename',
3000 'name': 'parent_image_id_ontable',
3004 'name': 'parent_image_id_onid',
3008 'name': 'parent_image_id_mimetype',
3012 'name': 'parent_image_id_width',
3016 'name': 'parent_image_id_height',
3020 'name': 'parent_image_id_filesize',
3024 'name': 'parent_image_id_displayorder',
3028 'name': 'parent_image_id_language',
3032 'name': 'parent_image_id_parent_image_id',
3036 'name': 'parent_image_id_created',
3040 'name': 'parent_image_id_imgtype',
3044 'name': 'parent_image_id_linkurl',
3048 'name': 'parent_image_id_descript',
3052 'name': 'parent_image_id_title',
3058 totalProperty : 'total',
3065 xtype : 'ColumnModel',
3067 header : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /* */,
3068 renderer : function(v,x,r) {
3069 return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.filename);
3077 xtype : 'ColumnModel',
3078 dataIndex : 'filename',
3079 header : _this._strings['1351017ac6423911223bc19a8cb7c653'] /* Filename */,
3080 renderer : function(v) { return String.format('{0}', v); },
3086 xtype : 'ColumnModel',
3087 dataIndex : 'displayorder',
3088 header : _this._strings['a240fa27925a635b08dc28c9e4f9216d'] /* Order */,
3089 renderer : function(v) { return String.format('{0}', v); },
3092 '|xns' : 'Roo.grid',
3094 xtype : 'GridEditor',
3096 '|xns' : 'Roo.grid',
3098 xtype : 'NumberField',
3099 decimalPrecision : 0,
3101 focus : function (_self)
3103 if (this.value == 0) {
3104 this.el.dom.value = '';
3114 xtype : 'ColumnModel',
3115 dataIndex : 'title',
3116 header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
3117 renderer : function(v) { return String.format('{0}', v); },
3120 '|xns' : 'Roo.grid',
3122 xtype : 'GridEditor',
3124 '|xns' : 'Roo.grid',
3126 xtype : 'TextField',
3133 xtype : 'ColumnModel',
3134 dataIndex : 'linkurl',
3135 header : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
3136 renderer : function(v)
3138 return String.format('{0}', (v) ? v : '');
3142 '|xns' : 'Roo.grid',
3144 xtype : 'GridEditor',
3146 '|xns' : 'Roo.grid',
3148 xtype : 'TextField',
3158 xtype : 'NestedLayoutPanel',
3160 fitContainer : true,
3164 render : function (_self)
3166 _this.westLayoutPanel = this;
3173 xtype : 'BorderLayout',
3177 xtype : 'LayoutRegion',
3178 tabPosition : 'top',
3183 xtype : 'LayoutRegion',
3186 tabPosition : 'top',
3192 xtype : 'ContentPanel',
3197 render : function (_self)
3199 _this.trpanel = _self;
3201 resize : function (_self, width, height)
3203 Roo.log('resize called');
3205 var ew = Math.max(250, width - 10);
3206 var eh = _this.westLayoutPanel.getLayout().getRegion('south').el.getHeight() - 30;
3209 if (!_this.trform) {
3213 var bd = _this.trform1.findField('body');
3218 // since render delays resize..
3219 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
3220 // _this.trbodycol.el.setWidth(bd.width+20);
3222 var bd = _this.trform2.findField('extended');
3226 // since render delays resize..
3227 bd.resizeEl.resizeTo.defer(110, bd.resizeEl,[ bd.width, bd.height ] );
3228 // _this.trextendcol.el.setWidth(bd.width+20);
3238 labelAlign : 'right',
3241 showHide : function() {
3243 // var in_rss= _this.form.findField('in_rss').getValue() * 1;
3244 var has_extended = _this.form.findField('has_extended').getValue() * 1;
3245 var has_lang = _this.trform.findField('language').getValue().length;
3247 _this.westLayoutPanel.getLayout().getRegion('south').show();
3248 _this.westLayoutPanel.getLayout().getRegion('south').unhidePanel(0);
3249 _this.westLayoutPanel.getLayout().getRegion('south').unhidePanel(1);
3250 _this.westLayoutPanel.getLayout().getRegion('south').unhidePanel(2);
3253 _this.westLayoutPanel.getLayout().getRegion('south').hide();
3256 if(!has_extended && has_lang){
3257 _this.westLayoutPanel.getLayout().getRegion('south').hidePanel(1);
3258 _this.westLayoutPanel.getLayout().getRegion('south').showPanel(0);
3266 var el = _this.trform.findField(k);
3267 el.actionMode = 'fieldEl';
3269 Roo.log("show: " + k);
3272 Roo.log("hide: " + k);
3277 _this.updateRow.el[has_lang ? 'show' : 'hide']();
3280 if(typeof(_this.trform.editors) == 'undefined'){
3281 _this.trform.editors = {
3282 body : _this.trform1.findField('body').wrap.isVisible(),
3283 extended : _this.trform2.findField('extended').wrap.isVisible()
3285 if(_this.trform.editors.body){
3286 setInterval(_this.trform1.findField('body').autosave, 60000);
3289 if(_this.trform.editors.extended){
3290 setInterval(_this.trform2.findField('extended').autosave, 60000);
3294 if(!_this.trform.editors.body && _this.trform1.findField('body').wrap.isVisible()){
3295 setInterval(_this.trform1.findField('body').autosave, 60000);
3296 _this.trform.editors.body = true;
3299 if(!_this.trform.editors.extended && _this.trform2.findField('extended').wrap.isVisible()){
3300 setInterval(_this.trform2.findField('extended').autosave, 60000);
3301 _this.trform.editors.extended = true;
3306 style : 'margin: 5px',
3307 trackResetOnLoad : true,
3308 url : baseURL + '/Roo/cms_page.php',
3310 actioncomplete : function (_self, action)
3312 if (action.type =='submit') {
3316 if (action.type == 'setdata') {
3317 _this.trform.addForm(_this.trform1);
3318 _this.trform.addForm(_this.trform2);
3319 _this.trform.addForm(_this.trform3);
3321 if ( _this.data.id) {
3323 this.load({ method: 'GET', params: { '_id' : _this.data.id }});
3325 this.trpanel.el.mask("save first");
3332 if (action.type == 'load') {
3333 // _this.dialog.el.unmask();
3336 _this.trform1.findField('body').originalValue = _this.trform1.findField('body').getValue();
3337 _this.trform2.findField('extended').originalValue = _this.trform2.findField('extended').getValue();
3338 _this.trform3.findField('keywords').originalValue = _this.trform3.findField('keywords').getValue();
3339 _this.trform3.findField('descriptions').originalValue = _this.trform3.findField('descriptions').getValue();
3344 actionfailed : function (_self, action)
3346 _this.dialog.el.unmask();
3348 Pman.standardActionFailed(_self, action);
3350 rendered : function (_self)
3352 _this.trform = _self;
3356 '|xns' : 'Roo.form',
3363 '|xns' : 'Roo.form',
3370 '|xns' : 'Roo.form',
3375 displayField : 'language_name',
3377 emptyText : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
3378 fieldLabel : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
3379 forceSelection : true,
3380 hiddenName : 'language',
3382 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3384 name : 'language_name',
3386 qtip : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
3387 selectOnFocus : true,
3388 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{language_name}</b> </div>',
3389 triggerAction : 'all',
3391 valueField : 'language',
3393 add : function (combo)
3395 Pman.Dialog.CmsLanguagePick.show({_with_name : true}, function( res) {
3398 _this.trform.reset();
3399 _this.trform1.reset();
3400 _this.trform2.reset();
3402 combo.setValue(res.lang);
3403 combo.el.dom.value = res.lang_name;
3406 _this.trform.showHide();
3407 _this.trpanel.fireEvent('resize', _this.trpanel, [ _this.trpanel.el.getWidth(), _this.trpanel.el.getHeight() ] );
3412 render : function (_self)
3414 _this.language = _self;
3416 select : function (combo, record, index)
3419 _this.trform.showHide();
3420 _this.trpanel.fireEvent('resize', _this.trpanel, [ _this.trpanel.el.getWidth(), _this.trpanel.el.getHeight() ] );
3427 'lookup[language]' : record.data.language,
3428 'lookup[translation_of_id]' : _this.data.id,
3435 '|xns' : 'Roo.form',
3439 sortInfo : { direction : 'ASC', field: 'language' },
3441 beforeload : function (_self, o){
3442 o.params = o.params || {};
3444 o.params._distinct = 'language';
3445 o.params._columns ='language_name,language';
3446 o.params._with_name = true;
3448 if(_this.form.findField('id').getValue()*1 > 0){
3449 o.params.translation_of_id = _this.form.findField('id').getValue();
3455 '|xns' : 'Roo.data',
3457 xtype : 'HttpProxy',
3459 url : baseURL + '/Roo/Cms_page.php',
3464 xtype : 'JsonReader',
3465 fields : [{"name":"language","type":"string"}],
3468 totalProperty : 'total',
3476 style : 'padding-top:12px;padding-left:30px;float:left',
3479 render : function (_self)
3481 _this.updateRow = _self;
3485 '|xns' : 'Roo.form',
3489 text : _this._strings['06933067aafd48425d67bcb01bba5cb6'] /* Update */,
3493 // _this.dialog.el.mask("Saving");
3494 if(!_this.trform1.findField('body').editorcore.sourceEditMode){
3495 _this.trform1.findField('body').syncValue();
3496 _this.trform2.findField('extended').syncValue();
3498 _this.trform1.findField('body').pushValue();
3499 _this.trform2.findField('extended').pushValue();
3502 _this.trform.findField('parent_id').setValue(_this.form.findField('parent_id').getValue());
3503 _this.trform.findField('element_id').setValue(_this.form.findField('element_id').getValue());
3504 _this.trform.findField('translation_of_id').setValue(_this.form.findField('id').getValue());
3505 _this.trform.findField('is_menuitem').setValue(_this.form.findField('is_menuitem').getValue());
3506 _this.trform.findField('menu_page_id').setValue(_this.form.findField('menu_page_id').getValue());
3508 if(_this.trform.findField('element_id').getValue()*1 > 0){
3509 _this.trform.findField('is_element').setValue(1);
3512 _this.trform.doAction("submit");
3523 xtype : 'TextField',
3524 fieldLabel : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
3540 name : 'element_id',
3546 name : 'menu_page_id',
3552 name : 'is_menuitem',
3558 name : 'is_element',
3565 name : 'translation_of_id',
3580 xtype : 'ContentPanel',
3582 fitContainer : true,
3585 title : _this._strings['c1df1da7a1ce305a3b60af9d5733ac1d'] /* Contents */,
3594 url : baseURL + '/Roo/cms_page.php',
3596 rendered : function (form)
3598 _this.trform1 = form;
3602 '|xns' : 'Roo.form',
3608 '|xns' : 'Roo.form',
3611 xtype : 'HtmlEditor',
3612 autosave : function() {
3614 var body = _this.trform1.findField('body');
3616 if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){
3617 Roo.log('tr body not dirty');
3621 Roo.log('tr body dirty, auto save!');
3623 body.fireEvent('autosave', body);
3625 fieldLabel : _this._strings['c1df1da7a1ce305a3b60af9d5733ac1d'] /* Contents */,
3629 white : [ 'iframe' ],
3631 autosave : function (_self)
3633 var id = _this.trform.findField('id').getValue() * 1;
3636 if(!_self.editorcore.sourceEditMode){
3643 url : baseURL + '/Roo/Events.php',
3647 action : 'AUTOSAVE',
3648 on_id : (id > 0) ? id : 0,
3649 on_table : 'cms_page',
3651 source: _self.getValue()
3653 success : function() {
3654 _self.originalValue = _self.getValue();
3657 failure : function()
3659 //Roo.MessageBox.alert("Error", "autosave failed");
3660 Roo.log('tr body autosave failed?!');
3664 savedpreview : function (_self)
3666 var id = _this.trform.findField('id').getValue() * 1;
3668 var successFn = function(res){
3669 return res.data.POST.source;
3673 action : 'AUTOSAVE',
3675 on_id : (id < 1) ? 0 : id,
3676 on_table : 'cms_page',
3677 successFn : successFn
3681 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
3682 _self.setValue(res);
3683 _self.originalValue = res;
3686 stylesheetsclick : function (_self)
3688 Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){
3689 _this.dialog.setStylesheets();
3695 '|xns' : 'Roo.form',
3698 xtype : 'ToolbarStandard',
3699 xns : Roo.form.HtmlEditor,
3700 '|xns' : 'Roo.form.HtmlEditor',
3705 displayField : 'name',
3707 emptyText : _this._strings['b9c49611cfda3259a2b837b39489e650'] /* Add Image */,
3708 fieldLabel : _this._strings['fff0d600f8a0b5e19e88bfb821dd1157'] /* Images */,
3709 forceSelection : true,
3711 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3714 qtip : _this._strings['2f26e35d61be90501e099089dc533638'] /* Select Images */,
3715 selectOnFocus : true,
3716 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>',
3717 triggerAction : 'all',
3722 beforequery : function (combo, query, forceAll, cancel, e)
3725 var id = _this.form.findField('id').getValue() * 1;
3727 Roo.MessageBox.alert("Error", "Save press release first");
3731 render : function (_self)
3733 _this.trbodyimgselect = _self;
3735 select : function (combo, record, index)
3742 var editor = _this.trform.findField('body').editorcore;
3744 var curnode = editor.getSelectedNode();
3746 if (curnode && curnode.tagName == 'IMG') {
3747 curnode.src= String.format('{0}/Images/{1}/{2}#attachment-{1}',
3748 baseURL, record.data.id, record.data.filename
3750 // note -forces an update... hopefully...
3751 editor.owner.fireEvent('editorevent', editor, false);
3754 editor.insertAtCursor(
3755 String.format('<img src="{0}/Images/{1}/{2}#attachment-{1}">',
3756 baseURL, record.data.id, record.data.filename
3765 '|xns' : 'Roo.form',
3769 sortInfo : { direction : 'ASC', field: 'id' },
3771 beforeload : function (_self, o){
3772 o.params = o.params || {};
3774 var id = _this.form.findField('id').getValue() * 1;
3776 Roo.MessageBox.alert("Error", "Save press release first");
3780 o.params.ontable = 'cms_page';
3781 // o.params.imgtype = 'PressRelease';
3782 //o.params['query[imagesize]'] = '150x150';
3787 '|xns' : 'Roo.data',
3789 xtype : 'HttpProxy',
3791 url : baseURL + '/Roo/Images.php',
3796 xtype : 'JsonReader',
3797 fields : [{"name":"id","type":"int"},{"name":"filename","type":"string"},{"name":"url_thumb","type":"string"}],
3800 totalProperty : 'total',
3809 displayField : 'page_link',
3811 emptyText : _this._strings['580b21aac58f1b73cece26e272cdfbee'] /* Add Link */,
3812 forceSelection : true,
3813 hiddenName : 'add_link_id',
3815 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
3819 qtip : _this._strings['76729937a5eb6b0fd88c42581161facd'] /* Select Category */,
3820 selectOnFocus : true,
3821 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> <i>{page_link}</i> </div>',
3822 triggerAction : 'all',
3827 select : function (combo, record, index)
3833 var editor = _this.form.findField('body');
3834 editor.insertAtCursor(
3835 String.format('<a href="#page-{0}">{1}</a>',
3836 record.data.page_link, record.data.title
3844 '|xns' : 'Roo.form',
3848 sortInfo : { field: 'page_link', direction: 'ASC' },
3850 beforeload : function (_self, options)
3852 options.params['search[page_link_no_empty]'] =1;
3854 options.params.is_element = 0;
3855 options.params.is_menuitem = _this.form.findField('is_menuitem').getValue() * 1;
3860 '|xns' : 'Roo.data',
3862 xtype : 'HttpProxy',
3864 url : baseURL + '/Roo/cms_page.php',
3869 xtype : 'JsonReader',
3871 { name: 'id', type: 'int' },
3877 totalProperty : 'total',
3884 xtype : 'Separator',
3886 '|xns' : 'Roo.Toolbar'
3890 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
3892 click : function (_self, e)
3894 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
3898 '|xns' : 'Roo.Toolbar'
3903 xtype : 'ToolbarContext',
3904 xns : Roo.form.HtmlEditor,
3905 '|xns' : 'Roo.form.HtmlEditor'
3916 xtype : 'ContentPanel',
3918 fitContainer : true,
3921 title : _this._strings['76eb64a1725ee953c664e15c9213b2fd'] /* Extended Content */,
3930 url : baseURL + '/Roo/cms_page.php',
3932 rendered : function (form)
3934 _this.trform2 = form;
3938 '|xns' : 'Roo.form',
3944 '|xns' : 'Roo.form',
3947 xtype : 'HtmlEditor',
3948 autosave : function() {
3950 var extended = _this.trform2.findField('extended');
3952 if(!extended.wrap.isVisible(true) || extended.getValue() == '' || !extended.isDirty()){
3953 Roo.log('tr extend not dirty');
3958 Roo.log('tr extend dirty, auto save!');
3960 extended.fireEvent('autosave', extended);
3964 fieldLabel : _this._strings['57e195426892c5515935f21d97228814'] /* Extended Contents */,
3968 white : [ 'iframe' ],
3970 autosave : function (_self)
3972 var id = _this.trform.findField('id').getValue() * 1;
3975 if(!_self.editorcore.sourceEditMode){
3983 url : baseURL + '/Roo/Events.php',
3987 action : 'AUTOSAVE',
3988 on_id : (id > 0) ? id : 0,
3989 on_table : 'cms_page',
3990 remarks : 'EXTENDED',
3991 source: _self.getValue()
3993 success : function() {
3994 _self.originalValue = _self.getValue();
3997 failure : function()
3999 //Roo.MessageBox.alert("Error", "autosave failed");
4000 Roo.log('tr extended autosave failed?!');
4004 savedpreview : function (_self)
4006 var id = _this.trform.findField('id').getValue() * 1;
4008 var successFn = function(res){
4009 return res.data.POST.source;
4013 action : 'AUTOSAVE',
4014 remarks : 'EXTENDED',
4015 on_id : (id < 1) ? 0 : id,
4016 on_table : 'cms_page',
4017 successFn : successFn
4021 Pman.Dialog.CoreAutoSavePreview.show(params, function(res){
4022 _self.setValue(res);
4023 _self.originalValue = res;
4026 stylesheetsclick : function (_self)
4028 Pman.Dialog.CmsApplyStyleSheets.show({}, function(res){
4029 _this.dialog.setStylesheets();
4035 '|xns' : 'Roo.form',
4038 xtype : 'ToolbarStandard',
4039 xns : Roo.form.HtmlEditor,
4040 '|xns' : 'Roo.form.HtmlEditor',
4043 xtype : 'Separator',
4045 '|xns' : 'Roo.Toolbar'
4049 text : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */,
4051 click : function (_self, e)
4053 this.scope.owner.fireEvent('savedpreview', this.scope.owner);
4057 '|xns' : 'Roo.Toolbar'
4062 xtype : 'ToolbarContext',
4063 styles : typeof(uiConfig) != 'undefined' ? (uiConfig['Roo.form.HtmlEditor.ToolbarContext.styles'] || {}) : {},
4064 xns : Roo.form.HtmlEditor,
4065 '|xns' : 'Roo.form.HtmlEditor'
4076 xtype : 'ContentPanel',
4078 fitContainer : true,
4081 title : _this._strings['98e93e8f7adfe14832db6caed713d849'] /* Meta Tags */,
4090 url : baseURL + '/Roo/cms_page.php',
4092 rendered : function (form)
4094 _this.trform3 = form;
4098 '|xns' : 'Roo.form',
4103 '|xns' : 'Roo.form',
4107 fieldLabel : _this._strings['867343577fa1f33caa632a19543bd252'] /* Keywords */,
4116 fieldLabel : _this._strings['8bc84316c4078bf66723fd019616d920'] /* Descriptions */,
4118 name : 'descriptions',