b2evolution PHP Cross Reference Blogging Systems

Source: /skins/_edit_comment.disp.php - 144 lines - 5644 bytes - Summary - Text - Print

Description: This is the template that displays the edit comment form. It gets POSTed to /htsrv/action.php.

   1  <?php
   2  /**

   3   * This is the template that displays the edit comment form. It gets POSTed to /htsrv/action.php.

   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  if( empty( $comment_Item ) )
  24  {
  25      $comment_Item = & $edited_Comment->get_Item();
  26  }
  27  
  28  $form_action = url_add_param( $admin_url, 'ctrl=comments' );
  29  
  30  $display_params = array_merge( $display_params, array(
  31      'textarea_lines' => 16,
  32      'form_comment_text' => T_('Comment content'),
  33  ) );
  34  
  35  $Form = new Form( $form_action, 'comment_edit', 'post' );
  36  
  37  $Form->begin_form( 'bComment' );
  38  
  39      $Form->add_crumb( 'comment' );
  40      $Form->hidden( 'blog', $Blog->ID );
  41      $Form->hidden( 'mname', 'collections' );
  42      $Form->hidden( 'action_type', 'comment' );
  43      $Form->hidden( 'comment_ID', $edited_Comment->ID );
  44      $Form->hidden( 'redirect_to', url_add_tail( $comment_Item->get_permanent_url(), '#c'.$edited_Comment->ID ) );
  45  
  46      $Form->info( T_('In response to'), $comment_Item->get_title() );
  47      if( $edited_Comment->get_author_User() )
  48      {
  49          $Form->info( T_('Author'), $edited_Comment->get_author() );
  50      }
  51      else
  52      {
  53          $Form->text_input( 'newcomment_author', $edited_Comment->author, 20, T_('Author'), '', array('maxlength'=>100, 'style'=>'width: 100%;' ) );
  54          $Form->text_input( 'newcomment_author_email', $edited_Comment->author_email, 20, T_('Email'), '', array('maxlength'=>100, 'style'=>'width: 100%;') );
  55          $Form->text_input( 'newcomment_author_url', $edited_Comment->author_url, 20, T_('Website URL'), '', array('maxlength'=>100, 'style'=>'width: 100%;') );
  56      }
  57  
  58      echo '<div class="comment_toolbars">';
  59      // CALL PLUGINS NOW:

  60      $Plugins->trigger_event( 'AdminDisplayToolbar', array(
  61              'target_type' => 'Comment',
  62              'edit_layout' => NULL,
  63              'Comment' => $edited_Comment,
  64          ) );
  65      echo '</div>';
  66  
  67      $Form->textarea_input( 'content', $comment_content, $display_params['textarea_lines'], $display_params['form_comment_text'], array( 'cols' => 38, 'class' => 'bComment', 'id' => $dummy_fields[ 'content' ] ) );
  68  
  69      // set b2evoCanvas for plugins

  70      echo '<script type="text/javascript">var b2evoCanvas = document.getElementById( "'.$dummy_fields[ 'content' ].'" );</script>';
  71  
  72      if( $current_User->check_perm( 'blog_edit_ts', 'edit', false, $Blog->ID ) )
  73      { // ------------------------------------ TIME STAMP -------------------------------------
  74          $Form->begin_fieldset();
  75          echo '<div class="label">'.T_('Comment date').':</div>';
  76          $Form->switch_layout( 'blockspan' );
  77          $Form->date_input( 'comment_issue_date', $edited_Comment->date, '', array( 'size' => "10" ) );
  78          $Form->time_input( 'comment_issue_time', $edited_Comment->date, '', array( 'size' => "10" ) );
  79          $Form->switch_layout( NULL );
  80          $Form->end_fieldset();
  81      }
  82  
  83      if( $comment_Item->can_rate() || !empty( $edited_Comment->rating ) )
  84      { // Rating is editable
  85          $edited_Comment->rating_input( array( 'before' => '<fieldset><div class="label">'.T_('Rating').':</div><div class="input">', 'after' => '</div></fieldset>' ) );
  86      }
  87  
  88      // Get those statuses which are not allowed for the current User to create comments in this blog

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

  91      $sharing_options = get_visibility_statuses( 'radio-options', $exclude_statuses );
  92      if( count( $sharing_options ) == 1 )
  93      { // Only one visibility status is available, don't show radio but set hidden field
  94          $Form->hidden( 'comment_status', $sharing_options[0][0] );
  95      }
  96      else
  97      { // Display visibiliy options
  98          $Form->radio( 'comment_status', $edited_Comment->status, $sharing_options, T_('Visibility'), true );
  99      }
 100  
 101      // Display renderers checkboxes ( Note: This contains inputs )

 102      $comment_renderer_checkboxes = $edited_Comment->renderer_checkboxes( NULL, false );
 103      if( !empty( $comment_renderer_checkboxes ) )
 104      {
 105          $Form->info( T_('Text Renderers'), $comment_renderer_checkboxes );
 106      }
 107  
 108      // Display comment attachments

 109      $LinkOwner = new LinkComment( $edited_Comment );
 110      if( $LinkOwner->count_links() )
 111      { // there are attachments to display
 112          if( $current_User->check_perm( 'files', 'view' ) && $current_User->check_perm( 'admin', 'restricted' ) )
 113          {
 114              $Form->begin_fieldset( T_('Attachments') );
 115              display_attachments( $LinkOwner );
 116              $Form->end_fieldset();
 117          }
 118          else
 119          {
 120              $Form->info( T_('Attachments'), T_('You do not have permission to edit file attachments for this comment') );
 121          }
 122      }
 123  
 124      echo '<div class="center margin2ex">';
 125      $Form->submit( array( 'actionArray[update]', T_('Save changes'), 'SaveButton', '' ) );
 126      echo '</div>';
 127  $Form->end_form();
 128  
 129  ?>
 130  <script type="text/javascript">
 131  	function switch_edit_view()
 132      {
 133          var form = document.getElementById('comment_edit');
 134          if( form )
 135          {
 136              jQuery(form).append( '<input type="hidden" name="action" value="switch_view" />');
 137              form.submit();
 138          }
 139          return false;
 140      }
 141  </script>
 142  <?php
 143  
 144  ?>

title

Description

title

Description

title

Description

title

title

Body