diff --git a/lib/javascript-static.js b/lib/javascript-static.js
index 44f00b12889..b3d79399ea6 100644
--- a/lib/javascript-static.js
+++ b/lib/javascript-static.js
@@ -30,7 +30,7 @@ M.util.image_url = function(imagename, component) {
url = url + '&rev=' + M.cfg.themerev;
}
- if (component != '' && component != 'moodle' && component != 'core') {
+ if (component && component != '' && component != 'moodle' && component != 'core') {
url = url + '&component=' + component;
}
diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php
index 3a4adea3ecb..47d884a63a4 100644
--- a/lib/outputrequirementslib.php
+++ b/lib/outputrequirementslib.php
@@ -331,6 +331,7 @@ class page_requirements_manager {
$module = null;
+
if (strpos($name, 'core_') === 0) {
// must be some core stuff - list here is not complete, this is just the stuff used from multiple places
// so that we do nto have to repeat the definition of these modules over and over again
@@ -338,7 +339,19 @@ class page_requirements_manager {
case 'core_filepicker':
$module = array('name' => 'core_filepicker',
'fullpath' => '/repository/filepicker.js',
- 'requires' => array('base', 'node', 'json', 'async-queue', 'io', 'yui2-button', 'yui2-container', 'yui2-layout', 'yui2-menu', 'yui2-treeview'));
+ 'requires' => array('base', 'node', 'json', 'async-queue', 'io', 'yui2-button', 'yui2-container', 'yui2-layout', 'yui2-menu', 'yui2-treeview'),
+ 'strings' => array(array('add', 'repository'), array('back', 'repository'), array('cancel', 'moodle'), array('close', 'repository'),
+ array('cleancache', 'repository'), array('copying', 'repository'), array('date', 'repository'), array('downloadsucc', 'repository'),
+ array('emptylist', 'repository'), array('error', 'repository'), array('federatedsearch', 'repository'),
+ array('filenotnull', 'repository'), array('getfile', 'repository'), array('help', 'moodle'), array('iconview', 'repository'),
+ array('invalidjson', 'repository'), array('linkexternal', 'repository'), array('listview', 'repository'),
+ array('loading', 'repository'), array('login', 'repository'), array('logout', 'repository'), array('noenter', 'repository'),
+ array('noresult', 'repository'), array('manageurl', 'repository'), array('popup', 'repository'), array('preview', 'repository'),
+ array('refresh', 'repository'), array('save', 'repository'), array('saveas', 'repository'), array('saved', 'repository'),
+ array('saving', 'repository'), array('search', 'repository'), array('searching', 'repository'), array('size', 'repository'),
+ array('submit', 'repository'), array('sync', 'repository'), array('title', 'repository'), array('upload', 'repository'),
+ array('uploading', 'repository'), array('xhtmlerror', 'repository'),
+ array('xhtml', 'quiz'), array('cancel')));
break;
case 'core_comment':
$module = array('name' => 'core_comment',
@@ -413,6 +426,17 @@ class page_requirements_manager {
$module['fullpath'] = $this->js_fix_url($module['fullpath'])->out(false);
+ // add all needed strings
+ if (!empty($module['strings'])) {
+ foreach ($module['strings'] as $string) {
+ $identifier = $string[0];
+ $component = isset($string[1]) ? $string[1] : 'moodle';
+ $a = isset($string[2]) ? $string[2] : null;
+ $this->string_for_js($identifier, $component, $a);
+ }
+ }
+ unset($module['strings']);
+
if ($this->headdone) {
$this->extramodules[$module['name']] = $module;
} else {
diff --git a/repository/filepicker.js b/repository/filepicker.js
index b5d16e027c8..241f81060d1 100644
--- a/repository/filepicker.js
+++ b/repository/filepicker.js
@@ -14,7 +14,6 @@
*
* Filepicker options:
* =====
- * this.options.pix, stores all images used in file picker
* this.options.client_id, the instance id
* this.options.contextid
* this.options.itemid
@@ -321,7 +320,7 @@ M.core_filepicker.init = function(Y, options) {
var panel = Y.one('#panel-'+client_id);
var html = '
';
var upload_form = Y.Node.create(str);
@@ -840,7 +839,7 @@ M.core_filepicker.init = function(Y, options) {
var toolbar = Y.one('#repo-tb-'+client_id);
if(!r.nosearch) {
- var html = '
'+mstr.repository.search+'';
+ var html = '
'+mstr.repository.search+'';
var search = Y.Node.create(html);
search.on('click', function() {
scope.request({
@@ -921,7 +920,7 @@ M.core_filepicker.init = function(Y, options) {
}
// weather we use cache for this instance, this button will reload listing anyway
if(!r.norefresh) {
- var html = '
'+mstr.repository.refresh+'';
+ var html = '
'+mstr.repository.refresh+'';
var refresh = Y.Node.create(html);
refresh.on('click', function() {
this.list();
@@ -929,7 +928,7 @@ M.core_filepicker.init = function(Y, options) {
toolbar.appendChild(refresh);
}
if(!r.nologin) {
- var html = '
'+mstr.repository.logout+'';
+ var html = '
'+mstr.repository.logout+'';
var logout = Y.Node.create(html);
logout.on('click', function() {
this.request({
@@ -950,14 +949,14 @@ M.core_filepicker.init = function(Y, options) {
var mgr = document.createElement('A');
mgr.href = r.manage;
mgr.target = "_blank";
- mgr.innerHTML = '
'+mstr.repository.manageurl;
+ mgr.innerHTML = '
'+mstr.repository.manageurl;
toolbar.appendChild(mgr);
}
if(r.help) {
var help = document.createElement('A');
help.href = r.help;
help.target = "_blank";
- help.innerHTML = '
'+mstr.repository.help;
+ help.innerHTML = '
'+mstr.repository.help;
toolbar.appendChild(help);
}
diff --git a/repository/lib.php b/repository/lib.php
index 68d71191d87..392ab9a35b0 100644
--- a/repository/lib.php
+++ b/repository/lib.php
@@ -1777,50 +1777,6 @@ function initialise_filepicker($args) {
}
$return = new stdclass;
- $PAGE->requires->string_for_js('loading', 'repository');
- $PAGE->requires->string_for_js('title', 'repository');
- $PAGE->requires->string_for_js('preview', 'repository');
- $PAGE->requires->string_for_js('add', 'repository');
- $PAGE->requires->string_for_js('back', 'repository');
- $PAGE->requires->string_for_js('cancel', 'moodle');
- $PAGE->requires->string_for_js('close', 'repository');
- $PAGE->requires->string_for_js('cleancache', 'repository');
- $PAGE->requires->string_for_js('copying', 'repository');
- $PAGE->requires->string_for_js('getfile', 'repository');
- $PAGE->requires->string_for_js('downloadsucc', 'repository');
- $PAGE->requires->string_for_js('date', 'repository').': ';
- $PAGE->requires->string_for_js('error', 'repository');
- $PAGE->requires->string_for_js('emptylist', 'repository');
- $PAGE->requires->string_for_js('filenotnull', 'repository');
- $PAGE->requires->string_for_js('federatedsearch', 'repository');
- $PAGE->requires->string_for_js('help', 'moodle');
- $PAGE->requires->string_for_js('refresh', 'repository');
- $PAGE->requires->string_for_js('invalidjson', 'repository');
- $PAGE->requires->string_for_js('listview', 'repository');
- $PAGE->requires->string_for_js('linkexternal', 'repository');
- $PAGE->requires->string_for_js('login', 'repository');
- $PAGE->requires->string_for_js('logout', 'repository');
- $PAGE->requires->string_for_js('loading', 'repository');
- $PAGE->requires->string_for_js('iconview', 'repository');
- $PAGE->requires->string_for_js('title', 'repository');
- $PAGE->requires->string_for_js('noresult', 'repository');
- $PAGE->requires->string_for_js('manageurl', 'repository');
- $PAGE->requires->string_for_js('noenter', 'repository');
- $PAGE->requires->string_for_js('save', 'repository');
- $PAGE->requires->string_for_js('saveas', 'repository').': ';
- $PAGE->requires->string_for_js('saved', 'repository');
- $PAGE->requires->string_for_js('saving', 'repository');
- $PAGE->requires->string_for_js('size', 'repository').': ';
- $PAGE->requires->string_for_js('sync', 'repository');
- $PAGE->requires->string_for_js('search', 'repository');
- $PAGE->requires->string_for_js('searching', 'repository');
- $PAGE->requires->string_for_js('submit', 'repository');
- $PAGE->requires->string_for_js('preview', 'repository');
- $PAGE->requires->string_for_js('popup', 'repository');
- $PAGE->requires->string_for_js('upload', 'repository').'...';
- $PAGE->requires->string_for_js('uploading', 'repository');
- $PAGE->requires->string_for_js('xhtmlerror', 'repository');
-
$user_context = get_context_instance(CONTEXT_USER, $USER->id);
$externallink = (int)get_config(null, 'repositoryallowexternallinks');
@@ -1838,14 +1794,6 @@ function initialise_filepicker($args) {
$return->externallink = true;
}
- $return->pix = array();
- $return->pix['loading'] = $OUTPUT->pix_url('i/loading')->out();
- $return->pix['logout'] = $OUTPUT->pix_url('a/logout')->out();
- $return->pix['help'] = $OUTPUT->pix_url('a/help')->out();
- $return->pix['progressbar'] = $OUTPUT->pix_url('i/progressbar')->out();
- $return->pix['search'] = $OUTPUT->pix_url('a/search')->out();
- $return->pix['setting'] = $OUTPUT->pix_url('a/setting')->out();
- $return->pix['refresh'] = $OUTPUT->pix_url('a/refresh')->out();
// provided by form element
$return->accepted_types = $ft->get_extensions($args->accepted_types);
foreach ($repositories as $repository) {