sync
[Pman.Admin] / Pman.Tab.AdminEmailTemplates.js
index c6bc60f..1415de2 100644 (file)
@@ -30,47 +30,50 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
   name     : "Manage Email Templates",
   disabled : false, 
   permname : '', 
-  _tree : function()
+  _tree : function(_data)
   {
    var _this = this;
    var MODULE = this;
    return {
+   xtype : 'NestedLayoutPanel',
    region : 'center',
    title : _this._strings['f49559cda3fb906fbd7736f8b8a0e37d'] /* Email Template */,
+   listeners : {
+    render : function (_self)
+     {
+         _this.nest = this;
+     }
+   },
    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 : {
-     autoScroll : false,
+     xtype : 'LayoutRegion',
      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;
@@ -79,12 +82,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() 
          {
@@ -110,20 +113,20 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
              }); 
          }
        },
+       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  : [
          {
-          text : _this._strings['01bd6a16732dfa2b760dc8566c58afae'] /* Download to Excel */,
-          xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
           xtype : 'Button',
+          text : _this._strings['01bd6a16732dfa2b760dc8566c58afae'] /* Download to Excel */,
           listeners : {
            click : function()
             {
@@ -139,18 +142,18 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
             Roo.MessageBox.alert("Notice", "Should be downloading now");
               
             }
-          }
+          },
+          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)
@@ -161,47 +164,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()
             {
@@ -223,15 +226,15 @@ 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()
             {
@@ -242,36 +245,36 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
                     _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 : {
-        remoteSort : true,
-        sortInfo : { field : 'name', direction: 'ASC' },
-        xns : Roo.data,
-        '|xns' : 'Roo.data',
         xtype : 'Store',
+        remoteSort : true,
+        sortInfo : { field : 'description', direction: 'ASC' },
         listeners : {
          beforeload : function (_self, options)
           {
@@ -285,14 +288,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",
@@ -307,91 +313,107 @@ 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'
        },
        cm : [
         {
+         xtype : 'ColumnModel',
          dataIndex : 'name',
          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
-         renderer : function(v) { return String.format('{0}', v); },
+         renderer : function(v,x,r) 
+         { 
+             if (r.data.description.length > 0) {
+                 v = r.data.description;
+             }
+             
+             
+             if(r.data.active * 1 < 1){
+                 return String.format('<s>{0}</s>', v ? v : ''); 
+             }
+             
+             return String.format('{0}', v ? 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); },
+         renderer : function(v,x,r) 
+         { 
+             if(r.data.active * 1 < 1){
+                 return String.format('<s>{0}</s>', v ? v : ''); 
+             }
+             
+             return String.format('{0}', v ? 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); },
+         renderer : function(v) { return String.format('{0}', v ? v : ''); },
          sortable : true,
-         width : 400,
+         width : 150,
          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 ? v : ''); },
          sortable : true,
-         width : 400,
+         width : 150,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'bcc_group_name',
          header : _this._strings['68b00d723d37122f64da8d9939f836f0'] /* BCC Group */,
          renderer : function(v) { return String.format('{0}', v ? v : ''); },
          sortable : true,
-         width : 400,
+         width : 150,
          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)
          {
@@ -399,9 +421,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)
@@ -424,56 +446,25 @@ Pman.Tab.AdminEmailTemplates = new Roo.XComponent({
                   this.removeAll();
                   return false;
               }
-            /*  
-              new Pman.Request({
-                  url : baseURL + '/Roo/crm_action.php',
-                  method : 'GET',
-                  params : {
-                      person_id : p.data.id,
-                      sort : 'action_dt',
-                      dir : 'DESC'
-                  },
-                  success : function(res) {
-                      if(res.success){
-                          var el = _this.cpanel.el.select('.crm-history-content').first();
-                          _this.historyTemplate.overwrite(el, res);
-                          el.select('.crm-history-log').on('click', Pman.Crm.auditToggle);
-                          //Roo.log(res);
-                      }
-                  },
-                  failure : function(e) {
-                      //Roo.log(e);
-                    _this.grid.ds.load({});
-                  }
-                  
-              });
-              */
-          
-          //_this.historyTemplate = new Roo.DomTemplate({url : rootURL+'/Pman/Crm/domtemplates/crm_history.html'})
-          
-          /*
-            new pman request ([
-            
-            } successs(data)
-                 el = _this.elemmnt.select('.services')
-                 _this.serviceTemplate.overwite(el, data)
-            */
+           
           }
         },
+        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'
         }
        }
       }