]> git.sur5r.net Git - bacula/bacula/blob - gui/bacula-web/js/overlib_exclusive.js
commit changes
[bacula/bacula] / gui / bacula-web / js / overlib_exclusive.js
1 //\/////
2 //\  overLIB Exclusive Plugin
3 //\  This file requires overLIB 4.00 or later.
4 //\
5 //\  overLIB 4.00 - 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
12 ////////
13 // PRE-INIT
14 // Ignore these lines, configuration is below.
15 ////////
16 if (typeof olInfo == 'undefined' || olInfo.simpleversion < 400) alert('overLIB 4.00 or later is required for the Debug Plugin.');
17 registerCommands('exclusive,exclusivestatus,exclusiveoverride');
18 var olOverrideIsSet;  // variable which tells if override is set
19
20
21 ////////
22 // DEFAULT CONFIGURATION
23 // Settings you want everywhere are set here. All of this can also be
24 // changed on your html page or through an overLIB call.
25 ////////
26 if (typeof ol_exclusive == 'undefined') var ol_exclusive = 0;
27 if (typeof ol_exclusivestatus == 'undefined') var ol_exclusivestatus = 'Please close open popup first.';
28
29 ////////
30 // END OF CONFIGURATION
31 // Don't change anything below this line, all configuration is above.
32 ////////
33
34
35 ////////
36 // INIT
37 ////////
38 // Runtime variables init. Don't change for config!
39 var o3_exclusive = 0;
40 var o3_exclusivestatus = '';
41
42 ////////
43 // PLUGIN FUNCTIONS
44 ////////
45
46 // Set runtime variables
47 function setExclusiveVariables() {
48         o3_exclusive = ol_exclusive;
49         o3_exclusivestatus = ol_exclusivestatus;
50 }
51
52 // Parses Exclusive Parameters
53 function parseExclusiveExtras(pf,i,ar) {
54         var k = i,v;
55
56         olOverrideIsSet = false;  // a global variable
57
58         if (k < ar.length) {
59                 if (ar[k] == EXCLUSIVEOVERRIDE) { if(pf !=  'ol_') olOverrideIsSet = true; return k; }
60                 if (ar[k] == EXCLUSIVE) { eval(pf +  'exclusive = (' +  pf + 'exclusive == 0) ? 1 : 0'); return k; }
61                 if (ar[k] == EXCLUSIVESTATUS) { eval(pf + "exclusivestatus = '" + escSglQuote(ar[++k]) + "'"); return k; }
62         }
63
64         return -1;
65 }
66
67 ///////
68 //  HELPER FUNCTIONS
69 ///////
70 // set status message and indicate whether popup is exclusive
71 function isExclusive(args) {
72         var rtnVal = false;
73
74         if(args != null) rtnVal = hasCommand(args, EXCLUSIVEOVERRIDE);
75
76         if(rtnVal) return false;
77         else {
78                 self.status = (o3_exclusive) ? o3_exclusivestatus : '';
79                 return o3_exclusive;
80         }
81
82 }
83
84 // checks overlib argument list to see if it has a COMMAND argument
85 function hasCommand(args, COMMAND) {
86         var rtnFlag = false;
87
88         for (var i=0; i<args.length; i++) {
89                 if (typeof args[i] == 'number' &&  args[i] == COMMAND) {
90                         rtnFlag = true;
91                         break;
92                 }
93         }
94
95         return rtnFlag;
96 }
97
98 // makes sure exclusive setting is off
99 function clearExclusive() {
100         o3_exclusive = 0;
101 }
102
103 function setExclusive() {
104         o3_exclusive = (o3_showingsticky &&  o3_exclusive);
105 }
106
107 function chkForExclusive() {
108         if (olOverrideIsSet) o3_exclusive = 0;  // turn it off in case it's been set.
109
110         return true;
111 }
112
113 ////////
114 // PLUGIN REGISTRATIONS
115 ////////
116 registerRunTimeFunction(setExclusiveVariables);
117 registerCmdLineFunction(parseExclusiveExtras);
118 registerPostParseFunction(chkForExclusive);
119 registerHook("createPopup",setExclusive,FBEFORE);
120 registerHook("hideObject",clearExclusive,FAFTER);
121
122