Changeset 498 for trunk/admin


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/admin
Files:
2 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';
Note: See TracChangeset for help on using the changeset viewer.