mc_edit.inc.js
11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
var var_kind;
var var_bgColor="#f3f3f3";
var var_borderColor="#d0d1d0";
var var_xmlWindow;
var var_ul;
var var_body;
var var_div;
var var_http = null;
var var_window_width="580";
var var_targetInput;
var var_src = "http://localhost/losp/";
var obj_urls = new Object();
obj_urls["service"] = "service.php?output=xml&p[0]=showSingle&p[1]=ID&p[2]=";
obj_urls["c"] = "&c[";
obj_urls["image"] = "&p[3]=FileBC";
obj_urls["image_c"] = "][FileBC][0][ListCondition-equal][Mime][1]=image";
obj_urls["friend"] = "&p[3]=FriendList";
obj_urls["friend_c"] = false;
obj_urls["next"] = false;
obj_urls["back"] = false;
var obj_text = new Object();
obj_text["image"] = "Bitte ein Bild aussuchen:";
obj_text["friend"] = "Bitte Freundschaften aussuchen:";
var a_next;
var i_next;
var a_back;
var i_back;
var var_NaB;
var var_id;
function fnc_xmlChooser(id, kind, target){
var_kind=kind;
var_id=id;
var_targetInput = target;
fnc_newWindow();
fnc_mkDiv(kind);
fnc_loading(var_div, true);
fnc_mkHttp(kind);
}
function fnc_newWindow(title, adress){
var_xmlWindow = window.open (
"",
"Dateien", // Name des neuen Fensters
+"toolbar=0" // Toolbar
+",location=0" // Adress-Leiste
+",directories=0" // Zusatzleisten
+",status=0" // Statusleiste
+",menubar=0" // Men
+",scrollbars=0" // Scrollbars
+",resizable=0" // Fenstergrsse vernderbar?
+",width="+var_window_width+"px" // Fensterbreite in Pixeln
//+",height=500" // Fensterhhe in Pixeln
);
var_body = var_xmlWindow.document.getElementsByTagName('body')[0];
var_body.focus();
var_body.style.backgroundColor=var_bgColor;
// window.document.getElementsByTagName('body')[0].setAttribute("onFocus","javascript:var_xmlWindow.close()");
}
function fnc_mkDiv(kind){
var_div = var_xmlWindow.document.createElement('div');
var_div.style.display = "block";
var_div.style.cssFloat="left";
var_div.style.width=var_window_width+"px";
var_body.appendChild(var_xmlWindow.document.createTextNode(obj_text[kind]));
var_ul = var_xmlWindow.document.createElement('ul');
var_ul.style.cssFloat="left";
var_ul.style.padding="0px";
var_ul.style.listStyle="none";
var_ul.style.backgroundColor="white";
a_next = document.createElement("div");
a_next.style.background="url('include/Forest/mensch.coop/Images/buttonAll.png') -20px -160px no-repeat";
a_next.style.width="20px";
a_next.style.height="20px";
a_next.style.cssFloat="right";
a_next.style.textDecoration="none";
/* a_next.onmouseover = fnc_nextMouseover;
a_next.onmouseout = fnc_nextMouseout;
a_next.onclick = fnc_nextOnclick;*/
i_next = document.createElement("div");
i_next.style.background="url('include/Forest/mensch.coop/Images/buttonAll.png') -20px -300px no-repeat";
i_next.style.width="20px";
i_next.style.height="20px";
i_next.style.cssFloat="right";
i_next.style.textDecoration="none";
a_back = document.createElement("div");
a_back.style.background="url('include/Forest/mensch.coop/Images/buttonAll.png') -20px -140px no-repeat";
a_back.style.width="20px";
a_back.style.height="20px";
a_back.style.cssFloat="left";
a_back.style.textDecoration="none";
/* a_back.onmouseover = fnc_backMouseover;
a_back.onmouseout = fnc_backMouseout;
a_back.onclick = fnc_backOnclick;*/
i_back = document.createElement("div");
i_back.style.background="url('include/Forest/mensch.coop/Images/buttonAll.png') 0px -300px no-repeat";
i_back.style.width="20px";
i_back.style.height="20px";
i_back.style.cssFloat="left";
i_back.textDecoration="none";
var_NaB = var_xmlWindow.document.createElement('div');
var_NaB.style.margin="auto";
var_NaB.style.width="100px";
var_NaB.style.height="28px";
var_NaB.style.display="block";
var_div.appendChild(var_NaB);
var_div.appendChild(var_ul);
var_body.appendChild(var_div);
}
function fnc_loading(where, start){
if(start){
var var_imageLoad = new Image();
var_imageLoad.setAttribute("id", "loading");
var_imageLoad.hspace=var_window_width/2-50;
var_imageLoad.src = "include/Forest/mensch.coop/Images/loading.gif";
where.appendChild(var_imageLoad);
}
else{
where.removeChild(var_xmlWindow.document.getElementById("loading"));
}
}
function fnc_mkHttp(kind){
if (window.XMLHttpRequest) {
var_http = new XMLHttpRequest();
} else if (window.ActiveXObject) {
var_http = new ActiveXObject("Microsoft.XMLHTTP");
}
if(var_http != null) {
// var_http.open("GET", "service.php?output=xml&p[0]=showSingle&p[1]=ID&p[2]=6&p[3]=FileBC&c[6][FileBC][0][ListCondition-equal][Mime][1]=image", true);
if(kind != "next" || kind != "back"){
var tmp_url=obj_urls["service"]+var_id+obj_urls[kind];
if(obj_urls[kind+"_c"]!=false){
tmp_url=tmp_url+obj_urls["c"]+var_id+obj_urls[kind+"_c"];
}
var_http.open("GET", tmp_url, true);
}
else{
var_http.open("GET", obj_urls[kind], true);
}
var_http.onreadystatechange = fnc_mkContent;
var_http.send(null);
}
}
function fnc_mkContent() {
fnc_clearNaB();
if(var_http.readyState == 4){
fnc_loading(var_div, false);
var daten = var_http.responseText;
if (window.ActiveXObject) {
var xml = new ActiveXObject("Microsoft.XMLDOM");
xml.loadXML(daten);
} else if (document.implementation) {
var xml = (new DOMParser()).parseFromString(daten, "text/xml");
}
var var_be=xml.getElementsByTagName("BasisElement");
switch (var_kind){
case "image" :
for (var i = 0; i < var_be.length; i++) {
var var_li = var_xmlWindow.document.createElement('li');
var_li.style.cssFloat="left";
var_li.style.width="100px";
var_li.style.paddingTop="2px";
var_li.style.margin="4px";
var_li.style.overflow="hidden";
var_li.style.border="3px solid "+var_bgColor;
var_li.onmouseover = fnc_liMouseover;
var_li.onclick = fnc_liFileOnclick;
var_li.onmouseout = fnc_liMouseout;
if(var_be[i].getAttribute("class")=="FileBE" && var_be[i].parentNode.getAttribute("class")=="FileBC"){
var var_headline=var_xmlWindow.document.createTextNode(var_be[i].getElementsByTagName("Headline")[0].getElementsByTagName("Element")[0].firstChild.nodeValue)
var_li.appendChild(var_headline);
var var_element=var_be[i].getElementsByTagName("Element");
for (var j = 0; j < var_element.length; j++) {
if(var_element[j].getAttribute("type")=="file"){
if(var_kind=='image'){
var var_url = var_element[j].firstChild.nodeValue;
var image = new Image();
image.height=100;
image.width=100;
var_li.name="files/"+var_url;
//image.src = var_src+"files/"+var_url.replace(/(\/)/, "/tn_");
image.src = "files/"+var_url.replace(/(\/)/, "/tn_");
var_li.appendChild(image);
}
}
}
var_ul.appendChild(var_li);
}
}
break;
case "friend" :
for (var i = 0; i < var_be.length; i++) {
var var_li = var_xmlWindow.document.createElement('li');
var_li.style.width="200px";
var_li.style.paddingTop="2px";
var_li.style.margin="4px";
var_li.style.overflow="hidden";
var_li.style.border="3px solid "+var_bgColor;
var_li.onmouseover = fnc_liMouseover;
var_li.onclick = fnc_liFriendOnclick;
var_li.onmouseout = fnc_liMouseout;
if(var_be[i].getAttribute("class")=="Profile" && var_be[i].parentNode.getAttribute("class")=="FriendList"){
var tmp_text=var_be[i].getElementsByTagName("Headline")[0].getElementsByTagName("Element")[0].firstChild.nodeValue;
var tmp_headline=var_xmlWindow.document.createTextNode(" "+tmp_text)
var_li.name=var_be[i].getAttribute("id")+"-"+tmp_text;
var var_element=var_be[i].getElementsByTagName("Element");
var image = new Image();
image.height=20;
image.width=20;
image.src="include/Forest/mensch.coop/Images/Avatar.png";
for (var j = 0; j < var_element.length; j++) {
if(var_element[j].getAttribute("objvar")=="Avatar"){
var var_url = var_element[j].nodeValue;
if(var_url != null){
image.src=var_url;
}
}
}
var_li.appendChild(image);
var_li.appendChild(tmp_headline);
var_ul.appendChild(var_li);
}
}
break;
}
fnc_mkNaB(xml);
}
function fnc_mkNaB(xml){
var var_link=xml.getElementsByTagName("Link");
for (var i = 0; i < var_link.length; i++) {
if(var_link[i].getAttribute("kind")=="back"){
obj_urls["back"] = "service.php?output=xml&"+var_link[i].getAttribute("parameter");
}
else if(var_link[i].getAttribute("kind")=="next"){
obj_urls["next"] = "service.php?output=xml&"+var_link[i].getAttribute("parameter");
}
}
if(obj_urls["next"]!=false){
var_NaB.appendChild(a_next);
a_next.onmouseover = fnc_nextMouseover;
a_next.onmouseout = fnc_nextMouseout;
a_next.onclick = fnc_nextOnclick;
}
else{
var_NaB.appendChild(i_next);
}
if(obj_urls["back"]!=false){
var_NaB.appendChild(a_back);
a_back.onmouseover = fnc_backMouseover;
a_back.onmouseout = fnc_backMouseout;
a_back.onclick = fnc_backOnclick;
}
else{
var_NaB.appendChild(i_back);
}
}
function fnc_clearUl(){
var var_lis = var_ul.getElementsByTagName("li");
for(var i = var_lis.length-1; i >= 0; i--) {
var_ul.removeChild(var_lis[i]);
}
}
function fnc_clearNaB(){
obj_urls["next"]=false;
obj_urls["back"]=false;
for(var i = var_NaB.getElementsByTagName("div").length - 1; i >= 0; i--) {
var_NaB.removeChild(var_NaB.getElementsByTagName("div")[i]);
}
}
function fnc_nextOnclick(){
fnc_clearUl();
fnc_loading(var_div, true);
fnc_mkHttp("next");
}
function fnc_backOnclick(){
fnc_clearUl();
fnc_loading(var_div, true);
fnc_mkHttp("back");
}
function fnc_nextMouseover(){
this.style.cursor="pointer";
// this.style.background="url('include/Forest/mensch.coop/Images/buttonAll.png') 0px -160px no-repeat";
}
function fnc_nextMouseout(){
//this.style.background="url('include/Forest/mensch.coop/Images/buttonAll.png') -20px -160px no-repeat";
}
function fnc_backMouseover(){
this.style.cursor="pointer";
// this.style.background="url('include/Forest/mensch.coop/Images/buttonAll.png') 0px -160px no-repeat";
}
function fnc_backMouseout(){
//this.style.background="url('include/Forest/mensch.coop/Images/buttonAll.png') -20px -160px no-repeat";
}
function fnc_liMouseover(){
this.style.cursor="pointer";
this.style.border="3px solid "+var_borderColor;
}
function fnc_liFileOnclick(){
window.document.getElementById(var_targetInput).value=this.getAttribute("name");
var_xmlWindow.close();
}
function fnc_chkElementExists(param_target, param_name, param_attribute, param_value){
var tmp_elementArray = param_target.getElementsByTagName(param_name);
for(var i = tmp_elementArray.length -1; i >= 0; i--) {
if(tmp_elementArray[i].getAttribute(param_attribute).substring(0,tmp_elementArray[i].getAttribute(param_attribute).indexOf("-")) == param_value){
return true;
}
}
return false;
}
function fnc_liFriendOnclick(){
if(!fnc_chkElementExists(window.document.getElementById(var_targetInput), "li", "name", this.name.substring(0,this.name.indexOf("-")))){
var tmp_li = window.document.createElement('li');
tmp_li.name=this.name;
var tmp_input=window.document.createElement('input');
tmp_input.type="checkbox";
tmp_input.name="ReadSelected[]";
tmp_input.checked="checked";
tmp_input.value=this.name.substring(0,this.name.indexOf("-"));
tmp_li.appendChild(tmp_input);
tmp_li.appendChild(var_xmlWindow.document.createTextNode(this.name.substr(this.name.indexOf("-")+1)))
window.document.getElementById(var_targetInput).appendChild(tmp_li);
}
}
function fnc_liMouseout(){
this.style.border="3px solid "+var_bgColor;
}
}