Merge branch 'MDL-43243-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Sam Hemelryk 2013-12-24 11:56:01 +13:00
commit 946e770ede
3 changed files with 23 additions and 12 deletions

View file

@ -109,7 +109,7 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{
if (count($options->repositories) > 0) { if (count($options->repositories) > 0) {
$straddlink = get_string('choosealink', 'repository'); $straddlink = get_string('choosealink', 'repository');
$str .= <<<EOD $str .= <<<EOD
<button id="filepicker-button-{$client_id}" style="display:none"> <button id="filepicker-button-{$client_id}" class="visibleifjs">
$straddlink $straddlink
</button> </button>
EOD; EOD;
@ -120,7 +120,6 @@ EOD;
$module = array('name'=>'form_url', 'fullpath'=>'/lib/form/url.js', 'requires'=>array('core_filepicker')); $module = array('name'=>'form_url', 'fullpath'=>'/lib/form/url.js', 'requires'=>array('core_filepicker'));
$PAGE->requires->js_init_call('M.form_url.init', array($options), true, $module); $PAGE->requires->js_init_call('M.form_url.init', array($options), true, $module);
$PAGE->requires->js_function_call('show_item', array('filepicker-button-'.$client_id));
return $str; return $str;
} }

View file

@ -1159,8 +1159,11 @@ function insertAtCursor(myField, myValue) {
Call instead of setting window.onload directly or setting body onload=. Call instead of setting window.onload directly or setting body onload=.
Adds your function to a chain of functions rather than overwriting anything Adds your function to a chain of functions rather than overwriting anything
that exists. that exists.
@deprecated Since Moodle 2.7. This will be removed in Moodle 2.9.
*/ */
function addonload(fn) { function addonload(fn) {
Y.log('addonload has been deprecated since Moodle 2.7 and will be removed in Moodle 2.9',
'warn', 'javascript-static.js');
var oldhandler=window.onload; var oldhandler=window.onload;
window.onload=function() { window.onload=function() {
if(oldhandler) oldhandler(); if(oldhandler) oldhandler();
@ -1181,8 +1184,11 @@ function addonload(fn) {
* document, use `document`. * document, use `document`.
* @param {String} strTagName filter by tag names * @param {String} strTagName filter by tag names
* @param {String} name same as HTML5 spec * @param {String} name same as HTML5 spec
* @deprecated Since Moodle 2.7. This will be removed in Moodle 2.9.
*/ */
function getElementsByClassName(oElm, strTagName, name) { function getElementsByClassName(oElm, strTagName, name) {
Y.log('getElementsByClassName has been deprecated since Moodle 2.7 and will be removed in Moodle 2.9',
'warn', 'javascript-static.js');
// for backwards compatibility // for backwards compatibility
if(typeof name == "object") { if(typeof name == "object") {
var names = new Array(); var names = new Array();
@ -1354,19 +1360,24 @@ function close_window(e) {
/** /**
* Used in a couple of modules to hide navigation areas when using AJAX * Used in a couple of modules to hide navigation areas when using AJAX
* @deprecated since Moodle 2.7. This function will be removed in Moodle 2.9.
*/ */
function show_item(itemid) { function show_item(itemid) {
var item = document.getElementById(itemid); Y.log('show_item has been deprecated since Moodle 2.7 and will be removed in Moodle 2.9',
'warn', 'javascript-static.js');
var item = Y.one('#' + itemid);
if (item) { if (item) {
item.style.display = ""; item.show();
} }
} }
// Deprecated since Moodle 2.7. This function will be removed in Moodle 2.9.
function destroy_item(itemid) { function destroy_item(itemid) {
var item = document.getElementById(itemid); Y.log('destroy_item has been deprecated since Moodle 2.7 and will be removed in Moodle 2.9',
'warn', 'javascript-static.js');
var item = Y.one('#' + itemid);
if (item) { if (item) {
item.parentNode.removeChild(item); item.remove(true);
} }
} }
/** /**
@ -1459,12 +1470,14 @@ function update_progress_bar (id, width, pt, msg, es){
/** /**
* Used in a couple of modules to hide navigation areas when using AJAX * Used in a couple of modules to hide navigation areas when using AJAX
* @deprecated since Moodle 2.7. This function will be removed in Moodle 2.9.
*/ */
function hide_item(itemid) { function hide_item(itemid) {
// use class='hiddenifjs' instead Y.log('hide_item has been deprecated since Moodle 2.7 and will be removed in Moodle 2.9',
var item = document.getElementById(itemid); 'warn', 'javascript-static.js');
var item = Y.one('#' + itemid);
if (item) { if (item) {
item.style.display = "none"; item.hide();
} }
} }

View file

@ -63,7 +63,7 @@ class data_field_url extends data_field_base {
$str .= '<label class="accesshide" for="' . $fieldid . '">'. $this->field->name .'</label>'; $str .= '<label class="accesshide" for="' . $fieldid . '">'. $this->field->name .'</label>';
$str .= '<input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.s($url).'" size="60" />'; $str .= '<input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.s($url).'" size="60" />';
if (count($options->repositories) > 0) { if (count($options->repositories) > 0) {
$str .= '<button id="filepicker-button-'.$options->client_id.'" style="display:none">'.$straddlink.'</button>'; $str .= '<button id="filepicker-button-'.$options->client_id.'" class="visibleifjs">'.$straddlink.'</button>';
} }
} }
@ -72,7 +72,6 @@ class data_field_url extends data_field_base {
$module = array('name'=>'data_urlpicker', 'fullpath'=>'/mod/data/data.js', 'requires'=>array('core_filepicker')); $module = array('name'=>'data_urlpicker', 'fullpath'=>'/mod/data/data.js', 'requires'=>array('core_filepicker'));
$PAGE->requires->js_init_call('M.data_urlpicker.init', array($options), true, $module); $PAGE->requires->js_init_call('M.data_urlpicker.init', array($options), true, $module);
$PAGE->requires->js_function_call('show_item', array('filepicker-button-'.$options->client_id));
$str .= '</div>'; $str .= '</div>';
return $str; return $str;