Ignore:
Timestamp:
Jun 15, 2011, 7:07:49 PM (13 years ago)
Author:
cljosse
Message:

[extensions] set_plugins update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/set_plugins/js/field_set.js

    r11276 r11385  
     1function raffraichir() {
     2  n = 1;
     3 // jQuery("#form_set_plugins").submit();
     4}
     5
     6
     7
    18jQuery("fieldset").hide();
    29jQuery(document).ready(function () {
     
    1017  }
    1118  var h_min = 0;
     19  var liste_des_plugins = {};
     20  jQuery(window).load(function () {
     21    if (jQuery(".titrePage").length >= 1) {
     22      if (jQuery("span.sort").length >= 1)
     23        jQuery("#titrePage").before(jQuery("span.sort"));
     24      jQuery(".titrePage ").hide();
     25    }
    1226
    13   jQuery(window).load(function () {
    1427    if (jQuery("fieldset").length >= 1) {
    15 
    16       jQuery("div.titrePage h2").parent().hide();
    17 
    1828      var reg = new RegExp("[,]", "g");
    1929      liste_visible = jQuery("input[name=list_visible]").val();
    20       n1 = liste_visible;
    21       liste = n1.split(reg);
     30      if (typeof liste_visible == "undefined") {
     31        liste_visible = "on,on,on,on";
     32        jQuery("input[name=list_visible]").val(liste_visible);
     33      }
     34      liste = liste_visible.split(reg);
    2235      reg = new RegExp("['off']", "g");
    2336      jQuery("fieldset").each(
     
    3548            liste[i] = "off";
    3649
    37            h_min = jQuery("#" + this.id + ' legend').height();
    38             jQuery(this).height(h_min + 5);
     50            h_min = jQuery("#" + this.id + ' legend').height();
     51            jQuery(this).height(h_min + 0);
    3952
    4053            jQuery("#" + this.id + ' legend').prepend(
     
    5871
    5972            n = jQuery(this).parent().hasClass("visible");
    60             jQuery(this).css("color", "red");
     73            //   jQuery(this).css("color", "red");
    6174
    6275            i = jQuery(jQuery(this).parent()).attr("rel");
    6376            liste_visible = jQuery("input[name=list_visible]").val();
    64             liste = liste_visible.split(",");
     77            if (typeof liste_visible == "undefined") {
     78              liste_visible = "on,on,on,on";
     79              jQuery("input[name=list_visible]").val(liste_visible);
     80            }
     81            // src = jQuery(this).find("img").attr("src");
    6582            if (n) {
    66               jQuery(this).parent().height(h_min + 5);
     83              jQuery(this).parent().height(h_min + 0);
    6784              jQuery(this).parent().removeClass("visible");
    6885              liste[i] = "off";
     86              jQuery(this).find("img").attr({
     87                src: plus_path
     88
     89              });
    6990            }
    7091            else {
     
    7293              jQuery(this).parent().addClass("visible");
    7394              liste[i] = "on";
     95              jQuery(this).find("img").attr({
     96                src: minus_path
     97
     98              });
    7499            }
    75 
    76 
    77100            val = liste.join(",");
    78101            jQuery("input[name=list_visible]").val(val);
     102            jQuery('#set').val("true");
    79103
    80104            jQuery.ajax({
    81105              type: "POST",
    82106              async: true,
    83               data: "list_visible=" + val,
     107              data: { list_visible: val, set: "true" },
    84108              success: function (msg) {
    85                 jQuery("#form_set_plugins").submit();
     109                // jQuery("#form_set_plugins").submit();
    86110              }
    87111            });
     
    97121          jQuery(this).click(function (event) {
    98122            jQuery(this).css("color", "red");
    99             action = jQuery(this).attr('rel');
    100             if (action == "Deactivate")
    101               liste_plugins = jQuery(this).parent().parent().text();
    102             else if (action == "Activate")
    103               liste_plugins = jQuery(this).parent().parent().text();
    104 
     123            jQuery('#set').val("true");
    105124          }); // click
    106125
    107126        }); //each
    108 
    109127      jQuery("input[name=list_visible]").val(liste.join(","));
    110128      jQuery("fieldset").show();
    111129    } // fielset
    112130    //====================================================================
    113     jQuery("td a").click(function (event) {
    114       l1 = jQuery('#liste').text();
    115       l = l1.split(new RegExp("\n", "g"));
     131    jQuery(".pluginBox a").click(function (event) {
     132      var link = event.target.href;
     133      if (link.indexOf("?") != -1) {
     134        var query = link.split("?")[1];
     135        eval("query = {" + query.replace(/&/ig, "\",").replace(/=/ig, ":\"") + "\"};");
     136        jQuery('#add_plugins').val(query.plugin);
     137        jQuery('#set').val("true");
     138        val = liste.join(",");
    116139
    117       list = jQuery('liste_plugins');
     140        jQuery.ajax({
     141          type: "POST",
     142          async: true,
     143          data: { add_plugins: query.plugin,
     144           set: "true",
     145           list_visible: val
     146            }
     147           ,
     148          success: function (data) {
     149          //  jQuery("#form_set_plugins").submit();
    118150
    119       var reg = new RegExp("[?]", "g");
    120       ret_args = new Array;
    121       var args = event.target.href.split(reg)[1];
    122       reg = new RegExp("[&]", "g");
    123       var tableau = args.split(reg);
    124       for (i = 0; i < tableau.length; i++) {
    125         vals = tableau[i].split("=");
    126         ret_args[vals[0]] = vals[1];
     151          }
     152        });
     153
    127154      }
    128       if (ret_args['action'] == "deactivate") {
    129 
    130         list = jQuery('list');
    131         n = 1;
    132       } else if (ret_args['action'] == "activate") {
    133 
    134         list = jQuery('liste_plugins');
    135         n = 0;
    136       }
    137 
    138155
    139156    })
    140157
    141158  }); // load
    142 });                     //ready           
     159});                                                               //ready           
    143160           
Note: See TracChangeset for help on using the changeset viewer.