Changeset 498


Ignore:
Timestamp:
Aug 29, 2004, 1:21:21 PM (20 years ago)
Author:
z0rglub
Message:

simplier display of update result :

  • number of new categories
  • number of new elements
  • number of deleted categories
  • number of deleted elements
  • only errors are fully listed
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r496 r498  
    193193function delete_categories($ids)
    194194{
     195  global $counts;
     196 
    195197  // destruction of all the related elements
    196198  $query = '
     
    252254;';
    253255  mysql_query($query);
    254 }
    255        
     256
     257  if (isset($counts['del_categories']))
     258  {
     259    $counts['del_categories']+= count($ids);
     260  }
     261}
    256262
    257263// The function delete_elements deletes the elements identified by the
     
    262268function delete_elements($ids)
    263269{
    264   global $count_deleted;
     270  global $counts;
    265271 
    266272  // destruction of the comments on the image
     
    296302  mysql_query($query);
    297303
    298   $count_deleted+= count($ids);
     304  if (isset($counts['del_elements']))
     305  {
     306    $counts['del_elements']+= count($ids);
     307  }
    299308}
    300309
  • trunk/admin/update.php

    r494 r498  
    6969function insert_local_category($id_uppercat)
    7070{
    71   global $conf, $page, $user, $lang;
     71  global $conf, $page, $user, $lang, $counts;
    7272 
    7373  $uppercats = '';
     
    189189      else
    190190      {
    191         $output.= '<span style="color:red;">"'.$fs_subdir.'" : ';
     191        $output.= '<span class="update_category_error">"'.$fs_subdir.'" : ';
    192192        $output.= $lang['update_wrong_dirname'].'</span><br />';
    193193      }
     
    206206;';
    207207    mysql_query($query);
     208
     209    $counts['new_categories']+= count($inserts);
    208210    // updating uppercats field
    209211    $query = '
     
    266268function insert_local_element($dir, $category_id)
    267269{
    268   global $lang,$conf,$count_new;
     270  global $lang,$conf,$counts;
    269271
    270272  $output = '';
     
    399401          $insert['tn_ext'] = "'".$tn_ext."'";
    400402
    401           $count_new++;
    402           $output.= $unregistered_element;
    403           $output.= ' <span style="font-weight:bold;">';
    404           $output.= $lang['update_research_added'].'</span>';
    405           $output.= ' ('.$lang['update_research_tn_ext'].' '.$tn_ext.')';
    406           $output.= '<br />';
     403          $counts['new_elements']++;
    407404          array_push($inserts, $insert);
    408405        }
    409406        else
    410407        {
    411           $output.= '<span style="color:orange;">';
     408          $output.= '<span class="update_error_element">';
    412409          $output.= $lang['update_missing_tn'].' : '.$unregistered_element;
    413410          $output.= ' (<span style="font-weight:bold;">';
     
    450447        }
    451448
    452         $count_new++;
    453         $output.= $unregistered_element;
    454         $output.= ' <span style="font-weight:bold;">';
    455         $output.= $lang['update_research_added'].'</span>';
    456         $output.= '<br />';
     449        $counts['new_elements']++;
    457450        array_push($inserts, $insert);
    458451      }
     
    460453    else
    461454    {
    462       $output.= '<span style="color:red;">"'.$unregistered_element.'" : ';
     455      $output.= '<span class="update_error_element">"';
     456      $output.= $unregistered_element.'" : ';
    463457      $output.= $lang['update_wrong_dirname'].'</span><br />';
    464458    }
     
    553547  'L_ALL_UPDATE'=>$lang['update_all'],
    554548  'L_RESULT_UPDATE'=>$lang['update_part_research'],
    555   'L_NEW_CATEGORY'=>$lang['update_research_conclusion'],
    556   'L_DEL_CATEGORY'=>$lang['update_deletion_conclusion'],
     549  'L_NB_NEW_ELEMENTS'=>$lang['update_nb_new_elements'],
     550  'L_NB_NEW_CATEGORIES'=>$lang['update_nb_new_categories'],
     551  'L_NB_DEL_ELEMENTS'=>$lang['update_nb_del_elements'],
     552  'L_NB_DEL_CATEGORIES'=>$lang['update_nb_del_categories'],
    557553  'L_UPDATE_SYNC_METADATA_QUESTION'=>$lang['update_sync_metadata_question'],
    558554 
     
    571567  check_cat_id($_GET['update']);
    572568  $start = get_moment();
    573   $count_new = 0;
    574   $count_deleted = 0;
     569  $counts = array(
     570    'new_elements' => 0,
     571    'new_categories' => 0,
     572    'del_elements' => 0,
     573    'del_categories' => 0
     574    );
    575575 
    576576  if (isset($page['cat']))
     
    583583  }
    584584  echo get_elapsed_time($start,get_moment()).' for scanning directories<br />';
    585   $template->assign_block_vars('update',array(
    586     'CATEGORIES'=>$categories,
    587         'NEW_CAT'=>$count_new,
    588         'DEL_CAT'=>$count_deleted
    589    ));
    590   if ($count_new > 0)
     585  $template->assign_block_vars(
     586    'update',
     587    array(
     588      'CATEGORIES'=>$categories,
     589      'NB_NEW_CATEGORIES'=>$counts['new_categories'],
     590      'NB_DEL_CATEGORIES'=>$counts['del_categories'],
     591      'NB_NEW_ELEMENTS'=>$counts['new_elements'],
     592      'NB_DEL_ELEMENTS'=>$counts['del_elements']
     593      ));
     594  if ($counts['new_elements'] > 0)
    591595  {
    592596    $url = PHPWG_ROOT_PATH.'admin.php?page=update&amp;metadata=1';
  • trunk/language/en_UK.iso-8859-1/admin.lang.php

    r493 r498  
    262262$lang['update_disappeared'] = 'doesn\'t exist';
    263263$lang['update_part_deletion'] = 'Deletion of images that have no thumbnail or that doesn\'t exist';
    264 $lang['update_deletion_conclusion'] = 'pictures removed from database';
    265264$lang['update_part_research'] = 'Search for new images in the directories';
    266265$lang['update_research_added'] = 'added';
    267266$lang['update_research_tn_ext'] = 'thumbnail in';
    268 $lang['update_research_conclusion'] = 'pictures added to the database';
     267$lang['update_nb_new_elements'] = 'elements added in the database';
     268$lang['update_nb_del_elements'] = 'elements deleted in the database';
     269$lang['update_nb_new_categories'] = 'categories added in the database';
     270$lang['update_nb_del_categories'] = 'categories deleted in the database';
    269271$lang['update_default_title'] = 'Choose an option';
    270272$lang['update_only_cat'] = 'update categories, not pictures';
  • trunk/template/default/admin/update.tpl

    r486 r498  
    88<!-- BEGIN update -->
    99<div class="admin">{L_RESULT_UPDATE}</div>
    10 <br /><span style="color:#9cb4ce;">{update.NEW_CAT} {L_NEW_CATEGORY}</span>
    11 <br /><span style="color:#ffe1e1;">{update.DEL_CAT} {L_DEL_CATEGORY}</span>
     10<ul style="text-align:left;">
     11  <li class="update_summary_new">{update.NB_NEW_CATEGORIES} {L_NB_NEW_CATEGORIES}</li>
     12  <li class="update_summary_new">{update.NB_NEW_ELEMENTS} {L_NB_NEW_ELEMENTS}</li>
     13  <li class="update_summary_del">{update.NB_DEL_CATEGORIES} {L_NB_DEL_CATEGORIES}</li>
     14  <li class="update_summary_del">{update.NB_DEL_ELEMENTS} {L_NB_DEL_ELEMENTS}</li>
     15</ul>
    1216<!-- BEGIN sync_metadata -->
    1317<br />[ <a href="{update.sync_metadata.U_URL}">{L_UPDATE_SYNC_METADATA_QUESTION}</a> ]
  • trunk/template/default/default.css

    r479 r498  
    328328  font-weight:normal;
    329329}
     330
     331span.update_error_element, span.update_category_error {
     332  color:orange;
     333}
     334
     335.update_summary_new {
     336  color:#9cb4ce;
     337}
     338
     339.update_summary_del {
     340  color:#ffe1e1;
     341}
Note: See TracChangeset for help on using the changeset viewer.