Changeset 11217


Ignore:
Timestamp:
Jun 3, 2011, 1:57:17 PM (13 years ago)
Author:
mistic100
Message:

clean code, add some options

Location:
extensions/Front2Back
Files:
1 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • extensions/Front2Back/Front2Back.php

    r9784 r11217  
    44function Front2Back_content($content, $image)
    55{
    6         global $template, $conf;
    7         $conf['Front2Back'] = explode(',', $conf['Front2Back']);
    8         load_language('plugin.lang', F2B_PATH);
     6  global $template, $conf, $user;
     7  $conf['Front2Back'] = explode(',', $conf['Front2Back']);
     8  load_language('plugin.lang', F2B_PATH);
    99
    10         /* dirs and files */
    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];
    14         } else {
    15                 $verso_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][1];
    16                 $hd_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][2];
    17         }
    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']);
     10  /* dirs and files */
     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];
     14  } else {
     15    $verso_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][1];
     16    $hd_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][2];
     17  }
     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']);
    2020
    21         $template->set_filenames(array('Front2Back' => dirname(__FILE__) . '/template/Front2Back.tpl') );
    22         $template->assign('F2B_PATH', F2B_PATH);
     21  /* Is there a verso file ? */
     22  if (is_file($verso_dir.$verso_file))
     23  {
     24    $template->assign('VERSO_URL', $verso_dir.$verso_file);
    2325
    24         /* Is there a verso file ? */
    25         if (is_file($verso_dir.$verso_file))
    26         {
    27                 $template->assign('VERSO_URL', $verso_dir.$verso_file);
     26    if (is_file($hd_dir.$verso_file)) {
     27      $template->assign('VERSO_HD', $hd_dir.$verso_file);
     28    }
     29  }
     30  /* useless section, just for retrocompatibility */
     31  else if (is_file($verso_dir.$rotat_file))
     32  {           
     33    $template->assign('VERSO_URL', $verso_dir.$rotat_file);
     34   
     35    if (is_file($hd_dir.$rotat_file)) {
     36      $template->assign('VERSO_HD', $hd_dir.$rotat_file);
     37    }
     38  }
     39  /* otherwise */
     40  else
     41  {
     42    return $content;
     43  }
     44 
     45  /* link name */
     46  $conf['Front2Back'][7] = unserialize($conf['Front2Back'][7]);
     47  if (!empty($conf['Front2Back'][7][$user['language']]))
     48  {
     49    $conf['Front2Back'][7] = explode('|', $conf['Front2Back'][7][$user['language']]);
     50  }
     51  else if (!empty($conf['Front2Back'][7]['default']))
     52  {
     53    $conf['Front2Back'][7] = explode('|', $conf['Front2Back'][7]['default']);
     54  }
     55  else
     56  {
     57    $conf['Front2Back'][7] = array(l10n('See back'), l10n('See front'));
     58  }
     59 
     60  $template->set_filenames(array('Front2Back' => dirname(__FILE__) . '/template/Front2Back.tpl') );
     61  $template->assign(array(
     62    'F2B_PATH' => F2B_PATH,
     63    'F2B_position' => $conf['Front2Back'][4],
     64    'F2B_switch_mode' => $conf['Front2Back'][5],
     65    'F2B_transition' => $conf['Front2Back'][6],
     66    'F2B_see_back' => $conf['Front2Back'][7][0],
     67    'F2B_see_front' => $conf['Front2Back'][7][1],
     68  ));
     69 
     70  switch ($conf['Front2Back'][4])
     71  {
     72    case 'toolbar':
     73      $template->set_prefilter('picture', 'Front2Back_toolbar_prefilter');
     74      return $content; 
     75      break;
     76    case 'top':
     77      return $template->parse('Front2Back', true)."\n".$content;
     78      break;
     79    case 'bottom':
     80      return $content."\n".$template->parse('Front2Back', true);
     81      break;
     82  }
    2883
    29                 if (is_file($hd_dir.$verso_file)) {
    30                         $template->assign('VERSO_HD', $hd_dir.$verso_file);
    31                 }
    32         }
    33         /* useless section, just for retrocompatibility */
    34         else if (is_file($verso_dir.$rotat_file))
    35         {           
    36                 $template->assign('VERSO_URL', $verso_dir.$rotat_file);
    37                
    38                 if (is_file($hd_dir.$rotat_file)) {
    39                         $template->assign('VERSO_HD', $hd_dir.$rotat_file);
    40                 }
    41         }
    42         /* otherwise */
    43         else
    44         {
    45                 return $content;
    46         }
    47        
    48         return $content . $template->parse('Front2Back', true);   
    4984
    5085
     86function Front2Back_toolbar_prefilter($content, &$smarty)
     87{
     88  $search = '{/if}{/strip}{*caddie management END*}';
     89  $replacement = $search."\n".file_get_contents(F2B_PATH.'template/Front2Back.tpl');
     90  return str_replace($search, $replacement, $content);
     91}
     92
    5193?>
  • extensions/Front2Back/admin.php

    r9784 r11217  
    99if (isset($_POST['submit']))
    1010{
    11         $conf['Front2Back'] = array(
    12                 !empty($_POST['path']) ? rtrim($_POST['path'],'/').'/' : '',
    13                 !empty($_POST['parent']) ? rtrim($_POST['parent'],'/').'/' : '',
    14                 !empty($_POST['hd_parent']) ? rtrim($_POST['hd_parent'],'/').'/' : '',
    15                 !empty($_POST['suffix']) ? $_POST['suffix'] : '',
    16         );
    17                        
    18     $query = 'UPDATE ' . CONFIG_TABLE . '
    19                 SET value="' . implode (',', $conf['Front2Back']) . '"
    20                 WHERE param="Front2Back"';
    21     pwg_query($query);
    22        
    23         array_push($page['infos'], l10n('Information data registered in database'));
     11  $conf['Front2Back'] = array(
     12    !empty($_POST['path']) ? rtrim($_POST['path'],'/').'/' : '',
     13    !empty($_POST['parent']) ? rtrim($_POST['parent'],'/').'/' : '',
     14    !empty($_POST['hd_parent']) ? rtrim($_POST['hd_parent'],'/').'/' : '',
     15    !empty($_POST['suffix']) ? $_POST['suffix'] : '',
     16    $_POST['position'],
     17    $_POST['switch_mode'],
     18    $_POST['transition'],
     19    serialize(str_replace(array('"',','), ' ', $_POST['link_name'])),
     20  );
     21     
     22  conf_update_param('Front2Back', implode (',', $conf['Front2Back']));
     23  array_push($page['infos'], l10n('Information data registered in database'));
     24}
     25
     26// Gestion des langues pour le bloc menu
     27$conf['Front2Back'][7] = unserialize($conf['Front2Back'][7]);
     28$template->append('link_name', array(
     29  'LANGUAGE_NAME' => l10n('Default'),
     30  'LANGUAGE_CODE' => 'default',
     31  'VALUE' => @$conf['Front2Back'][7]['default'],
     32  )
     33);
     34foreach (get_languages() as $language_code => $language_name)
     35{
     36        $template->append('link_name', array(
     37    'LANGUAGE_NAME' => $language_name,
     38    'LANGUAGE_CODE' => $language_code,
     39    'VALUE' => isset($conf['Front2Back'][7][$language_code]) ? $conf['Front2Back'][7][$language_code] : '',
     40    )
     41  );
    2442}
    2543
    2644$template->assign(array(
    27         'PATH' => $conf['Front2Back'][0],
    28         'PARENT' => $conf['Front2Back'][1],
    29         'HD_PARENT' => $conf['Front2Back'][2],
    30         'SUFFIX' => $conf['Front2Back'][3],
     45  'F2B_PATH' => F2B_PATH,
     46  'PATH' => $conf['Front2Back'][0],
     47  'PARENT' => $conf['Front2Back'][1],
     48  'HD_PARENT' => $conf['Front2Back'][2],
     49  'SUFFIX' => $conf['Front2Back'][3],
     50  'POSITION' => $conf['Front2Back'][4],
     51  'SWITCH_MODE' => $conf['Front2Back'][5],
     52  'TRANSITION' => $conf['Front2Back'][6],
    3153));
    32        
     54 
    3355$template->set_filename('Front2Back_conf', dirname(__FILE__).'/template/admin.tpl');
    3456$template->assign_var_from_handle('ADMIN_CONTENT', 'Front2Back_conf');
  • extensions/Front2Back/language/en_UK/plugin.lang.php

    r9784 r11217  
    11<?php
    22
    3 $lang['Front2Back_back'] = 'See back';
    4 $lang['Front2Back_front'] = 'See front';
     3$lang['See back'] = 'See back';
     4$lang['See 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";
     6$lang['Back sides folder'] = 'Back sides folder';
     7$lang['Web sized pics sub-folder'] = 'Web sized pics sub-folder';
     8$lang['HD pics sub-folder'] = 'HD pics sub-folder';
     9$lang['Suffix'] = 'Suffix';
     10
     11$lang['Switch mode'] = 'Switch mode';
     12$lang['Click'] = 'Click';
     13$lang['Mouseover'] = 'Mouseover';
     14$lang['Transition'] = 'Transition';
     15$lang['Fade'] = 'Fade';
     16$lang['Link position'] = 'Link position';
     17$lang['Top'] = 'Top';
     18$lang['Bottom'] = 'Bottom';
     19$lang['Toolbar'] = 'Toolbar';
     20$lang['Link name'] = 'Link name';
     21
     22$lang['Seperate the two labels with the | symbol. Leave blank to use default translation.'] = 'Seperate the two labels with the | symbol. Leave blank to use default translation.';
    1023
    1124$lang['f2b_help'] = "
    1225<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>
     26  <legend>Usage examples</legend>
     27  <fieldset>
     28    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:
     29    <ul>
     30      <li><b>Back sides' folder:</b> <i>empty</i>
     31      <li><b>Web sized pics' sub-folder:</b> thumbnail/verso/</li>
     32      <li><b>HD pics' sub-folder:</b> pwg_high/verso/</li>
     33    </ul>
     34  </fieldset>
     35 
     36  <fieldset>
     37    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.
     38    <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>
     39    <ul>
     40      <li><b>Back sides' folder:</b> verso/
     41      <li><b>Web sized pics' sub-folder:</b> <i>empty</i></li>
     42      <li><b>HD pics' sub-folder:</b> hd/</li>
     43    </ul>
     44  </fieldset>
     45 
     46  <fieldset>
     47    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.
     48  </fieldset>
    3549</fieldset>
    3650";
  • extensions/Front2Back/language/fr_FR/plugin.lang.php

    r9784 r11217  
    11<?php
    22
    3 $lang['Front2Back_back'] = 'Voir le dos';
    4 $lang['Front2Back_front'] = 'Voir le devant';
     3$lang['See back'] = 'Voir le dos';
     4$lang['See 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";
     6$lang['Back sides folder'] = 'Dossier des versos';
     7$lang['Web sized pics sub-folder'] = 'Sous-dossier des images web';
     8$lang['HD pics sub-folder'] = 'Sous-dossier des images HD';
     9$lang['Suffix'] = 'Suffixe de détection';
     10
     11$lang['Switch mode'] = 'Interchanger les images au';
     12$lang['Click'] = 'Clic';
     13$lang['Mouseover'] = 'Survol';
     14$lang['Transition'] = 'Transition';
     15$lang['Fade'] = 'Fondu';
     16$lang['Link position'] = 'Position du lien';
     17$lang['Top'] = 'Haut';
     18$lang['Bottom'] = 'Bas';
     19$lang['Toolbar'] = 'Barre d\'outils';
     20$lang['Link name'] = 'Nom du lien';
     21
     22$lang['Seperate the two labels with the | symbol. Leave blank to use default translation.'] = 'Séparez les deux textes par le symbole |. Laissez vide pour utiliser la traduction par défaut.';
    1023
    1124$lang['f2b_help'] = "
    1225<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>
     26  <legend>Exemples d'utilisation</legend>
     27  <fieldset>
     28    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 :
     29    <ul>
     30      <li><b>Dossier des versos :</b> <i>vide</i>
     31      <li><b>Sous-dossier des images web :</b> thumbnail/verso/</li>
     32      <li><b>Sous-dossier des images HD :</b> pwg_high/verso/</li>
     33    </ul>
     34  </fieldset>
     35 
     36  <fieldset>
     37    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.
     38    <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>
     39    <ul>
     40      <li><b>Dossier des versos :</b> verso/
     41      <li><b>Sous-dossier des images web :</b> <i>vide</i></li>
     42      <li><b>Sous-dossier des images HD :</b> hd/</li>
     43    </ul>
     44  </fieldset>
     45 
     46  <fieldset>
     47    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.
     48  </fieldset>
    3649</fieldset>
    3750";
  • extensions/Front2Back/language/it_IT/plugin.lang.php

    r10623 r11217  
    11<?php
    22
    3 $lang['Front2Back_back'] = 'Vedere il retro';
    4 $lang['Front2Back_front'] = 'Vedere il fronte';
     3$lang['See back'] = 'Vedere il retro';
     4$lang['See front'] = 'Vedere il fronte';
    55
    6 $lang['f2b_path'] = 'Album per le foto "retro"';
    7 $lang['f2b_parent'] = 'Sub-album per le foto taglia Web';
    8 $lang['f2b_hd_parent'] = 'Sub-album per le foto HD';
    9 $lang['f2b_suffix'] = 'Prefisso per individuare';
     6$lang['Back sides folder'] = 'Album per le foto "retro"';
     7$lang['Web sized pics sub-folder'] = 'Sub-album per le foto taglia Web';
     8$lang['HD pics sub-folder'] = 'Sub-album per le foto HD';
     9$lang['Suffix'] = 'Prefisso per individuare';
    1010
    1111$lang['f2b_help'] = '
    1212<fieldset>
    13         <legend>Esempi d\'uso</legend>
    14         <fieldset>
    15                 Se piazzate le foto "retro" con dimenzioni per il web nel sub-album <i>thumbnail/retro/</i> del album della vostra foto normale ("fronte") e la "retro" HD nel sub-album <i>pwg_high/retro/</i>, usare la configurazione di base :
    16                 <ul>
    17                         <li><b>Album delle foto "retro" :</b> <i>vuoto</i>
    18                         <li><b>Sub-album delle foto web :</b> thumbnail/retro/</li>
    19                         <li><b>Sub-album delle foto HD :</b> pwg_high/retro/</li>
    20                 </ul>
    21         </fieldset>
    22        
    23         <fieldset>
    24                 Se preferite piazzare le foto "retro" in un\'altra directory, cambiate il valore del promo paramero (relativo alla radice del sito). Mantenete in mente che in questo caso l\'arborescenza della vostra galleria non viene riprodotta, e che due foto che hanno lo stesso nome in due diversi album caricheranno la stessa foto "retro".
    25                 <br>Per esempio potete usare questa configurazione per cercare le foto "retro" web in <i>[RADICE]/retro/</i> e le foto "retro" HD in <i>[RADICE]/retro/hd/</i>
    26                 <ul>
    27                         <li><b>Album delle foto "retro" :</b> retro/
    28                         <li><b>Sub-album delle foto web :</b> <i>vuoto</i></li>
    29                         <li><b>Sub-album delle foto HD :</b> hd/</li>
    30                 </ul>
    31         </fieldset>
    32        
    33         <fieldset>
    34                 In tutti i casi le foto "retro" possono avere lo stesso nome che le foto "fronte". In questo caso lasciare <b>Prefisso per individuare</b> vuoto, o un nome con prefisso.
    35         </fieldset>
     13  <legend>Esempi d\'uso</legend>
     14  <fieldset>
     15    Se piazzate le foto "retro" con dimenzioni per il web nel sub-album <i>thumbnail/retro/</i> del album della vostra foto normale ("fronte") e la "retro" HD nel sub-album <i>pwg_high/retro/</i>, usare la configurazione di base :
     16    <ul>
     17      <li><b>Album delle foto "retro" :</b> <i>vuoto</i>
     18      <li><b>Sub-album delle foto web :</b> thumbnail/retro/</li>
     19      <li><b>Sub-album delle foto HD :</b> pwg_high/retro/</li>
     20    </ul>
     21  </fieldset>
     22 
     23  <fieldset>
     24    Se preferite piazzare le foto "retro" in un\'altra directory, cambiate il valore del promo paramero (relativo alla radice del sito). Mantenete in mente che in questo caso l\'arborescenza della vostra galleria non viene riprodotta, e che due foto che hanno lo stesso nome in due diversi album caricheranno la stessa foto "retro".
     25    <br>Per esempio potete usare questa configurazione per cercare le foto "retro" web in <i>[RADICE]/retro/</i> e le foto "retro" HD in <i>[RADICE]/retro/hd/</i>
     26    <ul>
     27      <li><b>Album delle foto "retro" :</b> retro/
     28      <li><b>Sub-album delle foto web :</b> <i>vuoto</i></li>
     29      <li><b>Sub-album delle foto HD :</b> hd/</li>
     30    </ul>
     31  </fieldset>
     32 
     33  <fieldset>
     34    In tutti i casi le foto "retro" possono avere lo stesso nome che le foto "fronte". In questo caso lasciare <b>Prefisso per individuare</b> vuoto, o un nome con prefisso.
     35  </fieldset>
    3636</fieldset>
    3737';
  • extensions/Front2Back/language/lv_LV/plugin.lang.php

    r10789 r11217  
    11<?php
    22
    3 $lang['Front2Back_back'] = 'Skatīt aizmugures daļu';
    4 $lang['Front2Back_front'] = 'Skatīt priekšpusi';
     3$lang['See back'] = 'Skatīt aizmugures daļu';
     4$lang['See front'] = 'Skatīt priekšpusi';
    55
    6 $lang['f2b_path'] = "Aizmugures (fona) daļas mape";
    7 $lang['f2b_parent'] = "Web izmēra attēlu apakšmape";
    8 $lang['f2b_hd_parent'] = "HD attēlu apakšmape";
    9 $lang['f2b_suffix'] = "Sufikss";
     6$lang['Back sides folder'] = "Aizmugures (fona) daļas mape";
     7$lang['Web sized pics sub-folder'] = "Web izmēra attēlu apakšmape";
     8$lang['HD pics sub-folder'] = "HD attēlu apakšmape";
     9$lang['Suffix'] = "Sufikss";
    1010
    1111$lang['f2b_help'] = "
    1212<fieldset>
    13 <legend>Izmantošanas piemēri</legend>
    14 <fieldset>
    15 Ja ievietojat web izmēra aizmugures daļu <i>thumbnail/back/</i>
    16 jūsu normāla izmēra attēlu direktorija apakšmapē un HD izmēra attēla aizmugurējo daļu apakšmapē <i>pwg_high/back/</i>, lietojiet pamata konfigurāciju:<ul>
    17 <li><b>Aizmugures daļas mape:</b> <i>tukša</i>
    18 <li><b>Web izmēra attēlu apakšmape:</b> thumbnail/verso/</li>
    19 <li><b>HD attēlu apakšmape:</b> pwg_high/verso/</li>
    20 </ul>
    21 </fieldset>
     13  <legend>Izmantošanas piemēri</legend>
     14  <fieldset>
     15    Ja ievietojat web izmēra aizmugures daļu <i>thumbnail/back/</i> jūsu normāla izmēra attēlu direktorija apakšmapē un HD izmēra attēla aizmugurējo daļu apakšmapē <i>pwg_high/back/</i>, lietojiet pamata konfigurāciju:
     16    <ul>
     17      <li><b>Aizmugures daļas mape:</b> <i>tukša</i>
     18      <li><b>Web izmēra attēlu apakšmape:</b> thumbnail/verso/</li>
     19      <li><b>HD attēlu apakšmape:</b> pwg_high/verso/</li>
     20    </ul>
     21  </fieldset>
    2222
    23 <fieldset>
    24 Ja vēlaties izvietot savas mugurpuses citā mapē, izmainiet pirmā parametra vērtību (attiecībā pret vietnes saknes mapi).
    25 Ņemiet vērā, ka šajā gadījumā jūsu galerijas koka struktūra nepašatjaunojas, un divi attēli ar vienādiem nosaukumiem divos dažādos albūmos izmantos vienu un to pašu fonu (aizmugures daļu).
    26  <br>Šos istatījumus varat izmantot, lai meklētu web izmēra fonus
    27 <i>[ROOT]/verso/</i> un HD fonus <i>[ROOT]/verso/hd/</i>
    28 <ul>
    29 <li><b> Aizmugures (fona) daļas mape:</b> verso/
    30 <li><b>Web izmēra attēlu apakšmape:</b> <i>tukša</i></li>
    31 <li><b>HD attēlu apakšmape:</b> hd/</li>
    32 </ul>
    33 </fieldset>
     23  <fieldset>
     24    Ja vēlaties izvietot savas mugurpuses citā mapē, izmainiet pirmā parametra vērtību (attiecībā pret vietnes saknes mapi). Ņemiet vērā, ka šajā gadījumā jūsu galerijas koka struktūra nepašatjaunojas, un divi attēli ar vienādiem nosaukumiem divos dažādos albūmos izmantos vienu un to pašu fonu (aizmugures daļu).
     25    <br>Šos istatījumus varat izmantot, lai meklētu web izmēra fonus <i>[ROOT]/verso/</i> un HD fonus <i>[ROOT]/verso/hd/</i>
     26    <ul>
     27      <li><b> Aizmugures (fona) daļas mape:</b> verso/
     28      <li><b>Web izmēra attēlu apakšmape:</b> <i>tukša</i></li>
     29      <li><b>HD attēlu apakšmape:</b> hd/</li>
     30    </ul>
     31  </fieldset>
    3432
    35 <fieldset>
    36 Jebkurā gadījumā fona attēlam var būt tāds pats nosaukums kā normālam attēlam, šajā gadījumā atstājiet <b>Sufiksu</b> tukšu, vai nosauciet ar sufiksu.
    37 </fieldset>
     33  <fieldset>
     34    Jebkurā gadījumā fona attēlam var būt tāds pats nosaukums kā normālam attēlam, šajā gadījumā atstājiet <b>Sufiksu</b> tukšu, vai nosauciet ar sufiksu.
     35  </fieldset>
    3836</fieldset>
    3937";
  • extensions/Front2Back/main.inc.php

    r10985 r11217  
    1515include_once(F2B_PATH . 'Front2Back.php');
    1616add_event_handler('render_element_content', 'Front2Back_content', 99, 2);
    17        
     17 
    1818if (script_basename() == 'admin')
    1919{
    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         }
     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  }
    2828}
    2929
  • extensions/Front2Back/maintain.inc.php

    r10165 r11217  
    44function plugin_install()
    55{
    6         global $conf;
     6  global $conf;
    77
    8         if (!isset($conf['Front2Back'])) {
    9                 $q = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
    10                         VALUES ("Front2Back", ",thumbnail/verso/,pwg_high/verso/,", "Parametres Front2Back");';
    11                 pwg_query($q);
    12         }
     8  if (!isset($conf['Front2Back'])) {
     9    $q = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
     10      VALUES ("Front2Back", ",thumbnail/verso/,pwg_high/verso/,", "Parametres Front2Back");';
     11    pwg_query($q);
     12  }
    1313}
    1414
    1515function plugin_activate()
    1616{
    17         global $conf;
     17  global $conf;
    1818
    19         if (!isset($conf['Front2Back'])) {
    20                 $q = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
    21                         VALUES ("Front2Back", ",thumbnail/verso/,pwg_high/verso/,", "Parametres Front2Back");';
    22                 pwg_query($q);
    23         }
     19  if (!isset($conf['Front2Back'])) {
     20    $q = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
     21      VALUES ("Front2Back", ",thumbnail/verso/,pwg_high/verso/,", "Parametres Front2Back");';
     22    pwg_query($q);
     23  } else {
     24    $conf['Front2Back'] = explode(',', $conf['Front2Back']);
     25    if (!isset($conf['Front2Back'][4])) {
     26      $conf['Front2Back'][4] = 'top';
     27      $conf['Front2Back'][5] = 'click';
     28      $conf['Front2Back'][6] = 'none';
     29      $conf['Front2Back'][7] = serialize(array('default'=>null));
     30      conf_update_param('Front2Back', implode (',', $conf['Front2Back']));
     31    }
     32  }
    2433}
    2534
    2635function plugin_uninstall()
    2736{
    28         global $conf;
     37  global $conf;
    2938
    30         if (isset($conf['Front2Back'])) {
    31                 pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param="Front2Back";');
    32         }
     39  if (isset($conf['Front2Back'])) {
     40    pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param="Front2Back";');
     41  }
    3342}
    3443
  • extensions/Front2Back/template/Front2Back.tpl

    r9969 r11217  
    1 {combine_css path=$F2B_PATH|@cat:"template/Front2Back.css"}
     1{combine_css path=$F2B_PATH|@cat:"template/style.css"}
     2{combine_script id="jquery" load="header" path = "themes/default/js/jquery.min.js"}
    23
    34{footer_script require="jquery"}
    4         jQuery('.reverse').click(function() {ldelim}
    5                 if (jQuery(this).attr('name') == 'front') {ldelim}
    6                         /* picture attributes */
    7                         jQuery('#theImage img:first-child').attr({ldelim}
    8                                 src: '{$VERSO_URL}',
    9                                 style: 'width:;height:;',
    10                         });
    11                        
    12                         /* hd link atributes */
    13                         {if isset($VERSO_HD)}
    14                         jQuery('#theImage a:first-child').attr({ldelim}
    15                                 href: "javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
    16                         });
    17                         {/if}
    18                        
    19                         /* f2b link content */
    20                         jQuery(this).html('<img src="{$F2B_PATH}template/rotate_2.png"/> {'Front2Back_front'|@translate}');
    21                         jQuery(this).attr('name', 'back');
    22                        
    23                 } else if (jQuery(this).attr('name') == 'back') {ldelim}
    24                         jQuery('#theImage img:first-child').attr({ldelim}
    25                                 src: '{$SRC_IMG}',
    26                                 style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
    27                         });
    28                        
    29                         {if isset($VERSO_HD)}
    30                         jQuery('#theImage a:first-child').attr({ldelim}
    31                                 href: "javascript:phpWGOpenWindow('{$high.U_HIGH}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')')"
    32                         });
    33                         {/if}
    34                        
    35                         jQuery(this).html('<img src="{$F2B_PATH}template/rotate_1.png"/> {'Front2Back_back'|@translate}');
    36                         jQuery(this).attr('name', 'front');
    37                 }
    38         });
     5jQuery(document).ready(function () {ldelim}
     6
     7{if $F2B_switch_mode == 'click'}
     8  jQuery('.reverse').click(function() {ldelim}
     9    if (jQuery(this).attr('rel') == 'front') {ldelim}
     10{else}
     11  jQuery('.reverse').hover(function() {ldelim}
     12{/if}
     13
     14      /* picture switch */
     15    {if $F2B_transition == 'fade'}
     16      jQuery('img[alt="{$ALT_IMG}"]').animate({ldelim}
     17        opacity:0
     18      }, 400, function() {ldelim}
     19        jQuery(this).attr({ldelim}
     20          src: '{$VERSO_URL}',
     21          style: 'max-width:{$WIDTH_IMG}px;max-height:{$HEIGHT_IMG}px;',
     22        });
     23        jQuery(this).animate({ldelim}
     24          opacity:1
     25        }, 400);
     26      });
     27    {else}
     28      jQuery('img[alt="{$ALT_IMG}"]').attr({ldelim}
     29        src: '{$VERSO_URL}',
     30        style: 'max-width:{$WIDTH_IMG}px;max-height:{$HEIGHT_IMG}px;',
     31      });
     32    {/if}
     33
     34    {if $F2B_switch_mode == 'click'}
     35      /* hd link */
     36      {if isset($VERSO_HD)}
     37      jQuery('img[alt="{$ALT_IMG}"]').parent().attr({ldelim}
     38        href: "javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
     39      });
     40      {/if}
     41     
     42      /* f2b link content */
     43      jQuery(this).html('<img src="{$F2B_PATH}template/rotate_2.png"/> {$F2B_see_front}');
     44      jQuery(this).attr('rel', 'back');
     45    {/if}
     46     
     47{if $F2B_switch_mode == 'click'}
     48    } else if (jQuery(this).attr('rel') == 'back') {ldelim}
     49{else}
     50  }, function() {ldelim}
     51{/if}
     52      /* picture switch */
     53    {if $F2B_transition == 'fade'}
     54      jQuery('img[alt="{$ALT_IMG}"]').animate({ldelim}
     55        opacity:0
     56      }, 400, function() {ldelim}
     57        jQuery(this).attr({ldelim}
     58          src: '{$SRC_IMG}',
     59          style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
     60        });
     61        jQuery(this).animate({ldelim}
     62          opacity:1
     63        }, 400);
     64      });
     65    {else}
     66      jQuery('img[alt="{$ALT_IMG}"]').attr({ldelim}
     67        src: '{$SRC_IMG}',
     68        style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
     69      });
     70    {/if}
     71   
     72    {if $F2B_switch_mode == 'click'}
     73       /* hd link */
     74      {if isset($high.U_HIGH)}
     75      jQuery('img[alt="{$ALT_IMG}"]').parent().attr({ldelim}
     76        href: "javascript:phpWGOpenWindow('{$high.U_HIGH}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
     77      });
     78      {/if}
     79     
     80      /* f2b link content */
     81      jQuery(this).html('<img src="{$F2B_PATH}template/rotate_1.png"/> {$F2B_see_back}');
     82      jQuery(this).attr('rel', 'front');
     83    {/if}
     84   
     85{if $F2B_switch_mode == 'click'}
     86    }
     87  });
     88{else}
     89  });
     90{/if}
     91 
     92});
    3993{/footer_script}
    4094
    41 <a class="reverse" name="front">
    42         <img src="{$F2B_PATH}template/rotate_1.png"/>
    43         {'Front2Back_back'|@translate}
     95<img src="{$VERSO_URL}" style="display:none;"/> {* <!-- force preload the verso --> *}
     96
     97{if $F2B_position != 'toolbar'}<div>{/if}
     98<a class="reverse" rel="front" {if $F2B_position == 'toolbar'}style="border:none !important;"{/if} {if $F2B_switch_mode == 'hover'}href="javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"{/if}>
     99  <img src="{$F2B_PATH}template/rotate_1.png"/> {$F2B_see_back}
    44100</a>
     101{if $F2B_position != 'toolbar'}</div>{/if}
  • extensions/Front2Back/template/admin.tpl

    r9784 r11217  
     1{combine_css path=$F2B_PATH|@cat:"template/style.css"}
     2
     3{footer_script require='jquery'}{literal}
     4jQuery().ready( function () {
     5  jQuery('select[name="lang_desc_select"]').change(function () {
     6    jQuery('[id^="link_name"]').hide();
     7    jQuery("#link_name_"+this.options[this.selectedIndex].value).show();
     8  });
     9  jQuery('[id^="link_name_"]').keyup(function () {
     10    arr = jQuery(this).attr("id").split("link_name_");
     11    id = arr[1];
     12    opt = jQuery('select[name="lang_desc_select"] option[id="opt_'+id+'"]');
     13    if (this.value != '')
     14      opt.html(opt.html().replace("\u2718", "\u2714"));
     15    else
     16      opt.html(opt.html().replace("\u2714", "\u2718"));
     17  });
     18});
     19
     20jQuery('.lang_help').tipTip();
     21{/literal}{/footer_script}
     22
    123<div class="titrePage">
    2         <h2>Front2Back</h2>
     24  <h2>Front2Back</h2>
    325</div>
    426
    527<form method="post" action="" class="properties" ENCTYPE="multipart/form-data">
    6         <fieldset>
    7                 <legend>{'Configuration'|@translate}</legend>     
    8                 <ul>                   
     28  <fieldset>
     29    <legend>{'Configuration'|@translate}</legend>   
     30    <ul>     
     31      <li>
     32        <span class="property">{'Back sides folder'|@translate}</span>
     33        <input type="text" name="path" value="{$PATH}"/>
     34      </li>
     35      <li>
     36        <span class="property">{'Web sized pics sub-folder'|@translate}</span>
     37        <input type="text" name="parent" value="{$PARENT}"/>
     38      </li>   
     39      <li>
     40        <span class="property">{'HD pics sub-folder'|@translate}</span>
     41        <input type="text" name="hd_parent" value="{$HD_PARENT}"/>
     42      </li>
     43      <li>
     44        <span class="property">{'Suffix'|@translate}</span>
     45        <input type="text" name="suffix" value="{$SUFFIX}"/>
     46      </li>
     47     
     48      <li>
     49        <span class="property">{'Link position'|@translate}</span>
     50        <label><input type="radio" name="position" value="top" {if $POSITION == 'top'}checked="checked"{/if}/> {'Top'|@translate}</label>
     51        <label><input type="radio" name="position" value="bottom" {if $POSITION == 'bottom'}checked="checked"{/if}/> {'Bottom'|@translate}</label>
     52        <label><input type="radio" name="position" value="toolbar" {if $POSITION == 'toolbar'}checked="checked"{/if}/> {'Toolbar'|@translate}</label>
     53      </li>
    954                        <li>
    10                                 <span class="property">{'f2b_path'|@translate}</span>
    11                                 <input type="text" name="path" value="{$PATH}"/>
     55                                <span class="property">{'Switch mode'|@translate}</span>
     56                                <label><input type="radio" name="switch_mode" value="click" {if $SWITCH_MODE == 'click'}checked="checked"{/if}/> {'Click'|@translate}</label>
     57                                <label><input type="radio" name="switch_mode" value="hover" {if $SWITCH_MODE == 'hover'}checked="checked"{/if}/> {'Mouseover'|@translate}</label>
    1258                        </li>
    1359                        <li>
    14                                 <span class="property">{'f2b_parent'|@translate}</span>
    15                                 <input type="text" name="parent" value="{$PARENT}"/>
    16                         </li>           
    17                         <li>
    18                                 <span class="property">{'f2b_hd_parent'|@translate}</span>
    19                                 <input type="text" name="hd_parent" value="{$HD_PARENT}"/>
     60                                <span class="property">{'Transition'|@translate}</span>
     61                                <label><input type="radio" name="transition" value="none" {if $TRANSITION == 'none'}checked="checked"{/if}/> {'None'|@translate}</label>
     62                                <label><input type="radio" name="transition" value="fade" {if $TRANSITION == 'fade'}checked="checked"{/if}/> {'Fade'|@translate}</label>
    2063                        </li>
    21                         <li>
    22                                 <span class="property">{'f2b_suffix'|@translate}</span>
    23                                 <input type="text" name="suffix" value="{$SUFFIX}"/>
    24                         </li>
    25                 </ul>
    26         </fieldset>
    27                
    28         <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p>
     64     
     65      <li>
     66        <span class="property">{'Link name'|@translate}</span>
     67        <select name="lang_desc_select">
     68          {foreach from=$link_name item=lang}
     69            <option value="{$lang.LANGUAGE_CODE}" id="opt_{$lang.LANGUAGE_CODE}">{if empty($lang.VALUE)}&#x2718;{else}&#x2714;{/if} &nbsp;{$lang.LANGUAGE_NAME}</option>
     70          {/foreach}
     71        </select>
     72        {foreach from=$link_name item=lang}
     73          <input type="text" size="30" name="link_name[{$lang.LANGUAGE_CODE}]" id="link_name_{$lang.LANGUAGE_CODE}" value="{$lang.VALUE}" style="{if $lang.LANGUAGE_CODE != 'default'}display:none; {/if}margin-left:10px;">
     74        {/foreach}
     75
     76        <a class="lang_help" title="{'Seperate the two labels with the | symbol. Leave blank to use default translation.'|@translate}">i</a>
     77      </li>
     78    </ul>
     79  </fieldset>
     80   
     81  <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p>
    2982</form>
    3083
Note: See TracChangeset for help on using the changeset viewer.