Uncommited changes synced
authorAlan Knowles <alan@roojs.com>
Thu, 24 Dec 2020 06:23:36 +0000 (14:23 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 24 Dec 2020 06:23:36 +0000 (14:23 +0800)
Pman.Dialog.CmsBlog.bjs
Pman.Tab.CmsTranslateTemplates.bjs
Pman.Tab.CmsTranslateTemplates.js
UpdateTemplates.php

index c88e98f..63694f5 100644 (file)
@@ -2,7 +2,7 @@
  "name" : "Pman.Dialog.CmsBlog",
  "parent" : "",
  "title" : "Cms -Edit Blog Entry",
- "path" : "/home/edward/gitlive/Pman.Cms/Pman.Dialog.CmsBlog.bjs",
+ "path" : "/home/alan/gitlive/Pman.Cms/Pman.Dialog.CmsBlog.bjs",
  "permname" : "",
  "modOrder" : "001",
  "strings" : {
           "render" : "function (_self)\n{\n  _this.cpanel = _self;\n}"
          },
          "autoScroll" : true,
-         "region" : "center",
          "fitToFrame" : true,
+         "region" : "center",
          "xtype" : "ContentPanel",
          "$ xns" : "Roo",
          "items" : [
             "|actioncomplete" : "function (_self, action)\n{\n\n   if (action.type == 'setdata') {\n\n        _this.form.addForm(_this.form1);\n        _this.form.addForm(_this.form2);\n        _this.form.addForm(_this.form3);\n        _this.form.addForm(_this.form4);\n        \n        _this.dialog.setStylesheets();\n        \n        _this.dialog.getLayout().getRegion('west').collapse();\n        _this.panel.region.collapse();\n        \n        _this.trpanel.el.mask('Save first');\n        _this.panel.el.mask('Save first');\n        \n        _this.loaded = false;\n        _this.interestsCol.hide();\n        \n        //_this.form.findField('category_page_id').fieldEl.select('label',true).first().dom.innerHTML = 'Category';\n        \n        if ( _this.data.id) {\n            _this.dialog.el.mask(\"Loading\");\n            this.load({ method: 'GET', params: { '_id' : _this.data.id, '_with_primary_image' : 1 }});\n        } else {\n\n            _this.loaded = true;\n            var is_draft = typeof(_this.data.is_draft) != 'undefined' ? _this.data.is_draft : 1;\n            this.findField('is_draft').setValue(is_draft);\n            _this.page_type.setValue(_this.data.page_type_id);\n            _this.page_type.el.dom.value = _this.data.page_type_id_display_name;\n            \n            if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf(\"Crm\") !== -1){\n                _this.interestsCol.show();\n            }\n            \n            _this.form.showHide();\n            \n            /*\n            var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()\n            catlabel.dom.innerHTML = 'Category';            \n            if(_this.data.page_type_id_name == 'category'){\n                catlabel.dom.innerHTML = 'Parent Category';\n            } \n            */\n            \n            /*\n            var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();\n            catlabel.dom.innerHTML = 'Parent page';\n            if(_this.data.page_type_id_name == 'category'){\n                catlabel.dom.innerHTML = 'Parent';\n            }\n            */\n            \n        }\n        \n        if(_this.data._is_copy){\n            _this.form.is_copy();\n        }\n        \n        return;\n    }\n    \n    if (action.type == 'load') {\n    \n        //_this.data = action.result.data;\n        \n        var d = action.result.data;\n        \n        _this.dialog.el.unmask();\n       _this.grid.getDataSource().load();\n       \n       _this.trform.reset();\n       _this.trform1.reset();\n       _this.trform2.reset();\n       _this.trform3.reset();\n       \n       _this.trform.addForm(_this.trform1);\n       _this.trform.addForm(_this.trform2);\n        \n       _this.form1.findField('body').originalValue = _this.form1.findField('body').getValue();\n       _this.form2.findField('extended').originalValue = _this.form2.findField('extended').getValue();\n       _this.form3.findField('extra_css').originalValue = _this.form3.findField('extra_css').getValue();\n       _this.form4.findField('keywords').originalValue = _this.form4.findField('keywords').getValue();\n       _this.form4.findField('descriptions').originalValue = _this.form4.findField('descriptions').getValue();\n       \n       /*\n        var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()\n        catlabel.dom.innerHTML = 'Category';            \n        \n        if(_this.data.page_type_id_name == 'category'){\n            catlabel.dom.innerHTML = 'Parent Category';\n        }\n        */\n        /*\n        var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();\n        catlabel.dom.innerHTML = 'Parent page';            \n        if(_this.data.page_type_id_name == 'category'){\n            catlabel.dom.innerHTML = 'Parent';\n        }\n        */\n        // better if this was not here... - not sure which project uses it?\n        \n        if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf(\"Crm\") !== -1){\n            _this.interestsCol.show();\n        }\n        \n        if(typeof(d['interests']) != 'undefined'){\n            _this.form.findField('interest').setValue(Roo.decode(d['interests']));\n        }\n        \n        if(typeof(d['categories']) != 'undefined'){\n            _this.form.findField('category').setValue(Roo.decode(d['categories']));\n        }\n        \n        if(typeof(d['page_classes']) != 'undefined'){\n            _this.form.findField('page_cls').setValue(Roo.decode(d['page_classes']));\n        }\n        \n        _this.trpanel.el.unmask();\n        _this.panel.el.unmask();\n        \n        // fix scrolling..\n        _this.cpanel.el.dom.scrollTop = 0;\n        \n        // fix messed up scroll.\n        _this.dialog.layout.el.dom.scrollTop = 0;\n        \n        return;\n    }\n    if (action.type =='submit') {\n       \n       _this.dialog.el.unmask();\n       \n       if(!_this.exit){\n            this.load({ method: 'GET', params: { '_id' : action.result.data.id }});\n            return;\n       }\n       \n       _this.dialog.hide();\n       \n\n        if (_this.callback) {\n           _this.callback.call(_this, action.result.data);\n        }\n        _this.form.reset();\n        return;\n    }\n}\n",
             "|rendered" : "function (_self)\n{\n    _this.form = _self;\n}\n"
            },
+           "labelAlign" : "right",
            "$ url" : "baseURL + '/Roo/cms_page.php'",
            "| function is_copy" : "function() \n{ \n    _this.form.setValues(_this.data);\n    \n    var d = _this.data;\n\n    _this.dialog.el.unmask();\n   _this.grid.getDataSource().load();\n   \n   _this.trform.reset();\n   _this.trform1.reset();\n   _this.trform2.reset();\n   \n   _this.form1.findField('body').originalValue = _this.form1.findField('body').getValue();\n   _this.form2.findField('extended').originalValue = _this.form2.findField('extended').getValue();\n   \n   /*\n    var catlabel= _this.form.findField('category_page_id').fieldEl.select('label',true).first()\n    catlabel.dom.innerHTML = 'Category';            \n    \n    if(_this.data.page_type_id_name == 'category'){\n        catlabel.dom.innerHTML = 'Parent Category';\n    }\n    */\n    /*\n    var catlabel= _this.form.findField('parent_id').fieldEl.select('label',true).first();\n    catlabel.dom.innerHTML = 'Parent page';            \n    if(_this.data.page_type_id_name == 'category'){\n        catlabel.dom.innerHTML = 'Parent';\n    }\n    */\n    // better if this was not here... - not sure which project uses it?\n    \n    if(_this.data.page_type_id_name == 'blog' && AppModules.indexOf(\"Crm\") !== -1){\n        _this.interestsCol.show();\n    }\n    \n    if(typeof(d['interests']) != 'undefined'){\n        _this.form.findField('interest').setValue(Roo.decode(d['interests']));\n    }\n    \n    if(typeof(d['categories']) != 'undefined'){\n        _this.form.findField('category').setValue(Roo.decode(d['categories']));\n    }\n    \n    if(typeof(d['page_classes']) != 'undefined'){\n        _this.form.findField('page_cls').setValue(Roo.decode(d['page_classes']));\n    }\n    \n    _this.trpanel.el.unmask();\n    _this.panel.el.unmask();\n    \n    // fix scrolling..\n    _this.cpanel.el.dom.scrollTop = 0;\n    \n    // fix messed up scroll.\n    _this.dialog.layout.el.dom.scrollTop = 0;\n    return;\n}",
-           "labelAlign" : "right",
            "method" : "POST",
            "style" : "margin: 5px",
            "xtype" : "Form",
                 },
                 {
                  "hideLabels" : true,
-                 "style" : "height:30px;overflow:hidden",
                  "xtype" : "Row",
+                 "style" : "height:30px;overflow:hidden",
                  "labelWidth" : 0,
                  "width" : 600,
                  "$ xns" : "Roo.form",
                      "items" : [
                       {
                        "$ url" : "baseURL + '/Roo/core_enum.php'",
-                       "method" : "GET",
                        "xtype" : "HttpProxy",
+                       "method" : "GET",
                        "$ xns" : "Roo.data",
                        "* prop" : "proxy"
                       },
                 },
                 {
                  "hideLabels" : true,
-                 "style" : "height:30px;overflow:hidden",
                  "xtype" : "Row",
+                 "style" : "height:30px;overflow:hidden",
                  "labelWidth" : 0,
                  "width" : 540,
                  "$ xns" : "Roo.form",
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/core_person'",
-                   "method" : "GET",
                    "xtype" : "HttpProxy",
+                   "method" : "GET",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
               },
               {
                "fieldLabel" : "Category",
-               "xtype" : "ComboBoxArray",
                "hiddenName" : "category",
+               "xtype" : "ComboBoxArray",
                "width" : 400,
                "$ xns" : "Roo.form",
                "name" : "category_name",
                "items" : [
                 {
+                 "Number pageSize" : 40,
                  "alwaysQuery" : true,
                  "listWidth" : 400,
-                 "Number pageSize" : 40,
                  "triggerAction" : "all",
                  "fieldLabel" : "Category",
                  "forceSelection" : true,
                    "items" : [
                     {
                      "$ url" : "baseURL + '/Roo/cms_page.php'",
-                     "method" : "GET",
                      "xtype" : "HttpProxy",
+                     "method" : "GET",
                      "$ xns" : "Roo.data",
                      "* prop" : "proxy"
                     },
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/cms_page.php'",
-                   "xtype" : "HttpProxy",
                    "method" : "GET",
+                   "xtype" : "HttpProxy",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
                "name" : "target_url"
               },
               {
+               "listWidth" : 400,
                "$ tpl" : "'<div class=\"x-grid-cell-text x-btn button\"><b>{template_clean}</b></div>'\n",
                "alwaysQuery" : true,
-               "listWidth" : 400,
                "triggerAction" : "all",
                "fieldLabel" : "Layout",
                "forceSelection" : true,
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/Cms_template'",
-                   "xtype" : "HttpProxy",
                    "method" : "GET",
+                   "xtype" : "HttpProxy",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/Cms_template_element'",
-                   "xtype" : "HttpProxy",
                    "method" : "GET",
+                   "xtype" : "HttpProxy",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/cms_page.php'",
-                   "xtype" : "HttpProxy",
                    "method" : "GET",
+                   "xtype" : "HttpProxy",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
               },
               {
                "fieldLabel" : "Page Class",
-               "hiddenName" : "page_cls",
                "xtype" : "ComboBoxArray",
+               "hiddenName" : "page_cls",
                "width" : 400,
                "$ xns" : "Roo.form",
                "name" : "page_cls_name",
                    "items" : [
                     {
                      "$ url" : "baseURL + '/Roo/core_enum.php'",
-                     "xtype" : "HttpProxy",
                      "method" : "GET",
+                     "xtype" : "HttpProxy",
                      "$ xns" : "Roo.data",
                      "* prop" : "proxy"
                     },
                 "render" : "function (_self)\n{\n    _this.interests = _self;\n    /*\n    _self.combo.addicon.setStyle( {\n        position : 'absolute',\n        right: '9px',\n        top : '2px',\n        float : 'left'\n    });\n    */\n}"
                },
                "fieldLabel" : "Interests",
-               "hiddenName" : "interest",
                "xtype" : "ComboBoxArray",
+               "hiddenName" : "interest",
                "width" : 300,
                "$ xns" : "Roo.form",
                "name" : "interest_name",
                    "items" : [
                     {
                      "$ url" : "baseURL + '/Roo/Core_enum.php'",
-                     "xtype" : "HttpProxy",
                      "method" : "GET",
+                     "xtype" : "HttpProxy",
                      "$ xns" : "Roo.data",
                      "* prop" : "proxy"
                     },
             "rendered" : "function (form)\n{\n    _this.form1 = form;\n}"
            },
            "$ url" : "baseURL + '/Roo/cms_page.php'",
-           "xtype" : "Form",
            "method" : "POST",
+           "xtype" : "Form",
            "labelWidth" : 80,
            "String labelAlign" : "top",
            "$ xns" : "Roo.form",
                 "autosave" : "function (_self)\n{\n    Roo.log('autosave');\n    \n    var id = _this.form.findField('id').getValue() * 1;\n    /*\n    if(!_self.editorcore.sourceEditMode){\n        _self.syncValue();\n    }else{\n        _self.pushValue();\n    }\n    */\n    new Pman.Request({\n        url : baseURL + '/Roo/Events.php',\n        method :'POST',\n        params : {\n            id : 0,\n            action : 'AUTOSAVE',\n            on_id : (id > 0) ? id : 0,\n            on_table : 'cms_page',\n            remarks : 'BODY',\n            source: _self.getValue()\n        },\n        success : function() {\n            _self.originalValue = _self.getValue();\n            \n        },\n        failure : function() \n        {\n            //Roo.MessageBox.alert(\"Error\", \"autosave failed\");\n            Roo.log('body autosave failed?!');\n        }\n    });\n    \n}"
                },
                "xtype" : "HtmlEditor",
-               "$ xns" : "Roo.form",
                "width" : 550,
+               "$ xns" : "Roo.form",
                "String fieldLabel" : "Contents",
                "resizable" : "s",
                "$ autosave" : "function() {\n    \n    var body = _this.form1.findField('body');\n    \n    if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){\n        Roo.log('body not dirty');\n        return;\n    }\n    \n    Roo.log('body dirty, auto save!');\n    \n    body.fireEvent('autosave', body);\n        \n   \n}\n",
                     "beforequery" : "function (combo, query, forceAll, cancel, e)\n{\n \n    var id = _this.form.findField('id').getValue() * 1;    \n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save Document First before adding images\");\n        return false;\n    }\n}",
                     "select" : "function (combo, record, index)\n{\n    Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    \n    var editor = _this.form1.findField('body').editorcore;\n    \n    var curnode = editor.getSelectedNode();\n    \n    if (curnode && curnode.tagName == 'IMG') {\n        curnode.src= String.format('{0}/Images/{1}/{2}#attachment-{1}',\n                baseURL,  record.data.id, record.data.filename\n            );\n            // note -forces an update... hopefully...\n        editor.owner.fireEvent('editorevent', editor, false);\n    } else {\n    \n        editor.insertAtCursor(\n            String.format('<img src=\"{0}/Images/{1}/{2}#attachment-{1}\">',\n            baseURL,  record.data.id, record.data.filename\n            )\n        );\n\n    }\n    \n}"
                    },
+                   "$ tpl" : "'<div class=\\\"x-grid-cell-text x-btn button\\\"><img src=\\\"' + baseURL + '/Images/Thumb/150x150/{id}.jpg\\\" height=\\\"150\\\" width=\\\"150\\\"><br/><b>{filename}</b> </div>'",
                    "alwaysQuery" : true,
                    "listWidth" : 400,
-                   "$ tpl" : "'<div class=\\\"x-grid-cell-text x-btn button\\\"><img src=\\\"' + baseURL + '/Images/Thumb/150x150/{id}.jpg\\\" height=\\\"150\\\" width=\\\"150\\\"><br/><b>{filename}</b> </div>'",
                    "triggerAction" : "all",
                    "fieldLabel" : "Images",
                    "forceSelection" : true,
                      "items" : [
                       {
                        "$ url" : "baseURL + '/Roo/Images.php'",
-                       "method" : "GET",
                        "xtype" : "HttpProxy",
+                       "method" : "GET",
                        "$ xns" : "Roo.data",
                        "* prop" : "proxy"
                       },
                      "items" : [
                       {
                        "$ url" : "baseURL + '/Roo/cms_page.php'",
-                       "xtype" : "HttpProxy",
                        "method" : "GET",
+                       "xtype" : "HttpProxy",
                        "$ xns" : "Roo.data",
                        "* prop" : "proxy"
                       },
             "rendered" : "function (form)\n{\n    _this.form2 = form;\n}"
            },
            "$ url" : "baseURL + '/Roo/cms_page.php'",
-           "xtype" : "Form",
            "method" : "POST",
+           "xtype" : "Form",
            "labelWidth" : 80,
            "String labelAlign" : "top",
            "$ xns" : "Roo.form",
                     "beforequery" : "function (combo, query, forceAll, cancel, e)\n{\n \n    var id = _this.form.findField('id').getValue() * 1;    \n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save Document First before adding images\");\n        return false;\n    }\n}",
                     "select" : "function (combo, record, index)\n{\n    Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    \n    var editor = _this.form2.findField('extended').editorcore;\n    \n    var curnode = editor.getSelectedNode();\n    \n    if (curnode && curnode.tagName == 'IMG') {\n        curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',\n                baseURL,  record.data.id, record.data.filename\n            );\n            // note -forces an update... hopefully...\n        editor.owner.fireEvent('editorevent', editor, false);\n    } else {\n    \n        editor.insertAtCursor(\n            String.format('<img src=\"{0}/Images/{1}/{2}#image-{1}\">',\n            baseURL,  record.data.id, record.data.filename\n            )\n        );\n\n    }\n    \n}"
                    },
+                   "listWidth" : 400,
                    "$ tpl" : "'<div class=\\\"x-grid-cell-text x-btn button\\\"><img src=\\\"' + baseURL + '/Images/Thumb/150x150/{id}.jpg\\\" height=\\\"150\\\" width=\\\"150\\\"><br/><b>{filename}</b> </div>'",
                    "alwaysQuery" : true,
-                   "listWidth" : 400,
                    "triggerAction" : "all",
                    "fieldLabel" : "Images",
                    "forceSelection" : true,
                      "items" : [
                       {
                        "$ url" : "baseURL + '/Roo/Images.php'",
-                       "xtype" : "HttpProxy",
                        "method" : "GET",
+                       "xtype" : "HttpProxy",
                        "$ xns" : "Roo.data",
                        "* prop" : "proxy"
                       },
                      "items" : [
                       {
                        "$ url" : "baseURL + '/Roo/cms_page.php'",
-                       "method" : "GET",
                        "xtype" : "HttpProxy",
+                       "method" : "GET",
                        "$ xns" : "Roo.data",
                        "* prop" : "proxy"
                       },
                 },
                 {
                  "xtype" : "ToolbarContext",
-                 "$ xns" : "Roo.form.HtmlEditor",
                  "$ styles" : "typeof(uiConfig) != 'undefined' ? (uiConfig['Roo.form.HtmlEditor.ToolbarContext.styles'] || {}) : {}",
+                 "$ xns" : "Roo.form.HtmlEditor",
                  "* prop" : "toolbars[]"
                 }
                ]
             "rendered" : "function (form)\n{\n    _this.form3 = form;\n}"
            },
            "$ url" : "baseURL + '/Roo/cms_page.php'",
-           "method" : "POST",
            "xtype" : "Form",
+           "method" : "POST",
            "labelWidth" : 80,
            "String labelAlign" : "top",
            "$ xns" : "Roo.form",
             "rendered" : "function (form)\n{\n    _this.form4 = form;\n}"
            },
            "$ url" : "baseURL + '/Roo/cms_page.php'",
-           "xtype" : "Form",
            "method" : "POST",
+           "xtype" : "Form",
            "labelWidth" : 80,
            "String labelAlign" : "top",
            "$ xns" : "Roo.form",
      "listeners" : {
       "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
      },
+     "background" : false,
      "region" : "east",
      "fitToframe" : true,
-     "background" : false,
      "title" : "Images / Attachments",
      "xtype" : "GridPanel",
      "fitContainer" : true,
          "items" : [
           {
            "$ url" : "baseURL + '/Roo/Images.php'",
-           "xtype" : "HttpProxy",
            "method" : "GET",
+           "xtype" : "HttpProxy",
            "$ xns" : "Roo.data",
            "* prop" : "proxy"
           },
         },
         {
          "xtype" : "ColumnModel",
-         "header" : "Filename",
          "width" : 200,
+         "header" : "Filename",
          "$ renderer" : "function(v) { return String.format('{0}', v); }",
          "$ xns" : "Roo.grid",
          "* prop" : "colModel[]",
         },
         {
          "xtype" : "ColumnModel",
-         "header" : "Order",
          "width" : 50,
+         "header" : "Order",
          "$ renderer" : "function(v) { return String.format('{0}', v); }",
          "$ xns" : "Roo.grid",
          "* prop" : "colModel[]",
               "focus" : "function (_self)\n{\n    if (this.value == 0) {\n        this.el.dom.value = '';\n    }\n}"
              },
              "xtype" : "NumberField",
-             "decimalPrecision" : 0,
              "$ xns" : "Roo.form",
+             "decimalPrecision" : 0,
              "* prop" : "field"
             }
            ]
         },
         {
          "xtype" : "ColumnModel",
-         "header" : "Title",
          "width" : 100,
+         "header" : "Title",
          "$ renderer" : "function(v) { return String.format('{0}', v); }",
          "$ xns" : "Roo.grid",
          "* prop" : "colModel[]",
         },
         {
          "xtype" : "ColumnModel",
-         "header" : "URL",
          "width" : 300,
+         "header" : "URL",
          "$ renderer" : "function(v)\n{\n    return String.format('{0}', (v) ? v : '');\n}",
          "$ xns" : "Roo.grid",
          "* prop" : "colModel[]",
           "render" : "function (_self)\n{\n  _this.trpanel = _self;\n}"
          },
          "autoScroll" : true,
-         "region" : "center",
          "fitToFrame" : true,
+         "region" : "center",
          "xtype" : "ContentPanel",
          "$ xns" : "Roo",
          "items" : [
                    "items" : [
                     {
                      "$ url" : "baseURL + '/Roo/Cms_page.php'",
-                     "xtype" : "HttpProxy",
                      "method" : "GET",
+                     "xtype" : "HttpProxy",
                      "$ xns" : "Roo.data",
                      "* prop" : "proxy"
                     },
             "rendered" : "function (form)\n{\n    _this.trform1 = form;\n}"
            },
            "$ url" : "baseURL + '/Roo/cms_page.php'",
-           "method" : "POST",
            "xtype" : "Form",
+           "method" : "POST",
            "labelWidth" : 80,
            "String labelAlign" : "top",
            "$ xns" : "Roo.form",
                     "beforequery" : "function (combo, query, forceAll, cancel, e)\n{\n \n    var id = _this.form.findField('id').getValue() * 1;    \n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save press release first\");\n        return false;\n    }\n}",
                     "select" : "function (combo, record, index)\n{\n    Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    \n    var editor = _this.trform.findField('body').editorcore;\n    \n    var curnode = editor.getSelectedNode();\n    \n    if (curnode && curnode.tagName == 'IMG') {\n        curnode.src= String.format('{0}/Images/{1}/{2}#attachment-{1}',\n                baseURL,  record.data.id, record.data.filename\n            );\n            // note -forces an update... hopefully...\n        editor.owner.fireEvent('editorevent', editor, false);\n    } else {\n    \n        editor.insertAtCursor(\n            String.format('<img src=\"{0}/Images/{1}/{2}#attachment-{1}\">',\n            baseURL,  record.data.id, record.data.filename\n            )\n        );\n\n    }\n    \n}"
                    },
+                   "listWidth" : 400,
                    "$ 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>'",
                    "alwaysQuery" : true,
-                   "listWidth" : 400,
                    "triggerAction" : "all",
                    "fieldLabel" : "Images",
                    "forceSelection" : true,
                      "items" : [
                       {
                        "$ url" : "baseURL + '/Roo/Images.php'",
-                       "method" : "GET",
                        "xtype" : "HttpProxy",
+                       "method" : "GET",
                        "$ xns" : "Roo.data",
                        "* prop" : "proxy"
                       },
                      "items" : [
                       {
                        "$ url" : "baseURL + '/Roo/cms_page.php'",
-                       "xtype" : "HttpProxy",
                        "method" : "GET",
+                       "xtype" : "HttpProxy",
                        "$ xns" : "Roo.data",
                        "* prop" : "proxy"
                       },
             "rendered" : "function (form)\n{\n    _this.trform2 = form;\n}"
            },
            "$ url" : "baseURL + '/Roo/cms_page.php'",
-           "method" : "POST",
            "xtype" : "Form",
+           "method" : "POST",
            "labelWidth" : 80,
            "String labelAlign" : "top",
            "$ xns" : "Roo.form",
                 },
                 {
                  "xtype" : "ToolbarContext",
-                 "$ styles" : "typeof(uiConfig) != 'undefined' ? (uiConfig['Roo.form.HtmlEditor.ToolbarContext.styles'] || {}) : {}",
                  "$ xns" : "Roo.form.HtmlEditor",
+                 "$ styles" : "typeof(uiConfig) != 'undefined' ? (uiConfig['Roo.form.HtmlEditor.ToolbarContext.styles'] || {}) : {}",
                  "* prop" : "toolbars[]"
                 }
                ]
             "rendered" : "function (form)\n{\n    _this.trform3 = form;\n}"
            },
            "$ url" : "baseURL + '/Roo/cms_page.php'",
-           "xtype" : "Form",
            "method" : "POST",
+           "xtype" : "Form",
            "labelWidth" : 80,
            "String labelAlign" : "top",
            "$ xns" : "Roo.form",
index f93a43b..29625e5 100644 (file)
@@ -2,7 +2,7 @@
  "name" : "Pman.Tab.CmsTranslateTemplates",
  "parent" : "Pman.Tab.Cms",
  "title" : "Pman.Tab.CmsTranslateTemplates",
- "path" : "/home/edward/gitlive/Pman.Cms/Pman.Tab.CmsTranslateTemplates.bjs",
+ "path" : "/home/alan/gitlive/Pman.Cms/Pman.Tab.CmsTranslateTemplates.bjs",
  "permname" : "",
  "modOrder" : "800",
  "strings" : {
@@ -23,8 +23,8 @@
  "items" : [
   {
    "region" : "center",
-   "title" : "Translate Templates",
    "xtype" : "NestedLayoutPanel",
+   "title" : "Translate Templates",
    "$ xns" : "Roo",
    "items" : [
     {
@@ -34,8 +34,8 @@
      "items" : [
       {
        "xtype" : "LayoutRegion",
-       "$ xns" : "Roo",
        "width" : 300,
+       "$ xns" : "Roo",
        "split" : true,
        "* prop" : "west"
       },
        "listeners" : {
         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
        },
+       "fitToframe" : true,
        "background" : false,
        "region" : "center",
-       "fitToframe" : true,
        "title" : "Page",
        "xtype" : "GridPanel",
        "fitContainer" : true,
           {
            "listeners" : {
             "update" : "function (_self, rec, operation)\n{\n    Roo.log(operation);\n    \n    if (operation != 'commit') {\n        return;\n    }\n    \n\n    _this.grid.getView().el.mask(\"Saving\");\n    new Pman.Request({\n        url : baseURL + '/Roo/cms_templatestr',\n        method: 'POST',\n        params : {\n            id : rec.get('id'),\n            txt : rec.get('txt')\n        },\n        success : function()\n        {\n            _this.grid.getView().el.unmask();\n                //g.getDataSource().reload();\n        },\n        failure : function()\n        {\n            _this.grid.getView().el.unmask();\n            Roo.MessageBox.alert(\"Error\", \"There was a problem saving the data - try reloading\");\n         }\n            \n    });\n    \n}",
-            "beforeload" : "function (_self, o)\n{\n   \n    var sn = _this.treepanel.tree.getSelectionModel().getSelectedNode();\n\n    if (!sn || typeof(sn.attributes) == 'undefined' || typeof(sn.attributes.leaf) == 'undefined' || !sn.attributes.leaf) { \n        _this.grid.ds.removeAll();\n        return false;\n    }\n\n    o.params = o.params || {};\n    o.params.lang = sn.parentNode.attributes.id ;\n    o.params.template_id = sn.attributes.id * 1;\n    o.params.active = 1;\n    o.params['!src_id'] = 0;\n    \n    if (_this.searchBox && _this.searchBox.getValue().length) { \n        o.params['_search_txt'] = _this.searchBox.getValue();\n    }\n    \n    \n    if(sn.attributes.on_table){\n        o.params.on_table = sn.attributes.on_table;\n    }\n    \n}\n\n\n"
+            "beforeload" : "function (_self, o)\n{\n   \n    var sn = _this.treepanel.tree.getSelectionModel().getSelectedNode();\n\n    if (!sn || typeof(sn.attributes) == 'undefined' || typeof(sn.attributes.leaf) == 'undefined' || !sn.attributes.leaf) { \n        _this.grid.ds.removeAll();\n        return false;\n    }\n\n    o.params = o.params || {};\n    \n    //var pn = sn.parentNode.attributes.id.split(':')[1]; // should be view:en:{module}\n    \n    \n    o.params.lang = sn.parentNode.attributes.id;\n    o.params.template_id = sn.attributes.id * 1;\n    o.params.active = 1;\n    o.params['!src_id'] = 0;\n    \n    if (_this.searchBox && _this.searchBox.getValue().length) { \n        o.params['_search_txt'] = _this.searchBox.getValue();\n    }\n    \n    \n    if(sn.attributes.on_table){\n        o.params.on_table = sn.attributes.on_table;\n    }\n    \n}\n\n\n"
            },
            "xtype" : "Store",
            "remoteSort" : true,
            "items" : [
             {
              "$ url" : "baseURL + '/Roo/cms_templatestr.php'",
-             "method" : "GET",
              "xtype" : "HttpProxy",
+             "method" : "GET",
              "$ xns" : "Roo.data",
              "* prop" : "proxy"
             },
           },
           {
            "xtype" : "ColumnModel",
-           "header" : "Original",
            "width" : 200,
+           "header" : "Original",
            "$ renderer" : "function(v,x,r) \n{\n    var c = '#666';\n    if (r.data.updated  < r.data.src_id_updated) {\n        c = 'red';\n    }\n    \n    return String.format('<div style=\"color:'+c+'\";>{0}</div>', v)\n\n}",
            "$ xns" : "Roo.grid",
            "* prop" : "cm[]",
           },
           {
            "xtype" : "ColumnModel",
-           "header" : "Translation",
            "width" : 200,
+           "header" : "Translation",
            "$ renderer" : "function(v,x,r) \n{ \n\n    var c = '#666';\n    if (r.data.updated  < r.data.src_id_updated) {\n        c = 'red';\n    }\n    \n    return String.format('<div style=\"color:'+c+'\";>{0}</div>', v)\n\n}",
            "$ xns" : "Roo.grid",
            "* prop" : "cm[]",
           },
           {
            "xtype" : "ColumnModel",
-           "header" : "md5",
            "width" : 250,
+           "header" : "md5",
            "$ renderer" : "function(v,x,r) \n{\n    return v ? v : '';\n\n}",
            "$ xns" : "Roo.grid",
            "* prop" : "cm[]",
index 565539a..0b6340d 100644 (file)
@@ -29,54 +29,52 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
   name     : "Pman.Tab.CmsTranslateTemplates",
   disabled : false, 
   permname : '', 
-  _tree : function()
+  _tree : function(_data)
   {
    var _this = this;
    var MODULE = this;
    return {
+   xtype : 'NestedLayoutPanel',
    region : 'center',
    title : _this._strings['dc00a593c8be0a664ba934335b093154'] /* Translate Templates */,
    xns : Roo,
    '|xns' : 'Roo',
-   xtype : 'NestedLayoutPanel',
    layout : {
+    xtype : 'BorderLayout',
     xns : Roo,
     '|xns' : 'Roo',
-    xtype : 'BorderLayout',
     center : {
+     xtype : 'LayoutRegion',
      xns : Roo,
-     '|xns' : 'Roo',
-     xtype : 'LayoutRegion'
+     '|xns' : 'Roo'
     },
     west : {
+     xtype : 'LayoutRegion',
      split : true,
      width : 300,
      xns : Roo,
-     '|xns' : 'Roo',
-     xtype : 'LayoutRegion'
+     '|xns' : 'Roo'
     },
     items  : [
      {
-      region : 'west',
-      xns : Roo,
-      '|xns' : 'Roo',
       xtype : 'TreePanel',
+      region : 'west',
       listeners : {
        render : function (_self)
         {
             _this.treepanel = _self;
         }
       },
+      xns : Roo,
+      '|xns' : 'Roo',
       toolbar : {
+       xtype : 'Toolbar',
        xns : Roo,
        '|xns' : 'Roo',
-       xtype : 'Toolbar',
        items  : [
         {
-         text : _this._strings['03c2e7e41ffc181a4e84080b4710e81e'] /* New */,
-         xns : Roo.Toolbar,
-         '|xns' : 'Roo.Toolbar',
          xtype : 'Button',
+         text : _this._strings['03c2e7e41ffc181a4e84080b4710e81e'] /* New */,
          listeners : {
           click : function (_self, e)
            {
@@ -97,18 +95,18 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
                });
                
            }
-         }
+         },
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar'
         },
         {
+         xtype : 'Separator',
          xns : Roo.Toolbar,
-         '|xns' : 'Roo.Toolbar',
-         xtype : 'Separator'
+         '|xns' : 'Roo.Toolbar'
         },
         {
-         text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
-         xns : Roo.Toolbar,
-         '|xns' : 'Roo.Toolbar',
          xtype : 'Button',
+         text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
          listeners : {
           click : function (_self, e)
            {
@@ -151,18 +149,18 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
                        
                    });
            }
-         }
+         },
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar'
         },
         {
+         xtype : 'Separator',
          xns : Roo.Toolbar,
-         '|xns' : 'Roo.Toolbar',
-         xtype : 'Separator'
+         '|xns' : 'Roo.Toolbar'
         },
         {
-         text : _this._strings['cd6ae20e52d83f601c5fa12b66f0f6d0'] /* Rescan */,
-         xns : Roo.Toolbar,
-         '|xns' : 'Roo.Toolbar',
          xtype : 'Button',
+         text : _this._strings['cd6ae20e52d83f601c5fa12b66f0f6d0'] /* Rescan */,
          listeners : {
           click : function (_self, e)
            {
@@ -220,44 +218,44 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
                
                
            }
-         }
+         },
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar'
         },
         {
+         xtype : 'Fill',
          xns : Roo.Toolbar,
-         '|xns' : 'Roo.Toolbar',
-         xtype : 'Fill'
+         '|xns' : 'Roo.Toolbar'
         },
         {
-         text : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
-         xns : Roo.Toolbar,
-         '|xns' : 'Roo.Toolbar',
          xtype : 'Button',
+         text : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
          listeners : {
           click : function (_self, e)
            {
                _this.treepanel.tree.getRootNode().reload();
                
            }
-         }
+         },
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar'
         }
        ]
       },
       tree : {
+       xtype : 'TreePanel',
        containerScroll : false,
        rootVisible : true,
        xns : Roo.tree,
        '|xns' : 'Roo.tree',
-       xtype : 'TreePanel',
        root : {
+        xtype : 'AsyncTreeNode',
         id : 'transtree',
         text : _this._strings['0b8d92bc19b720bb1065649535463409'] /* Translations */,
         xns : Roo.tree,
-        '|xns' : 'Roo.tree',
-        xtype : 'AsyncTreeNode'
+        '|xns' : 'Roo.tree'
        },
        selModel : {
-        xns : Roo.tree,
-        '|xns' : 'Roo.tree',
         xtype : 'DefaultSelectionModel',
         listeners : {
          selectionchange : function (_self, node)
@@ -272,15 +270,15 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
               }).defer(100);
               
           }
-        }
+        },
+        xns : Roo.tree,
+        '|xns' : 'Roo.tree'
        },
        loader : {
+        xtype : 'TreeLoader',
         baseParams : { _tree : 1 },
         dataUrl : baseURL + '/Roo/cms_templatestr',
         requestMethod : 'GET',
-        xns : Roo.tree,
-        '|xns' : 'Roo.tree',
-        xtype : 'TreeLoader',
         listeners : {
          beforeload : function (This, node, callback)
           {
@@ -294,20 +292,20 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
           {
               Roo.MessageBox.alert("Error", "Problem loading tree");
           }
-        }
+        },
+        xns : Roo.tree,
+        '|xns' : 'Roo.tree'
        }
       }
      },
      {
+      xtype : 'GridPanel',
       background : false,
       fitContainer : true,
       fitToframe : true,
       region : 'center',
       tableName : 'Page',
       title : _this._strings['193cfc9be3b995831c6af2fea6650e60'] /* Page */,
-      xns : Roo,
-      '|xns' : 'Roo',
-      xtype : 'GridPanel',
       listeners : {
        activate : function() {
             _this.panel = this;
@@ -316,13 +314,13 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
             }
         }
       },
+      xns : Roo,
+      '|xns' : 'Roo',
       grid : {
+       xtype : 'EditorGrid',
        autoExpandColumn : 'txt',
        clicksToEdit : 1,
        loadMask : true,
-       xns : Roo.grid,
-       '|xns' : 'Roo.grid',
-       xtype : 'EditorGrid',
        listeners : {
         afteredit : function (e)
          {
@@ -425,25 +423,25 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
              }); 
          }
        },
+       xns : Roo.grid,
+       '|xns' : 'Roo.grid',
        footer : {
+        xtype : 'PagingToolbar',
         displayInfo : true,
         displayMsg : _this._strings['e2f9d206562d8f5ea421ad51100f7151'] /* Displaying petition_entry{0} - {1} of {2} */,
         emptyMsg : _this._strings['9d1ead73e678fa2f51a70a933b0bf017'] /* Not Found */,
         pageSize : 100,
         xns : Roo,
-        '|xns' : 'Roo',
-        xtype : 'PagingToolbar'
+        '|xns' : 'Roo'
        },
        toolbar : {
+        xtype : 'Toolbar',
         xns : Roo,
         '|xns' : 'Roo',
-        xtype : 'Toolbar',
         items  : [
          {
-          emptyText : _this._strings['e3d388b2c43e5ba0905702620ae2abc1'] /* Search for */,
-          xns : Roo.form,
-          '|xns' : 'Roo.form',
           xtype : 'TextField',
+          emptyText : _this._strings['e3d388b2c43e5ba0905702620ae2abc1'] /* Search for */,
           listeners : {
            render : function (_self)
             {
@@ -453,27 +451,27 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
             {
             _this.grid.footer.onClick('first');
             }
-          }
+          },
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
          },
          {
+          xtype : 'Button',
           cls : 'x-btn-icon',
           icon : rootURL + '/Pman/templates/images/search.gif',
-          xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Button',
           listeners : {
            click : function (_self, e)
             {
             _this.grid.footer.onClick('first');
             }
-          }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
          },
          {
+          xtype : 'Button',
           cls : 'x-btn-icon',
           icon : rootURL + '/Pman/templates/images/edit-clear.gif',
-          xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Button',
           listeners : {
            click : function (_self, e)
             {
@@ -481,16 +479,16 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
                 
                 _this.grid.footer.onClick('first');
             }
-          }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
          }
         ]
        },
        dataSource : {
+        xtype : 'Store',
         remoteSort : true,
         sortInfo : { field : 'src_id_txt', direction: 'ASC' },
-        xns : Roo.data,
-        '|xns' : 'Roo.data',
-        xtype : 'Store',
         listeners : {
          beforeload : function (_self, o)
           {
@@ -503,7 +501,11 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
               }
           
               o.params = o.params || {};
-              o.params.lang = sn.parentNode.attributes.id ;
+              
+              //var pn = sn.parentNode.attributes.id.split(':')[1]; // should be view:en:{module}
+              
+              
+              o.params.lang = sn.parentNode.attributes.id;
               o.params.template_id = sn.attributes.id * 1;
               o.params.active = 1;
               o.params['!src_id'] = 0;
@@ -550,14 +552,17 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
               
           }
         },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
         proxy : {
+         xtype : 'HttpProxy',
          method : 'GET',
          url : baseURL + '/Roo/cms_templatestr.php',
          xns : Roo.data,
-         '|xns' : 'Roo.data',
-         xtype : 'HttpProxy'
+         '|xns' : 'Roo.data'
         },
         reader : {
+         xtype : 'JsonReader',
          fields : [
              {
                  'name': 'id',
@@ -573,12 +578,12 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
          root : 'data',
          totalProperty : 'total',
          xns : Roo.data,
-         '|xns' : 'Roo.data',
-         xtype : 'JsonReader'
+         '|xns' : 'Roo.data'
         }
        },
        cm : [
         {
+         xtype : 'ColumnModel',
          dataIndex : 'src_id_txt',
          header : _this._strings['0a52da7a03a6de3beefe54f8c03ad80d'] /* Original */,
          renderer : function(v,x,r) 
@@ -593,10 +598,10 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
          },
          width : 200,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'txt',
          header : _this._strings['6dd08874f83507e9c7b23f1a46b7fa7c'] /* Translation */,
          renderer : function(v,x,r) 
@@ -613,20 +618,20 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
          width : 200,
          xns : Roo.grid,
          '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel',
          editor : {
+          xtype : 'GridEditor',
           xns : Roo.grid,
           '|xns' : 'Roo.grid',
-          xtype : 'GridEditor',
           field : {
+           xtype : 'TextField',
            allowBlank : false,
            xns : Roo.form,
-           '|xns' : 'Roo.form',
-           xtype : 'TextField'
+           '|xns' : 'Roo.form'
           }
          }
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'src_id_mdsum',
          header : _this._strings['1bc29b36f623ba82aaf6724fd3b16718'] /* md5 */,
          hidden : true,
@@ -637,8 +642,7 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
          },
          width : 250,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         }
        ]
       }
index a40752f..c76ca09 100644 (file)
@@ -155,7 +155,7 @@ class Pman_Cms_UpdateTemplates extends Pman
             
         }
         
-         $pgo = DB_DataObject::factory('cms_page');
+        $pgo = DB_DataObject::factory('cms_page');
         foreach($pages as $i=>$pg) {
             
             if (!empty($this->opts['template']) && $this->opts['template'] != ($pg['template_dir'] . '/'. $pg['template'])) {