Changed select 2 and civiplugin
authoraditya-nambiar <aditya.nambiar007@gmail.com>
Wed, 16 Jul 2014 12:59:21 +0000 (18:29 +0530)
committeraditya-nambiar <aditya.nambiar007@gmail.com>
Sat, 26 Jul 2014 04:51:00 +0000 (10:21 +0530)
CRM/Mailing/Info.php
js/angular-crmMailingAB.js
partials/abtesting/main.html

index a6dac2971381df22d8dcd7c65073d6d7e3a5b976..1800117e83d7e1884b12a1303c08dca72bd63b71 100644 (file)
@@ -63,15 +63,31 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
         'css' => array('css/angular-crmMailingAB.css'),
       );
 
-      $compMails = civicrm_api3('Mailing', 'get', array());
+
+      $civiMails = civicrm_api3('Mailing', 'get', array());
       $campNames = civicrm_api3('Campaign', 'get', array());
-      $vargroups = civicrm_api3('Group', 'get', array());
+      $mailStatus = civicrm_api3('MailingJob', 'get', array());
+      $groupNames = civicrm_api3('Group', 'get', array());
+      $headerfooterList = civicrm_api3('MailingComponent', 'get', array());
+      $emailAdd = civicrm_api3('Email', 'get', array(
+      'sequential' => 1,
+      'return' => "email",
+      'contact_id' => 202,
+      ));
+      $mesTemplate = civicrm_api3('MessageTemplate', 'get', array( 'sequential' => 1,
+      'return' => array("msg_html", "id", "msg_title"),
+      'id' => array('>' => 58),
+      ));
 
       CRM_Core_Resources::singleton()->addSetting(array(
         'crmMailing' => array(
-          'compMails' => array_values($compMails['values']),
+          'civiMails' => array_values($civiMails['values']),
           'campNames' => array_values($campNames['values']),
-          'vargroups' => array_values($vargroups['values']),
+          'mailStatus' => array_values($mailStatus['values']),
+          'groupNames' => array_values($groupNames['values']),
+          'headerfooterList' => array_values($headerfooterList['values']),
+          'mesTemplate' => array_values($mesTemplate['values']),
+          'emailAdd' => array_values($emailAdd['values']),
           ),
         ));
 
index 89860a2840646b13985ddf8b1a8eba97b9d947cb..4a3d2dc51108987e392f4face5c7329b841b6c52 100644 (file)
@@ -37,9 +37,7 @@
                 templateUrl: partialUrl('main.html'),
                 controller: 'TabsDemoCtrl',
                 resolve: {
-                    metaData: function($route, crmApi) {
-                        return crmApi('Group', 'get', {});
-                    },
+
                     mailingList: function($route, crmApi) {
                         return crmApi('Mailing', 'get', {});
                     }
     // Add a new record by name.
     // Ex: <crmAddName crm-options="['Alpha','Beta','Gamma']" crm-var="newItem" crm-on-add="callMyCreateFunction(newItem)" />
 
-    crmMailingAB.controller('TabsDemoCtrl', function($scope, crmApi, metaData, mailingList) {
+    crmMailingAB.controller('TabsDemoCtrl', function($scope, crmApi) {
+
+        $scope.groups= CRM.crmMailing.groupNames;
+        $scope.mailList = CRM.crmMailing.civiMails;
 
-        $scope.groups = metaData.values;
-        $scope.mailings = mailingList.values;
         $scope.tab_val=0;
         $scope.max_tab=0;
         $scope.campaign_clicked= function(){
        return {
            restrict : 'AE',
            link: function(scope,element, attrs){
-               $(element).select2({width:"400px",placeholder: "Select the groups you wish to include"});
-               $(element).select2("data",groups)
                function format(item) {
                    if(!item.id) {
                        // return `text` for optgroup
index 0b2cbb2b3171f05a3ea2a75ea9fc775281703265..b959244576b97d563c78a165652048119373e2bd 100644 (file)
@@ -49,8 +49,8 @@
                 <select multiple groupselect ng-model="incGroup">
                     <option id= "1" ng-repeat="grp in groups" value="{{grp.id}} group include" > {{grp.title}} </option>
                     <option ng-repeat="grp in groups" value="{{grp.id}} group exclude" > {{grp.title}} </option>
-                    <option ng-repeat="ml in mailList| filter:isCompMail" value="{{ml.id}} mail include" > {{ml.name}} </option>
-                    <option ng-repeat="ml in mailList| filter:isCompMail" value="{{ml.id}} mail exclude" > {{ml.name}} </option>
+                    <option ng-repeat="ml in mailList" value="{{ml.id}} mail include" > {{ml.name}} </option>
+                    <option ng-repeat="ml in mailList" value="{{ml.id}} mail exclude" > {{ml.name}} </option>
                 </select>
                 <br> <br><br><br>