b2evolution PHP Cross Reference Blogging Systems

Source: /inc/items/views/_item_list_manual.view.php - 116 lines - 4523 bytes - Text - Print

Description: This file implements the recursive chapter list with posts inside.

   1  <?php
   2  /**

   3   * This file implements the recursive chapter list with posts inside.

   4   *

   5   * This file is part of the evoCore framework - {@link http://evocore.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   * {@internal License choice

  11   * - If you have received this file as part of a package, please find the license.txt file in

  12   *   the same folder or the closest folder above for complete license terms.

  13   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)

  14   *   then you must choose one of the following licenses before using the file:

  15   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php

  16   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php

  17   * }}

  18   *

  19   * @package admin

  20   *

  21   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  22   * @author fplanque: Francois PLANQUE.

  23   *

  24   * @version $Id: _item_list_manual.view.php 2193 2012-10-19 11:01:47Z yura $

  25   */
  26  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  27  
  28  
  29  items_manual_results_block();
  30  
  31  /* fp> TODO: maybe... (a general group move of posts would be more useful actually)

  32  echo '<p class="note">'.T_('<strong>Note:</strong> Deleting a category does not delete posts from that category. It will just assign them to the parent category. When deleting a root category, posts will be assigned to the oldest remaining category in the same collection (smallest category number).').'</p>';

  33  */
  34  
  35  global $Settings, $dispatcher, $ReqURI, $blog;
  36  
  37  echo '<p class="note">'.sprintf( T_('<strong>Note:</strong> Ordering of categories is currently set to %s in the %sblogs settings%s.'),
  38      $Settings->get('chapter_ordering') == 'manual' ? /* TRANS: Manual here = "by hand" */ T_('Manual ') : T_('Alphabetical'), '<a href="'.$dispatcher.'?ctrl=collections&tab=settings#categories">', '</a>' ).'</p> ';
  39  
  40  if( ! $Settings->get('allow_moving_chapters') )
  41  { // TODO: check perm
  42      echo '<p class="note">'.sprintf( T_('<strong>Note:</strong> Moving categories across blogs is currently disabled in the %sblogs settings%s.'), '<a href="'.$dispatcher.'?ctrl=collections&tab=settings#categories">', '</a>' ).'</p> ';
  43  }
  44  
  45  ?>
  46  <script type="text/javascript">
  47  jQuery( document ).on( 'click', 'td[id^=order-]', function()
  48  {
  49      if( jQuery( this ).find( 'input' ).length > 0 )
  50      { // This order field is already editing now
  51          return;
  52      }
  53  
  54      // Create <input> to edit order field

  55      var input = document.createElement( 'input' )
  56      var $input = jQuery( input );
  57      $input.val( jQuery( this ).html() );
  58      $input.css( {
  59          width: jQuery( this ).width() - 2,
  60          height: jQuery( this ).height() - 2,
  61          padding: '0',
  62          'text-align': 'center'
  63      } );
  64  
  65      // Save current value

  66      jQuery( this ).attr( 'rel', jQuery( this ).html() );
  67  
  68      // Replace statis value with <input>

  69      jQuery( this ).html( '' ).append( $input );
  70      $input.focus();
  71  
  72      // Bind events for <input>

  73      $input.bind( 'keydown', function( e )
  74      {
  75          var key = e.keyCode;
  76          //console.log(key);

  77          var td_obj = jQuery( this ).parent();
  78          if( key == 27 )
  79          { // "Esc" key
  80              td_obj.html( td_obj.attr( 'rel' ) );
  81          }
  82          else if( key == 13 )
  83          { // "Enter" key
  84              results_ajax_load( jQuery( this ), '<?php echo $ReqURI; ?>&blog=<?php echo $blog; ?>&order_action=update&order_data=' + td_obj.attr( 'id' ) + '&order_value=' + jQuery( this ).val() );
  85          }
  86      } );
  87  
  88      $input.bind( 'blur', function()
  89      {
  90          var revert_changes = false;
  91  
  92          var td_obj = jQuery( this ).parent();
  93          if( td_obj.attr( 'rel' ) != jQuery( this ).val() )
  94          { // Value was changed, ask about saving
  95              // fp>yura: please explain where and when this happens:

  96              // yura>fp: 1. Go to in backoffice "Manual BLOG > Contents > Manual Pages" like this url: /admin.php?ctrl=items&tab=manual&filter=restore&blog=6

  97              // 2. Click on the cell of the column "Order", You will see the input to change an order

  98              // 3. Change to other value

  99              // 4. Click outside input(to init event "blur") - and this message will be appeared

 100              if( confirm( '<?php echo TS_('Do you want discard your changes for this order field?'); ?>' ) )
 101              {
 102                  revert_changes = true;
 103              }
 104          }
 105          else
 106          {
 107              revert_changes = true;
 108          }
 109  
 110          if( revert_changes )
 111          { // Revert the changed value
 112              td_obj.html( td_obj.attr( 'rel' ) );
 113          }
 114      } );
 115  } );
 116  </script>

title

Description

title

Description

title

Description

title

title

Body