b2evolution PHP Cross Reference Blogging Systems

Source: /inc/items/views/_item_list_full.view.php - 534 lines - 18494 bytes - Text - Print

Description: This file implements the post browsing 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 post browsing
   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   * Parts of this file are copyright (c)2005 by Daniel HAHLER - {@link http://thequod.de/contact}.
  10   *
  11   * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)
  12   *
  13   * @package admin
  14   *
  15   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  16   * @author fplanque: Francois PLANQUE.
  17   *
  18   * @version $Id: _item_list_full.view.php 6136 2014-03-08 07:59:48Z manuel $
  19   */
  20  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  21  
  22  /**
  23   * @var Blog
  24   */
  25  global $Blog;
  26  /**
  27   * @var ItemList2
  28   */
  29  global $ItemList;
  30  /**
  31   * Note: definition only (does not need to be a global)
  32   * @var Item
  33   */
  34  global $Item;
  35  
  36  global $action, $dispatcher, $blog, $posts, $poststart, $postend, $ReqURI;
  37  global $edit_item_url, $delete_item_url, $htsrv_url, $p, $dummy_fields;
  38  global $comment_allowed_tags;
  39  
  40  if( $highlight = param( 'highlight', 'integer', NULL ) )
  41  {    // There are lines we want to highlight:
  42      global $rsc_url;
  43      echo '<script type="text/javascript" src="'.$rsc_url.'js/fadeout.js"></script>';
  44      echo '<script type="text/javascript">addEvent( window, "load", Fat.fade_all, false);</script>';
  45  }
  46  
  47  
  48  // Run the query:
  49  $ItemList->query();
  50  
  51  // Old style globals for category.funcs:
  52  global $postIDlist;
  53  $postIDlist = $ItemList->get_page_ID_list();
  54  global $postIDarray;
  55  $postIDarray = $ItemList->get_page_ID_array();
  56  
  57  
  58  
  59  $block_item_Widget = new Widget( 'block_item' );
  60  
  61  if( $action == 'view' )
  62  {    // We are displaying a single post:
  63      $block_item_Widget->title = $ItemList->get_filter_title( '', '', ' - ', NULL, 'htmlbody' );
  64      $block_item_Widget->global_icon( T_('Close post'), 'close',
  65                  regenerate_url( 'p,action', 'filter=restore&amp;highlight='.$p ), T_('close'), 4, 1 );
  66  }
  67  else
  68  {    // We are displaying multiple posts
  69      $block_item_Widget->title = T_('Full posts');
  70      if( $ItemList->is_filtered() )
  71      {    // List is filtered, offer option to reset filters:
  72          $block_item_Widget->global_icon( T_('Reset all filters!'), 'reset_filters', '?ctrl=items&amp;blog='.$Blog->ID.'&amp;filter=reset', T_('Reset filters'), 3, 3 );
  73      }
  74  
  75      if( $current_User->check_perm( 'blog_post_statuses', 'edit', false, $Blog->ID ) )
  76      {
  77          $block_item_Widget->global_icon( T_('Create multiple posts...'), 'new', '?ctrl=items&amp;action=new_mass&amp;blog='.$blog, T_('Mass create').' &raquo;', 3, 4 );
  78          $block_item_Widget->global_icon( T_('Mass edit the current post list...'), '', '?ctrl=items&amp;action=mass_edit&amp;filter=restore&amp;blog='.$blog.'&amp;redirect_to='.regenerate_url( 'action', '', '', '&'), T_('Mass edit').' &raquo;', 3, 4 );
  79          $block_item_Widget->global_icon( T_('Write a new post...'), 'new', '?ctrl=items&amp;action=new&amp;blog='.$blog, T_('New post').' &raquo;', 3, 4 );
  80      }
  81  }
  82  
  83  $block_item_Widget->disp_template_replaced( 'block_start' );
  84  
  85  
  86  
  87  if( $action == 'view' )
  88  {
  89      // Initialize things in order to be ready for displaying.
  90      $display_params = array(
  91                      'header_start' => '',
  92                          'header_text_single' => '',
  93                      'header_end' => '',
  94                      'footer_start' => '',
  95                          'footer_text_single' => '',
  96                      'footer_end' => '',
  97                      'disp_rating_summary'  => true,
  98                  );
  99  }
 100  else
 101  { // Not a single post!
 102      // Display title depending on selection params:
 103      echo $ItemList->get_filter_title( '<h3>', '</h3>', '<br />', NULL, 'htmlbody' );
 104  
 105      // Initialize things in order to be ready for displaying.
 106      $display_params = array(
 107                      'header_start' => '<div class="NavBar center">',
 108                          'header_text' => '<strong>'.T_('Pages').'</strong>: $prev$ $first$ $list_prev$ $list$ $list_next$ $last$ $next$',
 109                          'header_text_single' => T_('1 page'),
 110                      'header_end' => '</div>',
 111                      'footer_start' => '',
 112                          'footer_text' => '<div class="NavBar center"><strong>'.T_('Pages').'</strong>: $prev$ $first$ $list_prev$ $list$ $list_next$ $last$ $next$<br />$page_size$</div>',
 113                          'footer_text_single' => '<div class="NavBar center">$page_size$</div>',
 114                              'prev_text' => T_('Previous'),
 115                              'next_text' => T_('Next'),
 116                              'list_prev_text' => T_('...'),
 117                              'list_next_text' => T_('...'),
 118                              'list_span' => 11,
 119                              'scroll_list_range' => 5,
 120                      'footer_end' => ''
 121                  );
 122  }
 123  
 124  $ItemList->display_init( $display_params );
 125  
 126  // Display navigation:
 127  $ItemList->display_nav( 'header' );
 128  
 129  /*
 130   * Display posts:
 131   */
 132  while( $Item = & $ItemList->get_item() )
 133  {
 134      ?>
 135      <div id="<?php $Item->anchor_id() ?>" class="bPost bPost<?php $Item->status_raw() ?>" lang="<?php $Item->lang() ?>">
 136          <?php
 137          // We don't switch locales in the backoffice, since we use the user pref anyway
 138          // Load item's creator user:
 139          $Item->get_creator_User();
 140          ?>
 141          <div class="bSmallHead <?php
 142          if( $Item->ID == $highlight )
 143          {
 144              echo 'fadeout-ffff00" id="fadeout-1';
 145          }
 146          ?>">
 147              <?php
 148                  echo '<div class="bSmallHeadRight">';
 149                  $Item->permanent_link( array(
 150                          'before' => '',
 151                          'text'   => '#text#'
 152                      ) );
 153                  // Item slug control:
 154                  $Item->tinyurl_link( array(
 155                          'before' => ' - '.T_('Short').': ',
 156                          'after'  => ''
 157                      ) );
 158                  global $admin_url;
 159                  if( $current_User->check_perm( 'slugs', 'view' ) )
 160                  { // user has permission to view slugs:
 161                      echo '&nbsp;'.action_icon( T_('Edit slugs...'), 'edit', $admin_url.'?ctrl=slugs&amp;slug_item_ID='.$Item->ID,
 162                          NULL, NULL, NULL, array( 'class' => 'small' ) );
 163                  }
 164                  echo '<div class="bViews">';
 165                  $Item->views();
 166                  echo '</div>';
 167                  If( !empty( $Item->order ) )
 168                  {
 169                      echo T_('Order').': '.$Item->order;
 170                  }
 171                  $Item->locale_flag(array('class'=>'flagtop'));
 172                  echo '</div>';
 173  
 174                  $Item->issue_date( array(
 175                          'before'      => '<span class="bDate">',
 176                          'after'       => '</span>',
 177                          'date_format' => '#',
 178                      ) );
 179  
 180                  $Item->issue_time( array(
 181                          'before'      => ' @ <span class="bTime">',
 182                          'after'      => '</span>',
 183                      ) );
 184  
 185                  // TRANS: backoffice: each post is prefixed by "date BY author IN categories"
 186                  echo ' ', T_('by'), ' ', $Item->creator_User->get_identity_link( array( 'link_text' => 'text' ) );
 187  
 188                  echo '<br />';
 189                  $Item->type( T_('Type').': <span class="bType">', '</span> &nbsp; ' );
 190  
 191                  if( $Blog->get_setting( 'use_workflow' ) )
 192                  { // Only display workflow properties, if activated for this blog.
 193                      $Item->priority( T_('Priority').': <span class="bPriority">', '</span> &nbsp; ' );
 194                      $Item->assigned_to( T_('Assigned to').': <span class="bAssignee">', '</span> &nbsp; ' );
 195                      $Item->extra_status( T_('Task Status').': <span class="bExtStatus">', '</span>' );
 196                  }
 197                  echo '&nbsp;';
 198  
 199                  echo '<br />';
 200  
 201                  $Item->categories( array(
 202                      'before'          => T_('Categories').': <span class="bCategories">',
 203                      'after'           => '</span>',
 204                      'include_main'    => true,
 205                      'include_other'   => true,
 206                      'include_external'=> true,
 207                      'link_categories' => false,
 208                      'show_locked'     => true,
 209                  ) );
 210              ?>
 211          </div>
 212  
 213          <div class="bContent">
 214              <?php $Item->status( array( 'format' => 'styled' ) ); ?>
 215              <!-- TODO: Tblue> Do not display link if item does not get displayed in the frontend (e. g. not published). -->
 216              <h3 class="bTitle"><?php $Item->title( array( 'target_blog' => '' )) ?></h3>
 217  
 218              <?php
 219                  // Display images that are linked to this post:
 220                  $Item->images( array(
 221                          'before' =>              '<div class="bImages">',
 222                          'before_image' =>        '<div class="image_block">',
 223                          'before_image_legend' => '<div class="image_legend">',
 224                          'after_image_legend' =>  '</div>',
 225                          'after_image' =>         '</div>',
 226                          'after' =>               '</div>',
 227                          'image_size' =>          'fit-320x320',
 228                          'restrict_to_image_position' => 'teaser',    // Optionally restrict to files/images linked to specific position: 'teaser'|'aftermore'
 229                      ) );
 230              ?>
 231  
 232              <div class="bText">
 233                  <?php
 234                      // Uncomment this if you want to count views in backoffice:
 235                      /*
 236                      $Item->count_view( array(
 237                              'allow_multiple_counts_per_page' => false,
 238                          ) );
 239                      */
 240  
 241                      // Display CONTENT:
 242                      $Item->content_teaser( array(
 243                              'before'              => '',
 244                              'after'               => '',
 245                              'before_image'        => '<div class="image_block">',
 246                              'before_image_legend' => '<div class="image_legend">',
 247                              'after_image_legend'  =>  '</div>',
 248                              'after_image'         => '</div>',
 249                              'image_size'          => 'fit-320x320',
 250                          ) );
 251                      $Item->more_link();
 252                      $Item->content_extension( array(
 253                              'before'      => '',
 254                              'after'       => '',
 255                          ) );
 256  
 257                      // Links to post pages (for multipage posts):
 258                      $Item->page_links( array(
 259                              'separator' => ' &middot; ',
 260                          ) );
 261                  ?>
 262              </div>
 263  
 264          </div>
 265  
 266          <?php
 267              // List all tags attached to this post:
 268              $Item->tags( array(
 269                      'url' =>            regenerate_url( 'tag' ),
 270                      'before' =>         '<div class="bSmallPrint">'.T_('Tags').': ',
 271                      'after' =>          '</div>',
 272                      'separator' =>      ', ',
 273                  ) );
 274          ?>
 275  
 276          <div class="PostActionsArea">
 277              <?php
 278  
 279              echo '<span class="roundbutton_group">';
 280              if( $action != 'view' )
 281              {
 282                  echo '<a href="?ctrl=items&amp;blog='.$Blog->ID.'&amp;p='.$Item->ID.'" class="roundbutton_text">'.get_icon( 'magnifier' ).T_('View').'</a>';
 283              }
 284  
 285              if( isset($GLOBALS['files_Module']) && $current_User->check_perm( 'files', 'view' ) )
 286              {
 287                  echo '<a href="'.url_add_param( $Blog->get_filemanager_link(), 'fm_mode=link_object&amp;link_type=item&amp;link_object_ID='.$Item->ID )
 288                              .'" class="roundbutton_text">'.get_icon( 'folder' ).T_('Files').'</a>';
 289              }
 290  
 291              if( $Blog->get_setting( 'allow_comments' ) != 'never' )
 292              {
 293                  echo '<a href="?ctrl=items&amp;blog='.$Blog->ID.'&amp;p='.$Item->ID.'#comments" class="roundbutton_text">';
 294                  // TRANS: Link to comments for current post
 295                  $comments_number = generic_ctp_number( $Item->ID, 'comments', 'total' );
 296                  echo get_icon( $comments_number > 0 ? 'comments' : 'nocomment' );
 297                  comments_number( T_('no comment'), T_('1 comment'), T_('%d comments'), $Item->ID );
 298                  load_funcs('comments/_trackback.funcs.php'); // TODO: use newer call below
 299                  trackback_number('', ' &middot; '.T_('1 Trackback'), ' &middot; '.T_('%d Trackbacks'), $Item->ID);
 300                  echo '</a>';
 301              }
 302              echo '</span>';
 303  
 304              echo '<span class="roundbutton_group">';
 305              // Display edit button if current user has the rights:
 306              $Item->edit_link( array( // Link to backoffice for editing
 307                      'before' => ' ',
 308                      'after'  => '',
 309                      'class'  => 'roundbutton_text'
 310                  ) );
 311  
 312              // Display copy button if current user has the rights:
 313              $Item->copy_link( array( // Link to backoffice for coping
 314                      'before' => '',
 315                      'after'  => ' ',
 316                      'text'   => '#icon#',
 317                      'class'  => 'roundbutton'
 318                  ) );
 319              echo '</span>';
 320  
 321              echo '<span class="roundbutton_group">';
 322              // Display the moderate buttons if current user has the rights:
 323              $status_link_params = array(
 324                      'class'       => 'roundbutton_text',
 325                      'redirect_to' => regenerate_url( '', '&highlight='.$Item->ID.'#item_'.$Item->ID, '', '&' ),
 326                  );
 327              $Item->next_status_link( $status_link_params, true );
 328              $Item->next_status_link( $status_link_params, false );
 329  
 330              $next_status_in_row = $Item->get_next_status( false );
 331              if( $next_status_in_row && $next_status_in_row[0] != 'deprecated' )
 332              { // Display deprecate button if current user has the rights:
 333                  $Item->deprecate_link( '', '', get_icon( 'move_down_grey', 'imgtag', array( 'title' => '' ) ), '#', 'roundbutton' );
 334              }
 335  
 336              // Display delete button if current user has the rights:
 337              $Item->delete_link( '', ' ', '#', '#', 'roundbutton_text', false );
 338              echo '</span>';
 339  
 340              ?>
 341  
 342              <div class="clear"></div>
 343          </div>
 344  
 345          <?php
 346  
 347          // _____________________________________ Displayed in SINGLE VIEW mode only _____________________________________
 348  
 349          if( $action == 'view' )
 350          { // We are looking at a single post, include files and comments:
 351  
 352              if( isset($GLOBALS['files_Module']) )
 353              {    // Files:
 354                  echo '<div class="bFeedback">';    // TODO
 355      
 356                  /**
 357                   * Needed by file display funcs
 358                   * @var Item
 359                   */
 360                  global $LinkOwner;
 361                  $LinkOwner = new LinkItem( $Item );
 362                  require $inc_path.'links/views/_link_list.inc.php';
 363                  echo '</div>';
 364              }
 365  
 366  
 367            // ---------- comments ----------
 368  
 369              $total_comments_number = generic_ctp_number( $Item->ID, 'total', 'total' );
 370              $draft_comments_number = generic_ctp_number( $Item->ID, 'total', 'draft' );
 371              // decide to show all comments, or only drafts
 372              if( $total_comments_number > 5 && $draft_comments_number > 0 )
 373              { // show only drafts
 374                  $statuses = array( 'draft' );
 375                  $show_comments = 'draft';
 376                  param( 'comments_number', 'integer', $draft_comments_number );
 377              }
 378              else
 379              { // show all comments
 380                  $statuses = get_visibility_statuses( 'keys', array( 'redirected', 'trash' ) );
 381                  $show_comments = 'all';
 382                  param( 'comments_number', 'integer', $total_comments_number );
 383              }
 384  
 385              $show_comments_expiry = param( 'show_comments_expiry', 'string', 'active', false, true );
 386              $expiry_statuses = array( 'active' );
 387              if( $show_comments_expiry == 'all' )
 388              { // Display also the expired comments
 389                  $expiry_statuses[] = 'expired';
 390              }
 391  
 392              global $CommentList;
 393              $CommentList = new CommentList2( $Blog );
 394  
 395              // Filter list:
 396              $CommentList->set_filters( array(
 397                  'types' => array( 'comment','trackback','pingback' ),
 398                  'statuses' => $statuses,
 399                  'order' => 'ASC',
 400                  'post_ID' => $Item->ID,
 401                  'comments' => 20,
 402                  'expiry_statuses' => $expiry_statuses,
 403              ) );
 404              $CommentList->query();
 405  
 406              // We do not want to comment actions use new redirect
 407              param( 'save_context', 'boolean', false );
 408              param( 'redirect_to', 'url', url_add_param( $admin_url, 'ctrl=items&blog='.$blog.'&p='.$Item->ID, '&' ), false, true );
 409              param( 'item_id', 'integer', $Item->ID );
 410              param( 'currentpage', 'integer', 1 );
 411              param( 'show_comments', 'string', $show_comments, false, true );
 412  
 413              // display status filter
 414              ?>
 415              <div class="bFeedback">
 416              <a id="comments"></a>
 417              <h4>
 418              <?php 
 419                  echo T_('Comments'), ', ', T_('Trackbacks'), ', ', T_('Pingbacks').' ('.generic_ctp_number( $Item->ID, 'feedbacks', 'total' ).')';
 420                  $opentrash_link = get_opentrash_link();
 421                  $refresh_link = '<span class="floatright">'.action_icon( T_('Refresh comment list'), 'refresh', 'javascript:startRefreshComments('.$Item->ID.')' ).'</span> ';
 422                  echo $refresh_link.$opentrash_link;
 423              ?>:</h4>
 424              <?php
 425  
 426              if( $display_params['disp_rating_summary'] )
 427              {    // Display a ratings summary
 428                  echo '<h3>'.$Item->get_feedback_title( 'comments', '#', '#', '#', 'total' ).'</h3>';
 429                  echo $Item->get_rating_summary();
 430                  echo '<br />';
 431              }
 432  
 433              ?>
 434              <div class="tile"><label><?php echo T_('Show').':' ?></label></div>
 435              <div class="tile">
 436                  <input type="radio" name="show_comments" value="draft" id="only_draft" class="radio" <?php if( $show_comments == 'draft' ) echo 'checked="checked" '?> />
 437                  <label for="only_draft"><?php echo T_('Drafts') ?></label>
 438              </div>
 439              <div class="tile">
 440                  <input type="radio" name="show_comments" value="published" id="only_published" class="radio" <?php if( $show_comments == 'published' ) echo 'checked="checked" '?> />
 441                  <label for="only_published"><?php echo T_('Published') ?></label>
 442              </div>
 443              <div class="tile">
 444                  <input type="radio" name="show_comments" value="all" id="show_all" class="radio" <?php if( $show_comments == 'all' ) echo 'checked="checked" '?> />
 445                  <label for="show_all"><?php echo T_('All comments') ?></label>
 446              </div>
 447              <?php
 448              $expiry_delay = $Item->get_setting( 'post_expiry_delay' );
 449              if( ! empty( $expiry_delay ) )
 450              { // A filter to display even the expired comments
 451              ?>
 452              <div class="tile">
 453                  &nbsp; | &nbsp;
 454                  <input type="radio" name="show_comments_expiry" value="expiry" id="show_expiry_delay" class="radio" <?php if( $show_comments_expiry == 'active' ) echo 'checked="checked" '?> />
 455                  <label for="show_expiry_delay"><?php echo get_duration_title( $expiry_delay ); ?></label>
 456              </div>
 457              <div class="tile">
 458                  <input type="radio" name="show_comments_expiry" value="all" id="show_expiry_all" class="radio" <?php if( $show_comments_expiry == 'all' ) echo 'checked="checked" '?> />
 459                  <label for="show_expiry_all"><?php echo T_('All comments') ?></label>
 460              </div>
 461              <?php
 462              }
 463  
 464              load_funcs( 'comments/model/_comment_js.funcs.php' );
 465  
 466              // comments_container value shows, current Item ID
 467              echo '<div id="comments_container" value="'.$Item->ID.'">';
 468              // display comments
 469              $CommentList->display_if_empty( array(
 470                      'before'    => '<div class="bComment"><p>',
 471                      'after'     => '</p></div>',
 472                      'msg_empty' => T_('No feedback for this post yet...'),
 473                  ) );
 474  
 475              require $inc_path.'comments/views/_comment_list.inc.php';
 476              echo '</div>'; // comments_container div
 477  
 478              if( $Item->can_comment() )
 479              { // User can leave a comment
 480              ?>
 481              <!-- ========== FORM to add a comment ========== -->
 482              <h4><?php echo T_('Leave a comment') ?>:</h4>
 483  
 484              <?php
 485  
 486              $Form = new Form( $htsrv_url.'comment_post.php', 'comment_checkchanges' );
 487  
 488              $Form->begin_form( 'bComment' );
 489  
 490              $Form->add_crumb( 'comment' );
 491              $Form->hidden( 'comment_post_ID', $Item->ID );
 492              $Form->hidden( 'redirect_to', $ReqURI );
 493              ?>
 494                  <fieldset>
 495                      <div class="label"><?php echo T_('User') ?>:</div>
 496                      <div class="info">
 497                          <strong><?php echo $current_User->get_identity_link( array( 'link_text' => 'text' ) )?></strong>
 498                          <?php user_profile_link( ' [', ']', T_('Edit profile') ) ?>
 499                          </div>
 500                  </fieldset>
 501              <?php
 502              $Form->textarea( $dummy_fields[ 'content' ], '', 12, T_('Comment text'), '', 40, 'bComment' );
 503  
 504              global $Plugins;
 505              $Form->info( T_('Text Renderers'), $Plugins->get_renderer_checkboxes( array( 'default') , array( 'Blog' => & $Blog, 'setting_name' => 'coll_apply_comment_rendering' ) ) );
 506  
 507              $Form->buttons_input( array(array('name'=>'submit', 'value'=>T_('Send comment'), 'class'=>'SaveButton' )) );
 508              ?>
 509  
 510                  <div class="clear"></div>
 511              <?php
 512                  $Form->end_form();
 513              ?>
 514              <!-- ========== END of FORM to add a comment ========== -->
 515              <?php
 516              } // / can comment
 517          ?>
 518          </div>
 519          <?php
 520      } // / comments requested
 521  ?>
 522  </div>
 523  <?php
 524  }
 525  
 526  echo_show_comments_changed();
 527  
 528  // Display navigation:
 529  $ItemList->display_nav( 'footer' );
 530  
 531  
 532  $block_item_Widget->disp_template_replaced( 'block_end' );
 533  
 534  ?>

title

Description

title

Description

title

Description

title

title

Body