Changeset 16754


Ignore:
Timestamp:
Jul 15, 2012, 7:44:26 PM (12 years ago)
Author:
gbo
Message:

2.4F improve frame management first size and JS resize

Location:
extensions/LLGBO2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/LLGBO2/admin/llgbo_admin.php

    r15076 r16754  
    289289                if ($_POST['sample'] == "B_W")
    290290                        { $llgbo_sample = "#e8cb8b,#fcf6e9,11,#171112,9,#352c2d,1,#fcf6e9,1,#000000,3,#171112,3,#000000,0,#000000,0,#000000,0,#000000,0,#000000,0,#000000,0,#000000,0,#000000,0,#000000,0,#000000,0";}
     291                if ($_POST['sample'] == "IVORY")
     292                        { $llgbo_sample = "#16195f,#f4f4f4,4,#685008,1,#e0e0df,5,#d6d6d4,1,#cbcbca,1,#c0c0be,1,#b5b5b4,1,#aaaaa8,1,#9e9e9c,1,#929291,1,#868685,1,#7b7b7a,1,#6e6e6d,1,#626261,1,#555555,1,#4a4a4a,1";}
    291293                if ($_POST['sample'] != "MY_LAST_VALUES")
    292294                  { $conf['LLGBO_FRAME'] = explode ("," ,$llgbo_sample ); }
  • extensions/LLGBO2/admin/llgbo_adminframe.tpl

    r10453 r16754  
    1818                <option label="WHITE" value="WHITE">White</option>
    1919                <option label="B_W" value="B_W">Black&White</option>
     20                <option label="IVORY" value="IVORY">Ivory</option>
    2021                <option label="MY_LAST_VALUES" value="MY_LAST_VALUES"><selected="selected">MyLastValues</option>
    2122                </select> <input class="submit" type="submit" value="{'previewsamples'|@translate}" name="previewsample"/>
  • extensions/LLGBO2/include/manage_picture_content.php

    r16145 r16754  
    22$prev = $template->get_template_vars('previous');
    33$next  = $template->get_template_vars('next');
    4 $current  = $template->get_template_vars('current');
     4$current = $template->get_template_vars('current');
    55$themeconf = $template->get_template_vars('themeconf');
     6$slideshow = $template->get_template_vars('U_SLIDESHOW');
    67//print_r($next);
    78$swtimg =   '||<img src=';     
     
    1415        $template->append('llgbo', array('tooltipCSS'  => $sweetcss), true);
    1516        }       
    16        
     17If (($conf['LLGBO_SETTINGS'] [0] == 'true') and (!isset($slideshow))  ) //Frame
     18        {       
     19        $template->set_prefilter('default_content', 'LLGBO_prefilter_Content_Frame');
     20
    1721//----------------------------------------------------   
    18 /*              HTML  frame                          */
    19 //----------------------------------------------------   
    20 If (($conf['LLGBO_SETTINGS'] [0] == 'true') ) //Frame
    21         {       
    22         $template->set_prefilter('default_content', 'LLGBO_prefilter_Frame');
    23         // selected picture Size                       
    24         $deriv_type = pwg_get_session_var('picture_deriv', IMG_LARGE);
    25         $PictSizeWH  =  $element_info['derivatives'][$deriv_type]->get_size(); 
    26         $frame_width  = $PictSizeWH[0];
    27                 $frame_height = $PictSizeWH[1];
    28                 $lastbrdpx = 0;
    29                 $frame_begin ='';
     22/*       HTML End  frame   on Picture_content       */
     23//----------------------------------------------------         
    3024                $frame_end='';
    3125                for ($x = 1   ;$x < 32  ; $x =$x +2)
    3226                {       if ((isset($conf['LLGBO_FRAME'][$x+1])) and  ($conf['LLGBO_FRAME'][$x+1] > 0))  // boder value > 0     
    33                           { $bordpx= $conf['LLGBO_FRAME'][$x+1];
    34                                 $frame_width = $frame_width + ( 2* $lastbrdpx);                         
    35                                 $frame_height = $frame_height + ( 2* $lastbrdpx);
    36                             $bordcolor = $conf['LLGBO_FRAME'][$x];
    37                             $frame_begin = '<div   id ="llgboframe'.$x.'" style="border:'.$bordpx.'px solid '.$bordcolor.';width:'.$frame_width.'px; height:'.$frame_height.'px;">'."\n".$frame_begin;
    38                                 $frame_end = $frame_end .'</div>';     
    39                                 $lastbrdpx = $bordpx;}
     27                          {     $frame_end = $frame_end .'</div>';      }
    4028                }
    4129        $csstheme = 'default';
    4230        $themeconf = $template->get_template_vars('themeconf');
    43                 $frame_width = $frame_width + ( 2* $lastbrdpx);                         
    44                 $frame_height = $frame_height + ( 2* $lastbrdpx);
    45                 $frame_size = 'style="border:0 ;width:'.$frame_width.'px; height:'.$frame_height.'px;"';
    46                 $themestyle = $themeconf['parent'];
     31        //  dedicated Css by parent theme       
     32                $themestyle = 'default';
     33                if (isset ($themeconf['parent']))
     34                { $themestyle = $themeconf['parent'];}
    4735                If ($themestyle == 'default')
    4836                   { $themestyle = $themeconf['id'];}
    49                 // print_r($themestyle);
    5037                 $template->append('llgbo', array(
    51                          'FRAME_SIZE' => $frame_size,
    52                          'FRAME_BEGIN' => $frame_begin,
    5338                          'FRAME_END' => $frame_end,
    5439                          'GBOCSS' => LLGBO_PATH."css/llgbo_content_".$themestyle.".css" ), true);
    5540
    56                          
    57         If (($conf['LLGBO_SETTINGS'] [5]  == 'true' )  /* title on frame */
    58         and ($conf['LLGBO_SETTINGS'] [0]  == 'true' ) )// frame
    59                  {  $template->append('llgbo', array(
    60                                  'TITLE_FRAME_COLOR' => $conf['LLGBO_FRAME'][0],
    61                                  'TITLE_FRAME' => $current['name'] ), true);
    62                         $template->assign('SHOW_PICTURE_NAME_ON_TITLE' , false);
    63        
    64                         }
    6541} // end frame
     42
    6643?>
  • extensions/LLGBO2/js/jquery_llgboframeresize.js

    r15076 r16754  
    11// LLGBO frame resize
    22jQuery(document).ready(function(jQuery){
    3         jQuery("#theMainImage").load(function(){LlgboFr_Resize();});   
    4         jQuery(window).resize(function(){ LlgboFr_Resize(); });
     3         jQuery("#theMainImage").load(function(){LlgboFr_Resize();});   
     4        jQuery(window).resize(function(){ LlgboFr_Resize(); }); 
    55});
    66var LlgboFr_Resize = function () {
    7         var MainImg = jQuery("img#theMainImage").get(0);       
    8         var nFrH = parseInt(MainImg.height);
    9         var nFrW = parseInt(MainImg.width);
    10         var FrLstBdr = 0, i = 0;
    11         var elGbo = jQuery("div#llgbo");
    12         if  (elGbo.get(0)) {
    13                 for ( i=1; i<32; i=i+2 )
    14                         {var Fr = jQuery("div#llgboframe"+(i));
    15                          var frbdr = 0;
    16                          if (Fr.get(0)) {
    17                                 frbdr = parseInt(Fr.css('border-left-width'));
    18                                 nFrH = nFrH + FrLstBdr ;
    19                                 nFrW = nFrW + FrLstBdr ;
    20                                 Fr.css("height", (nFrH) + "px");
    21                                 Fr.css("width", (nFrW) + "px");}
    22                                 FrLstBdr = (frbdr * 2);
    23                         }
    24                         elGbo.css("width", (nFrW + FrLstBdr) + "px");
    25                         elGbo.css("height", (nFrH + FrLstBdr) + "px");
     7        var elGbo = document.getElementById("llgbo0");
     8         if  (elGbo) {
     9            var MainImg = document.getElementById("theMainImage");
     10                var nFrH = parseInt(MainImg.height);
     11                var nFrW = parseInt(MainImg.width);
     12                var ReadImgSize = document.getElementById("LLGBO_READIMGREELSIZE");
     13                 if (ReadImgSize) {
     14                 // Must read via URL the physical size of the img
     15                         var x = document.createElement('img');
     16                         x.id = 'NewImgx';
     17                         document.getElementsByTagName('body')[0].appendChild(x);
     18                         x.style.top = '0';
     19                         x.style.visibility = 'hidden';
     20                         x.src =  MainImg.src;
     21                         nFrH = parseInt(x.height);
     22                         nFrW = parseInt(x.width);
     23                        document.getElementsByTagName('body')[0].removeChild(x);
    2624                }
     25       
     26                var FrLstBdr = 0, i = 0;
     27                        for ( i=1; i<32; i=i+2 )
     28                                {var Fr = document.getElementById("llgboframe"+(i));
     29                                 var frbdr = 0;
     30                                 if (Fr) {
     31                                        frbdr = parseInt(Fr.style.borderWidth);
     32                                        nFrH = nFrH + FrLstBdr ;
     33                                        nFrW = nFrW + FrLstBdr ;
     34                                        Fr.style.height = nFrH + "px";
     35                                        Fr.style.width = nFrW + "px";}
     36                                        FrLstBdr = (frbdr * 2); 
     37                                }
     38                                elGbo.style.width = (nFrW + FrLstBdr) + "px";
     39                                elGbo.style.height =(nFrH + FrLstBdr) + "px";
     40                }               
    2741}
  • extensions/LLGBO2/main.inc.php

    r16145 r16754  
    22/*
    33Plugin Name: Look_like_gbo2
    4 Version:  2.4.D
     4Version:  2.4.F
    55Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=251
    66Author: GBo
     
    1111        2.4.B beta 2 Compliance with Theme Stripped and plugin Piwishak 
    1212        2.4.C First version for official Piwigo 2.4
    13         2.4.D Compliance with Theme Simple
     13        2.4.D Compliance with Theme Simple + fix bug on option
     14        2.4.F Improvement on frame management first size
    1415 */
    1516if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    1617
    1718global $conf;
    18 define ('LLGBO_INFO_VERSION','2.4.D');
     19define ('LLGBO_INFO_VERSION','2.4.F');
    1920if (!defined('LLGBO_PATH'))
    2021{define('LLGBO_PATH' ,get_root_url().'plugins/'.basename(dirname(__FILE__)) . '/');}
     
    6869function  llgbo_EndPicture()
    6970{ global $template,$conf;
    70 $infofile = $template->get_template_vars('INFO_FILE');
    71 
     71$infofile = $template->get_template_vars('INFO_FILE');
     72$current = $template->get_template_vars('current');
     73$slideshow = $template->get_template_vars('U_SLIDESHOW');
     74//----------------------------------------------------   
     75/*       HTML End  frame   on Picture.tpl       */
     76//---------------------------------------------------- 
     77If (($conf['LLGBO_SETTINGS'] [0] == 'true') and (!isset($slideshow)) ) //Frame
     78        { $template->set_prefilter('picture', 'LLGBO_prefilter_Picture_Frame');
     79                If (isset($conf['LLGBO_SETTINGS'] ['rirs']))
     80                { // Force javascript LlgboFr_Resize  to Read MainImage Reel Size via URL
     81                  // Must be used when html image is already resize by HTML (IE or Chrome)
     82                If ($conf['LLGBO_SETTINGS'] ['rirs']  == 'true') // Forcce javascript to read Image reel size
     83                        {$template->append('llgbo', array('READIMGREELSIZE'  => "ok"), true); }
     84                        }
     85// selected picture Size                       
     86        $PictSizeWH  =  $current['selected_derivative']->get_size();   
     87        $frame_width  = $PictSizeWH[0];
     88                $frame_height = $PictSizeWH[1];
     89                $lastbrdpx = 0;
     90                $frame_begin ='';
     91                for ($x = 1   ;$x < 32  ; $x =$x +2)
     92                {       if ((isset($conf['LLGBO_FRAME'][$x+1])) and  ($conf['LLGBO_FRAME'][$x+1] > 0))  // boder value > 0     
     93                          { $bordpx= $conf['LLGBO_FRAME'][$x+1];
     94                                $frame_width = $frame_width + ( 2* $lastbrdpx);                         
     95                                $frame_height = $frame_height + ( 2* $lastbrdpx);
     96                            $bordcolor = $conf['LLGBO_FRAME'][$x];
     97                            $frame_begin = '<div   id="llgboframe'.$x.'" class="llgbo" style="border:'.$bordpx.'px solid '.$bordcolor.';width:'.$frame_width.'px; height:'.$frame_height.'px;">'."\n".$frame_begin;
     98                                $lastbrdpx = $bordpx;}
     99                }
     100                $frame_width = $frame_width + ( 2* $lastbrdpx);                         
     101                $frame_height = $frame_height + ( 2* $lastbrdpx);
     102                $frame_size = 'style="border:0 ;width:'.$frame_width.'px; height:'.$frame_height.'px;"';
     103                $template->append('llgbo', array(
     104                         'FRAME_SIZE' => $frame_size,
     105                         'FRAME_BEGIN' => $frame_begin), true);
     106        If (($conf['LLGBO_SETTINGS'] [5]  == 'true' )  /* title on frame */
     107        and ($conf['LLGBO_SETTINGS'] [0]  == 'true' ) )// frame
     108                 {  $template->append('llgbo', array(
     109                                 'TITLE_FRAME_COLOR' => $conf['LLGBO_FRAME'][0],
     110                                 'TITLE_FRAME' => $current['name'] ), true);
     111                        $template->assign('SHOW_PICTURE_NAME_ON_TITLE' , false);
     112                        }
     113        }
    72114// ---- Metadata ----------     
    73115$pictExt = substr($infofile,-3);
     
    119161// -----------  add CSS tooltip in footer --------------------
    120162//-----------------------------------------------------------------
    121  If ((($conf['LLGBO_SETTINGS'][1]  == 'true' ) /*  tooltip  */ 
     163 If (($conf['LLGBO_SETTINGS'][1]  == 'true' ) /*  tooltip  */ 
    122164 or  ($conf['LLGBO_SETTINGS'] [2]  == 'true' )  /* exif under bt */ )   
    123165        {       $template->append('footer_elements',$sweetcss);
     
    135177} //end --> llgbo_RenderContent
    136178
    137 function LLGBO_prefilter_Frame($content, &$smarty)
    138 {  global $themeconf;
    139 // ------------------------
    140 //  begin frame
    141  $search = '<img src="';
    142   $replacement = '{if isset($llgbo.TITLE_FRAME)}'."\n".'<span  id="llgboh2" style ="background:transparent;z-index:3;color:{$llgbo.TITLE_FRAME_COLOR}">{$llgbo.TITLE_FRAME}</span>';
    143   $replacement = $replacement."\n".'{/if}'."\n".'<div  id="llgbo" {$llgbo.FRAME_SIZE}>'."\n".'{$llgbo.FRAME_BEGIN}'."\n".$search;
    144   $content = str_replace($search, $replacement, $content);
    145 // ------------------------
    146   //  End frame 
     179function LLGBO_prefilter_Content_Frame($content, &$smarty)
     180{   //  End frame  picture_content TPL
     181  global $themeconf;
    147182  $search = '{foreach from=$current.unique_derivatives';
    148183  $replacement =  "\n".'{$llgbo.FRAME_END}'."\n"."</div> <!-- end GBO frame -->"."\n".$search;
     
    151186  $replacement =  $search."\n".'{$llgbo.FRAME_END}'."\n"."</div> <!-- end GBO frame -->";}
    152187  return str_replace($search, $replacement, $content);
     188}
     189
     190function LLGBO_prefilter_Picture_Frame($content, &$smarty)
     191{
     192// ------------------------
     193//  begin frame on picture TPL
     194 $search = '{$ELEMENT_CONTENT}';
     195 $replacement = '{if isset($llgbo.TITLE_FRAME)}'."\n".'<span  id="llgboh2" style ="background:transparent;z-index:3;color:{$llgbo.TITLE_FRAME_COLOR}">{$llgbo.TITLE_FRAME}</span>';
     196 $replacement = $replacement."\n".'{/if}'."\n".'<div   id="llgbo0" class="llgbo" {$llgbo.FRAME_SIZE}>'."\n".'{$llgbo.FRAME_BEGIN}'."\n".$search;
     197// ------------------------
     198  return  str_replace($search, $replacement, $content);
    153199}
    154200
  • extensions/LLGBO2/samples/cadre data.txt

    r4523 r16754  
    1111#9f7a09,#090909,3,#fafafa,1,#0b0b0b,4,#0c0c0c,4,#1f1f20,1,#29292b,1,#343435,1,#3f3f41,1,#4a4a4b,1,#555557,1,#616163,1,#6d6d6e,1,#79797a,1,#848485,1,#919192,1,#9d9d9e,1
    1212
     13White new
     14#16195f,#f4f4f4,4,#685008,1,#e0e0df,5,#d6d6d4,1,#cbcbca,1,#c0c0be,1,#b5b5b4,1,#aaaaa8,1,#9e9e9c,1,#929291,1,#868685,1,#7b7b7a,1,#6e6e6d,1,#626261,1,#555555,1,#4a4a4a,1
    1315
    1416tooltip default
  • extensions/LLGBO2/template/llgbo_content.tpl

    r15107 r16754  
    11<!-- LLGBO2 picture_content -->
    2 {if  isset($llgbo.TOOLTIPCSS)}   
    3                 {$llgbo.TOOLTIPCSS}
    4 {/if} 
    5 {if  isset($llgbo.GBOCSS)}     
    6         { if file_exists($llgbo.GBOCSS) }
    7                         {combine_css path=$llgbo.GBOCSS order=+10}
    8                 {else}
    9                   {combine_css path=$LLGBO_PATH|@cat:"css/llgbo_content_default.css" order=+10}
    10         {/if}
    11 {/if} 
    12 {if  !isset($llgbo.NOJS)}
    13                 {if  isset($llgbo.TOOLTIP)}       
    14                         {combine_script id='llgbojqtooltip' load='footer' require='jquery'  path=$LLGBO_PATH|@cat:"js/jquery_llgbotip.js"}
    15                  {/if}
    16                  {if  isset($llgbo.FRAME_BEGIN)}       
    17                         {combine_script id='llgbojqframe' load='footer' require='jquery'  path=$LLGBO_PATH|@cat:"js/jquery_llgboframeresize.js" }
    18                 {/if}
     2 {if !isset($U_SLIDESHOW)}
     3        {if  isset($llgbo.TOOLTIPCSS)}   
     4                        {$llgbo.TOOLTIPCSS}
     5        {/if} 
     6        {if  isset($llgbo.GBOCSS)}     
     7                { if file_exists($llgbo.GBOCSS) }
     8                                {combine_css path=$llgbo.GBOCSS order=+10}
     9                        {else}
     10                          {combine_css path=$LLGBO_PATH|@cat:"css/llgbo_content_default.css" order=+10}
     11                {/if}
     12        {/if} 
     13        {if  !isset($llgbo.NOJS)}
     14                        {if  isset($llgbo.TOOLTIP)}       
     15                                {combine_script id='llgbojqtooltip' load='footer' require='jquery'  path=$LLGBO_PATH|@cat:"js/jquery_llgbotip.js"}
     16                         {/if}
     17                         {if  isset($llgbo.FRAME_BEGIN)}       
     18                                {combine_script id='llgbojqframe' load='footer' require='jquery'  path=$LLGBO_PATH|@cat:"js/jquery_llgboframeresize.js" }
     19                        {/if}
     20        {/if}
     21
     22        {if  isset($llgbo.READIMGREELSIZE)}     
     23        <div id="LLGBO_READIMGREELSIZE" style="visibility:hidden;top:0;"> <!--  if exists Force javascript LlgboFr_Resize  to Read MainImage Reel Size via URL" --></div>
     24        {/if}
    1925{/if}
    2026
Note: See TracChangeset for help on using the changeset viewer.