Skip to content

Commit

Permalink
MDL-19756 Migrated the following functions from weblib to outputlib:
Browse files Browse the repository at this point in the history
1. button_to_popup_window
2. link_to_popup_window
3. print_single_button
4. print_spacer
5. print_file_picture (deprecated)
6. print_user_picture
7. print_png (deprecated)
8. helpbutton
9. doclink
10. print_paging_bar
11. notice_yesno
  • Loading branch information
nicolasconnault committed Jul 27, 2009
1 parent 9482c0f commit f8065dd
Show file tree
Hide file tree
Showing 18 changed files with 2,517 additions and 897 deletions.
1 change: 1 addition & 0 deletions group/autogroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 17,7 @@
}

$courseid = required_param('courseid', PARAM_INT);
$PAGE->set_url('/group/autogroup.php', array('courseid' => $courseid));

if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
print_error('invalidcourseid');
Expand Down
3 changes: 1 addition & 2 deletions group/autogroup_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 45,7 @@ function definition() {
$mform->setAdvanced('allocateby');

$mform->addElement('text', 'namingscheme', get_string('namingscheme', 'group'));
$mform->setHelpButton('namingscheme', array(false, get_string('namingschemehelp', 'group'),
false, true, false, get_string('namingschemehelp', 'group')));
$mform->setHelpButton('namingscheme', array('namingscheme', get_string('namingschemehelp', 'group'), 'group'));
$mform->addRule('namingscheme', get_string('required'), 'required', null, 'client');
$mform->setType('namingscheme', PARAM_MULTILANG);
// there must not be duplicate group names in course
Expand Down
7 changes: 7 additions & 0 deletions help.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 19,7 @@
$module = optional_param('module', 'moodle', PARAM_ALPHAEXT);
$forcelang = optional_param('forcelang', '', PARAM_SAFEDIR);
$skiplocal = optional_param('skiplocal', 0, PARAM_INT); // shall _local help files be skipped?
$fortooltip = optional_param('fortooltip', 0, PARAM_INT);

$PAGE->set_course($COURSE);

Expand Down Expand Up @@ -62,8 63,14 @@

// Finish buffer
$output = ob_get_contents();

ob_end_clean();

if ($fortooltip) {
echo shorten_text($output, 400, false, '<span class="readmore">' . get_string('clickhelpiconformoreinfo') . '</span>');
die();
}

// Determine title
$title = get_string('help'); // Default is just 'Help'
$matches = array();
Expand Down
6 changes: 3 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 66,9 @@
add_to_log(SITEID, 'course', 'view', 'view.php?id='.SITEID, SITEID);
}

$PAGE->set_pagetype('site-index');
$PAGE->set_course($SITE);

if (empty($CFG->langmenu)) {
$langmenu = '';
} else {
Expand All @@ -74,9 77,6 @@
$langlabel = get_accesshide(get_string('language'));
$langmenu = popup_form($CFG->wwwroot .'/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel);
}

$PAGE->set_pagetype('site-index');
$PAGE->set_course($SITE);
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
$PAGE->set_url('');
$PAGE->set_docs_path('');
Expand Down
2 changes: 2 additions & 0 deletions lang/en_utf8/help/group/namingscheme.html
Original file line number Diff line number Diff line change
@@ -0,0 1,2 @@
<h2>Naming scheme</h2>
<p>Use @ character to represent the group letter (A-Z) or # to represent the group number.</p>
1 change: 1 addition & 0 deletions lang/en_utf8/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 242,7 @@
$string['clamunknownerror'] = 'There was an unknown error with clam.';
$string['cleaningtempdata'] = 'Cleaning temp data';
$string['clear'] = 'Clear';
$string['clickhelpiconformoreinfo'] = '... continues ... Click on the help icon to read the full article';
$string['clickhere'] = 'Click here ...';
$string['clicktochange'] = 'Click to change';
$string['clicktohideshow'] = 'Click to expand or collapse';
Expand Down
15 changes: 11 additions & 4 deletions lib/ajax/ajaxlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 32,7 @@
* @param page_requirements_manager $requires The page_requirements_manager to initialise.
*/
function setup_core_javascript(page_requirements_manager $requires) {
global $CFG;
global $CFG, $OUTPUT;

// JavaScript should always work with $CFG->httpswwwroot rather than $CFG->wwwroot.
// Otherwise, in some situations, users will get warnings about insecure content
Expand All @@ -41,6 41,7 @@ function setup_core_javascript(page_requirements_manager $requires) {
$config = array(
'wwwroot' => $CFG->httpswwwroot, // Yes, really. See above.
'sesskey' => sesskey(),
'loadingicon' => $OUTPUT->old_icon_url('i/loading_small')
);
if (debugging('', DEBUG_DEVELOPER)) {
$config['developerdebug'] = true;
Expand All @@ -56,6 57,12 @@ function setup_core_javascript(page_requirements_manager $requires) {
// 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->string_for_js('confirmation', 'moodle');
$requires->string_for_js('cancel', 'moodle');
$requires->string_for_js('yes', 'moodle');
$requires->js_function_call('init_help_icons');
}


Expand Down Expand Up @@ -364,8 371,9 @@ public function data_for_js($variable, $data) {
* @return required_event_handler The event_handler object
*/
public function event_handler($id, $event, $function, $arguments=array()) {
$requirement = new required_event_handler($id, $event, $function, $arguments);
$requirement = new required_event_handler($this, $id, $event, $function, $arguments);
$this->requiredjscode[] = $requirement;
$this->linkedrequirements[] = new required_yui_lib($this, 'event');
return $requirement;
}

Expand Down Expand Up @@ -1109,7 1117,6 @@ class required_event_handler extends required_js_code {
* @param array $arguments An optional array of argument parameters to pass to the function
*/
public function __construct(page_requirements_manager $manager, $id, $event, $function, $args=array()) {
$manager->requires->yui_lib('event');
parent::__construct($manager);
$this->id = $id;
$this->event = $event;
Expand All @@ -1118,7 1125,7 @@ public function __construct(page_requirements_manager $manager, $id, $event, $fu
}

public function get_js_code() {
$output = "YAHOO.util.Event.addListener($this->id, '$this->event', $this->function";
$output = "YAHOO.util.Event.addListener('$this->id', '$this->event', $this->function";
if (!empty($this->args)) {
$output .= ', ' . json_encode($this->args);
}
Expand Down
Loading

0 comments on commit f8065dd

Please sign in to comment.