Changeset 847


Ignore:
Timestamp:
Aug 21, 2005, 1:32:12 PM (19 years ago)
Author:
plg
Message:
  • new way to display picture informations (template variables instead of template generic blocks)
  • new color for A:hover and its solid border-bottom, dotted border-bottom for A (same color as link color)
  • background color and border color for form input fields (input, select, textarea) to accentuate contrast with page background.
  • clear:both on #imageHeaderBar H1 let it be center on page
  • in infoTable keys are right aligned and values are left aligned (more beautiful, isn't it?)
  • add "set as representative" button to cclear template in picture.tpl. representative.png picture taken from Gorilla theme.
  • invisible horizontal rule on picture.tpl to separate user comments from the beginning of the page
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r811 r847  
    9696  FROM '.IMAGE_CATEGORY_TABLE.'
    9797    INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id
    98   WHERE image_id = '.$_GET['image_id'];
    99 if ($user['forbidden_categories'] != '')
    100 {
    101   $query.= '
    102     AND category_id NOT IN ('.$user['forbidden_categories'].')';
    103 }
    104 $query.= '
     98  WHERE image_id = '.$_GET['image_id'].'
     99    AND category_id NOT IN ('.$user['forbidden_categories'].')
    105100;';
    106101$result = pwg_query($query);
     
    488483}
    489484
    490 // author
    491 $author = $creation_date = $size = $filesize = $lang['unavailable'];
    492 if ( !empty($picture['current']['author']) )
    493 {
    494   $search_url = PHPWG_ROOT_PATH.'category.php?cat=search';
    495   $search_url.= '&search=author:'.$picture['current']['author'];
    496  
    497   $author = '<a href="';
    498   $author .= add_session_id($search_url);
    499   $author .= '">'.$picture['current']['author'].'</a>';
    500 }
    501 
    502 // creation date
    503 if ( !empty($picture['current']['date_creation']) )
    504 {
    505   $creation_date = format_date($picture['current']['date_creation']);
    506 }
    507 
    508 // date of availability
    509 $availability_date = format_date($picture['current']['date_available'],
    510                                  'mysql_datetime');
    511 
    512 // size in pixels
    513 if ($picture['current']['is_picture'])
    514 {
    515   if ($original_width != $picture_size[0]
    516       or $original_height != $picture_size[1])
    517   {
    518     $size = '[ <a href="'.$picture['current']['src'].'" ';
    519     $size .= ' title="'.$lang['true_size'].'">';
    520     $size .= $original_width.'*'.$original_height.'</a> ]';
    521   }
    522   else
    523   {
    524     $size = $original_width.'*'.$original_height;
    525   }
    526 }
    527 
    528 // filesize
    529 if (empty($picture['current']['filesize']))
    530 {
    531   if (!$picture['current']['is_picture'])
    532   {
    533     $filesize = floor(filesize($picture['current']['download'])/1024);
    534   }
    535   else
    536   {
    537     $filesize = floor(filesize($picture['current']['src'])/1024);
    538   }
    539 }
    540 else
    541 {
    542   $filesize = $picture['current']['filesize'];
    543 }
    544 
    545 // number of visits
    546 $template->assign_block_vars(
    547   'info_line',
    548   array(
    549     'INFO'=>$lang['visited'],
    550     'VALUE'=>$picture['current']['hit'].' '.$lang['times']
    551     ));
    552                          
    553485include(PHPWG_ROOT_PATH.'include/page_header.php');
    554486$template->set_filenames(array('picture'=>'picture.tpl'));
     
    562494  'WIDTH_IMG' => $picture_size[0],
    563495  'HEIGHT_IMG' => $picture_size[1],
    564   'AUTHOR' => $author,
    565   'CREATION_DATE' => $creation_date,
    566   'AVAILABILITY_DATE' => $availability_date,
    567   'SIZE' => $size,
    568   'FILE_SIZE' => $filesize,
    569496
    570497  'LEVEL_SEPARATOR' => $conf['level_separator'],
     
    581508  'L_DELETE' =>$lang['delete'],
    582509  'L_SUBMIT' =>$lang['submit'],
    583   'L_AUTHOR' =>$lang['author'],
    584510  'L_COMMENT' =>$lang['comment'],
    585511  'L_DOWNLOAD' => $lang['download'],
     
    589515  'L_UP_HINT' => $lang['home_hint'],
    590516  'L_UP_ALT' => $lang['home'],
    591   'L_CREATION_DATE' => $lang['creation_date'],
    592   'L_AVAILABILITY_DATE' => $lang['registration_date'],
    593   'L_SIZE' => $lang['size'],
    594   'L_FILE' => $lang['file'],
    595   'L_FILE_SIZE' => $lang['size'],
    596517 
    597518  'U_HOME' => add_session_id(PHPWG_ROOT_PATH.'category.php'),
     
    731652}
    732653
     654$infos = array();
     655
     656// author
     657if (!empty($picture['current']['author']))
     658{
     659  $infos['INFO_AUTHOR'] =
     660    '<a href="'.
     661    add_session_id(
     662      PHPWG_ROOT_PATH.'category.php?cat=search'.
     663      '&amp;search=author:'.$picture['current']['author']
     664      ).
     665    '">'.$picture['current']['author'].'</a>';
     666}
     667else
     668{
     669  $infos['INFO_AUTHOR'] = l10n('N/A');
     670}
     671
     672// creation date
     673if (!empty($picture['current']['date_creation']))
     674{
     675  $infos['INFO_CREATION_DATE'] =
     676    '<a href="'.
     677    add_session_id(
     678      PHPWG_ROOT_PATH.'category.php?cat=search'.
     679      '&amp;search=date_creation:'.$picture['current']['date_creation']
     680      ).
     681    '">'.format_date($picture['current']['date_creation']).'</a>';
     682}
     683else
     684{
     685  $infos['INFO_CREATION_DATE'] = l10n('N/A');
     686}
     687
     688// date of availability
     689$infos['INFO_AVAILABILITY_DATE'] =
     690  '<a href="'.
     691  add_session_id(
     692    PHPWG_ROOT_PATH.'category.php?cat=search'.
     693    '&amp;search=date_available:'.
     694    substr($picture['current']['date_available'], 0, 10)
     695    ).
     696    '">'.
     697  format_date($picture['current']['date_available'], 'mysql_datetime').
     698  '</a>';
     699
     700// size in pixels
     701if ($picture['current']['is_picture'])
     702{
     703  if ($original_width != $picture_size[0]
     704      or $original_height != $picture_size[1])
     705  {
     706    $infos['INFO_DIMENSIONS'] =
     707      '<a href="'.$picture['current']['src'].'" title="'.
     708      l10n('Original dimensions').'">'.
     709      $original_width.'*'.$original_height.'</a>';
     710  }
     711  else
     712  {
     713    $infos['INFO_DIMENSIONS'] = $original_width.'*'.$original_height;
     714  }
     715}
     716else
     717{
     718  $infos['INFO_DIMENSIONS'] = l10n('N/A');
     719}
     720
     721// filesize
     722if (!empty($picture['current']['filesize']))
     723{
     724  $infos['INFO_FILESIZE'] =
     725    sprintf(l10n('%d Kb'), $picture['current']['filesize']);
     726}
     727else
     728{
     729  $infos['INFO_FILESIZE'] = l10n('N/A');
     730}
     731
     732// number of visits
     733$infos['INFO_VISITS'] = $picture['current']['hit'];
     734
     735// file
     736$infos['INFO_FILE'] = $picture['current']['file'];
     737
    733738// keywords
    734739if (!empty($picture['current']['keywords']))
    735740{
    736   $keywords = explode(',', $picture['current']['keywords']);
    737   $content = '';
    738   $url = PHPWG_ROOT_PATH.'category.php?cat=search&amp;search=keywords:';
    739   foreach ($keywords as $i => $keyword)
    740   {
    741     $local_url = add_session_id($url.$keyword);
    742     if ($i > 0)
    743     {
    744       $content.= ',';
    745     }
    746     $content.= '<a href="'.$local_url.'">'.$keyword.'</a>';
    747   }
     741  $infos['INFO_KEYWORDS'] =
     742    preg_replace(
     743      '/([^,]+)/',
     744      '<a href="'.
     745      add_session_id(
     746        PHPWG_ROOT_PATH.'category.php?cat=search&amp;search=keywords:$1'
     747        ).
     748      '">$1</a>',
     749      $picture['current']['keywords']
     750      );
     751}
     752else
     753{
     754  $infos['INFO_KEYWORDS'] = l10n('N/A');
     755}
     756
     757$template->assign_vars($infos);
     758
     759// related categories
     760foreach ($related_categories as $category)
     761{
    748762  $template->assign_block_vars(
    749     'keywords',
     763    'category',
    750764    array(
    751       'INFO'=>$lang['keywords'],
    752       'VALUE'=>$content
    753       ));
    754 }
    755 
    756 // related categories
    757 $cat_output = '';
    758 $page['show_comments'] = false;
    759 foreach ($related_categories as $category)
    760 {
    761   if ($cat_output != '')
    762   {
    763     $cat_output.= '<br />';
    764   }
    765  
    766   if (count($related_categories) > 3)
    767   {
    768     $cat_output .= get_cat_display_name_cache($category['uppercats']);
    769   }
    770   else
    771   {
    772     $cat_info = get_cat_info($category['category_id']);
    773     $cat_output .= get_cat_display_name($cat_info['name']);
    774   }
    775   // the picture is commentable if it belongs at least to one category which
    776   // is commentable
    777   if ($category['commentable'] == 'true')
    778   {
    779     $page['show_comments'] = true;
    780   }
    781 }
    782 $template->assign_block_vars(
    783   'associated',
    784   array(
    785     'INFO'  => $lang['categories'],
    786     'VALUE' => $cat_output
    787     ));
     765      'LINE' => count($related_categories) > 3
     766        ? get_cat_display_name_cache($category['uppercats'])
     767        : get_cat_display_name_from_id($category['category_id'])
     768      )
     769    );
     770}
    788771
    789772//-------------------------------------------------------------------  metadata
     
    894877if ($conf['rate'])
    895878{
    896   $query = 'SELECT COUNT(rate) AS count
     879  $query = '
     880SELECT COUNT(rate) AS count
    897881     , ROUND(AVG(rate),2) AS average
    898882     , ROUND(STD(rate),2) AS STD
     
    907891  else
    908892  {
    909     $value = $row['average'];
    910     $value.= ' (';
    911     $value.= $row['count'].' '.$lang['rates'];
    912     $value.= ', '.$lang['standard_deviation'].' : '.$row['STD'];
    913     $value.= ')';
     893    $value = sprintf(
     894      l10n('%.2f (rated %d times, standard deviation = %.2f)'),
     895      $row['average'],
     896      $row['count'],
     897      $row['STD']
     898      );
    914899  }
    915900 
     
    935920    'rate',
    936921    array(
    937       'INFO'  => $lang['element_rate'],
    938       'VALUE' => $value,
     922      'CONTENT' => $value,
    939923      'SENTENCE' => $sentence
    940924      ));
     925
     926  $template->assign_block_vars('info_rate', array('CONTENT' => $value));
     927 
     928  $template->assign_vars(
     929    array(
     930      'INFO_RATE' => $value
     931      )
     932    );
    941933 
    942934  foreach ($rate_items as $num => $mark)
     
    967959
    968960//---------------------------------------------------- users's comments display
     961
     962// the picture is commentable if it belongs at least to one category which
     963// is commentable
     964$page['show_comments'] = false;
     965foreach ($related_categories as $category)
     966{
     967  if ($category['commentable'] == 'true')
     968  {
     969    $page['show_comments'] = true;
     970  }
     971}
     972
    969973if ($page['show_comments'])
    970974{
  • trunk/template/cclear/default-colors.css

    r837 r847  
    2626
    2727A:hover {
    28     color: #754300;
     28    color: #858460;
    2929}
    3030
     
    115115input, select, textarea {
    116116        color:black;
    117         background-color:#eee;
     117        background-color: lightgrey;
     118        border: 1px solid gray;
    118119}
    119120.bouton {
  • trunk/template/cclear/default-layout.css

    r844 r847  
    3636A {
    3737    text-decoration:none;
    38     /*border-bottom: 1px dotted #000000;*/
     38    border-bottom: 1px dotted #005e89;
    3939}
    4040A:hover {
    41     border-bottom-style: solid;
     41    border-bottom: 1px solid #858460;
    4242}
    4343
    4444IMG {
    4545    border: none;
     46}
     47
     48HR.separation {
     49  visibility: hidden;
     50  clear: both;
    4651}
    4752
  • trunk/template/cclear/image.css

    r820 r847  
    88#imageHeaderBar H1 {
    99    margin: 1ex 0; /* override default-layout for less bottom-margin */
     10    clear: both;
    1011}
    1112
     
    7475    margin: auto;
    7576}
    76 TABLE.infoTable TD {
     77TABLE.infoTable .value {
    7778    text-align: left;
    7879}
     
    8081TABLE.infoTable .label {
    8182    font-weight: bold;
     83    text-align: right;
     84    padding-right: 0.5em;
     85}
     86
     87TABLE.infoTable TD.value UL {
     88  margin: 0;
     89  padding: 0 0 0 1.5em;
     90  list-style-type: square;
    8291}
    8392
  • trunk/template/cclear/picture.tpl

    r820 r847  
    1111<div id="imageToolBar">
    1212<div class="randomButtons">
    13   <a href="{U_SLIDESHOW}" title="{L_SLIDESHOW}">
    14     <img src="template/cclear/theme/slideshow.png" alt="{L_SLIDESHOW}">
    15   </a>
    16   <a href="{U_METADATA}" title="{L_PICTURE_METADATA}">
    17     <img src="template/cclear/theme/metadata.png" alt="{L_PICTURE_METADATA}">
    18   </a>
     13  <a href="{U_SLIDESHOW}" title="{L_SLIDESHOW}"><img src="template/cclear/theme/slideshow.png" alt="{L_SLIDESHOW}"></a>
     14  <a href="{U_METADATA}" title="{L_PICTURE_METADATA}"><img src="template/cclear/theme/metadata.png" alt="{L_PICTURE_METADATA}"></a>
     15<!-- BEGIN representative -->
     16  <a href="{representative.URL}" title="{lang:set as category representative}"><img src="template/cclear/theme/representative.png" alt="{lang:representative}" /></a>
     17<!-- END representative -->
    1918<!-- BEGIN favorite -->
    20   <a href="{favorite.U_FAVORITE}" title="{favorite.FAVORITE_HINT}">
    21     <img src="{favorite.FAVORITE_IMG}" alt="{favorite.FAVORITE_ALT}">
    22   </a>
     19  <a href="{favorite.U_FAVORITE}" title="{favorite.FAVORITE_HINT}"><img src="{favorite.FAVORITE_IMG}" alt="{favorite.FAVORITE_ALT}"></a>
    2320<!-- END favorite -->
    2421<!-- BEGIN download -->
    25   <a href="{download.U_DOWNLOAD}" title="{L_DOWNLOAD}">
    26     <img src="template/cclear/theme/save.png" alt="{L_DOWNLOAD}">
    27   </a>
     22  <a href="{download.U_DOWNLOAD}" title="{L_DOWNLOAD}"><img src="template/cclear/theme/save.png" alt="{L_DOWNLOAD}"></a>
    2823<!-- END download -->
    2924<!-- BEGIN admin -->
    30   <a href="{U_ADMIN}" title="{L_ADMIN}">
    31     <img src="template/cclear/theme/preferences.png" alt="{L_ADMIN}">
    32   </a>
     25  <a href="{U_ADMIN}" title="{L_ADMIN}"><img src="template/cclear/theme/preferences.png" alt="{L_ADMIN}"></a>
    3326<!-- END admin -->
    3427</div>
    3528<div class="navButtons">
    3629<!-- BEGIN next -->
    37   <a class="navButton next" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}">
    38     <img src="template/cclear/theme/right.png" alt="next">
    39   </a>
     30  <a class="navButton next" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}"><img src="template/cclear/theme/right.png" alt="next"></a>
    4031<!-- END next -->
    41   <a class="navButton up" href="{U_UP}" title="{L_UP_HINT}">
    42     <img src="template/cclear/theme/up.png" alt="{L_UP_ALT}">
    43   </a>
     32  <a class="navButton up" href="{U_UP}" title="{L_UP_HINT}"><img src="template/cclear/theme/up.png" alt="{L_UP_ALT}"></a>
    4433<!-- BEGIN previous -->
    45   <a class="navButton prev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}">
    46     <img src="template/cclear/theme/left.png" alt="previous">
    47   </a>
     34  <a class="navButton prev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}"><img src="template/cclear/theme/left.png" alt="previous"></a>
    4835<!-- END previous -->
    4936</div>
    50 </div>
     37</div> <!-- imageToolBar -->
    5138
    5239<div id="theImage">
     
    8168
    8269<table class="infoTable" summary="Some info about this picture">
    83   <!-- BEGIN info_line -->
    8470  <tr>
    85     <td class="label">{info_line.INFO} :</td>
    86     <td class="value">{info_line.VALUE}</td>
     71    <td class="label">{lang:Author}</td>
     72    <td class="value">{INFO_AUTHOR}</td>
    8773  </tr>
    88   <!-- END info_line -->
     74  <tr>
     75    <td class="label">{lang:Created on}</td>
     76    <td class="value">{INFO_CREATION_DATE}</td>
     77  </tr>
     78  <tr>
     79    <td class="label">{lang:Registered on}</td>
     80    <td class="value">{INFO_AVAILABILITY_DATE}</td>
     81  </tr>
     82  <tr>
     83    <td class="label">{lang:Dimensions}</td>
     84    <td class="value">{INFO_DIMENSIONS}</td>
     85  </tr>
     86  <tr>
     87    <td class="label">{lang:File}</td>
     88    <td class="value">{INFO_FILE}</td>
     89  </tr>
     90  <tr>
     91    <td class="label">{lang:Filesize}</td>
     92    <td class="value">{INFO_FILESIZE}</td>
     93  </tr>
     94  <tr>
     95    <td class="label">{lang:Keywords}</td>
     96    <td class="value">{INFO_KEYWORDS}</td>
     97  </tr>
     98  <tr>
     99    <td class="label">{lang:Categories}</td>
     100    <td class="value">
     101      <ul>
     102        <!-- BEGIN category -->
     103        <li>{category.LINE}</li>
     104        <!-- END category -->
     105      </ul>
     106    </td>
     107  </tr>
     108  <tr>
     109    <td class="label">{lang:Visits}</td>
     110    <td class="value">{INFO_VISITS}</td>
     111  </tr>
     112  <!-- BEGIN info_rate -->
     113  <tr>
     114    <td class="label">{lang:Average rate}</td>
     115    <td class="value">{info_rate.CONTENT}</td>
     116  </tr>
     117  <!-- END info_rate -->
    89118</table>
    90119
     
    113142</p>
    114143<!-- END rate -->
     144
     145<hr class="separation">
    115146
    116147<!-- BEGIN comments -->
Note: See TracChangeset for help on using the changeset viewer.