b2evolution PHP Cross Reference Blogging Systems

Source: /skins/forums/_edit_comment.disp.php - 190 lines - 7620 bytes - Summary - Text - Print

Description: This is the template that displays the edit comment form. It gets POSTed to comments ctrl.

   1  <?php
   2  /**

   3   * This is the template that displays the edit comment form. It gets POSTed to comments ctrl.

   4   *

   5   * Note: don't code this URL by hand, use the template functions to generate it!

   6   *

   7   * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}.

   8   * See also {@link http://sourceforge.net/projects/evocms/}.

   9   *

  10   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}.

  11   *

  12   * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)

  13   *

  14   * @package evoskins

  15   *

  16   * @version $Id: _edit_comment.disp.php 6136 2014-03-08 07:59:48Z manuel $

  17   */
  18  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  19  
  20  global $Blog, $edited_Comment, $comment_Item, $comment_content;
  21  global $display_params, $admin_url, $samedomain_htsrv_url, $dummy_fields;
  22  
  23  $form_action = url_add_param( $admin_url, 'ctrl=comments' );
  24  
  25  // Default params:

  26  $disp_params = array_merge( array(
  27          'disp_edit_categories' => true,
  28          'edit_form_params' => array(
  29              'formstart'      => '<table class="bForums" width="100%" cellspacing="1" cellpadding="2" border="0"><tr><th colspan="2">'.T_('Editing reply').'</th></tr>',
  30              'formend'        => '</table>',
  31              'fieldset_begin' => '<tr class="top"><td colspan="2">',
  32              'fieldset_end'   => '</td></tr>',
  33              'fieldstart'     => '<tr>',
  34              'fieldend'       => '</tr>',
  35              'labelstart'     => '<td class="left"><strong>',
  36              'labelend'       => '</strong></td>',
  37              'inputstart'     => '<td class="row2 left">',
  38              'inputend'       => '</td>',
  39              'infostart'      => '<td class="row2 left">',
  40              'infoend'        => '</td>',
  41              'buttonsstart'   => '<tr><td colspan="2">',
  42              'buttonsend'     => '</td></tr>',
  43              'output'         => true
  44          ),
  45          'categories_name'      => T_('Appears in'),
  46          'category_name'        => T_('Forum'),
  47          'category_main_title'  => T_('Main forum'),
  48          'category_extra_title' => T_('Additional forum'),
  49          'textarea_lines'       => 16,
  50          'form_comment_text'    => T_('Comment content'),
  51      ), $display_params );
  52  
  53  // BREADCRUMBS

  54  echo '<div class="post_panel">';
  55  $comment_Item = & $edited_Comment->get_Item();
  56  $main_Chapter = & $comment_Item->get_main_Chapter();
  57  $Skin->display_breadcrumbs( $main_Chapter->ID );
  58  echo '</div><div class="clear"></div>';
  59  
  60  $Form = new Form( $form_action, 'comment_edit', 'post' );
  61  
  62  $Form->switch_template_parts( $disp_params['edit_form_params'] );
  63  
  64  $Form->begin_form( 'inskin', '', $display_params );
  65  
  66      $Form->add_crumb( 'comment' );
  67      $Form->hidden( 'blog', $Blog->ID );
  68      $Form->hidden( 'mname', 'collections' );
  69      $Form->hidden( 'action_type', 'comment' );
  70      $Form->hidden( 'comment_ID', $edited_Comment->ID );
  71      $Form->hidden( 'redirect_to', url_add_tail( $comment_Item->get_permanent_url(), '#c'.$edited_Comment->ID ) );
  72  
  73      $Form->info( T_('In response to'), $comment_Item->get_title() );
  74      if( $edited_Comment->get_author_User() )
  75      {
  76          $Form->info( T_('Author'), $edited_Comment->get_author() );
  77      }
  78      else
  79      {
  80          $Form->text_input( 'newcomment_author', $edited_Comment->author, 20, T_('Author'), '', array('maxlength'=>100, 'style'=>'width: 99%;' ) );
  81          $Form->text_input( 'newcomment_author_email', $edited_Comment->author_email, 20, T_('Email'), '', array('maxlength'=>100, 'style'=>'width: 99%;') );
  82          $Form->text_input( 'newcomment_author_url', $edited_Comment->author_url, 20, T_('Website URL'), '', array('maxlength'=>100, 'style'=>'width: 99%;') );
  83      }
  84  
  85      ob_start();
  86      echo '<div class="comment_toolbars">';
  87      // CALL PLUGINS NOW:

  88      $Plugins->trigger_event( 'AdminDisplayToolbar', array(
  89              'target_type' => 'Comment',
  90              'edit_layout' => NULL,
  91              'Comment' => $edited_Comment,
  92          ) );
  93      echo '</div>';
  94      $plugins_toolbar = ob_get_clean();
  95  
  96      $Form->switch_template_parts( array(
  97              'inputstart' => '<td class="row2 left">'.$plugins_toolbar,
  98          ) );
  99      $Form->textarea_input( 'content', $comment_content, $disp_params['textarea_lines'], $disp_params['form_comment_text'], array( 'cols' => 60 , 'style' => 'width:99%', 'id' => $dummy_fields[ 'content' ] ) );
 100  
 101      // set b2evoCanvas for plugins

 102      echo '<script type="text/javascript">var b2evoCanvas = document.getElementById( "'.$dummy_fields[ 'content' ].'" );</script>';
 103  
 104      if( $current_User->check_perm( 'blog_edit_ts', 'edit', false, $Blog->ID ) )
 105      { // ------------------------------------ TIME STAMP -------------------------------------
 106          $Form->switch_template_parts( array(
 107              'fieldstart' => '',
 108              'fieldend'   => '',
 109              'labelstart' => '',
 110              'labelend'   => '',
 111              'labelempty' => '',
 112              'inputstart' => '',
 113              'inputend'   => '',
 114              'output'     => false
 115          ) );
 116  
 117          $comment_date_input = $Form->date_input( 'comment_issue_date', $edited_Comment->date, '' );
 118          $comment_date_input .= $Form->time_input( 'comment_issue_time', $edited_Comment->date, '' );
 119  
 120          $Form->switch_template_parts( $disp_params['edit_form_params'] );
 121  
 122          $Form->info( T_('Comment date'), $comment_date_input, '' );
 123      }
 124  
 125      if( $comment_Item->can_rate() || !empty( $edited_Comment->rating ) )
 126      { // Rating is editable
 127          $edit_form_params = $disp_params['edit_form_params'];
 128          $before_rating = $edit_form_params['fieldstart'].$edit_form_params['labelstart'].T_('Rating').$edit_form_params['labelend'].$edit_form_params['inputstart'];
 129          $after_rating = $edit_form_params['inputend'].$edit_form_params['fieldend'];
 130          $edited_Comment->rating_input( array( 'before' => $before_rating, 'after' => $after_rating ) );
 131      }
 132  
 133      // Get those statuses which are not allowed for the current User to create comments in this blog

 134      $exclude_statuses = array_merge( get_restricted_statuses( $Blog->ID, 'blog_comment!', 'edit' ), array( 'redirected', 'trash' ) );
 135      // Get allowed visibility statuses

 136      $sharing_options = get_visibility_statuses( 'radio-options', $exclude_statuses );
 137      if( count( $sharing_options ) == 1 )
 138      { // Only one visibility status is available, don't show radio but set hidden field
 139          $Form->hidden( 'comment_status', $sharing_options[0][0] );
 140      }
 141      else
 142      { // Display visibiliy options
 143          $Form->radio( 'comment_status', $edited_Comment->status, $sharing_options, T_('Visibility'), true );
 144      }
 145  
 146      // Display renderers

 147      $comment_renderer_checkboxes = $edited_Comment->renderer_checkboxes( NULL, false );
 148      if( !empty( $comment_renderer_checkboxes ) )
 149      {
 150          $Form->info( T_('Text Renderers'), $comment_renderer_checkboxes );
 151      }
 152  
 153      // Display comment attachments

 154      $LinkOwner = new LinkComment( $edited_Comment );
 155      if( $LinkOwner->count_links() )
 156      { // there are attachments to display
 157          $Form->switch_template_parts( array(
 158              'fieldset_begin' => '<tr><td class="left" valign="top"><strong>$fieldset_title$:</strong></td><td class="row2 left">',
 159          ) );
 160          $Form->begin_fieldset( T_('Attachments') );
 161          if( $current_User->check_perm( 'files', 'view' ) )
 162          { // User has permission to view files
 163              display_attachments( $LinkOwner );
 164          }
 165          else
 166          {
 167              echo T_('You do not have permission to edit file attachments for this comment');
 168          }
 169          $Form->end_fieldset();
 170          $Form->switch_template_parts( $disp_params['edit_form_params'] );
 171      }
 172  
 173      $Form->begin_fieldset();
 174      $Form->submit( array( 'actionArray[update]', T_('Save changes'), 'SaveButton submit' ) );
 175      $Form->end_fieldset();
 176  $Form->end_form();
 177  
 178  ?>
 179  <script type="text/javascript">
 180  	function switch_edit_view()
 181      {
 182          var form = document.getElementById('comment_edit');
 183          if( form )
 184          {
 185              jQuery(form).append( '<input type="hidden" name="action" value="switch_view" />');
 186              form.submit();
 187          }
 188          return false;
 189      }
 190  </script>

title

Description

title

Description

title

Description

title

title

Body