Changeset 9784 for extensions


Ignore:
Timestamp:
Mar 20, 2011, 12:58:38 PM (13 years ago)
Author:
mistic100
Message:

[extensions] Front2Back

  • new admin page
  • some changes in config
Location:
extensions/Front2Back
Files:
5 added
4 edited
4 moved

Legend:

Unmodified
Added
Removed
  • extensions/Front2Back/Front2Back.php

    r9782 r9784  
    55{
    66        global $template, $conf;
    7        
    8         /* Default values */
    9         if (!isset($conf['Front2Back_dir'])) $conf['Front2Back_dir'] = 'verso/';
    10         if (!isset($conf['Front2Back_parent'])) $conf['Front2Back_parent'] = 'thumbnail/';
    11         if (!isset($conf['Front2Back_hd_parent'])) $conf['Front2Back_hd_parent'] = 'pwg_high/';
    12         if (!isset($conf['Front2Back_path']))
    13                 $conf['Front2Back_inside']= true;
    14         else
    15                 $conf['Front2Back_inside']= false;
     7        $conf['Front2Back'] = explode(',', $conf['Front2Back']);
     8        load_language('plugin.lang', F2B_PATH);
    169
    1710        /* dirs and files */
    18         if ( $conf['Front2Back_inside'] ) {
    19                 $verso_dir = str_replace($image['file'], null, $image['path']) . $conf['Front2Back_parent'] . $conf['Front2Back_dir'];
    20                 $hd_dir = str_replace($image['file'], null, $image['path']) . $conf['Front2Back_hd_parent'] . $conf['Front2Back_dir'];
     11        if (empty($conf['Front2Back'][0])) {
     12                $verso_dir = str_replace($image['file'], null, $image['path']) . $conf['Front2Back'][1];
     13                $hd_dir = str_replace($image['file'], null, $image['path']) . $conf['Front2Back'][2];
    2114        } else {
    22                 $verso_dir = $conf['Front2Back_path'] . $conf['Front2Back_parent'] . $conf['Front2Back_dir'];
    23                 $hd_dir = $conf['Front2Back_path'] . $conf['Front2Back_hd_parent'] . $conf['Front2Back_dir'];
     15                $verso_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][1];
     16                $hd_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][2];
    2417        }
    25         $rotat_file = substr($image['file'],0,-4).'-r'.substr($image['file'],-4);
     18        $verso_file = get_filename_wo_extension($image['file']) . $conf['Front2Back'][3] . '.' . get_extension($image['file']);
     19        $rotat_file = get_filename_wo_extension($image['file']) . '-r.' . get_extension($image['file']);
    2620
    27         $template->set_filenames(array('Front2Back' => dirname(__FILE__) . '/Front2Back.tpl') );
     21        $template->set_filenames(array('Front2Back' => dirname(__FILE__) . '/template/Front2Back.tpl') );
    2822        $template->assign('F2B_PATH', F2B_PATH);
    2923
    3024        /* Is there a verso file ? */
    31         if (is_file($verso_dir.$image['file']))
     25        if (is_file($verso_dir.$verso_file))
    3226        {
    33                 $template->assign('VERSO_URL', $verso_dir.$image['file']);
     27                $template->assign('VERSO_URL', $verso_dir.$verso_file);
    3428
    35                 if (is_file($hd_dir.$image['file'])) {
    36                         $template->assign('VERSO_HD', $hd_dir.$image['file']);
     29                if (is_file($hd_dir.$verso_file)) {
     30                        $template->assign('VERSO_HD', $hd_dir.$verso_file);
    3731                }
    3832        }
  • extensions/Front2Back/language/en_UK/plugin.lang.php

    r9782 r9784  
    44$lang['Front2Back_front'] = 'See front';
    55
     6$lang['f2b_path'] = "Back sides' folder";
     7$lang['f2b_parent'] = "Web sized pics' sub-folder";
     8$lang['f2b_hd_parent'] = "HD pics' sub-folder";
     9$lang['f2b_suffix'] = "Suffix";
     10
     11$lang['f2b_help'] = "
     12<fieldset>
     13        <legend>Usage examples</legend>
     14        <fieldset>
     15                If you put the web sized back side in <i>thumbnail/back/</i> subfolder of your normal image directory and the high-definition back side in the subfolder <i>pwg_high/back/</i>, use the basic configuration:<ul>
     16                        <li><b>Back sides' folder:</b> <i>empty</i>
     17                        <li><b>Web sized pics' sub-folder:</b> thumbnail/verso/</li>
     18                        <li><b>HD pics' sub-folder:</b> pwg_high/verso/</li>
     19                </ul>
     20        </fieldset>
     21       
     22        <fieldset>
     23                If you prefer to put your backs into a different folder, change the value of the first parameter (relative to the root of the site). Keep in mind that in this case the tree of your gallery is not reproduced, and two images with the same name in two different albums will load the same back side.
     24                <br>For example you can use this setup to search the web sided backs in <i>[ROOT]/verso/</i> and HD backs in <i>[ROOT]/verso/hd/</i>
     25                <ul>
     26                        <li><b>Back sides' folder:</b> verso/
     27                        <li><b>Web sized pics' sub-folder:</b> <i>empty</i></li>
     28                        <li><b>HD pics' sub-folder:</b> hd/</li>
     29                </ul>
     30        </fieldset>
     31       
     32        <fieldset>
     33                Anyway the back side pic may have the same name as the normal pic, in this case let <b>Suffix</b> empty, or a name with suffix.
     34        </fieldset>
     35</fieldset>
     36";
     37
    638?>
  • extensions/Front2Back/language/fr_FR/plugin.lang.php

    r9782 r9784  
    44$lang['Front2Back_front'] = 'Voir le devant';
    55
     6$lang['f2b_path'] = "Dossier des versos";
     7$lang['f2b_parent'] = "Sous-dossier des images web";
     8$lang['f2b_hd_parent'] = "Sous-dossier des images HD";
     9$lang['f2b_suffix'] = "Suffixe de détection";
     10
     11$lang['f2b_help'] = "
     12<fieldset>
     13        <legend>Exemples d'utilisation</legend>
     14        <fieldset>
     15                Si vous placez le verso taille web dans le sous-dossier <i>thumbnail/verso/</i> du dossier de votre image normale et le verso haute-définition dans le sous-dossier <i>pwg_high/verso/</i>, utilisez la configuration de base :
     16                <ul>
     17                        <li><b>Dossier des versos :</b> <i>vide</i>
     18                        <li><b>Sous-dossier des images web :</b> thumbnail/verso/</li>
     19                        <li><b>Sous-dossier des images HD :</b> pwg_high/verso/</li>
     20                </ul>
     21        </fieldset>
     22       
     23        <fieldset>
     24                Si vous préferez placer vos versos dans un tout autre dossier changez la valeur du premier paramètre (relatif à la racine du site). Gardez à l'esprit que dans ce cas l'arborescence de votre galerie n'est pas reproduite, et deux images qui ont le même nom dans deux albums différents chargeront le même verso.
     25                <br>Par exemple vous pouvez utiliser cette configuration pour chercher les versos web dans <i>[RACINE]/verso/</i> et les versos HD dans <i>[RACINE]/verso/hd/</i>
     26                <ul>
     27                        <li><b>Dossier des versos :</b> verso/
     28                        <li><b>Sous-dossier des images web :</b> <i>vide</i></li>
     29                        <li><b>Sous-dossier des images HD :</b> hd/</li>
     30                </ul>
     31        </fieldset>
     32       
     33        <fieldset>
     34                Dans tous les cas les versos peuvent avoir le même nom que les images normale, dans ce cas laisser <b>Suffixe de détection</b> vide, ou un nom avec suffixe.
     35        </fieldset>
     36</fieldset>
     37";
     38
    639?>
  • extensions/Front2Back/main.inc.php

    r9782 r9784  
    22/*
    33Plugin Name: Front2Back
    4 Version: 2.2.0
     4Version: 2.2.a
    55Description: Add a link on picture's page to show a alternative version of the pic (for postcards for example)
    66Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=183
     
    1313define('F2B_PATH', PHPWG_PLUGINS_PATH . F2B_DIR . '/');
    1414
    15 load_language('plugin.lang', F2B_PATH);
    1615include_once(F2B_PATH . 'Front2Back.php');
    1716add_event_handler('render_element_content', 'Front2Back_content', 99, 2);
    1817       
     18if (script_basename() == 'admin')
     19{
     20        add_event_handler('get_admin_plugin_menu_links', 'Front2Back_admin_menu');
     21        function Front2Back_admin_menu($menu)
     22        {
     23                array_push($menu, array(
     24                        'NAME' => 'Front2Back',
     25                        'URL' => get_root_url().'admin.php?page=plugin-' . F2B_DIR));
     26                return $menu;
     27        }
     28}
     29
    1930?>
  • extensions/Front2Back/template/Front2Back.tpl

    r9782 r9784  
    11{combine_script id="jquery"}
    2 {combine_css path=$F2B_PATH|@cat:"Front2Back.css"}
     2{combine_css path=$F2B_PATH|@cat:"template/Front2Back.css"}
    33
    44{footer_script require="jquery"}
     
    1919                       
    2020                        /* f2b link content */
    21                         jQuery(this).html('<img src="{$F2B_PATH}rotate_2.png"/> {'Front2Back_front'|@translate}');
     21                        jQuery(this).html('<img src="{$F2B_PATH}template/rotate_2.png"/> {'Front2Back_front'|@translate}');
    2222                        jQuery(this).attr('name', 'back');
    2323                       
     
    3434                        {/if}
    3535                       
    36                         jQuery(this).html('<img src="{$F2B_PATH}rotate_1.png"/> {'Front2Back_back'|@translate}');
     36                        jQuery(this).html('<img src="{$F2B_PATH}template/rotate_1.png"/> {'Front2Back_back'|@translate}');
    3737                        jQuery(this).attr('name', 'front');
    3838                }
     
    4141
    4242<a class="reverse" name="front">
    43         <img src="{$F2B_PATH}rotate_1.png"/>
     43        <img src="{$F2B_PATH}template/rotate_1.png"/>
    4444        {'Front2Back_back'|@translate}
    4545</a>
Note: See TracChangeset for help on using the changeset viewer.