mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-08 09:43:01 +02:00
- modification : major simplification of admin.php. Titles are managed by
included page, localized items are managed directly in the template. - new : sub template admin/double_select is included in templates admin/cat_options, admin/user_perm and admin/group_perm. I haven't been able to use it in admin/picture_modify because it seems impossible to have two instance of the same sub-template without interfering. - modification : bug 99, in profile manager, no auto submit when changing language (useless and generate accessibility problem). - improvement : HTML semantically correct for administration menu, simpler syntax, less tags, correct tags (dl/dt/dd instead of div/div). - modification : number of waiting elements and unvalidated comments are displayed in admin/intro instead of administration menu (with a link to the dedicated pages). - deletion : no link to profile from admin/user_list anymore (no need). git-svn-id: http://piwigo.org/svn/trunk@817 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
+19
-15
@@ -30,9 +30,11 @@ if (!defined('PHPWG_ROOT_PATH'))
|
||||
die ("Hacking attempt!");
|
||||
}
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | modification registration |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// print '<pre>';
|
||||
// print_r($_POST);
|
||||
// print '</pre>';
|
||||
@@ -129,21 +131,21 @@ UPDATE '.CATEGORIES_TABLE.'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | template init |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$template->set_filenames(array('cat_options'=>'admin/cat_options.tpl'));
|
||||
|
||||
if (!isset($_GET['section']))
|
||||
{
|
||||
$page['section'] = 'upload';
|
||||
}
|
||||
else
|
||||
{
|
||||
$page['section'] = $_GET['section'];
|
||||
}
|
||||
$template->set_filenames(
|
||||
array(
|
||||
'cat_options' => 'admin/cat_options.tpl',
|
||||
'double_select' => 'admin/double_select.tpl'
|
||||
)
|
||||
);
|
||||
|
||||
$page['section'] = isset($_GET['section']) ? $_GET['section'] : 'upload';
|
||||
$base_url = PHPWG_ROOT_PATH.'admin.php?page=cat_options&section=';
|
||||
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_SUBMIT'=>$lang['submit'],
|
||||
@@ -153,7 +155,6 @@ $template->assign_vars(
|
||||
)
|
||||
);
|
||||
|
||||
$template->assign_vars(array(strtoupper($page['section']).'_CLASS'=>'opened'));
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | form display |
|
||||
// +-----------------------------------------------------------------------+
|
||||
@@ -189,7 +190,7 @@ SELECT id,name,uppercats,global_rank
|
||||
;';
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_CAT_TITLE' => $lang['cat_upload_title'],
|
||||
'L_SECTION' => $lang['cat_upload_title'],
|
||||
'L_CAT_OPTIONS_TRUE' => $lang['authorized'],
|
||||
'L_CAT_OPTIONS_FALSE' => $lang['forbidden'],
|
||||
'L_CAT_OPTIONS_INFO' => $lang['cat_upload_info'],
|
||||
@@ -211,7 +212,7 @@ SELECT id,name,uppercats,global_rank
|
||||
;';
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_CAT_TITLE' => $lang['cat_comments_title'],
|
||||
'L_SECTION' => $lang['cat_comments_title'],
|
||||
'L_CAT_OPTIONS_TRUE' => $lang['authorized'],
|
||||
'L_CAT_OPTIONS_FALSE' => $lang['forbidden'],
|
||||
'L_CAT_OPTIONS_INFO' => $lang['cat_comments_info'],
|
||||
@@ -233,7 +234,7 @@ SELECT id,name,uppercats,global_rank
|
||||
;';
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_CAT_TITLE' => $lang['cat_lock_title'],
|
||||
'L_SECTION' => $lang['cat_lock_title'],
|
||||
'L_CAT_OPTIONS_TRUE' => $lang['unlocked'],
|
||||
'L_CAT_OPTIONS_FALSE' => $lang['locked'],
|
||||
'L_CAT_OPTIONS_INFO' => $lang['cat_lock_info'],
|
||||
@@ -255,7 +256,7 @@ SELECT id,name,uppercats,global_rank
|
||||
;';
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_CAT_TITLE' => $lang['cat_status_title'],
|
||||
'L_SECTION' => $lang['cat_status_title'],
|
||||
'L_CAT_OPTIONS_TRUE' => $lang['cat_public'],
|
||||
'L_CAT_OPTIONS_FALSE' => $lang['cat_private'],
|
||||
'L_CAT_OPTIONS_INFO' => $lang['cat_status_info'],
|
||||
@@ -278,7 +279,7 @@ SELECT id,name,uppercats,global_rank
|
||||
;';
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_CAT_TITLE' => l10n('Representative'),
|
||||
'L_SECTION' => l10n('Representative'),
|
||||
'L_CAT_OPTIONS_TRUE' => l10n('singly represented'),
|
||||
'L_CAT_OPTIONS_FALSE' => l10n('randomly represented'),
|
||||
'L_CAT_OPTIONS_INFO' => l10n('')
|
||||
@@ -289,8 +290,11 @@ SELECT id,name,uppercats,global_rank
|
||||
}
|
||||
display_select_cat_wrapper($query_true,array(),'category_option_true');
|
||||
display_select_cat_wrapper($query_false,array(),'category_option_false');
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | sending html code |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$template->assign_var_from_handle('DOUBLE_SELECT', 'double_select');
|
||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'cat_options');
|
||||
?>
|
||||
+14
-4
@@ -196,12 +196,22 @@ SELECT user_id, cat_id
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | template initialization |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$template->set_filenames(array('cat_perm'=>'admin/cat_perm.tpl'));
|
||||
|
||||
$form_action = PHPWG_ROOT_PATH.'admin.php';
|
||||
$form_action.= '?page=cat_perm&cat='.$page['cat'];
|
||||
|
||||
$template->assign_vars(array('F_ACTION' => $form_action));
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'TITLE' =>
|
||||
sprintf(
|
||||
l10n('Manage permissions for category "%s"'),
|
||||
get_cat_display_name_from_id($page['cat'])
|
||||
)
|
||||
'F_ACTION' =>
|
||||
add_session_id(
|
||||
PHPWG_ROOT_PATH.'admin.php?page=cat_perm&cat='.$page['cat']
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | form construction |
|
||||
|
||||
+18
-7
@@ -120,21 +120,31 @@ SELECT cat_id
|
||||
// | template init |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$template->set_filenames(array('group_perm'=>'admin/cat_options.tpl'));
|
||||
$template->set_filenames(
|
||||
array(
|
||||
'group_perm' => 'admin/group_perm.tpl',
|
||||
'double_select' => 'admin/double_select.tpl'
|
||||
)
|
||||
);
|
||||
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_RESET'=>$lang['reset'],
|
||||
'TITLE' =>
|
||||
sprintf(
|
||||
l10n('Manage permissions for group "%s"'),
|
||||
get_groupname($page['group']
|
||||
)
|
||||
),
|
||||
'L_CAT_OPTIONS_TRUE'=>$lang['authorized'],
|
||||
'L_CAT_OPTIONS_FALSE'=>$lang['forbidden'],
|
||||
'L_CAT_OPTIONS_INFO'=>$lang['permuser_info'],
|
||||
|
||||
'F_ACTION' =>
|
||||
add_session_id(
|
||||
PHPWG_ROOT_PATH.
|
||||
'admin.php?page=group_perm&group_id='.
|
||||
$page['group']
|
||||
)
|
||||
add_session_id(
|
||||
PHPWG_ROOT_PATH.
|
||||
'admin.php?page=group_perm&group_id='.
|
||||
$page['group']
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -171,6 +181,7 @@ display_select_cat_wrapper($query_false,array(),'category_option_false');
|
||||
// | html code display |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$template->assign_var_from_handle('DOUBLE_SELECT', 'double_select');
|
||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'group_perm');
|
||||
|
||||
?>
|
||||
|
||||
+39
-1
@@ -192,7 +192,45 @@ $template->assign_vars(
|
||||
add_session_id(PHPWG_ROOT_PATH.'admin.php?action=phpinfo')
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// waiting elements
|
||||
$query = '
|
||||
SELECT COUNT(*)
|
||||
FROM '.WAITING_TABLE.'
|
||||
WHERE validated=\'false\'
|
||||
;';
|
||||
list($nb_waiting) = mysql_fetch_row(pwg_query($query));
|
||||
|
||||
if ($nb_waiting > 0)
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'waiting',
|
||||
array(
|
||||
'URL' => add_session_id(PHPWG_ROOT_PATH.'admin.php?page=waiting'),
|
||||
'INFO' => sprintf(l10n('%d waiting for validation'), $nb_waiting)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// unvalidated comments
|
||||
$query = '
|
||||
SELECT COUNT(*)
|
||||
FROM '.COMMENTS_TABLE.'
|
||||
WHERE validated=\'false\'
|
||||
;';
|
||||
list($nb_comments) = mysql_fetch_row(pwg_query($query));
|
||||
|
||||
if ($nb_comments > 0)
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'unvalidated',
|
||||
array(
|
||||
'URL' => add_session_id(PHPWG_ROOT_PATH.'admin.php?page=comments'),
|
||||
'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | sending html code |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
@@ -167,7 +167,12 @@ $storage_category = get_cat_display_name_cache($row['uppercats'],
|
||||
$url,
|
||||
false);
|
||||
//----------------------------------------------------- template initialization
|
||||
$template->set_filenames(array('picture_modify'=>'admin/picture_modify.tpl'));
|
||||
$template->set_filenames(
|
||||
array(
|
||||
'picture_modify' => 'admin/picture_modify.tpl'
|
||||
)
|
||||
);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TITLE_IMG'=>$title,
|
||||
'STORAGE_CATEGORY_IMG'=>$storage_category,
|
||||
@@ -220,7 +225,7 @@ SELECT id,name,uppercats,global_rank
|
||||
WHERE image_id = '.$_GET['image_id'].'
|
||||
AND id != '.$storage_category_id.'
|
||||
;';
|
||||
display_select_cat_wrapper($query,array(),'associated_option');
|
||||
display_select_cat_wrapper($query, array(), 'associated_option');
|
||||
|
||||
$result = pwg_query($query);
|
||||
$associateds = array($storage_category_id);
|
||||
@@ -233,7 +238,7 @@ SELECT id,name,uppercats,global_rank
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE id NOT IN ('.implode(',', $associateds).')
|
||||
;';
|
||||
display_select_cat_wrapper($query,array(),'dissociated_option');
|
||||
display_select_cat_wrapper($query, array(), 'dissociated_option');
|
||||
|
||||
// representing
|
||||
$query = '
|
||||
@@ -241,7 +246,7 @@ SELECT id,name,uppercats,global_rank
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE representative_picture_id = '.$_GET['image_id'].'
|
||||
;';
|
||||
display_select_cat_wrapper($query,array(),'elected_option');
|
||||
display_select_cat_wrapper($query, array(), 'elected_option');
|
||||
|
||||
$query = '
|
||||
SELECT id,name,uppercats,global_rank
|
||||
@@ -249,7 +254,10 @@ SELECT id,name,uppercats,global_rank
|
||||
WHERE representative_picture_id != '.$_GET['image_id'].'
|
||||
OR representative_picture_id IS NULL
|
||||
;';
|
||||
display_select_cat_wrapper($query,array(),'dismissed_option');
|
||||
display_select_cat_wrapper($query, array(), 'dismissed_option');
|
||||
|
||||
//----------------------------------------------------------- sending html code
|
||||
|
||||
|
||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'picture_modify');
|
||||
?>
|
||||
|
||||
+21
-5
@@ -109,15 +109,28 @@ SELECT cat_id
|
||||
|
||||
mass_inserts(USER_ACCESS_TABLE, array('user_id','cat_id'), $inserts);
|
||||
}
|
||||
//----------------------------------------------------- template initialization
|
||||
$template->set_filenames(array('user_perm'=>'admin/cat_options.tpl'));
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | template init |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$template->set_filenames(
|
||||
array(
|
||||
'user_perm' => 'admin/user_perm.tpl',
|
||||
'double_select' => 'admin/double_select.tpl'
|
||||
)
|
||||
);
|
||||
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_RESET'=>$lang['reset'],
|
||||
'TITLE' =>
|
||||
sprintf(
|
||||
l10n('Manage permissions for user "%s"'),
|
||||
get_username($page['user']
|
||||
)
|
||||
),
|
||||
'L_CAT_OPTIONS_TRUE'=>$lang['authorized'],
|
||||
'L_CAT_OPTIONS_FALSE'=>$lang['forbidden'],
|
||||
'L_CAT_OPTIONS_INFO'=>$lang['permuser_info'],
|
||||
|
||||
'F_ACTION' =>
|
||||
add_session_id(
|
||||
@@ -157,7 +170,10 @@ $query_false.= '
|
||||
;';
|
||||
display_select_cat_wrapper($query_false,array(),'category_option_false');
|
||||
|
||||
//----------------------------------------------------------- sending html code
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | sending html code |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$template->assign_var_from_handle('DOUBLE_SELECT', 'double_select');
|
||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'user_perm');
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user