Changeset 774


Ignore:
Timestamp:
Apr 26, 2005, 4:24:08 PM (19 years ago)
Author:
gweltas
Message:

Bug 0000100: 'info_line' template code splited

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/language/en_UK.iso-8859-1/common.lang.php

    r759 r774  
    6060$lang['powered_by'] = 'Powered by';
    6161$lang['all_categories'] = 'all categories';
     62$lang['unavailable'] = 'N/A';
    6263
    6364//Properties
  • trunk/language/fr_FR.iso-8859-1/common.lang.php

    r748 r774  
    6060$lang['powered_by'] = 'Propulsé par';
    6161$lang['all_categories'] = 'toutes catégories';
     62$lang['unavailable'] = 'N/A';
    6263
    6364// Properties
  • trunk/picture.php

    r745 r774  
    460460  $url_metadata.= '&show_metadata=1';
    461461}
    462                                  
     462
     463// author
     464$author = $creation_date = $size = $filesize = $lang['unavailable'];
     465if ( !empty($picture['current']['author']) )
     466{
     467  $search_url = PHPWG_ROOT_PATH.'category.php?cat=search';
     468  $search_url.= '&search=author:'.$picture['current']['author'];
     469 
     470  $author = '<a href="';
     471  $author .= add_session_id($search_url);
     472  $author .= '">'.$picture['current']['author'].'</a>';
     473}
     474
     475// creation date
     476if ( !empty($picture['current']['date_creation']) )
     477{
     478  $creation_date = format_date($picture['current']['date_creation']);
     479}
     480
     481// date of availability
     482$availability_date = format_date($picture['current']['date_available']);
     483
     484// size in pixels
     485if ($picture['current']['is_picture'])
     486{
     487  if ($original_width != $picture_size[0]
     488      or $original_height != $picture_size[1])
     489  {
     490    $size = '[ <a href="'.$picture['current']['src'].'" ';
     491    $size .= ' title="'.$lang['true_size'].'">';
     492    $size .= $original_width.'*'.$original_height.'</a> ]';
     493  }
     494  else
     495  {
     496    $size = $original_width.'*'.$original_height;
     497  }
     498}
     499
     500// filesize
     501if (empty($picture['current']['filesize']))
     502{
     503  if (!$picture['current']['is_picture'])
     504  {
     505    $filesize = floor(filesize($picture['current']['download'])/1024);
     506  }
     507  else
     508  {
     509    $filesize = floor(filesize($picture['current']['src'])/1024);
     510  }
     511}
     512else
     513{
     514  $filesize = $picture['current']['filesize'];
     515}
     516
     517// number of visits
     518$template->assign_block_vars(
     519  'info_line',
     520  array(
     521    'INFO'=>$lang['visited'],
     522    'VALUE'=>$picture['current']['hit'].' '.$lang['times']
     523    ));
     524                         
    463525include(PHPWG_ROOT_PATH.'include/page_header.php');
    464526$template->set_filenames(array('picture'=>'picture.tpl'));
     
    472534  'WIDTH_IMG' => $picture_size[0],
    473535  'HEIGHT_IMG' => $picture_size[1],
     536  'AUTHOR' => $author,
     537  'CREATION_DATE' => $creation_date,
     538  'AVAILABILITY_DATE' => $availability_date,
     539  'SIZE' => $size,
     540  'FILE_SIZE' => $filesize,
    474541
    475542  'LEVEL_SEPARATOR' => $conf['level_separator'],
     
    494561  'L_UP_HINT' => $lang['home_hint'],
    495562  'L_UP_ALT' => $lang['home'],
     563  'L_CREATION_DATE' => $lang['creation_date'],
     564  'L_AVAILABILITY_DATE' => $lang['registration_date'],
     565  'L_SIZE' => $lang['size'],
     566  'L_FILE' => $lang['file'],
     567  'L_FILE_SIZE' => $lang['size'],
    496568 
    497569  'U_HOME' => add_session_id(PHPWG_ROOT_PATH.'category.php'),
     
    612684}
    613685
    614 // author
    615 if ( !empty($picture['current']['author']) )
    616 {
    617   $search_url = PHPWG_ROOT_PATH.'category.php?cat=search';
    618   $search_url.= '&amp;search=author:'.$picture['current']['author'];
    619  
    620   $value = '<a href="';
    621   $value.= add_session_id($search_url);
    622   $value.= '">'.$picture['current']['author'].'</a>';
    623  
    624   $template->assign_block_vars(
    625     'info_line',
    626     array(
    627       'INFO'=>$lang['author'],
    628       'VALUE'=>$value
    629       ));
    630 }
    631 // creation date
    632 if ( !empty($picture['current']['date_creation']) )
    633 {
    634   $search_url = PHPWG_ROOT_PATH.'category.php?cat=search';
    635   $search_url.= '&amp;search=';
    636   $search_url.= 'date_creation:'.$picture['current']['date_creation'];
    637  
    638   $value = '<a href="';
    639   $value.= add_session_id($search_url);
    640   $value.= '">'.format_date($picture['current']['date_creation']).'</a>';
    641  
    642   $template->assign_block_vars(
    643     'info_line',
    644     array(
    645       'INFO'=>$lang['creation_date'],
    646       'VALUE'=>$value
    647       ));
    648 }
    649 // date of availability
    650 $search_url = PHPWG_ROOT_PATH.'category.php?cat=search';
    651 $search_url.= '&amp;search=';
    652 $search_url.= 'date_available:'.$picture['current']['date_available'];
    653  
    654 $value = '<a href="';
    655 $value.= add_session_id($search_url);
    656 $value.= '">'.format_date($picture['current']['date_available']).'</a>';
    657 
    658 $template->assign_block_vars(
    659   'info_line',
    660   array(
    661     'INFO'=>$lang['registration_date'],
    662     'VALUE'=>$value
    663     ));
    664 // size in pixels
    665 if ($picture['current']['is_picture'])
    666 {
    667   if ($original_width != $picture_size[0]
    668       or $original_height != $picture_size[1])
    669   {
    670     $content = '[ <a href="'.$picture['current']['src'].'" ';
    671     $content.= ' title="'.$lang['true_size'].'">';
    672     $content.= $original_width.'*'.$original_height.'</a> ]';
    673   }
    674   else
    675   {
    676     $content = $original_width.'*'.$original_height;
    677   }
    678   $template->assign_block_vars(
    679     'info_line',
    680     array(
    681       'INFO'=>$lang['size'],
    682       'VALUE'=>$content
    683       ));
    684 }
    685 // file
    686 $template->assign_block_vars('info_line', array(
    687           'INFO'=>$lang['file'],
    688           'VALUE'=>$picture['current']['file']
    689           ));
    690 // filesize
    691 if (empty($picture['current']['filesize']))
    692 {
    693   if (!$picture['current']['is_picture'])
    694   {
    695     $filesize = floor(filesize($picture['current']['download'])/1024);
    696   }
    697   else
    698   {
    699     $filesize = floor(filesize($picture['current']['src'])/1024);
    700   }
    701 }
    702 else
    703 {
    704   $filesize = $picture['current']['filesize'];
    705 }
    706 
    707 $template->assign_block_vars('info_line', array(
    708           'INFO'=>$lang['filesize'],
    709           'VALUE'=>$filesize.' KB'
    710           ));
    711686// keywords
    712687if (!empty($picture['current']['keywords']))
     
    725700  }
    726701  $template->assign_block_vars(
    727     'info_line',
     702    'keywords',
    728703    array(
    729704      'INFO'=>$lang['keywords'],
     
    731706      ));
    732707}
    733 // number of visits
    734 $template->assign_block_vars(
    735   'info_line',
    736   array(
    737     'INFO'=>$lang['visited'],
    738     'VALUE'=>$picture['current']['hit'].' '.$lang['times']
    739     ));
    740 // rate results
    741 if ($conf['rate'])
    742 {
    743   $query = '
    744 SELECT COUNT(rate) AS count
    745      , ROUND(AVG(rate),2) AS average
    746      , ROUND(STD(rate),2) AS STD
    747   FROM '.RATE_TABLE.'
    748   WHERE element_id = '.$picture['current']['id'].'
    749 ;';
    750   $row = mysql_fetch_array(pwg_query($query));
    751   if ($row['count'] == 0)
    752   {
    753     $value = $lang['no_rate'];
    754   }
    755   else
    756   {
    757     $value = $row['average'];
    758     $value.= ' (';
    759     $value.= $row['count'].' '.$lang['rates'];
    760     $value.= ', '.$lang['standard_deviation'].' : '.$row['STD'];
    761     $value.= ')';
    762   }
    763  
    764   $template->assign_block_vars(
    765     'info_line',
    766     array(
    767       'INFO'  => $lang['element_rate'],
    768       'VALUE' => $value
    769       ));
    770 }
     708
    771709// related categories
    772710$cat_output = '';
     
    796734}
    797735$template->assign_block_vars(
    798   'info_line',
     736  'associated',
    799737  array(
    800738    'INFO'  => $lang['categories'],
    801739    'VALUE' => $cat_output
    802740    ));
    803 // metadata
     741
     742//-------------------------------------------------------------------  metadata
    804743if ($metadata_showable and isset($_GET['show_metadata']))
    805744{
     
    905844}
    906845
    907 //------------------------------------------------------------------- rate form
    908 if ($conf['rate'] and !$user['is_the_guest'])
    909 {
    910   $query = '
    911 SELECT rate
     846//------------------------------------------------------------------- rating
     847if ($conf['rate'])
     848{
     849  $query = 'SELECT COUNT(rate) AS count
     850     , ROUND(AVG(rate),2) AS average
     851     , ROUND(STD(rate),2) AS STD
    912852  FROM '.RATE_TABLE.'
    913   WHERE user_id = '.$user['id'].'
    914     AND element_id = '.$_GET['image_id'].'
     853  WHERE element_id = '.$picture['current']['id'].'
    915854;';
     855  $row = mysql_fetch_array(pwg_query($query));
     856  if ($row['count'] == 0)
     857  {
     858    $value = $lang['no_rate'];
     859  }
     860  else
     861  {
     862    $value = $row['average'];
     863    $value.= ' (';
     864    $value.= $row['count'].' '.$lang['rates'];
     865    $value.= ', '.$lang['standard_deviation'].' : '.$row['STD'];
     866    $value.= ')';
     867  }
     868 
     869  if (!$user['is_the_guest'])
     870  {
     871    $query = 'SELECT rate
     872    FROM '.RATE_TABLE.'
     873    WHERE user_id = '.$user['id'].'
     874    AND element_id = '.$_GET['image_id'].';';
    916875  $result = pwg_query($query);
    917876  if (mysql_num_rows($result) > 0)
     
    925884  {
    926885    $sentence = $lang['never_rated'].'. '.$lang['to_rate'];
    927   }
     886  } 
    928887  $template->assign_block_vars(
    929888    'rate',
    930     array('SENTENCE' => $sentence)
    931     );
    932  
     889    array(
     890      'INFO'  => $lang['element_rate'],
     891      'VALUE' => $value,
     892      'SENTENCE' => $sentence
     893      ));
    933894 
    934895  foreach ($rate_items as $num => $mark)
     
    954915        'SEPARATOR' => $separator
    955916        ));
    956   }
    957 }
     917    }
     918  }
     919}
     920
    958921//---------------------------------------------------- users's comments display
    959922if ($page['show_comments'])
  • trunk/template/default/picture.tpl

    r712 r774  
    7676<div id="centre">
    7777  <table style="margin:auto;margin-top:5px;margin-bottom:5px;">
    78           <!-- BEGIN info_line -->
    79           <tr>
    80                  <td class="menu" style="font-weight:bold;">{info_line.INFO} : </td>
    81                  <td class="menu" style="text-align:right;">{info_line.VALUE}</td>
    82           </tr>
    83           <!-- END info_line -->
     78    <tr>
     79         <td class="menu" style="font-weight:bold;">{L_AUTHOR} : </td>
     80         <td class="menu" style="text-align:right;">{AUTHOR}</td>
     81    </tr>
     82    <tr>
     83         <td class="menu" style="font-weight:bold;">{L_CREATION_DATE} : </td>
     84         <td class="menu" style="text-align:right;">{CREATION_DATE}</td>
     85    </tr>
     86    <tr>
     87         <td class="menu" style="font-weight:bold;">{L_AVAILABILITY_DATE} : </td>
     88         <td class="menu" style="text-align:right;">{AVAILABILITY_DATE}</td>
     89    </tr>
     90    <tr>
     91         <td class="menu" style="font-weight:bold;">{L_SIZE} : </td>
     92         <td class="menu" style="text-align:right;">{SIZE}</td>
     93    </tr>
     94    <tr>
     95         <td class="menu" style="font-weight:bold;">{L_FILE} : </td>
     96         <td class="menu" style="text-align:right;">{ALT_IMG}</td>
     97    </tr>
     98    <tr>
     99         <td class="menu" style="font-weight:bold;">{L_FILE_SIZE} : </td>
     100         <td class="menu" style="text-align:right;">{FILE_SIZE} Ko</td>
     101    </tr>
     102    <!-- BEGIN keywords -->
     103    <tr>
     104         <td class="menu" style="font-weight:bold;">{keywords.INFO} : </td>
     105         <td class="menu" style="text-align:right;">{keywords.VALUE}</td>
     106    </tr>
     107    <!-- END keywords -->
     108    <!-- BEGIN associated -->
     109    <tr>
     110         <td class="menu" style="font-weight:bold;">{associated.INFO} : </td>
     111         <td class="menu" style="text-align:right;">{associated.VALUE}</td>
     112    </tr>
     113    <!-- END associated -->
     114    <!-- BEGIN rate -->
     115    <tr>
     116         <td class="menu" style="font-weight:bold;">{rate.INFO} : </td>
     117         <td class="menu" style="text-align:right;">{rate.VALUE}</td>
     118    </tr>
     119    <!-- END rate -->
    84120  </table>
    85121</div>
     
    95131</div>
    96132<div style="clear:both;"></div>
    97          <!-- BEGIN metadata -->
    98           <table class="tablecompact">
    99             <!-- BEGIN headline -->
    100             <tr>
    101               <th colspan="2">{metadata.headline.TITLE}</th>
    102             </tr>
    103             <!-- END headline -->
    104             <!-- BEGIN line -->
    105             <tr>
    106               <td>{metadata.line.KEY}</td>
    107               <td>{metadata.line.VALUE}</td>
    108             </tr>
    109             <!-- END line -->
    110           </table>
    111           <!-- END metadata -->
     133<!-- BEGIN metadata -->
     134 <table class="tablecompact">
     135  <!-- BEGIN headline -->
     136  <tr>
     137    <th colspan="2">{metadata.headline.TITLE}</th>
     138  </tr>
     139  <!-- END headline -->
     140  <!-- BEGIN line -->
     141  <tr>
     142    <td>{metadata.line.KEY}</td>
     143    <td>{metadata.line.VALUE}</td>
     144  </tr>
     145  <!-- END line -->
     146  </table>
     147<!-- END metadata -->
    112148
    113           <!-- BEGIN rate -->
    114           <div>
    115             {rate.SENTENCE} :
    116             <!-- BEGIN rate_option -->
    117             {rate.rate_option.SEPARATOR} <a href="{rate.rate_option.URL}">{rate.rate_option.OPTION}</a>
    118             <!-- END rate_option -->
    119           </div>
    120           <!-- END rate -->
     149<!-- BEGIN rate -->
     150<div>{rate.SENTENCE} :
     151  <!-- BEGIN rate_option -->
     152  {rate.rate_option.SEPARATOR} <a href="{rate.rate_option.URL}">{rate.rate_option.OPTION}</a>
     153  <!-- END rate_option -->
     154</div>
     155<!-- END rate -->
    121156         
    122157<table class="tablecompact">
    123       <!-- BEGIN comments -->
    124       <tr align="center" valign="middle">
    125         <td colspan="3" class="table2">
    126                   <div class="commentTitle">
     158  <!-- BEGIN comments -->
     159  <tr align="center" valign="middle">
     160    <td colspan="3" class="table2">
     161    <div class="commentTitle">
    127162                    [{comments.NB_COMMENT}] {L_COMMENT_TITLE}
    128163                  </div>
Note: See TracChangeset for help on using the changeset viewer.