Ignore:
Timestamp:
Feb 21, 2007, 12:40:02 AM (17 years ago)
Author:
plg
Message:

New: non picture files are now logged in history when downloaded. The
history filter was redesigned: #history.is_high replaced by
#history.image_type = high. The filter is simpler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/history.php

    r1821 r1844  
    5959}
    6060
     61$types = array('none', 'picture', 'high', 'other');
     62
    6163// +-----------------------------------------------------------------------+
    6264// | Check Access and exit when user status is not ok                      |
     
    9597  }
    9698
    97   $search['fields']['pictures'] = $_POST['pictures'];
    98   $search['fields']['high'] = $_POST['high'];
     99  $search['fields']['types'] = $_POST['types'];
    99100 
    100101  // echo '<pre>'; print_r($search); echo '</pre>';
     
    185186  }
    186187
    187   if (isset($page['search']['fields']['pictures']))
    188   {
    189     $clause = null;
     188  if (isset($page['search']['fields']['types']))
     189  {
     190    $local_clauses = array();
    190191   
    191     if ($page['search']['fields']['pictures'] == 'no')
     192    foreach ($types as $type) {
     193      if (in_array($type, $page['search']['fields']['types'])) {
     194        $clause = 'image_type ';
     195        if ($type == 'none')
     196        {
     197          $clause.= 'IS NULL';
     198        }
     199        else
     200        {
     201          $clause.= "= '".$type."'";
     202        }
     203       
     204        array_push($local_clauses, $clause);
     205      }
     206    }
     207   
     208    if (count($local_clauses) > 0)
    192209    {
    193       $clause = 'image_id IS NULL';
    194     }
    195 
    196     if ($page['search']['fields']['pictures'] == 'only')
    197     {
    198       $clause = 'image_id IS NOT NULL';
    199     }
    200 
    201     if (isset($clause))
    202     {
    203       array_push($clauses, $clause);
    204     }
    205   }
    206 
    207   if (isset($page['search']['fields']['high']))
    208   {
    209     $clause = null;
    210    
    211     if ($page['search']['fields']['high'] == 'no')
    212     {
    213       $clause = "is_high IS NULL or is_high = 'false'";
    214     }
    215 
    216     if ($page['search']['fields']['high'] == 'only')
    217     {
    218       $clause = "is_high = 'true'";
    219     }
    220 
    221     if (isset($clause))
    222     {
    223       array_push($clauses, $clause);
     210      array_push(
     211        $clauses,
     212        implode(' OR ', $local_clauses)
     213        );
    224214    }
    225215  }
     
    237227  FROM '.HISTORY_TABLE.'
    238228  WHERE '.$where_separator.'
    239 ';
    240 
     229;';
     230
     231  // echo '<pre>'.$query.'</pre>';
     232 
    241233  list($page['nb_lines']) = mysql_fetch_row(pwg_query($query));
    242234
     
    251243    tag_ids,
    252244    image_id,
    253     is_high
     245    image_type
    254246  FROM '.HISTORY_TABLE.'
    255247  WHERE '.$where_separator.'
     
    345337                : 'deleted '.$line['image_id'])
    346338          : $line['image_id'],
     339        'TYPE'      => $line['image_type'],
    347340        'SECTION'   => $line['section'],
    348341        'CATEGORY'  => isset($line['category_id'])
     
    355348        )
    356349      );
    357 
    358     if (isset($line['image_id']))
    359     {
    360       if ($line['is_high'] == 'true')
    361       {
    362         $template->assign_block_vars('detail.high', array());
    363       }
    364       else
    365       {
    366         $template->assign_block_vars('detail.no_high', array());
    367       }
    368     }
    369350  }
    370351}
     
    426407  }
    427408
    428   $form['pictures'] = $page['search']['fields']['pictures'];
    429   $form['high'] = $page['search']['fields']['high'];
     409  $form['types'] = $page['search']['fields']['types'];
    430410}
    431411else
     
    436416  $form['start_month'] = $form['end_month'] = date('n');
    437417  $form['start_day']   = $form['end_day']   = date('j');
    438   $form['pictures'] = 'yes';
    439   $form['high'] = 'yes';
     418  $form['types'] = $types;
    440419}
    441420
     
    454433  );
    455434
    456 foreach (array('pictures', 'high') as $block)
    457 {
    458   foreach (array('yes', 'no', 'only') as $item)
    459   {
    460     $selected = '';
    461    
    462     if ($item == $form[$block])
    463     {
    464       $selected = 'selected="selected"';
    465     }
    466    
    467     $template->assign_block_vars(
    468       $block.'_option',
    469       array(
    470         'VALUE' => $item,
    471         'CONTENT' => l10n($item),
    472         'SELECTED' => $selected,
    473         )
    474       );
    475   }
     435foreach ($types as $option)
     436{
     437  $selected = '';
     438 
     439  if (in_array($option, $form['types']))
     440  {
     441    $selected = 'selected="selected"';
     442  }
     443 
     444  $template->assign_block_vars(
     445    'types_option',
     446    array(
     447      'VALUE' => $option,
     448      'CONTENT' => l10n($option),
     449      'SELECTED' => $selected,
     450      )
     451    );
    476452}
    477453 
Note: See TracChangeset for help on using the changeset viewer.