admin page cleanup (google soc 2006)... updated to use new pagelib

This commit is contained in:
vinkmar
2006-08-18 07:27:05 +00:00
parent dd81bb350c
commit 7ff99cb64f
3 changed files with 31 additions and 38 deletions
+13 -8
View File
@@ -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",
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
"<a href=\"index.php\">$strcategories</a> -> $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",
"<a href=\"index.php\">$strcategories</a> -> $category->name", "", "", true, $navbaritem);
@@ -441,7 +442,11 @@
print_course_search();
echo "</center>";
print_footer();
if ($adminediting) {
admin_externalpage_print_footer();
} else {
print_footer();
}
?>
+11 -12
View File
@@ -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",
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strcategories",
"addform.addcategory", "", true, update_categories_button());
admin_externalpage_print_header();
print_heading($strcategories);
@@ -324,7 +323,7 @@
echo "<br />";
echo "</center>";
print_footer();
admin_externalpage_print_footer();
@@ -352,7 +351,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
}
$linkcss = $category->visible ? "" : " class=\"dimmed\" ";
echo "<a $linkcss title=\"$str->edit\" href=\"category.php?id=$category->id&amp;edit=on&amp;sesskey=$USER->sesskey\">$category->name</a>";
echo "<a $linkcss title=\"$str->edit\" href=\"category.php?id=$category->id&amp;categoryedit=on&amp;sesskey=$USER->sesskey\">$category->name</a>";
echo "</td>";
echo "<td align=\"right\">$category->coursecount</td>";
+7 -18
View File
@@ -1,18 +1,11 @@
<?php // $Id$
require_once("../config.php");
require_once($CFG->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,
"<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> ".
"<a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">$strconfiguration</a> -> $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,
"<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> ".
"<a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">$strconfiguration</a> -> $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 "</div>";
print_footer();
admin_externalpage_print_footer();
?>