On s'apprête à customiser le comportement aux requêtes PUT. Copie telle quelle du...
[Plinn.git] / skins / ajax_scripts / directory_management_script.js
1 // (c) Benoît PIN 2006-2007
2 // http://plinn.org
3 // Licence GPL
4
5 function openMemberPopup(member_id) {
6 var slot = document.getElementById("MemberFormSlot");
7 var url = portal_url() + "/use_macro?template=gruf_macros&macro=member_properties_form&fragmentId=MemberFormSlot&member_id=" + member_id;
8 new FragmentImporter(url, function() {initForms(slot);}).load();
9 }
10
11 function openMemberTreeView(evt) {
12 disableDefault(evt);
13 disablePropagation(evt);
14 var link = getTargetedObject(evt);
15 var slot = document.getElementById("MemberFormSlot");
16 var member_id = link.href.split("member_id=")[1];
17 /* member_id parameter is not necesary at the last position.*/
18 var member_id = member_id.split("&");
19 var url = portal_url() + "/use_macro?template=gruf_macros&macro=member_tree_view&fragmentId=MemberFormSlot&member_id=" + member_id;
20 new FragmentImporter(url, _initMemberTreeListener).load(url);
21 }
22
23 function _initMemberTreeListener() {
24 var slot = document.getElementById("MemberFormSlot");
25 addListener(slot, "click", handleMemberTreeViewClick);
26 if (browser.isIE55 || browser.isIE6up) {
27 _disableMemberSlotClickHandler = false;
28 }
29 }
30
31 function handleMemberTreeViewClick(evt) {
32 disableDefault(evt);
33 disablePropagation(evt);
34
35 // prevent click glitches from IE :((
36 if ((browser.isIE55 || browser.isIE6up) && _disableMemberSlotClickHandler)
37 return;
38 else {
39 _disableMemberSlotClickHandler = true;
40 setTimeout("_disableMemberSlotClickHandler=false", 100);
41 }
42
43
44 var target = getTargetedObject(evt);
45 var link, url, query;
46 var slot = document.getElementById("MemberFormSlot");
47 var afterLoadFunction;
48
49 switch (target.tagName) {
50 case "IMG" :
51 target = target.parentNode;
52 afterLoadFunction = _initMemberTreeListener;
53
54 case "A" :
55 query = target.href.split('?')[1];
56 query = query.replace(/macroName/, "macro");
57 query = query.split('#')[0];
58 url = portal_url() + "/use_macro?template=gruf_macros&fragmentId=MemberFormSlot&" + query;
59 afterLoadFunction = (afterLoadFunction) ? afterLoadFunction : function() {initForms(slot);};
60 new FragmentImporter(url, afterLoadFunction).load();
61 }
62 }