Ignore:
Timestamp:
Aug 1, 2012, 9:03:17 PM (12 years ago)
Author:
rvelices
Message:

merge-r17295 from branch 2.4 feature 2708: in admin, display allowed custom derivatives and ability to delete them

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r16928 r17302  
    107107    'privacy_level',
    108108  );
    109  
     109
    110110// image order management
    111111$sort_fields = array(
     
    127127  'rank ASC'            => l10n('Manual sort order'),
    128128  );
    129  
     129
    130130$comments_order = array(
    131131  'ASC' => l10n('Show oldest comments first'),
     
    142142  {
    143143    case 'main' :
    144     {     
     144    {
    145145      if ( !isset($conf['order_by_custom']) and !isset($conf['order_by_inside_category_custom']) )
    146146      {
     
    159159            // limit to the number of available parameters
    160160            $order_by = $order_by_inside_category = array_slice($_POST['order_by'], 0, ceil(count($sort_fields)/2));
    161            
     161
    162162            // there is no rank outside categories
    163163            if ( ($i = array_search('rank ASC', $order_by)) !== false)
     
    165165              unset($order_by[$i]);
    166166            }
    167            
     167
    168168            // must define a default order_by if user want to order by rank only
    169169            if ( count($order_by) == 0 )
     
    171171              $order_by = array('id ASC');
    172172            }
    173            
     173
    174174            $_POST['order_by'] = 'ORDER BY '.implode(', ', $order_by);
    175175            $_POST['order_by_inside_category'] = 'ORDER BY '.implode(', ', $order_by_inside_category);
     
    181181        }
    182182      }
    183      
     183
    184184      foreach( $main_checkboxes as $checkbox)
    185185      {
     
    190190    case 'watermark' :
    191191    {
    192       include(PHPWG_ROOT_PATH.'admin/include/configuration_watermark_process.inc.php');       
     192      include(PHPWG_ROOT_PATH.'admin/include/configuration_watermark_process.inc.php');
    193193      break;
    194194    }
    195195    case 'sizes' :
    196196    {
    197       include(PHPWG_ROOT_PATH.'admin/include/configuration_sizes_process.inc.php');       
     197      include(PHPWG_ROOT_PATH.'admin/include/configuration_sizes_process.inc.php');
    198198      break;
    199199    }
     
    303303{
    304304  case 'main' :
    305   {   
    306    
     305  {
     306
    307307    function order_by_is_local()
    308308    {
     
    312312        @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php');
    313313      }
    314      
     314
    315315      return isset($conf['order_by']) or isset($conf['order_by_inside_category']);
    316316    }
    317    
     317
    318318    if (order_by_is_local())
    319319    {
    320320      array_push($page['warnings'], l10n('You have specified <i>$conf[\'order_by\']</i> in your local configuration file, this parameter in deprecated, please remove it or rename it into <i>$conf[\'order_by_custom\']</i> !'));
    321321    }
    322    
     322
    323323    if ( isset($conf['order_by_custom']) or isset($conf['order_by_inside_category_custom']) )
    324324    {
     
    333333      $order_by = explode(', ', $order_by);
    334334    }
    335  
     335
    336336    $template->assign(
    337337      'main',
     
    441441          )
    442442        );
    443      
     443
    444444      foreach ($sizes_checkboxes as $checkbox)
    445445      {
     
    452452          );
    453453      }
    454      
     454
    455455      // derivatives = multiple size
    456456      $enabled = ImageStdParams::get_defined_type_map();
     
    465465      {
    466466        $tpl_var = array();
    467        
     467
    468468        $tpl_var['must_square'] = ($type==IMG_SQUARE ? true : false);
    469469        $tpl_var['must_enable'] = ($type==IMG_SQUARE || $type==IMG_THUMB)? true : false;
    470        
     470
    471471        if ($params = @$enabled[$type])
    472472        {
     
    478478          $params=@$disabled[$type];
    479479        }
    480        
     480
    481481        if ($params)
    482482        {
     
    496496      $template->assign('derivatives', $tpl_vars);
    497497      $template->assign('resize_quality', ImageStdParams::$quality);
     498
     499      $tpl_vars = array();
     500      $now = time();
     501      foreach(ImageStdParams::$custom as $custom=>$time)
     502      {
     503        $tpl_vars[$custom] = ($now-$time<=24*3600) ? l10n('today') : time_since($time, 'day');
     504      }
     505      $template->assign('custom_derivatives', $tpl_vars);
    498506    }
    499507
     
    547555        $position = 'bottomright';
    548556      }
    549      
     557
    550558      if ($wm->xrepeat != 0)
    551559      {
    552560        $position = 'custom';
    553561      }
    554    
     562
    555563      $template->assign(
    556564        'watermark',
     
    567575        );
    568576    }
    569    
     577
    570578    break;
    571579  }
Note: See TracChangeset for help on using the changeset viewer.