Changeset 6614


Ignore:
Timestamp:
Jun 28, 2010, 9:42:37 PM (10 years ago)
Author:
rvelices
Message:

favorite image icon is not taken from php but left to the theme (still in the php for the branch for theme compatibility)

Location:
branches/2.1
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1/picture.php

    r6592 r6614  
    313313    {
    314314      check_pwg_token();
    315  
     315
    316316      include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    317317
     
    319319
    320320      $author_id = get_comment_author_id($_GET['comment_to_edit']);
    321      
     321
    322322      if (can_manage_comment('edit', $author_id))
    323323      {
     
    332332            $_POST['key']
    333333            );
    334          
     334
    335335          redirect($url_self);
    336336        }
     
    345345    {
    346346      check_pwg_token();
    347  
     347
    348348      include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    349      
     349
    350350      check_input_parameter('comment_to_delete', $_GET, false, PATTERN_ID);
    351351
    352352      $author_id = get_comment_author_id($_GET['comment_to_delete']);
    353      
     353
    354354      if (can_manage_comment('delete', $author_id))
    355355      {
    356356        delete_user_comment($_GET['comment_to_delete']);
    357357      }
    358      
     358
    359359      redirect($url_self);
    360360    }
     
    362362    {
    363363      check_pwg_token();
    364  
     364
    365365      include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    366366
    367367      check_input_parameter('comment_to_validate', $_GET, false, PATTERN_ID);
    368      
     368
    369369      $author_id = get_comment_author_id($_GET['comment_to_validate']);
    370      
     370
    371371      if (can_manage_comment('validate', $author_id))
    372372      {
    373373        validate_user_comment($_GET['comment_to_validate']);
    374374      }
    375      
     375
    376376      redirect($url_self);
    377377    }
     
    797797    AND user_id = '.$user['id'].'
    798798;';
    799   $result = pwg_query($query);
    800   $row = pwg_db_fetch_assoc($result);
    801 
    802   if ($row['nb_fav'] == 0)
    803   {
    804     $template->assign(
    805       'favorite',
    806       array(
    807         'FAVORITE_IMG'  =>
    808           get_root_url().get_themeconf('icon_dir').'/favorite.png',
    809         'FAVORITE_HINT' => l10n('add this image to your favorites'),
    810         'U_FAVORITE'    => add_url_params(
    811           $url_self,
    812           array('action'=>'add_to_favorites')
    813           ),
    814         )
    815       );
    816   }
    817   else
    818   {
    819     $template->assign(
    820       'favorite',
    821       array(
    822         'FAVORITE_IMG'  =>
    823           get_root_url().get_themeconf('icon_dir').'/del_favorite.png',
    824         'FAVORITE_HINT' => l10n('delete this image from your favorites'),
    825         'U_FAVORITE'    => add_url_params(
    826           $url_self,
    827           array('action'=>'remove_from_favorites')
    828           ),
    829         )
    830       );
    831   }
     799  $row = pwg_db_fetch_assoc( pwg_query($query) );
     800        $is_favorite = $row['nb_fav'] != 0;
     801
     802  $template->assign(
     803    'favorite',
     804    array(
     805                        'IS_FAVORITE' => $is_favorite,
     806      'FAVORITE_IMG'  =>
     807        get_root_url().get_themeconf('icon_dir').(!$is_favorite ? '/favorite.png' : '/del_favorite.png' ),
     808      'FAVORITE_HINT' => l10n( !$is_favorite ? 'add this image to your favorites' : 'delete this image from your favorites'),
     809      'U_FAVORITE'    => add_url_params(
     810        $url_self,
     811        array('action'=> !$is_favorite ? 'add_to_favorites' : 'remove_from_favorites' )
     812        ),
     813      )
     814    );
    832815}
    833816
  • branches/2.1/themes/default/template/index.tpl

    r5535 r6614  
    1616
    1717      {if isset($favorite) }
    18       <li><a href="{$favorite.U_FAVORITE}" title="{'delete all images from your favorites'|@translate}"><img src="{$favorite.FAVORITE_IMG}" class="button" alt="favorite" title="{'delete all images from your favorites'|@translate}"></a></li>
     18      <li><a href="{$favorite.U_FAVORITE}" title="{'delete all images from your favorites'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/del_all_favorites.png" class="button" alt="favorite" title="{'delete all images from your favorites'|@translate}"></a></li>
    1919      {/if}
    2020
  • branches/2.1/themes/default/template/picture.tpl

    r6508 r6614  
    5151    {if isset($PLUGIN_PICTURE_ACTIONS)}{$PLUGIN_PICTURE_ACTIONS}{/if}
    5252    {if isset($favorite) }
    53       <a href="{$favorite.U_FAVORITE}" title="{$favorite.FAVORITE_HINT}"><img src="{$favorite.FAVORITE_IMG}" class="button" alt="favorite" title="{$favorite.FAVORITE_HINT}"></a>
     53      <a href="{$favorite.U_FAVORITE}" title="{if $favorite.IS_FAVORITE}{'delete this image from your favorites'|@translate}{else}{'add this image to your favorites'|@translate}{/if}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/{if $favorite.IS_FAVORITE}del_favorite{else}favorite{/if}.png" class="button" alt="favorite" title="{if $favorite.IS_FAVORITE}{'delete this image from your favorites'|@translate}{else}{'add this image to your favorites'|@translate}{/if}"></a>
    5454    {/if}
    5555    {if !empty($U_SET_AS_REPRESENTATIVE) }
Note: See TracChangeset for help on using the changeset viewer.