PageRenderTime 61ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/kernel/content/action.php

https://github.com/aurelienRT1/ezpublish
PHP | 1534 lines | 1306 code | 150 blank | 78 comment | 277 complexity | 02de36a0d479acbe5efdcc346794b6b4 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. //
  3. // Created on: <04-Jul-2002 13:06:30 bf>
  4. //
  5. // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
  6. // SOFTWARE NAME: eZ Publish
  7. // SOFTWARE RELEASE: 4.1.x
  8. // COPYRIGHT NOTICE: Copyright (C) 1999-2010 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. // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
  27. //
  28. $http = eZHTTPTool::instance();
  29. $module = $Params['Module'];
  30. /* We retrieve the class ID for users as this is used in many places in this
  31. * code in order to be able to cleanup the user-policy cache. */
  32. $userClassIDArray = eZUser::contentClassIDs();
  33. if ( $module->hasActionParameter( 'LanguageCode' ) )
  34. $languageCode = $module->actionParameter( 'LanguageCode' );
  35. else
  36. {
  37. $languageCode = false;
  38. }
  39. $viewMode = 'full';
  40. if ( $module->hasActionParameter( 'ViewMode' ) )
  41. $viewMode = $module->actionParameter( 'ViewMode' );
  42. if ( $http->hasPostVariable( 'BrowseCancelButton' ) || $http->hasPostVariable( 'CancelButton' ) )
  43. {
  44. if ( $http->hasPostVariable( 'BrowseCancelURI' ) )
  45. {
  46. return $module->redirectTo( $http->postVariable( 'BrowseCancelURI' ) );
  47. }
  48. else if ( $http->hasPostVariable( 'CancelURI' ) )
  49. {
  50. return $module->redirectTo( $http->postVariable( 'CancelURI' ) );
  51. }
  52. }
  53. // Merge post variables and variables that were used before login
  54. if ( $http->hasSessionVariable( 'LastPostVars' ) )
  55. {
  56. $post = $http->attribute( 'post' );
  57. $currentPostVarNames = array_keys( $post );
  58. foreach ( $http->sessionVariable( 'LastPostVars' ) as $var => $value )
  59. {
  60. if ( !in_array( $var, $currentPostVarNames ) )
  61. {
  62. $http->setPostVariable( $var, $value );
  63. }
  64. }
  65. $http->removeSessionVariable( 'LastPostVars' );
  66. }
  67. if ( $http->hasPostVariable( 'NewButton' ) || $module->isCurrentAction( 'NewObjectAddNodeAssignment' ) )
  68. {
  69. $hasClassInformation = false;
  70. $contentClassID = false;
  71. $contentClassIdentifier = false;
  72. $languageCode = false;
  73. $class = false;
  74. if ( $http->hasPostVariable( 'ClassID' ) )
  75. {
  76. $contentClassID = $http->postVariable( 'ClassID' );
  77. if ( $contentClassID )
  78. $hasClassInformation = true;
  79. }
  80. else if ( $http->hasPostVariable( 'ClassIdentifier' ) )
  81. {
  82. $contentClassIdentifier = $http->postVariable( 'ClassIdentifier' );
  83. $class = eZContentClass::fetchByIdentifier( $contentClassIdentifier );
  84. if ( is_object( $class ) )
  85. {
  86. $contentClassID = $class->attribute( 'id' );
  87. if ( $contentClassID )
  88. $hasClassInformation = true;
  89. }
  90. }
  91. if ( $http->hasPostVariable( 'ContentLanguageCode' ) )
  92. {
  93. $languageCode = $http->postVariable( 'ContentLanguageCode' );
  94. $languageID = eZContentLanguage::idByLocale( $languageCode );
  95. if ( $languageID === false )
  96. {
  97. eZDebug::writeError( "The language code [$languageCode] specified in ContentLanguageCode does not exist in the system." );
  98. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
  99. }
  100. }
  101. else
  102. {
  103. $allLanguages = eZContentLanguage::prioritizedLanguages();
  104. // Only show language selection if there are more than 1 languages.
  105. if ( count( $allLanguages ) > 1 &&
  106. $hasClassInformation )
  107. {
  108. $tpl = eZTemplate::factory();
  109. $tpl->setVariable( 'node_id', $http->postVariable( 'NodeID' ) );
  110. $tpl->setVariable( 'class_id', $contentClassID );
  111. $tpl->setVariable( 'assignment_remote_id', $http->postVariable( 'AssignmentRemoteID', false ) );
  112. $tpl->setVariable( 'redirect_uri_after_publish', $http->postVariable( 'RedirectURIAfterPublish', false ) );
  113. $tpl->setVariable( 'redirect_uri_after_discard', $http->postVariable( 'RedirectIfDiscarded', false ) );
  114. $Result = array();
  115. $Result['content'] = $tpl->fetch( 'design:content/create_languages.tpl' );
  116. return $Result;
  117. }
  118. }
  119. if ( ( $hasClassInformation && $http->hasPostVariable( 'NodeID' ) ) || $module->isCurrentAction( 'NewObjectAddNodeAssignment' ) )
  120. {
  121. if ( $module->isCurrentAction( 'NewObjectAddNodeAssignment' ) )
  122. {
  123. $selectedNodeIDArray = eZContentBrowse::result( 'NewObjectAddNodeAssignment' );
  124. if ( count( $selectedNodeIDArray ) == 0 )
  125. return $module->redirectToView( 'view', array( 'full', 2 ) );
  126. $node = eZContentObjectTreeNode::fetch( $selectedNodeIDArray[0] );
  127. }
  128. else
  129. {
  130. $node = eZContentObjectTreeNode::fetch( $http->postVariable( 'NodeID' ) );
  131. }
  132. if ( is_object( $node ) )
  133. {
  134. $contentObject = eZContentObject::createWithNodeAssignment( $node,
  135. $contentClassID,
  136. $languageCode,
  137. $http->postVariable( 'AssignmentRemoteID', false ) );
  138. if ( $contentObject )
  139. {
  140. if ( $http->hasPostVariable( 'RedirectURIAfterPublish' ) )
  141. {
  142. $http->setSessionVariable( 'RedirectURIAfterPublish', $http->postVariable( 'RedirectURIAfterPublish' ) );
  143. }
  144. if ( $http->hasPostVariable( 'RedirectIfDiscarded' ) )
  145. {
  146. $http->setSessionVariable( 'RedirectIfDiscarded', $http->postVariable( 'RedirectIfDiscarded' ) );
  147. }
  148. $module->redirectTo( $module->functionURI( 'edit' ) . '/' . $contentObject->attribute( 'id' ) . '/' . $contentObject->attribute( 'current_version' ) );
  149. return;
  150. }
  151. else
  152. {
  153. // If ACCESS DENIED save current post variables for using after login
  154. $http->setSessionVariable( '$_POST_BeforeLogin', $http->attribute( 'post' ) );
  155. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel' );
  156. }
  157. }
  158. else
  159. {
  160. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
  161. }
  162. }
  163. else if ( $hasClassInformation )
  164. {
  165. if ( !is_object( $class ) )
  166. $class = eZContentClass::fetch( $contentClassID );
  167. eZContentBrowse::browse( array( 'action_name' => 'NewObjectAddNodeAssignment',
  168. 'description_template' => 'design:content/browse_first_placement.tpl',
  169. 'keys' => array( 'class' => $class->attribute( 'id' ),
  170. 'classgroup' => $class->attribute( 'ingroup_id_list' ) ),
  171. 'persistent_data' => array( 'ClassID' => $class->attribute( 'id' ), 'ContentLanguageCode' => $languageCode ),
  172. 'content' => array( 'class_id' => $class->attribute( 'id' ) ),
  173. 'cancel_page' => $module->redirectionURIForModule( $module, 'view', array( 'full', 2 ) ),
  174. 'from_page' => "/content/action" ),
  175. $module );
  176. }
  177. }
  178. else if ( $http->hasPostVariable( 'SetSorting' ) &&
  179. $http->hasPostVariable( 'ContentObjectID' ) && $http->hasPostVariable( 'ContentNodeID' ) &&
  180. $http->hasPostVariable( 'SortingField' ) && $http->hasPostVariable( 'SortingOrder' ) )
  181. {
  182. $nodeID = $http->postVariable( 'ContentNodeID' );
  183. $contentObjectID = $http->postVariable( 'ContentObjectID' );
  184. $sortingField = $http->postVariable( 'SortingField' );
  185. $sortingOrder = $http->postVariable( 'SortingOrder' );
  186. $node = eZContentObjectTreeNode::fetch( $nodeID );
  187. $contentObject = eZContentObject::fetch( $contentObjectID );
  188. if ( eZOperationHandler::operationIsAvailable( 'content_sort' ) )
  189. {
  190. $operationResult = eZOperationHandler::execute( 'content', 'sort',
  191. array( 'node_id' => $nodeID,
  192. 'sorting_field' => $sortingField,
  193. 'sorting_order' => $sortingOrder ), null, true );
  194. }
  195. else
  196. {
  197. eZContentOperationCollection::changeSortOrder( $nodeID, $sortingField, $sortingOrder );
  198. }
  199. if ( $http->hasPostVariable( 'RedirectURIAfterSorting' ) )
  200. {
  201. return $module->redirectTo( $http->postVariable( 'RedirectURIAfterSorting' ) );
  202. }
  203. return $module->redirectToView( 'view', array( 'full', $nodeID, $languageCode ) );
  204. }
  205. else if ( $module->isCurrentAction( 'MoveNode' ) )
  206. {
  207. /* This action is used through the admin interface with the "Move" button,
  208. * or in the pop-up menu and will move a node to a different location. */
  209. if ( !$module->hasActionParameter( 'NodeID' ) )
  210. {
  211. eZDebug::writeError( "Missing NodeID parameter for action " . $module->currentAction(),
  212. 'content/action' );
  213. return $module->redirectToView( 'view', array( 'full', 2 ) );
  214. }
  215. if ( $module->hasActionParameter( 'NewParentNode' ) )
  216. {
  217. $selectedNodeID = $module->actionParameter( 'NewParentNode' );
  218. }
  219. else
  220. {
  221. $selectedNodeIDArray = eZContentBrowse::result( 'MoveNode' );
  222. $selectedNodeID = $selectedNodeIDArray[0];
  223. }
  224. $selectedNode = eZContentObjectTreeNode::fetch( $selectedNodeID );
  225. if ( !$selectedNode )
  226. {
  227. eZDebug::writeWarning( "Content node with ID $selectedNodeID does not exist, cannot use that as parent node for node $nodeID",
  228. 'content/action' );
  229. return $module->redirectToView( 'view', array( 'full', 2 ) );
  230. }
  231. $nodeIDlist = $module->actionParameter( 'NodeID' );
  232. if ( strpos( $nodeIDlist, ',' ) !== false )
  233. {
  234. $nodeIDlist = explode( ',', $nodeIDlist );
  235. }
  236. else
  237. {
  238. $nodeIDlist = array( $nodeIDlist );
  239. }
  240. // Check that all user has access to move all selected nodes
  241. $nodeToMoveList = array();
  242. foreach( $nodeIDlist as $key => $nodeID )
  243. {
  244. $node = eZContentObjectTreeNode::fetch( $nodeID );
  245. if ( !$node )
  246. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  247. if ( !$node->canMoveFrom() )
  248. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel', array() );
  249. $object = $node->object();
  250. if ( !$object )
  251. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  252. $nodeToMoveList[] = array( 'node_id' => $nodeID,
  253. 'object_id' => $object->attribute( 'id' ) );
  254. $class = $object->contentClass();
  255. $classID = $class->attribute( 'id' );
  256. // check if the object can be moved to (under) the selected node
  257. if ( !$selectedNode->canMoveTo( $classID ) )
  258. {
  259. eZDebug::writeError( "Cannot move node $nodeID as child of parent node $selectedNodeID, the current user does not have create permission for class ID $classID",
  260. 'content/action' );
  261. return $module->redirectToView( 'view', array( 'full', 2 ) );
  262. }
  263. // Check if we try to move the node as child of itself or one of its children
  264. if ( in_array( $node->attribute( 'node_id' ), $selectedNode->pathArray() ) )
  265. {
  266. eZDebug::writeError( "Cannot move node $nodeID as child of itself or one of its own children (node $selectedNodeID).",
  267. 'content/action' );
  268. return $module->redirectToView( 'view', array( 'full', $node->attribute( 'node_id' ) ) );
  269. }
  270. }
  271. // move selected nodes, this should probably be inside a transaction
  272. foreach( $nodeToMoveList as $nodeToMove )
  273. {
  274. if ( eZOperationHandler::operationIsAvailable( 'content_move' ) )
  275. {
  276. $operationResult = eZOperationHandler::execute( 'content',
  277. 'move', array( 'node_id' => $nodeToMove['node_id'],
  278. 'object_id' => $nodeToMove['object_id'],
  279. 'new_parent_node_id' => $selectedNodeID ),
  280. null,
  281. true );
  282. }
  283. else
  284. {
  285. eZContentOperationCollection::moveNode( $nodeToMove['node_id'], $nodeToMove['object_id'], $selectedNodeID );
  286. }
  287. }
  288. return $module->redirectToView( 'view', array( $viewMode, $selectedNodeID, $languageCode ) );
  289. }
  290. else if ( $module->isCurrentAction( 'MoveNodeRequest' ) )
  291. {
  292. /* This action is started through the pop-up menu when a "Move" is
  293. * requested and through the use of the "Move" button. It will start the
  294. * browser to select where the node should be moved to. */
  295. if ( !$module->hasActionParameter( 'NodeID' ) )
  296. {
  297. eZDebug::writeError( "Missing NodeID parameter for action " . $module->currentAction(),
  298. 'content/action' );
  299. return $module->redirectToView( 'view', array( 'full', 2 ) );
  300. }
  301. $nodeID = $module->actionParameter( 'NodeID' );
  302. $node = eZContentObjectTreeNode::fetch( $nodeID );
  303. if ( !$node )
  304. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  305. if ( !$node->canMoveFrom() )
  306. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel', array() );
  307. $object = $node->object();
  308. if ( !$object )
  309. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  310. $objectID = $object->attribute( 'id' );
  311. $class = $object->contentClass();
  312. $ignoreNodesSelect = array();
  313. $ignoreNodesSelectSubtree = array();
  314. $ignoreNodesClick = array();
  315. $publishedAssigned = $object->assignedNodes( false );
  316. foreach ( $publishedAssigned as $element )
  317. {
  318. $ignoreNodesSelect[] = $element['node_id'];
  319. $ignoreNodesSelectSubtree[] = $element['node_id'];
  320. $ignoreNodesClick[] = $element['node_id'];
  321. $ignoreNodesSelect[] = $element['parent_node_id'];
  322. }
  323. $ignoreNodesSelect = array_unique( $ignoreNodesSelect );
  324. $ignoreNodesSelectSubtree = array_unique( $ignoreNodesSelectSubtree );
  325. $ignoreNodesClick = array_unique( $ignoreNodesClick );
  326. eZContentBrowse::browse( array( 'action_name' => 'MoveNode',
  327. 'description_template' => 'design:content/browse_move_node.tpl',
  328. 'keys' => array( 'class' => $class->attribute( 'id' ),
  329. 'class_id' => $class->attribute( 'identifier' ),
  330. 'classgroup' => $class->attribute( 'ingroup_id_list' ),
  331. 'section' => $object->attribute( 'section_id' ) ),
  332. 'ignore_nodes_select' => $ignoreNodesSelect,
  333. 'ignore_nodes_select_subtree' => $ignoreNodesSelectSubtree,
  334. 'ignore_nodes_click' => $ignoreNodesClick,
  335. 'persistent_data' => array( 'ContentNodeID' => $nodeID,
  336. 'ViewMode' => $viewMode,
  337. 'ContentObjectLanguageCode' => $languageCode,
  338. 'MoveNodeAction' => '1' ),
  339. 'permission' => array( 'access' => 'create',
  340. 'contentclass_id' => $class->attribute( 'id' ) ),
  341. 'content' => array( 'object_id' => $objectID,
  342. 'object_version' => $object->attribute( 'current_version' ),
  343. 'object_language' => $languageCode ),
  344. 'start_node' => $node->attribute( 'parent_node_id' ),
  345. 'cancel_page' => $module->redirectionURIForModule( $module, 'view', array( $viewMode, $nodeID, $languageCode ) ),
  346. 'from_page' => "/content/action" ),
  347. $module );
  348. return;
  349. }
  350. else if ( $module->isCurrentAction( 'SwapNode' ) )
  351. {
  352. if ( !$module->hasActionParameter( 'NodeID' ) )
  353. {
  354. eZDebug::writeError( "Missing NodeID parameter for action " . $module->currentAction(),
  355. 'content/action' );
  356. return $module->redirectToView( 'view', array( 'full', 2 ) );
  357. }
  358. $nodeID = $module->actionParameter( 'NodeID' );
  359. $node = eZContentObjectTreeNode::fetch( $nodeID );
  360. if ( !$node )
  361. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  362. if ( !$node->canSwap() )
  363. {
  364. eZDebug::writeError( "Cannot swap node $nodeID (no edit permission)" );
  365. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel', array() );
  366. }
  367. $nodeParentNodeID = $node->attribute( 'parent_node_id' );
  368. $object = $node->object();
  369. if ( !$object )
  370. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  371. $objectID = $object->attribute( 'id' );
  372. $objectVersion = $object->attribute( 'current_version' );
  373. if ( $module->hasActionParameter( 'NewNode' ) )
  374. {
  375. $selectedNodeID = $module->actionParameter( 'NewNode' );
  376. }
  377. else
  378. {
  379. $selectedNodeIDArray = eZContentBrowse::result( 'SwapNode' );
  380. $selectedNodeID = $selectedNodeIDArray[0];
  381. }
  382. $selectedNode = eZContentObjectTreeNode::fetch( $selectedNodeID );
  383. if ( !$selectedNode )
  384. {
  385. eZDebug::writeWarning( "Content node with ID $selectedNodeID does not exist, cannot use that as exchanging node for node $nodeID",
  386. 'content/action' );
  387. return $module->redirectToView( 'view', array( 'full', 2 ) );
  388. }
  389. if ( !$selectedNode->canSwap() )
  390. {
  391. eZDebug::writeError( "Cannot use node $selectedNodeID as the exchanging node for $nodeID, the current user does not have edit permission for it",
  392. 'content/action' );
  393. return $module->redirectToView( 'view', array( 'full', 2 ) );
  394. }
  395. // clear cache.
  396. eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
  397. $selectedObject = $selectedNode->object();
  398. $selectedObjectID = $selectedObject->attribute( 'id' );
  399. $selectedObjectVersion = $selectedObject->attribute( 'current_version' );
  400. $selectedNodeParentNodeID = $selectedNode->attribute( 'parent_node_id' );
  401. /* In order to swap node1 and node2 a user should have the following permissions:
  402. * 1. move_from: move node1
  403. * 2. move_from: move node2
  404. * 3. move_to: move an object of the same class as node2 under parent of node1
  405. * 4. move_to: move an object of the same class as node1 under parent of node2
  406. *
  407. * The First two has already been checked. Let's check the rest.
  408. */
  409. $nodeParent = $node->attribute( 'parent' );
  410. $selectedNodeParent = $selectedNode->attribute( 'parent' );
  411. $objectClassID = $object->attribute( 'contentclass_id' );
  412. $selectedObjectClassID = $selectedObject->attribute( 'contentclass_id' );
  413. if ( !$nodeParent || !$selectedNodeParent )
  414. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  415. if ( !$nodeParent->canMoveTo( $selectedObjectClassID ) )
  416. {
  417. eZDebug::writeError( "Cannot move an object of class $selectedObjectClassID to node $nodeParentNodeID (no create permission)" );
  418. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel', array() );
  419. }
  420. if ( !$selectedNodeParent->canMoveTo( $objectClassID ) )
  421. {
  422. eZDebug::writeError( "Cannot move an object of class $objectClassID to node $selectedNodeParentNodeID (no create permission)" );
  423. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel', array() );
  424. }
  425. // exchange contentobject ids and versions.
  426. if ( eZOperationHandler::operationIsAvailable( 'content_swap' ) )
  427. {
  428. $operationResult = eZOperationHandler::execute( 'content',
  429. 'swap',
  430. array( 'node_id' => $nodeID,
  431. 'selected_node_id' => $selectedNodeID,
  432. 'node_id_list' => array( $nodeID, $selectedNodeID ) ),
  433. null,
  434. true );
  435. }
  436. else
  437. {
  438. eZContentOperationCollection::swapNode( $nodeID, $selectedNodeID, array( $nodeID, $selectedNodeID ) );
  439. }
  440. return $module->redirectToView( 'view', array( $viewMode, $nodeID, $languageCode ) );
  441. }
  442. else if ( $module->isCurrentAction( 'SwapNodeRequest' ) )
  443. {
  444. /* This action brings a browse screen up to select with which the selected
  445. * node should be swapped. It will not actually move the nodes. */
  446. if ( !$module->hasActionParameter( 'NodeID' ) )
  447. {
  448. eZDebug::writeError( "Missing NodeID parameter for action " . $module->currentAction(),
  449. 'content/action' );
  450. return $module->redirectToView( 'view', array( 'full', 2 ) );
  451. }
  452. $nodeID = $module->actionParameter( 'NodeID' );
  453. $node = eZContentObjectTreeNode::fetch( $nodeID );
  454. if ( !$node )
  455. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  456. if ( !$node->canSwap() )
  457. {
  458. eZDebug::writeError( "Cannot swap node $nodeID (no edit permission)" );
  459. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel', array() );
  460. }
  461. $object = $node->object();
  462. if ( !$object )
  463. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  464. $objectID = $object->attribute( 'id' );
  465. $class = $object->contentClass();
  466. $ignoreNodesSelect = array( $nodeID );
  467. $ignoreNodesClick = array();
  468. eZContentBrowse::browse( array( 'action_name' => 'SwapNode',
  469. 'description_template' => 'design:content/browse_swap_node.tpl',
  470. 'keys' => array( 'class' => $class->attribute( 'id' ),
  471. 'class_id' => $class->attribute( 'identifier' ),
  472. 'classgroup' => $class->attribute( 'ingroup_id_list' ),
  473. 'section' => $object->attribute( 'section_id' ) ),
  474. 'ignore_nodes_select' => $ignoreNodesSelect,
  475. 'ignore_nodes_click' => $ignoreNodesClick,
  476. 'persistent_data' => array( 'ContentNodeID' => $nodeID,
  477. 'ViewMode' => $viewMode,
  478. 'ContentObjectLanguageCode' => $languageCode,
  479. 'SwapNodeAction' => '1' ),
  480. 'permission' => array( 'access' => 'edit',
  481. 'contentclass_id' => $class->attribute( 'id' ) ),
  482. 'content' => array( 'object_id' => $objectID,
  483. 'object_version' => $object->attribute( 'current_version' ),
  484. 'object_language' => $languageCode ),
  485. 'start_node' => $node->attribute( 'parent_node_id' ),
  486. 'cancel_page' => $module->redirectionURIForModule( $module, 'view', array( $viewMode, $nodeID, $languageCode ) ),
  487. 'from_page' => "/content/action" ),
  488. $module );
  489. return;
  490. }
  491. else if ( $module->isCurrentAction( 'UpdateMainAssignment' ) )
  492. {
  493. /* This action selects a different main assignment node for the object. */
  494. if ( !$module->hasActionParameter( 'ObjectID' ) )
  495. {
  496. eZDebug::writeError( "Missing ObjectID parameter for action " . $module->currentAction(),
  497. 'content/action' );
  498. return $module->redirectToView( 'view', array( 'full', 2 ) );
  499. }
  500. if ( !$module->hasActionParameter( 'NodeID' ) )
  501. {
  502. eZDebug::writeError( "Missing NodeID parameter for action " . $module->currentAction(),
  503. 'content/action' );
  504. return $module->redirectToView( 'view', array( 'full', 2 ) );
  505. }
  506. $objectID = $module->actionParameter( 'ObjectID' );
  507. $nodeID = $module->actionParameter( 'NodeID' );
  508. if ( $module->hasActionParameter( 'MainAssignmentID' ) )
  509. {
  510. $mainAssignmentID = $module->actionParameter( 'MainAssignmentID' );
  511. $object = eZContentObject::fetch( $objectID );
  512. if ( !$object )
  513. {
  514. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
  515. }
  516. $existingMainNodeID = false;
  517. $existingMainNode = $object->attribute( 'main_node' );
  518. if ( $existingMainNode )
  519. $existingMainNodeID = $existingMainNode->attribute( 'node_id' );
  520. if ( $existingMainNodeID === false or
  521. $existingMainNodeID != $mainAssignmentID )
  522. {
  523. if ( $existingMainNode and
  524. !$existingMainNode->checkAccess( 'edit' ) )
  525. {
  526. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel', array() );
  527. }
  528. $newMainNode = eZContentObjectTreeNode::fetch( $mainAssignmentID );
  529. if ( !$newMainNode )
  530. {
  531. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
  532. }
  533. if ( !$newMainNode->checkAccess( 'edit' ) )
  534. {
  535. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel' );
  536. }
  537. $mainAssignmentParentID = $newMainNode->attribute( 'parent_node_id' );
  538. if ( eZOperationHandler::operationIsAvailable( 'content_updatemainassignment' ) )
  539. {
  540. $operationResult = eZOperationHandler::execute( 'content',
  541. 'updatemainassignment', array( 'main_assignment_id' => $mainAssignmentID,
  542. 'object_id' => $objectID,
  543. 'main_assignment_parent_id' => $mainAssignmentParentID ),null, true );
  544. }
  545. else
  546. {
  547. eZContentOperationCollection::UpdateMainAssignment( $mainAssignmentID, $objectID, $newMainNode->attribute( 'parent_node_id' ) );
  548. }
  549. }
  550. }
  551. else
  552. {
  553. eZDebug::writeError( "No MainAssignmentID found for action " . $module->currentAction(),
  554. 'content/action' );
  555. }
  556. return $module->redirectToView( 'view', array( $viewMode, $nodeID, $languageCode ) );
  557. }
  558. else if ( $module->isCurrentAction( 'AddAssignment' ) or
  559. $module->isCurrentAction( 'SelectAssignmentLocation' ) )
  560. {
  561. if ( !$module->hasActionParameter( 'ObjectID' ) )
  562. {
  563. eZDebug::writeError( "Missing ObjectID parameter for action " . $module->currentAction(),
  564. 'content/action' );
  565. return $module->redirectToView( 'view', array( 'full', 2 ) );
  566. }
  567. if ( !$module->hasActionParameter( 'NodeID' ) )
  568. {
  569. eZDebug::writeError( "Missing NodeID parameter for action " . $module->currentAction(),
  570. 'content/action' );
  571. return $module->redirectToView( 'view', array( 'full', 2 ) );
  572. }
  573. $objectID = $module->actionParameter( 'ObjectID' );
  574. $nodeID = $module->actionParameter( 'NodeID' );
  575. $object = eZContentObject::fetch( $objectID );
  576. if ( !$object )
  577. {
  578. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
  579. }
  580. $user = eZUser::currentUser();
  581. if ( !$object->checkAccess( 'edit' ) &&
  582. !$user->attribute( 'has_manage_locations' ) )
  583. {
  584. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel' );
  585. }
  586. $existingNode = eZContentObjectTreeNode::fetch( $nodeID );
  587. if ( !$existingNode )
  588. {
  589. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
  590. }
  591. $class = $object->contentClass();
  592. if ( $module->isCurrentAction( 'AddAssignment' ) )
  593. {
  594. $selectedNodeIDArray = eZContentBrowse::result( 'AddNodeAssignment' );
  595. if ( !is_array( $selectedNodeIDArray ) )
  596. $selectedNodeIDArray = array();
  597. if ( eZOperationHandler::operationIsAvailable( 'content_addlocation' ) )
  598. {
  599. $operationResult = eZOperationHandler::execute( 'content',
  600. 'addlocation', array( 'node_id' => $nodeID,
  601. 'object_id' => $objectID,
  602. 'select_node_id_array' => $selectedNodeIDArray ),
  603. null,
  604. true );
  605. }
  606. else
  607. {
  608. eZContentOperationCollection::addAssignment( $nodeID, $objectID, $selectedNodeIDArray );
  609. }
  610. }
  611. else if ( $module->isCurrentAction( 'SelectAssignmentLocation' ) )
  612. {
  613. $ignoreNodesSelect = array();
  614. $ignoreNodesClick = array();
  615. $assigned = eZNodeAssignment::fetchForObject( $objectID, $object->attribute( 'current_version' ), 0, false );
  616. $publishedAssigned = $object->assignedNodes( false );
  617. $isTopLevel = false;
  618. foreach ( $publishedAssigned as $element )
  619. {
  620. $append = false;
  621. if ( $element['parent_node_id'] == 1 )
  622. $isTopLevel = true;
  623. foreach ( $assigned as $ass )
  624. {
  625. if ( $ass['parent_node'] == $element['parent_node_id'] )
  626. {
  627. $append = true;
  628. break;
  629. }
  630. }
  631. if ( $append )
  632. {
  633. $ignoreNodesSelect[] = $element['node_id'];
  634. $ignoreNodesClick[] = $element['node_id'];
  635. $ignoreNodesSelect[] = $element['parent_node_id'];
  636. }
  637. }
  638. if ( !$isTopLevel )
  639. {
  640. $ignoreNodesSelect = array_unique( $ignoreNodesSelect );
  641. $objectID = $object->attribute( 'id' );
  642. eZContentBrowse::browse( array( 'action_name' => 'AddNodeAssignment',
  643. 'description_template' => 'design:content/browse_placement.tpl',
  644. 'keys' => array( 'class' => $class->attribute( 'id' ),
  645. 'class_id' => $class->attribute( 'identifier' ),
  646. 'classgroup' => $class->attribute( 'ingroup_id_list' ),
  647. 'section' => $object->attribute( 'section_id' ) ),
  648. 'ignore_nodes_select' => $ignoreNodesSelect,
  649. 'ignore_nodes_click' => $ignoreNodesClick,
  650. 'persistent_data' => array( 'ContentNodeID' => $nodeID,
  651. 'ContentObjectID' => $objectID,
  652. 'ViewMode' => $viewMode,
  653. 'ContentObjectLanguageCode' => $languageCode,
  654. 'AddAssignmentAction' => '1' ),
  655. 'content' => array( 'object_id' => $objectID,
  656. 'object_version' => $object->attribute( 'current_version' ),
  657. 'object_language' => $languageCode ),
  658. 'cancel_page' => $module->redirectionURIForModule( $module, 'view', array( $viewMode, $nodeID, $languageCode ) ),
  659. 'from_page' => "/content/action" ),
  660. $module );
  661. return;
  662. }
  663. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel' );
  664. }
  665. return $module->redirectToView( 'view', array( $viewMode, $nodeID, $languageCode ) );
  666. }
  667. else if ( $module->isCurrentAction( 'RemoveAssignment' ) )
  668. {
  669. if ( !$module->hasActionParameter( 'ObjectID' ) )
  670. {
  671. eZDebug::writeError( "Missing ObjectID parameter for action RemoveAssignment",
  672. 'content/action' );
  673. return $module->redirectToView( 'view', array( 'full', 2 ) );
  674. }
  675. if ( !$module->hasActionParameter( 'NodeID' ) )
  676. {
  677. eZDebug::writeError( "Missing NodeID parameter for action RemoveAssignment",
  678. 'content/action' );
  679. return $module->redirectToView( 'view', array( 'full', 2 ) );
  680. }
  681. $objectID = $module->actionParameter( 'ObjectID' );
  682. $nodeID = $module->actionParameter( 'NodeID' );
  683. $redirectNodeID = $nodeID;
  684. $object = eZContentObject::fetch( $objectID );
  685. if ( !$object )
  686. {
  687. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
  688. }
  689. $user = eZUser::currentUser();
  690. if ( !$object->checkAccess( 'edit' ) &&
  691. !$user->hasManageLocations() )
  692. {
  693. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel' );
  694. }
  695. if ( $module->hasActionParameter( 'AssignmentIDSelection' ) )
  696. {
  697. eZDebug::writeError( "Use of POST variable 'AssignmentIDSelection' is deprecated, use the node ID and put it in 'LocationIDSelection' instead" );
  698. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
  699. }
  700. if ( !$module->hasActionParameter( 'LocationIDSelection' ) )
  701. return $module->redirectToView( 'view', array( $viewMode, $redirectNodeID, $languageCode ) );
  702. $locationIDSelection = $module->actionParameter( 'LocationIDSelection' );
  703. $hasChildren = false;
  704. $nodes = array();
  705. foreach ( $locationIDSelection as $locationID )
  706. {
  707. $nodes[] = eZContentObjectTreeNode::fetch( $locationID );
  708. }
  709. $removeList = array();
  710. foreach ( $nodes as $node )
  711. {
  712. if ( $node )
  713. {
  714. // Security checks, removal of current node is not allowed
  715. // and we require removal rights
  716. if ( !$node->canRemove() &&
  717. !$node->canRemoveLocation() )
  718. continue;
  719. if ( $node->attribute( 'node_id' ) == $nodeID )
  720. {
  721. $redirectNodeID = $node->attribute( 'parent_node_id' );
  722. }
  723. $removeList[$node->attribute( 'node_id' )] = 1;
  724. $count = $node->childrenCount( false );
  725. if ( $count > 0 )
  726. {
  727. $hasChildren = true;
  728. }
  729. }
  730. }
  731. if ( $hasChildren )
  732. {
  733. $http->setSessionVariable( 'CurrentViewMode', $viewMode );
  734. $http->setSessionVariable( 'DeleteIDArray', array_keys( $removeList ) );
  735. $http->setSessionVariable( 'ContentNodeID', $nodeID );
  736. $http->setSessionVariable( 'ContentLanguage', $languageCode );
  737. return $module->redirectToView( 'removeobject' );
  738. }
  739. else
  740. {
  741. if ( eZOperationHandler::operationIsAvailable( 'content_removelocation' ) )
  742. {
  743. $operationResult = eZOperationHandler::execute( 'content',
  744. 'removelocation', array( 'node_list' => array_keys( $removeList ) ),
  745. null,
  746. true );
  747. }
  748. else
  749. {
  750. eZContentOperationCollection::removeNodes( array_keys( $removeList ) );
  751. }
  752. }
  753. return $module->redirectToView( 'view', array( $viewMode, $redirectNodeID, $languageCode ) );
  754. }
  755. else if ( $http->hasPostVariable( 'EditButton' ) )
  756. {
  757. if ( $http->hasPostVariable( 'ContentObjectID' ) )
  758. {
  759. $parameters = array( $http->postVariable( 'ContentObjectID' ) );
  760. if ( $http->hasPostVariable( 'ContentObjectVersion' ) )
  761. {
  762. $parameters[] = $http->postVariable( 'ContentObjectVersion' );
  763. if ( $http->hasPostVariable( 'ContentObjectLanguageCode' ) )
  764. {
  765. $parameters[] = $http->postVariable( 'ContentObjectLanguageCode' );
  766. }
  767. }
  768. else
  769. {
  770. if ( $http->hasPostVariable( 'ContentObjectLanguageCode' ) )
  771. {
  772. $languageCode = $http->postVariable( 'ContentObjectLanguageCode' );
  773. if ( $languageCode == '' )
  774. {
  775. $parameters[] = 'a'; // this will be treatead as not entering the version number and offering
  776. // list with new languages
  777. }
  778. else
  779. {
  780. $parameters[] = 'f'; // this will be treatead as not entering the version number
  781. $parameters[]= $languageCode;
  782. }
  783. }
  784. }
  785. if ( $http->hasPostVariable( 'RedirectURIAfterPublish' ) )
  786. {
  787. $http->setSessionVariable( 'RedirectURIAfterPublish', $http->postVariable( 'RedirectURIAfterPublish' ) );
  788. }
  789. if ( $http->hasPostVariable( 'RedirectIfDiscarded' ) )
  790. {
  791. $http->setSessionVariable( 'RedirectIfDiscarded', $http->postVariable( 'RedirectIfDiscarded' ) );
  792. }
  793. $module->redirectToView( 'edit', $parameters );
  794. return;
  795. }
  796. }
  797. else if ( $http->hasPostVariable( 'PreviewPublishButton' ) )
  798. {
  799. if ( $http->hasPostVariable( 'ContentObjectID' ) )
  800. {
  801. $parameters = array( $http->postVariable( 'ContentObjectID' ) );
  802. if ( $http->hasPostVariable( 'ContentObjectVersion' ) )
  803. {
  804. $parameters[] = $http->postVariable( 'ContentObjectVersion' );
  805. if ( $http->hasPostVariable( 'ContentObjectLanguageCode' ) )
  806. {
  807. $parameters[] = $http->postVariable( 'ContentObjectLanguageCode' );
  808. }
  809. }
  810. $module->setCurrentAction( 'Publish', 'edit' );
  811. return $module->run( 'edit', $parameters );
  812. }
  813. }
  814. else if ( $http->hasPostVariable( 'RemoveButton' ) )
  815. {
  816. $viewMode = $http->postVariable( 'ViewMode', 'full' );
  817. $contentNodeID = $http->postVariable( 'ContentNodeID', 2 );
  818. $contentObjectID = $http->postVariable( 'ContentObjectID', 1 );
  819. $hideRemoveConfirm = false;
  820. if ( $http->hasPostVariable( 'HideRemoveConfirmation' ) )
  821. $hideRemoveConfirm = $http->postVariable( 'HideRemoveConfirmation' ) ? true : false;
  822. if ( $http->hasPostVariable( 'DeleteIDArray' ) or $http->hasPostVariable( 'SelectedIDArray' ) )
  823. {
  824. if ( $http->hasPostVariable( 'SelectedIDArray' ) )
  825. $deleteIDArray = $http->postVariable( 'SelectedIDArray' );
  826. else
  827. $deleteIDArray = $http->postVariable( 'DeleteIDArray' );
  828. if ( is_array( $deleteIDArray ) && count( $deleteIDArray ) > 0 )
  829. {
  830. $http->setSessionVariable( 'CurrentViewMode', $viewMode );
  831. $http->setSessionVariable( 'ContentNodeID', $contentNodeID );
  832. $http->setSessionVariable( 'HideRemoveConfirmation', $hideRemoveConfirm );
  833. $http->setSessionVariable( 'DeleteIDArray', $deleteIDArray );
  834. $object = eZContentObject::fetch( $contentObjectID );
  835. if ( $object instanceof eZContentObject )
  836. {
  837. $section = eZSection::fetch( $object->attribute( 'section_id' ) );
  838. }
  839. if ( isset($section) && $section )
  840. $navigationPartIdentifier = $section->attribute( 'navigation_part_identifier' );
  841. else
  842. $navigationPartIdentifier = null;
  843. if ( $navigationPartIdentifier and $navigationPartIdentifier == 'ezusernavigationpart' )
  844. {
  845. $module->redirectTo( $module->functionURI( 'removeuserobject' ) . '/' );
  846. }
  847. elseif ( $navigationPartIdentifier and $navigationPartIdentifier == 'ezmedianavigationpart' )
  848. {
  849. $module->redirectTo( $module->functionURI( 'removemediaobject' ) . '/' );
  850. }
  851. else
  852. {
  853. $module->redirectTo( $module->functionURI( 'removeobject' ) . '/' );
  854. }
  855. }
  856. else
  857. {
  858. $module->redirectTo( $module->functionURI( 'view' ) . '/' . $viewMode . '/' . $contentNodeID . '/' );
  859. }
  860. }
  861. else
  862. {
  863. $module->redirectTo( $module->functionURI( 'view' ) . '/' . $viewMode . '/' . $contentNodeID . '/' );
  864. }
  865. }
  866. else if ( $http->hasPostVariable( 'MoveButton' ) )
  867. {
  868. /* action for multi select move, uses same interface as RemoveButton */
  869. $viewMode = $http->postVariable( 'ViewMode', 'full' );
  870. $parentNodeID = $http->postVariable( 'ContentNodeID', 2 );
  871. $parentObjectID = $http->postVariable( 'ContentObjectID', 1 );
  872. if ( $http->hasPostVariable( 'DeleteIDArray' ) or $http->hasPostVariable( 'SelectedIDArray' ) )
  873. {
  874. if ( $http->hasPostVariable( 'SelectedIDArray' ) )
  875. $moveIDArray = $http->postVariable( 'SelectedIDArray' );
  876. else
  877. $moveIDArray = $http->postVariable( 'DeleteIDArray' );
  878. if ( is_array( $moveIDArray ) && count( $moveIDArray ) > 0 )
  879. {
  880. $ignoreNodesSelect = array();
  881. $ignoreNodesSelectSubtree = array();
  882. $ignoreNodesClick = array();
  883. $classIDArray = array();
  884. $classIdentifierArray = array();
  885. $classGroupArray = array();
  886. $sectionIDArray = array();
  887. $objectNameArray = array();
  888. foreach( $moveIDArray as $nodeID )
  889. {
  890. $node = eZContentObjectTreeNode::fetch( $nodeID );
  891. if ( !$node )
  892. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  893. if ( !$node->canMoveFrom() )
  894. return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel', array() );
  895. $object = $node->object();
  896. if ( !$object )
  897. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  898. $class = $object->contentClass();
  899. $classIDArray[] = $class->attribute( 'id' );
  900. $classIdentifierArray[] = $class->attribute( 'identifier' );
  901. $classGroupArray = array_merge( $classGroupArray, $class->attribute( 'ingroup_id_list' ) );
  902. $sectionIDArray[] = $object->attribute( 'section_id' );
  903. $objectNameArray[] = $object->attribute( 'name' );
  904. $publishedAssigned = $object->assignedNodes( false );
  905. foreach ( $publishedAssigned as $element )
  906. {
  907. $ignoreNodesSelect[] = $element['node_id'];
  908. $ignoreNodesSelectSubtree[] = $element['node_id'];
  909. $ignoreNodesClick[] = $element['node_id'];
  910. $ignoreNodesSelect[] = $element['parent_node_id'];
  911. }
  912. }
  913. $parentNode = eZContentObjectTreeNode::fetch( $parentNodeID );
  914. if ( !$parentNode )
  915. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  916. $parentObject = $parentNode->object();
  917. if ( !$parentObject )
  918. return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel', array() );
  919. $parentObjectID = $parentObject->attribute( 'id' );
  920. $parentClass = $parentObject->contentClass();
  921. $ignoreNodesSelect = array_unique( $ignoreNodesSelect );
  922. $ignoreNodesSelectSubtree = array_unique( $ignoreNodesSelectSubtree );
  923. $ignoreNodesClick = array_unique( $ignoreNodesClick );
  924. $classIDArray = array_unique( $classIDArray );
  925. $classIdentifierArray = array_unique( $classIdentifierArray );
  926. $classGroupArray = array_unique( $classGroupArray );
  927. $sectionIDArray = array_unique( $sectionIDArray );
  928. eZContentBrowse::browse( array( 'action_name' => 'MoveNode',
  929. 'description_template' => 'design:content/browse_move_node.tpl',
  930. 'keys' => array( 'class' => $classIDArray,
  931. 'class_id' => $classIdentifierArray,
  932. 'classgroup' => $classGroupArray,
  933. 'section' => $sectionIDArray ),
  934. 'ignore_nodes_select' => $ignoreNodesSelect,
  935. 'ignore_nodes_select_subtree' => $ignoreNodesSelectSubtree,
  936. 'ignore_nodes_click' => $ignoreNodesClick,
  937. 'persistent_data' => array( 'ContentNodeID' => implode( ',', $moveIDArray ),
  938. 'ViewMode' => $viewMode,
  939. 'ContentObjectLanguageCode' => $languageCode,
  940. 'MoveNodeAction' => '1' ),
  941. 'permission' => array( 'access' => 'create',
  942. 'contentclass_id' => $classIDArray ),
  943. 'content' => array( 'name_list' => $objectNameArray, 'node_id_list' => $moveIDArray ),
  944. 'start_node' => $parentNodeID,
  945. 'cancel_page' => $module->redirectionURIForModule( $module, 'view', array( $viewMode, $parentNodeID, $languageCode ) ),
  946. 'from_page' => "/content/action" ),
  947. $module );
  948. }
  949. else
  950. {
  951. eZDebug::writeError( "Empty SelectedIDArray parameter for action " . $module->currentAction(),
  952. 'content/action' );
  953. $module->redirectTo( $module->functionURI( 'view' ) . '/' . $viewMode . '/' . $parentNodeID . '/' );
  954. }
  955. }
  956. else
  957. {
  958. eZDebug::writeError( "Missing SelectedIDArray parameter for action " . $module->currentAction(),
  959. 'content/action' );
  960. $module->redirectTo( $module->functionURI( 'view' ) . '/' . $viewMode . '/' . $parentNodeID . '/' );
  961. }
  962. }
  963. else if ( $http->hasPostVariable( 'UpdatePriorityButton' ) )
  964. {
  965. $viewMode = $http->postVariable( 'ViewMode', 'full' );
  966. if ( $http->hasPostVariable( 'ContentNodeID' ) )
  967. {
  968. $contentNodeID = $http->postVariable( 'ContentNodeID' );
  969. }
  970. else
  971. {
  972. eZDebug::writeError( "Variable 'ContentNodeID' can not be found in template." );
  973. $module->redirectTo( $module->functionURI( 'view' ) . '/' . $viewMode . '/' . $contentNodeID . '/' );
  974. return;
  975. }
  976. if ( $http->hasPostVariable( 'Priority' ) and $http->hasPostVariable( 'PriorityID' ) )
  977. {
  978. $contentNode = eZContentObjectTreeNode::fetch( $contentNodeID );
  979. if ( !$contentNode->attribute( 'can_edit' ) )
  980. {
  981. eZDebug::writeError( 'Current user can not update the priorities because he has no permissions to edit the node' );
  982. $module->redirectTo( $module->functionURI( 'view' ) . '/' . $viewMode . '/' . $contentNodeID . '/' );
  983. return;
  984. }
  985. $priorityArray = $http->postV

Large files files are truncated, but you can click here to view the full file