b2evolution PHP Cross Reference Blogging Systems

Source: /inc/items/views/_item_simple.form.php - 316 lines - 10875 bytes - Text - Print

Description: This file implements the SIMPLE Post form. 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 SIMPLE Post form.
   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   * @package admin
  13   *
  14   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  15   * @author fplanque: Francois PLANQUE
  16   * @author blueyed: Daniel HAHLER
  17   *
  18   * @version $Id: _item_simple.form.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 User
  24   */
  25  global $current_User;
  26  /**
  27   * @var Item
  28   */
  29  global $edited_Item;
  30  /**
  31   * @var Blog
  32   */
  33  global $Blog;
  34  /**
  35   * @var Plugins
  36   */
  37  global $Plugins;
  38  /**
  39   * @var GeneralSettings
  40   */
  41  global $Settings;
  42  
  43  global $pagenow;
  44  
  45  global $Session;
  46  
  47  global $mode;
  48  global $post_comment_status, $trackback_url, $item_tags;
  49  global $bozo_start_modified, $creating;
  50  global $item_title, $item_content;
  51  global $redirect_to;
  52  
  53  // Determine if we are creating or updating...
  54  $creating = is_create_action( $action );
  55  
  56  $Form = new Form( NULL, 'item_checkchanges', 'post' );
  57  $Form->labelstart = '<strong>';
  58  $Form->labelend = "</strong>\n";
  59  
  60  // ================================ START OF EDIT FORM ================================
  61  
  62  $iframe_name = NULL;
  63  $params = array();
  64  if( !empty( $bozo_start_modified ) )
  65  {
  66      $params['bozo_start_modified'] = true;
  67  }
  68  $Form->begin_form( '', '', $params );
  69  
  70      $Form->add_crumb( 'item' );
  71      $Form->hidden( 'ctrl', 'items' );
  72      $Form->hidden( 'blog', $Blog->ID );
  73      if( isset( $mode ) )   $Form->hidden( 'mode', $mode ); // used by bookmarklet
  74      if( isset( $edited_Item ) )
  75      {
  76          if( $action == 'copy' )
  77          {    // Copy post
  78              $Form->hidden( 'post_ID', 0 );
  79          }
  80          else
  81          {    // Edit post
  82              $Form->hidden( 'post_ID', $edited_Item->ID );
  83          }
  84  
  85          // Here we add js code for attaching file popup window: (Yury)
  86          if( !empty( $edited_Item->ID ) && ( $Session->get('create_edit_attachment') === true ) )
  87          { // item also created => we have $edited_Item->ID for popup window:
  88              echo_attaching_files_button_js( $iframe_name );
  89              // clear session variable:
  90              $Session->delete('create_edit_attachment');
  91          }
  92      }
  93      $Form->hidden( 'redirect_to', $redirect_to );
  94  
  95      // In case we send this to the blog for a preview :
  96      $Form->hidden( 'preview', 1 );
  97      $Form->hidden( 'more', 1 );
  98      $Form->hidden( 'preview_userid', $current_User->ID );
  99  
 100  
 101      // Fields used in "advanced" form, but not here:
 102      $Form->hidden( 'post_locale', $edited_Item->get( 'locale' ) );
 103      $Form->hidden( 'item_typ_ID', $edited_Item->ptyp_ID );
 104      $Form->hidden( 'post_url', $edited_Item->get( 'url' ) );
 105      $Form->hidden( 'post_excerpt', $edited_Item->get( 'excerpt' ) );
 106      $Form->hidden( 'post_urltitle', $edited_Item->get( 'urltitle' ) );
 107      $Form->hidden( 'titletag', $edited_Item->get( 'titletag' ) );
 108      $Form->hidden( 'metadesc', $edited_Item->get_setting( 'post_metadesc' ) );
 109      $Form->hidden( 'custom_headers', $edited_Item->get_setting( 'post_custom_headers' ) );
 110  
 111  
 112      if( $Blog->get_setting( 'use_workflow' ) )
 113      {    // We want to use workflow properties for this blog:
 114          $Form->hidden( 'item_priority', $edited_Item->priority );
 115          $Form->hidden( 'item_assigned_user_ID', $edited_Item->assigned_user_ID );
 116          $Form->hidden( 'item_st_ID', $edited_Item->pst_ID );
 117          $Form->hidden( 'item_deadline', $edited_Item->datedeadline );
 118      }
 119      $Form->hidden( 'trackback_url', $trackback_url );
 120      $Form->hidden( 'renderers_displayed', 1 );
 121      $Form->hidden( 'renderers', $edited_Item->get_renderers_validated() );
 122      $Form->hidden( 'item_featured', $edited_Item->featured );
 123      $Form->hidden( 'item_hideteaser', $edited_Item->get_setting( 'hide_teaser' ) );
 124      $Form->hidden( 'expiry_delay', $edited_Item->get_setting( 'post_expiry_delay' ) );
 125      $Form->hidden( 'item_order', $edited_Item->order );
 126  
 127      $creator_User = $edited_Item->get_creator_User();
 128      $Form->hidden( 'item_owner_login', $creator_User->login );
 129      $Form->hidden( 'item_owner_login_displayed', 1 );
 130  
 131      if( $Blog->get_setting( 'show_location_coordinates' ) )
 132      {
 133          $Form->hidden( 'item_latitude', $edited_Item->get_setting( 'latitude' ) );
 134          $Form->hidden( 'item_longitude', $edited_Item->get_setting( 'longitude' ) );
 135          $Form->hidden( 'google_map_zoom', $edited_Item->get_setting( 'map_zoom' ) );
 136          $Form->hidden( 'google_map_type', $edited_Item->get_setting( 'map_type' ) );
 137      }
 138  
 139      // CUSTOM FIELDS
 140      display_hidden_custom_fields( $Form, $edited_Item );
 141  
 142      // Location
 143      $Form->hidden( 'item_ctry_ID', $edited_Item->ctry_ID );
 144      $Form->hidden( 'item_rgn_ID', $edited_Item->rgn_ID );
 145      $Form->hidden( 'item_subrg_ID', $edited_Item->subrg_ID );
 146      $Form->hidden( 'item_city_ID', $edited_Item->city_ID );
 147  
 148      // TODO: Form::hidden() do not add, if NULL?!
 149  
 150  ?>
 151  
 152  <div class="left_col">
 153  
 154      <?php
 155      // ############################ POST CONTENTS #############################
 156  
 157      $Form->begin_fieldset( T_('Post contents').get_manual_link('post_contents_fieldset') );
 158  
 159      // Title input:
 160      $require_title = $Blog->get_setting('require_title');
 161      if( $require_title != 'none' )
 162      {
 163          $Form->switch_layout( 'none' );
 164  
 165          echo '<table cellspacing="0" class="compose_layout"><tr>';
 166          echo '<td class"label"><strong>'.T_('Title').':</strong></td>';
 167          echo '<td class="input">';
 168          $Form->text_input( 'post_title', $item_title, 20, '', '', array('maxlength'=>255, 'style'=>'width: 100%;', 'required'=>($require_title=='required')) );
 169          echo '</td><td width="1"><!-- for IE7 --></td></tr></table>';
 170  
 171          $Form->switch_layout( NULL );
 172      }
 173  
 174      // --------------------------- TOOLBARS ------------------------------------
 175      echo '<div class="edit_toolbars">';
 176      // CALL PLUGINS NOW:
 177      $Plugins->trigger_event( 'AdminDisplayToolbar', array(
 178              'target_type' => 'Item',
 179              'edit_layout' => 'simple',
 180              'Item' => $edited_Item,
 181          ) );
 182      echo '</div>';
 183  
 184      // ---------------------------- TEXTAREA -------------------------------------
 185      $Form->fieldstart = '<div class="edit_area">';
 186      $Form->fieldend = "</div>\n";
 187      $Form->textarea_input( 'content', $item_content, 16, '', array( 'cols' => 40 , 'id' => 'itemform_post_content' ) );
 188      $Form->fieldstart = '<div class="tile">';
 189      $Form->fieldend = '</div>';
 190      ?>
 191      <script type="text/javascript" language="JavaScript">
 192          <!--
 193          // This is for toolbar plugins
 194          var b2evoCanvas = document.getElementById('itemform_post_content');
 195          //-->
 196      </script>
 197  
 198      <?php // ------------------------------- ACTIONS ----------------------------------
 199      echo '<div class="edit_actions">';
 200  
 201      // CALL PLUGINS NOW:
 202      $Plugins->trigger_event( 'AdminDisplayEditorButton', array( 'target_type' => 'Item', 'edit_layout' => 'simple' ) );
 203  
 204      echo_publish_buttons( $Form, $creating, $edited_Item );
 205  
 206      echo '</div>';
 207  
 208      $Form->end_fieldset();
 209  
 210  
 211      // ####################### ATTACHMENTS/LINKS #########################
 212      if( isset($GLOBALS['files_Module']) && ( !$creating ||
 213          ( $current_User->check_perm( 'item_post!CURSTATUS', 'edit', false, $edited_Item )
 214          && $current_User->check_perm( 'files', 'view', false ) ) ) )
 215      { // Files module is enabled, but in case of creating new posts we should show file attachments block only if user has all required permissions to attach files
 216          load_class( 'links/model/_linkitem.class.php', 'LinkItem' );
 217          $LinkOwner = new LinkItem( $edited_Item );
 218          attachment_iframe( $Form, $LinkOwner, $iframe_name, $creating );
 219      }
 220      // ############################ ADVANCED #############################
 221  
 222      $Form->begin_fieldset( T_('Meta info').get_manual_link('post_simple_meta_fieldset'), array( 'id' => 'itemform_adv_props' ) );
 223  
 224      $Form->switch_layout( 'linespan' );
 225  
 226      if( $current_User->check_perm( 'blog_edit_ts', 'edit', false, $Blog->ID ) )
 227      { // ------------------------------------ TIME STAMP -------------------------------------
 228          echo '<div id="itemform_edit_timestamp" class="edit_fieldgroup">';
 229          issue_date_control( $Form, false );
 230          echo '</div>';
 231      }
 232  
 233      echo '<table cellspacing="0" class="compose_layout">';
 234      echo '<tr><td class="label"><label for="item_tags">'.T_('Tags').':</strong></label></td>';
 235      echo '<td class="input">';
 236      $Form->text_input( 'item_tags', $item_tags, 40, '', '', array('maxlength'=>255, 'style'=>'width: 100%;') );
 237      echo '</td><td width="1"><!-- for IE7 --></td></tr>';
 238      echo '</table>';
 239  
 240      $Form->switch_layout( NULL );
 241  
 242      $Form->end_fieldset();
 243  
 244  
 245      // ####################### PLUGIN FIELDSETS #########################
 246  
 247      $Plugins->trigger_event( 'AdminDisplayItemFormFieldset', array( 'Form' => & $Form, 'Item' => & $edited_Item, 'edit_layout' => 'simple' ) );
 248      ?>
 249  
 250  </div>
 251  
 252  <div class="right_col">
 253  
 254      <?php
 255      // ################### MODULES SPECIFIC ITEM SETTINGS ###################
 256  
 257      modules_call_method( 'display_item_settings', array( 'Form' => & $Form, 'Blog' => & $Blog, 'edited_Item' => & $edited_Item ) );
 258  
 259      // ################### CATEGORIES ###################
 260  
 261      cat_select( $Form );
 262  
 263  
 264      // ################### VISIBILITY / SHARING ###################
 265  
 266      $Form->begin_fieldset( T_('Visibility / Sharing'), array( 'id' => 'itemform_visibility' ) );
 267  
 268      $Form->switch_layout( 'linespan' );
 269      visibility_select( $Form, $edited_Item->status );
 270      $Form->switch_layout( NULL );
 271  
 272      $Form->end_fieldset();
 273  
 274  
 275      // ################### COMMENT STATUS ###################
 276  
 277      if( ( $Blog->get_setting( 'allow_comments' ) != 'never' ) && ( $Blog->get_setting( 'disable_comments_bypost' ) ) )
 278      {
 279          $Form->begin_fieldset( T_('Comments'), array( 'id' => 'itemform_comments' ) );
 280  
 281          ?>
 282              <label title="<?php echo T_('Visitors can leave comments on this post.') ?>"><input type="radio" name="post_comment_status" value="open" class="checkbox" <?php if( $post_comment_status == 'open' ) echo 'checked="checked"'; ?> />
 283              <?php echo T_('Open') ?></label><br />
 284  
 285              <label title="<?php echo T_('Visitors can NOT leave comments on this post.') ?>"><input type="radio" name="post_comment_status" value="closed" class="checkbox" <?php if( $post_comment_status == 'closed' ) echo 'checked="checked"'; ?> />
 286              <?php echo T_('Closed') ?></label><br />
 287  
 288              <label title="<?php echo T_('Visitors cannot see nor leave comments on this post.') ?>"><input type="radio" name="post_comment_status" value="disabled" class="checkbox" <?php if( $post_comment_status == 'disabled' ) echo 'checked="checked"'; ?> />
 289              <?php echo T_('Disabled') ?></label><br />
 290          <?php
 291  
 292          $Form->end_fieldset();
 293      }
 294  
 295      ?>
 296  
 297  </div>
 298  
 299  <div class="clear"></div>
 300  
 301  <?php
 302  // ================================== END OF EDIT FORM ==================================
 303  $Form->end_form();
 304  
 305  
 306  // ####################### JS BEHAVIORS #########################
 307  echo_publishnowbutton_js();
 308  echo_set_is_attachments();
 309  echo_link_files_js();
 310  // New category input box:
 311  echo_onchange_newcat();
 312  echo_autocomplete_tags( $edited_Item->get_tags() );
 313  
 314  // require dirname(__FILE__).'/inc/_item_form_behaviors.inc.php';
 315  
 316  ?>

title

Description

title

Description

title

Description

title

title

Body