From 349a45b706061a3a2d85368e97dc380616d21bb5 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 26 Dec 2013 17:26:16 -0800 Subject: [PATCH] CRM-14015 CRM-13863 - Fix enable/disable and crmEditable to work with campaigns tabs & datatables --- CRM/Campaign/Page/DashBoard.php | 28 ++++---- CRM/Campaign/Page/Vote.php | 13 ++-- css/civicrm.css | 2 +- templates/CRM/Campaign/Form/Survey/Tab.tpl | 2 +- templates/CRM/Campaign/Page/DashBoard.tpl | 64 ++----------------- templates/CRM/Campaign/Page/Vote.tpl | 39 +---------- .../Contribute/Form/ContributionPage/Tab.tpl | 2 +- templates/CRM/Event/Form/ManageEvent/Tab.tpl | 2 +- templates/CRM/common/TabHeader.tpl | 7 +- 9 files changed, 35 insertions(+), 124 deletions(-) diff --git a/CRM/Campaign/Page/DashBoard.php b/CRM/Campaign/Page/DashBoard.php index de364c9b6c..e0ac0c32c5 100644 --- a/CRM/Campaign/Page/DashBoard.php +++ b/CRM/Campaign/Page/DashBoard.php @@ -420,31 +420,29 @@ class CRM_Campaign_Page_DashBoard extends CRM_Core_Page { } function browse() { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - $this->_tabs = array('campaign' => ts('Campaigns'), + $this->_tabs = array( + 'campaign' => ts('Campaigns'), 'survey' => ts('Surveys'), 'petition' => ts('Petitions'), ); $subPageType = CRM_Utils_Request::retrieve('type', 'String', $this); if ($subPageType) { + if (!isset($this->_tabs[$subPageType])) { + CRM_Utils_System::permissionDenied(); + } //load the data in tabs. $this->{'browse' . ucfirst($subPageType)}(); + $this->assign('subPageType', ucfirst($subPageType)); } else { //build the tabs. $this->buildTabs(); } - $this->assign('subPageType', $subPageType); //give focus to proper tab. - $selectedTabIndex = array_search(strtolower(CRM_Utils_Array::value('subPage', $_GET, 'campaign')), - array_keys($this->_tabs) - ); - if (!$selectedTabIndex) { - $selectedTabIndex = array_search('campaign', array_keys($this->_tabs)); - } - $this->assign('selectedTabIndex', $selectedTabIndex); + $selectedTabIndex = strtolower(CRM_Utils_Array::value('subPage', $_GET, 'campaign')); + $this->assign('selectedTab', $selectedTabIndex); } function run() { @@ -460,14 +458,14 @@ class CRM_Campaign_Page_DashBoard extends CRM_Core_Page { function buildTabs() { $allTabs = array(); foreach ($this->_tabs as $name => $title) { - $allTabs[] = array( - 'id' => $name, + $allTabs[$name] = array( 'title' => $title, - 'url' => CRM_Utils_System::url('civicrm/campaign', "reset=1&type=$name&snippet=1"), + 'valid' => TRUE, + 'active' => TRUE, + 'link' => CRM_Utils_System::url('civicrm/campaign', "reset=1&type=$name"), ); } - - $this->assign('allTabs', $allTabs); + $this->assign('tabHeader', $allTabs); } } diff --git a/CRM/Campaign/Page/Vote.php b/CRM/Campaign/Page/Vote.php index e24a871354..143692d663 100644 --- a/CRM/Campaign/Page/Vote.php +++ b/CRM/Campaign/Page/Vote.php @@ -115,23 +115,22 @@ class CRM_Campaign_Page_Vote extends CRM_Core_Page { continue; } - $urlParams = "type={$name}&snippet=1"; + $urlParams = "type={$name}"; if ($this->_surveyId) { $urlParams .= "&sid={$this->_surveyId}"; } if ($this->_interviewerId) { $urlParams .= "&cid={$this->_interviewerId}"; } - $allTabs[] = array( - 'id' => $name, + $allTabs[$name] = array( 'title' => $title, - 'url' => CRM_Utils_System::url('civicrm/campaign/vote', - $urlParams - ), + 'valid' => TRUE, + 'active' => TRUE, + 'link' => CRM_Utils_System::url('civicrm/campaign/vote', $urlParams), ); } - $this->assign('allTabs', empty($allTabs) ? FALSE : $allTabs); + $this->assign('tabHeader', empty($allTabs) ? FALSE : $allTabs); } } diff --git a/css/civicrm.css b/css/civicrm.css index e2381bf155..3e112c9559 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -1760,7 +1760,7 @@ editor specific classes position: relative; padding: 0px 14px 0 5px; background: url("../i/TreePlus.gif") no-repeat right 1px; - border-left: none; + white-space: nowrap; z-index: 2; } diff --git a/templates/CRM/Campaign/Form/Survey/Tab.tpl b/templates/CRM/Campaign/Form/Survey/Tab.tpl index 3db967d021..a537f93d0e 100644 --- a/templates/CRM/Campaign/Form/Survey/Tab.tpl +++ b/templates/CRM/Campaign/Form/Survey/Tab.tpl @@ -24,4 +24,4 @@ +--------------------------------------------------------------------+ *} -{include file="CRM/common/TabHeader.tpl"} +{include file="CRM/common/TabHeader.tpl" cache=true} diff --git a/templates/CRM/Campaign/Page/DashBoard.tpl b/templates/CRM/Campaign/Page/DashBoard.tpl index f09d44c854..935ad4996a 100644 --- a/templates/CRM/Campaign/Page/DashBoard.tpl +++ b/templates/CRM/Campaign/Page/DashBoard.tpl @@ -25,67 +25,13 @@ *} {* CiviCampaign DashBoard (launch page) *} -{* build the campaign selector *} -{if $subPageType eq 'campaign'} - {* load the campaign search and selector here *} - {include file="CRM/Campaign/Form/Search/Campaign.tpl"} - -{* build the survey selector *} -{elseif $subPageType eq 'survey'} - - {* load the survey search and selector here *} - {include file="CRM/Campaign/Form/Search/Survey.tpl"} - -{* build normal page *} -{elseif $subPageType eq 'petition'} - - {* load the petition search and selector here *} - {include file="CRM/Campaign/Form/Search/Petition.tpl"} - -{* build normal page *} +{if !empty($subPageType)} + {* load campaign/survey/petition tab *} + {include file="CRM/Campaign/Form/Search/$subPageType.tpl"} {else} - - {* enclosed all tabs and its content in a block *} -
- -
-
    - {foreach from=$allTabs key=tabName item=tabValue} -
  • - {$tabValue.title} -
  • - {/foreach} -
-
- - -{literal} - -{/literal} -
-
{* crm-content-block ends here *} + {include file="CRM/common/TabHeader.tpl" cache=true} +
{/if} diff --git a/templates/CRM/Campaign/Page/Vote.tpl b/templates/CRM/Campaign/Page/Vote.tpl index 77035b08f9..5342003fb7 100644 --- a/templates/CRM/Campaign/Page/Vote.tpl +++ b/templates/CRM/Campaign/Page/Vote.tpl @@ -30,43 +30,8 @@ {elseif $subPageType eq 'reserve'} {* build the ajax search and voters reserve interface here *} {include file='CRM/Campaign/Form/Gotv.tpl'} -{elseif $allTabs} - {* build normal page *} -
- -
-
- -{literal} - -{/literal} +{elseif $tabHeader} + {include file="CRM/common/TabHeader.tpl" cache=false} {else}
diff --git a/templates/CRM/Contribute/Form/ContributionPage/Tab.tpl b/templates/CRM/Contribute/Form/ContributionPage/Tab.tpl index f4ad3a6646..4ff476407b 100644 --- a/templates/CRM/Contribute/Form/ContributionPage/Tab.tpl +++ b/templates/CRM/Contribute/Form/ContributionPage/Tab.tpl @@ -46,7 +46,7 @@
-{include file="CRM/common/TabHeader.tpl"} +{include file="CRM/common/TabHeader.tpl" cache=true} {literal}