Changeset 602


Ignore:
Timestamp:
Nov 13, 2004, 2:43:53 PM (19 years ago)
Author:
plg
Message:
  • 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
Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin.php

    r593 r602  
    133133   break;
    134134 }
     135 case 'cat_options' :
     136 {
     137   $title = $lang['title_cat_options'];
     138   $page_valide = true;
     139   break;
     140 }
    135141 default:
    136142   $title = $lang['title_default']; break;
     
    160166
    161167$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
     168$conf_link = $link_start.'configuration&section=';
    162169//----------------------------------------------------- template initialization
    163170include(PHPWG_ROOT_PATH.'include/page_header.php');
     
    193200  'L_AUTH'=>$lang['permissions'],
    194201  'L_UPDATE'=>$lang['update'],
     202  'L_CAT_OPTIONS'=>$lang['cat_options_menu'],
    195203 
    196   'U_CONFIG_GENERAL'=>add_session_id($link_start.'configuration&section=general' ),
    197   'U_CONFIG_COMMENTS'=>add_session_id($link_start.'configuration&section=comments' ),
    198   'U_CONFIG_DISPLAY'=>add_session_id($link_start.'configuration&section=default' ),
    199   'U_CONFIG_UPLOAD'=>add_session_id($link_start.'configuration&section=upload' ),
    200   'U_CONFIG_SESSION'=>add_session_id($link_start.'configuration&section=session' ),
    201   'U_CONFIG_METADATA'=>add_session_id($link_start.'configuration&section=metadata' ),
     204  'U_CONFIG_GENERAL'=>add_session_id($conf_link.'general' ),
     205  'U_CONFIG_COMMENTS'=>add_session_id($conf_link.'comments' ),
     206  'U_CONFIG_DISPLAY'=>add_session_id($conf_link.'default' ),
     207  'U_CONFIG_UPLOAD'=>add_session_id($conf_link.'upload' ),
     208  'U_CONFIG_SESSION'=>add_session_id($conf_link.'session' ),
     209  'U_CONFIG_METADATA'=>add_session_id($conf_link.'metadata' ),
    202210  'U_SITES'=>add_session_id($link_start.'remote_site'),
    203211  'U_PHPINFO'=>add_session_id($link_start.'admin_phpinfo' ),
     
    212220  'U_HISTORY'=>add_session_id($link_start.'stats' ),
    213221  'U_FAQ'=>add_session_id($link_start.'help' ),
     222  'U_CAT_OPTIONS'=>add_session_id($link_start.'cat_options'),
    214223  'U_RETURN'=>add_session_id(PHPWG_ROOT_PATH.'category.php')
    215224  ));
  • trunk/admin/cat_list.php

    r593 r602  
    4141// |                    virtual categories management                      |
    4242// +-----------------------------------------------------------------------+
    43 // request to add a virtual category
     43// request to delete a virtual category
    4444if (isset($_GET['delete']) and is_numeric($_GET['delete']))
    4545{
     
    4949  array_push($infos, $lang['cat_list_virtual_category_deleted']);
    5050}
    51 // request to delete a virtual category
     51// request to add a virtual category
    5252else if (isset($_POST['submit']))
    5353{
     
    7676    $query = '
    7777INSERT INTO '.CATEGORIES_TABLE.'
    78   (name,id_uppercat,rank)
     78  (name,id_uppercat,rank,site_id)
    7979  VALUES
    80   (\''.$_POST['virtual_name'].'\','.$parent_id.','.$_POST['rank'].')
     80  (\''.$_POST['virtual_name'].'\','.$parent_id.','.$_POST['rank'].',NULL)
    8181;';
    8282    pwg_query($query);
  • trunk/admin/configuration.php

    r593 r602  
    200200  case 'comments' :
    201201  {
    202     $show_yes = ($conf['show_comments']=='true')?'checked="checked"':'';
    203     $show_no = ($conf['show_comments']=='false')?'checked="checked"':'';
    204202    $all_yes = ($conf['comments_forall']=='true')?'checked="checked"':'';
    205203    $all_no  = ($conf['comments_forall']=='false')?'checked="checked"':'';
     
    211209      array(
    212210        'L_CONF_TITLE'=>$lang['conf_comments_title'],
    213         'L_CONF_SHOW_COMMENTS'=>$lang['conf_show_comments'],
    214         'L_CONF_SHOW_COMMENTS_INFO'=>$lang['conf_show_comments_info'],
    215211        'L_CONF_COMMENTS_ALL'=>$lang['conf_comments_forall'],
    216212        'L_CONF_COMMENTS_ALL_INFO'=>$lang['conf_comments_forall_info'],
     
    221217         
    222218        'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'],
    223         'SHOW_COMMENTS_YES'=>$show_yes,
    224         'SHOW_COMMENTS_NO'=>$show_no,
    225219        'COMMENTS_ALL_YES'=>$all_yes,
    226220        'COMMENTS_ALL_NO'=>$all_no,
     
    271265  case 'upload' :
    272266  {
    273     $upload_yes = ($conf['upload_available']=='true')?'checked="checked"':'';
    274     $upload_no = ($conf['upload_available']=='false')?'checked="checked"':'';
    275      
    276267    $template->assign_block_vars(
    277268      'upload',
    278269      array(
    279270        'L_CONF_TITLE'=>$lang['conf_upload_title'],
    280         'L_CONF_UPLOAD'=>$lang['conf_authorize_upload'],
    281         'L_CONF_UPLOAD_INFO'=>$lang['conf_authorize_upload_info'],
    282271        'L_CONF_MAXSIZE'=>$lang['conf_upload_maxfilesize'],
    283272        'L_CONF_MAXSIZE_INFO'=>$lang['conf_upload_maxfilesize_info'],
     
    296285        'TN_UPLOAD_MAXWIDTH'=>$conf['upload_maxwidth_thumbnail'],
    297286        'TN_UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight_thumbnail'],
    298         'UPLOAD_YES'=>$upload_yes,
    299         'UPLOAD_NO'=>$upload_no
    300287        ));
    301288    break;
  • trunk/admin/remote_site.php

    r593 r602  
    485485// +-----------------------------------------------------------------------+
    486486$template->set_filenames(array('remote_site'=>'admin/remote_site.tpl'));
    487 
    488 $action = PHPWG_ROOT_PATH.'admin.php?page=remote_site';
    489487
    490488$template->assign_vars(
  • trunk/admin/update.php

    r593 r602  
    604604                            ' ',
    605605                            array(),
    606                             'introduction.category_option');
     606                            'introduction.category_option',
     607                            array());
    607608}
    608609// +-----------------------------------------------------------------------+
  • trunk/category.php

    r593 r602  
    296296{
    297297  // upload a picture in the category
    298   if ( is_numeric( $page['cat'] )
    299        and $page['cat_site_id'] == 1
    300        and $conf['upload_available']
    301        and $page['cat_uploadable'] )
     298  if (is_numeric($page['cat'])
     299      and $page['cat_site_id'] == 1
     300      and $page['cat_dir'] != ''
     301      and $page['cat_uploadable'])
    302302  {
    303303    $url = PHPWG_ROOT_PATH.'upload.php?cat='.$page['cat'];
  • trunk/include/category_default.inc.php

    r593 r602  
    121121    );
    122122   
    123   if ($conf['show_comments'] and $user['show_nb_comments'])
     123  if ($user['show_nb_comments']
     124      and is_numeric($page['cat'])
     125      and $page['cat_commentable'])
    124126  {
    125127    $query = '
  • trunk/include/config.inc.php

    r601 r602  
    168168// show_gt : display generation time at the bottom of each page
    169169$conf['show_gt'] = true;
     170
     171// Default options for new categories.
     172//
     173// Some options for categories (commentable, uploadable, status, visible)
     174// must be set directly in the database by changing the corresponding
     175// default values of the column. Examples :
     176//
     177// ALTER TABLE phpwebgallery_categories ALTER visible SET DEFAULT 'true';
     178// ALTER TABLE phpwebgallery_categories ALTER status SET DEFAULT 'private';
     179// ALTER TABLE phpwebgallery_categories ALTER uploadable SET DEFAULT 'true';
     180// ALTER TABLE phpwebgallery_categories ALTER commentable SET DEFAULT 'false';
     181//
     182// MySQL default values are used when inserting a row and that no value is
     183// given for the column. In PhpWebGallery, the above columns are not valued
     184// during categories insertion, so default values are important.
    170185?>
  • trunk/include/functions_category.inc.php

    r593 r602  
    309309  $infos = array( 'nb_images','id_uppercat','comment','site_id','galleries_url'
    310310                  ,'dir','date_last','uploadable','status','visible'
    311                   ,'representative_picture_id','uppercats' );
     311                  ,'representative_picture_id','uppercats','commentable' );
    312312
    313313  $query = 'SELECT '.implode( ',', $infos );
     
    455455      $page['cat_site_id']    = $result['site_id'];
    456456      $page['cat_uploadable'] = $result['uploadable'];
     457      $page['cat_commentable'] = $result['commentable'];
    457458      $page['uppercats']      = $result['uppercats'];
    458459      $page['title'] = get_cat_display_name( $page['cat_name'],' - ','',false);
     
    912913                                   $indent,
    913914                                   $selecteds,
    914                                    $blockname)
     915                                   $blockname,
     916                                   $CSS_classes)
    915917{
    916918  global $template,$user;
     
    924926      {
    925927        $selected = ' selected="selected"';
     928      }
     929
     930      $class = '';
     931      foreach (array_keys($CSS_classes) as $CSS_class)
     932      {
     933        if (in_array($category['id'], $CSS_classes[$CSS_class]))
     934        {
     935          $class = $CSS_class;
     936        }
    926937      }
    927938
     
    930941        array('SELECTED'=>$selected,
    931942              'VALUE'=>$category['id'],
     943              'CLASS'=>$class,
    932944              'OPTION'=>$indent.'- '.$category['name']
    933945              ));
     
    936948                                $indent.str_repeat(' ',3),
    937949                                $selecteds,
    938                                 $blockname);
     950                                $blockname,
     951                                $CSS_classes);
    939952    }
    940953  }
  • trunk/install/config.sql

    r555 r602  
    66INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('default_template','default','Default gallery style');
    77INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('access','free','access type to your gallery (free|restricted)');
    8 INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('show_comments','true','display the users comments');
    98INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nb_comment_page','10','number of comments to display on each page');
    10 INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_available','false','authorizing the upload of pictures by users');
    119INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_maxfilesize','150','maximum filesize for the uploaded pictures');
    1210INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_maxwidth','800','maximum width authorized for the uploaded images');
  • trunk/install/dbscheme.txt

    r573 r602  
    2626column:rank                      table:categories     type:tinyint                  nullable:Y length:3   signed:N
    2727column:status                    table:categories     type:enum('public','private') nullable:N
    28 column:site_id                   table:categories     type:tinyint                  nullable:N length:4   signed:N
     28column:site_id                   table:categories     type:tinyint                  nullable:Y length:4   signed:N
    2929column:visible                   table:categories     type:enum('true','false')     nullable:N
    3030column:uploadable                table:categories     type:enum('true','false')     nullable:N
    3131column:representative_picture_id table:categories     type:mediumint                nullable:Y length:8   signed:N
    3232column:uppercats                 table:categories     type:varchar                  nullable:N length:255 binary:N
     33column:commentable               table:categories     type:enum('true','false')     nullable:N
    3334column:id                        table:comments       type:int                      nullable:N length:11  signed:N
    3435column:image_id                  table:comments       type:mediumint                nullable:N length:8   signed:N
     
    4647column:id                        table:groups         type:smallint                 nullable:N length:5   signed:N
    4748column:name                      table:groups         type:varchar                  nullable:N length:255 binary:N
    48 column:date                      table:history        type:int                      nullable:N length:11  signed:Y
     49column:date                      table:history        type:datetime                 nullable:N
    4950column:login                     table:history        type:varchar                  nullable:Y length:15  binary:N
    5051column:IP                        table:history        type:varchar                  nullable:N length:50  binary:N
     
    117118PK:group_access_pk   table:group_access   column:cat_id
    118119PK:groups_pk         table:groups         column:id
     120PK:history_pk        table:history        column:date
    119121PK:image_category_pk table:image_category column:image_id
    120122PK:image_category_pk table:image_category column:category_id
     
    136138index:images_i2         table:images         column:date_available
    137139index:images_i1         table:images         column:storage_category_id
     140index:images_i3         table:images         column:average_rate
     141index:images_i4         table:images         column:hit
    138142index:sites_ui1         table:sites          column:galleries_url
    139143index:users_ui1         table:users          column:username
  • trunk/install/phpwebgallery_structure.sql

    r537 r602  
    2020  rank tinyint(3) unsigned default NULL,
    2121  status enum('public','private') NOT NULL default 'public',
    22   site_id tinyint(4) unsigned NOT NULL default '1',
     22  site_id tinyint(4) unsigned default '1',
    2323  visible enum('true','false') NOT NULL default 'true',
    2424  uploadable enum('true','false') NOT NULL default 'false',
    2525  representative_picture_id mediumint(8) unsigned default NULL,
    2626  uppercats varchar(255) NOT NULL default '',
     27  commentable enum('true','false') NOT NULL default 'true',
    2728  PRIMARY KEY  (id),
    2829  KEY categories_i2 (id_uppercat)
     
    101102  file varchar(50) default NULL,
    102103  picture varchar(150) default NULL,
    103   PRIMARY KEY `date` (`date`)
     104  PRIMARY KEY  (date)
    104105) TYPE=MyISAM;
    105106
     
    142143  PRIMARY KEY  (id),
    143144  KEY images_i2 (date_available),
    144   KEY images_i1 (storage_category_id)
     145  KEY images_i1 (storage_category_id),
     146  KEY images_i3 (average_rate),
     147  KEY images_i4 (hit)
    145148) TYPE=MyISAM;
    146149
  • trunk/language/en_UK.iso-8859-1/admin.lang.php

    r593 r602  
    109109$lang['title_default'] = 'PhpWebGallery administration';
    110110$lang['title_waiting'] = 'Pictures waiting for validation';
     111$lang['title_cat_options'] = 'Categories options';
    111112
    112113//Error messages
     
    134135// Configuration -> comments
    135136$lang['conf_comments_title'] = 'Users comments';
    136 $lang['conf_show_comments'] = 'Show users comments';
    137 $lang['conf_show_comments_info'] = 'Display the users comments under each picture ?';
    138137$lang['conf_comments_forall'] = 'Comments for all ?';
    139138$lang['conf_comments_forall_info'] = 'Even guest not registered can post comments';
     
    156155// Configuration -> upload
    157156$lang['conf_upload_title'] = 'Users upload';
    158 $lang['conf_authorize_upload'] = 'Authorize upload of pictures';
    159 $lang['conf_authorize_upload_info'] = '';
    160157$lang['conf_upload_maxfilesize'] = 'Maximum filesize';
    161158$lang['conf_upload_maxfilesize_info'] = 'Maximum filesize for the uploaded pictures. Must be a number between 10 and 1000 KB.';
     
    326323$lang['cat_list_virtual_category_added'] = 'virtual category added';
    327324$lang['cat_list_virtual_category_deleted'] = 'virtual category deleted';
     325
     326$lang['cat_options_menu'] = 'Options';
     327$lang['cat_options_menu_upload'] = 'upload';
     328$lang['cat_options_menu_visible'] = 'lock';
     329$lang['cat_options_menu_comments'] = 'comments';
     330$lang['cat_options_menu_status'] = 'access';
     331$lang['cat_options_upload_true'] = 'authorize upload';
     332$lang['cat_options_upload_false'] = 'forbid upload';
     333$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.';
     334$lang['cat_options_comments_true'] = 'authorize comments';
     335$lang['cat_options_comments_false'] = 'forbid comments';
     336$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.';
    328337?>
  • trunk/language/fr_FR.iso-8859-1/admin.lang.php

    r593 r602  
    136136// Configuration -> comments
    137137$lang['conf_comments_title'] = 'Configuration des commentaires';
    138 $lang['conf_show_comments'] = 'Commentaires utilisateurs';
    139 $lang['conf_show_comments_info'] = 'Afficher les commentaires utilisateurs sous chaque images ?';
    140138$lang['conf_comments_forall'] = 'Autoriser pour tous ?';
    141139$lang['conf_comments_forall_info'] = 'Même les invités non enregistrés peuvent déposer les messages';
     
    160158// Configuration -> upload
    161159$lang['conf_upload_title'] = 'Configuration de l\'envoi d\'images par les utilisateurs';
    162 $lang['conf_authorize_upload'] = 'Autoriser l\'ajout d\'images';
    163 $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.';
    164160$lang['conf_upload_maxfilesize'] = 'Poids maximum';
    165161$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.';
  • trunk/picture.php

    r598 r602  
    754754$result = pwg_query($query);
    755755$categories = '';
     756$page['show_comments'] = false;
    756757while ($row = mysql_fetch_array($result))
    757758{
     
    762763  $cat_info = get_cat_info($row['category_id']);
    763764  $categories .= get_cat_display_name($cat_info['name'], ' >');
     765  // the picture is commentable if it belongs at least to one category which
     766  // is commentable
     767  if ($cat_info['commentable'])
     768  {
     769    $page['show_comments'] = true;
     770  }
    764771}
    765772$template->assign_block_vars(
     
    921928
    922929//---------------------------------------------------- users's comments display
    923 if ( $conf['show_comments'] )
     930if ($page['show_comments'])
    924931{
    925932  // number of comment for this picture
  • trunk/search.php

    r593 r602  
    353353                          ' ',
    354354                          $selecteds,
    355                           'category_option');
     355                          'category_option',
     356                          array());
    356357
    357358$categories_selected = '';
  • trunk/template/default/admin.tpl

    r589 r602  
    3939  <li><a class="adminMenu" href="{U_CATEGORIES}">{L_MANAGE}</a></li>
    4040  <li><a class="adminMenu" href="{U_UPLOAD}">{L_UPLOAD}</a></li>
     41  <li><a class="adminMenu" href="{U_CAT_OPTIONS}">{L_CAT_OPTIONS}</a></li>
    4142</ul>
    4243</div>
  • trunk/template/default/admin/configuration.tpl

    r555 r602  
    5252  </tr>
    5353  <tr>
    54     <td width="70%"><strong>{comments.L_CONF_SHOW_COMMENTS}&nbsp;:</strong><br /><span class="small">{comments.L_CONF_SHOW_COMMENTS_INFO}</span></td>
    55         <td class="row1"><input type="radio" class="radio" name="show_comments" value="true" {comments.SHOW_COMMENTS_YES} />{L_YES}&nbsp;&nbsp;
    56         <input type="radio" class="radio" name="show_comments" value="false" {comments.SHOW_COMMENTS_NO} />{L_NO}</td>
    57   </tr>
    58   <tr>
    59     <td><strong>{comments.L_CONF_COMMENTS_ALL}&nbsp;:</strong><br /><span class="small">{comments.L_CONF_COMMENTS_ALL_INFO}</span></td>
     54    <td width="70%"><strong>{comments.L_CONF_COMMENTS_ALL}&nbsp;:</strong><br /><span class="small">{comments.L_CONF_COMMENTS_ALL_INFO}</span></td>
    6055        <td class="row1"><input type="radio" class="radio" name="comments_forall" value="true" {comments.COMMENTS_ALL_YES} />{L_YES}&nbsp;&nbsp;
    6156        <input type="radio" class="radio" name="comments_forall" value="false" {comments.COMMENTS_ALL_NO} />{L_NO}</td>
     
    117112  </tr>
    118113  <tr>
    119     <td width="70%"><strong>{upload.L_CONF_UPLOAD}&nbsp;:</strong><br /><span class="small">{upload.L_CONF_UPLOAD_INFO}</span></td>
    120         <td class="row1"><input type="radio" class="radio" name="upload_available" value="true" {upload.UPLOAD_YES} />{L_YES}&nbsp;&nbsp;
    121         <input type="radio" class="radio" name="upload_available" value="false" {upload.UPLOAD_NO} />{L_NO}</td>
    122   </tr>
    123   <tr>
    124     <td><strong>{upload.L_CONF_MAXSIZE}&nbsp;:</strong><br /><span class="small">{upload.L_CONF_MAXSIZE_INFO}</span></td>
     114    <td width="70%"><strong>{upload.L_CONF_MAXSIZE}&nbsp;:</strong><br /><span class="small">{upload.L_CONF_MAXSIZE_INFO}</span></td>
    125115        <td class="row1"><input type="text" size="4" maxlength="4" name="upload_maxfilesize" value="{upload.UPLOAD_MAXSIZE}" /></td>
    126116  </tr>
  • trunk/template/default/default.css

    r579 r602  
    426426  text-align:left;
    427427}
     428
     429.confMenu {
     430  background-color:#444444;
     431  text-align:center;
     432}
     433
     434.confMenu a {
     435  padding:2px;
     436  border:1px solid gray;
     437  background-color:#505050;
     438  color:#fff48e;
     439  color:lightgray;
     440}
     441
     442.confMenu a:hover {
     443  color:orange;
     444  text-decoration:none;
     445}
     446
     447.confMenu a.opened {
     448  background-color:gray;
     449  color:white;
     450  text-decoration:none;
     451}
     452
     453.optionTrue {
     454  color:lightgreen;
     455}
     456
     457.optionFalse {
     458  color:#ffe1e1;
     459}
Note: See TracChangeset for help on using the changeset viewer.