Changeset 1844


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.

Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/action.php

    r1817 r1844  
    128128
    129129if ($_GET['part'] == 'h') {
    130   $is_high = true;
    131   pwg_log($_GET['id'], $is_high);
     130  pwg_log($_GET['id'], 'high');
     131}
     132else if ($_GET['part'] == 'e')
     133{
     134  pwg_log($_GET['id'], 'other');
    132135}
    133136
  • 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 
  • trunk/include/functions.inc.php

    r1817 r1844  
    411411}
    412412
    413 function pwg_log($image_id = null, $is_high = false)
     413function pwg_log($image_id = null, $image_type = null)
    414414{
    415415  global $conf, $user, $page;
     
    469469    category_id,
    470470    image_id,
    471     is_high,
     471    image_type,
    472472    tag_ids
    473473  )
     
    485485    '.(isset($page['category']) ? $page['category'] : 'NULL').',
    486486    '.(isset($image_id) ? $image_id : 'NULL').',
    487     '.(isset($image_id) ? "'".boolean_to_string($is_high)."'" : 'NULL').',
     487    '.(isset($image_id) ? "'".$image_type."'" : 'NULL').',
    488488    '.(isset($tags_string) ? "'".$tags_string."'" : 'NULL').'
    489489  )
  • trunk/install/phpwebgallery_structure.sql

    r1817 r1844  
    127127  `image_id` mediumint(8) default NULL,
    128128  `summarized` enum('true','false') default 'false',
    129   `is_high` enum('true','false') default NULL,
     129  `image_type` enum('picture','high','other') default NULL,
    130130  PRIMARY KEY  (`id`),
    131131  KEY `history_i1` (`summarized`)
  • trunk/picture.php

    r1837 r1844  
    813813}
    814814//------------------------------------------------------------ log informations
    815 pwg_log($picture['current']['id']);
     815pwg_log($picture['current']['id'], 'picture');
    816816
    817817include(PHPWG_ROOT_PATH.'include/page_header.php');
  • trunk/template/yoga/admin/history.tpl

    r1827 r1844  
    5050  </ul>
    5151
    52   <ul>
    53     <li><label></label></li>
    54     <li></li>
    55   </ul>
    56 
    5752  <label>
    58     {lang:Pictures}
    59     <select name="pictures">
    60       <!-- BEGIN pictures_option -->
    61       <option
    62         value="{pictures_option.VALUE}"
    63         {pictures_option.SELECTED}
    64       >
    65         {pictures_option.CONTENT}
     53    {lang:Element type}
     54    <select name="types[]" multiple="multiple" size="4">
     55      <!-- BEGIN types_option -->
     56      <option value="{types_option.VALUE}" {types_option.SELECTED}>
     57        {types_option.CONTENT}
    6658      </option>
    67       <!-- END pictures_option -->
    68     </select>
    69   </label>
    70 
    71   <label>
    72     {lang:High quality}
    73     <select name="high">
    74       <!-- BEGIN high_option -->
    75       <option
    76         value="{high_option.VALUE}"
    77         {high_option.SELECTED}
    78       >
    79         {high_option.CONTENT}
    80       </option>
    81       <!-- END high_option -->
     59      <!-- END types_option -->
    8260    </select>
    8361  </label>
     
    10280    <th>{lang:IP}</th>
    10381    <th>{lang:image}</th>
    104     <th>{lang:high quality}</th>
     82    <th>{lang:Element type}</th>
    10583    <th>{lang:section}</th>
    10684    <th>{lang:category}</th>
     
    11492    <td>{detail.IP}</td>
    11593    <td>{detail.IMAGE}</td>
    116     <td>
    117   <!-- BEGIN high -->
    118       <img src="{themeconf:icon_dir}/check.png" alt="{lang:yes}">
    119   <!-- END high -->
    120   <!-- BEGIN no_high -->
    121       <img src="{themeconf:icon_dir}/uncheck.png" alt="{lang:no}">
    122   <!-- END no_high -->
    123     </td>
     94    <td>{detail.TYPE}</td>
    12495    <td>{detail.SECTION}</td>
    12596    <td>{detail.CATEGORY}</td>
Note: See TracChangeset for help on using the changeset viewer.