DataObjects/Companies.php
[Pman.Core] / Pman.Dialog.CoreNotifyRecurKeywords.js
index 7e0668c..bddf1de 100644 (file)
@@ -7,11 +7,12 @@ Roo.namespace('Pman.Dialog');
 Pman.Dialog.CoreNotifyRecurKeywords = {
 
  _strings : {
-  '518ad9ed87d3ca17e223a91604b464d5' :"Add / Edit Core Enum",
-  'cfcd208495d565ef66e7dff9f98764da' :"0",
-  'c4ca4238a0b923820dcc509a6f75849b' :"1",
+  '0ee0f676f631ad4e8a5844314a3a20de' :"Select campaign",
+  '1243daf593fa297e07ab03bf06d925af' :"Searching...",
   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
-  'e0aa021e21dddbd6d8cecec71e9cf564' :"OK"
+  'e0aa021e21dddbd6d8cecec71e9cf564' :"OK",
+  '790f855c2139f2faecb810519e90b833' :"Add Notification Keywords",
+  'ded4cba1b04eb8236e24a3e39470d8a7' :"Select Campaign"
  },
 
  dialog : false,
@@ -48,11 +49,11 @@ Pman.Dialog.CoreNotifyRecurKeywords = {
     background : true,
     closable : false,
     collapsible : false,
-    height : 150,
+    height : 180,
     modal : true,
     resizable : false,
-    title : _this._strings['518ad9ed87d3ca17e223a91604b464d5'],
-    width : 400,
+    title : _this._strings['790f855c2139f2faecb810519e90b833'],
+    width : 600,
     xns : Roo,
     xtype : 'LayoutDialog',
     buttons : [
@@ -75,15 +76,7 @@ Pman.Dialog.CoreNotifyRecurKeywords = {
        xtype : 'Button',
        listeners : {
         click : function() {
-         
-             var name =     _this.form.findField('name').getValue();
-             name = name.toUpperCase().replace(/[^A-Z]+/g, '');
-             if (!name.length) {
-                 Roo.MessageBox.alert("Error","Please fill in a valid name");
-                 return;
-             }
-             _this.form.findField('name').setValue(name);
-          
+             
              _this.form.doAction('submit');
              
          }
@@ -109,33 +102,32 @@ Pman.Dialog.CoreNotifyRecurKeywords = {
         '|xns' : 'Roo.form',
         method : 'POST',
         style : 'margin: 5px',
-        url : baseURL + '/Roo/core_enum.php',
+        url : baseURL + '/Roo/Core_notify_recur.php',
         xns : Roo.form,
         xtype : 'Form',
         listeners : {
          actioncomplete : function (_self, action)
           {
             if (action.type == 'setdata') {
-          
-                  if((typeof(_this.data.etype) == 'undefined') || !_this.data.etype.length){
-                      Roo.MessageBox.alert('Error', 'Missing etype');
-                      _this.dialog.hide();
-                      return;
-                  }
                   
-                  if(typeof(_this.data.title) != 'undefined' && _this.data.title.length){
-                      _this.dialog.setTitle(_this.data.title);
-                  }
-            
                   if(_this.data.id){
                       _this.dialog.el.mask("Loading");
                       this.load({ method: 'GET', params: { '_id' : _this.data.id }}); 
                   }
-                 
-                 return;
+                  
+                  return;
               }
               if (action.type == 'load') {
+                  
                   _this.dialog.el.unmask();
+                  
+                  _this.data = action.result.data;
+                  
+                  if(typeof(_this.data.keywords) != 'undefined'){
+                      var n = Roo.decode(_this.data.keywords);
+                      _this.form.findField('keyword_filters').setValue(n);
+                  }
+                  
                   return;
               }
               if (action.type == 'submit' ) {
@@ -155,57 +147,145 @@ Pman.Dialog.CoreNotifyRecurKeywords = {
         },
         items : [
          {
+          store : {
+           proxy : {
+            '|xns' : 'Roo.data',
+            method : 'GET',
+            url : baseURL + '/Roo/Projects.php',
+            xns : Roo.data,
+            xtype : 'HttpProxy'
+           },
+           reader : {
+            '|xns' : 'Roo.data',
+            fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
+            id : 'id',
+            root : 'data',
+            totalProperty : 'total',
+            xns : Roo.data,
+            xtype : 'JsonReader'
+           },
+           '|xns' : 'Roo.data',
+           remoteSort : true,
+           sortInfo : { direction : 'DESC', field: 'id' },
+           xns : Roo.data,
+           xtype : 'Store',
+           listeners : {
+            beforeload : function (_self, o){
+                 o.params = o.params || {};
+                 
+             }
+           },
+           items : [
+
+           ]
+
+          },
           '|xns' : 'Roo.form',
-          actionMode : 'fieldEl',
           allowBlank : false,
-          fieldLabel : 'Name',
-          hidden : true,
-          name : 'name',
-          width : 200,
+          alwaysQuery : true,
+          displayField : 'name',
+          editable : true,
+          emptyText : _this._strings['ded4cba1b04eb8236e24a3e39470d8a7'],
+          fieldLabel : 'Campaign',
+          forceSelection : true,
+          hiddenName : 'campaign_id',
+          listWidth : 400,
+          loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
+          minChars : 2,
+          name : 'campaign_id_name',
+          pageSize : 20,
+          qtip : _this._strings['0ee0f676f631ad4e8a5844314a3a20de'],
+          queryParam : 'query[name]',
+          selectOnFocus : true,
+          tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b></div>',
+          triggerAction : 'all',
+          typeAhead : false,
+          valueField : 'id',
+          width : 400,
           xns : Roo.form,
-          xtype : 'TextField'
+          xtype : 'ComboBox',
+          items : [
+
+          ]
+
          },
          {
+          combo : {
+           store : {
+            proxy : {
+             '|xns' : 'Roo.data',
+             method : 'GET',
+             url : baseURL + '/Roo/clipping_keywords.php',
+             xns : Roo.data,
+             xtype : 'HttpProxy'
+            },
+            reader : {
+             '|xns' : 'Roo.data',
+             fields : [{"name":"id","type":"int"},{"name":"keyword","type":"string"}],
+             id : 'code',
+             root : 'data',
+             totalProperty : 'total',
+             xns : Roo.data,
+             xtype : 'JsonReader'
+            },
+            '|xns' : 'Roo.data',
+            remoteSort : true,
+            sortInfo : { direction : 'ASC', field: 'display_name' },
+            xns : Roo.data,
+            xtype : 'Store',
+            listeners : {
+             beforeload : function (_self, o){
+                  o.params = o.params || {};
+                  
+                  var s = _this.form.findField('campaign_id').getValue() * 1;
+                  
+                  if(isNaN(s) || s < 1){
+                      return false;
+                  }
+                  
+                  o.params.is_active  = 1;
+                  o.params.is_keyword = 1;
+                  o.params.project_id = s;
+              }
+            },
+            items : [
+
+            ]
+
+           },
+           '|xns' : 'Roo.form',
+           allowBlank : true,
+           alwaysQuery : true,
+           displayField : 'keyword',
+           editable : true,
+           fieldLabel : 'Keyword',
+           forceSelection : true,
+           listWidth : 400,
+           minChars : 2,
+           queryParam : 'query[keyword]',
+           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{keyword}</b> </div>',
+           triggerAction : 'all',
+           valueField : 'id',
+           width : 400,
+           xns : Roo.form,
+           xtype : 'ComboBox',
+           items : [
+
+           ]
+
+          },
           '|xns' : 'Roo.form',
           allowBlank : false,
-          fieldLabel : 'Display Name',
-          name : 'display_name',
-          width : 200,
-          xns : Roo.form,
-          xtype : 'TextField',
-          listeners : {
-           keyup : function (_self, e)
-            {
-                _this.form.findField('name').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase());
-                
-            }
-          }
-         },
-         {
-          '|xns' : 'Roo.form',
-          actionMode : 'fieldEl',
-          checked : true,
-          fieldLabel : 'Active',
-          hidden : true,
-          inputValue : 1,
-          name : 'active',
-          value : 1,
-          valueOff : 0,
+          fieldLabel : 'Keywords',
+          hiddenName : 'keyword_filters',
+          name : 'keyword_filters_name',
+          width : 410,
           xns : Roo.form,
-          xtype : 'Checkbox'
-         },
-         {
-          '|xns' : 'Roo.form',
-          name : 'etype',
-          xns : Roo.form,
-          xtype : 'Hidden'
-         },
-         {
-          '|xns' : 'Roo.form',
-          name : 'seqid',
-          value : 0,
-          xns : Roo.form,
-          xtype : 'Hidden'
+          xtype : 'ComboBoxArray',
+          items : [
+
+          ]
+
          },
          {
           '|xns' : 'Roo.form',