Changeset 8911


Ignore:
Timestamp:
Jan 26, 2011, 12:52:35 PM (13 years ago)
Author:
cljosse
Message:

[Autosize][beta] compatibility whith piwigo 2.2


Location:
extensions/Autosize
Files:
5 added
9 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/admin/admin_autosize.php

    r8864 r8911  
    115115case 'autosize_help':
    116116
    117  $message="<fieldset id='fieldset'>
     117 $message="
    118118    <script id='dimensions' src='./plugins/Autosize/js/jquery.dimensions.js'></script>
    119119    <script id='Affiche_script' src='./plugins/Autosize/js/Affiche_script.js'></script>
     120    <fieldset id='fieldset'>
    120121    <div class='autosize'
    121          autosize='MargeBasse:30px;MargeHaute:30px;parent:fieldset;ResizePicture:true'
    122          >
    123 
    124         <img src='./galleries/Voyages/Europe/Italie/Chianti/IMG_0520.JPG' width='100%' />
    125         </a>
     122         autosize='MargeBasse:30px;MargeHaute:30px;parent:fieldset;ResizePicture:true'>
     123        <img src='./plugins/Autosize/images/ECO_050.jpg ' width='100%' />       
    126124    </div>
    127125</fieldset>";
    128126    if (isset($_POST['valid']))  {      $message = empty($_POST['texte']) ? $message : stripslashes($_POST['texte']);
    129127        }       
    130     //=========================================================================         
    131                 $toolbar = 'Basic';
    132                 $width = '100%';
    133                 $height = '200px';
     128    //=========================================================================
     129   
     130
     131     $toolbar = 'Full';         //basic
     132                $width = 'auto';
     133                $height = 'auto';
    134134                $areas = array();
    135135                $areas[]='texte';
    136136                if (!empty($areas)){
    137137                                if (function_exists('set_fckeditor_instance'))
    138                                 set_fckeditor_instance($areas, $toolbar, $width, $height);
     138                {  $template->set_prefilter('plugin_admin_content', 'add_remove_button');
     139                                 set_fckeditor_instance($areas, $toolbar, $width, $height);
     140                    }
    139141                        }
    140                  
    141 
    142 
    143 
    144 
    145    
    146 
    147142
    148143 $template->set_filenames(array( 'plugin_admin_content' => realpath(AUTOSIZE_PATH . 'admin/template/help.tpl' )));
  • extensions/Autosize/autosize.inc.php

    r8729 r8911  
    2525   PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'
    2626);
     27if (!defined('ROOT_URL'))
     28define(  'ROOT_URL',  get_root_url().'/' );
     29if (!defined('AUTOSIZE_PATH_ABS'))
     30define(
     31  'AUTOSIZE_PATH_ABS',
     32   dirname(__FILE__).'/'
     33);
     34
     35
    2736
    2837class autosize_controler {
     
    3746                $ma_page=isset($page['body_id'])?$page['body_id']:"" ;
    3847                if ($ma_page=='thePiwiShackControllerPage') return ;
     48
    3949            $my_path = dirname(__FILE__).'/';
    4050                $template->set_filenames(array('autosize_init'=>$my_path. "template/conflit.tpl" ) );   
     
    4252                $autosize_parametres =   cl_autosize_Get_Options() ;                   
    4353                $theme=$user['theme'];
    44                 $url = get_root_url();                   
     54                $url = get_root_url();   
     55        $AUTOSIZE_PATH=AUTOSIZE_PATH;   
     56     
     57
    4558                $template->assign(
    4659                                                array(   
     
    4962                                                'cl_version' => $cl_plugin['version'] ,
    5063                                                'name' => $cl_plugin['name'] ,                                           
    51                                                 'MY_ROOT' => $url,
    5264                                                'theme' => $theme  ,
    5365                                                'DEBUG' => $DEBUG   ,
    54                                                 'AUTOSIZE_PATH' => AUTOSIZE_PATH)
     66                         'AUTOSIZE_PATH' => AUTOSIZE_PATH  ,
     67                         'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS,
     68                         'ROOT_URL' => $url  ,
     69                                                )
    5570                                                 );
    5671 
     
    6378 static public function cl_autosize_script_2()
    6479 {
    65            global  $template,$user,$conf,$picture ,$page, $cl_plugin ;
     80           global  $template,$user,$conf,$picture ,$page, $cl_plugin,$known_script ;
    6681                        $my_path = dirname(__FILE__).'/';
    6782                        $DEBUG =  isset($conf['cl_debug']) ? $conf['cl_debug'] : "false"  ;
     
    109124        static public function cl_autosize_affiche()
    110125        {
    111                 global $user, $picture, $template,$page;
     126                global $user, $picture, $template,$page,$known_script;
    112127                global $content, $element_info;   
    113128                global $infos_message,$erreur_message;
     
    119134                        if ( isset($picture['current'])){       
    120135                                $autosize_parametres = cl_autosize_Get_Options();
    121                                 include (AUTOSIZE_PATH."include/affiche.php");         
     136                                include (AUTOSIZE_PATH."include/affiche.php");
     137                               
    122138                                if($autosize_parametres->check_icon_v == 'on'){                         
    123139                                                $template->assign('cl_autosize_button',
  • extensions/Autosize/include/affiche.php

    r8864 r8911  
    11<?php 
    2 
    3        
    4 
    52$visible=(isset($visible))?$visible:false;
    63$img_width=isset($picture['current']['width'])?$picture['current']['width']:480;
     
    1310$DEBUG= isset($conf['cl_debug']) ? $conf['cl_debug'] : $DEBUG ;
    1411 
    15 
     12 $my_path = AUTOSIZE_PATH_ABS;
    1613$theme=$user['theme'];
    1714$user_status = $user['status'] ;
    18                    $template->assign( array(
     15 
     16                   $template->assign( array( 'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS
    1917                                                                                        )
    2018                                                                        );             
     
    2927                                        'thumbnail' => $conf['prefix_thumbnail'],
    3028                    'visible' => $visible,
    31 
     29                     'ROOT_URL' => get_root_url()  ,
    3230                    'AUTOSIZE_PATH' => AUTOSIZE_PATH,
    3331                    'theme' => $theme,
  • extensions/Autosize/js/Affiche_script.js

    r8864 r8911  
    5151function Wait_Affichage() {
    5252    fade_in = parseInt(fade_in);
    53    
     53
    5454    if (!jQuery().newResize()) {
    5555        setTimeout("Wait_Affichage()", 500);
    5656        return
    5757    }
    58  nu_img++;
     58    nu_img++;
    5959    if (fade_in == 0) {
    6060        jQuery(Parent).css({ opacity: "1" });
     
    7373                       }
    7474              );
    75                    }
    76                    if (nu_img > 1) return;
    77 
    78                  
     75    }
     76 //   if (nu_img > 1) return;
     77
     78
    7979
    8080    img_h = jQuery(TheImg).height();
     
    8585    jQuery("#ret_autosize").val(src_img);
    8686
    87     jQuery("#ret_autosize").trigger('ON');
     87    jQuery("#ret_autosize").trigger('ON', { width: img_w, height: img_w, theImage: TheImg, src_img: src_img });
    8888
    8989
     
    9797
    9898
    99 
    10099    conf = jQuery(Obj).get(0).conf;
    101100    Obj = jQuery(Obj).get(0).obj;
    102101    myWindow = jQuery("#" + conf.parent).infos();
    103102
    104     if (myWindow == 0) myWindow = jQuery(window).infos();
     103    if (myWindow.width == 0) myWindow = jQuery(window).infos();
    105104    marge_basse = 0;
    106105    if (conf.MargeBasse)
     
    108107            conf.MargeBasse
    109108    );
     109    marge_top = 0;
     110    if (conf.MargeHaute)
     111        marge_top = jQuery().Get_Val_int(
     112            conf.MargeHaute
     113    );
     114
    110115    info_Obj = jQuery(Obj).infos();
    111116    h1_left = jQuery(Obj).absoluteLeft();
    112117    h1_top = jQuery(Obj).absoluteTop();
    113     if (typeof old_h1 == "undefined") old_h1 = 0;
    114 
    115 
    116118
    117119    if (h1_top < info_Obj.height)
    118         h1 = (myWindow.height - h1_top - marge_basse);
     120        h1 = (myWindow.height - h1_top - marge_basse - marge_top);
    119121    else
    120122        h1 = (myWindow.height - marge_basse);
    121123
    122     if (h1 == old_h1) return;
    123     old_h1 = h1;
    124 
    125     imgs = jQuery(Obj).find("img");
    126     rap = jQuery(imgs).height() / jQuery(imgs).width();
    127     w2 = (h1 / rap);
    128 
    129     // ("source:" + message);
     124
     125    rap = info_Obj.height / info_Obj.width;
     126    w2 = parseInt(h1 / rap);
    130127
    131128    if (w2 < info_Obj.width)
     
    134131        marginLeft = "auto";
    135132
    136     jQuery(Obj).css({ width: "auto",
     133    jQuery(Obj).css({ width: "auto",marginTop:marge_top,
    137134        marginLeft: "auto", marginBottom: 0 + "px",
    138135        verticalAlign: "middle", textAlign: "center"
    139136    });
    140137    jQuery(Obj).height(h1);
     138
    141139    //=============================================================
    142140    if (conf.ResizePicture != "true") {
    143141
    144142    } else
    145         jQuery(imgs).each(function (i) {
    146             img = jQuery(this);
    147             rap = jQuery(this).height() / jQuery(this).width();
    148             w2 = parseInt(h1 / rap);
    149             if (w2 > 0 && h1 > 0 && img.length > 0) {
    150                 img.height(h1);
    151                 img.width(w2);
    152             }
    153 
    154         });
     143        imgs = jQuery(Obj).find("img");
     144    Obj_w = jQuery(Obj).width();
     145    Obj_h = jQuery(Obj).height();
     146
     147    jQuery(imgs).each(function (i) {
     148        img = jQuery(this);
     149
     150        info_img = { width: conf.width[i], height: conf.height[i] };
     151        img_rap = conf.rap[i];
     152
     153        if (info_img.width > Obj_w) h1 = parseInt(Obj_w / img_rap);
     154        else w2 = parseInt(Obj_h * img_rap);
     155        if (w2 > 0 && h1 > 0 && img.length > 0) {
     156            img.height(h1);
     157            img.width(w2);
     158        }
     159
     160    });
    155161
    156162
     
    176182                    conf[jQuery.trim(tableau2[0])] = jQuery.trim(tableau2[1]);
    177183                }
     184                imgs = jQuery(a).find("img");
     185                rap = new Array();
     186                width = new Array();
     187                height = new Array();
     188                jQuery(imgs).each(function (i) {
     189                    img = jQuery(this);
     190                    rap.push((img.width() / img.height()));
     191                    width.push( img.width()   );
     192                    height.push( img.height() );
     193                });
     194
     195                conf['rap'] = rap;
     196                conf['width'] = width;
     197                conf['height'] = height;
    178198
    179199                List_autosize.push({ obj: a, conf: conf });
     
    190210
    191211function List_autosize_resize(event, ui) {
     212    if (typeof wait_resize == "undefined") wait_resize = false;
     213    if (wait_resize == true) return;
     214
     215    wait_resize = true;
    192216    if (List_autosize.length == 0) return;
    193217    for (i = 0; i < List_autosize.length; i++) {
    194218        Autosize_resize(jQuery(List_autosize[i]));
    195219    }
     220    wait_resize = false;
    196221
    197222}
  • extensions/Autosize/js/conflit.js

    r8864 r8911  
    537537    //=== ajout des fonctions jQuery ===
    538538    jQuery.extend($, jQuery);
    539 
    540 
    541     //--------------------------------------------------------------
    542 
  • extensions/Autosize/main.inc.php

    r8864 r8911  
    1212if (!defined('AUTOSIZE_PATH'))
    1313define(  'AUTOSIZE_PATH',   PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/' );
     14if (!defined('ROOT_URL'))
     15define(  'ROOT_URL',  get_root_url().'/' );
    1416//==================================================================
    1517        include(AUTOSIZE_PATH."include/constants.php");           
  • extensions/Autosize/template/autosize.tpl

    r8864 r8911  
    11{html_head}  {* $Id: autosize/template/autosize.tpl  *}
    2 <!-- autosize/template/autosize.tpl  -->
    3     {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" now=1}
    4     {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
    5     {known_script id="dimensions" src=$AUTOSIZE_PATH|@cat:"js/jquery.dimensions.js"}
    6 
     2<!-- autosize/template/autosize.tpl  -->
    73 <script type="text/javascript">
    84    var src_img = '{$SRC_IMG}';
     
    4743    var check_desc_v = '{$check_desc_v}';
    4844 </script>
    49 {known_script id="Affiche_script" src=$AUTOSIZE_PATH|@cat:"js/Affiche_script.js"}
     45{if PHPWG_VERSION < 2.2 }
     46 {include file=$AUTOSIZE_PATH_ABS|@cat:'template/picture_2_1.tpl'}
     47{else}
     48{include file= $AUTOSIZE_PATH_ABS|@cat:'template/picture_2_2.tpl'}
     49{/if}
    5050<link href="{$AUTOSIZE_PATH}css/autosize.css" rel="stylesheet" type="text/css" />
    5151 <!--  << autosize/template/autosize.tpl   -->
  • extensions/Autosize/template/conflit.tpl

    r8729 r8911  
    11{html_head}
    2 <!--- cl_conflit/template/confilt.tpl --->
    3  {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"  now=1}
    4  {known_script id="dimensions" src=$AUTOSIZE_PATH|@cat:"js/jquery.dimensions.js"}
    5  {known_script id="conflit_script" src=$AUTOSIZE_PATH|@cat:"js/conflit.js"}
    6  {/html_head}
     2{if PHPWG_VERSION < 2.2 } 
     3    {include file=$AUTOSIZE_PATH_ABS|@cat:'template/header_2_1.tpl'}
     4 {else}
     5    {include file= $AUTOSIZE_PATH_ABS|@cat:'template/header_2_2.tpl'}
     6 {/if}
     7{/html_head}
     8
    79<script type="text/javascript">
     10 
    811 var DEBUG = '{$DEBUG}';
    912    var theme = '{$theme}';
  • extensions/Autosize/template/picture.tpl

    r8864 r8911  
    2020
    2121 </script>
    22  <form method="post">
     22 
    2323<input id="ret_autosize"  type="hidden" value="" />
    2424<input id="src_img_h"  type="hidden" value="" />
    2525<input id="src_img_w"   type="hidden" value="" />
    26 </form>
     26
     27 
Note: See TracChangeset for help on using the changeset viewer.