mirror of
https://github.com/moodle/moodle.git
synced 2025-02-08 17:11:49 +01:00
How it works: _ within the "sideblockheading" a DIV with class="hide-show" holds a link calling the JS containerDisplaySwitching(). To the user it's represented by the icon "switch.gif" (a plus in a square) at the right end side of the header. _ all content of the sideblock is surounded by a new <div class="blockcontent" id="'.$attributes['id']."_cont\">" _ a call of the JS containerDisplaySwitching() changes the state of the appropriate DIV with the content to "display:none/inline" and writes this state into a cookie. _ at the end of every block I added a call to the JS "containerDisplaySet()". This reads the block's state and hides the content or leaves it visible with every page load. _ in the stylesheet I added the positioning of the icon: .sideblockheading .hide-show { float:right; } .sideblockheading a img.hide-show-image { padding-top:0.25em; }
54 lines
2.0 KiB
PHP
54 lines
2.0 KiB
PHP
<?php /// $Id$
|
|
/// Load up any required Javascript libraries
|
|
|
|
if (!defined('MOODLE_INTERNAL')) {
|
|
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
|
}
|
|
|
|
if(!empty($CFG->aspellpath)) { // Enable global access to spelling feature.
|
|
echo '<script src="'.$CFG->wwwroot.'/lib/speller/spellChecker.js"></script>'."\n";
|
|
}
|
|
?>
|
|
<script language="JavaScript" type="text/javascript" src="<?php echo $CFG->wwwroot ?>/lib/overlib.js"></script>
|
|
<script language="JavaScript" type="text/javascript" src="<?php echo $CFG->wwwroot ?>/lib/javascript-static.js"></script>
|
|
<script language="JavaScript" type="text/javascript"
|
|
src="<?php echo "$CFG->wwwroot/lib/container.js" ?>"></script><script language="JavaScript" type="text/javascript"
|
|
src="<?php echo "$CFG->wwwroot/lib/cookies.js" ?>"></script>
|
|
<script language="JavaScript" type="text/javascript">
|
|
|
|
<!-- // Non-Static Javascript functions
|
|
|
|
function openpopup(url,name,options,fullscreen) {
|
|
fullurl = "<?php echo $CFG->wwwroot ?>" + url;
|
|
windowobj = window.open(fullurl,name,options);
|
|
if (fullscreen) {
|
|
windowobj.moveTo(0,0);
|
|
windowobj.resizeTo(screen.availWidth,screen.availHeight);
|
|
}
|
|
windowobj.focus();
|
|
return false;
|
|
}
|
|
|
|
function inserttext(text) {
|
|
<?php
|
|
if (!empty($SESSION->inserttextform)) {
|
|
$insertfield = "opener.document.forms['$SESSION->inserttextform'].$SESSION->inserttextfield";
|
|
} else {
|
|
$insertfield = "opener.document.forms['theform'].message";
|
|
}
|
|
echo " text = ' ' + text + ' ';\n";
|
|
echo " if ( $insertfield.createTextRange && $insertfield.caretPos) {\n";
|
|
echo " var caretPos = $insertfield.caretPos;\n";
|
|
echo " caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;\n";
|
|
echo " } else {\n";
|
|
echo " $insertfield.value += text;\n";
|
|
echo " }\n";
|
|
echo " $insertfield.focus();\n";
|
|
?>
|
|
}
|
|
|
|
<?php if (!empty($focus)) { echo "function setfocus() { document.$focus.focus() }\n"; } ?>
|
|
|
|
// done hiding -->
|
|
</script>
|