Skip to content

Commit

Permalink
MDL-19799 Upgraded calls to link_to_popup_window()
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasconnault committed Aug 20, 2009
1 parent 5a142c8 commit 3bd6b99
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
6 changes: 3 additions & 3 deletions files/index.php
Expand Up @@ -300,9 +300,9 @@ function displaydir($file_info) {
}

if ($viewurl = $child_info->get_url()) {
$viewurl = " ".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 = '';
}
Expand Down
5 changes: 3 additions & 2 deletions lib/deprecatedlib.php
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 7 additions & 4 deletions lib/form/tags.php
Expand Up @@ -101,7 +101,7 @@ protected function _load_official_tags() {
}

function _createElements() {
global $CFG;
global $CFG, $OUTPUT;
$this->_elements = array();

// Official tags.
Expand All @@ -112,8 +112,11 @@ function _createElements() {
// 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.
Expand Down Expand Up @@ -246,4 +249,4 @@ function exportValue(&$submitValues, $assoc = false) {
return array($this->getName() => $tags);
}
}
?>
?>
2 changes: 1 addition & 1 deletion lib/outputcomponents.php
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/questionlib.php
Expand Up @@ -104,7 +104,7 @@
/**
* 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
Expand Down
11 changes: 8 additions & 3 deletions lib/weblib.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 3bd6b99

Please sign in to comment.