[ 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_simple.form.php (source)

   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-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 blueyed: Daniel HAHLER

  17   *

  18   * @version $Id: _item_simple.form.php,v 1.5 2007/09/17 20:04:40 fplanque Exp $

  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 $mode, $use_post_url;
  46  global $use_preview, $post_comment_status, $trackback_url, $item_tags;
  47  global $edit_date, $bozo_start_modified, $creating;
  48  global $item_title, $item_content;
  49  global $redirect_to;
  50  
  51  // Determine if we are creating or updating...

  52  $creating = is_create_action( $action );
  53  
  54  $Form = & new Form( NULL, 'item_checkchanges', 'post' );
  55  $Form->labelstart = '<strong>';
  56  $Form->labelend = "</strong>\n";
  57  
  58  
  59  // ================================ START OF EDIT FORM ================================

  60  
  61  $params = array();
  62  if( !empty( $bozo_start_modified ) )
  63  {
  64      $params['bozo_start_modified'] = true;
  65  }
  66  $Form->begin_form( '', '', $params );
  67  
  68  $Form->hidden( 'ctrl', 'items' );
  69  $Form->hidden( 'action', $creating ? 'create' : 'update' );
  70  $Form->hidden( 'blog', $Blog->ID );
  71  if( isset( $mode ) )   $Form->hidden( 'mode', $mode ); // used by bookmarklet

  72  if( isset( $edited_Item ) )   $Form->hidden( 'post_ID', $edited_Item->ID );
  73  $Form->hidden( 'redirect_to', $redirect_to );
  74  
  75  // In case we send this to the blog for a preview :

  76  $Form->hidden( 'preview', 1 );
  77  $Form->hidden( 'more', 1 );
  78  $Form->hidden( 'preview_userid', $current_User->ID );
  79  
  80  
  81  // Fields used in "advanced" form, but not here:

  82  $Form->hidden( 'post_locale', $edited_Item->get( 'locale' ) );
  83  $Form->hidden( 'item_typ_ID', $edited_Item->ptyp_ID );
  84  $Form->hidden( 'post_url', $edited_Item->get( 'url' ) );
  85  $Form->hidden( 'post_excerpt', $edited_Item->get( 'excerpt' ) );
  86  $Form->hidden( 'post_urltitle', $edited_Item->get( 'urltitle' ) );
  87  if( $Blog->get_setting( 'use_workflow' ) )
  88  {    // We want to use workflow properties for this blog:
  89      $Form->hidden( 'item_priority', $edited_Item->priority );
  90      $Form->hidden( 'item_assigned_user_ID', $edited_Item->assigned_user_ID );
  91      $Form->hidden( 'item_st_ID', $edited_Item->pst_ID );
  92      $Form->hidden( 'item_deadline', $edited_Item->datedeadline );
  93  }
  94  $Form->hidden( 'item_tags', $item_tags );
  95  $Form->hidden( 'trackback_url', $trackback_url );
  96  $Form->hidden( 'renderers_displayed', 1 );
  97  $Form->hidden( 'renderers', $edited_Item->get_renderers_validated() );
  98  
  99  // TODO: Form::hidden() do not add, if NULL?!

 100  
 101  ?>
 102  
 103  <div class="left_col">
 104  
 105      <?php
 106      // ############################ POST CONTENTS #############################

 107  
 108      $Form->begin_fieldset( T_('Post contents').get_manual_link('post_contents_fieldset') );
 109  
 110      $Form->switch_layout( 'none' );
 111  
 112      echo '<table cellspacing="0" class="compose_layout"><tr>';
 113      echo '<td width="1%"><strong>'.T_('Title').':</strong></td>';
 114      echo '<td class="input">';
 115      $Form->text_input( 'post_title', $item_title, 20, '', '', array('maxlength'=>255, 'style'=>'width: 100%;') );
 116      echo '</td>';
 117      echo '</tr></table>';
 118  
 119      $Form->switch_layout( NULL );
 120  
 121      // --------------------------- TOOLBARS ------------------------------------

 122      echo '<div class="edit_toolbars">';
 123      // CALL PLUGINS NOW:

 124      $Plugins->trigger_event( 'AdminDisplayToolbar', array( 'target_type' => 'Item', 'edit_layout' => 'simple' ) );
 125      echo '</div>';
 126  
 127      // ---------------------------- TEXTAREA -------------------------------------

 128      $Form->fieldstart = '<div class="edit_area">';
 129      $Form->fieldend = "</div>\n";
 130      $Form->textarea_input( 'content', $item_content, 16, '', array( 'cols' => 40 , 'id' => 'itemform_post_content' ) );
 131      $Form->fieldstart = '<div class="tile">';
 132      $Form->fieldend = '</div>';
 133      ?>
 134      <script type="text/javascript" language="JavaScript">
 135          <!--
 136          // This is for toolbar plugins

 137          var b2evoCanvas = document.getElementById('itemform_post_content');
 138          //-->

 139      </script>
 140  
 141      <?php // ------------------------------- ACTIONS ----------------------------------
 142      echo '<div class="edit_actions">';
 143  
 144      if( $use_preview )
 145      { // ---------- PREVIEW ----------
 146          load_funcs( '_core/_url.funcs.php' );
 147          $url = url_same_protocol( $Blog->get( 'url' ) ); // was dynurl

 148  
 149          $Form->button( array( 'button', '', T_('Preview'), '', 'b2edit_open_preview(this.form, \''.$url.'\');' ) );
 150      }
 151  
 152      // ---------- SAVE ----------

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

 156      if( ! $creating )
 157      { // Editing post
 158          // Display delete button if current user has the rights:

 159          $edited_Item->delete_link( ' ', ' ', '#', '#', 'DeleteButton', true );
 160      }
 161  
 162      if( $Settings->get( 'fm_enabled' ) )
 163      { // ---------- UPLOAD ----------
 164          // Note: we try to land in the Blog media folder if possible

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

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

 169              echo '<input id="itemform_button_files" type="button" value="'.format_to_output(T_('Files'), 'formvalue').'" class="ActionButton"
 170                     onclick="pop_up_window( \''.url_add_param( $Blog->get_filemanager_link(), 'mode=upload' ).'\', \'fileman_upload\', 1000 )" /> ';
 171          }
 172      }
 173  
 174      // CALL PLUGINS NOW:

 175      $Plugins->trigger_event( 'AdminDisplayEditorButton', array( 'target_type' => 'Item', 'edit_layout' => 'simple' ) );
 176  
 177      echo '</div>';
 178  
 179  
 180      if( $current_User->check_perm( 'edit_timestamp' ) )
 181      { // ------------------------------------ TIME STAMP -------------------------------------
 182          echo '<div id="itemform_edit_timestamp" class="edit_fieldgroup">';
 183          $Form->switch_layout( 'linespan' );
 184  
 185          $Form->date( 'item_issue_date', $edited_Item->get('issue_date'), T_('Issue date') );
 186          echo ' '; // allow wrapping!

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

 189          if( $creating )
 190          { // If not checked, create time will be used...
 191              $Form->checkbox( 'edit_date', $edit_date, '', T_('Edit') );
 192          }
 193  
 194          $Form->switch_layout( NULL );
 195          echo '</div>';
 196      }
 197  
 198      $Form->end_fieldset();
 199  
 200  
 201      // ####################### PLUGIN FIELDSETS #########################

 202  
 203      $Plugins->trigger_event( 'AdminDisplayItemFormFieldset', array( 'Form' => & $Form, 'Item' => & $edited_Item, 'edit_layout' => 'simple' ) );
 204      ?>
 205  
 206  </div>
 207  
 208  <div class="right_col">
 209  
 210      <?php
 211      // ################### CATEGORIES ###################

 212  
 213      $Form->begin_fieldset( T_('Categories'), array( 'class'=>'extracats', 'id' => 'itemform_categories' ) );
 214  
 215      echo cat_select();
 216  
 217      $Form->end_fieldset();
 218  
 219  
 220      // ################### VISIBILITY / SHARING ###################

 221  
 222      $Form->begin_fieldset( T_('Visibility / Sharing'), array( 'id' => 'itemform_visibility' ) );
 223  
 224      $Form->switch_layout( 'linespan' );
 225      visibility_select( $Form, $edited_Item->status );
 226      $Form->switch_layout( NULL );
 227  
 228      $Form->end_fieldset();
 229  
 230  
 231      // ################### COMMENT STATUS ###################

 232  
 233      if( $Blog->allowcomments == 'post_by_post' )
 234      {
 235          $Form->begin_fieldset( T_('Comments'), array( 'id' => 'itemform_comments' ) );
 236  
 237          ?>
 238              <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"'; ?> />
 239              <?php echo T_('Open') ?></label><br />
 240  
 241              <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"'; ?> />
 242              <?php echo T_('Closed') ?></label><br />
 243  
 244              <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"'; ?> />
 245              <?php echo T_('Disabled') ?></label><br />
 246          <?php
 247  
 248          $Form->end_fieldset();
 249      }
 250  
 251      ?>
 252  
 253  </div>
 254  
 255  <div class="clear"></div>
 256  
 257  <?php
 258  // ================================== END OF EDIT FORM ==================================

 259  $Form->end_form();
 260  
 261  // ####################### JS BEHAVIORS #########################

 262  
 263  require dirname(__FILE__).'/inc/_item_form_behaviors.inc.php';
 264  
 265  /*

 266   * $Log: _item_simple.form.php,v $

 267   * Revision 1.5  2007/09/17 20:04:40  fplanque

 268   * UI improvements

 269   *

 270   * Revision 1.4  2007/09/12 21:00:31  fplanque

 271   * UI improvements

 272   *

 273   * Revision 1.3  2007/09/04 22:16:33  fplanque

 274   * in context editing of posts

 275   *

 276   * Revision 1.2  2007/09/03 16:44:28  fplanque

 277   * chicago admin skin

 278   *

 279   * Revision 1.1  2007/06/25 11:00:32  fplanque

 280   * MODULES (refactored MVC)

 281   *

 282   * Revision 1.37  2007/05/14 02:47:23  fplanque

 283   * (not so) basic Tags framework

 284   *

 285   * Revision 1.36  2007/05/13 22:03:21  fplanque

 286   * basic excerpt support

 287   *

 288   * Revision 1.35  2007/04/26 00:11:07  fplanque

 289   * (c) 2007

 290   *

 291   * Revision 1.34  2007/04/05 22:57:33  fplanque

 292   * Added hook: UnfilterItemContents

 293   *

 294   * Revision 1.33  2007/03/25 13:19:17  fplanque

 295   * temporarily disabled dynamic and static urls.

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

 297   *

 298   * Revision 1.32  2007/03/21 02:21:37  fplanque

 299   * item controller: highlight current (step 2)

 300   *

 301   * Revision 1.31  2007/03/21 01:44:51  fplanque

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

 303   *

 304   * Revision 1.30  2007/03/11 23:56:02  fplanque

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

 306   *

 307   * Revision 1.29  2007/01/26 02:12:09  fplanque

 308   * cleaner popup windows

 309   *

 310   * Revision 1.28  2006/12/14 00:01:49  fplanque

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

 312   *

 313   * Revision 1.27  2006/12/12 23:23:30  fplanque

 314   * finished post editing v2.0

 315   *

 316   * Revision 1.26  2006/12/12 21:19:31  fplanque

 317   * UI fixes

 318   *

 319   * Revision 1.25  2006/12/12 02:53:57  fplanque

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

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

 322   *

 323   * Revision 1.24  2006/12/11 00:02:25  fplanque

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

 325   *

 326   * Revision 1.23  2006/12/09 01:55:36  fplanque

 327   * feel free to fill in some missing notes

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

 329   *

 330   * Revision 1.22  2006/12/06 23:55:53  fplanque

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

 332   *

 333   * Revision 1.21  2006/11/29 20:48:46  blueyed

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

 335   *

 336   * Revision 1.20  2006/11/19 16:07:31  blueyed

 337   * Fixed saving empty renderers list. This should also fix the saving of "default" instead of the explicit renderer list

 338   *

 339   * Revision 1.19  2006/11/19 03:50:29  fplanque

 340   * cleaned up CSS

 341   *

 342   * Revision 1.17  2006/11/16 23:48:56  blueyed

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

 344   *

 345   * Revision 1.16  2006/11/16 23:10:35  blueyed

 346   * Added AdminDisplayItemFormFieldset hook also to simple form

 347   */
 348  ?>


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