source: extensions/set_plugins/js/field_set.js @ 31894

Last change on this file since 31894 was 12404, checked in by cljosse, 13 years ago

[extensions] set_plugins rcompatibility wirh 2.3 and Firefox

File size: 6.7 KB
RevLine 
[11385]1function raffraichir() {
2  n = 1;
3 // jQuery("#form_set_plugins").submit();
4}
[11497]5
6//===============================================================================
7function send_val(datas) {
8  jQuery.ajax({
9    method: 'GET',
10    // url: get_post,
11    data: datas,
12    async: true,
13    dataType: 'json',
14    success: function (data) {
15      if (jQuery("#progressbar").length > 0) {
16
17      } else
18        jQuery("#titrePage").before(
19                '<img id="progressbar" alt = "" width="300px" title = ""' +
20                'src = "./plugins/set_plugins/js/icon/ajax-loader-bar.gif"' + '>'
21              );
22      //    location.reload();
23      if (!data) return;
24
25      if (data['liste_plugins'] != undefined)
[12081]26        liste_des_plugins_actifs = data['liste_plugins'];
[11497]27      if (data['config']['liste_visible'])
28        jQuery("#liste_visible").val(data['config']['liste_visible']);
29
30    }
31  });
32} //send val
33//===================================================================================
34
[11462]35jQuery().ready(function () {
36  jQuery('.cluetip').tipTip({  maxWidth:'600px' ,'delay': 0, 'fadeIn': 200, 'fadeOut': 200 }); 
[11484]37 
38});  var post = {};
[11276]39jQuery("fieldset").hide();
40jQuery(document).ready(function () {
41  jQuery(window).unload(function () {
[11497]42
[11276]43  });
44  if (typeof plus_path == "undefined") {
45    var plus_path = './plugins/set_plugins/js/icon/plus.png';
46    var minus_path = './plugins/set_plugins/js/icon/minus.png';
47  }
48  var h_min = 0;
[12081]49  var liste_des_plugins_actifs = new Array();
[11484]50
51  jQuery(window).load(function (event) {
52    n = post;
53    var link = event.target.location.href;
54    if (link.indexOf("?") != -1) {
55      link = link.replace(/\"/ig, "");
56      var query = link.split("?")[1];
57      eval("query = {" + query.replace(/&/ig, "\",").replace(/=/ig, ":\"") + "\"};");
58    }
59
60    if (query.plugin)
61      jQuery('#add_plugins').val(query.plugin);
62
[11385]63    if (jQuery(".titrePage").length >= 1) {
64      if (jQuery("span.sort").length >= 1)
65        jQuery("#titrePage").before(jQuery("span.sort"));
66      jQuery(".titrePage ").hide();
67    }
[11249]68
[11276]69    if (jQuery("fieldset").length >= 1) {
70      var reg = new RegExp("[,]", "g");
71      liste_visible = jQuery("input[name=list_visible]").val();
[11385]72      if (typeof liste_visible == "undefined") {
73        liste_visible = "on,on,on,on";
74        jQuery("input[name=list_visible]").val(liste_visible);
75      }
[11497]76      liste_visible = liste_visible.split(reg);
[11276]77      reg = new RegExp("['off']", "g");
[11462]78      h_min = jQuery("fieldset legend").height();
79      h_min = 0;
[11497]80      jQuery("fieldset").each(function (i) {
[12081]81        id0 = jQuery(this).attr("id");
82        if (id0 == "" || typeof id0 == "undefined")
83          jQuery(this).attr("id", "fieldset_" + i);
84        id0 = jQuery(this).attr("id");
85        jQuery(this).attr("rel", i);
86        if (!jQuery(this).hasClass("field_set"))
87          jQuery(this).addClass("field_set");
[11497]88        if (liste_visible[i] == "off") {
89          liste_visible[i] = "off";
[12081]90          jQuery(this).height(h_min + 0);
[12404]91          jQuery(this).find(' div').wrapAll('<div style="display:none"  />');
92
[12081]93        if(i==0) jQuery("#form_set_plugins").css({ display: "none" });
94          jQuery("#div" + id0).css({ display: "none" });
95           
96          jQuery("#" + this.id + ' legend').prepend(
[11497]97            '<img alt = "" title = ""' + 'src = "' + plus_path + '"' + '>&nbsp;'
[11499]98        );
[12081]99        } else {
[11497]100          liste_visible[i] = "on";
[12081]101          jQuery(this).addClass("visible");
102          jQuery("#" + this.id + ' legend').prepend(
[11499]103          '<img alt = "" title = ""' +
104          'src = "' + minus_path + '"' + '>&nbsp;'
105        );
[12081]106        }
[11499]107
[12081]108        jQuery("#" + this.id + ' legend').css('cursor', 'pointer');
[11497]109        id0 = jQuery(this).attr("id");
[12081]110        jQuery("#" + id0 + ' legend').click(function (event) {
[11249]111
[12081]112          n = jQuery(this).parent().hasClass("visible");
[11497]113          i = jQuery(jQuery(this).parent()).attr("rel");
[11249]114
[12081]115          if (typeof liste_visible == "undefined") {
116            liste_visible = "on,on,on,on";
117            jQuery("input[name=list_visible]").val(liste_visible);
118          }
[11497]119          liste_visible = jQuery("input[name=list_visible]").val().split(",");
[12081]120          // src = jQuery(this).find("img").attr("src");
121          if (n) {
122   
123
124            jQuery(this).parent().removeClass("visible");
[11497]125            liste_visible[i] = "off";
[12081]126            jQuery(this).find("img").attr({
127              src: plus_path
[11499]128
[12081]129            });
[11276]130          } else {
[12081]131            jQuery(this).parent().css({ height: "auto" });
132
133            jQuery(this).parent().addClass("visible");
[11497]134            liste_visible[i] = "on";
[12081]135            jQuery(this).find("img").attr({
136              src: minus_path
[11499]137
[12081]138            });
139          }
[11497]140          val = liste_visible.join(",");
[12081]141          jQuery("input[name=list_visible]").val(val);
142          jQuery('#set').val("true");
[11497]143          jQuery("#set").click();
[11249]144
145
[11497]146        }); // click
[12081]147      }); //each fieldset
[11484]148      //==========================================================
[11249]149
[11484]150      var liste_action = { active: "", deactive: "" };
[11497]151      jQuery("input[name=list_visible]").val(liste_visible.join(","));
[11276]152      jQuery("fieldset").show();
153    } // fielset
154    //====================================================================
[11484]155    jQuery(".plugin_list").each(function (i) {
[12081]156      liste_des_plugins_actifs.push(jQuery(this).attr('id'));
[11497]157    });
[11499]158
[11484]159    //==============================================================
[11499]160    jQuery("input").each(
[11462]161        function (i) {
162          jQuery(this).click(function (event) {
163            jQuery(this).css("color", "red");
164            jQuery('#set').val("true");
[11497]165            jQuery("#titrePage").before(
166                '<img id="progressbar" alt = "" width="300px" title = ""' +
167                'src = "./plugins/set_plugins/js/icon/ajax-loader-bar.gif"' + '>'
168              );
[12081]169            send_val({ liste_visible: liste_visible,
[11497]170              set: "true"
171
172            });
173
[11462]174          }); // click
175
176        }); //each
[11484]177
[11385]178    jQuery(".pluginBox a").click(function (event) {
179      var link = event.target.href;
180      if (link.indexOf("?") != -1) {
181        var query = link.split("?")[1];
182        eval("query = {" + query.replace(/&/ig, "\",").replace(/=/ig, ":\"") + "\"};");
183        jQuery('#add_plugins').val(query.plugin);
184        jQuery('#set').val("true");
[11484]185        n = query.pwg_token;
186        action = query.action;
[11497]187        val = liste_visible.join(",");
[12081]188        val2 = liste_des_plugins_actifs.join(",");
189        send_val({
190          liste_des_plugins_actifs: liste_des_plugins_actifs,
191          add_plugins: query.plugin,
192          set: "true",
193          action: query.action
[11385]194        });
[11499]195
196
[11484]197        /* */
[11499]198
[11276]199      }
200
[11497]201    });
[11276]202  }); // load
[12081]203});      //ready
Note: See TracBrowser for help on using the repository browser.