diff --git a/CRM/Campaign/Page/DashBoard.php b/CRM/Campaign/Page/DashBoard.php index de364c9b6c134743061db9e4731cd3e0aaf97429..e0ac0c32c5f117d9e97500039c5f05e2b833b982 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 e24a871354191b144c97d5faeb7c82b12ebe6def..143692d66373324e73a966c5557b75dee160d623 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 e2381bf1557675f51fe60717b28df9303296ab05..3e112c955988886f08769ae1e73d9307c52d9cdf 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 3db967d021f8ed505151b7805b0222fa835ccbd9..a537f93d0ebc82eb77fdf5a82d6a69ff0d4818c6 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 f09d44c854da4e8deed897d54fdfb6794c08009b..935ad4996a475460db3b83ee8287102ea158e10e 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 *} - <div class="crm-block crm-content-block crm-campaign-page"> - - <div id="mainTabContainer" class="ui-tabs ui-widget ui-widget-content ui-corner-all"> - <ul class="crm-campaign-tabs-list"> - {foreach from=$allTabs key=tabName item=tabValue} - <li id="tab_{$tabValue.id}" class="crm-tab-button ui-corner-bottom"> - <a href="{$tabValue.url}" title="{$tabValue.title}"><span></span>{$tabValue.title}</a> - </li> - {/foreach} - </ul> - </div> - - -{literal} -<script type="text/javascript"> - -//explicitly stop spinner -function stopSpinner( ) { - cj('li.crm-tab-button').each(function(){ cj(this).find('span').text(' ');}) -} - -cj(document).ready( function( ) { - {/literal} - var spinnerImage = '<img src="{$config->resourceBase}i/loading.gif" style="width:10px;height:10px"/>'; - {literal} - - var selectedTabIndex = {/literal}{$selectedTabIndex}{literal}; - cj("#mainTabContainer").tabs( { - active: selectedTabIndex, - spinner: spinnerImage, - cache: true, - load: stopSpinner - }); -}); - -</script> -{/literal} -<div class="clear"></div> -</div> {* crm-content-block ends here *} + {include file="CRM/common/TabHeader.tpl" cache=true} + <div class="clear"></div> {/if} diff --git a/templates/CRM/Campaign/Page/Vote.tpl b/templates/CRM/Campaign/Page/Vote.tpl index 77035b08f991e875e316eee347afd9685f994a64..5342003fb77e52496795d7c74a45d20d848fd257 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 *} - <div id="mainTabContainer" class="ui-tabs ui-widget ui-widget-content ui-corner-all"> - <ul class="crm-vote-tabs-list"> - {foreach from=$allTabs key=tabName item=tabValue} - <li id="tab_{$tabValue.id}" class="crm-tab-button ui-corner-bottom"> - <a href="{$tabValue.url}" title="{$tabValue.title}"><span></span>{$tabValue.title}</a> - </li> - {/foreach} - </ul> - </div> - <div class="spacer"></div> - -{literal} -<script type="text/javascript"> - -//explicitly stop spinner -function stopSpinner( ) { - cj('li.crm-tab-button').each(function(){ cj(this).find('span').text(' ');}) -} - -cj(document).ready( function( ) { - {/literal} - var spinnerImage = '<img src="{$config->resourceBase}i/loading.gif" style="width:10px;height:10px"/>'; - {literal} - - var selectedTabIndex = {/literal}{$selectedTabIndex}{literal}; - cj("#mainTabContainer").tabs( { - active: selectedTabIndex, - spinner: spinnerImage, - cache: false, - load: stopSpinner - }); -}); - -</script> -{/literal} +{elseif $tabHeader} + {include file="CRM/common/TabHeader.tpl" cache=false} {else} <div class="messages status no-popup"> <div class="icon inform-icon"></div> diff --git a/templates/CRM/Contribute/Form/ContributionPage/Tab.tpl b/templates/CRM/Contribute/Form/ContributionPage/Tab.tpl index f4ad3a66467def8ce177fde2c62cd67e8d38e218..4ff476407b0a2e15a1bb65b3b0917d1276facbc5 100644 --- a/templates/CRM/Contribute/Form/ContributionPage/Tab.tpl +++ b/templates/CRM/Contribute/Form/ContributionPage/Tab.tpl @@ -46,7 +46,7 @@ </ul> <div class="clear"></div> </div> -{include file="CRM/common/TabHeader.tpl"} +{include file="CRM/common/TabHeader.tpl" cache=true} {literal} <script> diff --git a/templates/CRM/Event/Form/ManageEvent/Tab.tpl b/templates/CRM/Event/Form/ManageEvent/Tab.tpl index 4d659c01857e7590ff3b7c91e607bd907a256209..aca9a1e53baeeed878bce970d2af78a6eaeb666a 100644 --- a/templates/CRM/Event/Form/ManageEvent/Tab.tpl +++ b/templates/CRM/Event/Form/ManageEvent/Tab.tpl @@ -71,7 +71,7 @@ </div> {/if} -{include file="CRM/common/TabHeader.tpl"} +{include file="CRM/common/TabHeader.tpl" cache=true} {literal} <script> diff --git a/templates/CRM/common/TabHeader.tpl b/templates/CRM/common/TabHeader.tpl index e528d7df07a5782814614ac9a841b381292d90c3..353748da812de63ced6e0ef1a45ac240ffe828a4 100644 --- a/templates/CRM/common/TabHeader.tpl +++ b/templates/CRM/common/TabHeader.tpl @@ -67,13 +67,16 @@ }) .on('tabsbeforeload', function(e, ui) { + console.log(ui.panel.data()) // Use civicrm ajax wrappers rather than the default $.load - if (!ui.tab.data("loaded")) { + if (!ui.panel.data("civicrmCrmSnippet")) { CRM.loadPage($('a', ui.tab).attr('href'), { target: ui.panel }) } - ui.tab.data("loaded", true); + {/literal}{if empty($cache)} + else ui.panel.crmSnippet("refresh"); + {/if}{literal} e.preventDefault(); }) .tabs(tabSettings);