[ Index ]
 

Code source de Plume CMS 1.2.2

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/manager/mtemplates/ -> comments-rlist.php (source)

   1  <?php
   2  /* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
   3  /*
   4  # ***** BEGIN LICENSE BLOCK *****
   5  # This file is part of Plume CMS, a website management application.
   6  # Copyright (C) 2001-2005 Loic d'Anterroches and contributors.
   7  #
   8  # Plume CMS is free software; you can redistribute it and/or modify
   9  # it under the terms of the GNU General Public License as published by
  10  # the Free Software Foundation; either version 2 of the License, or
  11  # (at your option) any later version.
  12  #
  13  # Plume CMS is distributed in the hope that it will be useful,
  14  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  # GNU General Public License for more details.
  17  #
  18  # You should have received a copy of the GNU General Public License
  19  # along with this program; if not, write to the Free Software
  20  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  21  #
  22  # ***** END LICENSE BLOCK ***** */
  23  
  24  if (basename($_SERVER['SCRIPT_NAME']) == 'comments-rlist.php') exit;
  25  
  26  /**
  27   * @file comments-rlist.php
  28   *
  29   * List the comments associated to a resource.
  30   * Provide the form to modify each comment but also add a new comment.
  31   *
  32   * $ct: Stores the list of comments for the given resource.
  33   */
  34  
  35  echo '<h2>'.__('Comments').'</h2>'."\n";
  36  
  37  if ($ct->isEmpty()) {
  38      echo '<p>'.__('No comments for the moment.').'</p>'."\n\n";
  39  } else {
  40      while (!$ct->EOF()) {
  41          switch ($ct->f('comment_status')) {
  42          case PX_RESOURCE_STATUS_OFFLINE:
  43              $ct_class = 'cancel';
  44              $ct_img = '<img src="themes/'.$_px_theme
  45                  .'/images/check_off.png" alt="'.__('Comment off-line')
  46                  .'" class="status" />';
  47              break;
  48          case PX_RESOURCE_STATUS_VALIDE:
  49              $ct_class = 'published';
  50              $ct_img = '<img src="themes/'.$_px_theme
  51                  .'/images/check_on.png" alt="'.__('Comment on-line')
  52                  .'" class="status" />';
  53              break;
  54          case PX_RESOURCE_STATUS_JUNK:
  55              $ct_class = 'cancel';
  56              $ct_img = '<img src="themes/'.$_px_theme
  57                  .'/images/ico_bin.png" alt="'.__('Comment is junk')
  58                  .'" class="status" />';
  59              break;
  60          case PX_RESOURCE_STATUS_TOBEVALIDATED:
  61          default:
  62              $ct_class = 'published';
  63              $ct_img = '<img src="themes/'.$_px_theme
  64                  .'/images/check_wait.png" alt="'
  65                  .__('Comment waiting for validation').'" class="status" />';
  66              break;
  67          }
  68          echo '<div class="line '.$ct_class.'">'
  69              .'<p><a href="#" onclick="openClose(\'c'.$ct->f('comment_id')
  70              .'\',0); return false;" title="'.__('Show/hide edition form').'">'
  71              .'<img src="themes/'.$_px_theme.'/images/plus.png" id="img_c'
  72              .$ct->f('comment_id').'" alt="'.__('Show/hide edition form')
  73              .'" /></a> '.__('by')
  74              .' <strong>'.$ct->f('comment_author').'</strong> '
  75              .'(<a href="mailto:'.$ct->f('comment_email').'">'
  76              .$ct->f('comment_email').'</a>';
  77          if (strlen($ct->f('comment_website'))) {
  78              echo ', <a href="'.$ct->f('comment_website').'">'
  79                  .$ct->f('comment_website').'</a>';
  80          }
  81          echo ')<br />'."\n";
  82          echo $ct_img.'<strong>'
  83              .date(__('Y/m/d \a\t H:i:s'), date::unix($ct->f('comment_update')))
  84              .'</strong> '.__('with the IP address:').' '.$ct->f('comment_ip')
  85              .'</p>'."\n";
  86          echo '<div class="preview">'.$ct->f('comment_content').'</div>';
  87          echo '<div id="c'.$ct->f('comment_id').'" style="display:none;">';
  88          echo '<form id="formPost" method="POST" action="'.$_SERVER["PHP_SELF"]
  89              .'">'."\n";
  90          echo '<p><label for="c_author"><strong>'.__('Author')
  91              .'</strong></label> ';
  92          echo form::textField('c_author', 30, 50, $ct->f('comment_author'));
  93          echo '</p>'."\n";
  94          echo '<p><label for="c_email"><strong>'.__('Email')
  95              .'</strong></label> ';
  96          echo form::textField('c_email', 30, 50, $ct->f('comment_email'));
  97          echo '</p>'."\n";
  98          echo '<p><label for="c_website">'.__('Website').'</label> ';
  99          echo form::textField('c_website', 30, 50, $ct->f('comment_website'));
 100          echo '</p>'."\n";
 101          echo '<label for="c_content"><strong>'.__('Content of the comment');
 102          echo '</strong> ';
 103          echo '</label> ';
 104          echo form::textArea('c_content', 60, 10, 
 105                          $ct->f('comment_content'), '', 'style="width:50%"');
 106          // Status
 107          echo '<p><span class="nowrap"><label for="c_status" ';
 108          echo 'style="display:inline">';
 109          echo __('Status').' '; 
 110          echo '</label> ';
 111          echo form::combobox('c_status', $m->getArrayCommentStatus(), 
 112                              $ct->f('comment_status')); 
 113  
 114          echo "</span></p>\n\n";
 115  
 116          // submit buttons
 117          echo "<p>\n";
 118          echo form::button('submit', 'publish-comment', __('Save'), 
 119                            '', '', 'submit')."\n";
 120  
 121          echo '&nbsp;<input name="delete-comment" type="submit" tabindex="" class="submit" value="'.__('Delete').'" onclick="return window.confirm(\''.addslashes( __('Are you sure you want to delete this comment?')).'\')" />';
 122          echo form::hidden('comment_id',$ct->f('comment_id'));
 123          echo form::hidden('resource_id',$ct->f('resource_id'));
 124          echo '</p>';
 125          
 126          echo '</form>'."\n";
 127          echo '</div>';
 128          echo "</div>\n\n";    
 129          $ct->moveNext();
 130      }
 131  }
 132      
 133  echo '<form id="formPost" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
 134  echo "\n";
 135  echo '<fieldset><legend>'. __('Add a comment')."</legend>\n\n";
 136  echo '<p><label for="c_author"><strong>'.__('Author').'</strong></label> ';
 137  echo form::textField('c_author', 30, 50, $ct->f('comment_author'));
 138  echo '</p>'."\n";
 139  echo '<p><label for="c_email"><strong>'.__('Email').'</strong></label> ';
 140  echo form::textField('c_email', 30, 50, $ct->f('comment_email'));
 141  echo '</p>'."\n";
 142  echo '<p><label for="c_website">'.__('Website').'</label> ';
 143  echo form::textField('c_website', 30, 50, $ct->f('comment_website'));
 144  echo '</p>'."\n";
 145  echo '<label for="c_content"><strong>'.__('Content of the comment');
 146  echo '</strong> ';
 147  echo '</label> ';
 148  echo form::textArea('c_content', 60, 10, 
 149                      $ct->f('comment_content'), '', 'style="width:50%"');
 150  // Status
 151  echo '<p><span class="nowrap"><label for="c_status" ';
 152  echo 'style="display:inline">';
 153  echo __('Status').' '; 
 154  echo '</label> ';
 155  echo form::combobox('c_status', $m->getArrayCommentStatus(), 
 156                      $ct->f('comment_status')); 
 157  
 158  echo "</span></p>\n\n";
 159  
 160  // submit buttons
 161  echo "<p>\n";
 162  echo form::button('submit', 'publish-comment', __('Save'), 
 163                    '', '', 'submit')."\n";
 164  
 165  echo '&nbsp;<input name="delete-comment" type="submit" tabindex="" class="submit" value="'.__('Delete').'" onclick="return window.confirm(\''.addslashes( __('Are you sure you want to delete this comment?')).'\')" />';
 166  echo form::hidden('comment_id',$ct->f('comment_id'));
 167  echo form::hidden('resource_id',$px_resource_id);
 168  echo '</p>';
 169  echo '</fieldset>';
 170  echo '</form>'."\n";
 171      
 172  ?>


Généré le : Mon Nov 26 11:57:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics