From: nicolasconnault Date: Thu, 20 Aug 2009 13:18:08 +0000 (+0000) Subject: MDL-19799 Upgraded calls to link_to_popup_window() X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3bd6b994fcd90e64ab1126a2397ad411fe53cf00;p=moodle.git MDL-19799 Upgraded calls to link_to_popup_window() --- diff --git a/files/index.php b/files/index.php index d67b609471..e900b8ca39 100644 --- a/files/index.php +++ b/files/index.php @@ -300,9 +300,9 @@ function displaydir($file_info) { } if ($viewurl = $child_info->get_url()) { - $viewurl = " ".link_to_popup_window ($viewurl, "display", - "old_icon_url('t/preview') . "\" class=\"iconsmall\" alt=\"$strfile\" /> ", - 480, 640, get_string('viewfileinpopup'), null, true); + $link = html_link::make($viewurl, "display", "old_icon_url('t/preview') . "\" class=\"iconsmall\" alt=\"$strfile\" /> "); + $link->add_action(new popup_action('click', $link->url, 'display', array('height' => 480, 'width' => 640))); + $viewurl = " ".$OUTPUT->link($link); } else { $viewurl = ''; } diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index dd67345f5d..c2036a5421 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -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; diff --git a/lib/form/tags.php b/lib/form/tags.php index fd24a8b5bd..bc2ba49812 100644 --- a/lib/form/tags.php +++ b/lib/form/tags.php @@ -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 +?> diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index b1278facb1..815e209af7 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -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 { diff --git a/lib/questionlib.php b/lib/questionlib.php index 7d882c8895..b666ac71cc 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -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 diff --git a/lib/weblib.php b/lib/weblib.php index b4787f2f7e..3bd4e0ba47 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -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 = ''.$strscales.''; - $output .= link_to_popup_window ('/course/scales.php?id='. $courseid .'&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 = ''.$alttag.''; - 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); } /**