[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/items/views/ -> _item_expert.form.php (source)

   1  <?php
   2  /**

   3   * This file implements the 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-2007 by Francois PLANQUE - {@link http://fplanque.net/}.

   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 fsaya: Fabrice SAYA-GASNIER / PROGIDISTRI

  17   * @author blueyed: Daniel HAHLER

  18   * @author gorgeb: Bertrand GORGE / EPISTEMA

  19   *

  20   * @todo blueyed>> IMHO it's not good to use CSS class .line here (mainly white-space:nowrap),

  21   *                 because on a smaller screen you'll cut things off! (and not every browser

  22   *                 allows "marking and moving" of text then).

  23   *

  24   * @version $Id: _item_expert.form.php,v 1.13 2007/10/09 15:03:43 waltercruz Exp $

  25   */
  26  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  27  
  28  /**

  29   * @var User

  30   */
  31  global $current_User;
  32  /**

  33   * @var Item

  34   */
  35  global $edited_Item;
  36  /**

  37   * @var Blog

  38   */
  39  global $Blog;
  40  /**

  41   * @var Plugins

  42   */
  43  global $Plugins;
  44  /**

  45   * @var GeneralSettings

  46   */
  47  global $Settings;
  48  
  49  global $pagenow;
  50  
  51  
  52  global $mode, $use_post_url;
  53  global $use_preview, $post_comment_status, $trackback_url, $item_tags;
  54  global $edit_date, $bozo_start_modified, $creating;
  55  global $item_title, $item_content;
  56  global $redirect_to;
  57  
  58  // Determine if we are creating or updating...

  59  $creating = is_create_action( $action );
  60  
  61  $Form = & new Form( NULL, 'item_checkchanges', 'post' );
  62  $Form->labelstart = '<strong>';
  63  $Form->labelend = "</strong>\n";
  64  
  65  
  66  // ================================ START OF EDIT FORM ================================

  67  
  68  $params = array();
  69  if( !empty( $bozo_start_modified ) )
  70  {
  71      $params['bozo_start_modified'] = true;
  72  }
  73  
  74  $Form->begin_form( '', '', $params );
  75  
  76  $Form->hidden( 'ctrl', 'items' );
  77  $Form->hidden( 'action', $creating ? 'create' : 'update' );
  78  $Form->hidden( 'blog', $Blog->ID );
  79  if( isset( $mode ) )   $Form->hidden( 'mode', $mode );    // used by bookmarklet

  80  if( isset( $edited_Item ) )   $Form->hidden( 'post_ID', $edited_Item->ID );
  81  $Form->hidden( 'redirect_to', $redirect_to );
  82  
  83  // In case we send this to the blog for a preview :

  84  $Form->hidden( 'preview', 1 );
  85  $Form->hidden( 'more', 1 );
  86  $Form->hidden( 'preview_userid', $current_User->ID );
  87  
  88  ?>
  89  <div class="left_col">
  90  
  91      <?php
  92      // ############################ POST CONTENTS #############################

  93  
  94      $Form->begin_fieldset( T_('Post contents').get_manual_link('post_contents_fieldset') );
  95  
  96      $Form->switch_layout( 'none' );
  97  
  98      echo '<table cellspacing="0" class="compose_layout"><tr>';
  99      echo '<td width="1%"><strong>'.T_('Title').':</strong></td>';
 100      echo '<td width="97%" class="input">';
 101      $Form->text_input( 'post_title', $item_title, 20, '', '', array('maxlength'=>255, 'style'=>'width: 100%;') );
 102      echo '</td>';
 103      echo '<td width="1%">&nbsp;&nbsp;<strong>'.T_('Language').':</strong></td>';
 104      echo '<td width="1%" class="select">';
 105      $Form->select( 'post_locale', $edited_Item->get( 'locale' ), 'locale_options_return', '' );
 106      echo '</td></tr></table>';
 107  
 108      echo '<table cellspacing="0" class="compose_layout"><tr>';
 109      if( $use_post_url )
 110      {
 111          echo '<td width="1%"><strong>'.T_('Link to url').':</strong></td>';
 112          echo '<td class="input">';
 113          $Form->text_input( 'post_url', $edited_Item->get( 'url' ), 20, '', '', array('maxlength'=>255, 'style'=>'width: 100%;') );
 114          echo '</td>';
 115      }
 116      else
 117      {
 118          echo '<td>';
 119          $Form->hidden( 'post_url', '' );
 120          echo '</td>';
 121      }
 122  
 123      echo '<td width="1%">&nbsp;&nbsp;<strong>'.T_('Type').':</strong></td>';
 124      echo '<td width="1%" class="select">';
 125      $ItemTypeCache = & get_Cache( 'ItemTypeCache' );
 126      $Form->select_object( 'item_typ_ID', $edited_Item->ptyp_ID, $ItemTypeCache, '' );
 127      echo '</td>';
 128  
 129      echo '</tr></table>';
 130  
 131       $Form->switch_layout( NULL );
 132  
 133      // --------------------------- TOOLBARS ------------------------------------

 134      echo '<div class="edit_toolbars">';
 135      // CALL PLUGINS NOW:

 136      $Plugins->trigger_event( 'AdminDisplayToolbar', array( 'target_type' => 'Item', 'edit_layout' => 'expert' ) );
 137      echo '</div>';
 138  
 139      // ---------------------------- TEXTAREA -------------------------------------

 140      $Form->fieldstart = '<div class="edit_area">';
 141      $Form->fieldend = "</div>\n";
 142      $Form->textarea_input( 'content', $item_content, 16, '', array( 'cols' => 40 , 'id' => 'itemform_post_content' ) );
 143      $Form->fieldstart = '<div class="tile">';
 144      $Form->fieldend = '</div>';
 145      ?>
 146      <script type="text/javascript" language="JavaScript">
 147          <!--
 148          // This is for toolbar plugins

 149          var b2evoCanvas = document.getElementById('itemform_post_content');
 150          //-->

 151      </script>
 152  
 153      <?php // ------------------------------- ACTIONS ----------------------------------
 154      echo '<div class="edit_actions">';
 155  
 156      if( $use_preview )
 157      { // ---------- PREVIEW ----------
 158          load_funcs( '_core/_url.funcs.php' );
 159          $url = url_same_protocol( $Blog->get( 'url' ) ); // was dynurl

 160  
 161          $Form->button( array( 'button', '', T_('Preview'), '', 'b2edit_open_preview(this.form, \''.$url.'\');' ) );
 162      }
 163  
 164      // ---------- SAVE ----------

 165      $Form->submit( array( '', /* TRANS: This is the value of an input submit button */ T_('Save !'), 'SaveButton' ) );
 166  
 167      // ---------- DELETE ----------

 168      if( ! $creating )
 169      { // Editing post
 170          // Display delete button if current user has the rights:

 171          $edited_Item->delete_link( ' ', ' ', '#', '#', 'DeleteButton', true );
 172      }
 173  
 174      if( $Settings->get( 'fm_enabled' ) )
 175      { // ---------- UPLOAD ----------
 176          // Note: we try to land in the Blog media folder if possible

 177          // fp> TODO: check what happens if blog folders are disabled

 178          if( $current_User->check_perm( 'files', 'view' ) )
 179          {
 180              // TODO: image integration into posts after upload is broken...

 181              echo '<input id="itemform_button_files" type="button" value="'.format_to_output(T_('Files'), 'formvalue').'" class="ActionButton"
 182                     onclick="pop_up_window( \''.url_add_param( $Blog->get_filemanager_link(), 'mode=upload' ).'\', \'fileman_upload\', 1000 )" /> ';
 183          }
 184      }
 185  
 186      // CALL PLUGINS NOW:

 187      $Plugins->trigger_event( 'AdminDisplayEditorButton', array( 'target_type' => 'Item', 'edit_layout' => 'expert' ) );
 188  
 189      echo '</div>';
 190  
 191      $Form->end_fieldset();
 192  
 193  
 194      // ############################ ADVANCED #############################

 195  
 196      $Form->begin_fieldset( T_('Advanced properties'), array( 'id' => 'itemform_adv_props' ) );
 197  
 198       $Form->switch_layout( 'linespan' );
 199  
 200      if( $current_User->check_perm( 'edit_timestamp' ) )
 201      { // ------------------------------------ TIME STAMP -------------------------------------
 202  
 203          echo '<div id="itemform_edit_timestamp" class="edit_fieldgroup">';
 204  
 205          $Form->date( 'item_issue_date', $edited_Item->get('issue_date'), T_('Issue date') );
 206          echo ' '; // allow wrapping!

 207          $Form->time( 'item_issue_time', $edited_Item->get('issue_date'), '' );
 208          echo ' '; // allow wrapping!

 209          if( $creating )
 210          { // If not checked, create time will be used...
 211              $Form->checkbox( 'edit_date', $edit_date, '', T_('Edit') );
 212          }
 213  
 214          echo '</div>';
 215      }
 216  
 217  
 218      echo '<div id="itemform_urltitle" class="edit_fieldgroup">';
 219      $Form->text( 'post_urltitle', $edited_Item->get( 'urltitle' ), 40, T_('URL Title'),
 220                   T_('(to be used in permalinks)'), $field_maxlength = 50 ) ;
 221      echo '</div>';
 222      ?>
 223  
 224      <div id="itemform_tags" class="edit_fieldgroup">
 225          <label for="item_tags"><strong><?php echo T_('Tags') ?>:</strong>
 226          <span class="notes"><?php echo T_('(Separate by space)') ?></span></label><br />
 227          <input type="text" name="item_tags" class="large form_text_input" id="item_tags" value="<?php echo format_to_output( $item_tags, 'formvalue' ); ?>" />
 228      </div>
 229  
 230      <div id="itemform_post_excerpt" class="edit_fieldgroup">
 231          <label for="post_excerpt"><strong><?php echo T_('Excerpt') ?>:</strong>
 232          <span class="notes"><?php echo T_('(for XML feeds)') ?></span></label><br />
 233          <textarea name="post_excerpt" rows="2" cols="25" class="large" id="post_excerpt"><?php $edited_Item->disp( 'excerpt', 'formvalue' ) ?></textarea>
 234      </div>
 235  
 236      <?php
 237      $Form->switch_layout( NULL );
 238  
 239      $Form->end_fieldset();
 240  
 241  
 242      // ############################ WORKFLOW #############################

 243  
 244      if( $Blog->get_setting( 'use_workflow' ) )
 245      {    // We want to use workflow properties for this blog:
 246          $Form->begin_fieldset( T_('Workflow properties'), array( 'id' => 'itemform_workflow_props' ) );
 247  
 248              echo '<div id="itemform_edit_timestamp" class="edit_fieldgroup">';
 249              $Form->switch_layout( 'linespan' );
 250  
 251              $Form->select_object( 'item_priority', NULL, $edited_Item, T_('Priority'), '', true, '', 'priority_options' );
 252  
 253              echo ' '; // allow wrapping!

 254  
 255              $Form->select_object( 'item_assigned_user_ID', NULL, $edited_Item, T_('Assigned to'),
 256                                                          '', true, '', 'get_assigned_user_options' );
 257  
 258              echo ' '; // allow wrapping!

 259  
 260              $ItemStatusCache = & get_Cache( 'ItemStatusCache' );
 261              $Form->select_options( 'item_st_ID', $ItemStatusCache->get_option_list( $edited_Item->pst_ID, true ),     T_('Task status') );
 262  
 263              echo ' '; // allow wrapping!

 264  
 265              $Form->date( 'item_deadline', $edited_Item->get('datedeadline'), T_('Deadline') );
 266  
 267              $Form->switch_layout( NULL );
 268              echo '</div>';
 269  
 270          $Form->end_fieldset();
 271      }
 272  
 273      // ####################### ADDITIONAL ACTIONS #########################

 274  
 275      if( isset( $Blog ) && $Blog->get('allowtrackbacks') )
 276      {
 277          $Form->begin_fieldset( T_('Additional actions'), array( 'id' => 'itemform_additional_actions' ) );
 278  
 279          // --------------------------- TRACKBACK --------------------------------------

 280          ?>
 281          <div id="itemform_trackbacks">
 282              <label for="trackback_url"><strong><?php echo T_('Trackback URLs') ?>:</strong>
 283              <span class="notes"><?php echo T_('(Separate by space)') ?></span></label><br />
 284              <input type="text" name="trackback_url" class="large form_text_input" id="trackback_url" value="<?php echo format_to_output( $trackback_url, 'formvalue' ); ?>" />
 285          </div>
 286          <?php
 287  
 288          $Form->end_fieldset();
 289      }
 290  
 291  
 292      // ####################### PLUGIN FIELDSETS #########################

 293  
 294      $Plugins->trigger_event( 'AdminDisplayItemFormFieldset', array( 'Form' => & $Form, 'Item' => & $edited_Item, 'edit_layout' => 'expert' ) );
 295      ?>
 296  
 297  </div>
 298  
 299  <div class="right_col">
 300  
 301      <?php
 302      // ################### CATEGORIES ###################

 303  
 304      $Form->begin_fieldset( T_('Categories'), array( 'class'=>'extracats', 'id' => 'itemform_categories' ) );
 305  
 306      echo cat_select();
 307  
 308      $Form->end_fieldset();
 309  
 310  
 311      // ################### VISIBILITY / SHARING ###################

 312  
 313      $Form->begin_fieldset( T_('Visibility / Sharing'), array( 'id' => 'itemform_visibility' ) );
 314  
 315      $Form->switch_layout( 'linespan' );
 316      visibility_select( $Form, $edited_Item->status );
 317      $Form->switch_layout( NULL );
 318  
 319      $Form->end_fieldset();
 320  
 321  
 322      // ################### TEXT RENDERERS ###################

 323  
 324      $Form->begin_fieldset( T_('Text Renderers'), array( 'id' => 'itemform_renderers' ) );
 325  
 326      // fp> TODO: there should be no param call here (shld be in controller)

 327      $edited_Item->renderer_checkboxes( param('renderers', 'array', NULL) );
 328  
 329      $Form->end_fieldset();
 330  
 331  
 332      // ################### COMMENT STATUS ###################

 333  
 334      if( $Blog->allowcomments == 'post_by_post' )
 335      {
 336          $Form->begin_fieldset( T_('Comments'), array( 'id' => 'itemform_comments' ) );
 337  
 338          ?>
 339              <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"'; ?> />
 340              <?php echo T_('Open') ?></label><br />
 341  
 342              <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"'; ?> />
 343              <?php echo T_('Closed') ?></label><br />
 344  
 345              <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"'; ?> />
 346              <?php echo T_('Disabled') ?></label><br />
 347          <?php
 348  
 349          $Form->end_fieldset();
 350      }
 351  
 352      ?>
 353  
 354  </div>
 355  
 356  <div class="clear"></div>
 357  
 358  <?php
 359  // ================================== END OF EDIT FORM ==================================

 360  $Form->end_form();
 361  
 362  
 363  
 364  // ####################### LINKS #########################

 365  
 366  if( ! $creating )
 367  { // Editing post
 368  
 369      require dirname(__FILE__).'/inc/_item_links.inc.php';
 370  
 371  }
 372  
 373  
 374  // ####################### JS BEHAVIORS #########################

 375  
 376  require dirname(__FILE__).'/inc/_item_form_behaviors.inc.php';
 377  
 378  
 379  /*

 380   * $Log: _item_expert.form.php,v $

 381   * Revision 1.13  2007/10/09 15:03:43  waltercruz

 382   * Minor css fix

 383   *

 384   * Revision 1.12  2007/10/08 08:32:00  fplanque

 385   * nicer forms

 386   *

 387   * Revision 1.11  2007/09/29 16:17:50  fplanque

 388   * minor

 389   *

 390   * Revision 1.10  2007/09/29 09:50:54  yabs

 391   * validation

 392   *

 393   * Revision 1.9  2007/09/22 19:23:56  fplanque

 394   * various fixes & enhancements

 395   *

 396   * Revision 1.8  2007/09/17 20:11:43  fplanque

 397   * UI improvements

 398   *

 399   * Revision 1.7  2007/09/17 20:04:40  fplanque

 400   * UI improvements

 401   *

 402   * Revision 1.6  2007/09/12 21:00:31  fplanque

 403   * UI improvements

 404   *

 405   * Revision 1.5  2007/09/04 22:16:33  fplanque

 406   * in context editing of posts

 407   *

 408   * Revision 1.4  2007/09/03 16:44:28  fplanque

 409   * chicago admin skin

 410   *

 411   * Revision 1.3  2007/07/09 19:07:44  fplanque

 412   * minor

 413   *

 414   * Revision 1.2  2007/06/30 21:23:19  fplanque

 415   * moved excerpt

 416   *

 417   * Revision 1.1  2007/06/25 11:00:29  fplanque

 418   * MODULES (refactored MVC)

 419   *

 420   * Revision 1.45  2007/05/14 02:47:23  fplanque

 421   * (not so) basic Tags framework

 422   *

 423   * Revision 1.44  2007/05/13 22:03:21  fplanque

 424   * basic excerpt support

 425   *

 426   * Revision 1.43  2007/04/26 00:11:07  fplanque

 427   * (c) 2007

 428   *

 429   * Revision 1.42  2007/04/05 22:57:33  fplanque

 430   * Added hook: UnfilterItemContents

 431   *

 432   * Revision 1.41  2007/03/25 13:19:17  fplanque

 433   * temporarily disabled dynamic and static urls.

 434   * may become permanent in favor of a caching mechanism.

 435   *

 436   * Revision 1.40  2007/03/21 02:21:37  fplanque

 437   * item controller: highlight current (step 2)

 438   *

 439   * Revision 1.39  2007/03/21 01:44:51  fplanque

 440   * item controller: better return to current filterset - step 1

 441   *

 442   * Revision 1.38  2007/03/11 23:56:02  fplanque

 443   * fixed some post editing oddities / variable cleanup (more could be done)

 444   *

 445   * Revision 1.37  2007/01/26 02:12:09  fplanque

 446   * cleaner popup windows

 447   *

 448   * Revision 1.36  2006/12/14 00:01:49  fplanque

 449   * land in correct collection when opening FM from an Item

 450   *

 451   * Revision 1.35  2006/12/12 23:23:30  fplanque

 452   * finished post editing v2.0

 453   *

 454   * Revision 1.34  2006/12/12 21:19:31  fplanque

 455   * UI fixes

 456   *

 457   * Revision 1.33  2006/12/12 02:53:57  fplanque

 458   * Activated new item/comments controllers + new editing navigation

 459   * Some things are unfinished yet. Other things may need more testing.

 460   *

 461   * Revision 1.32  2006/12/10 23:56:26  fplanque

 462   * Worfklow stuff is now hidden by default and can be enabled on a per blog basis.

 463   *

 464   * Revision 1.31  2006/12/09 01:55:36  fplanque

 465   * feel free to fill in some missing notes

 466   * hint: "login" does not need a note! :P

 467   *

 468   * Revision 1.30  2006/12/06 23:55:53  fplanque

 469   * hidden the dead body of the sidebar plugin + doc

 470   *

 471   * Revision 1.29  2006/11/29 20:48:46  blueyed

 472   * Moved url_rel_to_same_host() from _misc.funcs.php to _url.funcs.php

 473   *

 474   * Revision 1.28  2006/11/19 03:50:29  fplanque

 475   * cleaned up CSS

 476   *

 477   * Revision 1.26  2006/11/16 23:48:56  blueyed

 478   * Use div.line instead of span.line as element wrapper for XHTML validity

 479   *

 480   * Revision 1.25  2006/10/01 22:21:54  blueyed

 481   * edit_layout param fixes/doc

 482   */
 483  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics