[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/content/ -> versionviewframe.php (source)

   1  <?php
   2  //
   3  // Created on: <21-Nov-2004 21:58:43 hovik>
   4  //
   5  // SOFTWARE NAME: eZ publish
   6  // SOFTWARE RELEASE: 3.9.0
   7  // BUILD VERSION: 17785
   8  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
   9  // SOFTWARE LICENSE: GNU General Public License v2.0
  10  // NOTICE: >
  11  //   This program is free software; you can redistribute it and/or
  12  //   modify it under the terms of version 2.0  of the GNU General
  13  //   Public License as published by the Free Software Foundation.
  14  //
  15  //   This program is distributed in the hope that it will be useful,
  16  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18  //   GNU General Public License for more details.
  19  //
  20  //   You should have received a copy of version 2.0 of the GNU General
  21  //   Public License along with this program; if not, write to the Free
  22  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23  //   MA 02110-1301, USA.
  24  //
  25  //
  26  
  27  /*! \file versionviewframe.php
  28  */
  29  
  30  /* Module action checks */
  31  if ( $Module->isCurrentAction( 'Edit' ) and
  32       $versionObject->attribute( 'status' ) == EZ_VERSION_STATUS_DRAFT and
  33       $contentObject->attribute( 'can_edit' ) and
  34       $isCreator )
  35  {
  36      return $Module->redirectToView( 'edit', array( $ObjectID, $EditVersion, $LanguageCode ) );
  37  }
  38  
  39  // If we have an archived version editing we cannot edit the version directly.
  40  // Instead we redirect to the edit page without a version, this will create
  41  // a new version for us and start the edit operation
  42  if ( $Module->isCurrentAction( 'Edit' ) and
  43       $contentObject->attribute( 'status' ) == EZ_CONTENT_OBJECT_STATUS_ARCHIVED and
  44       $contentObject->attribute( 'can_edit' ) )
  45  {
  46      return $Module->redirectToView( 'edit', array( $ObjectID, false, $LanguageCode, $FromLanguage ) );
  47  }
  48  
  49  if ( $Module->isCurrentAction( 'Publish' ) and
  50       $versionObject->attribute( 'status' ) == EZ_VERSION_STATUS_DRAFT and
  51       $contentObject->attribute( 'can_edit' ) and
  52       $isCreator )
  53  {
  54      $user =& eZUser::currentUser();
  55      include_once ( 'lib/ezutils/classes/ezoperationhandler.php' );
  56      $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $ObjectID,
  57                                                                                   'version' => $EditVersion ) );
  58      $object = eZContentObject::fetch( $ObjectID );
  59      $http =& eZHttpTool::instance();
  60      if ( $object->attribute( 'main_node_id' ) != null )
  61      {
  62          if ( $http->hasSessionVariable( 'ParentObject' ) && $http->sessionVariable( 'NewObjectID' ) == $object->attribute( 'id' ) )
  63          {
  64              $parentArray = $http->sessionVariable( 'ParentObject' );
  65              $parentURL = $Module->redirectionURI( 'content', 'edit', $parentArray );
  66              $parentObject = eZContentObject::fetch( $parentArray[0] );
  67              $parentObject->addContentObjectRelation( $object->attribute( 'id' ), $parentArray[1] );
  68              $http->removeSessionVariable( 'ParentObject' );
  69              $http->removeSessionVariable( 'NewObjectID' );
  70              $Module->redirectTo( $parentURL );
  71          }
  72          else
  73          {
  74              $Module->redirectToView( 'view', array( 'full', $object->attribute( 'main_parent_node_id' ) ) );
  75          }
  76      }
  77      else
  78      {
  79          $Module->redirectToView( 'view', array( 'sitemap', 2 ) );
  80      }
  81  
  82      return;
  83  }
  84  
  85  $ini =& eZINI::instance();
  86  
  87  $siteaccess = $ini->variable( 'SiteSettings', 'DefaultAccess' );
  88  if ( $Module->hasActionParameter( 'SiteAccess' ) )
  89  {
  90      $siteaccess = $Module->actionParameter( 'SiteAccess' );
  91  }
  92  
  93  if ( $LanguageCode )
  94  {
  95      $oldLanguageCode = $node->currentLanguage();
  96      $oldObjectLanguageCode = $contentObject->currentLanguage();
  97      $node->setCurrentLanguage( $LanguageCode );
  98      $contentObject->setCurrentLanguage( $LanguageCode );
  99  }
 100  $tpl->setVariable( 'site_access_list', $ini->variable( 'SiteAccessSettings', 'AvailableSiteAccessList' ) );
 101  $tpl->setVariable( 'node', $node );
 102  $tpl->setVariable( 'object', $contentObject );
 103  $tpl->setVariable( 'version', $versionObject );
 104  $tpl->setVariable( 'language', $LanguageCode );
 105  $tpl->setVariable( 'object_languagecode', $LanguageCode );
 106  $tpl->setVariable( 'siteaccess', $siteaccess );
 107  $tpl->setVariable( 'is_creator', $isCreator );
 108  $tpl->setVariable( 'from_language', $FromLanguage );
 109  
 110  $Result = array();
 111  $Result['content'] =& $tpl->fetch( 'design:content/view/versionview.tpl' );
 112  $Result['node_id'] =& $node->attribute( 'node_id' );
 113  $Result['path'] = array( array( 'text' => ezi18n( 'kernel/content', 'Version preview' ),
 114                                  'url' => false ) );
 115  
 116  if ( $LanguageCode )
 117  {
 118      $node->setCurrentLanguage( $oldLanguageCode );
 119      $contentObject->setCurrentLanguage( $oldObjectLanguageCode );
 120  }
 121  
 122  return $Result;
 123  
 124  
 125  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7