adding current groupid to grade_export class - soon to be used in plugins
[moodle-pu.git] / lib / overlib / overlib_exclusive.js
blobdae36cf1d5ecb9e4296b66978da10fa904433718
1 //\/////
2 //\ overLIB Exclusive Plugin
3 //\ This file requires overLIB 4.10 or later.
4 //\
5 //\ overLIB 4.05 - You may not remove or change this notice.
6 //\ Copyright Erik Bosrup 1998-2004. All rights reserved.
7 //\ Contributors are listed on the homepage.
8 //\ See http://www.bosrup.com/web/overlib/ for details.
9 // $Revision$ $Date$
10 //\/////
11 //\mini
12 ////////
13 // PRE-INIT
14 // Ignore these lines, configuration is below.
15 ////////
16 if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.10)) alert('overLIB 4.10 or later is required for the Debug Plugin.');
17 else {
18 registerCommands('exclusive,exclusivestatus,exclusiveoverride');
19 var olOverrideIsSet; // variable which tells if override is set
22 ////////
23 // DEFAULT CONFIGURATION
24 // Settings you want everywhere are set here. All of this can also be
25 // changed on your html page or through an overLIB call.
26 ////////
27 if (typeof ol_exclusive == 'undefined') var ol_exclusive = 0;
28 if (typeof ol_exclusivestatus == 'undefined') var ol_exclusivestatus = 'Please close open popup first.';
30 ////////
31 // END OF CONFIGURATION
32 // Don't change anything below this line, all configuration is above.
33 ////////
36 ////////
37 // INIT
38 ////////
39 // Runtime variables init. Don't change for config!
40 var o3_exclusive = 0;
41 var o3_exclusivestatus = '';
43 ////////
44 // PLUGIN FUNCTIONS
45 ////////
47 // Set runtime variables
48 function setExclusiveVariables() {
49 o3_exclusive = ol_exclusive;
50 o3_exclusivestatus = ol_exclusivestatus;
53 // Parses Exclusive Parameters
54 function parseExclusiveExtras(pf,i,ar) {
55 var k = i,v;
57 olOverrideIsSet = false; // a global variable
59 if (k < ar.length) {
60 if (ar[k] == EXCLUSIVEOVERRIDE) { if(pf != 'ol_') olOverrideIsSet = true; return k; }
61 if (ar[k] == EXCLUSIVE) { eval(pf + 'exclusive = (' + pf + 'exclusive == 0) ? 1 : 0'); return k; }
62 if (ar[k] == EXCLUSIVESTATUS) { eval(pf + "exclusivestatus = '" + escSglQuote(ar[++k]) + "'"); return k; }
65 return -1;
68 ///////
69 // HELPER FUNCTIONS
70 ///////
71 // set status message and indicate whether popup is exclusive
72 function isExclusive(args) {
73 var rtnVal = false;
75 if(args != null) rtnVal = hasCommand(args, EXCLUSIVEOVERRIDE);
77 if(rtnVal) return false;
78 else {
79 self.status = (o3_exclusive) ? o3_exclusivestatus : '';
80 return o3_exclusive;
85 // checks overlib argument list to see if it has a COMMAND argument
86 function hasCommand(args, COMMAND) {
87 var rtnFlag = false;
89 for (var i=0; i<args.length; i++) {
90 if (typeof args[i] == 'number' && args[i] == COMMAND) {
91 rtnFlag = true;
92 break;
96 return rtnFlag;
99 // makes sure exclusive setting is off
100 function clearExclusive() {
101 o3_exclusive = 0;
104 function setExclusive() {
105 o3_exclusive = (o3_showingsticky && o3_exclusive);
108 function chkForExclusive() {
109 if (olOverrideIsSet) o3_exclusive = 0; // turn it off in case it's been set.
111 return true;
114 ////////
115 // PLUGIN REGISTRATIONS
116 ////////
117 registerRunTimeFunction(setExclusiveVariables);
118 registerCmdLineFunction(parseExclusiveExtras);
119 registerPostParseFunction(chkForExclusive);
120 registerHook("createPopup",setExclusive,FBEFORE);
121 registerHook("hideObject",clearExclusive,FAFTER);
122 if (olInfo.meets(4.10)) registerNoParameterCommands('exclusive');