MDL-22067 - modify help popup functionality to use overlay.

This commit is contained in:
Rossiani Wijaya
2010-05-03 08:44:34 +00:00
parent d59a3f285b
commit 36282d8545
6 changed files with 189 additions and 32 deletions
+11 -7
View File
@@ -62,7 +62,7 @@ class renderer_base {
* @return string
*/
public function render(renderable $widget) {
$rendermethod = 'render_'.get_class($widget);
$rendermethod = 'render_'.get_class($widget);
if (method_exists($this, $rendermethod)) {
return $this->$rendermethod($widget);
}
@@ -623,6 +623,10 @@ class core_renderer extends renderer_base {
$output = $this->container_end_all(true);
$helpcontent_body = html_writer::tag('div', '<button class="closehelpbutton" type="button" id="hide"><img src="'.$this->pix_url('t/delete').'" alt="close" /></button>', array('class'=>'helpcontent_body'));
$output .= html_writer::tag('div', $helpcontent_body, array('id'=>'helpcontent', 'class'=>'yui3-overlay-loading'));
$this->page->requires->js_init_call('M.help_content.init');
$footer = $this->opencontainers->pop('header/footer');
if (debugging() and $DB and $DB->is_transaction_started()) {
@@ -645,7 +649,7 @@ class core_renderer extends renderer_base {
$footer = str_replace(self::END_HTML_TOKEN, $this->page->requires->get_end_code(), $footer);
$this->page->set_state(moodle_page::STATE_DONE);
return $output . $footer;
}
@@ -739,7 +743,7 @@ class core_renderer extends renderer_base {
$output = html_writer::tag('a', get_string('skipa', 'access', $skiptitle), array('href' => '#sb-' . $bc->skipid, 'class' => 'skip-block'));
$skipdest = html_writer::tag('span', '', array('id' => 'sb-' . $bc->skipid, 'class' => 'skip-block-to'));
}
$output .= html_writer::start_tag('div', $bc->attributes);
$controlshtml = $this->block_controls($bc->controls);
@@ -1460,9 +1464,9 @@ END;
$attributes = array('href'=>$url, 'title'=>$title);
$id = html_writer::random_id('helpicon');
$attributes['id'] = $id;
$this->add_action_handler(new popup_action('click', $url), $id);
$this->add_action_handler(new popup_action('click', $url, 'popup', array('id'=>$id)), $id);
$output = html_writer::tag('a', $output, $attributes);
// and finally span
return html_writer::tag('span', $output, array('class' => 'helplink'));
}
@@ -1476,7 +1480,7 @@ END;
* @return string HTML fragment
*/
public function help_icon($identifier, $component = 'moodle', $linktext = '') {
$icon = new help_icon($identifier, $component);
$icon = new help_icon($identifier, $component);
$icon->diag_strings();
if ($linktext === true) {
$icon->linktext = get_string($icon->identifier, $icon->component);
@@ -1523,7 +1527,7 @@ END;
$attributes = array('href'=>$url, 'title'=>$title);
$id = html_writer::random_id('helpicon');
$attributes['id'] = $id;
$this->add_action_handler(new popup_action('click', $url), $id);
$this->add_action_handler(new popup_action('click', $url, 'popup', array('id'=>$id)), $id);
$output = html_writer::tag('a', $output, $attributes);
// and finally span