aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2005-06-11 14:10:04 +0000
committerplegall <plg@piwigo.org>2005-06-11 14:10:04 +0000
commite851f504acebc9422b79f58da25420666da6e296 (patch)
treef90d0104a9799caa29bcd47d0bd2c6edabcefe79
parent4fedaac43ac404dc50193d6032307697412bb2c9 (diff)
- errors and informations boxes : management centralized in admin.php,
$errors and $infos arrays replaced by $page['errors'] and $page['infos'], special management for admin/update.php (more complex management) git-svn-id: http://piwigo.org/svn/trunk@792 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin.php23
-rw-r--r--admin/cat_list.php29
-rw-r--r--admin/cat_modify.php3
-rw-r--r--admin/configuration.php33
-rw-r--r--admin/element_set_global.php1
-rw-r--r--admin/element_set_unit.php1
-rw-r--r--admin/group_list.php22
-rw-r--r--admin/picture_modify.php17
-rw-r--r--admin/remote_site.php50
-rw-r--r--admin/thumbnail.php26
-rw-r--r--admin/update.php8
-rw-r--r--admin/user_list.php12
-rw-r--r--admin/waiting.php7
-rw-r--r--doc/ChangeLog7
-rw-r--r--template/default/admin.tpl21
-rw-r--r--template/default/admin/cat_list.tpl16
-rw-r--r--template/default/admin/cat_modify.tpl4
-rw-r--r--template/default/admin/configuration.tpl12
-rw-r--r--template/default/admin/group_list.tpl11
-rw-r--r--template/default/admin/images/errors.pngbin0 -> 3248 bytes
-rw-r--r--template/default/admin/images/infos.pngbin0 -> 2249 bytes
-rw-r--r--template/default/admin/picture_modify.tpl9
-rw-r--r--template/default/admin/remote_site.tpl14
-rw-r--r--template/default/admin/thumbnail.tpl10
-rw-r--r--template/default/admin/update.tpl20
-rw-r--r--template/default/admin/waiting.tpl3
-rw-r--r--template/default/default.css32
27 files changed, 150 insertions, 241 deletions
diff --git a/admin.php b/admin.php
index 60a6b25db..ade076020 100644
--- a/admin.php
+++ b/admin.php
@@ -265,6 +265,9 @@ $template->assign_vars(array(
//--------------------------------------------------------------------- summary
$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
//------------------------------------------------------------- content display
+$page['errors'] = array();
+$page['infos'] = array();
+
if ($page_valide)
{
switch ($_GET['page'])
@@ -294,6 +297,26 @@ else
)
);
}
+// +-----------------------------------------------------------------------+
+// | errors & infos |
+// +-----------------------------------------------------------------------+
+if (count($page['errors']) != 0)
+{
+ $template->assign_block_vars('errors',array());
+ foreach ($page['errors'] as $error)
+ {
+ $template->assign_block_vars('errors.error',array('ERROR'=>$error));
+ }
+}
+if (count($page['infos']) != 0)
+{
+ $template->assign_block_vars('infos',array());
+ foreach ($page['infos'] as $info)
+ {
+ $template->assign_block_vars('infos.info',array('INFO'=>$info));
+ }
+}
+
$template->parse('admin');
include(PHPWG_ROOT_PATH.'include/page_tail.php');
// +-----------------------------------------------------------------------+
diff --git a/admin/cat_list.php b/admin/cat_list.php
index 1706eaff8..a4fa4b5ce 100644
--- a/admin/cat_list.php
+++ b/admin/cat_list.php
@@ -33,8 +33,6 @@ include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
// +-----------------------------------------------------------------------+
// | initialization |
// +-----------------------------------------------------------------------+
-$errors = array();
-$infos = array();
$categories = array();
$navigation = $lang['home'];
// +-----------------------------------------------------------------------+
@@ -44,7 +42,7 @@ $navigation = $lang['home'];
if (isset($_GET['delete']) and is_numeric($_GET['delete']))
{
delete_categories(array($_GET['delete']));
- array_push($infos, $lang['cat_virtual_deleted']);
+ array_push($page['infos'], $lang['cat_virtual_deleted']);
ordering();
update_global_rank();
}
@@ -54,10 +52,10 @@ else if (isset($_POST['submit']))
// is the given category name only containing blank spaces ?
if (preg_match('/^\s*$/', $_POST['virtual_name']))
{
- array_push($errors, $lang['cat_error_name']);
+ array_push($page['errors'], $lang['cat_error_name']);
}
- if (!count($errors))
+ if (!count($page['errors']))
{
$parent_id = !empty($_GET['parent_id'])?$_GET['parent_id']:'NULL';
@@ -136,7 +134,7 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1)
'uppercats','global_rank');
mass_inserts(CATEGORIES_TABLE, $dbfields, $inserts);
- array_push($infos, $lang['cat_virtual_added']);
+ array_push($page['infos'], $lang['cat_virtual_added']);
}
}
// +-----------------------------------------------------------------------+
@@ -344,25 +342,6 @@ $template->assign_vars(array(
$tpl = array('cat_first','cat_last');
// +-----------------------------------------------------------------------+
-// | errors & infos |
-// +-----------------------------------------------------------------------+
-if (count($errors) != 0)
-{
- $template->assign_block_vars('errors',array());
- foreach ($errors as $error)
- {
- $template->assign_block_vars('errors.error',array('ERROR'=>$error));
- }
-}
-if (count($infos) != 0)
-{
- $template->assign_block_vars('infos',array());
- foreach ($infos as $info)
- {
- $template->assign_block_vars('infos.info',array('INFO'=>$info));
- }
-}
-// +-----------------------------------------------------------------------+
// | Categories display |
// +-----------------------------------------------------------------------+
$ranks = array();
diff --git a/admin/cat_modify.php b/admin/cat_modify.php
index 97217ab99..44c07ad85 100644
--- a/admin/cat_modify.php
+++ b/admin/cat_modify.php
@@ -81,7 +81,7 @@ if ( isset( $_POST['submit'] ) )
set_cat_visible(array($_GET['cat_id']), $_POST['visible']);
set_cat_status(array($_GET['cat_id']), $_POST['status']);
- $template->assign_block_vars('confirmation' ,array());
+ array_push($infos, $lang['editcat_confirm']);
}
else if (isset($_POST['set_random_representant']))
{
@@ -144,7 +144,6 @@ $template->assign_vars(array(
$commentable=>'checked="checked"',
$uploadable=>'checked="checked"',
- 'L_EDIT_CONFIRM'=>$lang['editcat_confirm'],
'L_EDIT_NAME'=>$lang['name'],
'L_STORAGE'=>$lang['storage'],
'L_REMOTE_SITE'=>$lang['remote_site'],
diff --git a/admin/configuration.php b/admin/configuration.php
index 9b3ca801a..5d3864937 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -53,7 +53,6 @@ while ($row = mysql_fetch_array($result))
}
}
//------------------------------ verification and registration of modifications
-$errors = array();
if (isset($_POST['submit']))
{
$int_pattern = '/^\d+$/';
@@ -64,13 +63,13 @@ if (isset($_POST['submit']))
// thumbnail prefix must only contain simple ASCII characters
if (!preg_match('/^[\w-]*$/', $_POST['prefix_thumbnail']))
{
- array_push($errors, $lang['conf_prefix_thumbnail_error']);
+ array_push($page['errors'], $lang['conf_prefix_thumbnail_error']);
}
// mail must be formatted as follows : name@server.com
$pattern = '/^[\w-]+(\.[\w-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/';
if (!preg_match($pattern, $_POST['mail_webmaster']))
{
- array_push($errors, $lang['conf_mail_webmaster_error']);
+ array_push($page['errors'], $lang['conf_mail_webmaster_error']);
}
break;
}
@@ -82,7 +81,7 @@ if (isset($_POST['submit']))
or $_POST['nb_comment_page'] < 5
or $_POST['nb_comment_page'] > 50)
{
- array_push($errors, $lang['conf_nb_comment_page_error']);
+ array_push($page['errors'], $lang['conf_nb_comment_page_error']);
}
break;
}
@@ -92,7 +91,7 @@ if (isset($_POST['submit']))
if (!preg_match($int_pattern, $_POST['recent_period'])
or $_POST['recent_period'] <= 0)
{
- array_push($errors, $lang['periods_error']);
+ array_push($page['errors'], $lang['periods_error']);
}
break;
}
@@ -103,7 +102,7 @@ if (isset($_POST['submit']))
or $_POST['upload_maxfilesize'] < 10
or $_POST['upload_maxfilesize'] > 1000)
{
- array_push($errors, $lang['conf_upload_maxfilesize_error']);
+ array_push($page['errors'], $lang['conf_upload_maxfilesize_error']);
}
foreach (array('upload_maxwidth',
@@ -113,9 +112,9 @@ if (isset($_POST['submit']))
as $field)
{
if (!preg_match($int_pattern, $_POST[$field])
- or $_POST[$field] < 10)
+ or $_POST[$field] < 10)
{
- array_push($errors, $lang['conf_'.$field.'_error']);
+ array_push($page['errors'], $lang['conf_'.$field.'_error']);
}
}
break;
@@ -123,8 +122,9 @@ if (isset($_POST['submit']))
}
// updating configuration if no error found
- if (count($errors) == 0)
+ if (count($page['errors']) == 0)
{
+ echo '<pre>'; print_r($_POST); echo '</pre>';
$result = pwg_query('SELECT * FROM '.CONFIG_TABLE);
while ($row = mysql_fetch_array($result))
{
@@ -138,6 +138,7 @@ UPDATE '.CONFIG_TABLE.'
pwg_query($query);
}
}
+ array_push($page['infos'], $lang['conf_confirmation']);
}
}
@@ -149,7 +150,6 @@ $action.= '&amp;section='.$page['section'];
$template->assign_vars(
array(
- 'L_CONFIRM'=>$lang['conf_confirmation'],
'L_YES'=>$lang['yes'],
'L_NO'=>$lang['no'],
'L_SUBMIT'=>$lang['submit'],
@@ -343,19 +343,6 @@ switch ($page['section'])
break;
}
}
-//-------------------------------------------------------------- errors display
-if ( sizeof( $errors ) != 0 )
-{
- $template->assign_block_vars('errors',array());
- for ( $i = 0; $i < sizeof( $errors ); $i++ )
- {
- $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i]));
- }
-}
-elseif ( isset( $_POST['submit'] ) )
-{
- $template->assign_block_vars('confirmation' ,array());
-}
//----------------------------------------------------------- sending html code
$template->assign_var_from_handle('ADMIN_CONTENT', 'config');
?>
diff --git a/admin/element_set_global.php b/admin/element_set_global.php
index 1c1315a0b..33ede7dfc 100644
--- a/admin/element_set_global.php
+++ b/admin/element_set_global.php
@@ -74,7 +74,6 @@ SELECT keywords
// +-----------------------------------------------------------------------+
// | global mode form submission |
// +-----------------------------------------------------------------------+
-$errors = array();
if (isset($_POST['submit']))
{
diff --git a/admin/element_set_unit.php b/admin/element_set_unit.php
index b72c370fe..74aaf1eb0 100644
--- a/admin/element_set_unit.php
+++ b/admin/element_set_unit.php
@@ -40,7 +40,6 @@ include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
// +-----------------------------------------------------------------------+
// | unit mode form submission |
// +-----------------------------------------------------------------------+
-$errors = array();
if (isset($_POST['submit']))
{
diff --git a/admin/group_list.php b/admin/group_list.php
index cdf123f4e..f789a6b27 100644
--- a/admin/group_list.php
+++ b/admin/group_list.php
@@ -31,7 +31,6 @@ if( !defined("PHPWG_ROOT_PATH") )
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
//-------------------------------------------------------------- delete a group
-$error = array();
if ( isset( $_POST['delete'] ) && isset( $_POST['confirm_delete'] ) )
{
// destruction of the access linked to the group
@@ -57,9 +56,9 @@ elseif ( isset( $_POST['new'] ) )
if ( empty($_POST['newgroup']) || preg_match( "/'/", $_POST['newgroup'] )
or preg_match( '/"/', $_POST['newgroup'] ) )
{
- array_push( $error, $lang['group_add_error1'] );
+ array_push( $page['errors'], $lang['group_add_error1'] );
}
- if ( count( $error ) == 0 )
+ if ( count( $page['errors'] ) == 0 )
{
// is the group not already existing ?
$query = 'SELECT id FROM '.GROUPS_TABLE;
@@ -68,10 +67,10 @@ elseif ( isset( $_POST['new'] ) )
$result = pwg_query( $query );
if ( mysql_num_rows( $result ) > 0 )
{
- array_push( $error, $lang['group_add_error2'] );
+ array_push( $page['errors'], $lang['group_add_error2'] );
}
}
- if ( count( $error ) == 0 )
+ if ( count( $page['errors'] ) == 0 )
{
// creating the group
$query = ' INSERT INTO '.GROUPS_TABLE;
@@ -80,13 +79,13 @@ elseif ( isset( $_POST['new'] ) )
pwg_query( $query );
}
}
-//--------------------------------------------------------------- user management
+//------------------------------------------------------------- user management
elseif ( isset( $_POST['add'] ) )
{
$userdata = getuserdata($_POST['username']);
if (!$userdata)
{
- array_push($error, $lang['user_err_unknown']);
+ array_push($page['errors'], $lang['user_err_unknown']);
}
else
{
@@ -113,15 +112,6 @@ elseif (isset( $_POST['deny_user'] ))
$query.= ') AND group_id = '.$_POST['edit_group_id'];
pwg_query( $query );
}
-//-------------------------------------------------------------- errors display
-if ( sizeof( $error ) != 0 )
-{
- $template->assign_block_vars('errors',array());
- for ( $i = 0; $i < sizeof( $error ); $i++ )
- {
- $template->assign_block_vars('errors.error',array('ERROR'=>$error[$i]));
- }
-}
//----------------------------------------------------------------- groups list
$query = 'SELECT id,name FROM '.GROUPS_TABLE;
diff --git a/admin/picture_modify.php b/admin/picture_modify.php
index fc2e2eb51..64d6cf04b 100644
--- a/admin/picture_modify.php
+++ b/admin/picture_modify.php
@@ -31,16 +31,15 @@ if(!defined("PHPWG_ROOT_PATH"))
}
include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
//--------------------------------------------------------- update informations
-$errors = array();
// first, we verify whether there is a mistake on the given creation date
if (isset($_POST['date_creation']) and !empty($_POST['date_creation']))
{
if (!check_date_format($_POST['date_creation']))
{
- array_push($errors, $lang['err_date']);
+ array_push($page['errors'], $lang['err_date']);
}
}
-if (isset($_POST['submit']) and count($errors) == 0)
+if (isset($_POST['submit']) and count($page['errors']) == 0)
{
$query = 'UPDATE '.IMAGES_TABLE.' SET name = ';
if ($_POST['name'] == '')
@@ -160,7 +159,7 @@ $thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']);
$url_img = PHPWG_ROOT_PATH.'picture.php?image_id='.$_GET['image_id'];
$url_img .= '&amp;cat='.$row['storage_category_id'];
-$date = isset($_POST['date_creation']) && empty($errors)
+$date = isset($_POST['date_creation']) && empty($page['errors'])
?$_POST['date_creation']:date_convert_back(@$row['date_creation']);
$url = PHPWG_ROOT_PATH.'admin.php?page=cat_modify&amp;cat_id=';
@@ -212,16 +211,6 @@ $template->assign_vars(array(
'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?'.$_SERVER['QUERY_STRING'])
));
-//-------------------------------------------------------------- errors display
-if (count($errors) != 0)
-{
- $template->assign_block_vars('errors',array());
- foreach ($errors as $error)
- {
- $template->assign_block_vars('errors.error',array('ERROR'=>$error));
- }
-}
-
// associate to another category ?
$query = '
SELECT id,name,uppercats,global_rank
diff --git a/admin/remote_site.php b/admin/remote_site.php
index 37f9458fc..ba8dc67ce 100644
--- a/admin/remote_site.php
+++ b/admin/remote_site.php
@@ -45,7 +45,7 @@ define('CURRENT_DATE', date('Y-m-d'));
*/
function remote_output($url)
{
- global $template, $errors, $lang;
+ global $template, $page, $lang;
if($lines = @file($url))
{
@@ -68,7 +68,7 @@ function remote_output($url)
}
else
{
- array_push($errors, $lang['remote_site_file_not_found']);
+ array_push($page['errors'], $lang['remote_site_file_not_found']);
}
}
@@ -120,7 +120,7 @@ SELECT id,dir
*/
function update_remote_site($listing_file, $site_id)
{
- global $lang, $counts, $template, $removes, $errors;
+ global $lang, $counts, $template, $removes, $page;
if (@fopen($listing_file, 'r'))
{
@@ -159,7 +159,7 @@ function update_remote_site($listing_file, $site_id)
}
else
{
- array_push($errors, $lang['remote_site_listing_not_found']);
+ array_push($page['errors'], $lang['remote_site_listing_not_found']);
}
}
@@ -518,14 +518,12 @@ $template->assign_vars(
// +-----------------------------------------------------------------------+
// | new site creation form |
// +-----------------------------------------------------------------------+
-$errors = array();
-
if (isset($_POST['submit']))
{
// site must start by http:// or https://
if (!preg_match('/^https?:\/\/[~\/\.\w-]+$/', $_POST['galleries_url']))
{
- array_push($errors, $lang['remote_site_uncorrect_url']);
+ array_push($page['errors'], $lang['remote_site_uncorrect_url']);
}
else
{
@@ -542,11 +540,11 @@ SELECT COUNT(id) AS count
$row = mysql_fetch_array(pwg_query($query));
if ($row['count'] > 0)
{
- array_push($errors, $lang['remote_site_already_exists']);
+ array_push($page['errors'], $lang['remote_site_already_exists']);
}
}
- if (count($errors) == 0)
+ if (count($page['errors']) == 0)
{
$url = $page['galleries_url'].'create_listing_file.php';
$url.= '?action=test';
@@ -556,16 +554,17 @@ SELECT COUNT(id) AS count
$first_line = strip_tags($lines[0]);
if (!preg_match('/^PWG-INFO-2:/', $first_line))
{
- array_push($errors, $lang['remote_site_error'].' : '.$first_line);
+ array_push($page['errors'],
+ $lang['remote_site_error'].' : '.$first_line);
}
}
else
{
- array_push($errors, $lang['remote_site_file_not_found']);
+ array_push($page['errors'], $lang['remote_site_file_not_found']);
}
}
- if (count($errors) == 0)
+ if (count($page['errors']) == 0)
{
$query = '
INSERT INTO '.SITES_TABLE.'
@@ -575,11 +574,8 @@ INSERT INTO '.SITES_TABLE.'
;';
pwg_query($query);
- $template->assign_block_vars(
- 'confirmation',
- array(
- 'CONTENT'=>$page['galleries_url'].' '.$lang['remote_site_created']
- ));
+ array_push($page['infos'],
+ $page['galleries_url'].' '.$lang['remote_site_created']);
}
}
// +-----------------------------------------------------------------------+
@@ -607,13 +603,8 @@ SELECT galleries_url
case 'delete' :
{
delete_site($page['site']);
-
- $template->assign_block_vars(
- 'confirmation',
- array(
- 'CONTENT'=>$galleries_url.' '.$lang['remote_site_deleted']
- ));
-
+ array_push($page['infos'],
+ $galleries_url.' '.$lang['remote_site_deleted']);
break;
}
case 'generate' :
@@ -738,17 +729,6 @@ while ($row = mysql_fetch_array($result))
);
}
// +-----------------------------------------------------------------------+
-// | errors display |
-// +-----------------------------------------------------------------------+
-if (count($errors) != 0)
-{
- $template->assign_block_vars('errors',array());
- foreach ($errors as $error)
- {
- $template->assign_block_vars('errors.error',array('ERROR'=>$error));
- }
-}
-// +-----------------------------------------------------------------------+
// | sending html code |
// +-----------------------------------------------------------------------+
$template->assign_var_from_handle('ADMIN_CONTENT', 'remote_site');
diff --git a/admin/thumbnail.php b/admin/thumbnail.php
index 7cdb1711a..64a6797e3 100644
--- a/admin/thumbnail.php
+++ b/admin/thumbnail.php
@@ -31,7 +31,7 @@ include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
// "thumbnail".
function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
{
- global $conf, $lang, $errors;
+ global $conf, $lang, $page;
$filename = basename($path);
$dirname = dirname($path);
@@ -100,7 +100,8 @@ function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
{
if (!is_writable($dirname))
{
- array_push($errors, '['.$dirname.'] : '.$lang['no_write_access']);
+ array_push($page['errors'],
+ '['.$dirname.'] : '.$lang['no_write_access']);
return false;
}
umask(0000);
@@ -114,7 +115,7 @@ function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
// creation and backup of final picture
if (!is_writable($tndir))
{
- array_push($errors, '['.$tndir.'] : '.$lang['no_write_access']);
+ array_push($page['errors'], '['.$tndir.'] : '.$lang['no_write_access']);
return false;
}
imagejpeg($destImage, $dest_file);
@@ -148,7 +149,6 @@ function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
}
}
-$errors = array();
$pictures = array();
$stats = array();
// +-----------------------------------------------------------------------+
@@ -247,22 +247,21 @@ foreach ($fs['elements'] as $path)
// +-----------------------------------------------------------------------+
if (isset($_POST['submit']))
{
- $errors = array();
$times = array();
$infos = array();
// checking criteria
if (!ereg('^[0-9]{2,3}$', $_POST['width']) or $_POST['width'] < 10)
{
- array_push($errors, $lang['tn_err_width'].' 10');
+ array_push($page['errors'], $lang['tn_err_width'].' 10');
}
if (!ereg('^[0-9]{2,3}$', $_POST['height']) or $_POST['height'] < 10)
{
- array_push($errors, $lang['tn_err_height'].' 10');
+ array_push($page['errors'], $lang['tn_err_height'].' 10');
}
// picture miniaturization
- if (count($errors) == 0)
+ if (count($page['errors']) == 0)
{
$num = 1;
foreach ($wo_thumbnails as $path)
@@ -345,17 +344,6 @@ if (isset($_POST['submit']))
}
}
// +-----------------------------------------------------------------------+
-// | errors display |
-// +-----------------------------------------------------------------------+
-if (count($errors) != 0)
-{
- $template->assign_block_vars('errors',array());
- foreach ($errors as $error)
- {
- $template->assign_block_vars('errors.error',array('ERROR'=>$error));
- }
-}
-// +-----------------------------------------------------------------------+
// | form & pictures without thumbnails display |
// +-----------------------------------------------------------------------+
$remainings = array_diff($wo_thumbnails, $thumbnalized);
diff --git a/admin/update.php b/admin/update.php
index 59e748198..bfc3236fc 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -654,11 +654,11 @@ if (isset($_POST['submit'])
if (count($errors) > 0)
{
- $template->assign_block_vars('update.errors', array());
+ $template->assign_block_vars('update.update_errors', array());
foreach ($errors as $error)
{
$template->assign_block_vars(
- 'update.errors.error',
+ 'update.update_errors.update_error',
array(
'ELEMENT' => $error['path'],
'LABEL' => $error['type'].' ('.$error_labels[$error['type']].')'
@@ -669,11 +669,11 @@ if (isset($_POST['submit'])
and isset($_POST['display_info'])
and $_POST['display_info'] == 1)
{
- $template->assign_block_vars('update.infos', array());
+ $template->assign_block_vars('update.update_infos', array());
foreach ($infos as $info)
{
$template->assign_block_vars(
- 'update.infos.info',
+ 'update.update_infos.update_info',
array(
'ELEMENT' => $info['path'],
'LABEL' => $info['info']
diff --git a/admin/user_list.php b/admin/user_list.php
index 23c467eb4..26a98ebaf 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -45,18 +45,16 @@ include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
if (isset($_POST['submit_add']))
{
- $errors = register_user($_POST['login'],
- $_POST['password'],
- $_POST['password'],
- '');
+ $page['errors'] = register_user($_POST['login'],
+ $_POST['password'],
+ $_POST['password'],
+ '');
}
// +-----------------------------------------------------------------------+
// | preferences form submission |
// +-----------------------------------------------------------------------+
-$errors = array();
-
if (isset($_POST['pref_submit']))
{
$collection = array();
@@ -193,7 +191,7 @@ $template->set_filenames(array('user_list'=>'admin/user_list.tpl'));
$base_url = add_session_id(PHPWG_ROOT_PATH.'admin.php?page=user_list');
-$conf['users_page'] = 20;
+$conf['users_page'] = 10;
if (isset($_GET['start']) and is_numeric($_GET['start']))
{
diff --git a/admin/waiting.php b/admin/waiting.php
index b0b69cd2e..3be00dd5c 100644
--- a/admin/waiting.php
+++ b/admin/waiting.php
@@ -72,12 +72,12 @@ if ( isset( $_POST['submit'] ) )
}
}
}
+ array_push($infos, $lang['waiting_update']);
}
//----------------------------------------------------- template initialization
$template->set_filenames(array('waiting'=>'admin/waiting.tpl'));
$template->assign_vars(array(
- 'L_WAITING_CONFIRMATION'=>$lang['waiting_update'],
'L_AUTHOR'=>$lang['author'],
'L_THUMBNAIL'=>$lang['thumbnail'],
'L_DATE'=>$lang['date'],
@@ -90,11 +90,6 @@ $template->assign_vars(array(
'F_ACTION'=>add_session_id(str_replace( '&', '&amp;', $_SERVER['REQUEST_URI'] ))
));
-//-------------------------------------------------------- confirmation message
-if (isset($_POST['submit']))
-{
- $template->assign_block_vars('confirmation' ,array());
-}
//---------------------------------------------------------------- form display
$cat_names = array();
$query = 'SELECT * FROM '.WAITING_TABLE;
diff --git a/doc/ChangeLog b/doc/ChangeLog
index cd9c18b98..b3d898ad6 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,5 +1,12 @@
2005-06-11 Pierrick LE GALL
+ * errors and informations boxes : management centralized in
+ admin.php, $errors and $infos arrays replaced by $page['errors']
+ and $page['infos'], special management for admin/update.php (more
+ complex management)
+
+2005-06-11 Pierrick LE GALL
+
* bug 96 (informations given by uploaders are lost) correction
reported from branch 1.4
diff --git a/template/default/admin.tpl b/template/default/admin.tpl
index 5c86bfdd7..db93f7ca9 100644
--- a/template/default/admin.tpl
+++ b/template/default/admin.tpl
@@ -71,6 +71,27 @@
<td style="padding:10px;width:99%;" valign="top">
<div class="home">
<div class="titrePage">{PAGE_TITLE}</div>
+
+ <!-- BEGIN errors -->
+ <div id="errors">
+ <ul>
+ <!-- BEGIN error -->
+ <li>{errors.error.ERROR}</li>
+ <!-- END error -->
+ </ul>
+ </div>
+ <!-- END errors -->
+
+ <!-- BEGIN infos -->
+ <div id="infos">
+ <ul>
+ <!-- BEGIN info -->
+ <li>{infos.info.INFO}</li>
+ <!-- END info -->
+ </ul>
+ </div>
+ <!-- END infos -->
+
<div align="center">{ADMIN_CONTENT}{ADMIN_CONTENT_2}</div>
</div>
</td>
diff --git a/template/default/admin/cat_list.tpl b/template/default/admin/cat_list.tpl
index 39fbc3b20..f6e30b042 100644
--- a/template/default/admin/cat_list.tpl
+++ b/template/default/admin/cat_list.tpl
@@ -1,19 +1,3 @@
-<!-- BEGIN errors -->
-<div class="errors">
-<ul>
- <!-- BEGIN error -->
- <li>{errors.error.ERROR}</li>
- <!-- END error -->
-</ul>
-</div>
-<!-- END errors -->
-<!-- BEGIN infos -->
-<div class="info">
- <!-- BEGIN info -->
- <li>{infos.info.INFO}</li>
- <!-- END info -->
-</div>
-<!-- END infos -->
<div class="admin">{CATEGORIES_NAV}</div>
<table style="width:100%;">
<!-- BEGIN category -->
diff --git a/template/default/admin/cat_modify.tpl b/template/default/admin/cat_modify.tpl
index bd25ac1b6..e83f587d4 100644
--- a/template/default/admin/cat_modify.tpl
+++ b/template/default/admin/cat_modify.tpl
@@ -1,7 +1,3 @@
-<!-- BEGIN confirmation -->
-<div style="color:red;text-align:center;">
- {L_EDIT_CONFIRM} <a href="{U_PERMISSIONS}">{L_HERE}</a></div>
-<!-- END confirmation -->
<div class="admin">{CATEGORIES_NAV}</div>
<form action="{F_ACTION}" method="POST">
<table style="width:100%;">
diff --git a/template/default/admin/configuration.tpl b/template/default/admin/configuration.tpl
index 9349c63b7..0f8bccf01 100644
--- a/template/default/admin/configuration.tpl
+++ b/template/default/admin/configuration.tpl
@@ -1,15 +1,3 @@
-<!-- BEGIN errors -->
-<div class="errors">
-<ul>
- <!-- BEGIN error -->
- <li>{errors.error.ERROR}</li>
- <!-- END error -->
-</ul>
-</div>
-<!-- END errors -->
-<!-- BEGIN confirmation -->
-<div class="info">{L_CONFIRM}</div>
-<!-- END confirmation -->
<form method="post" action="{F_ACTION}">
<table width="100%" align="center">
<!-- BEGIN general -->
diff --git a/template/default/admin/group_list.tpl b/template/default/admin/group_list.tpl
index 3a5688af0..89cdf1bb2 100644
--- a/template/default/admin/group_list.tpl
+++ b/template/default/admin/group_list.tpl
@@ -1,12 +1,3 @@
-<!-- BEGIN errors -->
-<div class="errors">
-<ul>
- <!-- BEGIN error -->
- <li>{errors.error.ERROR}</li>
- <!-- END error -->
-</ul>
-</div>
-<!-- END errors -->
<form method="post" name="post" action="{S_GROUP_ACTION}">
<div class="admin">{L_GROUP_SELECT}</div>
<!-- BEGIN select_box -->
@@ -49,4 +40,4 @@
</div>
<br />
<!-- END edit_group -->
-</form> \ No newline at end of file
+</form>
diff --git a/template/default/admin/images/errors.png b/template/default/admin/images/errors.png
new file mode 100644
index 000000000..887ec3d67
--- /dev/null
+++ b/template/default/admin/images/errors.png
Binary files differ
diff --git a/template/default/admin/images/infos.png b/template/default/admin/images/infos.png
new file mode 100644
index 000000000..bf20a2e4c
--- /dev/null
+++ b/template/default/admin/images/infos.png
Binary files differ
diff --git a/template/default/admin/picture_modify.tpl b/template/default/admin/picture_modify.tpl
index 2816c9c69..5cd889e83 100644
--- a/template/default/admin/picture_modify.tpl
+++ b/template/default/admin/picture_modify.tpl
@@ -1,12 +1,3 @@
-<!-- BEGIN errors -->
-<div class="errors">
-<ul>
- <!-- BEGIN error -->
- <li>{errors.error.ERROR}</li>
- <!-- END error -->
-</ul>
-</div>
-<!-- END errors -->
<div class="admin">{TITLE_IMG}</div>
<form action="{F_ACTION}" method="POST">
<table style="width:100%;">
diff --git a/template/default/admin/remote_site.tpl b/template/default/admin/remote_site.tpl
index 4b8260279..46a466c29 100644
--- a/template/default/admin/remote_site.tpl
+++ b/template/default/admin/remote_site.tpl
@@ -1,19 +1,5 @@
{REMOTE_SITE_TITLE}
-<!-- BEGIN errors -->
-<div class="errors">
- <ul>
- <!-- BEGIN error -->
- <li>{errors.error.ERROR}</li>
- <!-- END error -->
- </ul>
-</div>
-<!-- END errors -->
-
-<!-- BEGIN confirmation -->
-<div class="info">{confirmation.CONTENT}</div>
-<!-- END confirmation -->
-
<!-- BEGIN update -->
<div class="admin">{L_RESULT_UPDATE}</div>
<ul style="text-align:left;">
diff --git a/template/default/admin/thumbnail.tpl b/template/default/admin/thumbnail.tpl
index d362b017d..8f4738950 100644
--- a/template/default/admin/thumbnail.tpl
+++ b/template/default/admin/thumbnail.tpl
@@ -1,13 +1,3 @@
-<!-- BEGIN errors -->
-<div class="errors">
-<ul>
- <!-- BEGIN error -->
- <li>{errors.error.ERROR}</li>
- <!-- END error -->
-</ul>
-</div>
-<!-- END errors -->
-
<!-- BEGIN results -->
<div class="admin">{L_RESULTS}</div>
<table style="width:100%;">
diff --git a/template/default/admin/update.tpl b/template/default/admin/update.tpl
index d1f3adf5a..3a1ae33d3 100644
--- a/template/default/admin/update.tpl
+++ b/template/default/admin/update.tpl
@@ -7,27 +7,27 @@
<li class="update_summary_del">{update.NB_DEL_ELEMENTS} {L_NB_DEL_ELEMENTS}</li>
<li class="update_summary_err">{update.NB_ERRORS} {L_UPDATE_NB_ERRORS}</li>
</ul>
-<!-- BEGIN errors -->
+<!-- BEGIN update_errors -->
<div class="admin">{L_UPDATE_ERROR_LIST_TITLE}</div>
<ul style="text-align:left;">
- <!-- BEGIN error -->
- <li>[{update.errors.error.ELEMENT}] {update.errors.error.LABEL}</li>
- <!-- END error -->
+ <!-- BEGIN update_error -->
+ <li>[{update.update_errors.update_error.ELEMENT}] {update.update_errors.update_error.LABEL}</li>
+ <!-- END update_error -->
</ul>
<div class="admin">{L_UPDATE_ERRORS_CAPTION}</div>
<ul style="text-align:left;">
<li><strong>PWG-UPDATE-1</strong> : {L_UPDATE_WRONG_DIRNAME_INFO}</li>
<li><strong>PWG-UPDATE-2</strong> : {L_UPDATE_MISSING_TN_INFO} {{PICTURE_EXT_LIST}}</li>
</ul>
-<!-- END errors -->
-<!-- BEGIN infos -->
+<!-- END update_errors -->
+<!-- BEGIN update_infos -->
<div class="admin">{L_UPDATE_INFOS_TITLE}</div>
<ul style="text-align:left;">
- <!-- BEGIN info -->
- <li>[{update.infos.info.ELEMENT}] {update.infos.info.LABEL}</li>
- <!-- END info -->
+ <!-- BEGIN update_info -->
+ <li>[{update.update_infos.update_info.ELEMENT}] {update.update_infos.update_info.LABEL}</li>
+ <!-- END update_info -->
</ul>
-<!-- END infos -->
+<!-- END update_infos -->
<!-- END update -->
<!-- BEGIN metadata_result -->
diff --git a/template/default/admin/waiting.tpl b/template/default/admin/waiting.tpl
index 6c2cbd104..06bd7881f 100644
--- a/template/default/admin/waiting.tpl
+++ b/template/default/admin/waiting.tpl
@@ -1,7 +1,4 @@
<form action="{F_ACTION}" method="post">
- <!-- BEGIN confirmation -->
- <div class="info">{L_WAITING_CONFIRMATION}</div>
- <!-- END confirmation -->
<table style="width:100%;" >
<tr class="throw">
<th style="width:20%;">{L_CATEGORY}</th>
diff --git a/template/default/default.css b/template/default/default.css
index 35f54769c..2b5ed28fc 100644
--- a/template/default/default.css
+++ b/template/default/default.css
@@ -381,3 +381,35 @@ pre { text-align:left; }
label:hover {
cursor: pointer;
}
+
+/**
+ * Errors box in administration
+ */
+#errors {
+ text-align: left;
+ background-color: red;
+ background-image: url(admin/images/errors.png);
+ background-repeat: no-repeat;
+ background-position: top right;
+ color: white;
+ font-weight: bold;
+ margin: 5px;
+ border:1px solid black;
+ padding: 10px 50px 10px 10px;
+}
+
+/**
+ * Informations box in administration
+ */
+#infos {
+ text-align: left;
+ background-color: #eee;
+ background-image: url(admin/images/infos.png);
+ background-repeat: no-repeat;
+ background-position: top right;
+ color: black;
+ font-weight: bold;
+ margin: 5px;
+ border:1px solid gray;
+ padding: 10px 50px 10px 10px;
+} \ No newline at end of file