Skip to content

Commit

Permalink
MDL-6544
Browse files Browse the repository at this point in the history
resolved issue by passing strings into new main.portal.strings for delocalization.
  • Loading branch information
cap2501 committed Sep 21, 2006
1 parent 94e65cc commit e78a350
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
8 changes: 5 additions & 3 deletions course/format/topics/ajaxcourse-topics.js
Expand Up @@ -43,7 +43,6 @@ function main_class(){
//this.logview = new YAHOO.widget.LogReader('header');



this.icons = [];
this.marker = null;

Expand Down Expand Up @@ -138,7 +137,7 @@ main_class.prototype.mk_button = function(tag,imgSrc,attributes,imgAttributes){
var container = document.createElement(tag);
container.style.cursor = 'pointer';
var image = document.createElement('img');
image.setAttribute('src',main.portal.wwwroot+imgSrc);
image.setAttribute('src',main.portal.strings['wwwroot']+imgSrc);
container.appendChild(image);

if(attributes != null)
Expand All @@ -157,7 +156,7 @@ main_class.prototype.connect = function(method,urlStub,callback,body){
if(callback == null){
callback = {}
}
return YAHOO.util.Connect.asyncRequest(method,this.portal.wwwroot+"/course/format/topics/commands.php?courseId="+main.portal.id+"&"+urlStub,callback,body);
return YAHOO.util.Connect.asyncRequest(method,this.portal.strings['wwwroot']+"/course/format/topics/commands.php?courseId="+main.portal.id+"&"+urlStub,callback,body);


}
Expand Down Expand Up @@ -219,6 +218,9 @@ function php_portal_class(){

//flag for week fomat
this.isWeek = false;

//strings
this.strings = [];

YAHOO.log("instantiated php_portal_class","info");
}
Expand Down
9 changes: 5 additions & 4 deletions lib/ajax/ajaxlib.php
Expand Up @@ -3,7 +3,7 @@
* Library functions for using ajax with moodle
**/


/**
*Print require statements for javascript libraries
*Takes in an array of either full paths or shortnames and it will translate them to full paths
Expand Down Expand Up @@ -63,11 +63,12 @@ function print_javascript($id){
$blocksoutput.=",";
}

global $CFG;
global $CFG;
$output .="<script language='javascript'>\r";
$output .=" main.portal.id = ".$id."\r";
$output .=" main.portal.id = ".$id."\r";
$output .=" main.portal.blocks = new Array(".$blocksoutput.");\r";
$output .=" main.portal.wwwroot = '".$CFG->wwwroot."';\r";
$output .=" main.portal.strings['wwwroot']='".$CFG->wwwroot."';\r";
$output .=" main.portal.strings['update']='".get_string('update')."';\r";
$output .=" onload.load()\r";
$output .=" main.process_blocks();\r";
$output .="</script>";
Expand Down
2 changes: 1 addition & 1 deletion lib/ajax/section_classes.php
Expand Up @@ -499,7 +499,7 @@ function resource_class(id,group,config,parentObj){
var updateButton = null;
var buttons = commandContainer.getElementsByTagName('a');
for (var x=0;x<buttons.length;x++) {
if (buttons[x].title == '<?php print_string('update'); ?>') {
if (buttons[x].title == main.portal.strings['update']) {
updateButton = buttons[x];
}
}
Expand Down

0 comments on commit e78a350

Please sign in to comment.