Changeset 19744 for extensions


Ignore:
Timestamp:
Jan 3, 2013, 10:51:15 AM (12 years ago)
Author:
cljosse
Message:

[extensions] Autosize fix bug init with chrome

Location:
extensions/Autosize
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/autosize.inc.php

    r19707 r19744  
    5353    $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 
    5454   if ($ma_page !='thePicturePage') return ;
     55    $default_size =  $conf['derivative_default_size'];
     56//============================================================
     57self::get_cookies();
    5558    $types = array_intersect(array_keys(ImageStdParams::get_defined_type_map()), array("Autosize","SelMaxi"));
    5659    if (count($types)==0){ 
     
    7073        $infos_message .= "POST:"  . cl_print_var($_POST) ;
    7174        $infos_message .= "$pictureDeriv $pictureSelType $pictureMap ";
    72       //  die("#138: ".$DEBUG_autosize);
     75      //  self::Fin_php ("#138: ".$DEBUG_autosize);
    7376 }
    7477    if(!isset($_COOKIE['picture_deriv'] )){
    7578        if(preg_match("|test_1|", $DEBUG_autosize, $val)) {
    7679          $infos_message .= "not COOKIE['picture_deriv'] -> reload(): <br>";
    77           echo $infos_message;
    78           die("#78 autosize_calcContent:" . $DEBUG_autosize);
     80         
     81          self::Fin_php("#78 autosize_calcContent:" . $DEBUG_autosize );
    7982        }
    80         self::reload();
    81             die("#81 autosize_calcContent:" + $DEBUG_autosize);
     83        self::reload("#80");
     84           self::Fin_php("#81 autosize_calcContent:" + $DEBUG_autosize);
    8285    } 
    8386
     
    8790          $infos_message .= "not COOKIE['autosize_reload'] -> reload(): <br>";
    8891           echo $infos_message;
    89           die("#89 autosize_calcContent:" . $DEBUG_autosize);
     92          self::Fin_php("#89 autosize_calcContent:" . $DEBUG_autosize);
    9093        }
    91           self::reload();
    92             die("#92 autosize_calcContent:" + $DEBUG_autosize);
     94          self::reload("#81");
     95           self::Fin_php("#92 autosize_calcContent:" + $DEBUG_autosize);
    9396
    9497    } 
     
    155158        $infos_message .= "POST:"  . cl_print_var($_POST) ;
    156159        $infos_message .= "$pictureDeriv $pictureSelType $pictureMap ";
    157       //  die("#138: ".$DEBUG_autosize);
     160      //  self::Fin_php("#138: ".$DEBUG_autosize);
    158161 }
    159162  $autosize_parametres = cl_autosize_Get_Options();
     
    220223         if(preg_match("|c1|", $DEBUG_autosize, $val)) {
    221224         echo "<!-- " . $theImageWidth . "x" . $theImageHeight . " " .cl_print_var($content) ." -->";
    222          die("#230: " . $DEBUG_autosize);
     225         self::Fin_php("#222: " . $DEBUG_autosize);
    223226    }
    224227      return  $content;
     
    315318         echo "left:".$theImageLeft."px;top:".$theImageTop."px;width:".$theImageWidth ."px;height:" .$theImageHeight."px;";
    316319        echo "<div style='position:absolute;left:".$theImageLeft."px;top:".$theImageTop."px;width:".$theImageWidth ."px;height:" .  $theImageHeight."px;background-color:green;'>";
    317  die("#317 : " . $content + $DEBUG_autosize);
     320 self::Fin_php("#317 : " . $content + $DEBUG_autosize);
    318321   
    319322} //INIT2
     
    321324*
    322325***************************/
    323 static public  function reload(){
     326static public  function reload($id_ret){
    324327//=========================================
    325328include_once ( "include/functions_cookie.inc.php");   
     
    330333  $set_miniature = "<!DOCTYPE html><html><head>
    331334   <meta http-equiv='content-type' content='text/html; charset=UTF-8'/>
    332     <script type='text/javascript' src='themes/default/js/jquery.min.js'></script><script type='text/javascript' src='plugins/Autosize/js/autosizeDetect.js'></script>
     335    <script type='text/javascript' src='themes/default/js/jquery.min.js'></script>
     336    <script type='text/javascript' src='plugins/Autosize/js/autosizeDetect.js'></script>
    333337    <script type='text/javascript' src='plugins/Autosize/js/autosize.cookie.js'></script>
    334338    <script type='text/javascript' src='".PHPWG_ROOT_PATH."themes/default/js/plugins/jquery.ajaxmanager.js'></script>";     
     339   
    335340    $set_miniature .= "<script type='text/javascript' src='".PHPWG_ROOT_PATH."plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' >  </script >";
    336341
    337342   $set_var = "<script type='text/javascript'>\n var COOKIE_PATH =  '".cookie_path()."';\n"; 
    338 
     343   if(preg_match("|noreload|", $DEBUG_autosize, $val)) { 
     344   $set_var .= " var reload =  'false';\n"; 
     345   } else {
     346    $set_var .= " var reload =  'true';\n"; 
     347   }
     348   $set_var .= " var ret_id =  '". $id_ret . "';\n"; 
    339349   $set_var .= " var mapage =  '". $ma_page . "';\n"; 
    340350   $set_var .= " var theme =  '" .$user['theme']. "';\n"; 
     
    348358      </head>
    349359      <body onload=on_load() style='background-color:black;color :white;font-size:30px '  > 
    350      please wait, loading...
     360     please wait, loading($id_ret)...
    351361     <div></div>
    352362      </body></html>";   
    353 
     363     
    354364 
    355365  $default_size =  $conf['derivative_default_size'];
     
    381391  echo "INIT <pre>";
    382392  print_r($_COOKIE);
    383   die(400);
    384 }
    385 
    386 if(preg_match("|vue_init|", $DEBUG_autosize, $val)) {
    387         echo "Reload: $userst <br> $usertype <br> autosize_parametres:"  . cl_print_var($autosize_parametres) ;
    388         echo $infos_message ;
    389     if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ;
     393  self::Fin_php("#385: ".$DEBUG_autosize);
     394}
     395
     396if(preg_match("|vue_init|", $DEBUG_autosize, $val)) {   
     397  $infos_message.="Reload: $userst <br> $usertype <br> autosize_parametres:"  . cl_print_var($autosize_parametres) ; 
     398        if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ;
    390399        echo "Reload: SESSION:"  . cl_print_var($_SESSION) ;
    391400        echo "Reload: COOKIE:"  . cl_print_var($_COOKIE) ;
    392401        echo "GET:"  . cl_print_var($_GET) ;
    393402        echo "POST:"  . cl_print_var($_POST) ;
    394         die("#442: ".$DEBUG_autosize);
    395  }
     403        self::Fin_php("#396: ".$DEBUG_autosize);
     404    }
     405
     406     $infos_message.="Reload: $userst <br> $usertype <br> autosize_parametres:"  . cl_print_var($autosize_parametres) ; 
     407
    396408        echo $set_miniature ;
    397409        echo $set_var ;
    398         echo $autoscript; 
    399         die();
    400       //=========================================     
    401 
     410       
     411        echo $autoscript;       
     412        self::Fin_php("#401: ".$DEBUG_autosize);
     413       
    402414}
    403415
     
    455467    );
    456468   if( preg_match("|c2|", $DEBUG_autosize, $val) ){
    457    die( "446: " . $DEBUG_autosize);
     469   self::Fin_php( "446: " . $DEBUG_autosize);
    458470   return $content ;
    459471
     
    672684    $pictureMap=$_COOKIE['picture_map'];
    673685    $infos_message .= "<br />SelType:" . $pictureSelType."; pictureDeriv:".$pictureDeriv ."; pictureMap:".$pictureMap;
    674     echo $infos_message;
    675     die ("#657: ".$DEBUG_autosize);
     686   
     687    self::Fin_php("#677: ".$DEBUG_autosize);
    676688 } 
    677689       cl_aff_infos_plus();
     
    10951107 ****************************/
    10961108 static public  function  get_cookies(){
    1097   global $pictureDeriv,$pictureSelType,$pictureDeriv;
     1109  global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap;
    10981110  if(!isset($_COOKIE['picture_deriv'])){
    10991111      $pictureDeriv= pwg_get_session_var('picture_deriv');
     
    11151127 ****************************/
    11161128 static public  function  save_cookies(){
    1117  global $pictureDeriv,$pictureSelType,$pictureDeriv;
     1129  global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap;
    11181130
    11191131  pwg_set_session_var('picture_deriv',$pictureDeriv);
     
    11411153$_COOKIE['picture_deriv']=$pictureDeriv;
    11421154$_COOKIE['picture_map']=$pictureDeriv;
     1155}
     1156
     1157static public function Fin_php($message_){
     1158global  $infos_message;
     1159 echo "End :".$message_."<br>";
     1160die($infos_message);
    11431161}
    11441162 //==================================================
  • extensions/Autosize/js/autosizeDetect.js

    r18735 r19744  
    4343  jQuery.cookie('theMainImage', theMainImageWidth, { path: COOKIE_PATH });
    4444*/
     45  retval = jQuery.cookie('autosize_reload');
     46  if (retval == "ok") return;
    4547
    4648  jQuery.cookie('autosize_reload', "ok", { path: COOKIE_PATH });
    47  
    48  document.location.reload(false); // from cache
     49  if (reload=="true") {
     50    //document.location.reload(false); // from cache
     51    try {
    4952
     53      var retval = document.location.reload(true);
     54    }
     55    catch (err) {
     56      var retval = window.location.reload();
     57    }
     58  }
    5059}
  • extensions/Autosize/main.inc.php

    r19707 r19744  
    22/*
    33Plugin Name: AutoSize
    4 Version: 3.0.3
     4Version: 3.0.4
    55Description: Ajuste l'affichage des photos en fonction de la hauteur de la fenetre de navigation
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=448
Note: See TracChangeset for help on using the changeset viewer.