]> git.mjollnir.org Git - moodle.git/commitdiff
Miscellaneous fixes for MDL-11543
authormoodler <moodler>
Wed, 10 Oct 2007 04:05:46 +0000 (04:05 +0000)
committermoodler <moodler>
Wed, 10 Oct 2007 04:05:46 +0000 (04:05 +0000)
 - added button to edit current category
 - removed old mini-forms to do the same
 - tidied up various things and CSS as well

course/category.php
course/editcategory.php
course/editcategory_form.php
course/loginas.php
lang/en_utf8/moodle.php
theme/standard/styles_layout.css

index dbb00d0469bcddd70de2c518f941b7a2a8b6db01..7b9e212252cb1a92a7991483716b114bbd183484 100644 (file)
 
 /// Print button to turn editing off
     if ($adminediting) {
-        echo '<div class="categoryediting button" align="right">'.update_category_button($category->id).'</div>';
+        echo '<div class="categoryediting button">'.update_category_button($category->id).'</div>';
     }
 
 /// Print link to roles
     echo '</div>';
 
 /// Print current category description
-    if ($category->description) {
+    if (!$creatorediting && $category->description) {
         print_box_start();
-        print_heading(get_string('description'));
         echo $category->description;
         print_box_end();
     }
 
     } // End of editing stuff
 
+
+    if ($creatorediting) {   
+        echo '<div class="buttons">'; 
+        if (has_capability('moodle/category:update', $context)) {   // Print button to update this category
+            unset($options);
+            $options['id'] = $category->id;
+            print_single_button('editcategory.php', $options, get_string('editcategorythis'), 'get');
+        }
+
+        if (has_capability('moodle/category:create', $context)) {   // Print button for creating new categories
+            unset($options);
+            $options['categoryadd'] = 1;
+            $options['id'] = $id;
+            print_single_button('editcategory.php', $options, get_string('addsubcategory'), 'get');
+        }
+        echo '</div>';
+    }
+
 /// Print out all the sub-categories
     if ($subcategories = get_records("course_categories", "parent", $category->id, "sortorder ASC")) {
         $firstentry = true;
         }
     }
 
-    // Print button for creating new categories
-    if (has_capability('moodle/category:create', $context) && $creatorediting) {
-        unset($options);
-        $options['categoryadd'] = 1;
-        $options['id'] = $id;
-        echo '<div class="buttons">'; 
-        print_single_button('editcategory.php', $options, get_string('addsubcategory'), 'get');
-        echo '<br /></div>';
-    }
 
 /// Print out all the courses
     unset($course);    // To avoid unwanted language effects later
         echo '<br />';
     }
 
+    echo '<div class="buttons">'; 
     if (has_capability('moodle/category:update', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $numcourses > 1) {           /// Print button to re-sort courses by name
         unset($options);
         $options['id'] = $category->id;
         unset($options);
         $options['category'] = $category->id;
         print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
-        echo '<br />';
     }
+    echo '</div>'; 
 
-    if (has_capability('moodle/category:update', $context)) {           /// Print form to rename the category
-        $strrename= get_string('rename');
-        echo '<form id="renameform" action="category.php" method="post"><div>';
-        echo '<input type="hidden" name="id" value="'.$category->id.'" />';
-        echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
-        echo '<input type="text" size="30" name="rename" value="'.htmlspecialchars($category->name).'" alt="'.$strrename.'" />';
-        echo '<input type="submit" value="'.$strrename.'" />';
-        echo '</div></form>';
-        echo '<br />';
-
-        if (!empty($CFG->allowcategorythemes)) {
-            $choices = array();
-            $choices[''] = get_string('default');
-            $choices += get_list_of_themes();
-
-            echo '<form id="themeform" action="category.php" method="post"><div>';
-            echo '<input type="hidden" name="id" value="'.$category->id.'" />';
-            echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
-            choose_from_menu($choices, 'categorytheme', $category->theme);
-            echo '<input type="submit" value="'.get_string('setcategorytheme').'" />';
-            echo '</div></form>';
-            echo '<br />';
-        }
-    }
 
 
     print_course_search();
index 5aa160665ac8eac820a37a9cb6390d62ffe359c8..bba2c4a318099a8620817448e5ae84531a19ba9a 100644 (file)
@@ -290,7 +290,7 @@ if ($id && !$categoryadd && !$categoryupdate && false) {
             }
 
             if (!update_record('course_categories', $category)) {
-                notice( "Could not update the category '$category->name' ");
+                error( "Could not update the category '$category->name' ");
             } else {
                 if ($category->parent == 0) {
                     $redirect_link = 'index.php?categoryedit=on';
@@ -298,11 +298,11 @@ if ($id && !$categoryadd && !$categoryupdate && false) {
                     $redirect_link = 'category.php?id='.$category->id.'&categoryedit=on'; 
                 }
                 fix_course_sortorder();
-                redirect($redirect_link, get_string('categoryupdated', null, $category->name));
+                redirect($redirect_link);
             }
         } 
     } else {
-        notice("You do not have the permission to update this category.");
+        error("You do not have the permission to update this category.");
     }
 }
 
index 005bdc28577d7c968ae4ea652dab4baed436cab7..59bab64d26ba734c06d612555113048269297094 100644 (file)
@@ -19,7 +19,7 @@ class editcategory_form extends moodleform {
         $mform->addRule('name', get_string('required'), 'required', null);        
         $mform->addElement('htmleditor', 'description', get_string('description'));
         $mform->setType('description', PARAM_RAW);
-        if (!empty($CFG->allowcoursethemes)) {
+        if (!empty($CFG->allowcategorythemes)) {
             $themes=array();
             $themes[''] = get_string('forceno');
             $themes += get_list_of_themes();
index 1a1b7bac2c1a497227005a0384ded73acec26560..8b93bca4eb819d3d184761964550755a0b889241 100644 (file)
             $USER->timeaccess = $SESSION->oldtimeaccess;
             unset($SESSION->oldtimeaccess);
         }
+        if (isset($SESSION->grade_last_report)) {    // Restore grade defaults if any
+            $USER->grade_last_report = $SESSION->grade_last_report;
+            unset($SESSION->grade_last_report);
+        }
 
         if ($return and isset($_SERVER["HTTP_REFERER"])) { // That's all we wanted to do, so let's go back
             redirect($_SERVER["HTTP_REFERER"]);
@@ -73,6 +77,9 @@
     if (isset($USER->timeaccess)) {
         $SESSION->oldtimeaccess = $USER->timeaccess;
     }
+    if (isset($USER->grade_last_report)) {
+        $SESSION->grade_last_report = $USER->grade_last_report;
+    }
 
 /// Login as this user and return to course home page.
 
index da5da52c7514e1be3d394a0ed6423c17249f8594..32315e76fed112619ea7d3b46276860f4b63bf94 100644 (file)
@@ -405,6 +405,7 @@ $string['edhelpfontlist'] = 'Define the fonts used on editors dropdown menu.';
 $string['edhelpfontsize'] = 'The default font-size sets the size of a font. <br />Valid values are for example: medium, large, smaller, larger, 10pt, 11px.';
 $string['edit'] = 'Edit $a';
 $string['editcategorysettings'] = 'Edit category settings';
+$string['editcategorythis'] = 'Edit this category';
 $string['editcoursesettings'] = 'Edit course settings';
 $string['editfiles'] = 'Edit files';
 $string['editgroupprofile'] = 'Edit group profile';
index 442d080d8247acfd03bbb08e01378394f04aff2e..1ef3987f42bfeb999030a5979d3f810975380c6e 100644 (file)
@@ -1922,6 +1922,15 @@ body#course-category .addcategory {
   padding: 10px;
 }
 
+body#course-category .buttons .singlebutton {
+  display: inline;
+}
+
+body#course-category .buttons {
+  text-align: center;
+  margin-bottom: 15px;
+}
+
 body#course-index #middle-column .editcourse {
   margin-left:auto;
   margin-right:auto;