Commit 43d7b8fe authored by jonnybradley's avatar jonnybradley

[FIX] tabs: cleanup default tab selection for trackers admin (and calendar edit)

parent 37dfd997
......@@ -55,14 +55,15 @@ function smarty_block_tabset($params, $content, &$smarty, &$repeat) {
$smarty_tabset_i_tab = 1;
}
$cookietab = getCookie($smarty_tabset_name, 'tabs', 1);
if (!isset($cookietab) || $tabset_index > 1) {
$cookietab = getCookie($smarty_tabset_name, 'tabs', 1);
}
// work out cookie value if there
if( isset($_REQUEST['cookietab']) && $tabset_index === 1) { // overrides cookie if added to request as in tiki-admin.php?page=look&cookietab=6
$cookietab = empty($_REQUEST['cookietab']) ? 1 : $_REQUEST['cookietab'];
setCookieSection( $smarty_tabset_name, $cookietab, 'tabs' ); // too late to set it here as output has started
}
$smarty_tabset_i_tab = 1;
global $smarty_tabset_name, $smarty_tabset;
......@@ -124,7 +125,11 @@ if (ctab) {
setCookie("'.$smarty_tabset_name.'", ctab[1],"tabs");
}');
}
$headerlib->add_jq_onready('tikitabs(getCookie("'.$smarty_tabset_name.'","tabs",1), $("div[data-name='.$smarty_tabset_name.'] .tabmark:first"));');
if ($cookietab != getCookie($smarty_tabset_name, 'tabs', 1)) { // has been changed by code but now too late to reset
$headerlib->add_jq_onready('setCookie("'.$smarty_tabset_name.'","tabs",'.$cookietab.');');
} else {
$headerlib->add_jq_onready('tikitabs(getCookie("'.$smarty_tabset_name.'","tabs",1), $("div[data-name='.$smarty_tabset_name.'] .tabmark:first"));');
}
$tabset_index--;
if ($tabset_index > 0) {
......
......@@ -6,7 +6,7 @@
<div class="navbar">
{if !empty($calendarId) && $tiki_p_admin_calendar eq 'y'}
{button _text="{tr}Create Calendar{/tr}" href="tiki-admin_calendars.php?show=mod"}
{button _text="{tr}Create Calendar{/tr}" href="tiki-admin_calendars.php?cookietab=2"}
{/if}
{button _text="{tr}View Calendars{/tr}" href="tiki-calendar.php"}
{if $tiki_p_admin_calendar eq 'y'}
......@@ -95,9 +95,13 @@
{pagination_links cant=$cant step=$maxRecords offset=$offset}{/pagination_links}
{/tab}
{tab name="{tr}Create / Edit Calendar{/tr}"}
<h2>{tr}Create/Edit Calendars{/tr}</h2>
{if $calendarId gt 0}
{assign var="edtab" value="{tr}Edit Calendar{/tr}"}
{else}
{assign var="edtab" value="{tr}Create Calendar{/tr}"}
{/if}
{tab name=$edtab}
<h2>{$edtab}</h2>
<form action="tiki-admin_calendars.php" method="post">
<input type="hidden" name="calendarId" value="{$calendarId|escape}" />
......
......@@ -34,7 +34,7 @@
{/foreach}
</div>
{else}
{tr}None{/tr} {button href="tiki-admin_calendars.php?show=mod" _text="{tr}Create calendar{/tr}"}
{tr}None{/tr} {button href="tiki-admin_calendars.php?cookietab=2" _text="{tr}Create calendar{/tr}"}
{/if}
</div>
</div>
......
......@@ -5,7 +5,7 @@
{if $tiki_p_admin_trackers eq 'y'}
{button href="tiki-admin_trackers.php" _text="{tr}Admin Trackers{/tr}"}
{button href="tiki-admin_trackers.php?trackerId=$trackerId&show=mod" _text="{tr}Edit This Tracker{/tr}"}
{button href="tiki-admin_trackers.php?trackerId=$trackerId&cookietab=2" _text="{tr}Edit This Tracker{/tr}"}
{/if}
{button href="tiki-view_tracker.php?trackerId=$trackerId" _text="{tr}View This Tracker's Items{/tr}"}
</div>
......
......@@ -37,10 +37,10 @@
{section name=user loop=$channels}
<tr class="{cycle}">
<td class="id">
<a class="tablename" href="tiki-admin_trackers.php?trackerId={$channels[user].trackerId}&amp;show=mod" title="{tr}Edit{/tr}">{$channels[user].trackerId}</a>
<a class="tablename" href="tiki-admin_trackers.php?trackerId={$channels[user].trackerId}&amp;cookietab=2" title="{tr}Edit{/tr}">{$channels[user].trackerId}</a>
</td>
<td class="text">
<a class="tablename" href="tiki-admin_trackers.php?trackerId={$channels[user].trackerId}&amp;show=mod" title="{tr}Edit{/tr}">{$channels[user].name|escape}</a>
<a class="tablename" href="tiki-admin_trackers.php?trackerId={$channels[user].trackerId}&amp;cookietab=2" title="{tr}Edit{/tr}">{$channels[user].name|escape}</a>
</td>
{if $channels[user].descriptionIsParsed eq 'y'}
<td class="text">{wiki}{$channels[user].description}{/wiki}</td>
......@@ -51,7 +51,7 @@
<td class="date">{$channels[user].lastModif|tiki_short_date}</td>
<td class="integer">{$channels[user].items}</td>
<td class="action">
<a title="{tr}Edit{/tr}" href="tiki-admin_trackers.php?trackerId={$channels[user].trackerId}&amp;show=mod">{icon _id='page_edit'}</a>
<a title="{tr}Edit{/tr}" href="tiki-admin_trackers.php?trackerId={$channels[user].trackerId}&amp;cookietab=2">{icon _id='page_edit'}</a>
<a title="{tr}View{/tr}" href="tiki-view_tracker.php?trackerId={$channels[user].trackerId}">{icon _id='magnifier' alt="{tr}View{/tr}"}</a>
<a title="{tr}Fields{/tr}" class="link" href="tiki-admin_tracker_fields.php?trackerId={$channels[user].trackerId}">{icon _id='table' alt="{tr}Fields{/tr}"}</a>
{if $channels[user].individual eq 'y'}
......
......@@ -2,7 +2,7 @@
<div class="navbar">
{if $tiki_p_admin_trackers eq 'y'}
{button href="tiki-admin_trackers.php?show=mod#mod" _text="{tr}Create Tracker{/tr}"}
{button href="tiki-admin_trackers.php?cookietab=2" _text="{tr}Create Tracker{/tr}"}
{/if}
</div>
......
......@@ -32,7 +32,7 @@
{if $tiki_p_admin_trackers eq 'y'}
{button href="tiki-admin_trackers.php" _text="{tr}Admin Trackers{/tr}"}
{button href="tiki-admin_trackers.php?trackerId=$trackerId&show=mod" _text="{tr}Edit This Tracker{/tr}"}
{button href="tiki-admin_trackers.php?trackerId=$trackerId&cookietab=2" _text="{tr}Edit This Tracker{/tr}"}
{button href="tiki-admin_tracker_fields.php?trackerId=$trackerId" _text="{tr}Edit Fields{/tr}"}
{/if}
</div>
......
......@@ -29,7 +29,7 @@
{if $tiki_p_admin_trackers eq 'y'}
&nbsp;&nbsp;
{button href="tiki-admin_trackers.php" _text="{tr}Admin Trackers{/tr}"}
{button href="tiki-admin_trackers.php?trackerId=$trackerId&show=mod" _text="{tr}Edit This Tracker{/tr}"}
{button href="tiki-admin_trackers.php?trackerId=$trackerId&cookietab=2" _text="{tr}Edit This Tracker{/tr}"}
{button href="tiki-admin_tracker_fields.php?trackerId=$trackerId" _text="{tr}Edit Fields{/tr}"}
{/if}
</div>
......
......@@ -101,6 +101,8 @@ if (isset($_REQUEST["save"])) {
$cat_href = "tiki-calendar.php?calIds[]=" . $_REQUEST["calendarId"];
include_once("categorize.php");
}
$cookietab=1;
$_REQUEST['calendarId'] = 0;
}
if (isset($_REQUEST['clean']) && isset($_REQUEST['days'])) {
check_ticket('admin-calendars');
......
......@@ -51,9 +51,6 @@ if (!empty($_REQUEST['exportTrackerProfile']) && !empty($_REQUEST['trackerId']))
die;
}
if (!empty($_REQUEST['show']) && $_REQUEST['show'] == 'mod') {
$cookietab = '2';
}
if (isset($_REQUEST["remove"])) {
$access->check_authenticity();
$trklib->remove_tracker($_REQUEST["remove"]);
......@@ -369,6 +366,8 @@ if (isset($_REQUEST["save"])) {
$cat_href = "tiki-view_tracker.php?trackerId=" . $_REQUEST["trackerId"];
$cat_objid = $_REQUEST["trackerId"];
include_once ("categorize.php");
$cookietab = 1;
}
$smarty->assign('trackerId', $_REQUEST["trackerId"]);
$info = array();
......@@ -551,8 +550,6 @@ $urlquery['sort_mode'] = $sort_mode;
$smarty->assign_by_ref('urlquery', $urlquery);
$smarty->assign_by_ref('cant', $channels['cant']);
$smarty->assign_by_ref('channels', $channels["data"]);
setcookie('tab', $cookietab);
$smarty->assign('cookietab', $cookietab);
$smarty->assign('uses_tabs', 'y');
// block for categorization
include_once ("categorize_list.php");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment