From dd7dcb6236dc8ed000cf9510a22fd2e5acae1039 Mon Sep 17 00:00:00 2001 From: Siddhant Rajagopalan Date: Fri, 11 Jul 2014 09:52:59 +0530 Subject: [PATCH] made a superselect2 box,validations --- CRM/Mailing/BAO/Mailing.php | 4 +- i/include.jpeg | Bin 0 -> 2256 bytes js/angular-newMailing.js | 140 +++++++++++++------ partials/crmMailingType/attachments.html | 15 +- partials/crmMailingType/content.html | 11 +- partials/crmMailingType/mailingGroup.html | 10 +- partials/crmMailingType/main.html | 38 ++--- partials/crmMailingType/preview_ht.html | 10 +- partials/crmMailingType/recipient.html | 9 +- partials/crmMailingType/sched.html | 4 +- partials/crmMailingType/trackandRespond.html | 2 +- 11 files changed, 164 insertions(+), 79 deletions(-) create mode 100644 i/include.jpeg diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 63edbeef69..6a1dc837bf 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/i/include.jpeg b/i/include.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..4de3dc56198824d5cc195a821daa1c82f61e975c GIT binary patch literal 2256 zcmY+Ec{tSj7stP225E#DGuA(LW?!?U zD^!*YiWy{-C41pox-~!U?~mW}JLh@c&+GZT&*z-;*I`UE762|&V-sTl1OfoiNdgQS z5DT!euyDaS5pWm+fkYsAd3X^BJ~$T=3Fj5y;W>HZ2+YL941u0I z1OB%F1TcXiFt`#k3%97g^-bS&9<;$VTfeBx;)ZcnF>w`}TNzo6O?{Ld1X4m-)zJSH zA-d$Gk-+J{|C<7a08GpvmJ?4F1~8oj2*e8c?+gIM1b|_1h^Ugan6kcaRB;0$eVopX zyvd*f?BJ75Ffa_z17@w_UbVJ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9`Oc;63<<|GmsfNJmUqR~9)w!B7iqOTg$7xL3L@_vJaY;mJqfv;^&O~s$05%YDc zO7^(MdoS>8AlANE4*%R%bkP;jjxOBADgy?2_mc4 zpFh9`l+_%5K>3Q~YZYE-U&9kd$H^Bl^iJb%9D<3BoNC<|+Crpan`EsvhZ(1NOhydl zlB+-JVYP74i`L1#OKYK3pY6Oa>NGwpQLvc^hb2G!z*87*)+0gog7%15Pl(LLmDJGi zLOVytgdg?InxC=v38=z=@XrQ&(WkkTz$1~RJPWMrGnmZlYF zzS$q-rf}H-V)cx!Iv!{x6%I{ zkxi=ep$KhirlR+Uau*#q8rHa}2bTJ-76%h#7QL*d7)v#0ewna2L@I_MaMKTj=mXP34y2K>U^E42Oee@(t)LjV3#zNj5w=lB0WwsXYoib*rQ*TY;n) zEEf3l`3=&O(OzoDEp_oH8u@R;Grj)`HD>h_F6nGcvdOf}a{Tao>|?WsmJ;)-tGpW1 zO1e(6Vg8qU;78pZQmS$Rb<^XS`=L_=1(;9|<4!h3# z1VQD{*IH~T4HR<^TeI$!F8+kR{oOq@E>Jq_PcLceq{iKlH~F=$^ocb)_lEw($Yff? z^x&Opmtn40sn3cAT&0h#I|=rcRbt&gEluM+a}e1$B*dy-SrYq*A6pBE cLh-V;eAbC271awCs|GNMg;-G&DaOoy0Qo8QfdBvi literal 0 HcmV?d00001 diff --git a/js/angular-newMailing.js b/js/angular-newMailing.js index ad307ba916..6d6a3fcfd4 100644 --- a/js/angular-newMailing.js +++ b/js/angular-newMailing.js @@ -33,7 +33,7 @@ } else { //created_id has been set to my id. Does not save without created_id. Needs to made generic based on the user - return {name: "New Mail", visibility: "Public Pages", url_tracking:"1", forward_replies:"0", created_id: "202", auto_responder:"0", open_tracking:"1", + return {visibility: "Public Pages", url_tracking:"1", forward_replies:"0", created_id: "202", auto_responder:"0", open_tracking:"1", }; } } @@ -45,7 +45,7 @@ //This controller is used in creating new mail and editing current mails - crmMailing.controller('mailingCtrl', function($scope, crmApi, selectedMail) { + crmMailing.controller('mailingCtrl', function($scope, crmApi, selectedMail, $location) { //Making some dummy api to see if my from email, reply to email works. To see if all options come in select box $scope.cool_api= [ @@ -60,6 +60,7 @@ 'reply_mail': 'rajgo94@gmail_3.com'} ]; //setting variables to the values we have got to the api + $scope.submitted = false; $scope.partialUrl = partialUrl; $scope.campaignList = CRM.crmMailing.campNames; $scope.mailList = CRM.crmMailing.civiMails; @@ -71,13 +72,54 @@ $scope.currentMailing = selectedMail; $scope.testGroup = ""; window.ct = $scope.currentMailing; + $scope.param = {}; + $scope.mailingForm = function() { + if ($scope.mailing_form.$valid) { + // Submit as normal + } else { + $scope.mailing_form.submitted = true; + } + } + $scope.back = function (){ + $location.path( "mailing" ); + }; + //initializing variables we will use for checkboxes, or for purpose of ng-show $scope.acttab=0; $scope.composeS="1"; - $scope.trackreplies="0"; + if($scope.currentMailing.forward_replies==0 && $scope.currentMailing.auto_responder==0){ + $scope.trackreplies="0"; + } + else { + $scope.trackreplies="1"; + } + $scope.now="1"; + + $scope.reply = function(){ + if($scope.trackreplies==0){ + $scope.trackreplies=1; + } + else{ + $scope.trackreplies=0; + $scope.currentMailing.forward_replies=0; + $scope.currentMailing.auto_responder=0; + } + } + + $scope.recclicked = function(){ + $scope.acttab=0; + }; + $scope.conclicked = function(){ + $scope.acttab=1; + }; + + $scope.schedclicked = function(){ + $scope.acttab=2; + }; + //to split the value of selectedMail.scheduled_date into the date and time separately $scope.scheddate={}; $scope.scheddate.date = ""; @@ -102,7 +144,7 @@ } else return false; - } + }; //filter so we only get headers from mailing component $scope.isHeader= function(hf){ return hf.component_type == "Header"; @@ -136,6 +178,19 @@ return ml.is_completed == 1; }; + $scope.upload = function(){ + console.log($scope.param.file); + }; + + $scope.upload_2 = function(){ + console.log($scope.param.file_2); + }; + + $scope.upload_3 = function(){ + console.log($scope.param.file_3); + }; + + $scope.save = function() { $scope.incGrp=[]; $scope.excGrp=[]; @@ -268,9 +323,30 @@ return { restrict : 'AE', link: function(scope,element, attrs){ + function format(item) { + if(!item.id) { + // return `text` for optgroup + return item.text; + } + // 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") + return "" + " " + "" + item.text; + if(a[1]=="mail" && a[2]=="include") + return "" + " " + "" + item.text; + if(a[1]=="mail" && a[2]=="exclude") + return "" + " " + "" + item.text; + } + $(element).select2({ width:"400px", placeholder: "Choose Recipients", + formatResult: format, + formatSelection: format, + escapeMarkup: function(m) { return m; } }); $(element).on('select2-selecting', function(e) { incGroup.push(e.val); @@ -283,55 +359,38 @@ // Used for the select date option. This is used for giving scheduled_date its date value 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; + var ngModelName = this.attributes['ng-model'].value; + scope[ngModelName] = date; + scope.$apply(); } }); } }; }); -/* - //browsing controller. to add selected files. not working currently - crmMailing.controller('browse', function($scope){ - $scope.fileList = []; - $('#fileupload').bind('fileuploadadd', function(e, data){ - // Add the files to the list - numFiles = $scope.fileList.length - for (var i=0; i < data.files.length; ++i) { - var file = data.files[i]; - // .$apply to update angular when something else makes changes - $scope.$apply( - $scope.fileList.push({name: file.name}) - ); + crmMailing.directive('file', function(){ + return { + scope: { + file: '=' + }, + link: function(scope, el, attrs){ + el.bind('change', function(event){ + var files = event.target.files; + var file = files[0]; + scope.file = file ? file.name : undefined; + scope.$apply(); + }); } - // Begin upload immediately - data.submit(); - }); + }; }); - //adding directive. to add selected files. not working currently - crmMailing.directive('add',function(){ - return { - restrict : 'AE', - link: function(scope,element, attrs){ - $(document).ready(function(){ - $('#fileupload').fileupload({ - dataType: 'json' - }); - }); - } - }; - }); -*/ + //This controller is used for creating the mailing list. Simply gets all the mailing data from civiAPI crmMailing.controller('mailingListCtrl', function($scope, crmApi, mailingList) { $scope.mailingList = mailingList.values; @@ -340,5 +399,6 @@ })(angular, CRM.$, CRM._); - - +/* example of params + [attachFile_1] => Array ( [uri] => /var/www/siddhant/drupal-7.27/sites/default/files/civicrm/custom/blog_2_odt_2c622a7b5e32415a92e81ed97d6554c7.unknown [type] => application/vnd.oasis.opendocument.text [location] => /var/www/siddhant/drupal-7.27/sites/default/files/civicrm/custom/blog_2_odt_2c622a7b5e32415a92e81ed97d6554c7.unknown [description] => dasdas [upload_date] => 20140706105804 [tag] => Array ( ) [attachment_taglist] => Array ( ) ) +*/ diff --git a/partials/crmMailingType/attachments.html b/partials/crmMailingType/attachments.html index e3ecc093bd..c710671963 100644 --- a/partials/crmMailingType/attachments.html +++ b/partials/crmMailingType/attachments.html @@ -4,19 +4,28 @@ Attach Files - + + + + Attach Files - + + + + Attach Files - + + + + diff --git a/partials/crmMailingType/content.html b/partials/crmMailingType/content.html index cb02d7952b..de922ff28b 100644 --- a/partials/crmMailingType/content.html +++ b/partials/crmMailingType/content.html @@ -25,9 +25,14 @@ Required Variables: cool_api and currentMailing and eMailing Mailing Subject - + + + + Mailing subject required. + + Use Template @@ -36,7 +41,7 @@ Required Variables: cool_api and currentMailing and eMailing - + I want to Compose on screen @@ -54,7 +59,7 @@ Required Variables: cool_api and currentMailing and eMailing
Upload Content
-