Ignore:
Timestamp:
May 11, 2011, 7:17:49 PM (13 years ago)
Author:
mistic100
Message:

improve process, add options for link effect

Location:
extensions/Back2Front
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/Back2Front/Back2Front.php

    r10828 r10852  
    11<?php
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     3
     4include_once(B2F_PATH.'functions.inc.php');
    35
    46/*
     
    79function Back2Front_picture_content($content, $image)
    810 {
    9   global $template, $conf;
     11  global $template, $user, $conf;
    1012
    1113  /* search for a verso picture */
     
    1416      i.id,
    1517      i.path,
    16       i.has_high
     18      i.has_high,
     19      i.width,
     20      i.height
    1721    FROM ".IMAGES_TABLE." as i
    1822      INNER JOIN ".B2F_TABLE." as v
     
    2630  {
    2731    $verso = pwg_db_fetch_assoc($result);
     32    $conf['back2front'] = explode(',',$conf['back2front']);
     33   
     34    // calculation of width and height
     35    include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
     36   
     37    if (!empty($verso['width']))
     38    {
     39      list(
     40        $verso['scaled_width'],
     41        $verso['scaled_height']
     42        ) = get_picture_size(
     43          $verso['width'],
     44          $verso['height'],
     45          @$user['maxwidth'],
     46          @$user['maxheight']
     47        );
     48    }
    2849
    2950    /* websize picture */
    30     $template->assign('VERSO_URL', $verso['path']);
     51    $template->assign(array(
     52      'VERSO_URL' => $verso['path'],
     53      'VERSO_WIDTH' => $verso['scaled_width'],
     54      'VERSO_HEIGHT' => $verso['scaled_height'],
     55      'b2f_switch_mode' => $conf['back2front'][1],
     56      'b2f_transition' => $conf['back2front'][2],
     57    ));
    3158   
    3259    /* admin link */
     
    4875    $template->assign('B2F_PATH', B2F_PATH);
    4976   
    50     return $content . $template->parse('B2F_picture_content', true)
     77    return $template->parse('B2F_picture_content', true).$content
    5178  }
    5279  else
     
    6087 * Add field on picture modify page
    6188 */
    62 function Back2Front_picture_modify()
     89function Back2Front_picture_modify($menu)
    6390{
    6491  global $page, $template, $conf;
     92 
     93  if ($page['page'] != 'picture_modify') return $menu;
    6594  $conf['back2front'] = explode(',',$conf['back2front']);
    66  
    67   if ($page['page'] != 'picture_modify')
    68   {
    69     return;
    70   }
    7195 
    7296/* SAVE VALUES */
    7397  if (isset($_POST['b2f_submit']))
    7498  {
     99    /* catch all verso and recto ids and original categories */
     100    $query = "SELECT image_id, verso_id, categories
     101      FROM ".B2F_TABLE.";";
     102    $rectos = array_from_query($query, 'image_id');
     103    $versos = array_from_query($query, 'verso_id');
     104    $cats = array_from_query($query, 'categories');
     105   
     106    if (count($rectos) != 0)
     107    {
     108      $all_recto_verso = array_combine($rectos, $versos);
     109      $verso_cats = array_combine($versos, $cats);
     110    }
     111    else
     112    {
     113      $all_recto_verso = array(0=>0);
     114      $verso_cats = array(0=>NULL);
     115    }
     116    unset($rectos, $versos, $cats);
     117   
    75118    /* picture is verso */
    76119    if (isset($_POST['b2f_is_verso']))
    77     {
    78       /* catch all verso and recto ids */
    79       $query = "SELECT image_id, verso_id
    80         FROM ".B2F_TABLE.";";
    81       $rectos = array_from_query($query, 'image_id');
    82       $versos = array_from_query($query, 'verso_id');
    83       if (count($rectos) != 0)
    84       {
    85         $all_recto_verso = array_combine($rectos, $versos);
    86       }
    87       else
    88       {
    89         $all_recto_verso = array(0=>0);
    90       }
    91       unset($rectos, $versos);
    92      
     120    {     
    93121      /* verso don't exists */
    94122      if (!picture_exists($_POST['b2f_front_id']))
    95123      {
    96         $template->append('errors', l10n('Unknown id for frontside picture : ').$_POST['b2f_front_id']);
     124        array_push($page['errors'], l10n_args(get_l10n_args('Unknown id %d for frontside picture', $_POST['b2f_front_id'])));
    97125      }
    98126      /* verso same as recto  */
    99127      else if ($_POST['b2f_front_id'] == $_GET['image_id'])
    100128      {
    101         $template->append('errors', l10n('Backside and frontside can\'t be the same picture'));
     129        array_push($page['errors'], l10n('Backside and frontside can\'t be the same picture'));
    102130      }
    103131      /* recto has already a verso */
    104       else if (in_array($_POST['b2f_front_id'], array_keys($all_recto_verso)))
     132      else if (in_array($_POST['b2f_front_id'], array_keys($all_recto_verso)) AND $all_recto_verso[$_POST['b2f_front_id']] != $_GET['image_id'])
    105133      {
    106134          $recto_current_verso['id'] = $all_recto_verso[$_POST['b2f_front_id']];
    107135          $recto_current_verso['link'] = get_root_url().'admin.php?page=picture_modify&amp;image_id='.$recto_current_verso['id'];
    108           $template->append('errors', l10n('This picture has already a backside : ').'<a href="'.$recto_current_verso['link'].'">'.$recto_current_verso['id'].'</a>');
     136          array_push($page['errors'],
     137            l10n_args(get_l10n_args('The picture n°%d has already a backside : %s',
     138              array($_POST['b2f_front_id'], '<a href="'.$recto_current_verso['link'].'">'.$recto_current_verso['id'].'</a>')
     139            ))
     140          );
    109141      }
    110142      /* recto is already a verso */
     
    113145          $recto_is_verso['id'] = $_POST['b2f_front_id'];
    114146          $recto_is_verso['link'] = get_root_url().'admin.php?page=picture_modify&amp;image_id='.$recto_is_verso['id'];
    115           $template->append('errors', l10n('This picture is already a backside : ').'<a href="'.$recto_is_verso['link'].'">'.$recto_is_verso['id'].'</a>');
     147          array_push($page['errors'], l10n_args(get_l10n_args('The picture n°%s is already a backside', '<a href="'.$recto_is_verso['link'].'">'.$recto_is_verso['id'].'</a>')));
    116148      }
    117149      /* everything is fine */
    118150      else
    119151      {
    120         // get current categories
    121         $query = "SELECT category_id FROM ".IMAGE_CATEGORY_TABLE." WHERE image_id = ".$_GET['image_id'].";";
    122         $verso_categories = array_from_query($query, 'category_id');
    123        
    124         // insert or update verso associations
    125         pwg_query("INSERT INTO ".B2F_TABLE."
    126           VALUES(".$_POST['b2f_front_id'].", ".$_GET['image_id'].", '".implode(',',$verso_categories)."')
    127           ON DUPLICATE KEY UPDATE image_id = ".$_POST['b2f_front_id'].";");
    128        
    129         // move the verso ?
    130         if (isset($_POST['b2f_move_verso']))
     152        // move the verso - if first save
     153        if (isset($_POST['b2f_move_verso']) AND (!array_key_exists($_GET['image_id'], $verso_cats) OR $verso_cats[$_GET['image_id']] == NULL))
    131154        {
     155          // get current categories
     156          $query = "SELECT category_id FROM ".IMAGE_CATEGORY_TABLE." WHERE image_id = ".$_GET['image_id'].";";
     157          $verso_categories = array_from_query($query, 'category_id');
     158         
    132159          pwg_query("DELETE FROM ".IMAGE_CATEGORY_TABLE."
    133160            WHERE image_id = ".$_GET['image_id'].";");
    134            
    135161          pwg_query("INSERT INTO ".IMAGE_CATEGORY_TABLE."
    136162            VALUES(".$_GET['image_id'].", ".$conf['back2front'][0].", NULL);");
     
    138164          // random representant for each categories
    139165          set_random_representant($verso_categories);
     166         
     167          $verso_categories = isset($verso_cats[$_GET['image_id']]) ? $verso_cats[$_GET['image_id']] : implode(',',$verso_categories);
     168          $template->assign('B2F_MOVE_VERSO', 'checked="checked"');
    140169        }
     170        // restore the verso - if precedently moved
     171        else if (!isset($_POST['b2f_move_verso']) AND array_key_exists($_GET['image_id'], $verso_cats) AND $verso_cats[$_GET['image_id']] != NULL)
     172        {
     173          $item['verso_id'] = $_GET['image_id'];
     174          $item['categories'] = $verso_cats[$_GET['image_id']];
     175          back2front_restaure_categories($item);
     176         
     177          $verso_categories = 'NULL';
     178          $template->assign('B2F_MOVE_VERSO', '');
     179        }
     180        // leave the verso
     181        else
     182        {
     183          $verso_categories = isset($verso_cats[$_GET['image_id']]) ? $verso_cats[$_GET['image_id']] : 'NULL';
     184          $template->assign('B2F_MOVE_VERSO', isset($verso_cats[$_GET['image_id']]) ? 'checked="checked"' : '');
     185        }
     186       
     187        // insert or update verso associations
     188        pwg_query("INSERT INTO ".B2F_TABLE."
     189          VALUES(".$_POST['b2f_front_id'].", ".$_GET['image_id'].", '".$verso_categories."')
     190          ON DUPLICATE KEY UPDATE image_id = ".$_POST['b2f_front_id'].", categories = ".$verso_categories.";");
    141191     
    142192        $template->assign(array(
     
    145195        ));
    146196       
    147         $template->append('infos', l10n('This picture is now the backside of the picture n° ').$_POST['b2f_front_id']);
     197        $verso['id'] = $_POST['b2f_front_id'];
     198        $verso['link'] = get_root_url().'admin.php?page=picture_modify&amp;image_id='.$verso['id'];
     199        array_push($page['infos'], l10n_args(get_l10n_args('This picture is now the backside of the picture n°%s', '<a href="'.$verso['link'].'">'.$verso['id'].'</a>')));
    148200      }
    149201    }
     
    160212      if (pwg_db_num_rows($result))
    161213      {
    162         // original categories
     214        $item['verso_id'] = $_GET['image_id'];
    163215        list($item['categories']) = pwg_db_fetch_row($result);
    164         // catch current categories
    165         $versos_infos = pwg_query("SELECT category_id FROM ".IMAGE_CATEGORY_TABLE." WHERE image_id = ".$_GET['image_id'].";");
    166         while (list($verso_cat) = pwg_db_fetch_row($versos_infos))
    167         {
    168           $current_verso_cats[] = $verso_cat;
    169         }
    170        
    171         /* if verso € 'versos' cat only */
    172         if (count($current_verso_cats) == 1 AND $current_verso_cats[0] == $conf['back2front'][0])
    173         {
    174           foreach (explode(',',$item['categories']) as $cat)
    175           {
    176             $datas[] = array(
    177               'image_id' => $_GET['image_id'],
    178               'category_id' => $cat,
    179               );
    180           }
    181           if (isset($datas))
    182           {
    183             mass_inserts(
    184               IMAGE_CATEGORY_TABLE,
    185               array('image_id', 'category_id'),
    186               $datas
    187               );
    188           }
    189         }
    190        
    191         pwg_query("DELETE FROM ".IMAGE_CATEGORY_TABLE."
    192           WHERE image_id = ".$_GET['image_id']." AND category_id = ".$conf['back2front'][0].";");
     216        back2front_restaure_categories($item);
    193217       
    194218        pwg_query("DELETE FROM ".B2F_TABLE."
    195219          WHERE verso_id = ".$_GET['image_id'].";");
    196220         
    197         $template->append('infos', l10n('This picture is no longer a backside'));
     221        array_push($page['infos'], l10n('This picture is no longer a backside'));
    198222      }
    199223    }
     
    203227  if ($template->get_template_vars('B2F_IS_VERSO') == null)
    204228  {
     229    $template->assign('B2F_MOVE_VERSO', 'checked="checked"');
     230   
    205231    /* is the picture a verso ? */
    206232    $query = "
    207       SELECT image_id
     233      SELECT image_id, categories
    208234      FROM ".B2F_TABLE."
    209235      WHERE verso_id = ".$_GET['image_id']."
     
    213239    if (pwg_db_num_rows($result))
    214240    {
    215       list($recto_id) = pwg_db_fetch_row($result);
     241      list($recto_id, $cats) = pwg_db_fetch_row($result);
    216242      $template->assign(array(
    217243        'B2F_IS_VERSO' => 'checked="checked"',
    218244        'B2F_FRONT_ID' => $recto_id,
     245        'B2F_MOVE_VERSO' => $cats != NULL ? 'checked="checked"' : '',
    219246      ));
    220247    }
     
    228255     
    229256      if (pwg_db_num_rows($result))
    230       {
    231         include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
    232        
     257      {     
    233258        $item = pwg_db_fetch_assoc($result);
    234         $query = "SELECT id, name, file
    235           FROM ".IMAGES_TABLE."
    236           WHERE id = ".$item['verso_id'].";";
    237         $item = pwg_db_fetch_assoc(pwg_query($query));
    238        
     259
    239260        $template->assign(array(
    240           'B2F_VERSO_ID' => $item['id'],
    241           'B2F_VERSO_URL' => get_root_url().'admin.php?page=picture_modify&amp;image_id='.$item['id'],
    242           'B2F_VERSO_NAME' => get_image_name($item['name'], $item['file']),
     261          'B2F_VERSO_ID' => $item['verso_id'],
     262          'B2F_VERSO_URL' => get_root_url().'admin.php?page=picture_modify&amp;image_id='.$item['verso_id'],
    243263        ));
    244264      }
     
    246266  }
    247267 
    248   $template->set_filename('B2F_picture_modify', dirname(__FILE__).'/template/picture_modify.tpl');
    249   $template->concat('ADMIN_CONTENT', $template->parse('B2F_picture_modify', true));
     268  $template->set_prefilter('picture_modify', 'Back2front_picture_modify_prefilter');
     269 
     270  return $menu;
    250271}
    251272
    252 function picture_exists($id)
     273
     274function Back2front_picture_modify_prefilter($content, &$smarty)
    253275{
    254   if (!preg_match('#([0-9]{1,})#', $id) OR $id == '0') return false;
    255  
    256   $query = "SELECT id FROM ".IMAGES_TABLE." WHERE id = ".$id.";";
    257   $result = pwg_query($query);
    258  
    259   if (pwg_db_num_rows($result)) return true;
    260   else return false;
     276  $search = '<form id="associations" method="post" action="{$F_ACTION}#associations">';
     277  $replacement = file_get_contents(B2F_PATH.'template/picture_modify.tpl')."\n".$search;
     278  return str_replace($search, $replacement, $content);
    261279}
    262280
  • extensions/Back2Front/language/en_UK/plugin.lang.php

    r10823 r10852  
    44$lang['See front'] = 'See front';
    55$lang['Modify backside information'] = 'Modify backside information';
     6
     7$lang['Switch mode'] = 'Switch mode';
     8$lang['Click'] = 'Click';
     9$lang['Mouseover'] = 'Mouseover';
     10$lang['Fade'] = 'Fade';
    611
    712$lang['This picture is a backside...'] = 'This picture is a backside...';
     
    1217
    1318$lang['Backside and frontside can\'t be the same picture'] = 'Backside and frontside can\'t be the same picture';
    14 $lang['This picture has already a backside : '] = 'This picture has already a backside : ';
    15 $lang['This picture id already a backside : '] = 'This picture is already a backside : ';
    16 $lang['This picture is now the backside of the picture n° '] = 'This picture is now the backside of the picture n° ';
    17 $lang['Unknown id for frontside picture : '] = 'Unknown id for frontside picture : ';
     19$lang['The picture n°%d has already a backside : %s'] = 'The picture n°%d has already a backside : %s';
     20$lang['The picture n°%s is already a backside'] = 'The picture n°%s is already a backside';
     21$lang['This picture is now the backside of the picture n°%s'] = 'This picture is now the backside of the picture n°%s';
     22$lang['Unknown id %d for frontside picture'] = 'Unknown id %d for frontside picture';
    1823$lang['This picture is no longer a backside'] = 'This picture is no longer a backside';
    1924
  • extensions/Back2Front/language/fr_FR/plugin.lang.php

    r10823 r10852  
    44$lang['See front'] = 'Voir le recto';
    55$lang['Modify backside information'] = 'Modifier les informations du verso';
     6
     7$lang['Switch mode'] = 'Interchanger les images au';
     8$lang['Click'] = 'Clic';
     9$lang['Mouseover'] = 'Survol';
     10$lang['Fade'] = 'Fondu';
    611
    712$lang['This picture is a backside...'] = 'Cette image est le verso...';
     
    1217
    1318$lang['Backside and frontside can\'t be the same picture'] = 'Verso et recto ne peuvent être la même image';
    14 $lang['This picture has already a backside : '] = 'Cette image a déjà un verso : ';
    15 $lang['This picture is already a backside : '] = 'Cette image est déjà un verso : ';
    16 $lang['This picture is now the backside of the picture n° '] = 'Cette image est maintenant le verso de l\'image n° ';
    17 $lang['Unknown id for frontside picture : '] = 'Id inconnu pour le recto : ';
     19$lang['The picture n°%d has already a backside : %s'] = 'L\'image n°%d a déjà un verso';
     20$lang['The picture n°%s is already a backside'] = 'L\'image n°%s est déjà un verso';
     21$lang['This picture is now the backside of the picture n°%s'] = 'Cette image est maintenant le verso de l\'image n°%s';
     22$lang['Unknown id %d for frontside picture'] = 'Identifiant %d inconnu';
    1823$lang['This picture is no longer a backside'] = 'Cette image n\'est plus un verso';
    1924
  • extensions/Back2Front/main.inc.php

    r10821 r10852  
    1919include_once(B2F_PATH . 'Back2Front.php');
    2020
    21 add_event_handler('render_element_content', 'Back2Front_picture_content', 99, 2);
    22 add_event_handler('loc_end_admin', 'Back2Front_picture_modify');
     21if (script_basename() == 'picture')
     22{
     23  add_event_handler('render_element_content', 'Back2Front_picture_content', 99, 2);
     24}
     25
     26if (script_basename() == 'admin')
     27{
     28  add_event_handler('get_admin_plugin_menu_links', 'Back2Front_picture_modify');
     29  // add_event_handler('loc_begin_admin_page', 'Back2Front_picture_modify'); /* for Piwigo 2.2.2 */
     30 
     31        add_event_handler('get_admin_plugin_menu_links', 'Back2Front_admin_menu');
     32        function Back2Front_admin_menu($menu)
     33        {
     34                array_push($menu, array(
     35                        'NAME' => 'Back2Front',
     36                        'URL' => get_root_url().'admin.php?page=plugin-' . B2F_DIR));
     37                return $menu;
     38        }
     39}
    2340
    2441?>
  • extensions/Back2Front/maintain.inc.php

    r10821 r10852  
    11<?php
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     3
     4include_once(PHPWG_PLUGINS_PATH.'back2front/functions.inc.php');
    35
    46function plugin_install() {
     
    3436  /* config parameter */
    3537  pwg_query("INSERT INTO `" . CONFIG_TABLE . "`
    36     VALUES ('back2front', '".$versos_cat['id']."', 'Configuration for Back2Front plugin');");
     38    VALUES ('back2front', '".$versos_cat['id'].",click,none', 'Configuration for Back2Front plugin');");
    3739}
    3840
     
    5355  while ($item = pwg_db_fetch_assoc($images_versos))
    5456  {
    55     /* catch current verso categories */
    56     $versos_infos = pwg_query("SELECT category_id FROM ".IMAGE_CATEGORY_TABLE." WHERE image_id = ".$item['verso_id'].";");
    57     while (list($verso_cat) = pwg_db_fetch_row($versos_infos))
    58     {
    59       $item['current_verso_cats'][] = $verso_cat;
    60     }
    61    
    62     /* if verso € 'versos' cat only */
    63     if (count($item['current_verso_cats']) == 1 AND $item['current_verso_cats'][0] == $conf['back2front'][0])
    64     {
    65       foreach (explode(',',$item['categories']) as $cat)
    66       {
    67         $datas[] = array(
    68           'image_id' => $item['verso_id'],
    69           'category_id' => $cat,
    70           );
    71       }
    72     }
    73    
    74     pwg_query("DELETE FROM ".IMAGE_CATEGORY_TABLE."
    75       WHERE image_id = ".$item['verso_id']." AND category_id = ".$conf['back2front'][0].";");
    76   }
    77  
    78   if (isset($datas))
    79   {
    80     mass_inserts(
    81       IMAGE_CATEGORY_TABLE,
    82       array('image_id', 'category_id'),
    83       $datas
    84       );
     57    back2front_restaure_categories($item);
    8558  }
    8659
    87         pwg_query("DROP TABLE `" . $prefixeTable . "image_verso`;");
     60  pwg_query("DROP TABLE `" . $prefixeTable . "image_verso`;");
    8861  pwg_query("DELETE FROM `" . CONFIG_TABLE . "` WHERE param = 'back2front';");
    8962  pwg_query("DELETE FROM `" . CATEGORIES_TABLE ."`WHERE id = ".$conf['back2front'][0].";");
  • extensions/Back2Front/template/picture_content.tpl

    r10821 r10852  
    33{footer_script require="jquery"}
    44jQuery(document).ready(function () {ldelim}
     5
     6{if $b2f_switch_mode == 'click'}
    57  jQuery('.reverse').click(function() {ldelim}
    68    if (jQuery(this).attr('rel') == 'front') {ldelim}
    7       /* picture attributes */
    8       jQuery('#theImage img:first-child').attr({ldelim}
     9{else}
     10  jQuery('.reverse').hover(function() {ldelim}
     11{/if}
     12
     13      /* picture switch */
     14    {if $b2f_transition == 'fade'}
     15      jQuery('img[alt="{$ALT_IMG}"]').animate({ldelim}
     16        opacity:0
     17      }, 400, function() {ldelim}
     18        jQuery(this).animate({ldelim}
     19          width:'{$VERSO_WIDTH}px',
     20          height:'{$VERSO_HEIGHT}px'
     21        }, 200, function() {ldelim}
     22            jQuery(this).attr('src', '{$VERSO_URL}');
     23            jQuery(this).animate({ldelim}
     24              opacity:1
     25            }, 400);
     26        });
     27      });
     28    {else}
     29      jQuery('img[alt="{$ALT_IMG}"]').attr({ldelim}
    930        src: '{$VERSO_URL}',
    10         style: 'width:;height:;',
     31        style: 'width:{$VERSO_WIDTH}px;height:{$VERSO_HEIGHT}px;',
    1132      });
    12      
    13       /* hd link atributes */
     33    {/if}
     34   
     35    {if $b2f_switch_mode == 'click'}
     36      /* hd link */
    1437      {if isset($VERSO_HD)}
    15       jQuery('#theImage a:first-child').attr({ldelim}
     38      jQuery('img[alt="{$ALT_IMG}"]').parent().attr({ldelim}
    1639        href: "javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
    1740      });
    1841      {/if}
    19      
     42   
    2043      /* B2F link content */
    2144      jQuery(this).html('<img src="{$B2F_PATH}template/rotate_2.png"/> {'See front'|@translate}');
    2245      jQuery(this).attr('rel', 'back');
     46    {/if}
    2347     
     48{if $b2f_switch_mode == 'click'}
    2449    } else if (jQuery(this).attr('rel') == 'back') {ldelim}
    25       jQuery('#theImage img:first-child').attr({ldelim}
     50{else}
     51  }, function() {ldelim}
     52{/if}
     53
     54    {if $b2f_transition == 'fade'}
     55      jQuery('img[alt="{$ALT_IMG}"]').animate({ldelim}
     56        opacity:0
     57      }, 400, function() {ldelim}
     58        jQuery(this).animate({ldelim}
     59          width:'{$WIDTH_IMG}px',
     60          height:'{$HEIGHT_IMG}px'
     61        }, 200, function() {ldelim}
     62            jQuery(this).attr('src', '{$SRC_IMG}');
     63            jQuery(this).animate({ldelim}
     64              opacity:1
     65            }, 400);
     66        });
     67      });
     68    {else}
     69      jQuery('img[alt="{$ALT_IMG}"]').attr({ldelim}
    2670        src: '{$SRC_IMG}',
    2771        style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
    2872      });
     73    {/if}
    2974     
    30       {if isset($VERSO_HD)}
    31       jQuery('#theImage a:first-child').attr({ldelim}
    32         href: "javascript:phpWGOpenWindow('{$high.U_HIGH}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')')"
     75    {if $b2f_switch_mode == 'click'}
     76      {if isset($high.U_HIGH)}
     77      jQuery('img[alt="{$ALT_IMG}"]').parent().attr({ldelim}
     78        href: "javascript:phpWGOpenWindow('{$high.U_HIGH}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
    3379      });
    3480      {/if}
     
    3682      jQuery(this).html('<img src="{$B2F_PATH}template/rotate_1.png"/> {'See back'|@translate}');
    3783      jQuery(this).attr('rel', 'front');
     84    {/if}
     85     
     86{if $b2f_switch_mode == 'click'}
    3887    }
    3988  });
     89{else}
     90  });
     91{/if}
     92
    4093});
    4194{/footer_script}
    4295
    43 <a class="reverse" rel="front" href="#">
    44   <img src="{$B2F_PATH}template/rotate_1.png"/>
    45   {'See back'|@translate}
     96<img src="{$VERSO_URL}" style="display:none;"> {* <!-- force preload the verso --> *}
     97
     98<a class="reverse" rel="front" name="verso-link" {if $b2f_switch_mode == 'hover'}href="javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"{/if}>
     99  <img src="{$B2F_PATH}template/rotate_1.png"/> {'See back'|@translate}
    46100</a>
     101<br/>
  • extensions/Back2Front/template/picture_modify.tpl

    r10821 r10852  
    22$(document).ready(function () {ldelim}
    33  $('input[name="b2f_is_verso"]').change(function () {ldelim}
    4     if (this.checked) {ldelim}
    5       $('.frontside_id').css('visibility', '');
    6     } else {ldelim}
    7       $('.frontside_id').css('visibility', 'hidden');
    8     }
     4     $('.frontside_param').toggle();
    95  });
    106});
     
    2117      <tr>
    2218        <td><b>{'This picture has a backside :'|@translate}</b></td>
    23         <td><a href="{$B2F_VERSO_URL}">{$B2F_VERSO_ID} - {$B2F_VERSO_NAME}</a></td>
     19        <td><a href="{$B2F_VERSO_URL}">{$B2F_VERSO_ID}</a></td>
    2420      </tr>
    2521    </table>
    2622  {else}
    27     <table>
     23    <table style="min-width:400px;">
    2824      <tr>
    2925        <td><b>{'This picture is a backside...'|@translate}</b></td>
    30         <td><input type="checkbox" name="b2f_is_verso" {$B2F_IS_VERSO}></td>
     26        <td style="width:70px"><input type="checkbox" name="b2f_is_verso" {$B2F_IS_VERSO}></td>
    3127      </tr>
    32 
    33       <tr class="frontside_id" {if !isset($B2F_IS_VERSO)}style="visibility:hidden;"{/if}>
     28     
     29      <tr class="frontside_param" {if !isset($B2F_IS_VERSO)}style="display:none;"{/if}>
    3430        <td><b>{'...of the picture n°'|@translate}</b></td>
    3531        <td><input type="text" size="4" name="b2f_front_id" value="{$B2F_FRONT_ID}"></td>
    3632      </tr>
    3733     
    38       <tr class="frontside_id" {if !isset($B2F_IS_VERSO)}style="visibility:hidden;"{/if}>
     34      <tr class="frontside_param" {if !isset($B2F_IS_VERSO)}style="display:none;"{/if}>
    3935        <td><b>{'Move backside to private album'|@translate}</b></td>
    40         <td><input type="checkbox" name="b2f_move_verso" checked="checked"></td>
     36        <td><input type="checkbox" name="b2f_move_verso" {$B2F_MOVE_VERSO}></td>
    4137      </tr>
    4238    </table>
  • extensions/Back2Front/template/style.css

    r10819 r10852  
    66  font-size:15px;
    77  font-style:italic;   
     8  height:1em;
    89}
    910a.reverse img {
     11  margin:0 !important;
    1012  vertical-align:top;
    1113  border:none !important;
Note: See TracChangeset for help on using the changeset viewer.