MDL-16654 Move javascript used by the emoticons help file from javascript.php to javascript-static.js. Fix it so that it actually works.

This commit is contained in:
tjhunt 2008-09-25 10:07:11 +00:00
parent 16851b22ad
commit 740939ec61
5 changed files with 99 additions and 75 deletions

View file

@ -142,7 +142,7 @@ if(preg_match('~^(.*?)<title>(.*?)</title>(.*)$~s',$output,$matches)) {
// use ##emoticons_html## to replace the emoticons documentation
if(preg_match('~(##emoticons_html##)~', $output, $matches)) {
$output = preg_replace('~(##emoticons_html##)~', get_emoticons_html(), $output);
$output = preg_replace('~(##emoticons_html##)~', get_emoticons_list_for_help_file(), $output);
}
// Do the main output.
@ -163,29 +163,6 @@ echo '<p class="helpindex"><a href="help.php?file=index.html">'. get_string('hel
$CFG->docroot = ''; // We don't want a doc link here
print_footer('none');
// Utility function =================================================================
function get_emoticons_html(){
global $CFG;
$output = '';
$emoticonstring = $CFG->emoticons;
$output .= '<ul>';
if ($emoticonstring) {
$items = explode('{;}', $CFG->emoticons);
foreach ($items as $item) {
$item = explode('{:}', $item);
$emoticons[$item[0]] = $item[1];
$output .= '<li><a href="javascript:inserttext(\''.$item[0].'\')"><img src="'.
$CFG->pixpath.'/s/'.$item[1].'.gif" alt="'.$item[0].'" /></a>'.' <code>'.$item[0].
'</code></li>';
}
}
$output .= '</ul>';
return $output;
}
function file_exists_and_readable($filepath) {
return file_exists($filepath) and is_file($filepath) and is_readable($filepath);
}