return $returnUrl;
}
+ /**
+ * @param $url
+ * @param $mailing_id
+ *
+ * return int Url id of the given url and mail
+ */
+ public static function getTrackerURLId($url, $mailing_id) {
+ $tracker = new CRM_Mailing_BAO_TrackableURL();
+ $tracker->url = $url;
+ $tracker->mailing_id = $mailing_id;
+ if ($tracker->find(TRUE)) {
+ return $tracker->id;
+ }
+
+ return NULL;
+ }
+
/**
* @param $msg
* @param $mailing_id
'return' => array("msg_html", "id", "msg_title"),
'id' => array('>' => 58),
));
+ $mailTokens = civicrm_api3('Mailing', 'get_token', array( 'usage' => 'Mailing'));
CRM_Core_Resources::singleton()->addSetting(array(
'crmMailing' => array(
'headerfooterList' => array_values($headerfooterList['values']),
'mesTemplate' => array_values($mesTemplate['values']),
'emailAdd' => array_values($emailAdd['values']),
+ 'mailTokens' => array_values($mailTokens),
),
));
return civicrm_api3_create_success($mailDelivered);
}
+function civicrm_api3_mailing_get_token($params) {
+ if (!array_key_exists("usage", $params)) {
+ throw new API_Exception('Mandatory keys missing from params array: entity');
+ }
+
+ $tokens = CRM_Core_SelectValues::contactTokens();
+ switch ($params['usage']) {
+ case 'Mailing' :
+ $tokens = array_merge(CRM_Core_SelectValues::mailingTokens(), $tokens);
+ break;
+ case 'ScheduleEventReminder' :
+ $tokens = array_merge(CRM_Core_SelectValues::activityTokens(), $tokens);
+ $tokens = array_merge(CRM_Core_SelectValues::eventTokens(), $tokens);
+ $tokens = array_merge(CRM_Core_SelectValues::membershipTokens(), $tokens);
+ break;
+ case 'ManageEventScheduleReminder' :
+ $tokens = array_merge(CRM_Core_SelectValues::eventTokens(), $tokens);
+ break;
+ }
+
+ return CRM_Utils_Token::formatTokensForDisplay($tokens);
+
+}
+
/**
* Adjust Metadata for send_mail action
*
}
return civicrm_api3_create_success();
+}
+
+/**
+ * Adjust Metadata for graph_stats action
+ *
+ * The metadata is used for setting defaults, documentation & validation
+ * @param array $params array or parameters determined by getfields
+ */
+function _civicrm_api3_mailing_a_b_graph_stats_spec(&$params) {
+ $params['split_count']['api.default'] = 6;
+ $params['split_count_select']['api.required'] = 1;
+ }
+
+/**
+ * Send graph detail for A/B tests mail
+ *
+ * @param array $params
+ * @return array
+ */
+function civicrm_api3_mailing_a_b_graph_stats($params) {
+ civicrm_api3_verify_mandatory($params,
+ 'CRM_Mailing_DAO_MailingAB',
+ array('id'),
+ FALSE
+ );
+
+ $mailingAB = civicrm_api3('MailingAB', 'get', array('id' => $params['id']));
+ $mailingAB = $mailingAB['values'][$params['id']];
+
+ $optionGroupValue = civicrm_api3('OptionValue', 'get', array('option_group_name' => 'mailing_ab_winner_criteria', 'value' => $mailingAB['winner_criteria_id']));
+ $winningCriteria = $optionGroupValue['values'][$optionGroupValue['id']]['name'];
+
+ $graphStats = array();
+ $ABFormat = array('A' => 'mailing_id_a', 'B' => 'mailing_id_b');
+
+ foreach ($ABFormat as $name => $column) {
+ switch ($winningCriteria) {
+ case 'Open':
+ $totalCounts = CRM_Mailing_Event_BAO_Opened::getTotalCount($mailingAB[$column]);
+ $rowCount = round($totalCounts / $params['split_count']);
+ $offset = $rowCount * ($params['split_count_select'] - 1);
+ $graphStats[$name] = CRM_Mailing_Event_BAO_Opened::getRows($mailingAB[$column], NULL, FALSE, $offset, $rowCount, "{$open}.time_stamp ASC");
+ break;
+ case 'Total Unique Clicks':
+ $totalCounts = CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($mailingAB[$column]);
+ $rowCount = round($totalCounts / $params['split_count']);
+ $offset = $rowCount * ($params['split_count_select'] - 1);
+ $graphStats[$name] = CRM_Mailing_Event_BAO_TrackableURLOpen::getRows($mailingAB[$column], NULL, FALSE, NULL, $offset, $rowCount, "{$click}.time_stamp ASC");
+ break;
+ case 'Total Clicks on a particular link':
+ if (empty($params['url'])) {
+ throw new API_Exception("Provide url to get stats result for '{$winningCriteria}'");
+ }
+ $url_id = CRM_Mailing_BAO_TrackableURL::getTrackerURLId($mailingAB[$column], $params['url']);
+ $totalCounts = CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], NULL, FALSE, $url_id);
+ $rowCount = round($totalCounts / $params['split_count']);
+ $offset = $rowCount * ($params['split_count_select'] - 1);
+ $graphStats[$name] = CRM_Mailing_Event_BAO_TrackableURLOpen::getRows($mailingAB[$column], NULL, FALSE, $url_id, $offset, $rowCount, "{$click}.time_stamp ASC");
+ break;
+ }
+ }
+
+ return civicrm_api3_create_success($graphStats);
}
\ No newline at end of file
}
div#frag1 {
- height:500px;
+ height:600px;
width:800px;
overflow: auto;
position: relative;
}
div#frag2 {
- height:500px;
+ height:600px;
width:800px;
overflow: auto;
}
\ No newline at end of file
var partialUrl = function (relPath) {
return CRM.resourceUrls['civicrm'] + '/partials/abtesting/' + relPath;
};
-
+ var mltokens = [];
var crmMailingAB = angular.module('crmMailingAB', ['ngRoute', 'ui.utils', 'ngSanitize']);
var mltokens = [];
crmMailingAB.run(function ($rootScope, $templateCache) {
{
time: 2,
x: 6,
- y: 8,
+ y: 8
},
{
time: 3,
x: 10,
- y: 9,
+ y: 9
},
{
time: 4,
x: 13,
- y: 11,
+ y: 11
}
]
console.log(selectedABTest);
if (selectedABTest.winner_criteria_id == 1) {
- $scope.winner_criteria = "Open";
+ $scope.winnercriteria = "Open";
}
else {
if (selectedABTest.winner_criteria_id == 2) {
- $scope.winner_criteria = "Total Unique Clicks";
+ $scope.winnercriteria = "Total Unique Clicks";
}
else {
if (selectedABTest.winner_criteria_id == 3) {
- $scope.winner_criteria = "Total Clicks on a particular link";
+ $scope.winnercriteria = "Total Clicks on a particular link";
}
}
}
+
+ var result = crmApi('Mailing','stats',{mailing_id : selectedABTest.mailing_id_a});
+ $scope.r=[];
+ result.success(function (data) {
+ $scope.rtt= data;
+ $scope.r.push(data.values[selectedABTest.mailing_id_a]["Delivered"].toString());
+ $scope.r.push(data.values[selectedABTest.mailing_id_a]["Bounces"].toString());
+ $scope.r.push(data.values[selectedABTest.mailing_id_a]["Unsubscribers"].toString());
+ $scope.r.push(data.values[selectedABTest.mailing_id_a]["Opened"].toString());
+ $scope.r.push(data.values[selectedABTest.mailing_id_a]["Unique Clicks"].toString());
+ $scope.$apply();
+ });
+ console.log($scope.rtt)
+
+ $scope.d=[];
+ result = crmApi('Mailing','stats',{mailing_id : selectedABTest.mailing_id_b});
+ result.success(function (data) {
+ $scope.d.push(data.values[selectedABTest.mailing_id_b]["Delivered"].toString());
+ $scope.d.push(data.values[selectedABTest.mailing_id_b]["Bounces"].toString());
+ $scope.d.push(data.values[selectedABTest.mailing_id_b]["Unsubscribers"].toString());
+ $scope.d.push(data.values[selectedABTest.mailing_id_b]["Opened"].toString());
+ $scope.d.push(data.values[selectedABTest.mailing_id_b]["Unique Clicks"].toString());
+ $scope.$apply();
+ });
+ console.log($scope.d);
+
+ var numdiv = 5;
+
+ for (i = 0; i < numdiv; i++) {
+ var result = crmApi('MailingAB', 'graph_stats',{id : selectedABTest.id, stats_count : numdiv, stat_count_select : i});
+ result.success(function (data) {
+ console.log(data);
+ });
+ }
+
+
});
crmMailingAB.controller('crmABTestingTabsCtrl', function ($scope, crmApi, selectedABTest, $sce) {
$scope.eMailing = CRM.crmMailing.emailAdd;
$scope.tmpList = CRM.crmMailing.mesTemplate;
$scope.headerfooter = CRM.crmMailing.headerfooterList;
- $scope.emailadd = "";
+ $scope.sparestuff ={};
+ $scope.sparestuff.emailadd = "";
+ $scope.sparestuff.winnercriteria = "";
+ mltokens = CRM.crmMailing.mailTokens;
if ($scope.currentABTest.declare_winning_time != null) {
$scope.ans = $scope.currentABTest.declare_winning_time.split(" ");
$scope.currentABTest.date = $scope.ans[0];
$scope.currentABTest.time = $scope.ans[1];
}
+ $scope.token = [];
if ($scope.currentABTest.just_created != 1) {
$scope.abId = $scope.currentABTest.id;
];
if ($scope.currentABTest.just_created != 1) {
- $scope.template = $scope.templates[$scope.currentABTest.testing_criteria_id - 1];
+ $scope.sparestuff.template = $scope.templates[$scope.currentABTest.testing_criteria_id - 1];
}
else {
- $scope.template = $scope.templates[0];
+ $scope.sparestuff.template = $scope.templates[0];
}
- mltokens = CRM.crmMailing.mailTokens;
+
$scope.deliberatelyTrustDangerousSnippeta = function () {
- return $sce.trustAsHtml($scope.previewa);
+ return $sce.trustAsHtml($scope.sparestuff.previewa);
};
$scope.deliberatelyTrustDangerousSnippetb = function () {
- return $sce.trustAsHtml($scope.previewb);
+ return $sce.trustAsHtml($scope.sparestuff.previewb);
};
$scope.tab_val = 0;
}
};
- $scope.winner_criteria = "";
$scope.compose_clicked = function () {
if ($scope.max_tab >= 1) {
$scope.tab_val = 1;
}
};
- $scope.reply = function () {
+/* $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.mailA.forward_replies = 0;
+ $scope.mailA.auto_responder = 0;
}
}
-
+*/
$scope.isAuto = function (au) {
return au.component_type == "Reply";
};
$scope.saveb = function (dat) {
var flag = 0;
var result = crmApi('Mailing', 'create', dat, true);
- console.log(result);
result.success(function (data) {
if (data.is_error == 0) {
$scope.mailB.id = data.id;
});
};
- $scope.previewa = "";
+ $scope.sparestuff.previewa = "";
$scope.pre = function () {
$scope.preview = true;
}
$scope.init = function (par) {
if (par == "3") {
- $scope.template.url = partialUrl('from_name.html');
+ $scope.sparestuff.template.url = partialUrl('from_name.html');
}
else {
if (par == "2") {
- $scope.template.url = partialUrl('subject_lines.html');
+ $scope.sparestuff.template.url = partialUrl('subject_lines.html');
}
else {
- $scope.template.url = partialUrl('two_emails.html');
+ $scope.sparestuff.template.url = partialUrl('two_emails.html');
}
}
$scope.whatnext = par.toString()
$scope.tp1 = {};
$scope.create_abtest = function () {
var result;
- $scope.currentABTest.testing_criteria_id = $scope.template.val;
+ $scope.currentABTest.testing_criteria_id = $scope.sparestuff.template.val;
if ($scope.abId == "") {
- result = crmApi('MailingAB', 'create', {name: $scope.currentABTest.name, testing_criteria_id: $scope.template.val});
+ result = crmApi('MailingAB', 'create', {name: $scope.currentABTest.name, testing_criteria_id: $scope.sparestuff.template.val});
}
else {
if (typeof $scope.currentABTest.mailing_id_a == 'undefined') {
- result = crmApi('MailingAB', 'create', {id: $scope.abId, testing_criteria_id: $scope.template.val});
+ result = crmApi('MailingAB', 'create', {id: $scope.abId, testing_criteria_id: $scope.sparestuff.template.val});
}
else {
- result = crmApi('MailingAB', 'create', {id: $scope.abId, testing_criteria_id: $scope.template.val, mailing_id_a: $scope.currentABTest.mailing_id_a, mailing_id_b: $scope.currentABTest.mailing_id_b});
+ result = crmApi('MailingAB', 'create', {id: $scope.abId, testing_criteria_id: $scope.sparestuff.template.val, mailing_id_a: $scope.currentABTest.mailing_id_a, mailing_id_b: $scope.currentABTest.mailing_id_b});
}
}
}
});
};
+ $scope.tokenfunc = function(elem,e,chng){
+ var msg = document.getElementById(elem).value;
+ var cursorlen = document.getElementById(elem).selectionStart;
+ var textlen = msg.length;
+ document.getElementById(elem).value = msg.substring(0, cursorlen) + e.val + msg.substring(cursorlen, textlen);
+ chng = msg.substring(0, cursorlen) + e.val + msg.substring(cursorlen, textlen);
+ var cursorPos = (cursorlen + e.val.length);
+ document.getElementById(elem).selectionStart = cursorPos;
+ document.getElementById(elem).selectionEnd = cursorPos;
+ document.getElementById(elem).focus();
+ };
+ $scope.sparestuff.ingrps = "";
+ $scope.sparestuff.excgrps = "";
$scope.a_b_update = function () {
$scope.tp1.include = $scope.incGroupids;
$scope.tp1.exclude = $scope.excGroupids;
resulta.success(function (data) {
if (data.is_error == 0) {
console.log("came");
- $scope.previewa = data.values.html;
+ $scope.sparestuff.previewa = data.values.html;
}
});
resulta.success(function (data) {
if (data.is_error == 0) {
console.log("came");
- console.log(data.values.html);
- $scope.previewb = data.values.html;
+ $scope.sparestuff.previewb = data.values.html;
}
});
+
+ $scope.startabtest = function(){
+ console.log("yo");
+ var result = crmApi('MailingAB', 'send_mail', {id: $scope.abId,
+ scheduled_date : $scope.sparestuff.date , scheduled_date_time: $scope.currentABTest.latertime});
+
+ }
+
+ angular.forEach($scope.incGroup, function(value) {
+ $scope.sparestuff.ingrps += value.toString()+", ";
+ });
+ angular.forEach($scope.excGroup, function(value) {
+ $scope.sparestuff.excgrps += value.toString()+", ";
+ });
+ if($scope.sparestuff.ingrps.length != 0){
+ $scope.sparestuff.ingrps = $scope.sparestuff.ingrps.substr(0,$scope.sparestuff.ingrps.length-2);
+ }
+ if($scope.sparestuff.excgrps.length != 0){
+ $scope.sparestuff.excgrps = $scope.sparestuff.excgrps.substr(0,$scope.sparestuff.excgrps.length-2);
+ }
+
}
$scope.update_abtest = function () {
$scope.currentABTest.declare_winning_time = $scope.currentABTest.date + " " + $scope.currentABTest.time;
result = crmApi('MailingAB', 'create', {id: $scope.abId,
- testing_criteria_id: $scope.template.val,
+ testing_criteria_id: $scope.sparestuff.template.val,
mailing_id_a: $scope.currentABTest.mailing_id_a,
mailing_id_b: $scope.currentABTest.mailing_id_b,
mailing_id_c: $scope.currentABTest.mailing_id_c,
+ specific_url :$scope.currentABTest.acturl,
winner_criteria_id: $scope.currentABTest.winner_criteria_id,
group_percentage: $scope.currentABTest.group_percentage,
declare_winning_time: $scope.currentABTest.declare_winning_time
});
};
-
+ $scope.currentABTest.latertime = "";
$scope.tmp = function (tst, aorb) {
if (aorb == 1) {
$scope.mailA.msg_template_id = tst;
$('#prevmail').dialog({
title: 'Preview Mailing',
width: 1080,
- height: 800,
+ height: 700,
closed: false,
cache: false,
modal: true,
+ position : {
+ my: 'left',
+ at: 'top',
+ of: $(".crmABTestingAllTabs")
+
+
+ },
+
close: function () {
console.log("close");
$scope.preview = false;
$scope.$apply();
}
});
+
+ $("#prevmail").dialog('option', 'position', [300, 50]);
}
+
}, true);
+ $scope.call = function(){
+ console.log($scope.emailadd);
+ $scope.$apply();
+ var result = crmApi('Mailing','send_test',{
+ mailing_id : $scope.currentABTest.mailing_id_a,
+ test_email : $scope.sparestuff.emailadd
+ });
+
+ var result = crmApi('Mailing','send_test',{
+ mailing_id : $scope.currentABTest.mailing_id_b,
+ test_email : $scope.sparestuff.emailadd
+ })
+ console.log($scope.sparestuff.emailadd);
+
+ }
$scope.$watch('sendtest', function () {
+
if ($scope.sendtest == true) {
$('#sendtest').dialog({
title: 'Send Test Mails',
- width: 380,
- height: 200,
+ width: 300,
+ height: 150,
closed: false,
cache: false,
modal: true,
buttons: {
'Send': function () {
- var result = crmApi('Mailing','send_test',{
- mailing_id : $scope.currentABTest.mailing_id_a,
- test_email : $scope.emailadd
- });
-
- var result = crmApi('Mailing','send_test',{
- mailing_id : $scope.currentABTest.mailing_id_b,
- test_email : $scope.emailadd
- })
- console.log($scope.emailadd);
+ $scope.call();
+
$scope.sendtest = false;
$('#sendtest').dialog("close");
if (scope.tab_val == 2) {
scope.update_abtest();
if (scope.currentABTest.winner_criteria_id == 1) {
- scope.winner_criteria = "Open";
+ scope.sparestuff.winnercriteria = "Open";
+ scope.$apply();
}
else {
if (scope.currentABTest.winner_criteria_id == 2) {
- scope.winner_criteria = " Total Unique Clicks";
+ scope.sparestuff.winnercriteria = " Total Unique Clicks";
+ scope.$apply();
}
else {
if (scope.currentABTest.winner_criteria_id == 3) {
- scope.winner_criteria = "Total Clicks on a particular link";
+ scope.sparestuff.winnercriteria = "Total Clicks on a particular link";
+ scope.$apply();
}
}
}
});
- crmMailingAB.directive('groupselect', function () {
- return {
- restrict: 'AE',
- link: function (scope, element, attrs) {
- $(element).select2({width: "200px", data: mltokens, placeholder: "Insert Token"});
-
-
- $(element).on('select2-selecting', function (e) {
- scope.$evalAsync('_resetSelection()');
- console.log(mltokens);
- /* if(scope.currentMailing.body_html == null){
- scope.currentMailing.body_html = e.val;
- }
- else
- scope.currentMailing.body_html = scope.currentMailing.body_html + e.val;
- */
- var msg = document.getElementById("body_html").value;
- var cursorlen = document.getElementById("body_html").selectionStart;
- console.log(cursorlen);
- var textlen = msg.length;
- document.getElementById("body_html").value = msg.substring(0, cursorlen) + e.val + msg.substring(cursorlen, textlen);
- scope.currentMailing.body_html = msg.substring(0, cursorlen) + e.val + msg.substring(cursorlen, textlen);
- console.log(document.getElementById("body_html").value);
- console.log(scope.currentMailing.body_html);
- var cursorPos = (cursorlen + e.val.length);
- document.getElementById("body_html").selectionStart = cursorPos;
- document.getElementById("body_html").selectionEnd = cursorPos;
- document.getElementById("body_html").focus();
- scope.$apply();
- e.preventDefault();
- })
-
- }
- };
-
- });
-
crmMailingAB.directive('sliderbar', function () {
return{
restrict: 'AE',
restrict: 'AE',
link: function (scope, element, attrs) {
$(element).datepicker({
- dateFormat: "yy-mm-dd",
+ dateFormat: "dd-mm-yy",
onSelect: function (date) {
$(".ui-datepicker a").removeAttr("href");
- scope.scheddate.date = date.toString();
+ scope.sparestuff.date = date.toString();
scope.$apply();
- console.log(scope.scheddate.date);
+ console.log(scope.sparestuff.date);
}
});
}
// map one colour each to x, y and z
// keys grabs the key value or heading of each key value pair in the json
// but not time
- console.log("Key");
+ // console.log("Key");
- console.log(d3.keys(data[0]));
+ //console.log(d3.keys(data[0]));
color.domain(d3.keys(data[0]).filter(function (key) {
return key !== "time";
}));
// create a nested series for passing to the line generator
// it's best understood by console logging the data
var series = color.domain().map(function (name) {
- console.log(name);
+ // console.log(name);
return {
name: name,
values: data.map(function (d) {
- console.log("------");
- console.log(d);
+ // console.log("------");
+ // console.log(d);
return {
time: d.time,
score: +d[name]
})
};
});
- console.log("Series");
+ //console.log("Series");
- console.log(series);
+ // console.log(series);
// Set the dimensions of the canvas / graph
var margin = {
svg.append("text") // text label for the x axis
.style("text-anchor", "middle")
- .text(scope.winner_criteria).attr("transform",function (d) {
+ .text(scope.winnercriteria).attr("transform",function (d) {
return "rotate(-90)"
}).attr("x", -height / 2)
.attr("y", -30);
series.append("path")
.attr("class", "line")
.attr("d", function (d) {
- console.log(d); // to see how d3 iterates through series
+ // console.log(d); // to see how d3 iterates through series
return valueline(d.values);
})
.style("stroke", function (d) {
}
});
+ crmMailingAB.directive('groupselect',function(){
+ return {
+ restrict : 'AE',
+ link: function(scope,element, attrs){
+ $(element).select2({width:"200px", data: mltokens, placeholder:"Insert Token"});
+ $(element).on('select2-selecting', function(e) {
+
+ scope.$evalAsync('_resetSelection()');console.log(mltokens);
+ var a = $(element).attr('id');
+ if(a=="htgroupcompose"){scope.tokenfunc("body_html",e,scope.mailA.body_html);}
+ else if(a=="htgroupcomposetwob"){scope.tokenfunc("twomailbbody_html",e,scope.mailB.body_html);}
+ else if(a=="htgroupcomposetwoa"){scope.tokenfunc("twomailabody_html",e,scope.mailA.body_html);}
+ else if(a=="textgroupcompose"){scope.tokenfunc("body_text",e,scope.mailA.body_text);}
+ else if(a=="textgroupcomposetwoa"){scope.tokenfunc("twomailabody_text",e,scope.mailA.body_text);}
+ else if(a=="textgroupcomposetwob"){scope.tokenfunc("twomailbbody_text",e,scope.mailB.body_text);}
+ else if(a=="subgroupsuba"){scope.tokenfunc("suba",e,scope.mailA.subject);}
+ else if(a=="subgroupsubb"){scope.tokenfunc("subb",e,scope.mailB.subject);}
+ else if(a=="subgroupfrom"){scope.tokenfunc("subfrom",e,scope.mailA.subject);}
+ else if(a=="subgrouptwoa"){scope.tokenfunc("twomaila",e,scope.mailA.subject);}
+ else if(a=="subgrouptwob"){scope.tokenfunc("twomailb",e,scope.mailB.subject);}
+
+
+ scope.$apply();
+ e.preventDefault();
+ })
+ }
+ };
+ });
+
+ crmMailingAB.directive('checktimeentry',function(){
+ return {
+ restrict :'AE',
+ link: function (scope, element, attrs) {
+ $(element).timeEntry({show24Hours:true});
+ }
+ }
+
+ });
+
})(angular, CRM.$, CRM._);
--- /dev/null
+<div class="crm-accordion-wrapper ">
+ <div class="crm-accordion-wrapper ">
+ <div class="crm-accordion-header">HTML Format</div>
+ <div class="crm-accordion-body">
+ <br>
+                                                
+                                                
+                                
+ <input type="hidden" groupselect id= "htgroupcompose" ></input><br><br>
+        
+ <textarea id = "body_html" ng-model="mailA.body_html" style="width: 600px; height: 300px;" required></textarea>
+ <br> <br>
+ </div>
+ </div>
+
+ <div class="crm-accordion-wrapper collapsed">
+ <div class="crm-accordion-header">Plain Text</div>
+ <div class="crm-accordion-body">
+ <br>
+                                                
+                                                
+                                
+ <input type="hidden" groupselect id= "textgroupcompose" ></input>
+ <br> <br>
+        
+ <textarea id = "body_text" ng-model="mailA.body_text" style="width: 600px; height: 300px;" > </textarea>
+ <br>
+ </div>
+ </div>
+</div>
\ No newline at end of file
+++ /dev/null
-hi
\ No newline at end of file
<tr>
<td class="label">From E-mail Address A</td>
<td>
- <select style="width: 200px" ng-model="mailA.from_email" ng-options="frm.email as frm.email for frm in eMailing">
+ <select style="width: 200px" ng-model="mailA.from_email" ng-options="frm.email as frm.email for frm in eMailing" required>
<option value="">-none-</option>
</select>
</td>
<tr>
<td class="label">From E-mail Address B</td>
<td>
- <select style="width: 200px" ng-model="mailB.from_email" ng-options="frm.email as frm.email for frm in eMailing">
+ <select style="width: 200px" ng-model="mailB.from_email" ng-options="frm.email as frm.email for frm in eMailing" required>
<option value="">-none-</option>
</select>
</td>
<td class="label">Reply to E-mail Address</td>
<td>
<select style="width: 200px" ng-model="mailA.replyto_email"
- ng-options="frm.email as frm.email for frm in eMailing">
+ ng-options="frm.email as frm.email for frm in eMailing" >
<option value="">-none-</option>
</select>
</td>
<tr>
<td class="label">Mailing Subject</td>
<td>
- <input placeholder="Enter Subject" name="subject" type="text" ng-model="mailA.subject"/>
+ <input id= "subfrom" placeholder="Enter Subject" name="subject" type="text" ng-model="mailA.subject" required>
</td>
</tr>
+ <tr>
+ <td class="label">Mailing Subject Token</td>
+ <td>
+ <input type="hidden" groupselect id= "subgroupfrom" ng-model="token" ></input>
+ </td>
+ </tr>
<tr>
<td class="label" style="color:red" ng-show="mailing_form.subject.$invalid">
Mailing subject required.
<td class="label">Use Template</td>
<td>
<select ng-change="tmp(mailA.msg_template_id,3)" ng-model="mailA.msg_template_id"
- ng-options="mstemp.id as mstemp.msg_title for mstemp in tmpList">
+ ng-options="mstemp.id as mstemp.msg_title for mstemp in tmpList" >
<option value="">-none-</option>
</select>
</td>
</tr>
- <tr ng-show="false">
- <td class="label">I want to</td>
- <td class="label">Compose on screen</td>
- <td><input type="radio" ng-model="composeS" value="1"/></td>
- <td class="label">Upload Content</td>
- <td><input type="radio" ng-model="composeS" value="0"/></td>
- </tr>
+
</tbody>
</table>
<br>
-<div class="crm-accordion-wrapper collapsed">
- <div class="crm-accordion-wrapper collapsed">
- <div class="crm-accordion-header">HTML Format</div>
- <div class="crm-accordion-body">
- <br>
-        
- <textarea ng-model="mailA.body_html" style="width: 600px; height: 300px;"></textarea>
- <br> <br>
- </div>
- </div>
-
- <div class="crm-accordion-wrapper collapsed">
- <div class="crm-accordion-header">Plain Text</div>
- <div class="crm-accordion-body">
- <br>
-        
- <textarea ng-model="mailA.body_text" style="width: 600px; height: 300px;"></textarea>
- <br>
- </div>
- </div>
-
- <table ng-show="false">
- <tr>
- <td>
- <input type="checkbox">  Save Template</input>
- </tr>
- </table>
-</div>
-
+<div ng-include = "partialUrl('compose.html')"></div>
<div ng-include="partialUrl('headerfooter.html')"></div>
\ No newline at end of file
-{{tab_val}}
+{{tab_val}}<br>
+ {{winnercriteria}}
<div ui-jq="tabs" class="crmABTestingAllTabs" ui-options="{show: true, hide: true, collapsible: true}">
<ul>
<li><a href="#tabs-1" ng-click="campaign_clicked();">Campaign</a></li>
}
.axis path, .axis line {
fill: none;
- stroke: #000;
+ stroke:#000;
shape-rendering: crispEdges;
}
</style>
<div id="grph" ></div>
<div linegraph></div>
+ {{r5}}
<table style ="position: relative; right :-425px; top:-250px; width :250px;">
<tr >
<th>Details</th>
<th style="width :90px;">Version A</th>
<th style="width :90px;">Version B</th>
</tr>
- <tr ng-repeat="d in data">
- <td></td>
- <td></td>
- <td></td>
+ <tr>
+ <td>Delivered</td>
+ <td>{{r[0]}}</td>
+ <td>{{d[0]}}</td>
+ </tr>
+ <tr>
+ <td>Bounces</td>
+ <td>{{r[1]}}</td>
+ <td>{{d[1]}}</td>
+ </tr>
+ <tr>
+ <td>Unsuscribers</td>
+ <td>{{r[2]}}</td>
+ <td>{{d[2]}}</td>
+ </tr>
+ <tr>
+ <td>Opened</td>
+ <td>{{r[3]}}</td>
+ <td>{{d[3]}}</td>
+ </tr>
+ <tr>
+ <td>Unique Clicks</td>
+ <td>{{r[4]}}</td>
+ <td>{{d[4]}}</td>
</tr>
-
</table>
<br><br>
<hr>
- <table style="position: relative; left :40px;">
+ <table>
<tbody>
<tr >
<td>
- <input type="radio" name="stop"> Stop Test and Send Version A
+ <input type="radio" name="stop" > Stop Test and Send Version A
</td>
<td>
<tr>
<td class="label">From E-mail Address</td>
<td>
- <select style="width: 200px" ng-model="mailA.from_email" ng-options="frm.email as frm.email for frm in eMailing">
+ <select style="width: 200px" ng-model="mailA.from_email" ng-options="frm.email as frm.email for frm in eMailing" >
<option value="">-none-</option>
</select>
</td>
<td class="label">Reply to E-mail Address</td>
<td>
<select style="width: 200px" ng-model="mailA.replyto_email"
- ng-options="frm.email as frm.email for frm in eMailing">
+ ng-options="frm.email as frm.email for frm in eMailing" >
<option value="">-none-</option>
</select>
</td>
<tr>
<td class="label">Mailing Subject A</td>
<td>
- <input placeholder="Enter Subject A" name="subject_a" type="text" ng-model="mailA.subject" required/>
+ <input placeholder="Enter Subject A" id="suba" name="subject_a" type="text" ng-model="mailA.subject" required/>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">Mailing Subject Token</td>
+ <td>
+ <input type="hidden" groupselect id= "subgroupsuba" ></input>
</td>
</tr>
<tr>
<td class="label">Mailing Subject B</td>
<td>
- <input placeholder="Enter Subject B" name="subject_b" type="text" ng-model="mailB.subject" required/>
+ <input placeholder="Enter Subject B" id="subb" name="subject_b" type="text" ng-model="mailB.subject" required/>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">Mailing Subject Token</td>
+ <td>
+ <input type="hidden" groupselect id= "subgroupsubb" ></input>
</td>
</tr>
-
<tr>
<td class="label" style="color:red" ng-show="mailing_form.subject.$invalid">
Mailing subject required.
<td class="label">Use Template</td>
<td>
<select ng-change="tmp(mailA.msg_template_id,3)" ng-model="mailA.msg_template_id"
- ng-options="mstemp.id as mstemp.msg_title for mstemp in tmpList">
+ ng-options="mstemp.id as mstemp.msg_title for mstemp in tmpList" >
<option value="">-none-</option>
</select>
</td>
<br>
-<div class="crm-accordion-wrapper collapsed">
- <div class="crm-accordion-wrapper collapsed">
- <div class="crm-accordion-header">HTML Format</div>
- <div class="crm-accordion-body">
- <br>
- <!--<input type="hidden" groupselect ng-model="token" ></input>-->
- <br> <br>
-        
- <textarea id="body_html" ng-model="mailA.body_html" style="width: 600px; height: 300px;"></textarea>
- <br> <br>
- </div>
- </div>
-
- <div class="crm-accordion-wrapper collapsed">
- <div class="crm-accordion-header">Plain Text</div>
- <div class="crm-accordion-body">
- <br>
-        
- <textarea ng-model="mailA.body_text" style="width: 600px; height: 300px;"></textarea>
- <br>
- </div>
- </div>
-
- <table ng-show="false">
- <tr>
- <td>
- <input type="checkbox">  Save Template</input>
- </tr>
- </table>
-</div>
+<div ng-include = "partialUrl('compose.html')"></div>
<div ng-include="partialUrl('headerfooter.html')"></div>
<input type="text" ng-model="currentABTest.name" class="big crm-form-text" required><br><br><br>
<h3> What would you like to test?</h3><br><br>
-   <input type="radio" ng-model="template" ng-value="templates[0]" ng-click="init(2)"
- ng-checked="template.val==1">
+   <input type="radio" ng-model="sparestuff.template" ng-value="templates[0]" ng-click="init(2)"
+ ng-checked="currentABTest.testing_criteria_id==1">
Subject Lines <br/><br>
-   <input type="radio" ng-model="template" ng-value="templates[1]" ng-click="init(3)"
- ng-checked="template.val==2">
+   <input type="radio" ng-model="sparestuff.template" ng-value="templates[1]" ng-click="init(3)"
+ ng-checked="currentABTest.testing_criteria_id==2">
From Names <br/><br>
-   <input type="radio" ng-model="template" ng-value="templates[2]" ng-click="init(1)"
- ng-checked="template.val==3">
+   <input type="radio" ng-model="sparestuff.template" ng-value="templates[2]" ng-click="init(1)"
+ ng-checked="currentABTest.testing_criteria_id==3">
Two different Emails <br/><br>
 
<form name="tab2Form" unsaved-warning-form>
<div class="crm-block crm-form-block crmABTesting">
- <div ng-include="template.url"></div>
+ <div ng-include="sparestuff.template.url"></div>
<div class="crm-submit-buttons">
<span class="crm-button">
<input type="submit" ng-click="tab2Form.$setPristine();" value="Previous" submitform prevtab/>
</span>
<span class="crm-button">
- <input type="submit" ng-click="tab2Form.$setPristine();" value="Next" submitform nexttab="{{tab_val}}"/>
+ <input type="submit" ng-click="tab2Form.$setPristine();" value="Next" ng-disabled="tab2Form.$invalid" submitform nexttab="{{tab_val}}"/>
</span>
<span class="crm-button">
<input type="submit" ng-click="tab2Form.$setPristine(); goto('mailing/abtesting');" value="Cancel"/>
<h3>Select the size of your test group</h3><br>
  Percentage Selected - {{currentABTest.group_percentage}}%
- <div sliderbar id="trial" style="margin: 10px;"></div>
+ <div sliderbar id="trial" style="margin: 10px;" required></div>
<h3>How will the winner be decided</h3><br>
  <input type="radio" ng-model="currentABTest.winner_criteria_id" value=1 name="cri" required> Open <br/><br>
  <input type="radio" ng-model="currentABTest.winner_criteria_id" value=2 name="cri" checked="checked">
Total Unique Clicks <br/><br>
  <input type="radio" ng-model="currentABTest.winner_criteria_id" value=3 name="cri"> Total
- Clicks on a particular link <br/><br>
+ Clicks on a particular link <br/>
+        <input type="text" ng-show="currentABTest.winner_criteria_id==3" ng-model="currentABTest.acturl">
+ <br>
<h3>Declare the winner by when?</h3><br>
<table>
<tr>
<td class="label">Date</td>
<td>
- <input type="text" chsdate ng-model="currentABTest.date">
+ <input type="text" chsdate ng-model="currentABTest.date" required>
</td>
<td class="label">Time</td>
<td>
- <input type="text" placeholder="hh:mm:ss" ng-model="currentABTest.time">
+ <input type="text" placeholder="hh:mm" ng-model="currentABTest.time" checktimeentry required>
</td>
</tr>
</tbody>
<input type="submit" ng-click="tab3Form.$setPristine();update_abtest();" value="Previous" prevtab/>
</span>
<span class="crm-button">
- <input type="submit" ng-click="tab3Form.$setPristine();update_abtest();" value="Next" nexttab="{{tab_val}}"/>
+ <input type="submit" ng-click="tab3Form.$setPristine();update_abtest();" ng-disabled="tab3Form.$invalid" value="Next" nexttab="{{tab_val}}"/>
</span>
<span class="crm-button">
<input type="submit" ng-click="tab3Form.$setPristine(); goto('mailing/abtesting');" value="Cancel"/>
<table>
<tr>
<td>Test Criteria</td>
- <td>{{template.name}}</td>
+ <td>{{sparestuff.template.name}}</td>
</tr>
<tr>
<td>Groups Included</td>
- <td>{{incGroup}}</td>
+ <td>{{sparestuff.ingrps}}</td>
</tr>
<tr>
<td>Groups Excluded</td>
- <td>{{excGroup}}</td>
+ <td>{{sparestuff.excgrps}}</td>
</tr>
<tr>
<td>Size of Test Group</td>
</tr>
<tr>
<td>Winner Criteria</td>
- <td>{{winner_criteria}}</td>
+ <td>{{sparestuff.winnercriteria}}</td>
</tr>
<tr>
<td>Declare Winner By</td>
<h3 ng-click="sendTestMailing();">Send Test Emails</h3>
<div ng-show="sendtest" id="sendtest">
- <input type="text" ng-model="emailadd">
+ Email-id :  <input placeholder = "abcd@civicrm.org" type="text" ng-model="sparestuff.emailadd">
</div>
<h3>When to Start</h3><br>
<div>
<input type="radio" name="Start" ng-model="start" value="now"> Now  
<input type="radio" name="Start" ng-model="start" value="later"> Later
-     <input type="text" class="dateplugin" ng-show="start=='later'" ng-model="send_date" datepick>
+ <div ng-show="start=='later'">
+     <input type="text" class="dateplugin" ng-model="send_date" datepick>
+     Time :<input type="text" placeholder="hh:mm" ng-model="currentABTest.latertime" checktimeentry >
+ </div>
</div>
<br><br>
<input type="submit" ng-click="tab4Form.$setPristine();" value="Previous" prevtab/>
</span>
<span class="crm-button">
- <input type="submit" ng-click="tab4Form.$setPristine();" value="Submit & Send"/>
+ <input type="submit" ng-click="tab4Form.$setPristine(); startabtest(); goto('mailing/abtesting');" value="Submit & Send"/>
</span>
<span class="crm-button">
<input type="submit" ng-click="tab4Form.$setPristine(); goto('mailing/abtesting');" value="Cancel"/>
<td class="label">From E-mail Address</td>
<td>
<select style="width: 200px" ng-model="mailA.from_email"
- ng-options="frm.email as frm.email for frm in eMailing">
+ ng-options="frm.email as frm.email for frm in eMailing" >
<option value="">-none-</option>
</select>
</td>
<tr>
<td class="label">Mailing Subject</td>
<td>
- <input placeholder="Enter Subject" name="subject" type="text" ng-model="mailA.subject"/>
+ <input placeholder="Enter Subject" name="subject" id="twomaila" type="text" ng-model="mailA.subject" required>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">Mailing Subject Token</td>
+ <td>
+ <input type="hidden" groupselect id= "subgrouptwoa" ></input>
</td>
</tr>
+
<tr>
<td class="label" style="color:red" ng-show="mailing_form.subject.$invalid">
Mailing subject required.
<br>
- <div class="crm-accordion-wrapper collapsed">
- <div class="crm-accordion-wrapper collapsed">
+ <div class="crm-accordion-wrapper ">
+ <div class="crm-accordion-wrapper ">
<div class="crm-accordion-header">HTML Format</div>
<div class="crm-accordion-body">
<br>
-                                    
-  
-          
-                                    
-  
-          
+                                                
+                                                
                               
- ss
- <!-- <input type="hidden" groupselect ng-model="token" ></input>-->
- <br> <br>
+ <input type="hidden" groupselect id= "htgroupcomposetwoa" ></input><br><br>
+
       
- <textarea id="body_html" ng-model="mailA.body_html" style="width: 600px; height: 300px;"></textarea>
+ <textarea ng-model="mailA.body_html" id="twomailabody_html" style="width: 600px; height: 300px;" required></textarea>
<br> <br>
</div>
<div class="crm-accordion-wrapper collapsed">
<div class="crm-accordion-header">Plain Text</div>
<div class="crm-accordion-body">
-
<br>
+                                                
+                                                
+                                
+ <input type="hidden" groupselect id= "textgroupcomposetwoa" ></input><br><br>
+
       
- <textarea ng-model="mailA.body_text" style="width: 600px; height: 300px;"></textarea>
+ <textarea ng-model="mailA.body_text" id="twomailabody_text" style="width: 600px; height: 300px;"></textarea>
<br>
</div>
</div>
<tr>
<td class="label">Mailing Subject</td>
<td>
- <input placeholder="Enter Subject" name="subject" type="text" ng-model="mailB.subject"/>
+ <input placeholder="Enter Subject" id = "twomailb" name="subject" type="text" ng-model="mailB.subject"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">Mailing Subject Token</td>
+ <td>
+ <input type="hidden" groupselect id= "subgrouptwob" ></input>
</td>
</tr>
-
<tr>
<td class="label" style="color:red" ng-show="mailing_form.subject.$invalid">
Mailing subject required.
</table>
<br>
- <div class="crm-accordion-wrapper collapsed">
- <div class="crm-accordion-wrapper collapsed">
+ <div class="crm-accordion-wrapper ">
+ <div class="crm-accordion-wrapper ">
<div class="crm-accordion-header">HTML Format</div>
<div class="crm-accordion-body">
<br>
- <br> <br>
+                                                
+                                                
+                                
+ <input type="hidden" groupselect id= "htgroupcomposetwob" ></input><br><br>
       
- <textarea id="body_html" ng-model="mailB.body_html" style="width: 600px; height: 300px;"></textarea>
+ <textarea id="twomailbbody_html" ng-model="mailB.body_html" style="width: 600px; height: 300px;"></textarea>
<br> <br>
</div>
</div>
<div class="crm-accordion-header">Plain Text</div>
<div class="crm-accordion-body">
<br>
+                                                
+                                                
+                                
+ <input type="hidden" groupselect id= "textgroupcomposetwob" ></input><br><br>
       
- <textarea ng-model="mailB.body_text" style="width: 600px; height: 300px;"></textarea>
+ <textarea ng-model="mailB.body_text" id = "twomailbbody_text" style="width: 600px; height: 300px;"></textarea>
<br>
</div>
</div>