Project

General

Profile

1
//\/////
2

    
3
//\  overLIB Exclusive Plugin
4

    
5
//\  This file requires overLIB 4.10 or later.
6

    
7
//\
8

    
9
//\  overLIB 4.05 - You may not remove or change this notice.
10

    
11
//\  Copyright Erik Bosrup 1998-2004. All rights reserved.
12

    
13
//\  Contributors are listed on the homepage.
14

    
15
//\  See http://www.bosrup.com/web/overlib/ for details.
16

    
17
//   $Revision$                      $Date$
18

    
19
//\/////
20

    
21
//\mini
22

    
23
////////
24

    
25
// PRE-INIT
26

    
27
// Ignore these lines, configuration is below.
28

    
29
////////
30

    
31
if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.10)) alert('overLIB 4.10 or later is required for the Debug Plugin.');
32

    
33
else {
34

    
35
registerCommands('exclusive,exclusivestatus,exclusiveoverride');
36

    
37
var olOverrideIsSet;  // variable which tells if override is set
38

    
39

    
40

    
41

    
42

    
43
////////
44

    
45
// DEFAULT CONFIGURATION
46

    
47
// Settings you want everywhere are set here. All of this can also be
48

    
49
// changed on your html page or through an overLIB call.
50

    
51
////////
52

    
53
if (typeof ol_exclusive == 'undefined') var ol_exclusive = 0;
54

    
55
if (typeof ol_exclusivestatus == 'undefined') var ol_exclusivestatus = 'Please close open popup first.';
56

    
57

    
58

    
59
////////
60

    
61
// END OF CONFIGURATION
62

    
63
// Don't change anything below this line, all configuration is above.
64

    
65
////////
66

    
67

    
68

    
69

    
70

    
71
////////
72

    
73
// INIT
74

    
75
////////
76

    
77
// Runtime variables init. Don't change for config!
78

    
79
var o3_exclusive = 0;
80

    
81
var o3_exclusivestatus = '';
82

    
83

    
84

    
85
////////
86

    
87
// PLUGIN FUNCTIONS
88

    
89
////////
90

    
91

    
92

    
93
// Set runtime variables
94

    
95
function setExclusiveVariables() {
96

    
97
	o3_exclusive = ol_exclusive;
98

    
99
	o3_exclusivestatus = ol_exclusivestatus;
100

    
101
}
102

    
103

    
104

    
105
// Parses Exclusive Parameters
106

    
107
function parseExclusiveExtras(pf,i,ar) {
108

    
109
	var k = i,v;
110

    
111

    
112

    
113
	olOverrideIsSet = false;  // a global variable
114

    
115

    
116

    
117
	if (k < ar.length) {
118

    
119
		if (ar[k] == EXCLUSIVEOVERRIDE) { if(pf !=  'ol_') olOverrideIsSet = true; return k; }
120

    
121
		if (ar[k] == EXCLUSIVE) { eval(pf +  'exclusive = (' +  pf + 'exclusive == 0) ? 1 : 0'); return k; }
122

    
123
		if (ar[k] == EXCLUSIVESTATUS) { eval(pf + "exclusivestatus = '" + escSglQuote(ar[++k]) + "'"); return k; }
124

    
125
	}
126

    
127

    
128

    
129
	return -1;
130

    
131
}
132

    
133

    
134

    
135
///////
136

    
137
//  HELPER FUNCTIONS
138

    
139
///////
140

    
141
// set status message and indicate whether popup is exclusive
142

    
143
function isExclusive(args) {
144

    
145
	var rtnVal = false;
146

    
147

    
148

    
149
	if(args != null) rtnVal = hasCommand(args, EXCLUSIVEOVERRIDE);
150

    
151

    
152

    
153
	if(rtnVal) return false;
154

    
155
	else {
156

    
157
		self.status = (o3_exclusive) ? o3_exclusivestatus : '';
158

    
159
		return o3_exclusive;
160

    
161
	}
162

    
163

    
164

    
165
}
166

    
167

    
168

    
169
// checks overlib argument list to see if it has a COMMAND argument
170

    
171
function hasCommand(args, COMMAND) {
172

    
173
	var rtnFlag = false;
174

    
175

    
176

    
177
	for (var i=0; i<args.length; i++) {
178

    
179
		if (typeof args[i] == 'number' &&  args[i] == COMMAND) {
180

    
181
			rtnFlag = true;
182

    
183
			break;
184

    
185
		}
186

    
187
	}
188

    
189

    
190

    
191
	return rtnFlag;
192

    
193
}
194

    
195

    
196

    
197
// makes sure exclusive setting is off
198

    
199
function clearExclusive() {
200

    
201
	o3_exclusive = 0;
202

    
203
}
204

    
205

    
206

    
207
function setExclusive() {
208

    
209
	o3_exclusive = (o3_showingsticky &&  o3_exclusive);
210

    
211
}
212

    
213

    
214

    
215
function chkForExclusive() {
216

    
217
	if (olOverrideIsSet) o3_exclusive = 0;  // turn it off in case it's been set.
218

    
219

    
220

    
221
	return true;
222

    
223
}
224

    
225

    
226

    
227
////////
228

    
229
// PLUGIN REGISTRATIONS
230

    
231
////////
232

    
233
registerRunTimeFunction(setExclusiveVariables);
234

    
235
registerCmdLineFunction(parseExclusiveExtras);
236

    
237
registerPostParseFunction(chkForExclusive);
238

    
239
registerHook("createPopup",setExclusive,FBEFORE);
240

    
241
registerHook("hideObject",clearExclusive,FAFTER);
242

    
243
if (olInfo.meets(4.10)) registerNoParameterCommands('exclusive');
244

    
245
}
(7-7/11)