diff options
author | plegall <plg@piwigo.org> | 2004-11-13 13:43:53 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2004-11-13 13:43:53 +0000 |
commit | 88e4e1e60adf660651f9276ab2b19bffcc72d9d3 (patch) | |
tree | c5ee67d2ba4ee38b2864cf136787d187d12a2c07 | |
parent | 234b7463520902a62e0c3e4e35c00a9e27f14278 (diff) |
- admin/cat_options page added : manage options for the whole categories
tree (uploadable, commentable). status and visible will be soon added
- admin.php : $conf_link var to avoid lines longer than 79 characters
- config.upload_available configuration parameter disappear : it's simpler
to manage with cat_options
- config.show_comments idem : new column categories.commentable, each
categories can be commentable or not
- categories.site_id becomes a nullable column : a virtual category does
belong to no site
- function display_select_categories has a new argument : $CSS_classes array
to optionnaly assign a CSS class to each category in the select field
- added informations in include/config.inc.php for setting default value of :
- categories.visible
- categories.status
- categories.uploadable
- categories.commentable
- 2 new indexes images_i3(average_rate) and images_i4(hit) : optimizes best
rated and most visited categories
git-svn-id: http://piwigo.org/svn/trunk@602 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin.php | 21 | ||||
-rw-r--r-- | admin/cat_list.php | 8 | ||||
-rw-r--r-- | admin/configuration.php | 13 | ||||
-rw-r--r-- | admin/remote_site.php | 2 | ||||
-rw-r--r-- | admin/update.php | 3 | ||||
-rw-r--r-- | category.php | 8 | ||||
-rw-r--r-- | include/category_default.inc.php | 4 | ||||
-rw-r--r-- | include/config.inc.php | 15 | ||||
-rw-r--r-- | include/functions_category.inc.php | 19 | ||||
-rw-r--r-- | install/config.sql | 2 | ||||
-rw-r--r-- | install/dbscheme.txt | 8 | ||||
-rw-r--r-- | install/phpwebgallery_structure.sql | 9 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/admin.lang.php | 17 | ||||
-rw-r--r-- | language/fr_FR.iso-8859-1/admin.lang.php | 4 | ||||
-rw-r--r-- | picture.php | 9 | ||||
-rw-r--r-- | search.php | 3 | ||||
-rw-r--r-- | template/default/admin.tpl | 1 | ||||
-rw-r--r-- | template/default/admin/configuration.tpl | 14 | ||||
-rw-r--r-- | template/default/default.css | 32 |
19 files changed, 129 insertions, 63 deletions
@@ -132,6 +132,12 @@ switch ( $_GET['page'] ) $page_valide = true; break; } + case 'cat_options' : + { + $title = $lang['title_cat_options']; + $page_valide = true; + break; + } default: $title = $lang['title_default']; break; } @@ -159,6 +165,7 @@ if ( mysql_num_rows( $result ) > 0 ) } $link_start = PHPWG_ROOT_PATH.'admin.php?page='; +$conf_link = $link_start.'configuration&section='; //----------------------------------------------------- template initialization include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames( array('admin'=>'admin.tpl') ); @@ -192,13 +199,14 @@ $template->assign_vars(array( 'L_GROUPS'=>$lang['groups'], 'L_AUTH'=>$lang['permissions'], 'L_UPDATE'=>$lang['update'], + 'L_CAT_OPTIONS'=>$lang['cat_options_menu'], - 'U_CONFIG_GENERAL'=>add_session_id($link_start.'configuration&section=general' ), - 'U_CONFIG_COMMENTS'=>add_session_id($link_start.'configuration&section=comments' ), - 'U_CONFIG_DISPLAY'=>add_session_id($link_start.'configuration&section=default' ), - 'U_CONFIG_UPLOAD'=>add_session_id($link_start.'configuration&section=upload' ), - 'U_CONFIG_SESSION'=>add_session_id($link_start.'configuration&section=session' ), - 'U_CONFIG_METADATA'=>add_session_id($link_start.'configuration&section=metadata' ), + 'U_CONFIG_GENERAL'=>add_session_id($conf_link.'general' ), + 'U_CONFIG_COMMENTS'=>add_session_id($conf_link.'comments' ), + 'U_CONFIG_DISPLAY'=>add_session_id($conf_link.'default' ), + 'U_CONFIG_UPLOAD'=>add_session_id($conf_link.'upload' ), + 'U_CONFIG_SESSION'=>add_session_id($conf_link.'session' ), + 'U_CONFIG_METADATA'=>add_session_id($conf_link.'metadata' ), 'U_SITES'=>add_session_id($link_start.'remote_site'), 'U_PHPINFO'=>add_session_id($link_start.'admin_phpinfo' ), 'U_USERS'=>add_session_id($link_start.'user_search' ), @@ -211,6 +219,7 @@ $template->assign_vars(array( 'U_THUMBNAILS'=>add_session_id($link_start.'thumbnail' ), 'U_HISTORY'=>add_session_id($link_start.'stats' ), 'U_FAQ'=>add_session_id($link_start.'help' ), + 'U_CAT_OPTIONS'=>add_session_id($link_start.'cat_options'), 'U_RETURN'=>add_session_id(PHPWG_ROOT_PATH.'category.php') )); diff --git a/admin/cat_list.php b/admin/cat_list.php index ca3953f78..c57840481 100644 --- a/admin/cat_list.php +++ b/admin/cat_list.php @@ -40,7 +40,7 @@ $navigation = $lang['gallery_index']; // +-----------------------------------------------------------------------+ // | virtual categories management | // +-----------------------------------------------------------------------+ -// request to add a virtual category +// request to delete a virtual category if (isset($_GET['delete']) and is_numeric($_GET['delete'])) { $to_delete_categories = array(); @@ -48,7 +48,7 @@ if (isset($_GET['delete']) and is_numeric($_GET['delete'])) delete_categories($to_delete_categories); array_push($infos, $lang['cat_list_virtual_category_deleted']); } -// request to delete a virtual category +// request to add a virtual category else if (isset($_POST['submit'])) { // is the given category name only containing blank spaces ? @@ -75,9 +75,9 @@ SELECT uppercats // we have then to add the virtual category $query = ' INSERT INTO '.CATEGORIES_TABLE.' - (name,id_uppercat,rank) + (name,id_uppercat,rank,site_id) VALUES - (\''.$_POST['virtual_name'].'\','.$parent_id.','.$_POST['rank'].') + (\''.$_POST['virtual_name'].'\','.$parent_id.','.$_POST['rank'].',NULL) ;'; pwg_query($query); diff --git a/admin/configuration.php b/admin/configuration.php index bec557c5b..417d6416f 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -199,8 +199,6 @@ switch ($page['section']) } case 'comments' : { - $show_yes = ($conf['show_comments']=='true')?'checked="checked"':''; - $show_no = ($conf['show_comments']=='false')?'checked="checked"':''; $all_yes = ($conf['comments_forall']=='true')?'checked="checked"':''; $all_no = ($conf['comments_forall']=='false')?'checked="checked"':''; $validate_yes = ($conf['comments_validation']=='true')?'checked="checked"':''; @@ -210,8 +208,6 @@ switch ($page['section']) 'comments', array( 'L_CONF_TITLE'=>$lang['conf_comments_title'], - 'L_CONF_SHOW_COMMENTS'=>$lang['conf_show_comments'], - 'L_CONF_SHOW_COMMENTS_INFO'=>$lang['conf_show_comments_info'], 'L_CONF_COMMENTS_ALL'=>$lang['conf_comments_forall'], 'L_CONF_COMMENTS_ALL_INFO'=>$lang['conf_comments_forall_info'], 'L_CONF_NB_COMMENTS_PAGE'=>$lang['conf_nb_comment_page'], @@ -220,8 +216,6 @@ switch ($page['section']) 'L_CONF_VALIDATE_INFO'=>$lang['conf_comments_validation_info'], 'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'], - 'SHOW_COMMENTS_YES'=>$show_yes, - 'SHOW_COMMENTS_NO'=>$show_no, 'COMMENTS_ALL_YES'=>$all_yes, 'COMMENTS_ALL_NO'=>$all_no, 'VALIDATE_YES'=>$validate_yes, @@ -270,15 +264,10 @@ switch ($page['section']) } case 'upload' : { - $upload_yes = ($conf['upload_available']=='true')?'checked="checked"':''; - $upload_no = ($conf['upload_available']=='false')?'checked="checked"':''; - $template->assign_block_vars( 'upload', array( 'L_CONF_TITLE'=>$lang['conf_upload_title'], - 'L_CONF_UPLOAD'=>$lang['conf_authorize_upload'], - 'L_CONF_UPLOAD_INFO'=>$lang['conf_authorize_upload_info'], 'L_CONF_MAXSIZE'=>$lang['conf_upload_maxfilesize'], 'L_CONF_MAXSIZE_INFO'=>$lang['conf_upload_maxfilesize_info'], 'L_CONF_MAXWIDTH'=>$lang['conf_upload_maxwidth'], @@ -295,8 +284,6 @@ switch ($page['section']) 'UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight'], 'TN_UPLOAD_MAXWIDTH'=>$conf['upload_maxwidth_thumbnail'], 'TN_UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight_thumbnail'], - 'UPLOAD_YES'=>$upload_yes, - 'UPLOAD_NO'=>$upload_no )); break; } diff --git a/admin/remote_site.php b/admin/remote_site.php index b1c913914..5aaf1a08f 100644 --- a/admin/remote_site.php +++ b/admin/remote_site.php @@ -485,8 +485,6 @@ INSERT INTO '.IMAGE_CATEGORY_TABLE.' // +-----------------------------------------------------------------------+ $template->set_filenames(array('remote_site'=>'admin/remote_site.tpl')); -$action = PHPWG_ROOT_PATH.'admin.php?page=remote_site'; - $template->assign_vars( array( 'L_SUBMIT'=>$lang['submit'], diff --git a/admin/update.php b/admin/update.php index a01926c18..fc920ebb6 100644 --- a/admin/update.php +++ b/admin/update.php @@ -603,7 +603,8 @@ SELECT id display_select_categories($structure, ' ', array(), - 'introduction.category_option'); + 'introduction.category_option', + array()); } // +-----------------------------------------------------------------------+ // | synchronize files | diff --git a/category.php b/category.php index 8de82086d..516be0238 100644 --- a/category.php +++ b/category.php @@ -295,10 +295,10 @@ else if ( isset ( $page['cat'] ) ) { // upload a picture in the category - if ( is_numeric( $page['cat'] ) - and $page['cat_site_id'] == 1 - and $conf['upload_available'] - and $page['cat_uploadable'] ) + if (is_numeric($page['cat']) + and $page['cat_site_id'] == 1 + and $page['cat_dir'] != '' + and $page['cat_uploadable']) { $url = PHPWG_ROOT_PATH.'upload.php?cat='.$page['cat']; $template->assign_block_vars( diff --git a/include/category_default.inc.php b/include/category_default.inc.php index 9ecc4bded..983ec66be 100644 --- a/include/category_default.inc.php +++ b/include/category_default.inc.php @@ -120,7 +120,9 @@ while ($row = mysql_fetch_array($result)) ) ); - if ($conf['show_comments'] and $user['show_nb_comments']) + if ($user['show_nb_comments'] + and is_numeric($page['cat']) + and $page['cat_commentable']) { $query = ' SELECT COUNT(*) AS nb_comments diff --git a/include/config.inc.php b/include/config.inc.php index c60c46ca5..4d9d0428d 100644 --- a/include/config.inc.php +++ b/include/config.inc.php @@ -167,4 +167,19 @@ $conf['show_queries'] = false; // show_gt : display generation time at the bottom of each page $conf['show_gt'] = true; + +// Default options for new categories. +// +// Some options for categories (commentable, uploadable, status, visible) +// must be set directly in the database by changing the corresponding +// default values of the column. Examples : +// +// ALTER TABLE phpwebgallery_categories ALTER visible SET DEFAULT 'true'; +// ALTER TABLE phpwebgallery_categories ALTER status SET DEFAULT 'private'; +// ALTER TABLE phpwebgallery_categories ALTER uploadable SET DEFAULT 'true'; +// ALTER TABLE phpwebgallery_categories ALTER commentable SET DEFAULT 'false'; +// +// MySQL default values are used when inserting a row and that no value is +// given for the column. In PhpWebGallery, the above columns are not valued +// during categories insertion, so default values are important. ?> diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index 569115479..ffbabbe35 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -308,7 +308,7 @@ function get_cat_info( $id ) { $infos = array( 'nb_images','id_uppercat','comment','site_id','galleries_url' ,'dir','date_last','uploadable','status','visible' - ,'representative_picture_id','uppercats' ); + ,'representative_picture_id','uppercats','commentable' ); $query = 'SELECT '.implode( ',', $infos ); $query.= ' FROM '.CATEGORIES_TABLE.' AS a'; @@ -454,6 +454,7 @@ function initialize_category( $calling_page = 'category' ) $page['cat_nb_images'] = $result['nb_images']; $page['cat_site_id'] = $result['site_id']; $page['cat_uploadable'] = $result['uploadable']; + $page['cat_commentable'] = $result['commentable']; $page['uppercats'] = $result['uppercats']; $page['title'] = get_cat_display_name( $page['cat_name'],' - ','',false); $page['where'] = ' WHERE category_id = '.$page['cat']; @@ -911,7 +912,8 @@ function get_first_non_empty_cat_id( $id_uppercat ) function display_select_categories($categories, $indent, $selecteds, - $blockname) + $blockname, + $CSS_classes) { global $template,$user; @@ -925,17 +927,28 @@ function display_select_categories($categories, $selected = ' selected="selected"'; } + $class = ''; + foreach (array_keys($CSS_classes) as $CSS_class) + { + if (in_array($category['id'], $CSS_classes[$CSS_class])) + { + $class = $CSS_class; + } + } + $template->assign_block_vars( $blockname, array('SELECTED'=>$selected, 'VALUE'=>$category['id'], + 'CLASS'=>$class, 'OPTION'=>$indent.'- '.$category['name'] )); display_select_categories($category['subcats'], $indent.str_repeat(' ',3), $selecteds, - $blockname); + $blockname, + $CSS_classes); } } } diff --git a/install/config.sql b/install/config.sql index 52f810885..2c8d2594d 100644 --- a/install/config.sql +++ b/install/config.sql @@ -5,9 +5,7 @@ INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('mail_webmaster', INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('default_language','en_UK.iso-8859-1','Default gallery language'); INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('default_template','default','Default gallery style'); INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('access','free','access type to your gallery (free|restricted)'); -INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('show_comments','true','display the users comments'); INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nb_comment_page','10','number of comments to display on each page'); -INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_available','false','authorizing the upload of pictures by users'); INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_maxfilesize','150','maximum filesize for the uploaded pictures'); INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_maxwidth','800','maximum width authorized for the uploaded images'); INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_maxheight','600','maximum height authorized for the uploaded images'); diff --git a/install/dbscheme.txt b/install/dbscheme.txt index de53364c0..b190134b5 100644 --- a/install/dbscheme.txt +++ b/install/dbscheme.txt @@ -25,11 +25,12 @@ column:comment table:categories type:text column:dir table:categories type:varchar nullable:Y length:255 binary:N column:rank table:categories type:tinyint nullable:Y length:3 signed:N column:status table:categories type:enum('public','private') nullable:N -column:site_id table:categories type:tinyint nullable:N length:4 signed:N +column:site_id table:categories type:tinyint nullable:Y length:4 signed:N column:visible table:categories type:enum('true','false') nullable:N column:uploadable table:categories type:enum('true','false') nullable:N column:representative_picture_id table:categories type:mediumint nullable:Y length:8 signed:N column:uppercats table:categories type:varchar nullable:N length:255 binary:N +column:commentable table:categories type:enum('true','false') nullable:N column:id table:comments type:int nullable:N length:11 signed:N column:image_id table:comments type:mediumint nullable:N length:8 signed:N column:date table:comments type:datetime nullable:N @@ -45,7 +46,7 @@ column:group_id table:group_access type:smallint column:cat_id table:group_access type:smallint nullable:N length:5 signed:N column:id table:groups type:smallint nullable:N length:5 signed:N column:name table:groups type:varchar nullable:N length:255 binary:N -column:date table:history type:int nullable:N length:11 signed:Y +column:date table:history type:datetime nullable:N column:login table:history type:varchar nullable:Y length:15 binary:N column:IP table:history type:varchar nullable:N length:50 binary:N column:category table:history type:varchar nullable:Y length:150 binary:N @@ -116,6 +117,7 @@ PK:favorites_pk table:favorites column:image_id PK:group_access_pk table:group_access column:group_id PK:group_access_pk table:group_access column:cat_id PK:groups_pk table:groups column:id +PK:history_pk table:history column:date PK:image_category_pk table:image_category column:image_id PK:image_category_pk table:image_category column:category_id PK:images_pk table:images column:id @@ -135,5 +137,7 @@ index:image_category_i1 table:image_category column:image_id index:image_category_i2 table:image_category column:category_id index:images_i2 table:images column:date_available index:images_i1 table:images column:storage_category_id +index:images_i3 table:images column:average_rate +index:images_i4 table:images column:hit index:sites_ui1 table:sites column:galleries_url index:users_ui1 table:users column:username diff --git a/install/phpwebgallery_structure.sql b/install/phpwebgallery_structure.sql index 8ad3d1f7a..b45845675 100644 --- a/install/phpwebgallery_structure.sql +++ b/install/phpwebgallery_structure.sql @@ -19,11 +19,12 @@ CREATE TABLE phpwebgallery_categories ( dir varchar(255) default NULL, rank tinyint(3) unsigned default NULL, status enum('public','private') NOT NULL default 'public', - site_id tinyint(4) unsigned NOT NULL default '1', + site_id tinyint(4) unsigned default '1', visible enum('true','false') NOT NULL default 'true', uploadable enum('true','false') NOT NULL default 'false', representative_picture_id mediumint(8) unsigned default NULL, uppercats varchar(255) NOT NULL default '', + commentable enum('true','false') NOT NULL default 'true', PRIMARY KEY (id), KEY categories_i2 (id_uppercat) ) TYPE=MyISAM; @@ -100,7 +101,7 @@ CREATE TABLE phpwebgallery_history ( category varchar(150) default NULL, file varchar(50) default NULL, picture varchar(150) default NULL, - PRIMARY KEY `date` (`date`) + PRIMARY KEY (date) ) TYPE=MyISAM; -- @@ -141,7 +142,9 @@ CREATE TABLE phpwebgallery_images ( average_rate float(5,2) unsigned default NULL, PRIMARY KEY (id), KEY images_i2 (date_available), - KEY images_i1 (storage_category_id) + KEY images_i1 (storage_category_id), + KEY images_i3 (average_rate), + KEY images_i4 (hit) ) TYPE=MyISAM; -- diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php index c6bcdace5..8b5419b39 100644 --- a/language/en_UK.iso-8859-1/admin.lang.php +++ b/language/en_UK.iso-8859-1/admin.lang.php @@ -108,6 +108,7 @@ $lang['title_thumbnails'] = 'Thumbnail creation'; $lang['title_thumbnails_2'] = 'for'; $lang['title_default'] = 'PhpWebGallery administration'; $lang['title_waiting'] = 'Pictures waiting for validation'; +$lang['title_cat_options'] = 'Categories options'; //Error messages $lang['cat_error_name'] = 'The name of a category mustn\'t be empty'; @@ -133,8 +134,6 @@ $lang['conf_notification_info'] = 'Automated mail notification for adminsitrator // Configuration -> comments $lang['conf_comments_title'] = 'Users comments'; -$lang['conf_show_comments'] = 'Show users comments'; -$lang['conf_show_comments_info'] = 'Display the users comments under each picture ?'; $lang['conf_comments_forall'] = 'Comments for all ?'; $lang['conf_comments_forall_info'] = 'Even guest not registered can post comments'; $lang['conf_nb_comment_page'] = 'Number of comments per page'; @@ -155,8 +154,6 @@ $lang['conf_show_nb_comments_info'] = 'show the number of comments for each pict // Configuration -> upload $lang['conf_upload_title'] = 'Users upload'; -$lang['conf_authorize_upload'] = 'Authorize upload of pictures'; -$lang['conf_authorize_upload_info'] = ''; $lang['conf_upload_maxfilesize'] = 'Maximum filesize'; $lang['conf_upload_maxfilesize_info'] = 'Maximum filesize for the uploaded pictures. Must be a number between 10 and 1000 KB.'; $lang['conf_upload_maxfilesize_error'] = 'Maximum filesize for the uploaded pictures must be a number between 10 and 1000 KB.'; @@ -325,4 +322,16 @@ $lang['cat_list_update_metadata'] = 'Synchronize<br />metadata'; $lang['cat_list_update_metadata_confirmation'] = 'files metadata updated'; $lang['cat_list_virtual_category_added'] = 'virtual category added'; $lang['cat_list_virtual_category_deleted'] = 'virtual category deleted'; + +$lang['cat_options_menu'] = 'Options'; +$lang['cat_options_menu_upload'] = 'upload'; +$lang['cat_options_menu_visible'] = 'lock'; +$lang['cat_options_menu_comments'] = 'comments'; +$lang['cat_options_menu_status'] = 'access'; +$lang['cat_options_upload_true'] = 'authorize upload'; +$lang['cat_options_upload_false'] = 'forbid upload'; +$lang['cat_options_upload_info'] = '(multi)select categories to make them uploadable or not. Upload is not applicable to virtual categories and to categories from a remote site.'; +$lang['cat_options_comments_true'] = 'authorize comments'; +$lang['cat_options_comments_false'] = 'forbid comments'; +$lang['cat_options_comments_info'] = '(multi)select categories to make them commentable or not. By inheritance, an element is commentable if it belongs at least to one commentable category.'; ?>
\ No newline at end of file diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php index 60f1e682d..66793b049 100644 --- a/language/fr_FR.iso-8859-1/admin.lang.php +++ b/language/fr_FR.iso-8859-1/admin.lang.php @@ -135,8 +135,6 @@ $lang['conf_notification_info'] = 'Notification automatique par mail des adminis // Configuration -> comments $lang['conf_comments_title'] = 'Configuration des commentaires'; -$lang['conf_show_comments'] = 'Commentaires utilisateurs'; -$lang['conf_show_comments_info'] = 'Afficher les commentaires utilisateurs sous chaque images ?'; $lang['conf_comments_forall'] = 'Autoriser pour tous ?'; $lang['conf_comments_forall_info'] = 'Même les invités non enregistrés peuvent déposer les messages'; $lang['conf_nb_comment_page'] = 'Nombre de commentaires par page'; @@ -159,8 +157,6 @@ $lang['conf_default_maxheight_info'] = 'Idem mais pour la hauteur des images'; // Configuration -> upload $lang['conf_upload_title'] = 'Configuration de l\'envoi d\'images par les utilisateurs'; -$lang['conf_authorize_upload'] = 'Autoriser l\'ajout d\'images'; -$lang['conf_authorize_upload_info'] = 'Autoriser l\'ajout d\'image par les utilisateurs dans les catégories du site (pas sur un site distant). Ceci est un paramètre général, il est nécessaire pour autoriser l\'upload catégorie par catégorie.'; $lang['conf_upload_maxfilesize'] = 'Poids maximum'; $lang['conf_upload_maxfilesize_info'] = 'Poids maximum autorisé pour les images uploadées. Celui-ci doit être un entier compris entre 10 et 1000, en Ko.'; $lang['conf_upload_maxfilesize_error'] = 'Le poids maximum pour les images uploadés doit être un entier compris entre 10 et 1000.'; diff --git a/picture.php b/picture.php index 4335f2a23..171bc5e50 100644 --- a/picture.php +++ b/picture.php @@ -753,6 +753,7 @@ $query.= ' ;'; $result = pwg_query($query); $categories = ''; +$page['show_comments'] = false; while ($row = mysql_fetch_array($result)) { if ($categories != '') @@ -761,6 +762,12 @@ while ($row = mysql_fetch_array($result)) } $cat_info = get_cat_info($row['category_id']); $categories .= get_cat_display_name($cat_info['name'], ' >'); + // the picture is commentable if it belongs at least to one category which + // is commentable + if ($cat_info['commentable']) + { + $page['show_comments'] = true; + } } $template->assign_block_vars( 'info_line', @@ -920,7 +927,7 @@ SELECT rate } //---------------------------------------------------- users's comments display -if ( $conf['show_comments'] ) +if ($page['show_comments']) { // number of comment for this picture $query = 'SELECT COUNT(*) AS nb_comments'; diff --git a/search.php b/search.php index 1ff498db7..673112424 100644 --- a/search.php +++ b/search.php @@ -352,7 +352,8 @@ if (isset($_POST['submit'])) display_select_categories($structure, ' ', $selecteds, - 'category_option'); + 'category_option', + array()); $categories_selected = ''; if (isset($_POST['categories-check'])) diff --git a/template/default/admin.tpl b/template/default/admin.tpl index 3504b16ab..e971f0f95 100644 --- a/template/default/admin.tpl +++ b/template/default/admin.tpl @@ -38,6 +38,7 @@ <ul class="menu"> <li><a class="adminMenu" href="{U_CATEGORIES}">{L_MANAGE}</a></li> <li><a class="adminMenu" href="{U_UPLOAD}">{L_UPLOAD}</a></li> + <li><a class="adminMenu" href="{U_CAT_OPTIONS}">{L_CAT_OPTIONS}</a></li> </ul> </div> <div class="titreMenu">{L_IMAGES}</div> diff --git a/template/default/admin/configuration.tpl b/template/default/admin/configuration.tpl index 26605c14b..0d90e356b 100644 --- a/template/default/admin/configuration.tpl +++ b/template/default/admin/configuration.tpl @@ -51,12 +51,7 @@ <td colspan="2"> </td> </tr> <tr> - <td width="70%"><strong>{comments.L_CONF_SHOW_COMMENTS} :</strong><br /><span class="small">{comments.L_CONF_SHOW_COMMENTS_INFO}</span></td> - <td class="row1"><input type="radio" class="radio" name="show_comments" value="true" {comments.SHOW_COMMENTS_YES} />{L_YES} - <input type="radio" class="radio" name="show_comments" value="false" {comments.SHOW_COMMENTS_NO} />{L_NO}</td> - </tr> - <tr> - <td><strong>{comments.L_CONF_COMMENTS_ALL} :</strong><br /><span class="small">{comments.L_CONF_COMMENTS_ALL_INFO}</span></td> + <td width="70%"><strong>{comments.L_CONF_COMMENTS_ALL} :</strong><br /><span class="small">{comments.L_CONF_COMMENTS_ALL_INFO}</span></td> <td class="row1"><input type="radio" class="radio" name="comments_forall" value="true" {comments.COMMENTS_ALL_YES} />{L_YES} <input type="radio" class="radio" name="comments_forall" value="false" {comments.COMMENTS_ALL_NO} />{L_NO}</td> </tr> @@ -116,12 +111,7 @@ <td colspan="2"> </td> </tr> <tr> - <td width="70%"><strong>{upload.L_CONF_UPLOAD} :</strong><br /><span class="small">{upload.L_CONF_UPLOAD_INFO}</span></td> - <td class="row1"><input type="radio" class="radio" name="upload_available" value="true" {upload.UPLOAD_YES} />{L_YES} - <input type="radio" class="radio" name="upload_available" value="false" {upload.UPLOAD_NO} />{L_NO}</td> - </tr> - <tr> - <td><strong>{upload.L_CONF_MAXSIZE} :</strong><br /><span class="small">{upload.L_CONF_MAXSIZE_INFO}</span></td> + <td width="70%"><strong>{upload.L_CONF_MAXSIZE} :</strong><br /><span class="small">{upload.L_CONF_MAXSIZE_INFO}</span></td> <td class="row1"><input type="text" size="4" maxlength="4" name="upload_maxfilesize" value="{upload.UPLOAD_MAXSIZE}" /></td> </tr> <tr> diff --git a/template/default/default.css b/template/default/default.css index 4994645ab..abf187d63 100644 --- a/template/default/default.css +++ b/template/default/default.css @@ -424,4 +424,36 @@ div.remoteLocal { /* for debugging purpose */ pre { text-align:left; +} + +.confMenu { + background-color:#444444; + text-align:center; +} + +.confMenu a { + padding:2px; + border:1px solid gray; + background-color:#505050; + color:#fff48e; + color:lightgray; +} + +.confMenu a:hover { + color:orange; + text-decoration:none; +} + +.confMenu a.opened { + background-color:gray; + color:white; + text-decoration:none; +} + +.optionTrue { + color:lightgreen; +} + +.optionFalse { + color:#ffe1e1; }
\ No newline at end of file |