CRM-15854 - crmMailing, crmMailingAB - Respect 'delete in CiviMail' permission
authorTim Otten <totten@civicrm.org>
Tue, 3 Mar 2015 02:35:23 +0000 (18:35 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 3 Mar 2015 03:56:38 +0000 (19:56 -0800)
CRM/Mailing/Info.php
js/angular-crmMailingAB.js
partials/crmMailing/edit-unified.html
partials/crmMailing/edit-unified2.html
partials/crmMailing/edit-wizard.html
partials/crmMailing/edit-workflow.html
partials/crmMailing/edit.html
partials/crmMailingAB/edit.html

index aefd0d23a4e18519e56806d1ecd4b78e5f7fee63..2f56018e10164736f0a92bd620c93ae0f6ef6115 100644 (file)
@@ -153,6 +153,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
       'create mailings',
       'schedule mailings',
       'approve mailings',
+      'delete in CiviMail',
     ));
 
     return $result;
index 3572b21687cd8b1593cd7e11044f2cbbdc9afd71..cc23dad906fe8064847f24536f4d82a6bcd4ca01 100644 (file)
@@ -66,6 +66,7 @@
     var myAutosave = null;
     $scope.crmMailingABCriteria = crmMailingABCriteria;
     $scope.crmMailingConst = CRM.crmMailing;
+    $scope.checkPerm = CRM.checkPerm;
 
     $scope.isSubmitted = function isSubmitted() {
       return _.size(abtest.mailings.a.jobs) > 0 || _.size(abtest.mailings.b.jobs) > 0;
index ca1ef5cf1c029acb522cc529390b131032acba44..ef4b2ad66b2c27c2bf38516a72269adf7ec78728 100644 (file)
 
     <button crm-icon="check" ng-disabled="block.check() || crmMailing.$invalid" ng-click="submit()">{{ts('Submit Mailing')}}</button>
     <button crm-icon="disk" ng-disabled="block.check()" ng-click="save().then(leave)">{{ts('Save Draft')}}</button>
-    <button crm-icon="trash" ng-disabled="block.check()" crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}" on-yes="delete()">{{ts('Delete Draft')}}</button>
+    <button
+      crm-icon="trash"
+      ng-show="checkPerm('delete in CiviMail')"
+      ng-disabled="block.check()"
+      crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}"
+      on-yes="delete()">{{ts('Delete Draft')}}</button>
   </div>
 </form>
index 464e89058ca346754bc92638d11bec2c9ff7c659..7f1ef824a2f812b2a7212718422033e1212ab300 100644 (file)
 
     <button crm-icon="check" ng-disabled="block.check() || crmMailing.$invalid" ng-click="submit()">{{ts('Submit Mailing')}}</button>
     <button crm-icon="disk" ng-disabled="block.check()" ng-click="save().then(leave)">{{ts('Save Draft')}}</button>
-    <button crm-icon="trash" ng-disabled="block.check()" crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}" on-yes="delete()">{{ts('Delete Draft')}}</button>
+    <button
+      crm-icon="trash"
+      ng-show="checkPerm('delete in CiviMail')"
+      ng-disabled="block.check()"
+      crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}"
+      on-yes="delete()">{{ts('Delete Draft')}}</button>
   </div>
 </form>
index 9e2ba6a11293ac79387d75b41d517e18e0323518..ef2a8eef0bf3a7c2143b2996119eae3201abc35b 100644 (file)
       </div>
 
       <span crm-ui-wizard-buttons style="float:right;">
-        <button crm-icon="trash" ng-disabled="block.check()" crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}" on-yes="delete()">{{ts('Delete Draft')}}</button>
+        <button
+          crm-icon="trash"
+          ng-show="checkPerm('delete in CiviMail')"
+          ng-disabled="block.check()"
+          crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}"
+          on-yes="delete()">{{ts('Delete Draft')}}</button>
         <button crm-icon="disk" ng-disabled="block.check()" ng-click="save().then(leave)">{{ts('Save Draft')}}</button>
       </span>
     </div>
index 7b00de8fb26eb25e5f21238eb58a2cbc17074971..740f42846642594de22f06e9808b700bb2cb5ce0 100644 (file)
       </div>
 
       <span crm-ui-wizard-buttons style="float:right;">
-        <button crm-icon="trash" ng-disabled="block.check()" crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}" on-yes="delete()">{{ts('Delete Draft')}}</button>
+        <button
+          crm-icon="trash"
+          ng-show="checkPerm('delete in CiviMail')"
+          ng-disabled="block.check()"
+          crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}"
+          on-yes="delete()">{{ts('Delete Draft')}}</button>
         <button crm-icon="disk" ng-disabled="block.check()" ng-click="save().then(leave)">{{ts('Save Draft')}}</button>
       </span>
     </div>
index 0d6f08e3b64e936705001dd0e2180ca988cc7fb3..8e581bfaf30c0caae17e56143c8f696495560b9a 100644 (file)
       </div>
 
       <span crm-ui-wizard-buttons style="float:right;">
-        <button crm-icon="trash" ng-disabled="block.check()" crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}" on-yes="delete()">{{ts('Delete Draft')}}</button>
+        <button
+          crm-icon="trash"
+          ng-show="checkPerm('delete in CiviMail')"
+          ng-disabled="block.check()"
+          crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}"
+          on-yes="delete()">{{ts('Delete Draft')}}</button>
         <button crm-icon="disk" ng-disabled="block.check()" ng-click="save().then(leave)">{{ts('Save Draft')}}</button>
       </span>
     </div>
index 357d96fcc62a6cacbe9cd49b5be5b52f89fc1e89..75a7c5ea56faf7ef092cd94bc448f5fc5bddf023 100644 (file)
       <span crm-ui-wizard-buttons style="float:right;">
         <button
           crm-icon="trash"
+          ng-show="checkPerm('delete in CiviMail')"
           ng-disabled="block.check()"
           crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}"
           on-yes="delete()">{{ts('Delete Draft')}}