Example #1
0
 function loadObjectList($package, $http, $step, &$persistentData, $tpl, &$module)
 {
     if ($http->hasPostVariable('AddSubtree')) {
         eZContentBrowse::browse(array('action_name' => 'FindLimitationSubtree', 'description_template' => 'design:package/creators/ezcontentobject/browse_subtree.tpl', 'from_page' => '/package/create', 'persistent_data' => array('PackageStep' => $http->postVariable('PackageStep'), 'CreatorItemID' => $http->postVariable('CreatorItemID'), 'CreatorStepID' => $http->postVariable('CreatorStepID'), 'Subtree' => 1)), $module);
     } else {
         if ($http->hasPostVariable('AddNode')) {
             eZContentBrowse::browse(array('action_name' => 'FindLimitationNode', 'description_template' => 'design:package/creators/ezcontentobject/browse_node.tpl', 'from_page' => '/package/create', 'persistent_data' => array('PackageStep' => $http->postVariable('PackageStep'), 'CreatorItemID' => $http->postVariable('CreatorItemID'), 'CreatorStepID' => $http->postVariable('CreatorStepID'), 'Node' => 1)), $module);
         } else {
             if ($http->hasPostVariable('RemoveSelected')) {
                 foreach (array_keys($persistentData['node_list']) as $key) {
                     if (in_array($persistentData['node_list'][$key]['id'], $http->postVariable('DeleteIDArray'))) {
                         unset($persistentData['node_list'][$key]);
                     }
                 }
             } else {
                 if ($http->hasPostVariable('SelectedNodeIDArray') && !$http->hasPostVariable('BrowseCancelButton')) {
                     if ($http->hasPostVariable('Subtree') && $http->hasPostVariable('Subtree') == 1) {
                         foreach ($http->postVariable('SelectedNodeIDArray') as $nodeID) {
                             $persistentData['node_list'][] = array('id' => $nodeID, 'type' => 'subtree');
                         }
                     } else {
                         if ($http->hasPostVariable('Node') && $http->hasPostVariable('Node') == 1) {
                             foreach ($http->postVariable('SelectedNodeIDArray') as $nodeID) {
                                 $persistentData['node_list'][] = array('id' => $nodeID, 'type' => 'node');
                             }
                         }
                     }
                 }
             }
         }
     }
     $tpl->setVariable('node_list', $persistentData['node_list']);
 }
Example #2
0
 public function proccessHTTPInput($module, $http, $edit = false)
 {
     if ($http->hasVariable('DiscardButton')) {
         return $module->redirectTo('csv_import/configs');
     }
     if ($http->hasVariable('BrowseParentNode')) {
         $url = $edit ? 'csv_import/edit_config/' . $this->attribute('id') : 'csv_import/add_config';
         $browseParameters = array('action_name' => 'AddParentNode', 'type' => 'NewObjectAddNodeAssignment', 'from_page' => $url);
         return eZContentBrowse::browse($browseParameters, $module);
     }
     if ($http->hasVariable('SelectedNodeIDArray')) {
         $nodeIDs = (array) $http->variable('SelectedNodeIDArray');
         $this->setAttribute('parent_node_id', (int) $nodeIDs[0]);
     } elseif ($http->hasVariable('parent_node_id')) {
         $this->setAttribute('parent_node_id', (int) $http->variable('parent_node_id'));
     }
     if ($http->hasVariable('name')) {
         $this->setAttribute('name', $http->variable('name'));
     }
     if ($http->hasVariable('class_id')) {
         $this->setAttribute('class_id', $http->variable('class_id'));
     }
     if ($http->hasVariable('attributes_mapping')) {
         $this->setAttribute('attributes_mapping_serialized', serialize($http->variable('attributes_mapping')));
     }
     return true;
 }
        eZDiscountSubRuleValue::removeBySubRuleID($discountRuleID);
        eZDiscountSubRule::remove($discountRuleID);
    }
    $db->commit();
    // we changed prices => remove content cache
    eZContentCacheManager::clearAllContentCache();
    $module->redirectTo($module->functionURI("discountgroupview") . "/" . $discountGroupID);
    return;
}
if ($http->hasPostVariable("AddCustomerButton")) {
    eZContentBrowse::browse(array('action_name' => 'AddCustomer', 'description_template' => 'design:shop/browse_discountcustomer.tpl', 'keys' => array('discountgroup_id' => $discountGroupID), 'content' => array('discountgroup_id' => $discountGroupID), 'from_page' => "/shop/discountgroupview/{$discountGroupID}"), $module);
    return;
}
// Add customer or customer group to this rule
if ($module->isCurrentAction('AddCustomer')) {
    $selectedObjectIDArray = eZContentBrowse::result('AddCustomer');
    $userIDArray = eZUserDiscountRule::fetchUserID($discountGroupID);
    $db = eZDB::instance();
    $db->begin();
    foreach ($selectedObjectIDArray as $objectID) {
        if (!in_array($objectID, $userIDArray)) {
            $userRule = eZUserDiscountRule::create($discountGroupID, $objectID);
            $userRule->store();
        }
    }
    $db->commit();
    // because we changed users, we have to remove content cache
    eZContentCacheManager::clearAllContentCache();
}
if ($http->hasPostVariable("RemoveCustomerButton")) {
    if ($http->hasPostVariable("CustomerIDArray")) {
function chooseOptionsToCopy($Module, &$Result, $srcNode, $chooseVersions, $chooseCreator, $chooseTime)
{
    $selectedNodeIDArray = eZContentBrowse::result($Module->currentAction());
    $tpl = eZTemplate::factory();
    $tpl->setVariable('node', $srcNode);
    $tpl->setVariable('selected_node_id', $selectedNodeIDArray[0]);
    $tpl->setVariable('choose_versions', $chooseVersions);
    $tpl->setVariable('choose_creator', $chooseCreator);
    $tpl->setVariable('choose_time', $chooseTime);
    $Result['content'] = $tpl->fetch('design:content/copy_subtree.tpl');
    $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/content', 'Content')), array('url' => false, 'text' => ezpI18n::tr('kernel/content', 'Copy subtree')));
}
Example #5
0
             if (!$parentNode) {
                 return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel', array());
             }
             $parentObject = $parentNode->object();
             if (!$parentObject) {
                 return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel', array());
             }
             $parentObjectID = $parentObject->attribute('id');
             $ignoreNodesSelect = array_unique($ignoreNodesSelect);
             $ignoreNodesSelectSubtree = array_unique($ignoreNodesSelectSubtree);
             $ignoreNodesClick = array_unique($ignoreNodesClick);
             $classIDArray = array_unique($classIDArray);
             $classIdentifierArray = array_unique($classIdentifierArray);
             $classGroupArray = array_unique($classGroupArray);
             $sectionIDArray = array_unique($sectionIDArray);
             eZContentBrowse::browse(array('action_name' => 'MoveNode', 'description_template' => 'design:content/browse_move_node.tpl', 'keys' => array('class' => $classIDArray, 'class_id' => $classIdentifierArray, 'classgroup' => $classGroupArray, 'section' => $sectionIDArray), 'ignore_nodes_select' => $ignoreNodesSelect, 'ignore_nodes_select_subtree' => $ignoreNodesSelectSubtree, 'ignore_nodes_click' => $ignoreNodesClick, 'persistent_data' => array('ContentNodeID' => implode(',', $moveIDArray), 'ViewMode' => $viewMode, 'ContentObjectLanguageCode' => $languageCode, 'MoveNodeAction' => '1'), 'permission' => array('access' => 'create', 'contentclass_id' => $classIDArray), 'content' => array('name_list' => $objectNameArray, 'node_id_list' => $moveIDArray), 'start_node' => $parentNodeID, 'cancel_page' => $module->redirectionURIForModule($module, 'view', array($viewMode, $parentNodeID, $languageCode)), 'from_page' => "/content/action"), $module);
         } else {
             eZDebug::writeError("Empty SelectedIDArray parameter for action " . $module->currentAction(), 'content/action');
             $module->redirectTo($module->functionURI('view') . '/' . $viewMode . '/' . $parentNodeID . '/');
         }
     } else {
         eZDebug::writeError("Missing SelectedIDArray parameter for action " . $module->currentAction(), 'content/action');
         $module->redirectTo($module->functionURI('view') . '/' . $viewMode . '/' . $parentNodeID . '/');
     }
 } else {
     if ($http->hasPostVariable('UpdatePriorityButton')) {
         $viewMode = $http->postVariable('ViewMode', 'full');
         if ($http->hasPostVariable('ContentNodeID')) {
             $contentNodeID = $http->postVariable('ContentNodeID');
         } else {
             eZDebug::writeError("Variable 'ContentNodeID' can not be found in template.");
            // Redirect the to detail page for the object's elevation configuration
            $module->redirectToView( 'elevation_detail', array( $objectID ) );
        }
    }
}

// From elevate's landing page, trigger browsing for an object to elevate, or to search elevation for
elseif ( $http->hasPostVariable( 'ezfind-elevate-browseforobject' ) or
         $http->hasPostVariable( 'ezfind-searchelevateconfigurations-browse' ) )
{
    $actionName = $http->hasPostVariable( 'ezfind-elevate-browseforobject' ) ? 'ezfind-elevate-browseforobject' : 'ezfind-searchelevateconfigurations-browse';
    $elevateSearchQuery =  $http->hasPostVariable( 'ezfind-elevate-searchquery' ) ? $http->postVariable( 'ezfind-elevate-searchquery' ): '';
    $browseType = 'SelectObjectRelationNode';
    eZContentBrowse::browse( array( 'action_name' => $actionName,
                                    'type' =>  $browseType,
                                    'from_page' => $module->currentRedirectionURI(),
                                    'persistent_data' => array( 'elevateSearchQuery' => $elevateSearchQuery ) ),
                             $module );
}

// Store the actual Elevate configuration
else if ( $http->hasPostVariable( 'ezfind-elevate-do' ) )
{
    $doStorage = true;

    // Check if we have all required data
    // Validate ObjectID
    if ( !$http->hasPostVariable( 'elevateObjectID' ) or
         ( $elevatedObject = eZContentObject::fetch( $http->postVariable( 'elevateObjectID' ) ) ) === null
       )
    {
    }
    if ( $http->hasPostVariable( 'NeedRedirectBack' ) )
    {
        return $Module->redirectTo( $http->postVariable( 'RedirectURI', $http->sessionVariable( 'LastAccessesURI', '/' ) ) );
    }
}
else if ( $Module->isCurrentAction( 'Add' )  )
{
    return eZContentBrowse::browse( array( 'action_name' => 'AddBookmark',
                                           'description_template' => 'design:content/browse_bookmark.tpl',
                                           'from_page' => "/content/bookmark" ),
                                    $Module );
}
else if ( $Module->isCurrentAction( 'AddBookmark' )  )
{
    $nodeList = eZContentBrowse::result( 'AddBookmark' );
    if ( $nodeList )
    {
        $db = eZDB::instance();
        $db->begin();
        foreach ( $nodeList as $nodeID )
        {
            $node = eZContentObjectTreeNode::fetch( $nodeID );
            if ( $node )
            {
                $nodeName = $node->attribute( 'name' );
                eZContentBrowseBookmark::createNew( $userID, $nodeID, $nodeName );
            }
        }
        $db->commit();
    }
Example #8
0
                        $rssExport->store();
                    }
                }
            }
        }
    }
}
if ($http->hasPostVariable('Item_Count')) {
    $db = eZDB::instance();
    $db->begin();
    for ($itemCount = 0; $itemCount < $http->postVariable('Item_Count'); $itemCount++) {
        if ($http->hasPostVariable('SourceBrowse_' . $itemCount)) {
            $skipValues = $http->hasPostVariable('Ignore_Values_On_Browse_' . $itemCount) && $http->postVariable('Ignore_Values_On_Browse_' . $itemCount);
            eZRSSEditFunction::storeRSSExport($Module, $http, false, $skipValues ? $http->postVariable('Item_ID_' . $itemCount) : null);
            //
            eZContentBrowse::browse(array('action_name' => 'RSSObjectBrowse', 'description_template' => 'design:rss/browse_source.tpl', 'from_page' => '/rss/edit_export/' . $RSSExportID . '/' . $http->postVariable('Item_ID_' . $itemCount) . '/NodeSource'), $Module);
            break;
        }
        // remove selected source (if any)
        if ($http->hasPostVariable('RemoveSource_' . $itemCount)) {
            $itemID = $http->postVariable('Item_ID_' . $itemCount);
            if ($rssExportItem = eZRSSExportItem::fetch($itemID, true, eZRSSExport::STATUS_DRAFT)) {
                // remove the draft version
                $rssExportItem->remove();
                // remove the published version
                $rssExportItem->setAttribute('status', eZRSSExport::STATUS_VALID);
                $rssExportItem->remove();
                eZRSSEditFunction::storeRSSExport($Module, $http);
            }
            break;
        }
 function customClassAttributeHTTPAction($http, $action, $classAttribute)
 {
     switch ($action) {
         case 'browse_for_placement':
             $module = $classAttribute->currentModule();
             $customActionName = 'CustomActionButton[' . $classAttribute->attribute('id') . '_browsed_for_placement]';
             eZContentBrowse::browse(array('action_name' => 'SelectObjectRelationListNode', 'content' => array('contentclass_id' => $classAttribute->attribute('contentclass_id'), 'contentclass_attribute_id' => $classAttribute->attribute('id'), 'contentclass_version' => $classAttribute->attribute('version'), 'contentclass_attribute_identifier' => $classAttribute->attribute('identifier')), 'persistent_data' => array($customActionName => '', 'ContentClassHasInput' => false), 'description_template' => 'design:class/datatype/browse_objectrelationlist_placement.tpl', 'from_page' => $module->currentRedirectionURI()), $module);
             break;
         case 'browsed_for_placement':
             $nodeSelection = eZContentBrowse::result('SelectObjectRelationListNode');
             if ($nodeSelection and count($nodeSelection) > 0) {
                 $nodeID = $nodeSelection[0];
                 $content = $classAttribute->content();
                 $content['default_placement'] = array('node_id' => $nodeID);
                 $classAttribute->setContent($content);
             }
             break;
         case 'disable_placement':
             $content = $classAttribute->content();
             $content['default_placement'] = false;
             $classAttribute->setContent($content);
             break;
         default:
             eZDebug::writeError("Unknown objectrelationlist action '{$action}'", __METHOD__);
             break;
     }
 }
Example #10
0
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
$http = eZHTTPTool::instance();
$module = $Params["Module"];
$NodeID = $Params['NodeID'];
$exportTypeParam = $Params['ExportType'];
$tpl = eZTemplate::factory();
$success = true;
if ($http->hasPostVariable("ExportButton")) {
    eZContentBrowse::browse(array('action_name' => 'OOPlace', 'description_template' => 'design:ezodf/browse_place.tpl', 'content' => array(), 'from_page' => '/ezodf/export/', 'cancel_page' => '/ezodf/export/'), $module);
    return;
}
$doExport = false;
if ($module->isCurrentAction('OOPlace')) {
    // We have the file and the placement. Do the actual import.
    $selectedNodeIDArray = eZContentBrowse::result('OOPlace');
    $nodeID = $selectedNodeIDArray[0];
    $doExport = true;
}
if ($http->hasPostVariable("NodeID")) {
    $nodeID = $http->postVariable("NodeID");
    $doExport = true;
} else {
    if (is_numeric($NodeID)) {
        $nodeID = $NodeID;
        $doExport = true;
    }
}
$exportType = false;
if ($http->hasPostVariable("ExportType")) {
    $type = $http->postVariable("ExportType");
 function fetchHttpInput($http, $module)
 {
     if ($http->hasPostVariable('NewRule_' . self::NOTIFICATION_HANDLER_ID)) {
         eZContentBrowse::browse(array('action_name' => 'AddSubtreeSubscribingNode', 'from_page' => '/notification/settings/'), $module);
     } else {
         if ($http->hasPostVariable('RemoveRule_' . self::NOTIFICATION_HANDLER_ID) and $http->hasPostVariable('SelectedRuleIDArray_' . self::NOTIFICATION_HANDLER_ID)) {
             $user = eZUser::currentUser();
             $userList = eZSubtreeNotificationRule::fetchList($user->attribute('contentobject_id'), false);
             foreach ($userList as $userRow) {
                 $listID[] = $userRow['id'];
             }
             $ruleIDList = $http->postVariable('SelectedRuleIDArray_' . self::NOTIFICATION_HANDLER_ID);
             foreach ($ruleIDList as $ruleID) {
                 if (in_array($ruleID, $listID)) {
                     eZPersistentObject::removeObject(eZSubtreeNotificationRule::definition(), array('id' => $ruleID));
                 }
             }
         } else {
             if ($http->hasPostVariable("BrowseActionName") and $http->postVariable("BrowseActionName") == "AddSubtreeSubscribingNode" and !$http->hasPostVariable('BrowseCancelButton')) {
                 $selectedNodeIDArray = $http->postVariable("SelectedNodeIDArray");
                 $user = eZUser::currentUser();
                 $existingNodes = eZSubtreeNotificationRule::fetchNodesForUserID($user->attribute('contentobject_id'), false);
                 foreach ($selectedNodeIDArray as $nodeID) {
                     if (!in_array($nodeID, $existingNodes)) {
                         $rule = eZSubtreeNotificationRule::create($nodeID, $user->attribute('contentobject_id'));
                         $rule->store();
                     }
                 }
                 //            $Module->redirectTo( "//list/" );
             }
         }
     }
 }
    $subscriptionList->publish();
    return $Module->redirectToView('subscription_list', array($subscriptionList->attribute('url_alias')));
}
if ($http->hasPostVariable('CancelButton')) {
    $subscriptionList->removeDraft();
    return $Module->redirectToView('list_subscriptions');
}
$relatedObjectMap = array();
$extension = 'eznewsletter';
for ($count = 1; $count <= 3; ++$count) {
    $postName = 'BrowseRelatedObject_' . $count;
    $attributeName = 'related_object_id_' . $count;
    $selectName = 'related' . $count;
    $deleteName = 'DeleteRelatedObject_' . $count;
    if ($http->hasPostVariable($postName)) {
        return eZContentBrowse::browse(array('action_name' => 'ArticlePoolBrowse', 'keys' => array(), 'description_template' => "design:{$extension}/browse_article_pool.tpl", 'from_page' => 'newsletter/edit_subscription_list/' . $subscriptionListID . '/' . $selectName), $Module);
    }
    if ($http->hasPostVariable($deleteName)) {
        $subscriptionList->setAttribute($attributeName, 0);
        $subscriptionList->store();
    }
    if (isset($Params['BrowseSelected']) && $Params['BrowseSelected'] == $selectName) {
        if ($http->hasPostVariable('SelectedObjectIDArray')) {
            $relatedObjectID = $http->postVariable('SelectedObjectIDArray');
            if (isset($relatedObjectID) && !$http->hasPostVariable('BrowseCancelButton')) {
                $subscriptionList->setAttribute($attributeName, $relatedObjectID[0]);
                $subscriptionList->store();
            }
        }
    }
}
Example #13
0
    if ($Module->isCurrentAction('Export')) {
        $pdfExport->setAttribute('source_node_id', $Module->actionParameter('SourceNode'));
        if ($pdfExport->attribute('status') == eZPDFExport::CREATE_ONCE && $pdfExport->countGeneratingOnceExports() > 0) {
            $validation['placement'][] = array('text' => ezpI18n::tr('kernel/pdf', 'An export with such filename already exists.'));
            $validation['processed'] = true;
            $inputValidated = false;
        }
    }
    if ($inputValidated) {
        $pdfExport->store();
    }
}
$setWarning = false;
// used to set missing options during export
if ($Module->isCurrentAction('BrowseSource')) {
    eZContentBrowse::browse(array('action_name' => 'ExportSourceBrowse', 'description_template' => 'design:content/browse_export.tpl', 'from_page' => '/pdf/edit/' . $pdfExport->attribute('id')), $Module);
} else {
    if ($Module->isCurrentAction('Export') && $inputValidated) {
        // remove the old file ( user may changed the filename )
        $originalPdfExport = eZPDFExport::fetch($Params['PDFExportID']);
        if ($originalPdfExport && $originalPdfExport->attribute('status') == eZPDFExport::CREATE_ONCE) {
            $filename = $originalPdfExport->attribute('filepath');
            if (file_exists($filename)) {
                unlink($filename);
            }
        }
        if ($pdfExport->attribute('status') == eZPDFExport::CREATE_ONCE) {
            generatePDF($pdfExport, $pdfExport->attribute('filepath'));
            $pdfExport->store(true);
            return $Module->redirect('pdf', 'list');
        } else {
Example #14
0
    if (count($nodeIDArray) > 0 and is_numeric($nodeIDArray[0])) {
        // update the database.
        $nodeID = $nodeIDArray[0];
        if ($config === false) {
            $configList = eZSurveyRelatedConfig::fetchList();
            if (count($configList) == 0) {
                $config = eZSurveyRelatedConfig::create();
            } else {
                $config = $configList[0];
            }
        }
        $config->setAttribute('node_id', $nodeID);
        $config->store();
    }
}
if ($Module->isCurrentAction('BrowseForObjects')) {
    $assignedNodesIDs = array();
    eZContentBrowse::browse(array('action_name' => 'AddRelatedSurveyNode', 'description_template' => 'design:content/browse_related.tpl', 'content' => array(), 'keys' => array(), 'ignore_nodes_select' => $assignedNodesIDs, 'from_page' => $Module->redirectionURI('survey', 'wizard', array())), $Module);
    return eZModule::HOOK_STATUS_CANCEL_RUN;
}
$tpl = eZTemplate::factory();
$tpl->setVariable('state', $state);
$tpl->setVariable('content_class_list', $contentClassList);
if ($config !== false) {
    $tpl->setVariable('config', $config);
    $tpl->setVariable('survey_attribute_found', $surveyAttributeFound);
    $tpl->setVariable('browse_attribute', $browseAttribute);
}
$Result = array();
$Result['content'] = $tpl->fetch('design:survey/wizard.tpl');
$Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('survey', 'Survey Wizard')));
 /**
  * Executes a custom action for an object attribute which was defined on the web page.
  *
  * @param eZHTTPTool $http
  * @param string $action
  * @param eZContentObjectAttribute $contentObjectAttribute
  * @param array $parameters
  */
 function customObjectAttributeHTTPAction($http, $action, $contentObjectAttribute, $parameters)
 {
     $params = explode('-', $action);
     switch ($params[0]) {
         case 'new_zone_layout':
             if ($http->hasPostVariable('ContentObjectAttribute_ezpage_zone_allowed_type_' . $contentObjectAttribute->attribute('id'))) {
                 $zoneMap = array();
                 if ($http->hasPostVariable('ContentObjectAttribute_ezpage_zone_map')) {
                     $zoneMap = $http->postVariable('ContentObjectAttribute_ezpage_zone_map');
                 }
                 $zoneINI = eZINI::instance('zone.ini');
                 $page = $contentObjectAttribute->content();
                 $zoneAllowedType = $http->postVariable('ContentObjectAttribute_ezpage_zone_allowed_type_' . $contentObjectAttribute->attribute('id'));
                 if ($zoneAllowedType == $page->attribute('zone_layout')) {
                     return false;
                 }
                 $allowedZones = $zoneINI->variable($zoneAllowedType, 'Zones');
                 $allowedZonesCount = count($allowedZones);
                 $page->setAttribute('zone_layout', $zoneAllowedType);
                 $existingZoneCount = $page->getZoneCount();
                 $zoneCountDiff = 0;
                 if ($allowedZonesCount < $existingZoneCount) {
                     $zoneCountDiff = $existingZoneCount - $allowedZonesCount;
                 }
                 if (count($zoneMap) > 0) {
                     foreach ($page->attribute('zones') as $zoneIndex => $zone) {
                         $zoneMapKey = array_search($zone->attribute('zone_identifier'), $zoneMap);
                         if ($zoneMapKey) {
                             $zone->setAttribute('action', 'modify');
                             $zone->setAttribute('zone_identifier', $zoneMapKey);
                         } else {
                             if ($zone->toBeAdded()) {
                                 $page->removeZone($zoneIndex);
                             } else {
                                 $zone->setAttribute('action', 'remove');
                             }
                         }
                     }
                 } else {
                     foreach ($allowedZones as $index => $zoneIdentifier) {
                         $existingZone = $page->getZone($index);
                         if ($existingZone instanceof eZPageZone) {
                             $existingZone->setAttribute('action', 'modify');
                             $existingZone->setAttribute('zone_identifier', $zoneIdentifier);
                         } else {
                             $newZone = $page->addZone(new eZPageZone());
                             $newZone->setAttribute('id', md5(mt_rand() . microtime() . $page->getZoneCount()));
                             $newZone->setAttribute('zone_identifier', $zoneIdentifier);
                             $newZone->setAttribute('action', 'add');
                         }
                     }
                     if ($zoneCountDiff > 0) {
                         while ($zoneCountDiff != 0) {
                             $existingZoneIndex = $existingZoneCount - $zoneCountDiff;
                             $existingZone = $page->getZone($existingZoneIndex);
                             if ($existingZone->toBeAdded()) {
                                 $page->removeZone($existingZoneIndex);
                             } else {
                                 $existingZone->setAttribute('action', 'remove');
                             }
                             $zoneCountDiff -= 1;
                         }
                     }
                 }
                 $page->sortZones();
             }
             break;
         case 'set_rotation':
             $page = $contentObjectAttribute->content();
             $zone = $page->getZone($params[1]);
             $block = $zone->getBlock($params[2]);
             $rotationValue = $http->postVariable('RotationValue_' . $params[2]);
             $rotationUnit = $http->postVariable('RotationUnit_' . $params[2]);
             $rotationSuffle = $http->postVariable('RotationShuffle_' . $params[2]);
             if ($rotationValue == '') {
                 $block->setAttribute('rotation', array('interval' => 0, 'type' => 0, 'value' => '', 'unit' => ''));
             } else {
                 switch ($rotationUnit) {
                     case '2':
                         $rotationInterval = $rotationValue * 60;
                         break;
                     case '3':
                         $rotationInterval = $rotationValue * 3600;
                         break;
                     case '4':
                         $rotationInterval = $rotationValue * 86400;
                     default:
                         break;
                 }
                 $rotationType = 1;
                 if ($rotationSuffle) {
                     $rotationType = 2;
                 }
                 $block->setAttribute('rotation', array('interval' => $rotationInterval, 'type' => $rotationType, 'value' => $rotationValue, 'unit' => $rotationUnit));
             }
             break;
         case 'remove_block':
             $page = $contentObjectAttribute->content();
             $zone = $page->getZone($params[1]);
             $block = $zone->getBlock($params[2]);
             if ($block->toBeAdded()) {
                 $zone->removeBlock($params[2]);
             } else {
                 $block->setAttribute('action', 'remove');
             }
             break;
         case 'new_block':
             $page = $contentObjectAttribute->content();
             $zone = $page->getZone($params[1]);
             if ($http->hasPostVariable('ContentObjectAttribute_ezpage_block_type_' . $contentObjectAttribute->attribute('id') . '_' . $params[1])) {
                 $blockType = $http->postVariable('ContentObjectAttribute_ezpage_block_type_' . $contentObjectAttribute->attribute('id') . '_' . $params[1]);
             }
             if ($http->hasPostVariable('ContentObjectAttribute_ezpage_block_name_' . $contentObjectAttribute->attribute('id') . '_' . $params[1])) {
                 $blockName = $http->postVariable('ContentObjectAttribute_ezpage_block_name_' . $contentObjectAttribute->attribute('id') . '_' . $params[1]);
             }
             $block = $zone->addBlock(new eZPageBlock($blockName));
             $block->setAttribute('action', 'add');
             $block->setAttribute('id', md5(mt_rand() . microtime() . $zone->getBlockCount()));
             $block->setAttribute('zone_id', $zone->attribute('id'));
             $block->setAttribute('type', $blockType);
             break;
         case 'move_block_up':
             $page = $contentObjectAttribute->content();
             $zone = $page->getZone($params[1]);
             $zone->moveBlockUp($params[2]);
             break;
         case 'move_block_down':
             $page = $contentObjectAttribute->content();
             $zone = $page->getZone($params[1]);
             $zone->moveBlockDown($params[2]);
             break;
         case 'new_item':
             if ($http->hasPostVariable('SelectedNodeIDArray')) {
                 if (!$http->hasPostVariable('BrowseCancelButton')) {
                     $selectedNodeIDArray = $http->postVariable('SelectedNodeIDArray');
                     $page = $contentObjectAttribute->content();
                     $zone = null;
                     $block = null;
                     if (isset($params[1]) && $page instanceof eZPage) {
                         $zone = $page->getZone($params[1]);
                     }
                     if ($zone instanceof eZPageZone) {
                         $block = $zone->getBlock($params[2]);
                     }
                     if ($block instanceof eZPageBlock) {
                         foreach ($selectedNodeIDArray as $index => $nodeID) {
                             $object = eZContentObject::fetchByNodeID($nodeID);
                             if (!$object instanceof eZContentObject) {
                                 return false;
                             }
                             $objectID = $object->attribute('id');
                             //judge the list if there is a same item in history
                             $itemAdded = false;
                             $itemValid = false;
                             $historyItems = $block->attribute('archived');
                             foreach ($historyItems as $historyItem) {
                                 if ($historyItem->attribute('object_id') == $objectID) {
                                     $itemAdded = $historyItem;
                                 }
                             }
                             $validItems = $block->attribute('valid');
                             foreach ($validItems as $validItem) {
                                 if ($validItem->attribute('object_id') == $objectID) {
                                     $itemValid = $validItem;
                                 }
                             }
                             //judge if the item will be removed
                             $itemToBeRemoved = false;
                             if ($block->getItemCount() > 0) {
                                 foreach ($block->attribute('items') as $itemID => $item) {
                                     if ($item->attribute('object_id') == $objectID) {
                                         if ($item->toBeRemoved()) {
                                             $itemToBeRemoved = true;
                                             $itemAdded = $item;
                                         }
                                     }
                                 }
                             }
                             if ($itemAdded || $itemToBeRemoved) {
                                 //if there is same item in history, or item to be removed (in history or valid), set the item in history to be modified
                                 // if item is not to be removed, add to the block since it's not in block ,but in history or valid
                                 if (!$itemToBeRemoved) {
                                     $block->addItem($itemAdded);
                                 }
                                 $itemAdded->setXMLStorable(true);
                                 $itemAdded->setAttribute('node_id', $nodeID);
                                 $itemAdded->setAttribute('priority', $block->getItemCount());
                                 $itemAdded->setAttribute('ts_publication', time());
                                 $itemAdded->setAttribute('ts_visible', '0');
                                 $itemAdded->setAttribute('ts_hidden', '0');
                                 $itemAdded->setAttribute('action', 'modify');
                             } else {
                                 if (!$itemValid) {
                                     //if there is no same item in history and valid, also the item is not to be removed, add new
                                     $item = $block->addItem(new eZPageBlockItem());
                                     $item->setAttribute('object_id', $objectID);
                                     $item->setAttribute('node_id', $nodeID);
                                     $item->setAttribute('priority', $block->getItemCount());
                                     $item->setAttribute('ts_publication', time());
                                     $item->setAttribute('action', 'add');
                                 }
                             }
                         }
                     }
                     $contentObjectAttribute->setContent($page);
                     $contentObjectAttribute->store();
                 }
             }
             break;
         case 'new_item_browse':
             $module = $parameters['module'];
             $redirectionURI = $redirectionURI = $parameters['current-redirection-uri'];
             $page = $contentObjectAttribute->content();
             $zone = $page->getZone($params[1]);
             $block = $zone->getBlock($params[2]);
             $type = $block->attribute('type');
             $blockINI = eZINI::instance('block.ini');
             $classArray = false;
             if ($blockINI->hasVariable($type, 'AllowedClasses')) {
                 $classArray = $blockINI->variable($type, 'AllowedClasses');
             }
             eZContentBrowse::browse(array('class_array' => $classArray, 'action_name' => 'AddNewBlockItem', 'browse_custom_action' => array('name' => 'CustomActionButton[' . $contentObjectAttribute->attribute('id') . '_new_item-' . $params[1] . '-' . $params[2] . ']', 'value' => $contentObjectAttribute->attribute('id')), 'from_page' => $redirectionURI, 'cancel_page' => $redirectionURI, 'persistent_data' => array('HasObjectInput' => 0)), $module);
             break;
         case 'new_source':
             $page = $contentObjectAttribute->content();
             $zone = $page->getZone($params[1]);
             $block = $zone->getBlock($params[2]);
             if ($http->hasPostVariable('SelectedNodeIDArray')) {
                 $selectedNodeIDArray = $http->postVariable('SelectedNodeIDArray');
                 $blockINI = eZINI::instance('block.ini');
                 $fetchParametersSelectionType = $blockINI->variable($block->attribute('type'), 'FetchParametersSelectionType');
                 $fetchParams = unserialize($block->attribute('fetch_params'));
                 if ($fetchParametersSelectionType['Source'] == 'single') {
                     $fetchParams['Source'] = $selectedNodeIDArray[0];
                 } else {
                     $fetchParams['Source'] = $selectedNodeIDArray;
                 }
                 $block->setAttribute('fetch_params', serialize($fetchParams));
                 $persBlockObject = eZFlowBlock::fetch($block->attribute('id'));
                 if ($persBlockObject instanceof eZFlowBlock) {
                     $persBlockObject->setAttribute('last_update', 0);
                     $persBlockObject->store();
                 }
             }
             $contentObjectAttribute->setContent($page);
             $contentObjectAttribute->store();
             break;
         case 'new_source_browse':
             $page = $contentObjectAttribute->content();
             $zone = $page->getZone($params[1]);
             $block = $zone->getBlock($params[2]);
             $blockINI = eZINI::instance('block.ini');
             $fetchParametersSelectionType = $blockINI->variable($block->attribute('type'), 'FetchParametersSelectionType');
             $module = $parameters['module'];
             $redirectionURI = $redirectionURI = $parameters['current-redirection-uri'];
             eZContentBrowse::browse(array('action_name' => 'AddNewBlockSource', 'selection' => $fetchParametersSelectionType['Source'], 'browse_custom_action' => array('name' => 'CustomActionButton[' . $contentObjectAttribute->attribute('id') . '_new_source-' . $params[1] . '-' . $params[2] . ']', 'value' => $contentObjectAttribute->attribute('id')), 'from_page' => $redirectionURI, 'cancel_page' => $redirectionURI, 'persistent_data' => array('HasObjectInput' => 0)), $module);
             break;
         case 'custom_attribute':
             $page = $contentObjectAttribute->content();
             $zone = $page->getZone($params[1]);
             $block = $zone->getBlock($params[2]);
             if (!$http->hasPostVariable('BrowseCancelButton')) {
                 $customAttributes = $block->attribute('custom_attributes');
                 if ($http->hasPostVariable('SelectedNodeIDArray')) {
                     $selectedNodeIDArray = $http->postVariable('SelectedNodeIDArray');
                     $customAttributes[$params[3]] = $selectedNodeIDArray[0];
                 }
                 $block->setAttribute('custom_attributes', $customAttributes);
                 $contentObjectAttribute->setContent($page);
                 $contentObjectAttribute->store();
             }
             break;
         case 'custom_attribute_browse':
             $module = $parameters['module'];
             $redirectionURI = $redirectionURI = $parameters['current-redirection-uri'];
             eZContentBrowse::browse(array('action_name' => 'CustomAttributeBrowse', 'browse_custom_action' => array('name' => 'CustomActionButton[' . $contentObjectAttribute->attribute('id') . '_custom_attribute-' . $params[1] . '-' . $params[2] . '-' . $params[3] . ']', 'value' => $contentObjectAttribute->attribute('id')), 'from_page' => $redirectionURI, 'cancel_page' => $redirectionURI, 'persistent_data' => array('HasObjectInput' => 0)), $module);
             break;
         case 'remove_item':
             $page = $contentObjectAttribute->content();
             $zone = $page->getZone($params[1]);
             $block = $zone->getBlock($params[2]);
             $deleteItemIDArray = $http->postVariable('DeleteItemIDArray');
             if ($block->getItemCount() > 0) {
                 foreach ($block->attribute('items') as $itemID => $item) {
                     foreach ($deleteItemIDArray as $index => $deleteItemID) {
                         if ($item->attribute('object_id') == $deleteItemID) {
                             if ($item->toBeAdded()) {
                                 $block->removeItem($itemID);
                                 unset($deleteItemIDArray[$index]);
                             } elseif ($item->toBeModified()) {
                                 $block->removeItem($itemID);
                             }
                         }
                     }
                 }
             }
             foreach ($deleteItemIDArray as $deleteItemID) {
                 $item = $block->addItem(new eZPageBlockItem());
                 $item->setAttribute('object_id', $deleteItemID);
                 $item->setAttribute('action', 'remove');
             }
             break;
         default:
             break;
     }
 }
    $rssImport->remove();
    return $Module->redirectTo( '/rss/list' );
}
else if ( $Module->isCurrentAction( 'BrowseDestination' ) )
{
    storeRSSImport( $rssImport, $http );
    return eZContentBrowse::browse( array( 'action_name' => 'RSSObjectBrowse',
                                           'description_template' => 'design:rss/browse_destination.tpl',
                                           'from_page' => '/rss/edit_import/'.$rssImportID.'/destination' ),
                                    $Module );
}
else if ( $Module->isCurrentAction( 'BrowseUser' ) )
{
    storeRSSImport( $rssImport, $http );
    return eZContentBrowse::browse( array( 'action_name' => 'RSSUserBrowse',
                                           'description_template' => 'design:rss/browse_user.tpl',
                                           'from_page' => '/rss/edit_import/'.$rssImportID.'/user' ),
                                    $Module );
}

// Check if coming from browse, if so store result
if ( isset( $Params['BrowseType'] ) )
{
    switch ( $Params['BrowseType'] )
    {
        case 'destination': // Returning from destination browse
        {
            $nodeIDArray = $http->hasPostVariable( 'SelectedNodeIDArray' ) ? $http->postVariable( 'SelectedNodeIDArray' ) : null;
            if ( isset( $nodeIDArray ) && !$http->hasPostVariable( 'BrowseCancelButton' ) )
            {
                $rssImport->setAttribute( 'destination_node_id', $nodeIDArray[0] );
                $rssImport->store();
Example #17
0
        $db = eZDB::instance();
        $db->begin();
        foreach ($deleteIDArray as $deleteID) {
            eZRole::removeRole($deleteID);
        }
        // Clear role caches.
        eZRole::expireCache();
        // Clear all content cache.
        eZContentCacheManager::clearAllContentCache();
        $db->commit();
    }
}
// Redirect to content node browse in the user tree
// Assign the role for a user or group
if ($Module->isCurrentAction('AssignRole')) {
    $selectedObjectIDArray = eZContentBrowse::result('AssignRole');
    foreach ($selectedObjectIDArray as $objectID) {
        $role->assignToUser($objectID);
    }
    // Clear role caches.
    eZRole::expireCache();
    // Clear all content cache.
    eZContentCacheManager::clearAllContentCache();
}
if ($http->hasPostVariable('NewButton')) {
    $role = eZRole::createNew();
    return $Module->redirectToView('edit', array($role->attribute('id')));
}
$viewParameters = array('offset' => $offset);
$tpl = eZTemplate::factory();
$roles = eZRole::fetchByOffset($offset, $limit, $asObject = true, $ignoreTemp = true);
Example #18
0
if ($module->isCurrentAction('Confirm')) {
    $type = $module->actionParameter('RestoreType');
    if ($type == 1) {
        $selectedNodeIDArray = array($location->attribute('parent_node'));
        $module->setCurrentAction('AddLocation');
    } elseif ($type == 2) {
        $languageCode = $object->attribute('initial_language_code');
        eZContentBrowse::browse(array('action_name' => 'AddNodeAssignment', 'description_template' => 'design:content/browse_placement.tpl', 'keys' => array('class' => $class->attribute('id'), 'class_id' => $class->attribute('identifier'), 'classgroup' => $class->attribute('ingroup_id_list'), 'section' => $object->attribute('section_id')), 'ignore_nodes_select' => array(), 'ignore_nodes_click' => array(), 'persistent_data' => array('ContentObjectID' => $objectID, 'AddLocationAction' => '1'), 'content' => array('object_id' => $objectID, 'object_version' => $version->attribute('version'), 'object_language' => $languageCode), 'cancel_page' => '/content/trash/', 'from_page' => "/content/restore/" . $objectID), $module);
        return;
    }
}
if ($module->isCurrentAction('AddLocation')) {
    // If $selectedNodeIDArray is already set then use it as it is,
    // if not get the browse data.
    if (!isset($selectedNodeIDArray)) {
        $selectedNodeIDArray = eZContentBrowse::result('AddNodeAssignment');
        if (!$selectedNodeIDArray) {
            return $module->redirectToView('trash');
        }
    }
    $db = eZDB::instance();
    $db->begin();
    $locationAdded = false;
    $mainNodeID = false;
    $newLocationList = array();
    $failedLocationList = array();
    foreach ($selectedNodeIDArray as $selectedNodeID) {
        $parentNode = eZContentObjectTreeNode::fetch($selectedNodeID);
        $parentNodeObject = $parentNode->attribute('object');
        $canCreate = $parentNode->checkAccess('create', $class->attribute('id'), $parentNodeObject->attribute('contentclass_id')) == 1;
        if ($canCreate) {
Example #19
0
     }
 }
 else
 {
     // Redirect to content node browse
     $classList = $currentUser->canAssignSectionToClassList( $SectionID );
     if ( count( $classList ) > 0 )
     {
         if ( in_array( '*', $classList ) )
         {
             $classList = false;
         }
         eZContentBrowse::browse( array( 'action_name' => 'AssignSection',
                                         'keys' => array(),
                                         'description_template' => 'design:section/browse_assign.tpl',
                                         'content' => array( 'section_id' => $SectionID ),
                                         'from_page' => '/section/assign/' . $SectionID . "/",
                                         'cancel_page' => '/section/list',
                                         'class_array' => $classList ),
                                  $Module );
         return;
     }
     else
     {
         $tpl = eZTemplate::factory();
         $tpl->setVariable( 'section_name', $section->attribute( 'name' ) );
         $tpl->setVariable( 'error_number', 2 );
         $Result = array();
         $Result['content'] = $tpl->fetch( "design:section/assign_notification.tpl" );
         $Result['path'] = array( array( 'url' => false,
                                         'text' => ezpI18n::tr( 'kernel/section', 'Sections' ) ),
                                  array( 'url' => false,
 static function browse($parameters = array(), &$module)
 {
     $ini = eZINI::instance('browse.ini');
     if (!isset($parameters['action_name'])) {
         $parameters['action_name'] = $ini->variable('BrowseSettings', 'DefaultActionName');
     }
     if (!isset($parameters['type'])) {
         $parameters['type'] = $parameters['action_name'];
     }
     //$ini->variable( $parameters['action_name'], 'BrowseType' );
     if (!isset($parameters['selection'])) {
         if ($ini->hasVariable($parameters['type'], 'SelectionType')) {
             $parameters['selection'] = $ini->variable($parameters['type'], 'SelectionType');
         } else {
             $parameters['selection'] = $ini->variable('BrowseSettings', 'DefaultSelectionType');
         }
     }
     if (!isset($parameters['return_type'])) {
         if ($ini->hasVariable($parameters['type'], 'ReturnType')) {
             $parameters['return_type'] = $ini->variable($parameters['type'], 'ReturnType');
         } else {
             $parameters['return_type'] = $ini->variable('BrowseSettings', 'DefaultReturnType');
         }
     }
     if (!isset($parameters['browse_custom_action'])) {
         $parameters['browse_custom_action'] = false;
     }
     if (!isset($parameters['custom_action_data'])) {
         $parameters['custom_action_data'] = false;
     }
     if (!isset($parameters['description_template'])) {
         $parameters['description_template'] = false;
     }
     if (!isset($parameters['start_node'])) {
         $parameters['start_node'] = $ini->variable($parameters['type'], 'StartNode');
     }
     if (!isset($parameters['ignore_nodes_select'])) {
         $parameters['ignore_nodes_select'] = array();
     }
     if (!isset($parameters['ignore_nodes_select_subtree'])) {
         $parameters['ignore_nodes_select_subtree'] = array();
     }
     if (!isset($parameters['ignore_nodes_click'])) {
         $parameters['ignore_nodes_click'] = array();
     }
     if (!isset($parameters['class_array'])) {
         if ($ini->hasVariable($parameters['type'], 'Class')) {
             $parameters['class_array'] = $ini->variable($parameters['type'], 'Class');
         } else {
             $parameters['class_array'] = false;
         }
     }
     if (isset($parameters['keys'])) {
         $overrideStartNode = false;
         foreach ($parameters['keys'] as $key => $keyValue) {
             $variableName = 'StartNode_' . $key;
             if (!$ini->hasVariable($parameters['type'], $variableName)) {
                 continue;
             }
             $keyData = $ini->variable($parameters['type'], $variableName);
             if (is_array($keyValue)) {
                 foreach ($keyValue as $keySubValue) {
                     if (isset($keyData[$keySubValue])) {
                         $overrideStartNode = $keyData[$keySubValue];
                     }
                 }
             } else {
                 if (isset($keyData[$keyValue])) {
                     $overrideStartNode = $keyData[$keyValue];
                 }
             }
             if ($overrideStartNode) {
                 break;
             }
         }
         if ($overrideStartNode) {
             $parameters['start_node'] = $overrideStartNode;
         }
     }
     if (!isset($parameters['persistent_data'])) {
         $parameters['persistent_data'] = false;
     }
     if (!isset($parameters['permission'])) {
         $parameters['permission'] = false;
     }
     if (!isset($parameters['top_level_nodes'])) {
         $parameters['top_level_nodes'] = $ini->variable('BrowseSettings', 'DefaultTopLevelNodes');
         if ($ini->hasVariable($parameters['type'], 'TopLevelNodes')) {
             $parameters['top_level_nodes'] = $ini->variable($parameters['type'], 'TopLevelNodes');
         }
     }
     if (!is_numeric($parameters['start_node'])) {
         $parameters['start_node'] = eZContentBrowse::nodeAliasID($parameters['start_node']);
     }
     for ($i = 0; $i < count($parameters['top_level_nodes']); $i++) {
         if (!is_numeric($parameters['top_level_nodes'][$i])) {
             $parameters['top_level_nodes'][$i] = eZContentBrowse::nodeAliasID($parameters['top_level_nodes'][$i]);
         }
     }
     if (!isset($parameters['cancel_page'])) {
         $parameters['cancel_page'] = false;
     }
     if (!isset($parameters['from_page'])) {
         eZDebug::writeError($parameters, 'eZContentBrowse::browse() $parameters[\'from_page\'] is not set');
     }
     $http = eZHTTPTool::instance();
     $http->setSessionVariable('BrowseParameters', $parameters);
     if ($module === null) {
         return "/content/browse/";
     } else {
         $module->redirectTo("/content/browse/");
         return "/content/browse/";
     }
 }
Example #21
0
function checkNodeActions( $module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
{
    // If the object has been previously published we do not allow node assignment operations
    if ( $object->attribute( 'status' ) != eZContentObject::STATUS_DRAFT )
    {
        if ( !$module->isCurrentAction( 'BrowseForPrimaryNodes' ) )
        {
            return;
        }
    }

    $http = eZHTTPTool::instance();

    if ( $module->isCurrentAction( 'BrowseForNodes' ) ||
         $module->isCurrentAction( 'BrowseForPrimaryNodes' ) )
    {
        // Remove custom actions from attribute editing.
        $http->removeSessionVariable( 'BrowseCustomAction' );

        $ignoreNodesSelect = array();
        $ignoreNodesClick  = array();
        $assigned = $version->nodeAssignments();
        $publishedAssigned = $object->assignedNodes( false );
        $isTopLevel = false;
        foreach ( $publishedAssigned as $element )
        {
            $append = false;
            if ( $element['parent_node_id'] == 1 )
                $isTopLevel = true;
            foreach ( $assigned as $ass )
            {
                if ( $ass->attribute( 'parent_node' ) == $element['parent_node_id'] )
                    $append = true;
            }

            /* If the current version (draft) has no assigned nodes then
             * we should disallow adding assignments under nodes
             * the previous published version is assignned to.
             * Thus we avoid fatal errors in eZ Publish.
             */
            if ( count($assigned) == 0 )
            {
                $ignoreNodesSelect[] = $element['node_id'];
                $ignoreNodesClick[]  = $element['node_id'];
            }

            if ( $append )
            {
                $ignoreNodesSelect[] = $element['node_id'];
                $ignoreNodesClick[]  = $element['node_id'];
                $ignoreNodesSelect[] = $element['parent_node_id'];
            }
        }
        if ( !$isTopLevel )
        {
            $ignoreNodesSelect = array_unique( $ignoreNodesSelect );
            $objectID = $object->attribute( 'id' );
            $action = 'AddNodeAssignment';
            if ( $module->isCurrentAction( 'BrowseForPrimaryNodes' ) )
            {
                $action = 'AddPrimaryNodeAssignment';
            }
            eZContentBrowse::browse( array( 'action_name' => $action,
                                            'description_template' => 'design:content/browse_placement.tpl',
                                            'keys' => array( 'class' => $class->attribute( 'id' ),
                                                             'class_id' => $class->attribute( 'identifier' ),
                                                             'classgroup' => $class->attribute( 'ingroup_id_list' ),
                                                             'section' => $object->attribute( 'section_id' ) ),
                                            'ignore_nodes_select' => $ignoreNodesSelect,
                                            'ignore_nodes_click'  => $ignoreNodesClick,
                                            'content' => array( 'object_id' => $objectID,
                                                                'object_version' => $editVersion,
                                                                'object_language' => $editLanguage ),
                                            'from_page' => "/content/edit/$objectID/$editVersion/$editLanguage/$fromLanguage" ),
                                     $module );

            return eZModule::HOOK_STATUS_CANCEL_RUN;
        }
    }

    // If node assignment handling is diabled we return
    $useNodeAssigments = true;
    if ( $http->hasPostVariable( 'UseNodeAssigments' ) )
        $useNodeAssigments = (bool)$http->postVariable( 'UseNodeAssigments' );

    if ( !$useNodeAssigments )
        return;

    // Remove custom actions from attribute editing.
    $http->removeSessionVariable( 'BrowseCustomAction' );

    if ( $module->isCurrentAction( 'ConfirmAssignmentDelete' ) && $http->hasPostVariable( 'RemoveNodeID' ) )
    {
        $nodeID = $http->postVariable( 'RemoveNodeID' );
        $db = eZDB::instance();
        $db->begin();
        $version->removeAssignment( $nodeID );
        $db->commit();
    }

    if ( $module->isCurrentAction( 'DeleteNode' ) )
    {

        if ( $http->hasPostVariable( 'RemoveNodeID' ) )
        {
            $nodeID = $http->postVariable( 'RemoveNodeID' );
        }

        $mainNodeID = $http->postVariable( 'MainNodeID' );

//         if ( $nodeID != $mainNodeID )
        {
            $objectID = $object->attribute( 'id' );
            $publishedNode = eZContentObjectTreeNode::fetchNode( $objectID, $nodeID );
            if ( $publishedNode != null )
            {
                $publishParentNodeID = $publishedNode->attribute( 'parent_node_id' );
                if ( $publishParentNodeID > 1 )
                {
                    $childrenCount = $publishedNode->childrenCount();
                    if ( $childrenCount != 0 )
                    {
                        $module->redirectToView( 'removenode', array( $objectID, $editVersion, $editLanguage, $nodeID ) );
                        return eZModule::HOOK_STATUS_CANCEL_RUN;
                    }
                    else
                    {
                        $db = eZDB::instance();
                        $db->begin();
                        $version->removeAssignment( $nodeID );
                        $db->commit();
                    }
                }
            }
            else
            {
                $nodeAssignment = eZNodeAssignment::fetch( $objectID, $version->attribute( 'version' ), $nodeID );
                if ( $nodeAssignment->attribute( 'from_node_id' ) != 0 )
                {
                    $publishedNode = eZContentObjectTreeNode::fetchNode( $objectID, $nodeAssignment->attribute( 'from_node_id' ) );
                    $childrenCount = 0;
                    if ( $publishedNode !== null )
                        $childrenCount = $publishedNode->childrenCount();
                    if ( $childrenCount != 0 )
                    {
                        $module->redirectToView( 'removenode', array( $objectID, $editVersion, $editLanguage, $nodeID ) );
                        return eZModule::HOOK_STATUS_CANCEL_RUN;
                    }
                }
                $db = eZDB::instance();
                $db->begin();
                $version->removeAssignment( $nodeID );
                $db->commit();
            }
        }
    }

    if ( $module->isCurrentAction( 'RemoveAssignments' ) )
    {
        if( $http->hasPostVariable( 'AssignmentIDSelection' ) )
        {
            $selected       = $http->postVariable( 'AssignmentIDSelection' );
            $objectID       = $object->attribute( 'id' );
            $versionInt     = $version->attribute( 'version' );
            $hasChildren    = false;
            $assignmentsIDs = array();
            $assignments    = array();

            // Determine if at least one node of ones we remove assignments for has children.
            foreach ( $selected as $parentNodeID )
            {
                $assignment = eZNodeAssignment::fetch( $objectID, $versionInt, $parentNodeID );
                if( !$assignment )
                {
                    eZDebug::writeWarning( "No assignment found for object $objectID version $versionInt, parent node $parentNodeID" );
                    continue;
                }

                $assignmentID     =  $assignment->attribute( 'id' );
                $assignmentsIDs[] =  $assignmentID;
                $assignments[]    = $assignment;
                $node             = $assignment->attribute( 'node' );

                if( !$node )
                    continue;

                if( $node->childrenCount( false ) > 0 )
                    $hasChildren = true;

                unset( $assignment );
            }

            if ( $hasChildren )
            {
                // We need user confirmation if at least one node we want to remove assignment for contains children.
                // Aactual removal is done in content/removeassignment in this case.
                $http->setSessionVariable( 'AssignmentRemoveData',
                                           array( 'remove_list'   => $assignmentsIDs,
                                                  'object_id'     => $objectID,
                                                  'edit_version'  => $versionInt,
                                                  'edit_language' => $editLanguage,
                                                  'from_language' => $fromLanguage ) );
                $module->redirectToView( 'removeassignment' );
                return eZModule::HOOK_STATUS_CANCEL_RUN;

            }
            else
            {
                // Just remove all the selected locations.
                $mainNodeChanged = false;
                $db = eZDB::instance();
                $db->begin();
                foreach ( $assignments as $assignment )
                {
                    $assignmentID = $assignment->attribute( 'id' );
                    if ( $assignment->attribute( 'is_main' ) )
                        $mainNodeChanged = true;
                    eZNodeAssignment::removeByID( $assignmentID );
                }
                if ( $mainNodeChanged )
                    eZNodeAssignment::setNewMainAssignment( $objectID, $versionInt );
                $db->commit();
                unset( $mainNodeChanged );
            }
            unset( $assignmentsIDs, $assignments );

        }
        else
        {
            eZDebug::writeNotice( 'No nodes to remove selected' );
        }
    }

    if ( $module->isCurrentAction( 'MoveNode' ) )
    {
        $objectID = $object->attribute( 'id' );
        if ( $http->hasPostVariable( 'MoveNodeID' ) )
        {
            $fromNodeID = $http->postVariable( 'MoveNodeID' ); //$sourceNodeID[0];
            $oldAssignmentParentID = $fromNodeID;
            $fromNodeAssignment = eZNodeAssignment::fetch( $objectID, $version->attribute( 'version' ), $fromNodeID );
            $publishParentNodeID = $fromNodeAssignment->attribute( 'parent_node' );
            if ( $publishParentNodeID > 1 )
            {
                if( $fromNodeAssignment->attribute( 'from_node_id' ) != 0 )
                {
                    $fromNodeID = $fromNodeAssignment->attribute( 'from_node_id' );
                    $oldAssignmentParentID = $fromNodeAssignment->attribute( 'parent_node' );
                }

                // we don't allow moving object to itself, to its descendants or parent object(s)
                $objectAssignedNodes = $object->attribute( 'assigned_nodes' );

                // nodes that are not allowed to select (via checkbox or radiobutton) when browsing
                $ignoreNodesSelectArray = array();

                // nodes that are not allowed to click on
                $ignoreNodesClickArray  = array();
                foreach( $objectAssignedNodes as $curAN )
                {
                    // current node should be neither selectable, nor clickable
                    $ignoreNodesClickArray[]  = $curAN->NodeID;
                    $ignoreNodesSelectArray[] = $curAN->NodeID;

                    // parent node should be only clickable, but not selectable
                    $ignoreNodesSelectArray[] = $curAN->ParentNodeID;
                }

                eZContentBrowse::browse( array( 'action_name' => 'MoveNodeAssignment',
                                                'description_template' => 'design:content/browse_move_placement.tpl',
                                                'keys' => array( 'class' => $class->attribute( 'id' ),
                                                                 'class_id' => $class->attribute( 'identifier' ),
                                                                 'classgroup' => $class->attribute( 'ingroup_id_list' ),
                                                                 'section' => $object->attribute( 'section_id' ) ),
                                                'start_node' => $fromNodeID,
                                                'persistent_data' => array( 'FromNodeID' => $fromNodeID,
                                                                            'OldAssignmentParentID' => $oldAssignmentParentID ),
                        'ignore_nodes_select' => $ignoreNodesSelectArray,
                        'ignore_nodes_click'  => $ignoreNodesClickArray,
                                                'content' => array( 'object_id' => $objectID,
                                                                    'previous_node_id' => $fromNodeID,
                                                                    'object_version' => $editVersion,
                                                                    'object_language' => $editLanguage ),
                                                'from_page' => "/content/edit/$objectID/$editVersion/$editLanguage" ),
                                         $module );

                return eZModule::HOOK_STATUS_CANCEL_RUN;
            }
        }
    }
}
    }
    if (isset($Params['BrowseSelected']) && $Params['BrowseSelected'] == $selectName) {
        if ($http->hasPostVariable('SelectedObjectIDArray')) {
            $relatedObjectID = $http->postVariable('SelectedObjectIDArray');
            if (isset($relatedObjectID) && !$http->hasPostVariable('BrowseCancelButton')) {
                $newsletterType->setAttribute($attributeName, $relatedObjectID[0]);
                $newsletterType->store();
            }
        }
    }
}
if ($http->hasPostVariable('BrowseArticlePool')) {
    eZContentBrowse::browse(array('action_name' => 'ArticlePoolBrowse', 'keys' => array(), 'description_template' => "design:{$extension}/browse_article_pool.tpl", 'from_page' => 'newsletter/edit_type/' . $newsletterTypeID . '/article'), $Module);
} else {
    if ($http->hasPostVariable('BrowseInbox')) {
        eZContentBrowse::browse(array('action_name' => 'BrowseInbox', 'keys' => array(), 'description_template' => "design:{$extension}/browse_article_pool.tpl", 'from_page' => 'newsletter/edit_type/' . $newsletterTypeID . '/inbox'), $Module);
    }
}
if ($http->hasPostVariable('DeleteArticlePool')) {
    $newsletterType->setAttribute('article_pool_object_id', 0);
    $newsletterType->store('article_pool_object_id');
} else {
    if ($http->hasPostVariable('DeleteInbox')) {
        $newsletterType->setAttribute('inbox_id', 0);
        $newsletterType->store('inbox_id');
    }
}
if (isset($Params['BrowseSelected']) && $Params['BrowseSelected'] == 'article') {
    if ($http->hasPostVariable('SelectedObjectIDArray')) {
        $articlePoolNodeID = $http->postVariable('SelectedObjectIDArray');
        if (isset($articlePoolNodeID) && !$http->hasPostVariable('BrowseCancelButton')) {
        $discountRuleName = ezpI18n::tr( 'design/admin/shop/discountruleedit', 'New discount rule' );
        $discountRulePercent = 0.0;
        $discountRuleSelectedClasses = array( -1 );
        $discountRuleSelectedSections = array( -1 );
        $discountRuleSelectedProducts = array();

        $discountRule = array( 'id' => 0,
                               'name' => $discountRuleName,
                               'discount_percent' => $discountRulePercent );
    }
}

if ( $module->isCurrentAction( 'FindProduct' ) )
{
    // returning from browse; add products to product list
    $result = eZContentBrowse::result( 'FindProduct' );
    if ( $result )
    {
        $discountRuleSelectedProducts = array_merge( $discountRuleSelectedProducts, $result );
        $discountRuleSelectedProducts = array_unique( $discountRuleSelectedProducts );
    }
}

if ( $http->hasPostVariable( 'DeleteProductButton' ) )
{
    // remove products from list:
    if ( $http->hasPostVariable( 'DeleteProductIDArray' ) )
    {
        $deletedIDList = $http->postVariable( 'DeleteProductIDArray' );
        $arrayKeys = array_keys( $discountRuleSelectedProducts );
    function initializeTopNodes( $package, $http, $step, &$persistentData, $tpl, $module )
    {
        if ( !isset( $persistentData['top_nodes_map'] ) )
        {
            $persistentData['top_nodes_map'] = array();
            $rootDOMNode = $this->rootDOMNode();
            $topNodeListNode = $rootDOMNode->getElementsByTagName( 'top-node-list' )->item( 0 );

            $ini = eZINI::instance( 'content.ini' );
            $defaultPlacementNodeID = $ini->variable( 'NodeSettings', 'RootNode' );
            $defaultPlacementNode = eZContentObjectTreeNode::fetch( $defaultPlacementNodeID );
            $defaultPlacementName = $defaultPlacementNode->attribute( 'name' );
            foreach ( $topNodeListNode->getElementsByTagName( 'top-node' ) as $topNodeDOMNode )
            {
                $persistentData['top_nodes_map'][(string)$topNodeDOMNode->getAttribute( 'node-id' )] = array( 'old_node_id' => $topNodeDOMNode->getAttribute( 'node-id' ),
                                                                                                                'name' => $topNodeDOMNode->textContent,
                                                                                                                'new_node_id' => $defaultPlacementNodeID,
                                                                                                                'new_parent_name' => $defaultPlacementName );
            }
        }

        foreach( array_keys( $persistentData['top_nodes_map'] ) as $topNodeArrayKey )
        {
            if ( $http->hasPostVariable( 'BrowseNode_' . $topNodeArrayKey ) )
            {
                eZContentBrowse::browse( array( 'action_name' => 'SelectObjectRelationNode',
                                                'description_template' => 'design:package/installers/ezcontentobject/browse_topnode.tpl',
                                                'from_page' => '/package/install',
                                                'persistent_data' => array( 'PackageStep' => $http->postVariable( 'PackageStep' ),
                                                                            'InstallerType' => $http->postVariable( 'InstallerType' ),
                                                                            'InstallStepID' => $http->postVariable( 'InstallStepID' ),
                                                                            'ReturnBrowse_' . $topNodeArrayKey => 1 ) ),
                                         $module );
            }
            else if ( $http->hasPostVariable( 'ReturnBrowse_' . $topNodeArrayKey ) && !$http->hasPostVariable( 'BrowseCancelButton' ) )
            {
                $nodeIDArray = $http->postVariable( 'SelectedNodeIDArray' );
                if ( $nodeIDArray != null )
                {
                    $persistentData['top_nodes_map'][$topNodeArrayKey]['new_node_id'] = $nodeIDArray[0];
                    $contentNode = eZContentObjectTreeNode::fetch( $nodeIDArray[0] );
                    $persistentData['top_nodes_map'][$topNodeArrayKey]['new_parent_name'] = $contentNode->attribute( 'name' );
                }
            }
        }

        $tpl->setVariable( 'top_nodes_map', $persistentData['top_nodes_map'] );
    }
Example #25
0
        }
    }
    $iniAppend->setVariable("Toolbar_" . $toolbarPosition, "Tool", $updatedToolArray);
    $succeed = $iniAppend->save(false, false, false, false, true, true);
    if ($currentAction == 'Browse') {
        $browseArray = $http->postVariable('BrowseButton');
        if (preg_match("/_node\$/", key($browseArray))) {
            if (preg_match("/(.+)_parameter_(.+)/", key($browseArray), $res)) {
                eZContentBrowse::browse(array('action_name' => 'SelectToolbarNode', 'description_template' => false, 'persistent_data' => array('tool_index' => $res[1], 'parameter_name' => $res[2]), 'from_page' => "/visual/toolbar/{$currentSiteAccess}/{$toolbarPosition}/"), $module);
                removeRelatedCache($currentSiteAccess);
                return;
            }
        } else {
            if (preg_match("/_subtree\$/", key($browseArray))) {
                if (preg_match("/(.+)_parameter_(.+)/", key($browseArray), $res)) {
                    eZContentBrowse::browse(array('action_name' => 'SelectToolbarNodePath', 'description_template' => false, 'persistent_data' => array('tool_index' => $res[1], 'parameter_name' => $res[2]), 'from_page' => "/visual/toolbar/{$currentSiteAccess}/{$toolbarPosition}/"), $module);
                    removeRelatedCache($currentSiteAccess);
                    return;
                }
            }
        }
    }
    $toolArray = $updatedToolArray;
    $removeCache = true;
} elseif ($currentAction == 'Store') {
    $storeList = true;
    $removeCache = true;
    $checkCurrAction = true;
}
$toolList = array();
foreach (array_keys($toolArray) as $toolKey) {
Example #26
0
$http = eZHTTPTool::instance();
$Offset = $Params['Offset'];
if (!is_numeric($Offset)) {
    $Offset = 0;
}
$parents = array();
// Make sure user has session (if not, then this can't possible be a valid browse request)
if (!eZSession::userHasSessionCookie()) {
    return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
// Check that Browse parameters exists
if (!$http->hasSessionVariable('BrowseParameters')) {
    return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
}
// Check if node parameters exist
$browse = new eZContentBrowse();
if (!isset($Params['NodeID']) && !isset($Params['NodeList']) && !$browse->hasAttribute('start_node')) {
    return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
}
// We get node list when browse is execiuted from search engine ( "search in browse" functionality )
if (isset($Params['NodeList'])) {
    $nodeList = $Params['NodeList']['SearchResult'];
    $nodeListCount = $Params['NodeList']['SearchCount'];
    $requestedURI = $Params['NodeList']['RequestedURI'];
    $requestedURISuffix = $Params['NodeList']['RequestedURISuffix'];
    if (isset($Params['NodeID']) && is_numeric($Params['NodeID'])) {
        $NodeID = $Params['NodeID'];
    }
} else {
    if (isset($Params['NodeID']) && is_numeric($Params['NodeID'])) {
        $NodeID = $Params['NodeID'];
Example #27
0
            if (is_string($limitIdent) && !isset($limitValue)) {
                switch ($limitIdent) {
                    case 'subtree':
                        eZContentBrowse::browse(array('action_name' => 'SelectObjectRelationNode', 'from_page' => '/role/assign/' . $roleID . '/' . $limitIdent, 'cancel_page' => '/role/view/' . $roleID), $Module);
                        return;
                        break;
                    case 'section':
                        $sectionArray = eZSection::fetchList();
                        $tpl = eZTemplate::factory();
                        $tpl->setVariable('section_array', $sectionArray);
                        $tpl->setVariable('role_id', $roleID);
                        $tpl->setVariable('limit_ident', $limitIdent);
                        $Result = array();
                        $Result['content'] = $tpl->fetch('design:role/assign_limited_section.tpl');
                        $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/role', 'Limit on section')));
                        return;
                        break;
                    default:
                        eZDebug::writeWarning('Unsupported assign limitation: ' . $limitIdent);
                        $Module->redirectTo('/role/view/' . $roleID);
                        break;
                }
            } else {
                if (is_numeric($roleID)) {
                    eZContentBrowse::browse(array('action_name' => 'AssignRole', 'from_page' => '/role/assign/' . $roleID . '/' . $limitIdent . '/' . $limitValue, 'cancel_page' => '/role/view/' . $roleID), $Module);
                    return;
                }
            }
        }
    }
}
Example #28
0
                     $policyLimitation = eZPolicyLimitation::createNew($policy->attribute('id'), $functionLimitation['name']);
                     eZDebugSetting::writeDebug('kernel-role-edit', $policyLimitation, 'policyLimitationCreated');
                     foreach ($limitationValues as $limitationValue) {
                         eZPolicyLimitationValue::createNew($policyLimitation->attribute('id'), $limitationValue);
                     }
                 }
             }
         }
     }
     $db->commit();
     $http->setSessionVariable('BrowseCurrentModule', $currentModule);
     $http->setSessionVariable('BrowseCurrentFunction', $currentFunction);
     if ($http->hasPostVariable('BrowseLimitationSubtreeButton')) {
         eZContentBrowse::browse(array('action_name' => 'FindLimitationSubtree', 'from_page' => '/role/edit/' . $roleID . '/'), $Module);
     } elseif ($http->hasPostVariable('BrowseLimitationNodeButton')) {
         eZContentBrowse::browse(array('action_name' => 'FindLimitationNode', 'from_page' => '/role/edit/' . $roleID . '/'), $Module);
     }
     return;
 }
 if ($http->hasPostVariable('SelectedNodeIDArray') and $http->postVariable('BrowseActionName') == 'FindLimitationNode' and !$http->hasPostVariable('BrowseCancelButton')) {
     $selectedNodeIDList = $http->postVariable('SelectedNodeIDArray');
     if ($http->hasSessionVariable('BrowsePolicyID')) {
         $policy = eZPolicy::fetch($http->sessionVariable('BrowsePolicyID'));
         $limitationList = eZPolicyLimitation::fetchByPolicyID($policy->attribute('id'));
         // Remove other limitations. When the policy is applied to node, no other constraints needed.
         // Removes limitations only from a DropList if it is specified in the module.
         if (isset($currentFunctionLimitations['Node']['DropList'])) {
             $dropList = $currentFunctionLimitations['Node']['DropList'];
             foreach ($limitationList as $limitation) {
                 $limitationID = $limitation->attribute('id');
                 $limitationIdentifier = $limitation->attribute('identifier');
Example #29
0
    function customWorkflowEventHTTPAction( $http, $action, $workflowEvent )
    {
        $eventID = $workflowEvent->attribute( "id" );
        $module =& $GLOBALS['eZRequestedModule'];
        //$siteIni = eZINI::instance();
        switch ( $action )
        {
            case 'AddApproveUsers' :
            {
                $userClassNames = eZUser::fetchUserClassNames();
                if ( count( $userClassNames ) > 0 )
                {
                    eZContentBrowse::browse( array( 'action_name' => 'SelectMultipleUsers',
                                                    'from_page' => '/workflow/edit/' . $workflowEvent->attribute( 'workflow_id' ),
                                                    'custom_action_data' => array( 'event_id' => $eventID,
                                                                                   'browse_action' => $action ),
                                                    'class_array' => $userClassNames ),
                                             $module );
                }
            } break;

            case 'RemoveApproveUsers' :
            {
                if ( $http->hasPostVariable( 'DeleteApproveUserIDArray_' . $eventID ) )
                {
                    $workflowEvent->setAttribute( 'data_text3', implode( ',', array_diff( $this->attributeDecoder( $workflowEvent, 'approve_users' ),
                                                                                          $http->postVariable( 'DeleteApproveUserIDArray_' . $eventID ) ) ) );
                }
            } break;

            case 'AddApproveGroups' :
            case 'AddExcludeUser' :
            {
                $groupClassNames = eZUser::fetchUserGroupClassNames();
                if ( count( $groupClassNames ) > 0 )
                {
                    eZContentBrowse::browse( array( 'action_name' => 'SelectMultipleUsers',
                                                    'from_page' => '/workflow/edit/' . $workflowEvent->attribute( 'workflow_id' ),
                                                    'custom_action_data' => array( 'event_id' => $eventID,
                                                                                   'browse_action' => $action ),
                                                    'class_array' => $groupClassNames ),
                                             $module );
                }
            } break;

            case 'RemoveApproveGroups' :
            {
                if ( $http->hasPostVariable( 'DeleteApproveGroupIDArray_' . $eventID ) )
                {
                    $workflowEvent->setAttribute( 'data_text4', implode( ',', array_diff( $this->attributeDecoder( $workflowEvent, 'approve_groups' ),
                                                                                          $http->postVariable( 'DeleteApproveGroupIDArray_' . $eventID ) ) ) );
                }
            } break;

            case 'RemoveExcludeUser' :
            {
                if ( $http->hasPostVariable( 'DeleteExcludeUserIDArray_' . $eventID ) )
                {
                    $workflowEvent->setAttribute( 'data_text2', implode( ',', array_diff( $this->attributeDecoder( $workflowEvent, 'selected_usergroups' ),
                                                                                          $http->postVariable( 'DeleteExcludeUserIDArray_' . $eventID ) ) ) );
                }
            } break;

            case 'AddExcludedGroups' :
            {
                // TODO:
                // .....
            } break;

            case 'RemoveExcludedGroups' :
            {
                // TODO:
                // .....
            } break;
        }
    }
Example #30
0
if ( $http->hasPostVariable( 'BrowseLimitationNodeButton' ) )
{
    processDropdownLimitations( $policy, $currentModule, $currentFunction, $currentFunctionLimitations );
    eZContentBrowse::browse( array( 'action_name' => 'FindLimitationNode',
                                    'content' => array( 'policy_id' => $originalPolicyID ),
                                    'from_page' => '/role/policyedit/' . $originalPolicyID ),
                             $Module );
    return;
}

if ( $http->hasPostVariable( 'BrowseLimitationSubtreeButton' ) )
{
    processDropdownLimitations( $policy, $currentModule, $currentFunction, $currentFunctionLimitations );
    eZContentBrowse::browse( array( 'action_name' => 'FindLimitationSubtree',
                                    'content' => array( 'policy_id' => $originalPolicyID ),
                                    'from_page' => '/role/policyedit/' . $originalPolicyID ),
                             $Module );
    return;
}

if ( $http->hasPostVariable( 'SelectedNodeIDArray' ) and
     $http->postVariable( 'BrowseActionName' ) == 'FindLimitationNode' and
     !$http->hasPostVariable( 'BrowseCancelButton' ) )
{
    $db = eZDB::instance();
    $db->begin();
    $limitationList = eZPolicyLimitation::fetchByPolicyID( $policyID );

    // Remove other limitations. When the policy is applied to node, no other constraints needed.
    // Removes limitations only from a DropList if it is specified in the module.
    if ( isset( $currentFunctionLimitations['Node']['DropList'] ) )