Changeset 25629


Ignore:
Timestamp:
11/21/13 21:13:41 (6 years ago)
Author:
mistic100
Message:
  • add "Add photos" link for albums
  • fix empty username if viewing as "guest"
Location:
extensions/AdminTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/AdminTools/include/events.inc.php

    r25619 r25629  
    1111  } 
    1212 
    13   global $template, $page; 
     13  global $template, $page, $user; 
    1414 
    1515  $url_root = get_root_url(); 
     
    2020    'U_SELF' => $MultiView->get_clean_url(true), 
    2121    'USER' => $MultiView->get_user(), 
     22    'CURRENT_USERNAME' => $user['id']==$conf['guest_id'] ? l10n('guest') : $user['username'], 
    2223    ); 
    2324 
     
    3738      )); 
    3839 
     40    $query = 'SELECT element_id FROM ' . CADDIE_TABLE . ' 
     41      WHERE element_id = ' . $page['image_id'] .';'; 
     42    $tpl_vars['IS_IN_CADDIE'] = pwg_db_num_rows(pwg_query($query)) > 0; 
     43 
    3944    if (isset($page['category'])) 
    4045    { 
     46      $tpl_vars['CATEGORY_ID'] = $page['category']['id']; 
     47 
    4148      $tpl_vars['U_SET_REPRESENTATIVE'] = add_url_params( 
    4249        $url_self, 
    4350        array('action'=>'set_as_representative') 
    4451        ); 
    45       $tpl_vars['CATEGORY_ID'] = $page['category']['id']; 
     52 
     53      $query = 'SELECT id FROM ' . CATEGORIES_TABLE.' 
     54        WHERE id = ' . $page['category']['id'] .' 
     55        AND representative_picture_id = ' . $page['image_id'] .';'; 
     56      $tpl_vars['IS_REPRESENTATIVE'] = pwg_db_num_rows(pwg_query($query)) > 0; 
    4657    } 
    4758 
  • extensions/AdminTools/template/public_controller.tpl

    r25619 r25629  
    22{combine_css path='admin/themes/default/fontello/css/fontello.css'} 
    33{combine_css path=$ADMINTOOLS_PATH|cat:'template/fontello/css/fontello-ato.css'} 
    4  
    5 {capture assign=users_options} {html_options options=$ato.USERS  selected=$ato.MULTIVIEW.view_as}{/capture} 
    6 {capture assign=themes_options}{html_options options=$ato.THEMES selected=$ato.MULTIVIEW.theme}{/capture} 
    7 {capture assign=langs_options} {html_options options=$ato.LANGS  selected=$ato.MULTIVIEW.lang}{/capture} 
    84 
    95<div id="ato_header_closed"><a href="#" class="icon-tools"></a></div> 
     
    1410    <li class="parent"><a href="#" class="icon-menu">{'Admin panel'|translate}</a> 
    1511      <ul> 
    16         <li><a class="icon-picture" href="{$ato.U_SITE_ADMIN}photos_add">{'Photos'|translate}</a></li> 
     12        <li><a class="icon-picture" href="{$ato.U_SITE_ADMIN}batch_manager">{'Photos'|translate}</a></li> 
    1713        <li><a class="icon-sitemap" href="{$ato.U_SITE_ADMIN}cat_list">{'Albums'|translate}</a></li> 
    1814        <li><a class="icon-users" href="{$ato.U_SITE_ADMIN}user_list">{'Users'|translate}</a></li> 
     
    3127  {/if} 
    3228  {if isset($ato.U_SET_REPRESENTATIVE)} 
    33     <li><a class="icon-ato-trophy set-representative" href="{$ato.U_SET_REPRESENTATIVE}">{'representative'|translate|ucfirst}</a></li> 
     29    <li {if $ato.IS_REPRESENTATIVE}class="disabled"{/if}><a class="icon-ato-trophy set-representative" href="{$ato.U_SET_REPRESENTATIVE}">{'representative'|translate|ucfirst}</a></li> 
    3430  {/if} 
    3531  {if isset($ato.U_CADDIE)} 
    36     <li><a class="icon-ato-flag add-caddie" href="{$ato.U_CADDIE}">{'Add to caddie'|translate}</a></li> 
     32    <li {if $ato.IS_IN_CADDIE}class="disabled"{/if}><a class="icon-ato-flag add-caddie" href="{$ato.U_CADDIE}">{'Add to caddie'|translate}</a></li> 
    3733  {/if} 
     34  {if isset($ato.IS_CATEGORY)} 
     35    <li><a class="icon-plus-circled" href="{$ato.U_SITE_ADMIN}photos_add&amp;album={$ato.CATEGORY_ID}">{'Add Photos'|translate}</a></li> 
     36  {/if} 
     37 
    3838    <li class="parent right"><a class="icon-cog-alt" href="#">{'Tools'|translate}</a> 
    3939      <ul> 
    4040        <li><label>View as</label> 
    4141          <select class="switcher" data-type="view_as"> 
    42             {$users_options} 
     42            {html_options options=$ato.USERS selected=$ato.MULTIVIEW.view_as} 
    4343          </select> 
    4444        </li> 
    4545        <li><label>Theme</label> 
    4646          <select class="switcher" data-type="theme"> 
    47             {$themes_options} 
     47            {html_options options=$ato.THEMES selected=$ato.MULTIVIEW.theme} 
    4848          </select> 
    4949        </li> 
    5050        <li><label>Language</label> 
    5151          <select class="switcher" data-type="lang"> 
    52             {$langs_options} 
     52            {html_options options=$ato.LANGS selected=$ato.MULTIVIEW.lang} 
    5353          </select> 
    5454        </li> 
     
    6161      </ul> 
    6262    </li> 
    63   {if $ato.USER.username != $USERNAME} 
     63  {if $ato.USER.id != $ato.MULTIVIEW.view_as} 
    6464    <li class="right"> 
    65       &nbsp;&nbsp;{'Logged as <b>%s</b>, viewing as <b>%s</b>.'|translate:$ato.USER.username:$USERNAME} 
    66       <a href="{$ato.U_SELF}view_as={$ato.USER.id}">{'Go back'|translate}</a> 
     65      &nbsp;&nbsp;{'Logged as <b>%s</b>, viewing as <b>%s</b>.'|translate:$ato.USER.username:$ato.CURRENT_USERNAME} 
     66      <a href="{$ato.U_SELF}view_as={$ato.USER.id}">{'Revert'|translate}</a> 
    6767    </li> 
    6868  {/if} 
Note: See TracChangeset for help on using the changeset viewer.