Ignore:
Timestamp:
Apr 5, 2011, 12:45:03 PM (13 years ago)
Author:
cljosse
Message:

[extensions] edit_gmaps compatibility with piwigo 2.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/edit_gmaps/admin/js/fieldset.js

    r8501 r10060  
    1  if (typeof ef_animate_fast == "undefined")
    2       var ef_animate_fast = true;
     1if (typeof ef_animate_fast == "undefined")
     2  var ef_animate_fast = true;
    33
    4       // Smart Fieldsets initialization/
    5       if (typeof ef_plus_bullet_path == "undefined")
    6       {       
    7          var ef_plus_bullet_path = './plugins/edit_gmaps/admin/icon/plus.png';
    8          var ef_minus_bullet_path = './plugins/edit_gmaps/admin/icon/minus.png';
    9  
    10       }
     4// Smart Fieldsets initialization/
     5if (typeof ef_plus_bullet_path == "undefined") {
     6  var ef_plus_bullet_path = './plugins/edit_gmaps/admin/icon/plus.png';
     7  var ef_minus_bullet_path = './plugins/edit_gmaps/admin/icon/minus.png';
    118
    12      if (typeof ef_separator == "undefined") 
    13      var ef_separator = ' : ';
     9}
    1410
    15       function ef_reduce(fieldset_id, fast) {
    16           var l_m = jQuery('#' + fieldset_id + ' legend');
    17           if (ef_reduce.arguments.length < 2) fast = ef_animate_fast;
    18           if (!l_m.is('.ef_command')) l_m.addClass('ef_command');
    19           if (!jQuery('#' + fieldset_id).is(':hidden'))
    20               l_m.trigger('ef_reduce_private', fast);
    21           l_m.removeClass('ef_command');
     11if (typeof ef_separator == "undefined")
     12  var ef_separator = '&nbsp;: ';
    2213
    23       }
     14function ef_reduce(fieldset_id, fast) {
     15  l_m = jQuery('#' + fieldset_id + ' legend');
     16  if (ef_reduce.arguments.length < 2) fast = ef_animate_fast;
     17  if (!l_m.is('.ef_command')) l_m.addClass('ef_command');
     18  if (!jQuery('#' + fieldset_id).is(':hidden'))
     19    l_m.trigger('ef_reduce_private', fast.fast,this);
     20  l_m.removeClass('ef_command');
    2421
    25       function ef_maximize(fieldset_id, fast) {
    26           var l_r = jQuery('#' + fieldset_id + '_reduced_legend');
    27           if (ef_maximize.arguments.length < 2) fast = ef_animate_fast;
    28           if (!l_r.is('.ef_command')) l_r.addClass('ef_command');
    29           if (jQuery('#' + fieldset_id).is(':hidden'))
    30               l_r.trigger('ef_maximize_private', fast);
    31           l_r.removeClass('ef_command');
    32       }
     22}
    3323
    34    
    35       function ef_init(fieldset_id, cache_id) {
    36           jQuery(document).ready(function () {
    37               var f_m = jQuery('#' + fieldset_id);
    38               var l_m = jQuery('#' + fieldset_id + ' legend');
    39               var l_txt = l_m.text();
    40               var f_r = f_m;
    41               var l_r = l_m;
     24function ef_maximize(fieldset_id, fast) {
     25  l_r = jQuery('#' + fieldset_id + '_reduced_legend');
     26  if (ef_maximize.arguments.length < 2) fast = ef_animate_fast;
     27  if (!l_r.is('.ef_command')) l_r.addClass('ef_command');
     28  if (jQuery('#' + fieldset_id).is(':hidden'))
     29    l_r.trigger('ef_maximize_private', fast);
     30  l_r.removeClass('ef_command');
     31   
     32}
    4233
    43               if (ef_minus_bullet_path != '') l_m.prepend(
     34var l_m, l_r;
     35function ef_init(fieldset_id, cache_id) {
     36  jQuery(document).ready(function () {
     37    var f_m = jQuery('#' + fieldset_id);
     38    l_m = jQuery('#' + fieldset_id + ' legend');
     39    var l_txt = l_m.text();
     40    var f_r = f_m;
     41    l_r = l_m;
     42
     43    if (ef_minus_bullet_path != '') l_m.prepend(
    4444          '<img alt = "" title = ""' +
    4545          'src = "' + ef_minus_bullet_path + '"' + '>&nbsp;'
    4646        );
    47               l_m.addClass('ef_legends');
    48               l_m.addClass('ef_click_ok');
    49    
     47    l_m.addClass('ef_legends');
     48    l_m.addClass('ef_click_ok');
    5049
    51               f_r = jQuery('#' + fieldset_id + " ").clone();
    52               l_r = jQuery('#' + fieldset_id + " LEGEND").clone();
    53               f_r.empty();
    54               l_r.appendTo(f_r);
    55  
    56               f_r.attr('id', fieldset_id + '_reduced');
    57               f_r.insertAfter(f_m);
    58                f_r.css({display: 'none'   });
    59              
    60    
    61               l_r.attr('id', fieldset_id + '_reduced_legend');
    62               l_r.addClass('ef_legends');
    63               l_r.addClass('ef_click_ok');
    6450
    65                
     51    f_r = jQuery('#' + fieldset_id + " ").clone();
     52    l_r = jQuery('#' + fieldset_id + " LEGEND").clone();
     53    f_r.empty();
     54    l_r.appendTo(f_r);
    6655
    67               l_r.css({               
    68                   outlineColor: "invert",
    69                   opacity: 0
    70               }); 
    71                        
    72      if (ef_plus_bullet_path == '')
    73          l_r.append(
     56    f_r.attr('id', fieldset_id + '_reduced');
     57    f_r.insertAfter(f_m);
     58    f_r.css({ display: 'none' });
     59
     60
     61    l_r.attr('id', fieldset_id + '_reduced_legend');
     62    l_r.addClass('ef_legends');
     63    l_r.addClass('ef_click_ok');
     64
     65
     66
     67    l_r.css({
     68      outlineColor: "invert",
     69      opacity: 0
     70    });
     71
     72    if (ef_plus_bullet_path == '')
     73      l_r.append(
    7474          '<span style = "padding-left:' + l_m.css('padding-left') + ';">' +
    7575          l_txt + '</' + 'span>' + ef_separator
    7676         );
    77               else
    78               {
     77    else {
    7978
    80               lg= jQuery(l_r).find("img") ;
    81               if(lg.length>0)
    82                   lg.get(0).src = ef_plus_bullet_path ;
     79      lg = jQuery(l_r).find("img");
     80      if (lg.length > 0)
     81        lg.get(0).src = ef_plus_bullet_path;
    8382
    84               l_r.append('&nbsp;' + ef_separator  );
    85          }
     83      l_r.append('&nbsp;' + ef_separator);
     84    }
    8685
    87              f_r.append('<span id="' + cache_id +'" > </span>') ;
    88                    jQuery('.ef_legends').css('cursor', 'pointer');
    89               l_m.bind('ef_reduce_private', function (event, fast) { // Reduce
    90              
    91                   if (l_m.is('.ef_command, .ef_click_ok')) {
    92                       if (fast) {
    93                           f_m.hide();
    94                           f_r.show();
    95                           f_r.find('*').css({opacity: 1});
    96                       }
    97                       else {
    98                           f_m.find('*').not('.ef_legends, img').animate(
    99                                  {opacity: 0} ,
    100                                 200,
     86    f_r.append('<span id="' + cache_id + '" > </span>');
     87    jQuery('.ef_legends').css('cursor', 'pointer');
     88
     89    l_m.bind('ef_reduce_private', function (event, fast) { // Reduce
     90
     91      if (l_m.is('.ef_command, .ef_click_ok')) {
     92        if (fast) {
     93          f_m.hide();
     94          f_r.show();
     95          f_r.find('*').css({ opacity: 1 });
     96        }
     97        else {
     98          f_m.find('*').not('.ef_legends, img').animate(
     99                                 { opacity: 0 }, 200,
    101100                                function () {
    102                                     f_m.slideUp(400);
    103                                     f_r.slideDown(400, function () {
    104                                             f_r.find('*').css({opacity: 1});
    105                                     });
     101                                  f_m.slideUp(400);
     102                                  f_r.slideDown(400, function () {
     103                                    f_r.find('*').css({ opacity: 1 });
     104                                  });
    106105                                }
    107106                            );
    108                       }
    109                   }
    110               });
    111               l_r.bind('ef_maximize_private', function (event, fast) { // Maximize
    112                   if (l_r.is('.ef_command, .ef_click_ok')) {
    113                       if (fast) {
    114                           f_r.hide();
    115                           f_m.show();
    116                       } else {
    117                           f_r.find('*').css({opacity: 0});
    118                           f_r.slideUp(400);
    119                           f_m.slideDown(400, function () {
    120                               f_m.find('*').not('.ef_legends, img').animate(
    121                                                                     {opacity: 1},
    122                                                                             200
    123                                                                               );
    124                                  });
    125                         }
    126                   }
    127               });
    128               l_m.click(function () { // Reduce
    129                   l_m.trigger('ef_reduce_private', ef_animate_fast);
    130               });
    131               l_r.click(function () { // Maximize
    132                   l_r.trigger('ef_maximize_private', ef_animate_fast);
    133               });
     107        }
     108      }
     109    });
     110
     111    l_r.bind('ef_maximize_private', function (event, fast) { // Maximize
     112      if (l_r.is('.ef_command, .ef_click_ok')) {
     113        if (fast) {
     114          f_r.hide();
     115          f_m.show();
     116        } else {
     117          f_r.find('*').css({ opacity: 0 });
     118          f_r.slideUp(400);
     119          f_m.slideDown(400, function () {
     120            f_m.find('*').not('.ef_legends, img').animate({ opacity: 1 },200 );
    134121          });
     122        }
    135123      }
     124    });
     125
     126    l_m.click(function () { // Reduce
     127      l_m.trigger('ef_reduce_private', ef_animate_fast);
     128    });
     129
     130    l_r.click(function () { // Maximize
     131      l_r.trigger('ef_maximize_private', ef_animate_fast);
     132    });
     133    if (no_affiche!="true") {
     134      ef_reduce("geoposition", { fast: true })
     135      // jQuery("#Envoie").trigger("submit");
     136    } else {
     137      ef_reduce("Elements", { fast: true })
     138    }
     139  });
     140}
    136141
    137142
    138       jQuery(document).ready(function () {
    139           if (jQuery(".fieldset").length >= 1)
    140               jQuery(".fieldset").each(
     143jQuery(document).ready(function () {
     144  if (jQuery(".fieldset").length >= 1)
     145    jQuery(".fieldset").each(
    141146                function (i) {
    142                     id0 = jQuery(this).attr("id");
    143                     if (id0 == "") jQuery(this).attr("id", "Cadre_" + i);
    144                     id0 = jQuery(this).attr("id");
    145                     // Update of the '#cache' value when changing the selected value in the fieldset
    146                     jQuery("#" + id0 + ' .inputs').click(function () {
    147                         jQuery("#" + id0).text(jQuery("#" + id0 + ' .inputs:checked').next().text());
    148                     });
     147                  id0 = jQuery(this).attr("id");
     148                  if (id0 == "") jQuery(this).attr("id", "Cadre_" + i);
     149                  id0 = jQuery(this).attr("id");
     150                  // Update of the '#cache' value when changing the selected value in the fieldset
     151                  jQuery("#" + id0 + ' .inputs').click(function () {
     152                    jQuery("#" + id0).text(jQuery("#" + id0 + ' .inputs:checked').next().text());
     153                  });
    149154                });
    150           // Some changes of the defaults, nothing to see with Smart Fieldsets
    151           //   jQuery('input').attr('checked', 'true');
    152           jQuery('code').css('font-size', 'larger');
    153           jQuery('#ef_presentation label, #ef_presentation input').css('cursor', 'pointer');
    154       });
     155  // Some changes of the defaults, nothing to see with Smart Fieldsets
     156  //   jQuery('input').attr('checked', 'true');
     157  jQuery('code').css('font-size', 'larger');
     158  jQuery('#ef_presentation label, #ef_presentation input').css('cursor', 'pointer');
     159});
    155160
    156161
    157162
    158       jQuery(document).ready(function () {
    159           if (jQuery(".fieldset").length >= 1) {
    160               jQuery(".fieldset").each(
     163jQuery(document).ready(function () {
     164  if (jQuery(".fieldset").length >= 1) {
     165    jQuery(".fieldset").each(
    161166              function (i) {
    162                   id0 = jQuery(this).attr("id");
    163                   ef_init(id0, 'cache' + i);
     167                id0 = jQuery(this).attr("id");
     168                ef_init(id0, 'cache' + i);
    164169
    165170              })
    166           }
    167           if (no_affiche) {
    168               ef_reduce("geoposition", true)
    169           } else {
    170               ef_reduce("Elements", true)
    171           }
    172171
    173       })
     172  }
     173
     174})
    174175
    175176             
Note: See TracChangeset for help on using the changeset viewer.