From 77ee3cc4b811b34abdf9c7ec485d3c6bcf014a3a Mon Sep 17 00:00:00 2001 From: Siddhant Rajagopalan Date: Mon, 23 Jun 2014 16:35:21 +0530 Subject: [PATCH] Header and footer done, auto-responder, some part of scheduling --- CRM/Mailing/Info.php | 6 +- js/angular-newMailing.js | 78 +++++++++++++------- partials/crmMailingType/headerandFooter.html | 6 +- partials/crmMailingType/mailingGroup.html | 4 +- partials/crmMailingType/sched.html | 6 +- partials/crmMailingType/test.html | 2 +- partials/crmMailingType/trackandRespond.html | 6 +- 7 files changed, 70 insertions(+), 38 deletions(-) diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index 0d43ae3705..15ce035548 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -65,14 +65,16 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { $civiMails = civicrm_api3('Mailing', 'get', array()); $campNames = civicrm_api3('Campaign', 'get', array()); $mailStatus = civicrm_api3('MailingJob', 'get', array()); - $groupNames = civicrm_api3('Group', 'get', array()); - + $groupNames = civicrm_api3('Group', 'get', array()); + $headerfooterList = civicrm_api3('MailingComponent', 'get', array()); + CRM_Core_Resources::singleton()->addSetting(array( 'crmMailing' => array( 'civiMails' => array_values($civiMails['values']), 'campNames' => array_values($campNames['values']), 'mailStatus' => array_values($mailStatus['values']), 'groupNames' => array_values($groupNames['values']), + 'headerfooterList' => array_values($headerfooterList['values']), ), )); return $result; diff --git a/js/angular-newMailing.js b/js/angular-newMailing.js index be85cf8d0f..f051e697e4 100644 --- a/js/angular-newMailing.js +++ b/js/angular-newMailing.js @@ -32,7 +32,7 @@ return crmApi('Mailing', 'getsingle', {id: $route.current.params.id}); } else { - return {name: "New Mail", visibility: "Public Pages", url_tracking:"1", forward_replies:"0", created_id: "202", auto_responder:"0", open_tracking:"1", + return {name: "New Mail", visibility: "Public Pages", url_tracking:"1", forward_replies:"0", created_id: "202", auto_responder:"0", open_tracking:"1", }; } } @@ -48,11 +48,12 @@ - crmMailing.controller('mailingCtrl', function($scope, crmApi, selectedMail) { - $scope.partialUrl = partialUrl; +crmMailing.controller('mailingCtrl', function($scope, crmApi, selectedMail) { + $scope.partialUrl = partialUrl; $scope.campaignList = CRM.crmMailing.campNames; $scope.mailNameList = _.pluck(CRM.crmCaseType.civiMails, 'name'); $scope.groupNamesList = CRM.crmMailing.groupNames; + $scope.headerfooter = CRM.crmMailing.headerfooterList; $scope.incGroup = []; $scope.excGroup = []; $scope.testGroup = []; @@ -62,8 +63,19 @@ $scope.composeS="1"; $scope.trackreplies="0"; $scope.now="1"; + $scope.scheddate={}; + $scope.scheddate.date = ""; + $scope.scheddate.time = ""; + $scope.ans=""; + $scope.mailAutoResponder=""; ///changing upload on screen +/* if(selectedMail.scheduled_date != ""){ + $scope.ans= selectedMail.scheduled_date.split(" "); + $scope.scheddate.date=$scope.ans[0]; + $scope.scheddate.time=$scope.ans[1]; + }*/ + console.log(selectedMail); $scope.upldChange= function(composeS){ if(composeS=="1"){ return true; @@ -72,6 +84,18 @@ return false; } + $scope.isHeader= function(hf){ + return hf.component_type == "Header"; + }; + + $scope.isFooter= function(f){ + return f.component_type == "Footer"; + }; + + $scope.isAuto= function(au){ + return au.component_type == "Auto-responder"; + }; + $scope.trackr= function(trackreplies){ if(trackreplies=="1"){ return true; @@ -94,6 +118,11 @@ $scope.save = function() { + $scope.currentMailing.scheduled_date= $scope.scheddate.date + " " + $scope.scheddate.time ; + if($scope.currentMailing.scheduled_date!=" "){ + $scope.currentMailing.scheduled_id= "202"; + $scope.currentMailing.scheduled_date= ""; + } var result = crmApi('Mailing', 'create', $scope.currentMailing, true); result.success(function(data) { if (data.is_error == 0) { @@ -156,7 +185,26 @@ }); - +crmMailing.directive('chsdate',function(){ + return { + scope :{ + dat : '=send_date' + }, + restrict: 'AE', + link: function(scope,element,attrs){ + $(element).datepicker({ + dateFormat: 'yy-mm-dd', + onSelect: function(date) { + $(".ui-datepicker a").removeAttr("href"); + scope.dat =date; + console.log(date); + } + }); + } + }; + }); + + crmMailing.controller('browse', function(){ FileUploadCtrl.$inject = ['$scope'] function FileUploadCtrl(scope) { @@ -259,28 +307,8 @@ function FileUploadCtrl(scope) { alert("The upload has been canceled by the user or the browser dropped the connection.") } } -}); +}); - crmMailing.directive('chsdate',function(){ - return { - scope :{ - dat : '=send_date' - }, - restrict: 'AE', - link: function(scope,element,attrs){ - $(element).datepicker({ - //dateFormat: 'yyyy-MM-dd HH:mm:ss', - onSelect: function(date) { - $(".ui-datepicker a").removeAttr("href"); - scope.dat =date; - console.log(date); - } - }); - } - }; - }); - - crmMailing.controller('mailingListCtrl', function($scope, crmApi, mailingList) { $scope.mailingList = mailingList.values; $scope.mailStatus = _.pluck(CRM.crmMailing.mailStatus, 'status'); diff --git a/partials/crmMailingType/headerandFooter.html b/partials/crmMailingType/headerandFooter.html index 6554d060ec..6275434549 100644 --- a/partials/crmMailingType/headerandFooter.html +++ b/partials/crmMailingType/headerandFooter.html @@ -4,8 +4,7 @@ Mailing Header - @@ -13,8 +12,7 @@ Mailing Footer - diff --git a/partials/crmMailingType/mailingGroup.html b/partials/crmMailingType/mailingGroup.html index 42bed40167..19ae7c99b4 100644 --- a/partials/crmMailingType/mailingGroup.html +++ b/partials/crmMailingType/mailingGroup.html @@ -3,12 +3,12 @@ Controller: CaseTypeCtrl Required vars: activitySet -->
-

-

diff --git a/partials/crmMailingType/sched.html b/partials/crmMailingType/sched.html index 526d881a4d..113c1d4de3 100644 --- a/partials/crmMailingType/sched.html +++ b/partials/crmMailingType/sched.html @@ -12,8 +12,12 @@ Schedule Mailing - + + Time + + + diff --git a/partials/crmMailingType/test.html b/partials/crmMailingType/test.html index 06e1b3502a..54167adb01 100644 --- a/partials/crmMailingType/test.html +++ b/partials/crmMailingType/test.html @@ -9,7 +9,7 @@ Send to this Group - diff --git a/partials/crmMailingType/trackandRespond.html b/partials/crmMailingType/trackandRespond.html index 1ca7869947..1183510a15 100644 --- a/partials/crmMailingType/trackandRespond.html +++ b/partials/crmMailingType/trackandRespond.html @@ -62,9 +62,9 @@   Auto-Respond to Replies     - + -- 2.25.1