Changeset 19460 for extensions/Panoramas


Ignore:
Timestamp:
Dec 16, 2012, 8:19:28 PM (11 years ago)
Author:
Klarsfeld
Message:

Upgrade for Piwigo 2.4.5
Only languages en-UK and fr-FR upgraded

Location:
extensions/Panoramas
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/Panoramas/AS_Panorama.php

    r6533 r19460  
    1212                  global $conf, $template, $page;
    1313                  $asp = & $conf['AS_panorama'];
    14                   if ( !stristr($image['name'], $asp['in_mode_360'])
    15                    and !stristr($image['name'], $asp['in_mode_180']) ) return $content;
    16                   if (!isset($image['image_url'])) return $content;
    17                   if ( isset($page['slideshow']) and $page['slideshow'] ) return $content;
    18                   if (isset($image['width']) and $image['width'] < $asp['min_viewport_width']) return $content;
    19                   $asp['image_name'] = $image['name'];
    20                   $asp['width'] = $image['width'];
    21                   $asp['height'] = $image['height'];
    22                   if (stristr($image['name'], $asp['in_mode_180'])) {
    23                         $asp['mode_360'] = 'false';
    24                         $asp['name'] = str_replace($asp['in_mode_180'],'', $image['name']);
    25                   }
    26                   else  {
    27                         $asp['name'] = str_replace($asp['in_mode_360'],'', $image['name']);
    28                   }
    29                   $template->set_filenames(
    30                         array('AS_panorama_content' => dirname(__FILE__) . '/template/AS_panorama_content.tpl') );
    31                   $asp['Path'] = embellish_url($template->get_template_vars('ROOT_URL').ASP_PATH);
    32                   $asp['content'] = $content;
    33                   $template->assign( array( 'ASP' => $asp, ) );
    34                   return $template->parse('AS_panorama_content', true);
    35                 }
    36   }
     14        //echo "<pre>"; print_r($template); echo "</pre>"; exit;
     15       
     16        if (isset($template->files['slideshow'])) return $content;
     17        if ( !stristr($image['name'], $asp['in_mode_360']) and !stristr($image['name'], $asp['in_mode_180']) ) return $content;
     18        if (!isset($image['path'])) return $content;
     19        if ( isset($page['slideshow']) and $page['slideshow'] ) return $content;
     20        if (isset($image['width']) and $image['width'] < $asp['min_viewport_width']) return $content;
     21
     22        $divtag = "<img src=\"";
     23        $divtag.= str_replace( "./", "", $image['path'])."\" width=\"".$image['width']."\" ";
     24        $divtag.= "height=\"".$image['height']."\" ";
     25        $divtag.= "alt=\"".$image['file']."\" id=\"theMainImage\" ";
     26       
     27        if ($image['height'] > $asp['viewport_height']) {
     28                $ratio = $image['width'] / $image['height'];
     29                $image['height'] = $asp['viewport_height'];
     30                $image['width'] = $asp['viewport_height'] * $ratio;
     31        }
     32
     33        $asp['image_name'] = $image['name'];
     34        $asp['width'] = $image['width'];
     35        $asp['height'] = $image['height'];
     36        if (stristr($image['name'], $asp['in_mode_180'])) {
     37                $asp['mode_360'] = 'false';
     38                $asp['name'] = str_replace($asp['in_mode_180'],'', $image['name']);
     39        }
     40        else  {
     41                $asp['name'] = str_replace($asp['in_mode_360'],'', $image['name']);
     42        }
     43       
     44        $template->set_filenames(
     45        array('AS_panorama_content' => dirname(__FILE__) . '/template/AS_panorama_content.tpl') );
     46        $asp['Path'] = embellish_url($template->get_template_vars('ROOT_URL').ASP_PATH);
     47        $asp['content'] = $divtag;
     48        $template->assign( array( 'ASP' => $asp, ) );
     49        return $template->parse('AS_panorama_content', true);
     50}
     51}
    3752}
    3853
    3954if ( !function_exists( 'AS_panorama_title' ) ) {
    40   if ( $conf['AS_panorama']['In_name_display_removal'] ) {
    41     add_event_handler('loc_end_picture', 'AS_panorama_title');
    42     function AS_panorama_title()
    43     {
    44       global $conf, $template;
    45       $asp = & $conf['AS_panorama'];
    46       $picture = $template->get_template_vars('current');
    47           if ( isset($asp['name']) ) {
    48                   $picture['TITLE'] = $asp['name'];
    49                   $template->assign('current', $picture);
    50                   $template->assign( array( 'ASP' => $asp, ) );
    51           }
    52     }
    53   }
     55        if ( $conf['AS_panorama']['In_name_display_removal'] ) {
     56                add_event_handler('loc_end_picture', 'AS_panorama_title');
     57                function AS_panorama_title()
     58                {
     59                        global $conf, $template;
     60                        $asp = & $conf['AS_panorama'];
     61                        $picture = $template->get_template_vars('current');
     62                        if ( isset($asp['name']) ) {
     63                        $picture['TITLE'] = $asp['name'];
     64                        $template->assign('current', $picture);
     65                        $template->assign( array( 'ASP' => $asp, ) );
     66                        }
     67                }
     68        }
    5469}
    5570
     
    5772        if ( defined('IN_ADMIN') and IN_ADMIN ) {
    5873                add_event_handler('get_admin_plugin_menu_links', 'AS_panorama_menu');
    59     function AS_panorama_menu($menu)
    60     {
    61         array_push($menu,
    62             array(
    63                 'NAME' => 'Panoramas',
    64                 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/AS_Panorama_admin.php')
    65             )
    66         );
    67         return $menu;
    68     }
    69   }
     74                function AS_panorama_menu($menu)
     75                {
     76                        array_push($menu,
     77                                array(
     78                                        'NAME' => 'Panoramas',
     79                                        'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/AS_Panorama_admin.php')
     80                                        )
     81                        );
     82                return $menu;
     83                }
     84        }
    7085}
    7186?>
  • extensions/Panoramas/AS_Panorama_admin.php

    r6533 r19460  
    1919  $nsp = array_merge($asp, $_POST);
    2020        if ( $nsp['viewport_width']=='' or !is_numeric($nsp['viewport_width']) or $nsp['viewport_width'] < 50 or $nsp['viewport_width'] > 100 )
    21     array_push($errors, l10n('Viewport width ratio is out of range (Correct range: 50-100).'));
     21    array_push($errors, l10n('Viewport width ratio is out of range (Correct range: 50-100).'));
     22        if ( $nsp['viewport_height']=='' or !is_numeric($nsp['viewport_height']) or $nsp['viewport_height'] < 500 or $nsp['viewport_height'] > 800 )
     23    array_push($errors, l10n('Viewport height is out of range (Correct range: 500/+).'));
    2224        if ( $nsp['min_viewport_width']=='' or !is_numeric($nsp['min_viewport_width']) or $nsp['min_viewport_width'] < 320 )
    2325    array_push($errors, l10n('Minimal Viewport width is out of range (Correct range: 320/+).'));
  • extensions/Panoramas/AS_Panorama_default.php

    r6530 r19460  
    22  $default = array(
    33        'viewport_width' => 100,
     4        'viewport_height' => 500,
    45        'min_viewport_width' => 720,
    56        'max_viewport_width' => 1500,
  • extensions/Panoramas/language/fr_FR/plugin.lang.php

    r6533 r19460  
    2727$lang['Viewport maximal width [pixels >= minimal width]'] = 'Largeur maximale de la partie visible [pixels >= largeur minimale]';
    2828$lang['Viewport minimal width [pixels > 320]'] = 'Largeur minimale de la partie visible [pixels > 320]';
     29$lang['Viewport height [pixels > 500]'] = 'Hauteur de la partie visible [pixels > 300]';
    2930$lang['Viewport width [% between 50-100]'] = 'Largeur relative de la partie visible [% between 50-100]';
    3031$lang['Viewport width ratio is out of range (Correct range: 50-100).'] = 'La largeur relative de la partie visible est incorrecte (Valeurs acceptables: 50-100).';
  • extensions/Panoramas/main.inc.php

    r7478 r19460  
    11<?php /*
    22Plugin Name: Panoramas
    3 Version: auto
     3Version: 2.4.5
    44Description: A simple panorama viewer based on jQuery
    5 Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=207
     5Plugin URI: http://piwigo.org/ext/extension_view.php?eid=207
    66Author: Piwigo team & OpenStudio
    77Author URI: http://www.vdigital.org
     
    1717
    1818History
     19  2012-12-15 2.4.5
     20                         New: Add Viewport height parameter
     21                         Upgrade for Piwigo 2.4.5
    1922  2010-05-27 2.1.a
    2023                         New: jQuery function replacement
  • extensions/Panoramas/template/AS_Panorama_admin.tpl

    r7840 r19460  
    1515  <legend>{'Panoramas configuration'|@translate}</legend>
    1616  <table id="table">
     17     <tr>
     18    <td class="label">{'Viewport height [pixels > 500]'|@translate}</td>
     19    <td><input type="text" class="field" name="viewport_height" value="{$ASP.viewport_height}" size="20" maxlength="3"/></td>
     20   </tr>
     21
    1722   <tr>
    1823    <td class="label">{'Viewport width [% between 50-100]'|@translate}</td>
Note: See TracChangeset for help on using the changeset viewer.