]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19799 Upgraded calls to link_to_popup_window()
authornicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 13:18:08 +0000 (13:18 +0000)
committernicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 13:18:08 +0000 (13:18 +0000)
files/index.php
lib/deprecatedlib.php
lib/form/tags.php
lib/outputcomponents.php
lib/questionlib.php
lib/weblib.php

index d67b6094717eb07dae070a15b8a527d2d4428e39..e900b8ca3904d4a484bbff6f36b47b206cab4ebb 100644 (file)
@@ -300,9 +300,9 @@ function displaydir($file_info) {
                 }
 
                 if ($viewurl = $child_info->get_url()) {
-                    $viewurl = "&nbsp;".link_to_popup_window ($viewurl, "display",
-                                                     "<img src=\"" . $OUTPUT->old_icon_url('t/preview') . "\" class=\"iconsmall\" alt=\"$strfile\" />&nbsp;",
-                                                     480, 640, get_string('viewfileinpopup'), null, true);
+                    $link = html_link::make($viewurl, "display", "<img src=\"" . $OUTPUT->old_icon_url('t/preview') . "\" class=\"iconsmall\" alt=\"$strfile\" />&nbsp;");
+                    $link->add_action(new popup_action('click', $link->url, 'display', array('height' => 480, 'width' => 640)));
+                    $viewurl = "&nbsp;".$OUTPUT->link($link);
                 } else {
                     $viewurl = '';
                 }
index dd67345f5d93cd49cda520ac82baa8159573e5e9..c2036a5421a2221f1896331e337147632a9fa719 100644 (file)
@@ -1836,6 +1836,7 @@ function page_id_and_class(&$getid, &$getclass) {
  * @param string $error The text to be displayed in red
  */
 function formerr($error) {
+    debugging('formerr() has been deprecated. Please change your code to use $OUTPUT->error_text($string).');
     global $OUTPUT;
     echo $OUTPUT->error_text($error);
 }
@@ -2447,7 +2448,7 @@ function link_to_popup_window ($url, $name=null, $linkname=null,
                                $options=null, $return=false) {
     global $OUTPUT;
 
-    // debugging('link_to_popup_window() has been deprecated. Please change your code to use $OUTPUT->link().');
+    debugging('link_to_popup_window() has been deprecated. Please change your code to use $OUTPUT->link().');
 
     if ($options == 'none') {
         $options = null;
@@ -2515,7 +2516,7 @@ function button_to_popup_window ($url, $name=null, $linkname=null,
                                  $id=null, $class=null) {
     global $OUTPUT;
 
-    debugging('link_to_popup_window() has been deprecated. Please change your code to use $OUTPUT->link_to_popup().');
+    debugging('button_to_popup_window() has been deprecated. Please change your code to use $OUTPUT->button().');
 
     if ($options == 'none') {
         $options = null;
index fd24a8b5bd70174ffe0e6a9401167ba500e8a33b..bc2ba49812e1f69c4496c5df3bdc3e5c673d8bbe 100644 (file)
@@ -101,7 +101,7 @@ class MoodleQuickForm_tags extends MoodleQuickForm_group {
     }
 
     function _createElements() {
-        global $CFG;
+        global $CFG, $OUTPUT;
         $this->_elements = array();
 
         // Official tags.
@@ -112,8 +112,11 @@ class MoodleQuickForm_tags extends MoodleQuickForm_group {
             // If the user can manage official tags, give them a link to manage them.
             $label = get_string('otags', 'tag');
             if (has_capability('moodle/tag:manage', get_context_instance(CONTEXT_SYSTEM))) {
-                $label .= ' (' . link_to_popup_window($CFG->wwwroot .'/tag/manage.php',
-                        'managetags', get_string('manageofficialtags', 'tag'), '', '', get_string('newwindow'), null, true) . ')';
+                $link = html_link::make($CFG->wwwroot .'/tag/manage.php', get_string('manageofficialtags', 'tag'));
+                $link->add_action(new popup_action('click', $link->url, 'managetags'));
+                $link->title = get_string('newwindow');
+
+                $label .= ' (' . $OUTPUT->link($link) . ')';
             }
 
             // Get the list of official tags.
@@ -246,4 +249,4 @@ class MoodleQuickForm_tags extends MoodleQuickForm_group {
         return array($this->getName() => $tags);
     }
 }
-?>
\ No newline at end of file
+?>
index b1278facb145596e426611fe32f71d725abd5419..815e209af746a2b4e431bac152f8356c2170a185 100644 (file)
@@ -75,7 +75,7 @@ class moodle_html_component {
      */
     public static function clean_classes($classes) {
         if (empty($classes)) {
-            return '';
+            return array();
         } else if (is_array($classes)) {
             return $classes;
         } else {
index 7d882c88957457d67f2e5ade4b678d527e2674d5..b666ac71cc35e83976c9cf443dea99ab8bcaef9a 100644 (file)
@@ -104,7 +104,7 @@ define("QUESTION_NUMANS_ADD", 3);
 /**
  * The options used when popping up a question preview window in Javascript.
  */
-define('QUESTION_PREVIEW_POPUP_OPTIONS', 'scrollbars=yes,resizable=yes,width=700,height=540');
+define('QUESTION_PREVIEW_POPUP_OPTIONS', 'scrollbars=true&resizable=true&width=700&height=540');
 
 /**#@+
  * Option flags for ->optionflags
index b4787f2f7e489712affc82d1db69ca2542d5e136..3bd4e0ba473c4a86eeeda3a7692077a5ac5c9637 100644 (file)
@@ -2971,8 +2971,10 @@ function print_grade_menu($courseid, $name, $current, $includenograde=true, $ret
     $output .= $OUTPUT->select(html_select::make($grades, $name, $current, false));
 
     $linkobject = '<span class="helplink"><img class="iconhelp" alt="'.$strscales.'" src="'.$OUTPUT->old_icon_url('help') . '" /></span>';
-    $output .= link_to_popup_window ('/course/scales.php?id='. $courseid .'&amp;list=true', 'ratingscales',
-                                     $linkobject, 400, 500, $strscales, 'none', true);
+    $link = html_link::make('/course/scales.php?id='. $courseid .'&list=true', $linkobject);
+    $link->add_action(new popup_action('click', $link->url, 'ratingscales', array('height' => 400, 'width' => 500)));
+    $link->title = $strscales;
+    $output .= $OUTPUT->link($link);
 
     if ($return) {
         return $output;
@@ -3060,7 +3062,10 @@ function editorhelpbutton(){
 
     $paramstring = join('&', $urlparams);
     $linkobject = '<img alt="'.$alttag.'" class="iconhelp" src="'.$OUTPUT->old_icon_url('help') . '" />';
-    return link_to_popup_window(s('/lib/form/editorhelp.php?'.$paramstring), 'popup', $linkobject, 400, 500, $alttag, 'none', true);
+    $link = html_link::make(s('/lib/form/editorhelp.php?'.$paramstring), $linkobject);
+    $link->add_action(new popup_action('click', $link->url, 'popup', array('height' => 400, 'width' => 500)));
+    $link->title = $alttag;
+    return $OUTPUT->link($link);
 }
 
 /**