b2evolution PHP Cross Reference Blogging Systems

Source: /inc/collections/views/_coll_comments.form.php - 309 lines - 13695 bytes - Summary - Text - Print

Description: This file implements the UI view for the Collection comments properties. This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}. See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This file implements the UI view for the Collection comments properties.
   4   *
   5   * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}.
   6   * See also {@link http://sourceforge.net/projects/evocms/}.
   7   *
   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}.
   9   *
  10   * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)
  11   *
  12   * {@internal Open Source relicensing agreement:
  13   * }}
  14   *
  15   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  16   *
  17   * @package admin
  18   *
  19   * @version $Id: _coll_comments.form.php 6136 2014-03-08 07:59:48Z manuel $
  20   */
  21  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  22  
  23  /**
  24   * @var Blog
  25   */
  26  global $edited_Blog;
  27  
  28  ?>
  29  <script type="text/javascript">
  30      <!--
  31  	function show_hide_feedback_details(ob)
  32      {
  33          if( ob.value == 'never' )
  34          {
  35              jQuery( '.feedback_details_container' ).hide();
  36          }
  37          else
  38          {
  39              jQuery( '.feedback_details_container' ).show();
  40          }
  41      }
  42      //-->
  43  </script>
  44  <?php
  45  
  46  // This warning is used for 'Trackbacks' and 'New feedback status'
  47  $spammers_warning = '<span class="red"$attrs$>'.get_icon( 'warning_yellow' ).' '.T_('Warning: this makes your site a preferred target for spammers!').'<br /></span>';
  48  
  49  // Permission to edit advanced admin settings
  50  $perm_blog_admin = $current_User->check_perm( 'blog_admin', 'edit', false, $edited_Blog->ID );
  51  
  52  $Form = new Form( NULL, 'coll_comments_checkchanges' );
  53  
  54  $Form->begin_form( 'fform' );
  55  
  56  $Form->add_crumb( 'collection' );
  57  $Form->hidden_ctrl();
  58  $Form->hidden( 'action', 'update' );
  59  $Form->hidden( 'tab', 'comments' );
  60  $Form->hidden( 'blog', $edited_Blog->ID );
  61  
  62  $Form->begin_fieldset( T_('Comment viewing options') );
  63  
  64      $Form->radio( 'allow_view_comments', $edited_Blog->get_setting( 'allow_view_comments' ),
  65                          array(  array( 'any', T_('Any user'), T_('Including anonymous users') ),
  66                                  array( 'registered', T_('Registered users only') ),
  67                                  array( 'member', T_('Members only'),  T_( 'Users have to be members of this blog' ) ),
  68                                  array( 'moderator', T_('Moderators & Admins only') ),
  69                      ), T_('Comment viewing by'), true );
  70  
  71      // put this on feedback details container, this way it won't be displayed if comment posting is not allowed
  72      echo '<div class="feedback_details_container">';
  73  
  74      $Form->radio( 'comments_orderdir', $edited_Blog->get_setting('comments_orderdir'),
  75                          array(    array( 'ASC', T_('Chronologic') ),
  76                                  array ('DESC', T_('Reverse') ),
  77                          ), T_('Display order'), true );
  78  
  79      $Form->checkbox( 'threaded_comments', $edited_Blog->get_setting( 'threaded_comments' ), T_('Threaded comments'), T_('Check to enable hierarchical threads of comments.') );
  80  
  81      $paged_comments_disabled = (boolean) $edited_Blog->get_setting( 'threaded_comments' );
  82      $Form->checkbox( 'paged_comments', $edited_Blog->get_setting( 'paged_comments' ), T_( 'Paged comments' ), T_( 'Check to enable paged comments on the public pages.' ), '', 1, $paged_comments_disabled );
  83  
  84      $Form->text( 'comments_per_page', $edited_Blog->get_setting('comments_per_page'), 4, T_('Comments/Page'),  T_('How many comments do you want to display on one page?'), 4 );
  85  
  86      $Form->checkbox( 'comments_avatars', $edited_Blog->get_setting( 'comments_avatars' ), T_('Display profile pictures'), T_('Display profile pictures/avatars for comments.') );
  87  
  88      $Form->checkbox( 'comments_latest', $edited_Blog->get_setting( 'comments_latest' ), T_('Latest comments'), T_('Check to enable viewing of the latest comments') );
  89  
  90      echo '</div>';
  91  
  92  $Form->end_fieldset();
  93  
  94  $Form->begin_fieldset( T_('Feedback options') );
  95  
  96      $advanced_perms_warning = $edited_Blog->get_advanced_perms_warning();
  97      $Form->radio( 'allow_comments', $edited_Blog->get_setting( 'allow_comments' ),
  98                          array(  array( 'any', T_('Any user'), T_('Including anonymous users'),
  99                                          $advanced_perms_warning, 'onclick="show_hide_feedback_details(this);"'),
 100                                  array( 'registered', T_('Registered users only'),  '',
 101                                          '', 'onclick="show_hide_feedback_details(this);"'),
 102                                  array( 'member', T_('Members only'),  T_( 'Users have to be members of this blog' ),
 103                                          '', 'onclick="show_hide_feedback_details(this);"'),
 104                                  array( 'never', T_('Not allowed'), '',
 105                                          '', 'onclick="show_hide_feedback_details(this);"'),
 106                      ), T_('Comment posting by'), true );
 107  
 108      echo '<div class="feedback_details_container">';
 109  
 110      $Form->checkbox( 'disable_comments_bypost', $edited_Blog->get_setting( 'disable_comments_bypost' ), '', T_('Comments can be disabled on each post separately') );
 111  
 112      $Form->checkbox( 'allow_anon_url', $edited_Blog->get_setting( 'allow_anon_url' ), T_('Anonymous URLs'), T_('Allow anonymous commenters to submit an URL') );
 113  
 114      $Form->checkbox( 'allow_html_comment', $edited_Blog->get_setting( 'allow_html_comment' ),
 115                          T_( 'Allow HTML' ), T_( 'Check to allow HTML in comments.' ).' ('.T_('HTML code will pass several sanitization filters.').')' );
 116  
 117      $any_option = array( 'any', T_('Any user'), T_('Including anonymous users'), '' );
 118      $registered_option = array( 'registered', T_('Registered users only'),  '', '' );
 119      $member_option = array( 'member', T_('Members only'), T_('Users have to be members of this blog'), '' );
 120      $never_option = array( 'never', T_('Not allowed'), '', '' );
 121      $Form->radio( 'allow_attachments', $edited_Blog->get_setting( 'allow_attachments' ),
 122                          array(  $any_option, $registered_option, $member_option, $never_option,
 123                          ), T_('Allow attachments from'), true );
 124  
 125      $max_attachments_params = array();
 126      if( $edited_Blog->get_setting( 'allow_attachments' ) == 'any' )
 127      {    // Disable field "Max # of attachments" when Allow attachments from Any user
 128          $max_attachments_params['disabled'] = 'disabled';
 129      }
 130      $Form->text_input( 'max_attachments', $edited_Blog->get_setting( 'max_attachments' ), 10, T_('Max # of attachments per User per Post'), T_('(leave empty for no limit)'), $max_attachments_params );
 131  
 132      if( $perm_blog_admin || $edited_Blog->get( 'allowtrackbacks' ) )
 133      { // Only admin can turn ON this setting
 134          $trackbacks_warning_attrs = ' id="trackbacks_warning" style="display:'.( $edited_Blog->get( 'allowtrackbacks' ) ? 'inline' : 'none' ).'"';
 135          $trackbacks_warning = str_replace( '$attrs$', $trackbacks_warning_attrs, $spammers_warning );
 136          $trackbacks_title = !$edited_Blog->get( 'allowtrackbacks' ) ? ' ['.T_('Admin').']' : '';
 137          $Form->checkbox( 'blog_allowtrackbacks', $edited_Blog->get( 'allowtrackbacks' ), T_('Trackbacks').$trackbacks_title, $trackbacks_warning.T_('Allow other bloggers to send trackbacks to this blog, letting you know when they refer to it. This will also let you send trackbacks to other blogs.') );
 138      }
 139  
 140      echo '</div>';
 141  
 142      if( $edited_Blog->get_setting( 'allow_comments' ) == 'never' )
 143      { ?>
 144      <script type="text/javascript">
 145          <!--
 146          jQuery( '.feedback_details_container' ).hide();
 147          //-->
 148      </script>
 149      <?php
 150      }
 151  
 152  $Form->end_fieldset();
 153  
 154  $Form->begin_fieldset( T_('Voting options'), array( 'class' => 'feedback_details_container' ) );
 155  
 156      $Form->radio( 'allow_rating_items', $edited_Blog->get_setting( 'allow_rating_items' ),
 157                          array( $any_option, $registered_option, $member_option, $never_option,
 158                          ), T_('Allow star ratings from'), true );
 159  
 160      $Form->textarea_input( 'rating_question', $edited_Blog->get_setting( 'rating_question' ), 3, T_('Star rating question'), array( 'class' => 'large' ) );
 161  
 162      $Form->checkbox( 'allow_rating_comment_helpfulness', $edited_Blog->get_setting( 'allow_rating_comment_helpfulness' ), T_('Allow helpful/not helpful'), T_("Allow users to say if a comment was helpful or not.") );
 163  
 164  $Form->end_fieldset();
 165  
 166  
 167  // display comments settings provided by optional modules:
 168  // echo 'modules';
 169  modules_call_method( 'display_collection_comments', array( 'Form' => & $Form, 'edited_Blog' => & $edited_Blog ) );
 170  
 171  $Form->begin_fieldset( T_('Comment moderation') );
 172      $newstatus_warning_attrs = ' id="newstatus_warning" style="display:'.( $edited_Blog->get_setting('new_feedback_status') == 'published' ? 'inline' : 'none' ).'"';
 173      $newstatus_warning = str_replace( '$attrs$', $newstatus_warning_attrs, $spammers_warning );
 174      $status_options = get_visibility_statuses( '', array( 'redirected', 'trash' ) );
 175      if( $edited_Blog->get_setting('new_feedback_status') != 'published' )
 176      {
 177          if( $perm_blog_admin )
 178          { // Only admin can set this setting to 'Public'
 179              $status_options['published'] .= ' ['.T_('Admin').']';
 180          }
 181          else
 182          { // Remove published status for non-admin users
 183              unset( $status_options['published'] );
 184          }
 185      }
 186      // put this on feedback details container, this way it won't be displayed if comment posting is not allowed
 187      echo '<div class="feedback_details_container">';
 188      $Form->select_input_array( 'new_feedback_status', $edited_Blog->get_setting('new_feedback_status'), $status_options,
 189                  T_('New feedback status'), $newstatus_warning.T_('Logged in users will get the highest possible status allowed by their permissions. Plugins may also override this default.') );
 190      echo '</div>';
 191  
 192      // Moderation statuses setting
 193      $not_moderation_statuses = array_diff( get_visibility_statuses( 'keys', NULL ), get_visibility_statuses( 'moderation' ) );
 194      // Get moderation statuses with status text
 195      $moderation_statuses = get_visibility_statuses( '', $not_moderation_statuses );
 196      $blog_moderation_statuses = $edited_Blog->get_setting( 'moderation_statuses' );
 197      $checklist_options = array();
 198      foreach( $moderation_statuses as $status => $status_text )
 199      { // Add a checklist option for each possible modeartion status
 200          $is_checked = ( strpos( $blog_moderation_statuses, $status) !== false );
 201          $checklist_options[] = array( 'notif_'.$status, 1, $status_text, $is_checked );
 202      }
 203      $Form->checklist( $checklist_options, 'moderation_statuses', T_('Comment moderation reminder statuses'), false, false, array( 'note' => 'Comments with the selected statuses will be notified on the "Send reminders about comments awaiting moderation" scheduled job.' ) );
 204  
 205      $Form->radio( 'comment_quick_moderation', $edited_Blog->get_setting( 'comment_quick_moderation' ),
 206                      array(  array( 'never', T_('Never') ),
 207                              array( 'expire', T_('Links expire on first edit action') ),
 208                              array( 'always', T_('Always available') )
 209                          ), T_('Comment quick moderation'), true );
 210  $Form->end_fieldset();
 211  
 212  $Form->begin_fieldset( T_('RSS/Atom feeds') );
 213      $Form->radio( 'comment_feed_content', $edited_Blog->get_setting('comment_feed_content'),
 214                                  array(  array( 'none', T_('No feeds') ),
 215                                          array( 'excerpt', T_('Comment excerpts') ),
 216                                          array( 'normal', T_('Standard comment contents') ),
 217                                      ), T_('Comment feed contents'), true, T_('How much content do you want to make available in comment feeds?') );
 218  
 219      $Form->text( 'comments_per_feed', $edited_Blog->get_setting('comments_per_feed'), 4, T_('Comments in feeds'),  T_('How many of the latest comments do you want to include in RSS & Atom feeds?'), 4 );
 220  $Form->end_fieldset();
 221  
 222  
 223  $Form->begin_fieldset( T_('Subscriptions') );
 224      $Form->checkbox( 'allow_item_subscriptions', $edited_Blog->get_setting( 'allow_item_subscriptions' ), T_('Email subscriptions'), T_( 'Allow users to subscribe and receive email notifications for comments on a specific post.' ) );
 225  $Form->end_fieldset();
 226  
 227  
 228  $Form->begin_fieldset( T_('Registration of commenters') );
 229      $Form->checkbox( 'comments_detect_email', $edited_Blog->get_setting( 'comments_detect_email' ), T_('Email addresses'), T_( 'Detect email addresses in comments.' ) );
 230  
 231      $Form->checkbox( 'comments_register', $edited_Blog->get_setting( 'comments_register' ), T_('Register after comment'), T_( 'Display the registration form right after submitting a comment.' ) );
 232  $Form->end_fieldset();
 233  
 234  
 235  $Form->end_form( array(
 236      array( 'submit', 'submit', T_('Save !'), 'SaveButton' ),
 237      array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
 238  
 239  ?>
 240  <script type="text/javascript">
 241      var paged_comments_is_checked = jQuery( '#paged_comments' ).is( ':checked' );
 242      jQuery( '#threaded_comments' ).click( function()
 243      { // Disable checkbox "Paged comments" if "Threaded comments" is ON
 244          if( jQuery( this ).is( ':checked' ) )
 245          {
 246              jQuery( '#paged_comments' ).attr( 'disabled', 'disabled' );
 247              paged_comments_is_checked = jQuery( '#paged_comments' ).is( ':checked' );
 248              jQuery( '#paged_comments' ).removeAttr( 'checked' );
 249              jQuery( '#comments_per_page' ).val( '1000' );
 250          }
 251          else
 252          {
 253              jQuery( '#paged_comments' ).removeAttr( 'disabled' );
 254              if( paged_comments_is_checked )
 255              {
 256                  jQuery( '#paged_comments' ).attr( 'checked', 'checked' );
 257                  jQuery( '#comments_per_page' ).val( '20' );
 258              }
 259          }
 260      } );
 261  
 262      jQuery( '#paged_comments' ).click( function()
 263      {
 264          if( jQuery( this ).is( ':checked' ) )
 265          {
 266              jQuery( '#comments_per_page' ).val( '20' );
 267          }
 268          else
 269          {
 270              jQuery( '#comments_per_page' ).val( '1000' );
 271          }
 272      } );
 273  
 274      jQuery( 'input[name=allow_attachments]' ).click( function()
 275      {    // Disable field "Max # of attachments" when Allow attachments from Any user
 276          if( jQuery( this ).val() == 'any' )
 277          {
 278              jQuery( '#max_attachments' ).attr( 'disabled', 'disabled' );
 279          }
 280          else
 281          {
 282              jQuery( '#max_attachments' ).removeAttr( 'disabled' );
 283          }
 284      } );
 285  
 286      jQuery( '#blog_allowtrackbacks' ).click( function()
 287      { // Show/Hide warning for 'Trackbacks'
 288          if( jQuery( this ).is( ':checked' ) )
 289          {
 290              jQuery( '#trackbacks_warning' ).css( 'display', 'inline' );
 291          }
 292          else
 293          {
 294              jQuery( '#trackbacks_warning' ).hide();
 295          }
 296      } );
 297  
 298      jQuery( '#new_feedback_status' ).change( function()
 299      { // Show/Hide warning for 'New feedback status'
 300          if( jQuery( this ).val() == 'published' )
 301          {
 302              jQuery( '#newstatus_warning' ).css( 'display', 'inline' );
 303          }
 304          else
 305          {
 306              jQuery( '#newstatus_warning' ).hide();
 307          }
 308      } );
 309  </script>

title

Description

title

Description

title

Description

title

title

Body