Changeset 7458


Ignore:
Timestamp:
Oct 28, 2010, 2:48:57 PM (14 years ago)
Author:
cljosse
Message:

[Autosize][beta] Add the option validation of the autosize according to the status

Location:
extensions/Autosize
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/js/Affiche_script.js

    r7394 r7458  
    113113                                     info_theImage.borderwidth.top;
    114114
    115               img_top = info_theImage.top + info_theImage.borderwidth.top ;
     115              img_top = info_theImage.top + info_theImage.borderwidth.top;
    116116              return { marge_top: marge_top, img_top: img_top };
    117117
     
    124124              jQuery("#" + Parent + " p").css({ padding: "0px", margin: "0px "
    125125              });
    126             //  jQuery("#" + Parent + " p:not(:contains(' ')) ").remove();
    127               var inter_ligne = jQuery("#" + Parent + " p").css("lineHeight");
    128 
    129               jQuery("#" + Parent).css({ padding: "0px",
    130                marginLeft: "auto",
    131                   marginRight: "auto",
    132                   marginTop: "0px",
    133                   marginBottom: "0px"
    134                 });
    135 
     126              //  jQuery("#" + Parent + " p:not(:contains(' ')) ").remove();
     127
     128
     129
     130              //=============================================================================
    136131              var info_description = { top: 0, bottom: 0, height: 0 };
    137               //=============================================================================
    138               info_img = jQuery("#" + Parent + " img").info();
    139               info_description.top = info_img.bottom;
     132
     133              if (theme.match(RegExp("simple", "gi"))) {
     134                  jQuery("#" + Parent).css({ padding: "0px",
     135                      marginLeft: "0px",
     136                      marginRight: "auto",
     137                      marginTop: "0px",
     138                      marginBottom: "0px"
     139                  });
     140              } else {
     141                  jQuery("#" + Parent).css({ padding: "0px",
     142                      marginLeft: "auto",
     143                      marginRight: "auto",
     144                      marginTop: "0px",
     145                      marginBottom: "0px"
     146                  });
     147              }
     148
     149              if (theme.match(RegExp("luciano", "g"))) {
     150                  info_img = jQuery("#" + Parent + " #theImg").info();
     151              } else {
     152
     153                  info_img = jQuery("#" + Parent + " img").info();
     154              }
     155
     156              info_description.marge = { bottom: info_img.padding.bottom + info_img.margin.bottom + info_img.borderwidth.bottom,
     157                  top: info_img.padding.top + info_img.borderwidth.top
     158              }
     159
     160              info_description.top = info_img.bottom + info_img.margin.bottom + info_img.borderwidth.bottom;
    140161              //=============================================================================
    141162              info_gbo = jQuery("#gbo").info();
     
    143164                  info_description.top = info_gbo.bottom;
    144165              //=============================================================================
    145 
    146               info_desc = jQuery("#" + Parent + " p:last").info();
    147               info_description.bottom = info_desc.bottom;
     166              info_desc = jQuery("#" + Parent + " p:first").info();
     167              //  if (info_desc.top > info_img.bottom)
     168              //     info_description.top = info_desc.top;
     169
     170
     171              info_table = jQuery(".infoTable").info();
     172
     173              if (info_table.top > info_description.bottom)
     174                  info_description.bottom = info_table.top;
     175              //===========================================================================
    148176
    149177              info_licencetag = jQuery(".licencetag").info();
    150178
    151179
    152               if (info_licencetag.bottom > info_description.bottom) {
    153                   jQuery(".licencetag").css("border", "solid 2px transparent");
    154                   info_description.bottom = info_licencetag.bottom;
     180              if (info_licencetag.bottom > 0) {
     181                  jQuery(".licencetag").css("border", "solid 5px transparent");
     182                  if (info_licencetag.bottom > info_licencetag.height)
     183                      info_description.bottom = info_licencetag.bottom - 3;
     184                  else
     185                      info_description.bottom -= info_licencetag.padding.top + info_table.margin.top;
    155186
    156187              }
    157188              //=============================================================================
     189              if (theme.match(RegExp("gally", "gi"))) {
     190                  if (!theme.match(RegExp("lapis", "gi"))) {
     191                      info_description.bottom = info_description.bottom
     192                  }
     193              }
     194
     195
     196
     197
    158198
    159199              if (info_description.top < 1)
     
    161201
    162202
    163               if (info_description.bottom < info_description.top)
    164                   info_description.bottom = info_description.top = 1;
    165 
    166               info_description.height = info_description.bottom - info_description.top ;
     203              if (info_description.bottom < info_description.top) {
     204                  info_description.bottom = info_description.top;
     205
     206                  info_desc = jQuery("#" + Parent + " p:last").info();
     207
     208                  if (info_desc.bottom > info_img.bottom)
     209                      info_description.bottom = info_desc.bottom;
     210              }
     211
     212
     213              if (theme.match(RegExp("gally", "g"))) {
     214                  if (!theme.match(RegExp("lapis", "gi"))) {
     215                      info_copyright = jQuery("#copyright").info();
     216                      info_description.bottom += info_copyright.height;
     217                  }
     218              }
     219              info_description.height = info_description.bottom - info_description.top;
     220
     221              if (0) {
     222                  /*  jQuery("#Debug").text(jQuery("#Debug").text() + user_status);   
     223       
     224                  jQuery("#Debug").hide();
     225                  jQuery("#Debug1").hide();
     226                  jQuery("#Debug2").hide();
     227                  info_description.width = "800";
     228                  */
     229
     230                  Bandeau_bas = info_description;
     231
     232                  jQuery("#Debug").css({
     233                      filter: 'alpha(opacity:50)',
     234                      position: "absolute",
     235                      width: "800px",
     236                      border: "solid 1px green",
     237                      top: Bandeau + "px"
     238                  });
     239                  jQuery("#Debug").text("Debug:Bandeau : " + Bandeau);
     240
     241                  jQuery("#Debug1").css({
     242                      filter: 'alpha(opacity:50)',
     243                      position: "absolute",
     244                      border: "solid 1px green",
     245                      top: Bandeau_bas.top + "px",
     246                      width: (200) + "px",
     247                      height: Bandeau_bas.height + "px"
     248                  });
     249                  jQuery("#Debug1").text("Debug1:Bandeau_bas top : " + Bandeau_bas.top + " height:" + Bandeau_bas.height);
     250
     251                  jQuery("#Debug2").css({
     252                      filter: 'alpha(opacity:50)',
     253                      position: "absolute",
     254                      left: '50px',
     255                      width: (300) + "px",
     256                      border: "solid 1px green", top: Bandeau_bas.bottom + "px"
     257                  });
     258                  jQuery("#Debug2").text("Debug2:Bandeau_bas bottom :" + Bandeau_bas.bottom);
     259                  //  cl_visible = false;
     260              }
    167261
    168262              if (check_desc_v != 'checked="checked"') {
     
    213307          var Bandeau_t = Info_entete("theImage")
    214308          Bandeau = Bandeau_t.img_top;
    215 
    216 
    217309          var Bandeau_bas = 0;
    218310          Bandeau_bas = Info_description("theImage");
    219 
    220 
    221311          //===================================================================
    222 
    223 
    224 
    225 
    226312          /*
    227313          * window .resize
     
    230316              if (typeof (event) == 'undefined') return;
    231317              if (!cl_visible) return;
    232                if (eval(user_status + "_enabled") == "") return;
     318              if (eval(user_status + "_enabled") == "") return;
    233319              var chk = eval(user_status + "_enabled");
    234               /*  jQuery("#Debug").text(jQuery("#Debug").text() + user_status);
    235                
    236               jQuery("#Debug").hide();
    237               jQuery("#Debug1").hide();
    238               jQuery("#Debug2").hide();
    239              
    240               jQuery("#Debug").css({ position: "absolute", width: "200px", border: "solid 1px green", top: Bandeau + "px" });
    241               jQuery("#Debug").text(Bandeau);
    242 
    243               jQuery("#Debug1").css({ position: "absolute",
    244               border: "solid 1px green",
    245               top: Bandeau_bas.top + "px",
    246               width: (Bandeau_bas.width / 5) + "px",
    247               height: Bandeau_bas.height + "px"
    248               });
    249               jQuery("#Debug1").text(Bandeau_bas.top + " height:" + Bandeau_bas.height);
    250 
    251               jQuery("#Debug2").css({ position: "absolute",
    252               left: '200px',
    253               border: "solid 1px green", top: Bandeau_bas.bottom + "px"
    254               });
    255               jQuery("#Debug2").text(Bandeau_bas.bottom);
    256              
    257  */
    258              
     320
     321
    259322
    260323              //==========================================================================
     
    309372              var info_titrePage = jQuery("#titrePage").info();
    310373
    311                
     374
    312375              var Zone_Affichage = jQuery("#theImage").info();
    313376
     
    316379              var info_theHeader = jQuery("#theHeader").info();
    317380
    318               var marge = 0;
     381              var marge = (Zone_Affichage.width - info_ToolBar.width) / 2;
    319382
    320383              var marge_right = marge;
    321384              var marge_left = marge;
     385
    322386              if (info_content.width > 100) {
     387                  marge_left = 0;
    323388                  marge_right = info_imageInfoBar.margin.left + info_imageInfoBar.margin.right;
    324389                  winwidth = info_content.width;
     
    330395              winwidth -= (marge_right + marge_left);
    331396
    332               //======================================================================
    333397
    334398
     
    378442
    379443                      var TheImg = jQuery("#map").get(0);
    380                        img_reelle.height = info_image.height;
    381                        img_reelle.width = winwidth - marge_right - marge_right;
     444                      img_reelle.height = info_image.height;
     445                      img_reelle.width = winwidth - marge_right - marge_right;
    382446                      Bandeau_bas.height = 10;
    383447                      marge_right = 10;
    384                      
     448
    385449                      info_the_page = jQuery("#the_page").info();
    386450                      ;
     
    505569              Zone_Affichage.width = winwidth - borderW;
    506570
     571
     572
     573              var Licence = jQuery(".licencetag");
     574              info_Licence = jQuery(".licencetag").info();
    507575              //==================================================================================
    508576              jQuery("#theImage #theImg IMG").css("marginTop", "0px")
    509577
    510               var h = 0;
     578              var correction = 0;
    511579              if (theme.match(RegExp("sobre", "g"))) {
    512                   h += 0; //??
     580
     581                  correction = -info_Licence.padding.top;
     582
    513583              } else if (theme.match(RegExp("Pure", "g"))) {
    514                   h += 0; //??
     584                  correction += 0; //??
    515585              } else if (theme.match(RegExp("luciano", "g"))) {
    516                   h += 0; //??
     586                  correction += 0; //??
    517587              } else if (theme.match(RegExp("simple", "g"))) {
    518                   h += 0; //??
     588                  correction += 0; //??
    519589              } else if (theme.match(RegExp("gally", "g"))) {
    520                   h += 0; //??
     590                  correction += 0; //??
    521591
    522592              }
    523593              //================ Licence  ========================
    524               var Licence = jQuery(".licencetag");
     594
    525595              if (Licence.length > 0) {
    526596                  jQuery(".licencetag").css("padding", "0px");
     
    531601
    532602
    533               //=========================================================================
     603
    534604              img_top = Bandeau;
    535               //============ Padding image ? ===============
    536 
    537               img_padding_top = (info_img.padding.top);
    538               img_padding_top += (info_img.padding.bottom);
    539               img_padding_top += (info_img.borderwidth.top);
    540               img_padding_top += (info_img.borderwidth.bottom);
    541 
    542               margin_top = (info_Cadre.margin.top);
    543               padding_top = (info_Cadre.padding.top);
    544               padding_top += (info_Cadre.padding.bottom);
    545605
    546606              Marge_Basse = parseInt(marge_basse || 0); // hors bandeau
    547607              //==========================================================================
    548608              h = 0;
    549               Zone_Affichage.height = winheight - Bandeau - Marge_Basse;
    550               var Image_height = Zone_Affichage.height - Bandeau_bas.height;
    551 
    552               // jQuery("#Debug1").css("top", Image_height + "px");
     609              Zone_Affichage.height = winheight - Bandeau - Marge_Basse - correction;
     610              var Image_height = Zone_Affichage.height - Bandeau_bas.height - Bandeau_bas.marge.top - Bandeau_bas.marge.bottom;
     611
    553612              //=============================================================
    554613              var height_user = eval(user_status + "_height");
     
    612671
    613672              // }
     673              //===================================================
     674
    614675
    615676
     
    617678              //=============LLGBO2 ===========================
    618679
    619               t1 = { top: 0 };
     680
    620681              if (marges_llgbo > 0) {
    621682
     
    625686                  if (TheImg.src) {
    626687
    627 
    628                       if ((winwidth) < Image_width) {
    629                           _width = maxWidth;
     688                      Image_width -= marges_llgbo; // réduction frame
     689                      Image_height -= marges_llgbo; // réduction frame
     690                      if (rapport > 1) {
     691                          jQuery("#gbo").outerWidth(Image_width);
     692                          jQuery("#gbo").css("width", Image_width + "px");
     693
     694
     695                          t1 = jQuery("#gbo div:last").info();
     696
     697                          Image_width = jQuery("#gbo div:last").innerWidth();
     698                          Image_height = parseInt(Image_width / rapport);
     699
     700                          jQuery("#gbo").outerHeight(Image_height + marges_llgbo);
     701                          jQuery("#gbo").css("height", (Image_height + marges_llgbo) + "px");
     702                          if ( jQuery.browser.msie) {
     703                              jQuery("#gbo").css("paddingBottom", 18 + "px");
     704                          }
     705
    630706                      } else {
    631                           _width = Image_width;
     707                          Image_height -= 4;
     708                          Image_width -= 4;
     709                          jQuery("#gbo").css("height", (Image_height + marges_llgbo) + "px");
     710                          jQuery("#gbo").css("width", Image_width + marges_llgbo + "px");
     711
     712                          Image_width = jQuery("#gbo div:last").innerWidth();
     713                          Image_height = parseInt(Image_width / rapport);
     714
    632715                      }
    633                       _width -= marges_llgbo; // réduction frame
    634                       jQuery("#gbo").outerWidth(_width);
    635                       jQuery("#gbo").css("width", (_width) + "px");
    636 
    637 
    638 
    639                       Image_width = jQuery("#gbo div:last").innerWidth();
    640                       Image_height = parseInt(Image_width / rapport);
    641                       jQuery("#gbo").outerHeight(Image_height + marges_llgbo + 10);
    642                       jQuery("#gbo").css("height", (Image_height + marges_llgbo + 10) + "px");
    643 
    644                   } else {
    645 
    646                       jQuery("#gbo").width(Zone_Affichage.width - marges);
    647                       jQuery("#gbo").height(Image_height + marges)
    648                       jQuery("#gbo").css("width", Zone_Affichage.width - marges + "px");
    649                       jQuery("#gbo").css("height", Image_height - marges + "px")
     716
     717                      a1 = jQuery("area[rel=prev]");
     718                      a2 = jQuery("area[rel=next]");
     719
     720                      if (a1.length == 0) {
     721                          jQuery("area[rel=prev]").attr({ coords: "'" + 0 + ",0," + 0 + "," + 0 + "'" });
     722                          jQuery("area[rel=up]").attr({ coords: "'" + 0 + ",0," + Image_width / 2 + "," + Image_height + "'" });
     723                          jQuery("area[rel=next]").attr({ coords: "'" + Image_width / 2 + ",0," + (Image_width) + "," + Image_height + "'" });
     724
     725                      } else if (a2.length == 0) {
     726                          jQuery("area[rel=prev]").attr({ coords: "'" + 0 + ",0," + (Image_width) / 2 + "," + Image_height + "'" });
     727                          jQuery("area[rel=up]").attr({ coords: "'" + Image_width / 2 + ",0," + (Image_width * 2) / 2 + "," + Image_height + "'" });
     728                          jQuery("area[rel=next]").attr({ coords: "'" + 0 + ",0," + 0 + "," + 0 + "'" });
     729
     730                      } else {
     731
     732                          jQuery("area[rel=prev]").attr({ coords: "'" + 0 + ",0," + (Image_width) / 3 + "," + Image_height + "'" });
     733                          jQuery("area[rel=up]").attr({ coords: "'" + Image_width / 3 + ",0," + (Image_width * 2) / 3 + "," + Image_height + "'" });
     734                          jQuery("area[rel=next]").attr({ coords: "'" + (Image_width * 2) / 3 + ",0," + (Image_width) + "," + Image_height + "'" });
     735                      }
     736
    650737
    651738                  }
    652 
    653 
    654 
    655                   if (jQuery("area").length > 0) {
    656                       jQuery("area").each(function (i) {
    657 
    658                           obj1 = this.rel;
    659                           obj2 = this.coords;
    660                           if (obj1 == "up")
    661                               this.coords = (Image_width / 3) + "," + 0 + "," + (Image_width * 2 / 3) + "," + Image_height;
    662                           else if (obj1 == "prev")
    663                               this.coords = 0 + "," + 0 + "," + (Image_width / 3) + "," + Image_height;
    664                           else if (obj1 == "next")
    665                               this.coords = (Image_width * 2) / 3 + "," + 0 + "," + (Image_width * 3 / 3) + "," + Image_height;
    666 
    667                       });
    668 
    669 
    670 
    671 
    672 
    673 
    674                   }
    675 
     739              }
     740
     741              //================ Zone affichage =========================
     742              //  Image_height, Image_width = valeur a atteindre.
     743              if (theme.match(RegExp("luciano", "g"))) {
     744                  Zone_Affichage.height -= Bandeau_bas.height;
     745                  jQuery(Cadre).height(Zone_Affichage.height);
    676746
    677747              }
     
    683753              jQuery("#comments").css("top", 0 + "px");
    684754
    685               //================ Zone affichage =========================
    686               //  Image_height, Image_width = valeur a atteindre.
    687               if (theme.match(RegExp("luciano", "g"))) {
    688                   Zone_Affichage.height -= Bandeau_bas;
    689               }
    690 
    691755
    692756              jQuery(Cadre).width(Zone_Affichage.width);
     757
    693758              //==============================================================
    694759
    695760              img_finale.height = Image_height;
    696761              img_finale.width = Image_width;
    697               //==============================================================
     762
     763              //=========================================================================
     764
    698765
    699766              if (typeof (gmaps) != "undefined") {
    700767                  Gmap_ = gmaps.maps[0];
    701                   if (Gmap_.sizeMode == 'A')
    702                   {
     768                  if (Gmap_.sizeMode == 'A') {
    703769                      jQuery("#iGMapsIcon").css({ width: old_w * 0.8 + "px", height: old_h * 0.8 + "px" });
    704770
     
    790856              }
    791857
     858              /*
     859              jQuery("#Debug1").css({
     860              position: "absolute",
     861              top: Bandeau + "px",
     862              textAlign: align_auto,
     863              margin: "0px auto",
     864
     865
     866              border: "solid 1px red",
     867
     868              width: Image_width + "px",
     869              height: Image_height + "px"
     870
     871              });
     872              //===================================================
     873              jQuery("#Debug2").css({ position: "absolute",
     874              left: Zone_Affichage.left + 'px',
     875              border: "solid 1px green",
     876              top: Zone_Affichage.top + "px",
     877              width: Zone_Affichage.width / 2 + "px",
     878              height: Zone_Affichage.height + "px"
     879
     880              });
     881              jQuery("#Debug2").text(info_Cadre.bottom);
     882              */
    792883
    793884              try {
    794885                  if (theme.match(RegExp("gally", "g"))) {
    795886
     887                      //===========================================================================
     888
     889                      if (jQuery("#navThumbPrev").length > 0) {
     890                          jQuery("#navThumbPrev").css({ height: info_img.height + "px",
     891                              top: info_img.top
     892                          });
     893                      }
     894                      if (jQuery("#navThumbNext").length > 0) {
     895                          jQuery("#navThumbNext").css({ height: info_img.height + "px",
     896                              top: info_img.top
     897                          });
     898                      }
     899                      if (!theme.match(RegExp("lapis", "gi"))) { }
     900                  } else if (theme.match(RegExp("simple", "g"))) {
    796901
    797902                  } else {
     
    841946
    842947      } // function
    843 );                                                                                                                                                                                                                                                                                                                                        // ready
     948);                                                                                                                                                                                                                                                                                                                                                                                         // ready
    844949    /*
    845950*
  • extensions/Autosize/main.inc.php

    r7394 r7458  
    88Author URI:http://cljosse.free.fr
    99*/
    10 
     10/*| Ajoute l' option validation de l'autotaille en fonction du statut */
    1111if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    1212if (!defined('AUTOSIZE_PATH'))
     
    1616
    1717add_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_affiche'), 45 );
    18 //---- avant pamooramics ---
    19 //add_event_handler('render_element_content', array(&$autosize_controler, 'cl_autosize_aff_infos_plus'),40,2);
     18
    2019
    2120add_event_handler('get_admin_plugin_menu_links', array(&$autosize_controler,'cl_autosize_admin')  );
Note: See TracChangeset for help on using the changeset viewer.