From f7f735b877f8f72a2f558e01ac087f83211241d1 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 9 Apr 2006 10:45:14 +0000 Subject: [PATCH] Some defaults applied to paramenters was preventing defaults based on formats to work properly. --- mod/glossary/tabs.html | 10 ++++------ mod/glossary/view.php | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/mod/glossary/tabs.html b/mod/glossary/tabs.html index 06ebfc53c6..66292b2800 100644 --- a/mod/glossary/tabs.html +++ b/mod/glossary/tabs.html @@ -44,15 +44,13 @@ $hiddenentries = get_records_select("glossary_entries","glossaryid = $glossary->id and approved = 0"); if ($hiddenentries) { $data[GLOSSARY_APPROVAL_VIEW]->caption .= " (" . count($hiddenentries) . " " . get_string("entries","glossary") . ")"; - $data[GLOSSARY_APPROVAL_VIEW]->link = "view.php?id=$id&tab=".GLOSSARY_APPROVAL_VIEW; - $data[GLOSSARY_APPROVAL_VIEW]->link = "view.php?id=$id&mode=approval"; - } elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) { - $tab = $framebydefault; + } elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) { //Teachers going to approval view and without entries->go to defaulttab + $tab = $defaulttab; } - } elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) { - $tab = $framebydefault; + } elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) { //Non-teachers going to approval view go to defaulttab + $tab = $defaulttab; } /// printing header of the current tab diff --git a/mod/glossary/view.php b/mod/glossary/view.php index 08b1102d4d..bd88ef1c33 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -10,8 +10,8 @@ $tab = optional_param('tab', GLOSSARY_NO_VIEW, PARAM_ALPHA); // browsing entries by categories? $displayformat = optional_param('displayformat',-1, PARAM_INT); // override of the glossary display format - $mode = optional_param('mode', 'approval', PARAM_ALPHA); // term entry cat date letter search author approval - $hook = optional_param('hook', 'ALL', PARAM_CLEAN); // the term, entry, cat, etc... to look for based on mode + $mode = optional_param('mode', '', PARAM_ALPHA); // term entry cat date letter search author approval + $hook = optional_param('hook', '', PARAM_CLEAN); // the term, entry, cat, etc... to look for based on mode $fullsearch = optional_param('fullsearch', 0,PARAM_INT); // full search (concept and definition) when searching? $sortkey = optional_param('sortkey', 'CREATION', PARAM_ALPHA);// Sorted view: CREATION | UPDATE | FIRSTNAME | LASTNAME... $sortorder = optional_param('sortorder', 'ASC', PARAM_ALPHA); // it defines the order of the sorting (ASC or DESC) @@ -70,6 +70,21 @@ /// setting the default values for the display mode of the current glossary /// only if the glossary is viewed by the first time if ( $dp = get_record('glossary_formats','name', addslashes($glossary->displayformat)) ) { + /// Based on format->defaultmode, we build the defaulttab to be showed sometimes + switch ($dp->defaultmode) { + case 'cat': + $defaulttab = GLOSSARY_CATEGORY_VIEW; + break; + case 'date': + $defaulttab = GLOSSARY_DATE_VIEW; + break; + case 'author': + $defaulttab = GLOSSARY_AUTHOR_VIEW; + break; + default: + $defaulttab = GLOSSARY_STANDARD_VIEW; + } + /// Fetch the rest of variables $printpivot = $dp->showgroup; if ( $mode == '' and $hook == '' and $show == '') { $mode = $dp->defaultmode; @@ -78,6 +93,7 @@ $sortorder = $dp->sortorder; } } else { + $defaulttab = GLOSSARY_STANDARD_VIEW; $printpivot = 1; if ( $mode == '' and $hook == '' and $show == '') { $mode = 'letter'; -- 2.39.5