Changeset 12361 for extensions


Ignore:
Timestamp:
Oct 6, 2011, 1:45:36 PM (13 years ago)
Author:
mistic100
Message:

remove a prefilter for a better integration, add an option to display a mark on thumbnails list

Location:
extensions/Back2Front
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • extensions/Back2Front/Back2Front.php

    r11599 r12361  
    88 */
    99function Back2Front_picture_content($content, $image)
    10  {
     10{
    1111  global $template, $user, $conf;
    1212
     
    3333   
    3434    /* websize picture */
    35     $template->assign('VERSO_URL', $verso['path']);
     35    $template->assign(array(
     36      'B2F_PATH' => B2F_PATH,
     37      'VERSO_URL' => $verso['path'],
     38      ));
    3639   
    3740    /* admin link */
     
    7982
    8083    /* template & output */
    81     $template->set_filenames(array('B2F_picture_content' => dirname(__FILE__).'/template/picture_content.tpl') );   
     84    $template->set_filename('B2F_picture_content', dirname(__FILE__).'/template/picture_content.tpl');   
    8285    $template->assign(array(
    83       'B2F_PATH' => B2F_PATH,
    8486      'b2f_switch_mode' => $conf['back2front'][1],
    8587      'b2f_transition' => $conf['back2front'][2],
     
    9294    {
    9395      case 'toolbar':
    94         $template->set_prefilter('picture', 'Back2Front_toolbar_prefilter'); 
     96        $template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('B2F_picture_content', true));
    9597        break;
    9698      case 'top':
     
    104106 
    105107  return $content;
    106 }
    107 
    108 function Back2Front_toolbar_prefilter($content, &$smarty)
    109 {
    110   $search = '{/if}{/strip}{*caddie management END*}';
    111   $replacement = $search."\n".file_get_contents(B2F_PATH.'template/picture_content.tpl');
    112   return str_replace($search, $replacement, $content);
    113108}
    114109
     
    322317}
    323318
     319
     320/*
     321 * Add mark on thumbnails list
     322 */
     323function Back2Front_thumbnails($tpl_thumbnails_var, $pictures)
     324{
     325  global $conf;
     326 
     327  $conf['back2front'] = explode(',',$conf['back2front']);
     328  if (!$conf['back2front'][5]) return $tpl_thumbnails_var;
     329 
     330  $ids = array();
     331  foreach ($pictures as $row)
     332  {
     333    array_push($ids, $row['id']);
     334  }
     335   
     336  /* has the pictures a verso ? */
     337  $query = "SELECT image_id, verso_id
     338    FROM ".B2F_TABLE."
     339    WHERE image_id IN(".implode(',', $ids).");";
     340  $result = hash_from_query($query, 'image_id');
     341 
     342  $ids = array_keys($result);
     343 
     344  foreach($tpl_thumbnails_var as &$tpl_var)
     345  {
     346    if (in_array($tpl_var['ID'], $ids))
     347    {
     348      $tpl_var['NAME'].= ' <img class="has_verso" src="'.B2F_PATH.'template/rotate_1.png" title="'.l10n('This picture has a backside :').'"/>';
     349    }
     350  }
     351 
     352  return $tpl_thumbnails_var;
     353}
     354
    324355?>
  • extensions/Back2Front/admin.php

    r11219 r12361  
    1111if (isset($_POST['submit']))
    1212{
    13         $conf['back2front'] = array(
     13  $conf['back2front'] = array(
    1414    $conf['back2front'][0],
    1515    $_POST['switch_mode'],
     
    1717    $_POST['position'],
    1818    serialize(stripslashes_deep(str_replace(array("'",'"',','), null, $_POST['link_name']))),
     19    isset($_POST['show_thumbnail']),
    1920  );
    20        
     21 
    2122  conf_update_param('back2front', implode (',', $conf['back2front']));
    22         array_push($page['infos'], l10n('Information data registered in database'));
     23  array_push($page['infos'], l10n('Information data registered in database'));
    2324}
    2425
     
    3334foreach (get_languages() as $language_code => $language_name)
    3435{
    35         $template->append('link_name', array(
     36  $template->append('link_name', array(
    3637    'LANGUAGE_NAME' => $language_name,
    3738    'LANGUAGE_CODE' => $language_code,
     
    4344$template->assign(array(
    4445  'B2F_PATH' => B2F_PATH,
    45         'SWITCH_MODE' => $conf['back2front'][1],
    46         'TRANSITION' => $conf['back2front'][2],
     46  'SWITCH_MODE' => $conf['back2front'][1],
     47  'TRANSITION' => $conf['back2front'][2],
    4748  'POSITION' => $conf['back2front'][3],
     49  'SHOW_THUMBNAIL' => $conf['back2front'][5],
    4850));
    49        
     51 
    5052$template->set_filename('back2front_conf', dirname(__FILE__).'/template/admin.tpl');
    5153$template->assign_var_from_handle('ADMIN_CONTENT', 'back2front_conf');
  • extensions/Back2Front/language/en_UK/plugin.lang.php

    r11238 r12361  
    1515$lang['Toolbar'] = 'Toolbar';
    1616$lang['Link name'] = 'Button name';
     17$lang['Display a mark on thumbnails list'] = 'Display a mark on thumbnails list';
    1718
    1819$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.';
     
    2223$lang['Backside management'] = 'Backside management';
    2324$lang['Move backside to private album'] = 'Move backside to private album';
    24 $lang['This picture has a backside : '] = 'This picture has a backside : ';
     25$lang['This picture has a backside :'] = 'This picture has a backside : ';
    2526
    2627$lang['Backside and frontside can\'t be the same picture'] = 'Backside and frontside can\'t be the same picture';
  • extensions/Back2Front/language/fr_FR/plugin.lang.php

    r11238 r12361  
    1515$lang['Toolbar'] = 'Barre d\'outils';
    1616$lang['Link name'] = 'Nom du bouton';
     17$lang['Display a mark on thumbnails list'] = 'Marquer les versos sur la liste des miniatures';
    1718
    1819$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.';
     
    2223$lang['Backside management'] = 'Gestion des recto-verso';
    2324$lang['Move backside to private album'] = 'Déplacer le verso vers un album privé';
    24 $lang['This picture has a backside : '] = 'Cette image a un verso : ';
     25$lang['This picture has a backside :'] = 'Cette image a un verso : ';
    2526
    2627$lang['Backside and frontside can\'t be the same picture'] = 'Verso et recto ne peuvent être la même image';
  • extensions/Back2Front/language/it_IT/plugin.lang.php

    r11519 r12361  
    2222$lang['Backside management'] = 'Gestione delle fronte-retro';
    2323$lang['Move backside to private album'] = 'Spostare il retro verso un\'album privato';
    24 $lang['This picture has a backside : '] = 'Questa foto a un retro : ';
     24$lang['This picture has a backside :'] = 'Questa foto a un retro :';
    2525
    2626$lang['Backside and frontside can\'t be the same picture'] = 'Retro e fronte non possono essere la stessa foto';
  • extensions/Back2Front/language/lv_LV/plugin.lang.php

    r11238 r12361  
    2222$lang['Backside management'] = 'Aizmugures daļas pārvalde';
    2323$lang['Move backside to private album'] = 'Pārvietot attēla aizmugures daļu uz privātu albūmu';
    24 $lang['This picture has a backside : '] = 'Šim attēlam ir aizmugure : ';
     24$lang['This picture has a backside :'] = 'Šim attēlam ir aizmugure :';
    2525
    2626$lang['Backside and frontside can\'t be the same picture'] = 'Aizmugure un priekšpuse nevar būt viens un tas pats attēls';
  • extensions/Back2Front/main.inc.php

    r11219 r12361  
    2424}
    2525
     26if (script_basename() == 'index')
     27{
     28  add_event_handler('loc_end_index_thumbnails', 'Back2Front_thumbnails', 99, 2);
     29}
     30
    2631if (script_basename() == 'admin')
    2732{
    2833  add_event_handler('loc_begin_admin_page', 'Back2Front_picture_modify');
    2934 
    30         add_event_handler('get_admin_plugin_menu_links', 'Back2Front_admin_menu');
    31         function Back2Front_admin_menu($menu)
    32         {
    33                 array_push($menu, array(
    34                         'NAME' => 'Back2Front',
    35                         'URL' => get_root_url().'admin.php?page=plugin-' . B2F_DIR));
    36                 return $menu;
    37         }
     35  add_event_handler('get_admin_plugin_menu_links', 'Back2Front_admin_menu');
     36  function Back2Front_admin_menu($menu)
     37  {
     38    array_push($menu, array(
     39      'NAME' => 'Back2Front',
     40      'URL' => get_root_url().'admin.php?page=plugin-' . B2F_DIR));
     41    return $menu;
     42  }
    3843}
    3944
  • extensions/Back2Front/maintain.inc.php

    r11219 r12361  
    44include_once(PHPWG_PLUGINS_PATH.'back2front/functions.inc.php');
    55
    6 function plugin_install() {
    7         global $prefixeTable;
     6function plugin_install()
     7{
     8  global $prefixeTable;
    89
    9   /* create table for recto/veros pairs | stores original verso categories */
    10         pwg_query("CREATE TABLE IF NOT EXISTS `" . $prefixeTable . "image_verso` (
     10  /* create table for recto/verso pairs | stores original verso categories */
     11  pwg_query("CREATE TABLE IF NOT EXISTS `" . $prefixeTable . "image_verso` (
    1112    `image_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
    1213    `verso_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
     
    1415    PRIMARY KEY (`image_id`),
    1516    UNIQUE KEY (`verso_id`)
    16         ) DEFAULT CHARSET=utf8;");
     17  ) DEFAULT CHARSET=utf8;");
    1718 
    1819  /* create a virtual category to store versos */
     
    3637  /* config parameter */
    3738  pwg_query("INSERT INTO `" . CONFIG_TABLE . "`
    38     VALUES ('back2front', '".$versos_cat['id'].",click,none', 'Configuration for Back2Front plugin');");
     39    VALUES ('back2front', '".$versos_cat['id'].",click,none,top,".serialize(array('default'=>null)).",1', 'Configuration for Back2Front plugin');");
    3940}
    4041
     
    4344  global $conf;
    4445
    45   if (!isset($conf['back2front'])) {
     46  if (!isset($conf['back2front']))
     47  {
    4648    pwg_query("INSERT INTO `" . CONFIG_TABLE . "`
    47       VALUES ('back2front', '".$versos_cat['id'].",click,none', 'Configuration for Back2Front plugin');");
    48   } else {
     49      VALUES ('back2front', '".$versos_cat['id'].",click,none,top,".serialize(array('default'=>null)).",1', 'Configuration for Back2Front plugin');");
     50  }
     51  else
     52  {
    4953    $conf['back2front'] = explode(',', $conf['back2front']);
    50     if (!isset($conf['back2front'][3])) {
     54   
     55    if (!isset($conf['back2front'][3]))
     56    {
    5157      $conf['back2front'][3] = 'top';
    5258      $conf['back2front'][4] = serialize(array('default'=>null));
    53       conf_update_param('back2front', implode (',', $conf['back2front']));
    5459    }
     60    if (!isset($conf['back2front'][5]))
     61    {
     62      $conf['back2front'][5] = true;
     63    }
     64   
     65    conf_update_param('back2front', implode (',', $conf['back2front']));
    5566  }
    5667}
     
    5869
    5970function plugin_uninstall() {
    60         global $conf, $prefixeTable;
     71  global $conf, $prefixeTable;
    6172 
    6273  $conf['back2front'] = explode(',',$conf['back2front']);
  • extensions/Back2Front/template/admin.tpl

    r11219 r12361  
    2323
    2424<div class="titrePage">
    25         <h2>Back2Front</h2>
     25  <h2>Back2Front</h2>
    2626</div>
    2727
    2828<form method="post" action="" class="properties" ENCTYPE="multipart/form-data">
    29         <fieldset>
    30                 <legend>{'Display'|@translate}</legend>   
    31                 <ul>                   
     29  <fieldset>
     30    <legend>{'Display'|@translate}</legend>
     31    <ul>
    3232      <li>
    3333        <span class="property">{'Link position'|@translate}</span>
     
    3636        <label><input type="radio" name="position" value="toolbar" {if $POSITION == 'toolbar'}checked="checked"{/if}/> {'Toolbar'|@translate}</label>
    3737      </li>
    38                         <li>
    39                                 <span class="property">{'Switch mode'|@translate}</span>
    40                                 <label><input type="radio" name="switch_mode" value="click" {if $SWITCH_MODE == 'click'}checked="checked"{/if}/> {'Click'|@translate}</label>
    41                                 <label><input type="radio" name="switch_mode" value="hover" {if $SWITCH_MODE == 'hover'}checked="checked"{/if}/> {'Mouseover'|@translate}</label>
    42                         </li>
    43                         <li>
    44                                 <span class="property">{'Transition'|@translate}</span>
    45                                 <label><input type="radio" name="transition" value="none" {if $TRANSITION == 'none'}checked="checked"{/if}/> {'None'|@translate}</label>
    46                                 <label><input type="radio" name="transition" value="fade" {if $TRANSITION == 'fade'}checked="checked"{/if}/> {'Fade'|@translate}</label>
    47                         </li>   
     38      <li>
     39        <span class="property">{'Switch mode'|@translate}</span>
     40        <label><input type="radio" name="switch_mode" value="click" {if $SWITCH_MODE == 'click'}checked="checked"{/if}/> {'Click'|@translate}</label>
     41        <label><input type="radio" name="switch_mode" value="hover" {if $SWITCH_MODE == 'hover'}checked="checked"{/if}/> {'Mouseover'|@translate}</label>
     42      </li>
     43      <li>
     44        <span class="property">{'Transition'|@translate}</span>
     45        <label><input type="radio" name="transition" value="none" {if $TRANSITION == 'none'}checked="checked"{/if}/> {'None'|@translate}</label>
     46        <label><input type="radio" name="transition" value="fade" {if $TRANSITION == 'fade'}checked="checked"{/if}/> {'Fade'|@translate}</label>
     47      </li>
     48      <li>
     49        <span class="property">{'Display a mark on thumbnails list'|@translate}</span>
     50        <input type="checkbox" name="show_thumbnail" value="1" {if $SHOW_THUMBNAIL == '1'}checked="checked"{/if}/>
     51      </li>
    4852
    4953      <li>
     
    6064        <a class="lang_help" title="{'Seperate the two labels with the | symbol. Leave blank to use default translation.'|@translate}">i</a>
    6165      </li>     
    62                 </ul>
    63         </fieldset>
    64                
    65         <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p>
     66    </ul>
     67  </fieldset>
     68 
     69  <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p>
    6670</form>
  • extensions/Back2Front/template/admin_button.tpl

    r10823 r12361  
    11{strip}<a href="{$VERSO_U_ADMIN}" title="{'Modify backside information'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
    2   <span class="pwg-icon pwg-icon-edit"> </span><span class="pwg-button-text">{'edit'|@translate}</span>
     2  <img src="{$B2F_PATH}template/rotate_edit.png"/><span class="pwg-button-text">{'edit'|@translate}</span>
    33</a>{/strip}
  • extensions/Back2Front/template/picture_content.tpl

    r11599 r12361  
    9797
    9898{if $b2f_position != 'toolbar'}<div>{/if}
    99 <a class="reverse" rel="front" {if $b2f_position == 'toolbar'}style="border:none !important;"{/if}
     99<a class="reverse" rel="front" class="pwg-state-default pwg-button" title="{$b2f_see_back}" {if $b2f_position == 'toolbar'}style="border:none !important;"{/if}
    100100  {if $b2f_switch_mode == 'hover' and isset($VERSO_HD)}href="javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"{/if}>
    101101  <img src="{$B2F_PATH}template/rotate_1.png"/> {$b2f_see_back}
  • extensions/Back2Front/template/style.css

    r11219 r12361  
    22  display:inline-block;
    33  border:1px solid #666 !important;
    4   padding:3px 5px;
     4  padding:5px 5px;
    55  margin-bottom:10px;
    66  font-size:15px;
Note: See TracChangeset for help on using the changeset viewer.