Browse code

Initial uplad w/ php7 fixes

Rainer Volkrodt authored on 2016/03/12 15:54:02
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,309 @@
1
+
2
+function pop(theurl, w, h, scroll)
3
+{
4
+ var the_atts = "width="+w+", height="+h+", top=20, screenY=20, left=20, screenX=20,  toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars="+scroll+", resizable=yes, copyhistory=no";
5
+ // open window
6
+ window.open(theurl,'pop',the_atts);
7
+}
8
+
9
+function more_info(sid) {
10
+   if(document.getElementById('more_' + sid).style.display == 'none') {
11
+       document.getElementById('more_' + sid).style.display = 'block';
12
+       document.getElementById('info_' + sid).style.display = 'none';
13
+   }
14
+   else {
15
+       document.getElementById('info_' + sid).style.display = 'block';
16
+       document.getElementById('more_' + sid).style.display = 'none';
17
+   }
18
+}
19
+
20
+function category(pid, catid, name, locked, order) {
21
+	this.pid = pid;
22
+	this.catid = catid;
23
+	this.name = name;
24
+	this.locked = locked;
25
+	this.order = order;
26
+}
27
+
28
+function character(charid, catid, charname) { 
29
+	this.charid = charid;
30
+	this.catid = catid;
31
+	this.charname = charname;
32
+}
33
+
34
+function resetCats(element) {
35
+	var selItem = document.getElementById(element).selectedIndex;
36
+	var selValue = document.getElementById(element).options[selItem].value;
37
+	var serverPage = basedir + "includes/categorylist.php";
38
+	myRequest = new ajaxObject(serverPage, resetCatsResponse);
39
+	val = "element=" + element + "&";
40
+	val = val + "catid="+selValue;
41
+	myRequest.update(val);
42
+}
43
+
44
+function resetCatsResponse(responseText, responseStatus) {
45
+	if(responseStatus == 200) {
46
+		categories.length = 0;
47
+		eval(responseText);
48
+		var selItem = document.getElementById(el).selectedIndex;
49
+		var selValue = document.getElementById(el).options[selItem].value;
50
+		var element = document.getElementById(el);
51
+		element.options.length = 0;
52
+		element.options[element.options.length] = new Option(lang['Back2Cats'], -1);
53
+		for(z = 0; z < categories.length; z++) {
54
+			categories[z].name = unescape(categories[z].name).replaceAll("+", " ");
55
+			if(categories[z].pid == selValue || categories[z].catid == selValue) 
56
+				element.options[element.options.length] = new Option(categories[z].name, categories[z].catid);
57
+		}
58
+		if(selValue != -1) element.options.selectedIndex = 1;
59
+	}
60
+	else {
61
+		alert(responseStatus + ' -- Error Processing Request');
62
+	}
63
+}
64
+
65
+function addCat(fromGroup, toGroup) {
66
+	var strValues = "";
67
+	var listLength = document.getElementById(toGroup).length;
68
+	var selItem = document.getElementById(fromGroup).selectedIndex;
69
+	var selValue = document.getElementById(fromGroup).options[selItem].value;
70
+	var selText = document.getElementById(fromGroup).options[selItem].text;
71
+	var newItem = true;
72
+	for(i = 0; i < categories.length; i++) {
73
+		categories[i].name = unescape(categories[i].name).replaceAll("+", " ");
74
+		if(categories[i].catid == selValue) {
75
+			if(categories[i].locked == 1) {
76
+				alert(lang['CatLocked']);
77
+				return false;
78
+			}
79
+		}
80
+	}
81
+	strValues = selValue;
82
+	for(i = 0; i < listLength; i++) {
83
+		strValues = strValues + "," + document.getElementById(toGroup).options[i].value;
84
+		if(document.getElementById(toGroup).options[i].text == selText) {
85
+			newItem = false;
86
+			break;
87
+		}
88
+	}
89
+	if(newItem) {
90
+		document.getElementById(toGroup).options[listLength] = new Option(selText, selValue);
91
+		document.getElementById(fromGroup).options[selItem] = null;
92
+		document.getElementById("catid").value = strValues;
93
+	}
94
+	buildCharacters(toGroup);
95
+}
96
+
97
+function browseCategories(element) {
98
+	var selItem = document.getElementById(element).selectedIndex;
99
+	var selValue = document.getElementById(element).options[selItem].value;
100
+	var serverPage = basedir + "includes/browsecategories.php";
101
+	myRequest = new ajaxObject(serverPage, browseCategoriesResponse);
102
+	val = "element=" + element + "&";
103
+	val = val + "catid="+selValue;
104
+	myRequest.update(val);
105
+}
106
+
107
+function browseCategoriesResponse(responseText, responseStatus) {
108
+	if(responseStatus == 200) {
109
+		var categories = new Array();
110
+		var characters = new Array();
111
+		eval(responseText);
112
+		var selItem = document.getElementById(el).selectedIndex;
113
+		var selValue = document.getElementById(el).options[selItem].value;
114
+		var element = document.getElementById(el);
115
+		var charlist1 = document.getElementById('charlist1');
116
+		var charlist2 = document.getElementById('charlist2');
117
+		var copyOption1 = new Array( );
118
+		var copyOption2 = new Array( );
119
+		element.options.length = 0;
120
+		if(selValue != -1) element.options[element.options.length] = new Option(lang['Back2Cats'], -1);
121
+		else element.options[element.options.length] = new Option(lang['Categories'], -1);
122
+		for(z = 0; z < categories.length; z++) {
123
+			categories[z].name = unescape(categories[z].name).replaceAll("+", " ");
124
+			element.options[element.options.length] = new Option(categories[z].name, categories[z].catid);
125
+		}
126
+		if(selValue != -1) element.options.selectedIndex = 1;
127
+		var copyOption1 = characters;
128
+		var copyOption2 = characters;
129
+	
130
+		for(x = 0; x < copyOption1.length; x++) {
131
+			for(y = 0; y < charlist1.length; y++) {
132
+				if(charlist1.options[y].selected == true && charlist1.options[y].value == copyOption1[x][1]) {
133
+					copyOption1[x][2] = false;
134
+					copyOption1[x][3] = true;
135
+				}
136
+				if(charlist2.options[y].selected == true && charlist1.options[y].value == copyOption2[x][1]) {
137
+					copyOption2[x][2] = false;
138
+					copyOption2[x][3] = true;
139
+				}
140
+			}
141
+		}
142
+		if(charlist1) charlist1.length = 0;
143
+		charlist2.length = 0;
144
+		if(charlist1) charlist1.options[charlist1.options.length] = new Option(lang['Characters'], '', false, false);
145
+		charlist2.options[charlist2.options.length] = new Option(lang['Characters'], '', false, false);
146
+
147
+		for(i = 0; i < copyOption1.length; i++) {
148
+			if(charlist1) charlist1.options[charlist1.options.length] = new Option(copyOption1[i][1], copyOption1[i][0], copyOption1[i][2], copyOption1[i][3]);
149
+			charlist2.options[charlist2.options.length] = new Option(copyOption2[i][1], copyOption2[i][0], copyOption2[i][2], copyOption2[i][3]);
150
+		}
151
+	}
152
+	else {
153
+		alert(responseStatus + ' -- Error Processing Request');
154
+	}	
155
+}	
156
+
157
+function buildCharacters(cats) {
158
+	if(document.form.formname.value == "admins") return;
159
+	var catslist = document.getElementById(cats);
160
+	var serverPage = basedir + "includes/characterlist.php";
161
+	var clist = new Array( );
162
+	for(z = 0; z < catslist.length; z++) {
163
+		clist[z] = catslist.options[z].value;
164
+	}
165
+	clist[z] = '-1';
166
+	myRequest = new ajaxObject(serverPage, buildCharactersResponse);
167
+	val = "element=" + cats + "&";
168
+	val = val + "catid="+clist.join(",");
169
+	myRequest.update(val);
170
+
171
+}
172
+
173
+String.prototype.replaceAll = function(pcFrom, pcTo){
174
+	var i = this.indexOf(pcFrom);
175
+	var c = this;
176
+	
177
+	while (i > -1){
178
+		c = c.replace(pcFrom, pcTo);
179
+		i = c.indexOf(pcFrom);
180
+	}
181
+	return c;
182
+}
183
+
184
+function buildCharactersResponse(responseText, responseStatus) {
185
+	if(responseStatus == 200) {
186
+		characters.length = 0;
187
+		eval(responseText);
188
+		var charid = document.form.charid;			
189
+		var copyOption = new Array( );
190
+		var a = 0;
191
+		for(y = 0; y < charid.length; y++) {
192
+			if(charid.options[y].selected == true) {
193
+				for(a = 0; a < characters.length; a++) {
194
+					if(characters[a][0] == charid.options[y].value) {
195
+						characters[a][2] = false;
196
+						characters[a][3] = true;
197
+					}
198
+				}
199
+			}
200
+		}
201
+		document.form.charid.length = 0;
202
+		for(i = 0; i < characters.length; i++) {
203
+			charid.options[charid.options.length] = new Option(unescape(characters[i][1]).replaceAll("+", " "), characters[i][0], characters[i][2], characters[i][3]);
204
+		}
205
+	}
206
+	else {
207
+		alert(responseStatus + ' -- Error Processing Request');
208
+	}
209
+}
210
+
211
+function removeCat( catid ) {
212
+	var selitem = document.getElementById(catid).selectedIndex;
213
+	var strValues = "";
214
+	document.getElementById(catid).options[selitem] = null;
215
+	for(i = 0; i < document.getElementById(catid).length; i++) {
216
+		strValues = strValues + "," + document.getElementById(catid).options[i].value;
217
+	}
218
+	document.getElementById("catid").value = strValues;
219
+	buildCharacters(catid);
220
+}
221
+
222
+function displayCatRows(catid) {
223
+	var serverPage = basedir + "includes/categorylist.php";
224
+	myRequest = new ajaxObject(serverPage, displayCatRowsResponse);
225
+	
226
+	val = "element="+catid+"&catid="+catid;
227
+	myRequest.update(val);
228
+}
229
+
230
+function displayCatRowsResponse(responseText, responseStatus) {
231
+	if(responseStatus == 200) {
232
+		categories = Array( );
233
+		eval(responseText);
234
+		if(navigator.appName.indexOf('Microsoft') > -1) var canSee = 'block';
235
+		else var canSee = 'table-row';
236
+		var start = document.images['c_' + el].src.lastIndexOf(".") - 3;
237
+		if(document.images['c_' + el].src.indexOf('on', start) == -1) {
238
+			var state = 'off';
239
+			tmp = document.images['c_' + el].src;
240
+			document.images['c_' + el].src = document.images['c_' + el].src.replace('_off', '_on');
241
+		}
242
+		else {
243
+			var state = 'on';
244
+			tmp = document.images['c_' + el].src;
245
+			document.images['c_' + el].src = document.images['c_' + el].src.replace('_on', '_off');
246
+		}
247
+		for(x = 0; x < categories.length; x++) {
248
+			if(state == "off" && x == 0) continue;
249
+			if(row = document.getElementById('catid_' + categories[x].catid)) {
250
+				if(state == 'off')
251
+					row.style.display = 'none';
252
+				else
253
+					row.style.display = canSee;
254
+			}
255
+		}			
256
+	}
257
+	else {
258
+		alert(responseStatus + ' -- Error Processing Request');
259
+	}
260
+}
261
+
262
+function setCategoryForm( chosen ) {
263
+	var serverPage = basedir + "includes/categorylist.php";
264
+	myRequest = new ajaxObject(serverPage, setCategoryFormResponse);
265
+	var category = chosen.options[chosen.selectedIndex].value;
266
+	val = "element=" + chosen.name + "&" + "catid=" + category;
267
+	myRequest.update(val);
268
+}
269
+
270
+function setCategoryFormResponse(responseText, responseStatus) {
271
+	if(responseStatus == 200) {
272
+		categories = Array( );
273
+		eval(responseText);
274
+		var selItem = document.getElementById(el).selectedIndex;
275
+		var selValue = document.getElementById(el).options[selItem].value;
276
+		var element = document.getElementById(el);
277
+		element.options.length = 0;
278
+		orderafter = document.getElementById("orderafter");
279
+		orderafter.options.length = 0;
280
+		if(selValue != -1) element.options[element.options.length] = new Option(lang['Back2Cats'], -1);
281
+		else element.options[element.options.length] = new Option(lang['Categories'], -1);
282
+		for(z = 0; z < categories.length; z++) {
283
+			categories[z].name = unescape(categories[z].name).replaceAll("+", " ");
284
+			element.options[element.options.length] = new Option(categories[z].name, categories[z].catid);
285
+			if(!z) continue;
286
+			orderafter.options[orderafter.options.length] = new Option(categories[z].name, categories[z].catid);
287
+		}
288
+		if(selValue != -1) element.options.selectedIndex = 1;
289
+			
290
+	}
291
+	else {
292
+		alert(responseStatus + " -- Error Processing Request");
293
+	}
294
+}
295
+
296
+function displayTypeOpts() {
297
+	var choice = document.getElementById('field_type').selectedIndex;
298
+	var type = document.getElementById('field_type').options[choice].value;
299
+	if(window.tinyMCE) tinyMCE.execCommand('mceResetDesignMode'); 
300
+
301
+	for(i = 1; i < 6; i++) {
302
+		if(document.getElementById('opt_' + i)) {
303
+			document.getElementById('opt_' + i).style.display = 'none';
304
+		}
305
+	}
306
+	document.getElementById('opt_' + type).style.display = 'block';
307
+	if(window.tinyMCE) tinyMCE.execCommand('mceResetDesignMode'); 
308
+}
309
+