Ignore:
Timestamp:
Feb 14, 2007, 11:53:02 PM (17 years ago)
Author:
plg
Message:

New: history logs high quality access via action.php. A new column
#history.is_high was added. Filter was added on administration history
detail view.

Modification: function get_sql_condition_FandF was slightly refactored for
presentation improvement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/history.php

    r1782 r1817  
    9595  }
    9696
     97  $search['fields']['pictures'] = $_POST['pictures'];
     98  $search['fields']['high'] = $_POST['high'];
     99 
    97100  // echo '<pre>'; print_r($search); echo '</pre>';
    98101 
     
    182185  }
    183186
     187  if (isset($page['search']['fields']['pictures']))
     188  {
     189    $clause = null;
     190   
     191    if ($page['search']['fields']['pictures'] == 'no')
     192    {
     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);
     224    }
     225  }
     226 
    184227  $clauses = prepend_append_array_items($clauses, '(', ')');
    185228
     
    199242
    200243  $query = '
    201 SELECT date, time, user_id, IP, section, category_id, tag_ids, image_id
     244SELECT
     245    date,
     246    time,
     247    user_id,
     248    IP,
     249    section,
     250    category_id,
     251    tag_ids,
     252    image_id,
     253    is_high
    202254  FROM '.HISTORY_TABLE.'
    203255  WHERE '.$where_separator.'
     
    299351        )
    300352      );
     353
     354    if (isset($line['image_id']))
     355    {
     356      if ($line['is_high'] == 'true')
     357      {
     358        $template->assign_block_vars('detail.high', array());
     359      }
     360      else
     361      {
     362        $template->assign_block_vars('detail.no_high', array());
     363      }
     364    }
    301365  }
    302366}
     
    352416  {
    353417    $tokens = explode('-', $page['search']['fields']['date-before']);
    354    
    355      (int)$tokens[0];
    356      (int)$tokens[1];
    357      (int)$tokens[2];
    358   }
     418
     419    $form['end_year']  = (int)$tokens[0];
     420    $form['end_month'] = (int)$tokens[1];
     421    $form['end_day']   = (int)$tokens[2];
     422  }
     423
     424  $form['pictures'] = $page['search']['fields']['pictures'];
     425  $form['high'] = $page['search']['fields']['high'];
    359426}
    360427else
     
    365432  $form['start_month'] = $form['end_month'] = date('n');
    366433  $form['start_day']   = $form['end_day']   = date('j');
     434  $form['pictures'] = 'yes';
     435  $form['high'] = 'yes';
    367436}
    368437
     
    380449    )
    381450  );
     451
     452foreach (array('pictures', 'high') as $block)
     453{
     454  foreach (array('yes', 'no', 'only') as $item)
     455  {
     456    $selected = '';
     457   
     458    if ($item == $form[$block])
     459    {
     460      $selected = 'selected="selected"';
     461    }
     462   
     463    $template->assign_block_vars(
     464      $block.'_option',
     465      array(
     466        'VALUE' => $item,
     467        'CONTENT' => l10n($item),
     468        'SELECTED' => $selected,
     469        )
     470      );
     471  }
     472}
    382473 
    383474// +-----------------------------------------------------------------------+
Note: See TracChangeset for help on using the changeset viewer.