]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19808 Fixed dropdown for moving forum discussions
authornicolasconnault <nicolasconnault>
Thu, 13 Aug 2009 01:43:57 +0000 (01:43 +0000)
committernicolasconnault <nicolasconnault>
Thu, 13 Aug 2009 01:43:57 +0000 (01:43 +0000)
lib/outputcomponents.php
mod/forum/discuss.php

index 8953056ec987e141d4690d41471b3c5256e232cb..0913466a72b809a722856bc0a2f12bfb5eef4892 100644 (file)
@@ -555,7 +555,10 @@ class html_select extends labelled_html_component {
     public function override_option_values($options) {
         global $PAGE;
 
+        $originalcount = count($options);
         $this->initialise_options();
+        $newcount = count($this->options);
+        $first = true;
 
         reset($options);
 
@@ -572,15 +575,16 @@ class html_select extends labelled_html_component {
                     }
                 }
                 next($options);
-            } else if ($optgroup instanceof html_select_option) {
-                next($options);
+            } else if ($optgroup instanceof html_select_option && !($first && $originalcount < $newcount)) {
                 $this->options[$optkey]->value = key($options);
                 $optionurl = new moodle_url(key($options));
 
                 if ($optionurl->compare($PAGE->url, URL_MATCH_PARAMS)) {
                     $this->options[$optkey]->selected = 'selected';
                 }
+                next($options);
             }
+            $first = false;
         }
     }
 
index 8c3fb7c85332f02626c701e83e3155faf4ac53ee..4604edcdfe5ed9d1e60efea3e8b653c974ea50aa 100644 (file)
@@ -92,7 +92,7 @@
             print_error('cannotpurgecachedrss', 'forum', $return);
         }
 
-        redirect($return.'&amp;moved=-1&amp;sesskey='.sesskey());
+        redirect($return.'&moved=-1&sesskey='.sesskey());
     }
 
     $logparameters = "d=$discussion->id";
                 }
                 $section = $forumcm->sectionnum;
                 if ($forumcm->instance != $forum->id) {
-                    $url = "discuss.php?d=$discussion->id&move=$forumcm->instance&sesskey=".sesskey();
+                    $url = $CFG->wwwroot . "/mod/forum/discuss.php?d=$discussion->id&move=$forumcm->instance&sesskey=".sesskey();
                     $forummenu[$url] = format_string($forumcm->name);
                 }
             }