Changeset 602 for trunk/include


Ignore:
Timestamp:
Nov 13, 2004, 2:43:53 PM (20 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/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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  }
Note: See TracChangeset for help on using the changeset viewer.