aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-08-29 11:21:21 +0000
committerz0rglub <z0rglub@piwigo.org>2004-08-29 11:21:21 +0000
commit38f7bcd8ac94db8c460fe3913bb7d19c81a2e7dc (patch)
treefee40e989372cb4c1f1f32b9ee8126875162ff98
parentc414a9133eea12bf5ccfd8e08d5af0a5ff270cf0 (diff)
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 git-svn-id: http://piwigo.org/svn/trunk@498 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/include/functions.php15
-rw-r--r--admin/update.php56
-rw-r--r--language/en_UK.iso-8859-1/admin.lang.php6
-rw-r--r--template/default/admin/update.tpl8
-rw-r--r--template/default/default.css12
5 files changed, 64 insertions, 33 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 203ef37cf..4a38f9b05 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -192,6 +192,8 @@ DELETE FROM '.SITES_TABLE.'
// The function works recursively.
function delete_categories($ids)
{
+ global $counts;
+
// destruction of all the related elements
$query = '
SELECT id
@@ -251,8 +253,12 @@ DELETE FROM '.CATEGORIES_TABLE.'
WHERE id IN ('.implode(',', $ids).')
;';
mysql_query($query);
+
+ if (isset($counts['del_categories']))
+ {
+ $counts['del_categories']+= count($ids);
+ }
}
-
// The function delete_elements deletes the elements identified by the
// (numeric) values of the array $ids. It also deletes (in the database) :
@@ -261,7 +267,7 @@ DELETE FROM '.CATEGORIES_TABLE.'
// - all the favorites associated to elements
function delete_elements($ids)
{
- global $count_deleted;
+ global $counts;
// destruction of the comments on the image
$query = '
@@ -295,7 +301,10 @@ DELETE FROM '.IMAGES_TABLE.'
;';
mysql_query($query);
- $count_deleted+= count($ids);
+ if (isset($counts['del_elements']))
+ {
+ $counts['del_elements']+= count($ids);
+ }
}
// The delete_user function delete a user identified by the $user_id
diff --git a/admin/update.php b/admin/update.php
index 4f7a3cb64..627af7812 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -68,7 +68,7 @@ UPDATE '.CATEGORIES_TABLE.'
function insert_local_category($id_uppercat)
{
- global $conf, $page, $user, $lang;
+ global $conf, $page, $user, $lang, $counts;
$uppercats = '';
$output = '';
@@ -188,7 +188,7 @@ SELECT id,dir FROM '.CATEGORIES_TABLE.'
}
else
{
- $output.= '<span style="color:red;">"'.$fs_subdir.'" : ';
+ $output.= '<span class="update_category_error">"'.$fs_subdir.'" : ';
$output.= $lang['update_wrong_dirname'].'</span><br />';
}
}
@@ -205,6 +205,8 @@ INSERT INTO '.CATEGORIES_TABLE.'
$query.= '
;';
mysql_query($query);
+
+ $counts['new_categories']+= count($inserts);
// updating uppercats field
$query = '
UPDATE '.CATEGORIES_TABLE.'
@@ -265,7 +267,7 @@ SELECT id
function insert_local_element($dir, $category_id)
{
- global $lang,$conf,$count_new;
+ global $lang,$conf,$counts;
$output = '';
@@ -398,17 +400,12 @@ SELECT file
$insert['date_available'] = CURRENT_DATE;
$insert['tn_ext'] = "'".$tn_ext."'";
- $count_new++;
- $output.= $unregistered_element;
- $output.= ' <span style="font-weight:bold;">';
- $output.= $lang['update_research_added'].'</span>';
- $output.= ' ('.$lang['update_research_tn_ext'].' '.$tn_ext.')';
- $output.= '<br />';
+ $counts['new_elements']++;
array_push($inserts, $insert);
}
else
{
- $output.= '<span style="color:orange;">';
+ $output.= '<span class="update_error_element">';
$output.= $lang['update_missing_tn'].' : '.$unregistered_element;
$output.= ' (<span style="font-weight:bold;">';
$output.= $conf['prefix_thumbnail'];
@@ -449,17 +446,14 @@ SELECT file
$insert['representative_ext'] = "'".$representative_ext."'";
}
- $count_new++;
- $output.= $unregistered_element;
- $output.= ' <span style="font-weight:bold;">';
- $output.= $lang['update_research_added'].'</span>';
- $output.= '<br />';
+ $counts['new_elements']++;
array_push($inserts, $insert);
}
}
else
{
- $output.= '<span style="color:red;">"'.$unregistered_element.'" : ';
+ $output.= '<span class="update_error_element">"';
+ $output.= $unregistered_element.'" : ';
$output.= $lang['update_wrong_dirname'].'</span><br />';
}
}
@@ -552,8 +546,10 @@ $template->assign_vars(array(
'L_CAT_UPDATE'=>$lang['update_only_cat'],
'L_ALL_UPDATE'=>$lang['update_all'],
'L_RESULT_UPDATE'=>$lang['update_part_research'],
- 'L_NEW_CATEGORY'=>$lang['update_research_conclusion'],
- 'L_DEL_CATEGORY'=>$lang['update_deletion_conclusion'],
+ 'L_NB_NEW_ELEMENTS'=>$lang['update_nb_new_elements'],
+ 'L_NB_NEW_CATEGORIES'=>$lang['update_nb_new_categories'],
+ 'L_NB_DEL_ELEMENTS'=>$lang['update_nb_del_elements'],
+ 'L_NB_DEL_CATEGORIES'=>$lang['update_nb_del_categories'],
'L_UPDATE_SYNC_METADATA_QUESTION'=>$lang['update_sync_metadata_question'],
'U_CAT_UPDATE'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?page=update&amp;update=cats'),
@@ -570,8 +566,12 @@ else if (!isset($_GET['metadata']))
{
check_cat_id($_GET['update']);
$start = get_moment();
- $count_new = 0;
- $count_deleted = 0;
+ $counts = array(
+ 'new_elements' => 0,
+ 'new_categories' => 0,
+ 'del_elements' => 0,
+ 'del_categories' => 0
+ );
if (isset($page['cat']))
{
@@ -582,12 +582,16 @@ else if (!isset($_GET['metadata']))
$categories = insert_local_category('NULL');
}
echo get_elapsed_time($start,get_moment()).' for scanning directories<br />';
- $template->assign_block_vars('update',array(
- 'CATEGORIES'=>$categories,
- 'NEW_CAT'=>$count_new,
- 'DEL_CAT'=>$count_deleted
- ));
- if ($count_new > 0)
+ $template->assign_block_vars(
+ 'update',
+ array(
+ 'CATEGORIES'=>$categories,
+ 'NB_NEW_CATEGORIES'=>$counts['new_categories'],
+ 'NB_DEL_CATEGORIES'=>$counts['del_categories'],
+ 'NB_NEW_ELEMENTS'=>$counts['new_elements'],
+ 'NB_DEL_ELEMENTS'=>$counts['del_elements']
+ ));
+ if ($counts['new_elements'] > 0)
{
$url = PHPWG_ROOT_PATH.'admin.php?page=update&amp;metadata=1';
if (isset($page['cat']))
diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php
index 48f3157b2..710c0d799 100644
--- a/language/en_UK.iso-8859-1/admin.lang.php
+++ b/language/en_UK.iso-8859-1/admin.lang.php
@@ -261,11 +261,13 @@ $lang['update_missing_tn'] = 'the thumbnail is missing for';
$lang['update_disappeared_tn'] = 'the thumbnail disapeared';
$lang['update_disappeared'] = 'doesn\'t exist';
$lang['update_part_deletion'] = 'Deletion of images that have no thumbnail or that doesn\'t exist';
-$lang['update_deletion_conclusion'] = 'pictures removed from database';
$lang['update_part_research'] = 'Search for new images in the directories';
$lang['update_research_added'] = 'added';
$lang['update_research_tn_ext'] = 'thumbnail in';
-$lang['update_research_conclusion'] = 'pictures added to the database';
+$lang['update_nb_new_elements'] = 'elements added in the database';
+$lang['update_nb_del_elements'] = 'elements deleted in the database';
+$lang['update_nb_new_categories'] = 'categories added in the database';
+$lang['update_nb_del_categories'] = 'categories deleted in the database';
$lang['update_default_title'] = 'Choose an option';
$lang['update_only_cat'] = 'update categories, not pictures';
$lang['update_all'] = 'update all';
diff --git a/template/default/admin/update.tpl b/template/default/admin/update.tpl
index 01cfeaabb..0a09dd23b 100644
--- a/template/default/admin/update.tpl
+++ b/template/default/admin/update.tpl
@@ -7,8 +7,12 @@
<!-- END introduction -->
<!-- BEGIN update -->
<div class="admin">{L_RESULT_UPDATE}</div>
-<br /><span style="color:#9cb4ce;">{update.NEW_CAT} {L_NEW_CATEGORY}</span>
-<br /><span style="color:#ffe1e1;">{update.DEL_CAT} {L_DEL_CATEGORY}</span>
+<ul style="text-align:left;">
+ <li class="update_summary_new">{update.NB_NEW_CATEGORIES} {L_NB_NEW_CATEGORIES}</li>
+ <li class="update_summary_new">{update.NB_NEW_ELEMENTS} {L_NB_NEW_ELEMENTS}</li>
+ <li class="update_summary_del">{update.NB_DEL_CATEGORIES} {L_NB_DEL_CATEGORIES}</li>
+ <li class="update_summary_del">{update.NB_DEL_ELEMENTS} {L_NB_DEL_ELEMENTS}</li>
+</ul>
<!-- BEGIN sync_metadata -->
<br />[ <a href="{update.sync_metadata.U_URL}">{L_UPDATE_SYNC_METADATA_QUESTION}</a> ]
<!-- END sync_metadata -->
diff --git a/template/default/default.css b/template/default/default.css
index aafaa4846..65292944e 100644
--- a/template/default/default.css
+++ b/template/default/default.css
@@ -327,3 +327,15 @@ span.thumb_picture {
span.thumb_category {
font-weight:normal;
}
+
+span.update_error_element, span.update_category_error {
+ color:orange;
+}
+
+.update_summary_new {
+ color:#9cb4ce;
+}
+
+.update_summary_del {
+ color:#ffe1e1;
+} \ No newline at end of file