Skip to content

Commit

Permalink
MDL-19690 - more $CFG->pixpath to $OUTPUT->old_icon_url
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhunt committed Jul 3, 2009
1 parent 4d13d47 commit ddedf97
Show file tree
Hide file tree
Showing 21 changed files with 112 additions and 89 deletions.
46 changes: 23 additions & 23 deletions lib/adminlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4500,7 +4500,7 @@ public function is_related($query) {
* @return string highlight
*/
public function output_html($data, $query='') {
global $CFG;
global $CFG, $OUTPUT;


// display strings
Expand Down Expand Up @@ -4576,14 +4576,14 @@ public function output_html($data, $query='') {
// hide/show link
if (in_array($auth, $authsenabled)) {
$hideshow = "<a href=\"$url&amp;action=disable&amp;auth=$auth\">";
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" class=\"icon\" alt=\"disable\" /></a>";
$hideshow .= "<img src=\"" . $OUTPUT->old_icon_url('i/hide') . "\" class=\"icon\" alt=\"disable\" /></a>";
// $hideshow = "<a href=\"$url&amp;action=disable&amp;auth=$auth\"><input type=\"checkbox\" checked /></a>";
$enabled = true;
$displayname = "<span>$name</span>";
}
else {
$hideshow = "<a href=\"$url&amp;action=enable&amp;auth=$auth\">";
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" class=\"icon\" alt=\"enable\" /></a>";
$hideshow .= "<img src=\"" . $OUTPUT->old_icon_url('i/show') . "\" class=\"icon\" alt=\"enable\" /></a>";
// $hideshow = "<a href=\"$url&amp;action=enable&amp;auth=$auth\"><input type=\"checkbox\" /></a>";
$enabled = false;
$displayname = "<span class=\"dimmed_text\">$name</span>";
Expand All @@ -4594,17 +4594,17 @@ public function output_html($data, $query='') {
if ($enabled) {
if ($updowncount > 1) {
$updown .= "<a href=\"$url&amp;action=up&amp;auth=$auth\">";
$updown .= "<img src=\"{$CFG->pixpath}/t/up.gif\" alt=\"up\" /></a>&nbsp;";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('t/up') . "\" alt=\"up\" /></a>&nbsp;";
}
else {
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" />&nbsp;";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('spacer.gif') . "\" class=\"icon\" alt=\"\" />&nbsp;";
}
if ($updowncount < $authcount) {
$updown .= "<a href=\"$url&amp;action=down&amp;auth=$auth\">";
$updown .= "<img src=\"{$CFG->pixpath}/t/down.gif\" alt=\"down\" /></a>";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('t/down') . "\" alt=\"down\" /></a>";
}
else {
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" />";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('spacer.gif') . "\" class=\"icon\" alt=\"\" />";
}
++ $updowncount;
}
Expand Down Expand Up @@ -4699,7 +4699,7 @@ public function is_related($query) {
* @return string
*/
public function output_html($data, $query='') {
global $CFG;
global $CFG, $OUTPUT;

// display strings
$txt = get_strings(array('administration', 'settings', 'edit', 'name', 'enable', 'disable',
Expand Down Expand Up @@ -4740,14 +4740,14 @@ public function output_html($data, $query='') {
// hide/show link
if (in_array($editor, $active_editors)) {
$hideshow = "<a href=\"$url&amp;action=disable&amp;editor=$editor\">";
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" class=\"icon\" alt=\"disable\" /></a>";
$hideshow .= "<img src=\"" . $OUTPUT->old_icon_url('i/hide') . "\" class=\"icon\" alt=\"disable\" /></a>";
// $hideshow = "<a href=\"$url&amp;action=disable&amp;editor=$editor\"><input type=\"checkbox\" checked /></a>";
$enabled = true;
$displayname = "<span>$name</span>";
}
else {
$hideshow = "<a href=\"$url&amp;action=enable&amp;editor=$editor\">";
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" class=\"icon\" alt=\"enable\" /></a>";
$hideshow .= "<img src=\"" . $OUTPUT->old_icon_url('i/show') . "\" class=\"icon\" alt=\"enable\" /></a>";
// $hideshow = "<a href=\"$url&amp;action=enable&amp;editor=$editor\"><input type=\"checkbox\" /></a>";
$enabled = false;
$displayname = "<span class=\"dimmed_text\">$name</span>";
Expand All @@ -4758,17 +4758,17 @@ public function output_html($data, $query='') {
if ($enabled) {
if ($updowncount > 1) {
$updown .= "<a href=\"$url&amp;action=up&amp;editor=$editor\">";
$updown .= "<img src=\"{$CFG->pixpath}/t/up.gif\" alt=\"up\" /></a>&nbsp;";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('t/up') . "\" alt=\"up\" /></a>&nbsp;";
}
else {
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" />&nbsp;";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('spacer.gif') . "\" class=\"icon\" alt=\"\" />&nbsp;";
}
if ($updowncount < $editorcount) {
$updown .= "<a href=\"$url&amp;action=down&amp;editor=$editor\">";
$updown .= "<img src=\"{$CFG->pixpath}/t/down.gif\" alt=\"down\" /></a>";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('t/down') . "\" alt=\"down\" /></a>";
}
else {
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" />";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('spacer.gif') . "\" class=\"icon\" alt=\"\" />";
}
++ $updowncount;
}
Expand Down Expand Up @@ -4949,8 +4949,8 @@ public function output_html($data, $query='') {
if (array_key_exists($i->get('plugin'), $insane) || array_key_exists($i->get('id'), $insaneinstances)) {
$row .= '<img src="' . $OUTPUT->old_icon_url('t/show') . '" alt="' . get_string('hidden', 'portfolio') . '" />' . "\n";
} else {
$row .= ' <a href="' . $this->baseurl . '&hide=' . $i->get('id') . '"><img src="' . $CFG->pixpath . '/t/'
. ($i->get('visible') ? 'hide' : 'show') . '.gif" alt="' . get_string($i->get('visible') ? 'hide' : 'show') . '" /></a>' . "\n";
$row .= ' <a href="' . $this->baseurl . '&hide=' . $i->get('id') . '"><img src="' .
$OUTPUT->old_icon_url('t/' . ($i->get('visible') ? 'hide' : 'show')) . '" alt="' . get_string($i->get('visible') ? 'hide' : 'show') . '" /></a>' . "\n";
}
$table->data[] = array($i->get('name'), $i->get_name() . ' (' . $i->get('plugin') . ')', $row);
if (!in_array($i->get('plugin'), $alreadyplugins)) {
Expand Down Expand Up @@ -5861,7 +5861,7 @@ public function is_related($query) {
* @return string XHTML
*/
public function output_html($data, $query='') {
global $CFG, $USER;
global $CFG, $USER, $OUTPUT;
$output = print_box_start('generalbox','',true);
$namestr = get_string('name');
$settingsstr = get_string('settings');
Expand Down Expand Up @@ -5906,7 +5906,7 @@ public function output_html($data, $query='') {

$hidetitle = $i->get_visible() ? get_string('clicktohide', 'repository') : get_string('clicktoshow', 'repository');
$hiddenshow = ' <a href="' . $this->baseurl . '&amp;hide=' . $i->get_typename() . '">'
.'<img src="' . $CFG->pixpath . '/i/' . ($i->get_visible() ? 'hide' : 'show') . '.gif"'
.'<img src="' . $OUTPUT->old_icon_url('i/' . ($i->get_visible() ? 'hide' : 'show')) . '"'
.' alt="' . $hidetitle . '" '
.' title="' . $hidetitle . '" />'
.'</a>' . "\n";
Expand All @@ -5916,17 +5916,17 @@ public function output_html($data, $query='') {

if ($updowncount > 1) {
$updown .= "<a href=\"$this->baseurl&amp;move=up&amp;type=".$i->get_typename()."\">";
$updown .= "<img src=\"{$CFG->pixpath}/t/up.gif\" alt=\"up\" /></a>&nbsp;";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('t/up') . "\" alt=\"up\" /></a>&nbsp;";
}
else {
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" />&nbsp;";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('spacer.gif') . "\" class=\"icon\" alt=\"\" />&nbsp;";
}
if ($updowncount < count($instances)) {
$updown .= "<a href=\"$this->baseurl&amp;move=down&amp;type=".$i->get_typename()."\">";
$updown .= "<img src=\"{$CFG->pixpath}/t/down.gif\" alt=\"down\" /></a>";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('t/down') . "\" alt=\"down\" /></a>";
}
else {
$updown .= "<img src=\"{$CFG->pixpath}/spacer.gif\" class=\"icon\" alt=\"\" />";
$updown .= "<img src=\"" . $OUTPUT->old_icon_url('spacer.gif') . "\" class=\"icon\" alt=\"\" />";
}

$updowncount++;
Expand Down Expand Up @@ -6028,7 +6028,7 @@ public function output_html($data, $query='') {
foreach ($protocols as $i) {
$hidetitle = $i->get_protocolid() ? get_string('clicktohide', 'repository') : get_string('clicktoshow', 'repository');
$hiddenshow = ' <a href="' . $this->baseurl . '&amp;hide=' . $i->get_protocolid() . '">'
.'<img src="' . $CFG->pixpath . '/i/' . ($i->get_enable() ? 'hide' : 'show') . '.gif"'
.'<img src="' . $OUTPUT->old_icon_url('i/' . ($i->get_enable() ? 'hide' : 'show')) . '"'
.' alt="' . $hidetitle . '" '
.' title="' . $hidetitle . '" />'
.'</a>' . "\n";
Expand Down
4 changes: 2 additions & 2 deletions lib/ajax/ajaxcourse.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ main_class.prototype.get_section_index = function(el) {
main_class.prototype.mk_button = function(tag, imgSrc, text, attributes, imgAttributes) {
//Create button and return object.
//Set the text: the container TITLE or image ALT attributes can be overridden, eg.
// main.mk_button('a', '/i/move_2d.gif', strmove, [['title', strmoveshort]]);
// main.mk_button('a', main.portal.icons['move_2d'], strmove, [['title', strmoveshort]]);
var container = document.createElement(tag);
container.style.cursor = 'pointer';
container.setAttribute('title', text);
var image = document.createElement('img');

image.setAttribute('src', main.portal.strings['pixpath']+imgSrc);
image.setAttribute('src', imgSrc);
image.setAttribute('alt', text);
//image.setAttribute('title', '');
container.appendChild(image);
Expand Down
20 changes: 18 additions & 2 deletions lib/ajax/ajaxlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ function setup_core_javascript(page_requirements_manager $requires) {

$config = array(
'wwwroot' => $CFG->httpswwwroot, // Yes, really. See above.
'pixpath' => $CFG->pixpath,
'sesskey' => sesskey(),
);
if (debugging('', DEBUG_DEVELOPER)) {
Expand Down Expand Up @@ -1302,7 +1301,6 @@ function print_javascript($courseid, $return=false) {
$output .= " main.portal.id = ".$courseid.";\n";
$output .= " main.portal.blocks = new Array(".$blocksoutput.");\n";
$output .= " main.portal.strings['wwwroot']='".$CFG->wwwroot."';\n";
$output .= " main.portal.strings['pixpath']='".$CFG->pixpath."';\n";
$output .= " main.portal.strings['marker']='".get_string('markthistopic', '', '_var_')."';\n";
$output .= " main.portal.strings['marked']='".get_string('markedthistopic', '', '_var_')."';\n";
$output .= " main.portal.strings['hide']='".get_string('hide')."';\n";
Expand All @@ -1322,6 +1320,24 @@ function print_javascript($courseid, $return=false) {
$output .= " main.portal.strings['resource']='".get_string('resource')."';\n";
$output .= " main.portal.strings['activity']='".get_string('activity')."';\n";
$output .= " main.portal.strings['sesskey']='".sesskey()."';\n";
$output .= " main.portal.icons['spacerimg']='".$OUTPUT->old_icon_url('spaces')."';\n";
$output .= " main.portal.icons['marker']='".$OUTPUT->old_icon_url('i/marker')."';\n";
$output .= " main.portal.icons['ihide']='".$OUTPUT->old_icon_url('i/hide')."';\n";
$output .= " main.portal.icons['move_2d']='".$OUTPUT->old_icon_url('i/move_2d')."';\n";
$output .= " main.portal.icons['show']='".$OUTPUT->old_icon_url('t/show')."';\n";
$output .= " main.portal.icons['hide']='".$OUTPUT->old_icon_url('t/hide')."';\n";
$output .= " main.portal.icons['delete']='".$OUTPUT->old_icon_url('t/delete')."';\n";
$output .= " main.portal.icons['groupn']='".$OUTPUT->old_icon_url('t/groupn')."';\n";
$output .= " main.portal.icons['groups']='".$OUTPUT->old_icon_url('t/groups')."';\n";
$output .= " main.portal.icons['groupv']='".$OUTPUT->old_icon_url('t/groupv')."';\n";
if (right_to_left()) {
$output .= " main.portal.icons['backwards']='".$OUTPUT->old_icon_url('t/right')."';\n";
$output .= " main.portal.icons['forwards']='".$OUTPUT->old_icon_url('t/left')."';\n";
} else {
$output .= " main.portal.icons['backwards']='".$OUTPUT->old_icon_url('t/left')."';\n";
$output .= " main.portal.icons['forwards']='".$OUTPUT->old_icon_url('t/right')."';\n";
}

$output .= " onloadobj.load();\n";
$output .= " main.process_blocks();\n";
$output .= "</script>";
Expand Down
4 changes: 2 additions & 2 deletions lib/ajax/block_classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ block_class.prototype.reset_regions = function() {


block_class.prototype.init_buttons = function() {
var viewbutton = main.mk_button('a', '/t/hide.gif', main.portal.strings['hide'], [['class', 'icon hide']]);
var viewbutton = main.mk_button('a', main.portal.icons['hide'], main.portal.strings['hide'], [['class', 'icon hide']]);
YAHOO.util.Event.addListener(viewbutton, 'click', this.toggle_hide, this, true);

var deletebutton = main.mk_button('a', '/t/delete.gif', main.portal.strings['delete'], [['class', 'icon delete']]);
var deletebutton = main.mk_button('a', main.portal.icons['delete'], main.portal.strings['delete'], [['class', 'icon delete']]);
YAHOO.util.Event.addListener(deletebutton, 'click', this.delete_button, this, true);

this.viewbutton = viewbutton;
Expand Down
Loading

0 comments on commit ddedf97

Please sign in to comment.