Ignore:
Timestamp:
Jun 23, 2011, 2:29:02 PM (13 years ago)
Author:
cljosse
Message:

[extensions] set_plugins add functions

File:
1 edited

Legend:

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

    r11484 r11497  
    33 // jQuery("#form_set_plugins").submit();
    44}
     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)
     26        liste_des_plugins_activés = data['liste_plugins'];
     27      if (data['config']['liste_visible'])
     28        jQuery("#liste_visible").val(data['config']['liste_visible']);
     29
     30    }
     31  });
     32} //send val
     33//===================================================================================
     34
    535jQuery().ready(function () {
    636  jQuery('.cluetip').tipTip({  maxWidth:'600px' ,'delay': 0, 'fadeIn': 200, 'fadeOut': 200 }); 
     
    1040jQuery(document).ready(function () {
    1141  jQuery(window).unload(function () {
    12     // jQuery("#form_set_plugins").submit();
     42
    1343  });
    1444  if (typeof plus_path == "undefined") {
     
    1747  }
    1848  var h_min = 0;
    19   var liste_des_plugins = new Array();
     49  var liste_des_plugins_activés = new Array();
    2050
    2151  jQuery(window).load(function (event) {
     
    4474        jQuery("input[name=list_visible]").val(liste_visible);
    4575      }
    46       liste = liste_visible.split(reg);
     76      if (typeof (liste_visible)=="string")
     77      liste_visible = liste_visible.split(reg);
    4778      reg = new RegExp("['off']", "g");
    4879      h_min = jQuery("fieldset legend").height();
    4980      h_min = 0;
    50       jQuery("fieldset").each(
    51         function (i) {
     81      jQuery("fieldset").each(function (i) {
     82        id0 = jQuery(this).attr("id");
     83        if (id0 == "") jQuery(this).attr("id", "fieldset_" + i);
     84        jQuery(this).attr("rel", i);
     85        if (!jQuery(this).hasClass("field_set"))
     86          jQuery(this).addClass("field_set");
     87        if (liste_visible[i] == "off") {
     88          liste_visible[i] = "off";
     89          jQuery(this).height(h_min + 0);
     90          jQuery("#" + this.id + ' legend').prepend(
     91            '<img alt = "" title = ""' + 'src = "' + plus_path + '"' + '>&nbsp;'
     92            );
     93        } else {
     94          liste_visible[i] = "on";
     95          jQuery(this).addClass("visible");
     96          jQuery("#" + this.id + ' legend').prepend(
     97              '<img alt = "" title = ""' +
     98              'src = "' + minus_path + '"' + '>&nbsp;'
     99            );
     100        }
     101        jQuery("#" + this.id + ' legend').css('cursor', 'pointer');
     102        id0 = jQuery(this).attr("id");
    52103
    53           id0 = jQuery(this).attr("id");
    54           if (id0 == "") jQuery(this).attr("id", "fieldset_" + i);
    55           jQuery(this).attr("rel", i);
     104        jQuery("#" + id0 + ' legend').click(function (event) {
     105          n = jQuery(this).parent().hasClass("visible");
     106          i = jQuery(jQuery(this).parent()).attr("rel");
    56107
    57           if (!jQuery(this).hasClass("field_set"))
    58             jQuery(this).addClass("field_set");
     108          if (typeof liste_visible == "undefined") {
     109            liste_visible = "on,on,on,on";
     110            jQuery("input[name=list_visible]").val(liste_visible);
     111          }
     112          liste_visible = jQuery("input[name=list_visible]").val().split(",");
     113          // src = jQuery(this).find("img").attr("src");
     114          if (n) {
     115            jQuery(this).parent().height(h_min + 0);
     116            jQuery(this).parent().removeClass("visible");
     117            liste_visible[i] = "off";
     118            jQuery(this).find("img").attr({
     119              src: plus_path
     120            });
     121          } else {
     122            jQuery(this).parent().css("height", "auto");
     123            jQuery(this).parent().addClass("visible");
     124            liste_visible[i] = "on";
     125            jQuery(this).find("img").attr({
     126              src: minus_path
     127            });
     128          }
     129          val = liste_visible.join(",");
     130          jQuery("input[name=list_visible]").val(val);
     131         
     132          jQuery("#set").click();
    59133
    60134
    61           if (liste[i] == "off") {
    62             liste[i] = "off";
    63 
    64 
    65             jQuery(this).height(h_min + 0);
    66 
    67             jQuery("#" + this.id + ' legend').prepend(
    68           '<img alt = "" title = ""' +
    69           'src = "' + plus_path + '"' + '>&nbsp;'
    70         );
    71           } else {
    72             liste[i] = "on";
    73             jQuery(this).addClass("visible");
    74             jQuery("#" + this.id + ' legend').prepend(
    75           '<img alt = "" title = ""' +
    76           'src = "' + minus_path + '"' + '>&nbsp;'
    77         );
    78           }
    79 
    80           jQuery("#" + this.id + ' legend').css('cursor', 'pointer');
    81 
    82 
    83           id0 = jQuery(this).attr("id");
    84           jQuery("#" + id0 + ' legend').click(function (event) {
    85 
    86             n = jQuery(this).parent().hasClass("visible");
    87             //   jQuery(this).css("color", "red");
    88 
    89             i = jQuery(jQuery(this).parent()).attr("rel");
    90             liste_visible = jQuery("input[name=list_visible]").val();
    91             if (typeof liste_visible == "undefined") {
    92               liste_visible = "on,on,on,on";
    93               jQuery("input[name=list_visible]").val(liste_visible);
    94             }
    95             // src = jQuery(this).find("img").attr("src");
    96             if (n) {
    97               jQuery(this).parent().height(h_min + 0);
    98               jQuery(this).parent().removeClass("visible");
    99               liste[i] = "off";
    100               jQuery(this).find("img").attr({
    101                 src: plus_path
    102 
    103               });
    104             }
    105             else {
    106               jQuery(this).parent().css("height", "auto");
    107               jQuery(this).parent().addClass("visible");
    108               liste[i] = "on";
    109               jQuery(this).find("img").attr({
    110                 src: minus_path
    111 
    112               });
    113             }
    114             val = liste.join(",");
    115             jQuery("input[name=list_visible]").val(val);
    116             jQuery('#set').val("true");
    117           }); // click
    118 
    119 
    120         }); //each fieldset
     135        }); // click
     136      }); //each fieldset
    121137      //==========================================================
    122138
    123 
    124 
    125 
    126       //=========================================================
    127 
    128139      var liste_action = { active: "", deactive: "" };
    129       jQuery("input[name=list_visible]").val(liste.join(","));
     140      jQuery("input[name=list_visible]").val(liste_visible.join(","));
    130141      jQuery("fieldset").show();
    131142    } // fielset
    132143    //====================================================================
    133144    jQuery(".plugin_list").each(function (i) {
    134       liste_des_plugins.push(jQuery(this).attr('id'));
    135     }
    136 
    137     )
    138 
     145      liste_des_plugins_activés.push(jQuery(this).attr('id'));
     146    });
     147   
    139148    //==============================================================
    140     jQuery("input").each(
     149    jQuery("input.button").each(
    141150        function (i) {
    142151          jQuery(this).click(function (event) {
    143152            jQuery(this).css("color", "red");
    144153            jQuery('#set').val("true");
     154            jQuery("#titrePage").before(
     155                '<img id="progressbar" alt = "" width="300px" title = ""' +
     156                'src = "./plugins/set_plugins/js/icon/ajax-loader-bar.gif"' + '>'
     157              );
     158            send_val({liste_visible:liste_visible,
     159              set: "true"
     160
     161            });
     162
    145163          }); // click
    146164
     
    156174        n = query.pwg_token;
    157175        action = query.action;
    158         val = liste.join(",");
    159         val2 = liste_des_plugins.join(",");
    160         jQuery.ajax({
    161           method: 'GET',
    162           // url: get_post,
    163           data: { get_post: get_post,
    164             liste_des_plugins: true,
    165             liste: val,
    166             add_plugins: query.plugin,
    167             set: "true",
    168             action: query.action
    169           },
    170            async: false,
    171           dataType: 'json',
    172           success: function (data) {
    173             n = eval(data);
    174             jQuery("#titrePage").after(
    175           '<img alt = "" width="50px" title = ""' +
    176           'src = "themes/default/images/colorbox-loading.gif"' + '>&nbsp;'
    177         );
    178 
    179 
    180             liste_des_plugins = data;
    181             n = data;
    182           }
     176        val = liste_visible.join(",");
     177        val2 = liste_des_plugins_activés.join(",");
     178        send_val({
     179          liste_des_plugins_activés: liste_des_plugins_activés,
     180          add_plugins: query.plugin,
     181          set: "true",
     182          action: query.action
    183183        });
    184 
    185 
    186184        /* */
    187 
    188185      }
    189186
    190     })
    191 
     187    });
    192188  }); // load
    193 });                                                                                  //ready           
     189});                                                                                         //ready           
    194190           
Note: See TracChangeset for help on using the changeset viewer.