From 5436a351ef6dd685483f022af6656bbf8b797cb6 Mon Sep 17 00:00:00 2001 From: rub Date: Fri, 2 May 2008 21:56:21 +0000 Subject: Resolved issue 0000823: Enhance upload functionalities First commit, others will be follow. Not hesitate to change my translations. Add upload configuration tabsheet (move and add configuration) Change and add define for access level Can show upload link every time Can restrict access upload.class.php Can choice category on upload page Add upload class not use for the moment Review quickly and temporary style of upload.tpl git-svn-id: http://piwigo.org/svn/trunk@2325 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/configuration.php | 43 +++++++++++++++++++++++++++++++++++++++---- admin/include/functions.php | 16 ++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) (limited to 'admin') diff --git a/admin/configuration.php b/admin/configuration.php index 0a89f6e4b..8e69d9c16 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -51,7 +51,6 @@ $main_checkboxes = array( 'rate', 'rate_anonymous', 'email_admin_on_new_user', - 'email_admin_on_picture_uploaded', ); $history_checkboxes = array( @@ -60,6 +59,11 @@ $history_checkboxes = array( 'history_guest' ); +$upload_checkboxes = array( + 'upload_link_everytime', + 'email_admin_on_picture_uploaded', + ); + $comments_checkboxes = array( 'comments_forall', 'comments_validation', @@ -110,6 +114,14 @@ if (isset($_POST['submit']) and !is_adviser()) } break; } + case 'upload' : + { + foreach( $upload_checkboxes as $checkbox) + { + $_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true'; + } + break; + } case 'default' : { // Never go here @@ -160,6 +172,7 @@ $tabsheet = new tabsheet(); $tabsheet->add('main', l10n('conf_main_title'), $conf_link.'main'); $tabsheet->add('history', l10n('conf_history_title'), $conf_link.'history'); $tabsheet->add('comments', l10n('conf_comments_title'), $conf_link.'comments'); +$tabsheet->add('upload', l10n('conf_upload_title'), $conf_link.'upload'); $tabsheet->add('default', l10n('conf_display'), $conf_link.'default'); // TabSheet selection $tabsheet->select($page['section']); @@ -187,7 +200,7 @@ switch ($page['section']) 'CONF_GALLERY_URL' => $conf['gallery_url'], )); - foreach( $main_checkboxes as $checkbox) + foreach ($main_checkboxes as $checkbox) { $template->append( 'main', @@ -202,7 +215,7 @@ switch ($page['section']) case 'history' : { //Necessary for merge_block_vars - foreach( $history_checkboxes as $checkbox) + foreach ($history_checkboxes as $checkbox) { $template->append( 'history', @@ -222,7 +235,7 @@ switch ($page['section']) 'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'], )); - foreach( $comments_checkboxes as $checkbox) + foreach ($comments_checkboxes as $checkbox) { $template->append( 'comments', @@ -234,6 +247,28 @@ switch ($page['section']) } break; } + case 'upload' : + { + $template->assign( + 'upload', + array( + 'upload_user_access_options'=> get_user_access_level_html_options(ACCESS_GUEST), + 'upload_user_access_options_selected' => array($conf['upload_user_access']) + ) + ); + //Necessary for merge_block_vars + foreach ($upload_checkboxes as $checkbox) + { + $template->append( + 'upload', + array( + $checkbox => $conf[$checkbox] + ), + true + ); + } + break; + } case 'default' : { $edit_user = build_user($conf['default_user_id'], false); diff --git a/admin/include/functions.php b/admin/include/functions.php index 94ac4c962..5cb81e9cb 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -1837,4 +1837,20 @@ function create_table_add_character_set($query) } return $query; } + +/** + * Returns array use on template with html_options method + * @param Min and Max access to use + * @return array of user access level + */ +function get_user_access_level_html_options($MinLevelAccess = ACCESS_FREE, $MaxLevelAccess = ACCESS_CLOSED) +{ + $tpl_options = array(); + for ($level = $MinLevelAccess; $level <= $MaxLevelAccess; $level++) + { + $tpl_options[$level] = l10n(sprintf('ACCESS_%d', $level)); + } + return $tpl_options; +} + ?> \ No newline at end of file -- cgit v1.2.3