From 7ff99cb64fb9a608ce12432137a09aef188926b6 Mon Sep 17 00:00:00 2001 From: vinkmar Date: Fri, 18 Aug 2006 07:27:05 +0000 Subject: [PATCH] admin page cleanup (google soc 2006)... updated to use new pagelib --- course/category.php | 21 +++++++++++++-------- course/index.php | 23 +++++++++++------------ theme/index.php | 25 +++++++------------------ 3 files changed, 31 insertions(+), 38 deletions(-) diff --git a/course/category.php b/course/category.php index 47400c4a8b..cd9b35ae40 100644 --- a/course/category.php +++ b/course/category.php @@ -9,7 +9,7 @@ $id = required_param('id', PARAM_INT); // Category id $page = optional_param('page', 0, PARAM_INT); // which page to show $perpage = optional_param('perpage', 20, PARAM_INT); // how many per page - $edit = optional_param('edit', -1, PARAM_BOOL); + $categoryedit = optional_param('categoryedit', -1, PARAM_BOOL); $hide = optional_param('hide', 0, PARAM_INT); $show = optional_param('show', 0, PARAM_INT); $moveup = optional_param('moveup', 0, PARAM_INT); @@ -32,7 +32,7 @@ if (iscreator()) { if ($edit !== -1) { - $USER->categoryediting = $edit; + $USER->categoryediting = $categoryedit; } $navbaritem = update_category_button($category->id); @@ -89,10 +89,11 @@ if ($creatorediting) { if ($adminediting) { - print_header("$site->shortname: $category->name", "$site->fullname: $strcourses", - "admin/index.php\">$stradministration -> ". - "$strcategories -> $category->name", - "", "", true, $navbaritem); + // modify this to treat this as an admin page + + require_once($CFG->dirroot . '/admin/adminlib.php'); + admin_externalpage_setup('coursemgmt'); + admin_externalpage_print_header(); } else { print_header("$site->shortname: $category->name", "$site->fullname: $strcourses", "$strcategories -> $category->name", "", "", true, $navbaritem); @@ -441,7 +442,11 @@ print_course_search(); echo ""; - - print_footer(); + + if ($adminediting) { + admin_externalpage_print_footer(); + } else { + print_footer(); + } ?> diff --git a/course/index.php b/course/index.php index 71583cdbcc..ed57d7d0bd 100644 --- a/course/index.php +++ b/course/index.php @@ -5,7 +5,7 @@ require_once("../config.php"); require_once("lib.php"); - $edit = optional_param('edit', -1,PARAM_BOOL); + $categoryedit = optional_param('categoryedit', -1,PARAM_BOOL); $delete = optional_param('delete',0,PARAM_INT); $hide = optional_param('hide',0,PARAM_INT); $show = optional_param('show',0,PARAM_INT); @@ -26,8 +26,8 @@ } if (isadmin()) { - if ($edit !== -1) { - $USER->categoryediting = $edit; + if ($categoryedit !== -1) { + $USER->categoryediting = $categoryedit; } $adminediting = !empty($USER->categoryediting); } else { @@ -74,11 +74,10 @@ /// From now on is all the admin functions - require_login(); - if (!isadmin()) { - error("Only administrators can use this page!"); - } + require_once($CFG->dirroot . '/admin/adminlib.php'); + admin_externalpage_setup('coursemgmt'); + /// Print headings @@ -91,9 +90,9 @@ $straction = get_string("action"); $straddnewcategory = get_string("addnewcategory"); - print_header("$site->shortname: $strcategories", "$site->fullname", - "admin/index.php\">$stradministration -> $strcategories", - "addform.addcategory", "", true, update_categories_button()); + + + admin_externalpage_print_header(); print_heading($strcategories); @@ -324,7 +323,7 @@ echo "
"; echo ""; - print_footer(); + admin_externalpage_print_footer(); @@ -352,7 +351,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $ echo "      "; } $linkcss = $category->visible ? "" : " class=\"dimmed\" "; - echo "edit\" href=\"category.php?id=$category->id&edit=on&sesskey=$USER->sesskey\">$category->name"; + echo "edit\" href=\"category.php?id=$category->id&categoryedit=on&sesskey=$USER->sesskey\">$category->name"; echo ""; echo "$category->coursecount"; diff --git a/theme/index.php b/theme/index.php index 1978637fc9..c50ecc2d21 100644 --- a/theme/index.php +++ b/theme/index.php @@ -1,18 +1,11 @@ dirroot . '/admin/adminlib.php'); $choose = optional_param("choose",'',PARAM_FILE); // set this theme as default - if (! $site = get_site()) { - error("Site doesn't exist!"); - } - - require_login(); - - if (!isadmin()) { - error("You must be an administrator to change themes."); - } + admin_externalpage_setup('themeselector'); unset($SESSION->theme); @@ -34,10 +27,7 @@ } if (set_config("theme", $choose)) { theme_setup($choose); - - print_header("$site->shortname: $strthemes", $site->fullname, - "wwwroot/$CFG->admin/index.php\">$stradministration -> ". - "wwwroot/$CFG->admin/configure.php\">$strconfiguration -> $strthemes"); + admin_externalpage_print_header(); print_heading(get_string("themesaved")); print_continue("$CFG->wwwroot/"); @@ -52,16 +42,14 @@ echo format_text(implode('', $file), FORMAT_MOODLE); print_simple_box_end(); } - print_footer(); + admin_externalpage_print_footer(); exit; } else { error("Could not set the theme!"); } } - print_header("$site->shortname: $strthemes", $site->fullname, - "wwwroot/$CFG->admin/index.php\">$stradministration -> ". - "wwwroot/$CFG->admin/configure.php\">$strconfiguration -> $strthemes"); + admin_externalpage_print_header('themeselector'); print_heading($strthemes); @@ -143,6 +131,7 @@ $options["sub"] = "themes"; print_single_button("$CFG->wwwroot/doc/index.php", $options, get_string("howtomakethemes")); echo ""; - print_footer(); + admin_externalpage_print_footer(); + ?> -- 2.39.5