Pman.Tab.AdminEmailTemplates.bjs
authorAlan Knowles <alan@roojs.com>
Fri, 3 Jun 2016 05:26:34 +0000 (13:26 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 3 Jun 2016 05:26:34 +0000 (13:26 +0800)
Pman.Tab.AdminEmailTemplates.js

Pman.Tab.AdminEmailTemplates.bjs
Pman.Tab.AdminEmailTemplates.js

index 4faacf2..013de0e 100644 (file)
@@ -2,7 +2,7 @@
  "name" : "Pman.Tab.AdminEmailTemplates",
  "parent" : "Pman.Tab.Admin",
  "title" : "Manage Email Templates",
- "path" : "/home/edward/gitlive/Pman.Admin/Pman.Tab.AdminEmailTemplates.bjs",
+ "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminEmailTemplates.bjs",
  "permname" : "",
  "modOrder" : "999",
  "strings" : {
@@ -51,9 +51,9 @@
        "listeners" : {
         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
        },
-       "region" : "center",
        "fitToframe" : true,
        "background" : true,
+       "region" : "center",
        "title" : "core_email",
        "xtype" : "GridPanel",
        "fitContainer" : true,
@@ -62,7 +62,7 @@
        "items" : [
         {
          "listeners" : {
-          "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    var data = this.getDataSource().getAt(rowIndex).data;\n    _this.dialog.show( {id : data.id, module : 'core_email'} , function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
+          "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) { \n        return;\n        }\n    var data = this.getDataSource().getAt(rowIndex).data;\n    _this.dialog.show( {id : data.id, module : 'core_email'} , function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
           "|render" : "function() \n{\n    _this.grid = this; \n    _this.dialog = Pman.Dialog.CoreEmail;\n    if (_this.panel.active) {\n       _this.grid.footer.onClick('first');\n    }\n}",
           "rowclick" : "function (_self, rowIndex, e)\n{\n   // _this.grid.ds.load({});\n    _this.viewPanel.view.store.load({});\n}"
          },
            "$ xns" : "Roo",
            "displayMsg" : "Displaying Message{0} - {1} of {2}",
            "displayInfo" : true,
-           "* prop" : "footer"
+           "* prop" : "footer",
+           "items" : [
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n  var sel = _this.grid.selModel.getSelected();\n  if (!sel) {\n        Roo.MessageBox.alert(\"Error\", \"Select a message to copy\");\n        return;\n    }\nnew Pman.Request({\n    url : baseURL + '/Roo/Core_email',\n    method : 'POST',\n    params : {\n        id : sel.data.id,\n        _make_copy : 1\n    },\n    success : function() {\n        _this.grid.footer.onClick('refresh');\n    }\n});\n  \n}\n"
+             },
+             "text" : "Copy",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+             "$ xns" : "Roo.Toolbar"
+            }
+           ]
           },
           {
            "xtype" : "Toolbar",
             },
             {
              "listeners" : {
-              "|click" : "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0, module : 'core_email' } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
+              "|click" : "function()\n{\n    if (!_this.dialog) {\n         return;\n         }\n    _this.dialog.show( { id : 0, module : 'core_email' } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
              },
              "text" : "Add",
              "xtype" : "Button",
index 48dd260..df26a46 100644 (file)
@@ -33,42 +33,40 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
    var _this = this;
    var MODULE = this;
    return {
+   xtype : 'NestedLayoutPanel',
    region : 'center',
    title : _this._strings['f49559cda3fb906fbd7736f8b8a0e37d'] /* Email Template */,
    xns : Roo,
    '|xns' : 'Roo',
-   xtype : 'NestedLayoutPanel',
    layout : {
+    xtype : 'BorderLayout',
     xns : Roo,
     '|xns' : 'Roo',
-    xtype : 'BorderLayout',
     center : {
+     xtype : 'LayoutRegion',
      autoScroll : false,
      split : true,
      xns : Roo,
-     '|xns' : 'Roo',
-     xtype : 'LayoutRegion'
+     '|xns' : 'Roo'
     },
     south : {
+     xtype : 'LayoutRegion',
      autoScroll : false,
      height : 300,
      split : true,
      titlebar : true,
      xns : Roo,
-     '|xns' : 'Roo',
-     xtype : 'LayoutRegion'
+     '|xns' : 'Roo'
     },
     items  : [
      {
+      xtype : 'GridPanel',
       background : true,
       fitContainer : true,
       fitToframe : true,
       region : 'center',
       tableName : 'core_email',
       title : _this._strings['c7d299bf3f9e37c77ab646f7e5366696'] /* core_email */,
-      xns : Roo,
-      '|xns' : 'Roo',
-      xtype : 'GridPanel',
       listeners : {
        activate : function() {
             _this.panel = this;
@@ -77,12 +75,12 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
             }
         }
       },
+      xns : Roo,
+      '|xns' : 'Roo',
       grid : {
+       xtype : 'Grid',
        autoExpandColumn : 'subject',
        loadMask : true,
-       xns : Roo.grid,
-       '|xns' : 'Roo.grid',
-       xtype : 'Grid',
        listeners : {
         render : function() 
          {
@@ -99,30 +97,64 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
          },
         rowdblclick : function (_self, rowIndex, e)
          {
-             if (!_this.dialog) return;
+             if (!_this.dialog) { 
+                 return;
+                 }
              var data = this.getDataSource().getAt(rowIndex).data;
              _this.dialog.show( {id : data.id, module : 'core_email'} , function() {
                  _this.grid.footer.onClick('first');
              }); 
          }
        },
+       xns : Roo.grid,
+       '|xns' : 'Roo.grid',
        footer : {
+        xtype : 'PagingToolbar',
         displayInfo : true,
         displayMsg : _this._strings['00d6e06d2f3c092b4f5e1e708a360b0f'] /* Displaying Message{0} - {1} of {2} */,
         emptyMsg : _this._strings['9076cbba1d9ef79280b4f39e2aa0d115'] /* Nothing found */,
         pageSize : 25,
         xns : Roo,
         '|xns' : 'Roo',
-        xtype : 'PagingToolbar'
+        items  : [
+         {
+          xtype : 'Button',
+          cls : 'x-btn-text-icon',
+          icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+          text : _this._strings['5fb63579fc981698f97d55bfecb213ea'] /* Copy */,
+          listeners : {
+           click : function()
+            {
+              var sel = _this.grid.selModel.getSelected();
+              if (!sel) {
+                    Roo.MessageBox.alert("Error", "Select a message to copy");
+                    return;
+                }
+            new Pman.Request({
+                url : baseURL + '/Roo/Core_email',
+                method : 'POST',
+                params : {
+                    id : sel.data.id,
+                    _make_copy : 1
+                },
+                success : function() {
+                    _this.grid.footer.onClick('refresh');
+                }
+            });
+              
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         }
+        ]
        },
        toolbar : {
+        xtype : 'Toolbar',
         xns : Roo,
         '|xns' : 'Roo',
-        xtype : 'Toolbar',
         items  : [
          {
-          xns : Roo.form,
-          '|xns' : 'Roo.form',
           xtype : 'TextField',
           listeners : {
            render : function (_self)
@@ -133,47 +165,47 @@ Pman.Tab.AdminEmailTemplates = 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)
             {
                 _this.searchBox.setValue('');\r
                 _this.grid.footer.onClick('first');\r
             }
-          }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
          },
          {
+          xtype : 'Fill',
           xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Fill'
+          '|xns' : 'Roo.Toolbar'
          },
          {
+          xtype : 'Button',
           cls : 'x-btn-text-icon',
           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
           text : _this._strings['5fb63579fc981698f97d55bfecb213ea'] /* Copy */,
-          xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Button',
           listeners : {
            click : function()
             {
@@ -195,53 +227,55 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
             });
               
             }
-          }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
          },
          {
+          xtype : 'Button',
           cls : 'x-btn-text-icon',
           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
-          xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Button',
           listeners : {
            click : function()
             {
-                if (!_this.dialog) return;
+                if (!_this.dialog) {
+                     return;
+                     }
                 _this.dialog.show( { id : 0, module : 'core_email' } , function() {
                     _this.grid.footer.onClick('first');
                }); 
             }
-          }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
          },
          {
+          xtype : 'Separator',
           xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Separator'
+          '|xns' : 'Roo.Toolbar'
          },
          {
+          xtype : 'Button',
           cls : 'x-btn-text-icon',
           icon : rootURL + '/Pman/templates/images/trash.gif',
           text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
-          xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Button',
           listeners : {
            click : function()
             {
                 Pman.genericDelete(_this, 'core_email');
                 
             }
-          }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
          }
         ]
        },
        dataSource : {
+        xtype : 'Store',
         remoteSort : true,
         sortInfo : { field : 'name', direction: 'ASC' },
-        xns : Roo.data,
-        '|xns' : 'Roo.data',
-        xtype : 'Store',
         listeners : {
          beforeload : function (_self, options)
           {
@@ -255,14 +289,17 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
           
           }
         },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
         proxy : {
+         xtype : 'HttpProxy',
          method : 'GET',
          url : baseURL + '/Roo/Core_email.php',
          xns : Roo.data,
-         '|xns' : 'Roo.data',
-         xtype : 'HttpProxy'
+         '|xns' : 'Roo.data'
         },
         reader : {
+         xtype : 'JsonReader',
          fields : [
              {
                  "name":"name",
@@ -277,81 +314,78 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
          root : 'data',
          totalProperty : 'total',
          xns : Roo.data,
-         '|xns' : 'Roo.data',
-         xtype : 'JsonReader'
+         '|xns' : 'Roo.data'
         }
        },
        sm : {
+        xtype : 'RowSelectionModel',
         singleSelect : true,
         xns : Roo.grid,
-        '|xns' : 'Roo.grid',
-        xtype : 'RowSelectionModel'
+        '|xns' : 'Roo.grid'
        },
        colModel : [
         {
+         xtype : 'ColumnModel',
          dataIndex : 'name',
          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
          renderer : function(v) { return String.format('{0}', v); },
          sortable : true,
          width : 250,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'subject',
          header : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
          renderer : function(v) { return String.format('{0}', v); },
          sortable : true,
          width : 300,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'from_name',
          header : _this._strings['4a4a8fe0c6dfb6bd2a41755d15eb6f0b'] /* From Name */,
          renderer : function(v) { return String.format('{0}', v); },
          sortable : true,
          width : 400,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'from_email',
          header : _this._strings['4ca679a383343ab3d4ca1cd7c91b43f7'] /* From Email */,
          renderer : function(v) { return String.format('{0}', v); },
          sortable : true,
          width : 400,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         }
        ]
       }
      },
      {
+      xtype : 'ContentPanel',
       autoScroll : true,
       background : false,
       fitContainer : true,
       fitToFrame : true,
       region : 'south',
       title : _this._strings['9e11143e29a031212f2cdefcf61f39e9'] /* View Message */,
-      xns : Roo,
-      '|xns' : 'Roo',
-      xtype : 'ContentPanel',
       listeners : {
        render : function (_self)
         {
             _this.viewPanel = _self;
         }
       },
+      xns : Roo,
+      '|xns' : 'Roo',
       view : {
-       tpl : new Roo.DomTemplate({url : rootURL+'/Pman/Crm/domtemplates/crm_mail.html'}),
-       xns : Roo,
-       '|xns' : 'Roo',
        xtype : 'View',
+       tpl : new Roo.DomTemplate({url : rootURL+'/Pman/Crm/domtemplates/crm_mail.html'}),
        listeners : {
         preparedata : function (_self, data, i, rec)
          {
@@ -359,9 +393,9 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
              //Roo.apply(data, rec.json);
          }
        },
+       xns : Roo,
+       '|xns' : 'Roo',
        store : {
-        xns : Roo.data,
-        '|xns' : 'Roo.data',
         xtype : 'Store',
         listeners : {
          beforeload : function (_self, options)
@@ -420,20 +454,22 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
             */
           }
         },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
         proxy : {
+         xtype : 'HttpProxy',
          method : 'GET',
          url : baseURL+'/Roo/Core_email.php',
          xns : Roo.data,
-         '|xns' : 'Roo.data',
-         xtype : 'HttpProxy'
+         '|xns' : 'Roo.data'
         },
         reader : {
+         xtype : 'JsonReader',
          id : 'id',
          root : 'data',
          totalProperty : 'total',
          xns : Roo.data,
-         '|xns' : 'Roo.data',
-         xtype : 'JsonReader'
+         '|xns' : 'Roo.data'
         }
        }
       }