Changeset 9051


Ignore:
Timestamp:
Feb 2, 2011, 10:35:48 AM (10 years ago)
Author:
plg
Message:

bug 2172 fixed: the "sort order" options are removed from the album administration main page.

bug 2173 fixed: rename "manual order" into "automatic order" and "by rank" into "manual order"

bug 2174 fixed: only show the automatic order options when it's relevant

new icon for the "manage photo order" screen

hide the numeric rank below the thumbnail (it is confusing for users)

tell users that you can drag'n drop to reorder photos

bug fixed: the "apply to sub-albums" options for photo orders was not working

Location:
trunk/admin
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/cat_modify.php

    r8728 r9051  
    4545if (isset($_POST['submit']))
    4646{
    47   $image_order = null;
    48   if ( !isset($_POST['image_order_default']) )
    49   {
    50     for ($i=1; $i<=3; $i++)
    51     {
    52       if ( !empty($_POST['order_field_'.$i]) )
    53       {
    54         if (! empty($image_order) )
    55         {
    56           $image_order .= ',';
    57         }
    58         $image_order .= $_POST['order_field_'.$i];
    59         if ($_POST['order_direction_'.$i]=='DESC')
    60         {
    61           $image_order .= ' DESC';
    62         }
    63       }
    64     }
    65   }
    66 
    6747  $data =
    6848    array(
     
    7353        $conf['allow_html_descriptions'] ?
    7454          @$_POST['comment'] : strip_tags(@$_POST['comment']),
    75       'image_order' => $image_order,
    7655      );
    7756
     
    8766  // retrieve cat infos before continuing (following updates are expensive)
    8867  $cat_info = get_cat_info($_GET['cat_id']);
    89 
    90   if (isset($_POST['image_order_subcats']))
    91   {
    92     $query = '
    93 UPDATE '.CATEGORIES_TABLE.' SET image_order='.(isset($image_order) ? 'NULL':'\''.$image_order.'\'').'
    94   WHERE uppercats LIKE \''.$cat_info['uppercats'].',%\'';
    95     pwg_query($query);
    96   }
    9768
    9869  if ($cat_info['visible'] != get_boolean( $_POST['visible'] ) )
     
    245216    'CAT_COMMENTABLE'   => boolean_to_string($category['commentable']),
    246217
    247     'IMG_ORDER_DEFAULT'  => empty($category['image_order']) ?
    248                               'checked="checked"' : '',
    249 
    250218    'U_JUMPTO' => make_index_url(
    251219      array(
     
    278246    $base_url.'batch_manager&amp;cat='.$category['id']
    279247    );
    280   $template->assign(
    281     'U_MANAGE_RANKS',
    282     $base_url.'element_set_ranks&amp;cat_id='.$category['id']
    283     );
    284 }
     248}
     249
     250$template->assign(
     251  'U_MANAGE_RANKS',
     252  $base_url.'element_set_ranks&amp;cat_id='.$category['id']
     253  );
    285254
    286255if ($category['is_virtual'])
     
    303272    );
    304273}
    305 
    306 // image order management
    307 
    308 $sort_fields = array(
    309   '' => '',
    310   'date_creation' => l10n('Creation date'),
    311   'date_available' => l10n('Post date'),
    312   'average_rate' => l10n('Average rate'),
    313   'hit' => l10n('Most visited'),
    314   'file' => l10n('File name'),
    315   'id' => 'Id',
    316   'rank' => l10n('Rank'),
    317   );
    318 
    319 $sort_directions = array(
    320   'ASC' => l10n('ascending'),
    321   'DESC' => l10n('descending'),
    322   );
    323 
    324 $template->assign( 'image_order_field_options', $sort_fields);
    325 $template->assign( 'image_order_direction_options', $sort_directions);
    326 
    327 $matches = array();
    328 if ( !empty( $category['image_order'] ) )
    329 {
    330   preg_match_all('/([a-z_]+) *(?:(asc|desc)(?:ending)?)? *(?:, *|$)/i',
    331     $category['image_order'], $matches);
    332 }
    333 
    334 for ($i=0; $i<3; $i++) // 3 fields
    335 {
    336   $tpl_image_order_select = array(
    337       'ID' => $i+1,
    338       'FIELD' => array(''),
    339       'DIRECTION' => array('ASC'),
    340     );
    341 
    342   if ( isset($matches[1][$i]) )
    343   {
    344     $tpl_image_order_select['FIELD'] = array($matches[1][$i]);
    345   }
    346 
    347   if (isset($matches[2][$i]) and strcasecmp($matches[2][$i],'DESC')==0)
    348   {
    349     $tpl_image_order_select['DIRECTION'] = array('DESC');
    350   }
    351   $template->append( 'image_orders', $tpl_image_order_select);
    352 }
    353 
    354274
    355275// representant management
  • trunk/admin/element_set_ranks.php

    r8728 r9051  
    9090if (isset($_POST['submit']))
    9191{
    92   asort($_POST['rank_of_image'], SORT_NUMERIC);
     92  if (isset($_POST['rank_of_image']))
     93  {
     94    asort($_POST['rank_of_image'], SORT_NUMERIC);
    9395 
    94   save_images_order(
    95     $page['category_id'],
    96     array_keys($_POST['rank_of_image'])
    97     );
    98 
    99   array_push(
    100     $page['infos'],
    101     l10n('Images manual order was saved')
    102     );
     96    save_images_order(
     97      $page['category_id'],
     98      array_keys($_POST['rank_of_image'])
     99      );
     100
     101    array_push(
     102      $page['infos'],
     103      l10n('Images manual order was saved')
     104      );
     105  }
    103106
    104107  $image_order = null;
     
    135138  WHERE id='.$page['category_id'];
    136139  pwg_query($query);
     140
     141  if (isset($_POST['image_order_subcats']))
     142  {
     143    $cat_info = get_cat_info($page['category_id']);
     144   
     145    $query = '
     146UPDATE '.CATEGORIES_TABLE.'
     147  SET image_order = '.(isset($image_order) ? '\''.$image_order.'\'' : 'NULL').'
     148  WHERE uppercats LIKE \''.$cat_info['uppercats'].',%\'';
     149    pwg_query($query);
     150  }
     151
     152  array_push($page['infos'], l10n('Your configuration settings are saved'));
    137153}
    138154
  • trunk/admin/themes/clear/theme.css

    r8732 r9051  
    262262.languageName {color:black;}
    263263.languageDefault {background-color:#dbe8f3;}
     264
     265UL.thumbnails li.rank-of-image {
     266  background-color: #ddd;
     267}
  • trunk/admin/themes/default/template/cat_modify.tpl

    r8727 r9051  
    1515  {if isset($U_MANAGE_ELEMENTS) }
    1616  <li><a href="{$U_MANAGE_ELEMENTS}" title="{'manage album photos'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/category_elements.png" class="button" alt="{'Photos'|@translate}"></a></li>
     17  {/if}
    1718  <li><a href="{$U_MANAGE_RANKS}" title="{'manage photo ranks'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/ranks.png" class="button" alt="{'ranks'|@translate}"></a></li>
    18   {/if}
    1919  <li><a href="{$U_CHILDREN}" title="{'manage sub-albums'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/category_children.png" class="button" alt="{'sub-albums'|@translate}"></a></li>
    2020  {if isset($U_MANAGE_PERMISSIONS) }
     
    8989</fieldset>
    9090
    91 <fieldset id="image_order">
    92   <legend>{'Sort order'|@translate}</legend>
    93   <input type="checkbox" name="image_order_default" id="image_order_default" {$IMG_ORDER_DEFAULT}>
    94   <label for="image_order_default">{'Use the default photo sort order (defined in the configuration file)'|@translate}</label>
    95   <br>
    96   <input type="checkbox" name="image_order_subcats" id="image_order_subcats">
    97   <label for="image_order_subcats">{'Apply to sub-albums'|@translate}</label>
    98   <br>
    99  
    100   {foreach from=$image_orders item=order}
    101     <select name="order_field_{$order.ID}">
    102       {html_options options=$image_order_field_options selected=$order.FIELD }
    103     </select>
    104     <select name="order_direction_{$order.ID}">
    105       {html_options options=$image_order_direction_options selected=$order.DIRECTION }
    106     </select><br>
    107   {/foreach}
    108  
    109 </fieldset>
    110 
    11191<p style="text-align:center;">
    11292  <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit">
  • trunk/admin/themes/default/template/element_set_ranks.tpl

    r9039 r9051  
    3737<h3>{$CATEGORIES_NAV}</h3>
    3838
     39<form action="{$F_ACTION}" method="post">
    3940{if !empty($thumbnails)}
    40 <form action="{$F_ACTION}" method="post">
    4141  <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit"></p>
    4242  <fieldset>
    43     <legend>{'Edit ranks'|@translate}</legend>
     43    <legend>{'Manual order'|@translate}</legend>
    4444    {if !empty($thumbnails)}
     45    <p>{'Drag to re-order'|@translate}</p>
    4546    <ul class="thumbnails">
    4647      {foreach from=$thumbnails item=thumbnail}
     
    5152          </div>
    5253        </div>
    53         <input type="text" name="rank_of_image[{$thumbnail.ID}]" value="{$thumbnail.RANK}">
     54        <input type="text" name="rank_of_image[{$thumbnail.ID}]" value="{$thumbnail.RANK}" style="display:none">
    5455      </li>
    5556      {/foreach}
     
    5758    {/if}
    5859  </fieldset>
     60{/if}
    5961
    6062  <fieldset>
     
    6668    <p class="field">
    6769      <input type="radio" name="image_order_choice" id="image_order_rank" value="rank"{if $image_order_choice=='rank'} checked="checked"{/if}>
    68       <label for="image_order_rank">{'By rank'|@translate}</label>
     70      <label for="image_order_rank">{'manual order'|@translate}</label>
    6971    </p>
    7072    <p class="field">
    7173      <input type="radio" name="image_order_choice" id="image_order_user_define" value="user_define"{if $image_order_choice=='user_define'} checked="checked"{/if}>
    72       <label for="image_order_user_define">{'Manual order'|@translate}</label>
     74      <label for="image_order_user_define">{'automatic order'|@translate}</label>
    7375      <div id="image_order_user_define_options">
    7476      {foreach from=$image_orders item=order}
     
    8486      </div>
    8587  </fieldset>
    86   <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit"></p>
     88  <p>
     89    <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit">
     90
     91    <label>
     92      <input type="checkbox" name="image_order_subcats" id="image_order_subcats">
     93      {'Apply to sub-albums'|@translate}
     94    </label>
     95  </p>
    8796</form>
    88 
    89 
    90 {else}
    91 <div class="infos"><p>{'No photo in this album'|@translate}</p></div>
    92 {/if}
  • trunk/admin/themes/default/thumbnails.css

    r7869 r9051  
    77UL.thumbnails li.rank-of-image {
    88  float: left;
    9   background-color: #111;
    10   border: 1px solid #666;
     9  background-color: #333;
    1110  color: #666;
    12   -moz-border-radius: 4px;
     11  -moz-border-radius: 5px;
    1312  display: block;
    1413  width: 104px;
    15   height: 128px;
     14  height: 104px;
    1615  cursor: move;
    1716  margin: 10px;
     
    1918UL.thumbnails li.rank-of-image img {
    2019  margin: 0 20px;
    21   padding: 4px 2px;
     20  padding: 8px 2px;
    2221  float: left;
    2322}
     
    3130}
    3231UL.thumbnails li.rank-of-image input {
    33   height: 12px;
    34   width: 50px;
    35   position: relative;
    36   top: 4px; 
    3732}
    3833UL.thumbnails SPAN.wrap1 {
Note: See TracChangeset for help on using the changeset viewer.