From 1dfafa8f5cad1813fa96d85ae29ba2195dcb0ba2 Mon Sep 17 00:00:00 2001 From: Siddhant Rajagopalan Date: Sat, 12 Jul 2014 23:21:44 +0530 Subject: [PATCH] groups remove and msg-templates --- CRM/Mailing/BAO/Mailing.php | 4 +-- CRM/Mailing/Info.php | 9 +++--- js/angular-newMailing.js | 34 ++++++++++++++++++-- partials/crmMailingType/composeonScreen.html | 2 +- partials/crmMailingType/content.html | 2 +- partials/crmMailingType/main.html | 22 ++++++------- partials/crmMailingType/preview_ht.html | 3 +- partials/crmMailingType/sched.html | 7 +++- 8 files changed, 58 insertions(+), 25 deletions(-) diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 6a1dc837bf..63edbeef69 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -1657,8 +1657,8 @@ ORDER BY civicrm_email.is_bulkmail DESC // Populate the recipients. $mailing->getRecipients($job->id, $mailing->id, NULL, NULL, TRUE, FALSE); } - // print_r($params); - // exit; + //print_r($params); + //exit; return $mailing; } diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index 0ad2bb5156..8021c26381 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -72,10 +72,11 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { 'return' => "email", 'contact_id' => 202, )); - $mesTemplate = civicrm_api3('MessageTemplate', 'get', array( 'sequential' => 1, - 'return' => "msg_title", - 'id' => array('>' => 58),) - ); + $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( diff --git a/js/angular-newMailing.js b/js/angular-newMailing.js index 6d6a3fcfd4..f2dec4c9d7 100644 --- a/js/angular-newMailing.js +++ b/js/angular-newMailing.js @@ -7,6 +7,7 @@ var crmMailing = angular.module('crmMailing', ['ngRoute', 'ui.utils']); var incGroup = []; + //------------------------------------------------------------------------------------------------------- crmMailing.config(['$routeProvider', function($routeProvider) { @@ -73,18 +74,41 @@ $scope.testGroup = ""; window.ct = $scope.currentMailing; $scope.param = {}; + $scope.tst="" + if($scope.currentMailing.msg_template_id!=null){ + $scope.tst=$scope.currentMailing.msg_template_id; + } + console.log($scope.tst); + $scope.mailingForm = function() { if ($scope.mailing_form.$valid) { // Submit as normal } else { $scope.mailing_form.submitted = true; } - } + }; $scope.back = function (){ $location.path( "mailing" ); }; + $scope.tmp = function (tst){ + console.log(tst); + $scope.currentMailing.msg_template_id=tst; + if($scope.currentMailing.msg_template_id == ""){ + $scope.currentMailing.body_html=""; + } + else{ + for(var a in $scope.tmpList){ + + if($scope.tmpList[a].id==$scope.currentMailing.msg_template_id){ + $scope.currentMailing.body_html=$scope.tmpList[a].msg_html; + } + } + } + }; + + //initializing variables we will use for checkboxes, or for purpose of ng-show $scope.acttab=0; $scope.composeS="1"; @@ -330,7 +354,6 @@ } // return item template var a = item.id.split(" "); - console.log(a); if(a[1]=="group" && a[2]=="include") return "" + " " + "" + item.text; if(a[1]=="group" && a[2]=="exclude") @@ -351,11 +374,16 @@ $(element).on('select2-selecting', function(e) { incGroup.push(e.val); console.log(incGroup); + }); + $(element).on("select2-removed", function(e) { + var index = incGroup.indexOf(e.val); + incGroup.splice(index, 1); + console.log(incGroup); }); } }; }); - + // Used for the select date option. This is used for giving scheduled_date its date value crmMailing.directive('chsdate',function(){ return { diff --git a/partials/crmMailingType/composeonScreen.html b/partials/crmMailingType/composeonScreen.html index e98b3f52dd..7953733ac0 100644 --- a/partials/crmMailingType/composeonScreen.html +++ b/partials/crmMailingType/composeonScreen.html @@ -10,7 +10,7 @@ - + diff --git a/partials/crmMailingType/content.html b/partials/crmMailingType/content.html index de922ff28b..fa12508f48 100644 --- a/partials/crmMailingType/content.html +++ b/partials/crmMailingType/content.html @@ -36,7 +36,7 @@ Required Variables: cool_api and currentMailing and eMailing diff --git a/partials/crmMailingType/main.html b/partials/crmMailingType/main.html index d205c29897..020b51485c 100644 --- a/partials/crmMailingType/main.html +++ b/partials/crmMailingType/main.html @@ -19,29 +19,29 @@ Submit Mailing is not functional yet
- - - + + +


- - - - + + + +


- - - - + + + +

diff --git a/partials/crmMailingType/preview_ht.html b/partials/crmMailingType/preview_ht.html index 900c6f65c0..1f1cc0dce4 100644 --- a/partials/crmMailingType/preview_ht.html +++ b/partials/crmMailingType/preview_ht.html @@ -4,8 +4,7 @@ Required vars: currentMailing The editor has to be added. Currently just a simple text editor --> - +
  Save Template
Use Template -