Skip to content

Commit

Permalink
MDL-21139 replace all yui functions/methods with yui2 to make room fo…
Browse files Browse the repository at this point in the history
…r yui3
  • Loading branch information
skodak committed Dec 16, 2009
1 parent 39302c7 commit f44b10e
Show file tree
Hide file tree
Showing 48 changed files with 139 additions and 139 deletions.
2 changes: 1 addition & 1 deletion admin/report/capability/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}

// Include the required JavaScript.
$PAGE->requires->yui_lib('event');
$PAGE->requires->yui2_lib('event');
$PAGE->requires->js('admin/report/capability/script.js');
$PAGE->requires->js_function_call('capability_report.cap_filter_init', array(get_string('search')));

Expand Down
2 changes: 1 addition & 1 deletion admin/report/security/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

function report_security_hide_timearning() {
global $PAGE;
$PAGE->requires->yui_lib('dom');
$PAGE->requires->yui2_lib('dom');
$PAGE->requires->js_function_call('YAHOO.util.Dom.addClass', Array('timewarning', 'timewarninghidden'));
}

Expand Down
4 changes: 2 additions & 2 deletions admin/report/spamcleaner/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@

require_login();
admin_externalpage_setup('reportspamcleaner');
$PAGE->requires->yui_lib('json');
$PAGE->requires->yui_lib('connection');
$PAGE->requires->yui2_lib('json');
$PAGE->requires->yui2_lib('connection');

// Implement some AJAX calls

Expand Down
2 changes: 1 addition & 1 deletion admin/roles/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
}

/// Print the header and tabs
$PAGE->requires->yui_lib('dom-event');
$PAGE->requires->yui2_lib('dom-event');
$PAGE->requires->js($CFG->admin . '/roles/roles.js');
if ($context->contextlevel == CONTEXT_USER) {
$user = $DB->get_record('user', array('id'=>$userid));
Expand Down
2 changes: 1 addition & 1 deletion admin/roles/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function display() {
echo "</tbody>\n</table>\n";
if (count($this->capabilities) > capability_table_base::NUM_CAPS_FOR_SEARCH) {
global $CFG, $PAGE;
$PAGE->requires->yui_lib('dom-event');
$PAGE->requires->yui2_lib('dom-event');
$PAGE->requires->js($CFG->admin . '/roles/roles.js');
$PAGE->requires->js_function_call('cap_table_filter.init',
array($this->id, get_string('filter'), get_string('clear')));
Expand Down
2 changes: 1 addition & 1 deletion blocks/admin_tree/block_admin_tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function get_content() {
}

if ($this->tempcontent !== '') {
$this->page->requires->yui_lib('event');
$this->page->requires->yui2_lib('event');
$this->page->requires->js('blocks/admin_tree/admintree.js');
$this->page->requires->js_function_call('admin_tree.init',
array($this->divcounter - 1, $this->expandnodes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function get_content() {
if ($this->contentgenerated === true) {
return true;
}
$this->page->requires->yui_lib('dom');
$this->page->requires->yui2_lib('dom');
$this->page->requires->js('lib/javascript-navigation.js');
// Navcount is used to allow us to have multiple trees although I dont' know why
// you would want to trees the same
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function get_content() {
if ($this->contentgenerated === true) {
return true;
}
$this->page->requires->yui_lib('dom');
$this->page->requires->yui2_lib('dom');
$this->page->requires->js('lib/javascript-navigation.js');
block_settings_navigation_tree::$navcount++;

Expand Down
2 changes: 1 addition & 1 deletion calendar/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
redirect($eventurl);
}

$PAGE->requires->yui_lib('animation');
$PAGE->requires->yui2_lib('animation');
$PAGE->requires->js('calendar/calendar.js');

$PAGE->navbar->add($strcalendar, $link);
Expand Down
2 changes: 1 addition & 1 deletion calendar/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ function calendar_get_popup($is_today, $event_timestart, $popupcontent='') {
$popupcaption .= get_string('eventsfor', 'calendar', userdate($event_timestart, get_string('strftimedayshort')));
}
$id = 'calendar_tooltip_'.$popupcount;
$PAGE->requires->yui_lib('container');
$PAGE->requires->yui2_lib('container');
$PAGE->requires->js_function_call('YAHOO.moodle.calendar.attach_calendar_panel', Array(Array('id'=>$id,'title'=>$popupcaption, 'content'=>$popupcontent)));
$popupcount++;
return 'id="'.$id.'"';
Expand Down
2 changes: 1 addition & 1 deletion calendar/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
$PAGE->set_headingmenu(user_login_string($site));
$PAGE->set_button($prefsbutton);

$PAGE->requires->yui_lib('animation');
$PAGE->requires->yui2_lib('animation');
$PAGE->requires->js('calendar/calendar.js');

echo $OUTPUT->header();
Expand Down
12 changes: 6 additions & 6 deletions comment/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/comment:delete', $context);

$PAGE->requires->yui_lib('yahoo')->in_head();
$PAGE->requires->yui_lib('dom')->in_head();
$PAGE->requires->yui_lib('event')->in_head();
$PAGE->requires->yui_lib('animation')->in_head();
$PAGE->requires->yui_lib('json')->in_head();
$PAGE->requires->yui_lib('connection')->in_head();
$PAGE->requires->yui2_lib('yahoo')->in_head();
$PAGE->requires->yui2_lib('dom')->in_head();
$PAGE->requires->yui2_lib('event')->in_head();
$PAGE->requires->yui2_lib('animation')->in_head();
$PAGE->requires->yui2_lib('json')->in_head();
$PAGE->requires->yui2_lib('connection')->in_head();
$PAGE->requires->js('comment/admin.js')->in_head();

$action = optional_param('action', '', PARAM_ALPHA);
Expand Down
2 changes: 1 addition & 1 deletion course/report/progress/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function csv_quote($value) {
echo $OUTPUT->header();

if($svgcleverness) {
$PAGE->requires->yui_lib('event');
$PAGE->requires->yui2_lib('event');
$PAGE->requires->js('course/report/progress/textrotate.js');
}

Expand Down
8 changes: 4 additions & 4 deletions course/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@
// Course-based switches

if (ajaxenabled($CFG->ajaxtestedbrowsers)) { // Browser, user and site-based switches
$PAGE->requires->yui_lib('dragdrop')->asap();
$PAGE->requires->yui_lib('connection')->asap();
$PAGE->requires->yui_lib('selector')->asap();
$PAGE->requires->yui2_lib('dragdrop')->asap();
$PAGE->requires->yui2_lib('connection')->asap();
$PAGE->requires->yui2_lib('selector')->asap();
$PAGE->requires->js('lib/ajax/block_classes.js')->asap();
$PAGE->requires->js('lib/ajax/section_classes.js')->asap();

Expand All @@ -178,7 +178,7 @@

$completion = new completion_info($course);
if ($completion->is_enabled() && ajaxenabled()) {
$PAGE->requires->yui_lib('connection')->asap();
$PAGE->requires->yui2_lib('connection')->asap();
$PAGE->requires->js('course/completion.js')->asap();
$PAGE->requires->js_function_call('completion_init')->on_dom_ready();
$PAGE->requires->data_for_js('completion_strsaved', get_string('saved', 'completion'));
Expand Down
14 changes: 7 additions & 7 deletions grade/edit/tree/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
require_once $CFG->dirroot.'/grade/report/lib.php'; // for preferences
require_once $CFG->dirroot.'/grade/edit/tree/lib.php';

$PAGE->requires->yui_lib('event');
$PAGE->requires->yui_lib('json');
$PAGE->requires->yui_lib('connection');
$PAGE->requires->yui_lib('dragdrop');
$PAGE->requires->yui_lib('element');
$PAGE->requires->yui_lib('container');
$PAGE->requires->yui_lib('animation');
$PAGE->requires->yui2_lib('event');
$PAGE->requires->yui2_lib('json');
$PAGE->requires->yui2_lib('connection');
$PAGE->requires->yui2_lib('dragdrop');
$PAGE->requires->yui2_lib('element');
$PAGE->requires->yui2_lib('container');
$PAGE->requires->yui2_lib('animation');
$PAGE->requires->js('grade/edit/tree/functions.js');

$courseid = required_param('id', PARAM_INT);
Expand Down
12 changes: 6 additions & 6 deletions grade/report/grader/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@
// Initialise the grader report object
$report = new grade_report_grader($courseid, $gpr, $context, $page, $sortitemid);

$PAGE->requires->yui_lib('event');
$PAGE->requires->yui_lib('json');
$PAGE->requires->yui_lib('connection');
$PAGE->requires->yui_lib('dragdrop');
$PAGE->requires->yui_lib('element');
$PAGE->requires->yui_lib('container');
$PAGE->requires->yui2_lib('event');
$PAGE->requires->yui2_lib('json');
$PAGE->requires->yui2_lib('connection');
$PAGE->requires->yui2_lib('dragdrop');
$PAGE->requires->yui2_lib('element');
$PAGE->requires->yui2_lib('container');
$PAGE->requires->js('grade/report/grader/functions.js');
$PAGE->requires->js('grade/report/grader/grader.js');
$PAGE->requires->js('lib/overlib/overlib.js')->in_head();
Expand Down
2 changes: 1 addition & 1 deletion group/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

ini_set('include_path', $CFG->libdir.'/pear'.PATH_SEPARATOR.ini_get('include_path'));

$PAGE->requires->yui_lib('connection');
$PAGE->requires->yui2_lib('connection');
$PAGE->requires->js('group/clientlib.js');

$courseid = required_param('id', PARAM_INT);
Expand Down
2 changes: 1 addition & 1 deletion iplookup/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@

$PAGE->requires->js("http://maps.google.com/maps?file=api&amp;v=2&amp;key=$CFG->googlemapkey", true)->in_head();
$PAGE->requires->js('/iplookup/functions.js')->in_head();
$PAGE->requires->yui_lib('event');
$PAGE->requires->yui2_lib('event');
$PAGE->requires->js_function_call('iplookup_load', array($latitude, $longitude));

$PAGE->set_title(get_string('iplookup', 'admin').': '.$info);
Expand Down
30 changes: 15 additions & 15 deletions lib/ajax/ajaxlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ function setup_core_javascript(page_requirements_manager $requires) {
$requires->data_for_js('moodle_cfg', $config)->in_head();

if (debugging('', DEBUG_DEVELOPER)) {
$requires->yui_lib('logger');
$requires->yui2_lib('logger');
}

$requires->skip_link_to('maincontent', get_string('tocontent', 'access'));

// Note that, as a short-cut, the code
// $js = "document.body.className += ' jsenabled';\n";
// is hard-coded in {@link page_requirements_manager::get_top_of_body_code)
$requires->yui_lib('container');
$requires->yui_lib('connection');
$requires->yui2_lib('container');
$requires->yui2_lib('connection');
$requires->string_for_js('confirmation', 'admin');
$requires->string_for_js('cancel', 'moodle');
$requires->string_for_js('yes', 'moodle');
Expand Down Expand Up @@ -154,14 +154,14 @@ public function js($jsfile, $fullurl = false) {
* of other libraries) it will only be linked to once.
*
* @param $libname the name of the YUI library you require. For example 'autocomplete'.
* @return required_yui_lib A requried_yui_lib object. This allows you to control when the
* link to the script is output by calling methods like {@link required_yui_lib::asap()} or
* {@link required_yui_lib::in_head()}.
* @return required_yui2_lib A required_yui2_lib object. This allows you to control when the
* link to the script is output by calling methods like {@link required_yui2_lib::asap()} or
* {@link required_yui2_lib::in_head()}.
*/
public function yui_lib($libname) {
public function yui2_lib($libname) {
$key = 'yui:' . $libname;
if (!isset($this->linkedrequirements[$key])) {
$this->linkedrequirements[$key] = new required_yui_lib($this, $libname);
$this->linkedrequirements[$key] = new required_yui2_lib($this, $libname);
}
return $this->linkedrequirements[$key];
}
Expand Down Expand Up @@ -370,7 +370,7 @@ public function data_for_js($variable, $data) {
public function event_handler($id, $event, $function, $arguments=array()) {
$requirement = new required_event_handler($this, $id, $event, $function, $arguments);
$this->requiredjscode[] = $requirement;
$this->linkedrequirements[] = new required_yui_lib($this, 'event');
$this->linkedrequirements[] = new required_yui2_lib($this, 'event');
return $requirement;
}

Expand Down Expand Up @@ -689,7 +689,7 @@ public function at_top_of_body() {
*
* The methods {@link asap()}, {@link in_head()} and {@link at_top_of_body()}
* are indented to be used as a fluid API, so you can say things like
* $PAGE->requires->yui_lib('autocomplete')->in_head();
* $PAGE->requires->yui2_lib('autocomplete')->in_head();
*
* This class (with the help of {@link ajax_resolve_yui2_lib()}) knows about the
* dependancies between the different YUI libraries, and will include all the
Expand All @@ -704,13 +704,13 @@ public function at_top_of_body() {
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
*/
class required_yui_lib extends linked_requirement {
class required_yui2_lib extends linked_requirement {
protected $jss = array();

/**
* Constructor. Normally instances of this class should not be created
* directly. Client code should create them via the page_requirements_manager
* method {@link page_requirements_manager::yui_lib()}.
* method {@link page_requirements_manager::yui2_lib()}.
*
* @param page_requirements_manager $manager the page_requirements_manager we are associated with.
* @param string $libname The name of the YUI library you want. See the array
Expand Down Expand Up @@ -739,7 +739,7 @@ public function get_html() {
* is responsible for outputting this HTML promptly. For example, a good way to
* call this method is like
* <pre>
* echo $PAGE->requires->yui_lib(...)->asap();
* echo $PAGE->requires->yui2_lib(...)->asap();
* </pre>
*/
public function asap() {
Expand Down Expand Up @@ -848,7 +848,7 @@ class required_skip_link extends linked_requirement {
/**
* Constructor. Normally instances of this class should not be created directly.
* Client code should create them via the page_requirements_manager
* method {@link page_requirements_manager::yui_lib()}.
* method {@link page_requirements_manager::yui2_lib()}.
*
* @param page_requirements_manager $manager the page_requirements_manager we are associated with.
* @param string $target the name of the anchor in the page we are linking to.
Expand Down Expand Up @@ -1015,7 +1015,7 @@ public function on_dom_ready() {
if ($this->is_done() || $this->when < page_requirements_manager::WHEN_AT_END) {
return;
}
$this->manager->yui_lib('event');
$this->manager->yui2_lib('event');
$this->when = page_requirements_manager::WHEN_ON_DOM_READY;
}

Expand Down
12 changes: 6 additions & 6 deletions lib/commentlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ public static function js() {
self::$comment_context = optional_param('comment_context', '', PARAM_INT);
self::$comment_area = optional_param('comment_area', '', PARAM_ALPHAEXT);

$PAGE->requires->yui_lib('yahoo')->in_head();
$PAGE->requires->yui_lib('dom')->in_head();
$PAGE->requires->yui_lib('event')->in_head();
$PAGE->requires->yui_lib('animation')->in_head();
$PAGE->requires->yui_lib('json')->in_head();
$PAGE->requires->yui_lib('connection')->in_head();
$PAGE->requires->yui2_lib('yahoo')->in_head();
$PAGE->requires->yui2_lib('dom')->in_head();
$PAGE->requires->yui2_lib('event')->in_head();
$PAGE->requires->yui2_lib('animation')->in_head();
$PAGE->requires->yui2_lib('json')->in_head();
$PAGE->requires->yui2_lib('connection')->in_head();
$PAGE->requires->js('comment/comment.js')->in_head();
$PAGE->requires->string_for_js('addcomment', 'moodle');
$PAGE->requires->string_for_js('deletecomment', 'moodle');
Expand Down
8 changes: 4 additions & 4 deletions lib/deprecatedlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1672,11 +1672,11 @@ function use_html_editor($name='', $editorhidebuttons='', $id='') {

/**
* The old method that was used to include JavaScript libraries.
* Please use $PAGE->requires->js() or $PAGE->requires->yui_lib() instead.
* Please use $PAGE->requires->js() or $PAGE->requires->yui2_lib() instead.
*
* @param mixed $lib The library or libraries to load (a string or array of strings)
* There are three way to specify the library:
* 1. a shorname like 'yui_yahoo'. This translates into a call to $PAGE->requires->yui_lib('yahoo')->asap();
* 1. a shorname like 'yui_yahoo'. This translates into a call to $PAGE->requires->yui2_lib('yahoo')->asap();
* 2. the path to the library relative to wwwroot, for example 'lib/javascript-static.js'
* 3. (legacy) a full URL like $CFG->wwwroot . '/lib/javascript-static.js'.
* 2. and 3. lead to a call $PAGE->requires->js('/lib/javascript-static.js').
Expand All @@ -1694,10 +1694,10 @@ function require_js($lib) {

// TODO uncomment this once we have eliminated the remaining calls to require_js from core.
//debugging('Call to deprecated function require_js. Please use $PAGE->requires->js() ' .
// 'or $PAGE->requires->yui_lib() instead.', DEBUG_DEVELOPER);
// 'or $PAGE->requires->yui2_lib() instead.', DEBUG_DEVELOPER);

if (strpos($lib, 'yui_') === 0) {
echo $PAGE->requires->yui_lib(substr($lib, 4))->asap();
echo $PAGE->requires->yui2_lib(substr($lib, 4))->asap();
} else if (preg_match('/^https?:/', $lib)) {
echo $PAGE->requires->js(str_replace($CFG->wwwroot, '', $lib))->asap();
} else {
Expand Down
6 changes: 3 additions & 3 deletions lib/form/filemanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function MoodleQuickForm_filemanager($elementName=null, $elementLabel=null, $att
require_once("$CFG->dirroot/repository/lib.php");

// has to require these js files before head
$PAGE->requires->yui_lib('menu');
$PAGE->requires->yui_lib('connection');
$PAGE->requires->yui_lib('json');
$PAGE->requires->yui2_lib('menu');
$PAGE->requires->yui2_lib('connection');
$PAGE->requires->yui2_lib('json');

$options = (array)$options;
foreach ($options as $name=>$value) {
Expand Down
2 changes: 1 addition & 1 deletion lib/form/searchableselector.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function toHtml(){
} else {
// Javascript for the search/selection fields
global $PAGE;
$PAGE->requires->yui_lib('event');
$PAGE->requires->yui2_lib('event');
$PAGE->requires->js('lib/form/searchableselector.js');
$PAGE->requires->js_function_call('selector.filter_init', array(get_string('search'),$this->getAttribute('id')));

Expand Down
6 changes: 3 additions & 3 deletions lib/formslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ function form_init_date_js() {
global $PAGE;
static $done = false;
if (!$done) {
$PAGE->requires->yui_lib('calendar');
$PAGE->requires->yui_lib('container');
$PAGE->requires->yui2_lib('calendar');
$PAGE->requires->yui2_lib('container');
$PAGE->requires->js_function_call('init_date_selectors',
array(get_string('firstdayofweek')));
$done = true;
Expand Down Expand Up @@ -2158,7 +2158,7 @@ function renderHeader(&$header) {
}

if (isset($this->_advancedElements[$name])){
$PAGE->requires->yui_lib('event');
$PAGE->requires->yui2_lib('event');
// this is tricky - the first submit button on form is "clicked" if user presses enter
// we do not want to "submit" using advanced button if javascript active
$button_nojs = '<input name="'.$elementName.'" id="'.$elementName.(string)$advformcount.'" class="showadvancedbtn" value="'.$buttonlabel.'" type="submit" />';
Expand Down
Loading

0 comments on commit f44b10e

Please sign in to comment.