protected function processItem(Docman_Item $item)
 {
     $project_id = $item->getGroupId();
     $this->initializeMapping($project_id);
     $this->actions->indexCopiedItem($item);
     return true;
 }
 protected function processItem(Docman_Item $item)
 {
     $project_id = $item->getGroupId();
     if (!$this->actions->checkProjectMappingExists($project_id)) {
         $this->actions->initializeProjetMapping($project_id);
     }
     $wiki_page = $this->getWikiPage($item, $project_id);
     $this->actions->indexNewWikiDocument($item, $wiki_page->getMetadata());
     return true;
 }
コード例 #3
0
 protected function appendItemMetadataNode(DOMElement $node, Docman_Item $item)
 {
     $metaDataFactory = new Docman_MetadataFactory($item->getGroupId());
     $metaDataFactory->appendItemMetadataList($item);
     foreach ($item->getMetadata() as $metadata) {
         $real = $this->getNodeForMetadata($metadata);
         if ($real) {
             $node->appendChild($real);
         }
     }
 }
コード例 #4
0
 private function mappingNeedsToBoUpdated(Docman_Item $item, array $mapping_data)
 {
     return $mapping_data[$item->getGroupId()][ElasticSearch_1_2_RequestDocmanDataFactory::MAPPING_PROPERTIES_KEY] !== array();
 }
コード例 #5
0
 private function getDocmanSerializedParameters(Docman_Item $item, array $additional_params = array())
 {
     return implode(SystemEvent::PARAMETER_SEPARATOR, array_merge(array($item->getGroupId(), $item->getId()), $additional_params));
 }
コード例 #6
0
 private function getCustomDateMetadata(Docman_Item $item)
 {
     $this->metadata_factory->setRealGroupId($item->getGroupId());
     return $this->metadata_factory->getRealMetadataList(false, array(PLUGIN_DOCMAN_METADATA_TYPE_DATE));
 }
コード例 #7
0
 private function getIndexedData(Docman_Item $item, Docman_Version $version)
 {
     return array('id' => $item->getId(), 'group_id' => $item->getGroupId(), 'title' => $item->getTitle(), 'description' => $item->getDescription(), 'permissions' => $this->permissions_manager->exportPermissions($item), 'file' => $this->fileContentEncode($version->getPath()));
 }
コード例 #8
0
 /**
  * Returns ugroups of an item in a human readable format
  *
  * @param Docman_Item $item
  *
  * @return array
  */
 public function exportPermissions(Docman_Item $item)
 {
     $project = ProjectManager::instance()->getProject($item->getGroupId());
     $literalizer = new UGroupLiteralizer();
     $ugroup_ids = $this->getUgroupIdsPermissions($item, $literalizer, $project);
     return $literalizer->ugroupIdsToString($ugroup_ids, $project);
 }
コード例 #9
0
 /**
  * Raise item monitoring list event
  *
  * @param Docman_Item $item Locked item
  * @param String      $eventType
  * @param Array       $subscribers
  *
  * @return void
  */
 function _raiseMonitoringListEvent($item, $subscribers, $eventType)
 {
     $p = array('group_id' => $item->getGroupId(), 'item' => $item, 'listeners' => $subscribers, 'event' => $eventType);
     $this->event_manager->processEvent('plugin_docman_event_subcribers', $p);
 }
コード例 #10
0
ファイル: Reminder.class.php プロジェクト: pombredanne/tuleap
 /**
  * Retrieve project for a given docman item
  *
  * @param Docman_Item $docmanItem The docman item we want to get its project
  *
  * @return Project
  */
 private function getItemProject(Docman_Item $docmanItem)
 {
     $pm = ProjectManager::instance();
     return $pm->getProject($docmanItem->getGroupId());
 }
コード例 #11
0
 /**
  * Build a subtree from the given item id.
  *
  * Build the list in depth, level per level, from root to leaves.
  * 
  * @param Docman_Item $rootItem
  * @param User $user
  * @param boolean $ignorePerms
  * @param boolean $expandAll
  * @param boolean $ignoreObsolete
  * @return Docman_Item
  */
 function &getItemSubTree(&$rootItem, &$user, $ignorePerms = false, $expandAll = false, $ignoreObsolete = true)
 {
     // {{1}} Exclude collapsed items
     $expandedFolders = array();
     if (!$expandAll) {
         $fld = $this->_getExpandedUserPrefs($rootItem->getId(), user_getid());
         foreach ($fld as $v) {
             $expandedFolders[$v] = true;
         }
     }
     $searchItemsParams = array('ignore_obsolete' => $ignoreObsolete);
     //
     // Treatment
     //
     $dao =& $this->_getItemDao();
     $dPm = Docman_PermissionsManager::instance($rootItem->getGroupId());
     $itemList = array($rootItem->getId() => &$rootItem);
     $parentIds = array($rootItem->getId());
     do {
         // Fetch all children for the given level.
         $dar = $dao->searchChildren($parentIds, $searchItemsParams);
         $parentIds = array();
         $itemIds = array();
         $itemRows = array();
         if ($dar && !$dar->isError()) {
             $dar->rewind();
             while ($dar->valid()) {
                 $row = $dar->current();
                 $itemRows[$row['item_id']] = $row;
                 $itemIds[] = $row['item_id'];
                 if ($row['item_type'] == PLUGIN_DOCMAN_ITEM_TYPE_FOLDER && ($expandAll || isset($expandedFolders[$row['item_id']]))) {
                     $parentIds[$row['item_id']] = $row['item_id'];
                 }
                 $dar->next();
             }
             // Fetch all the permissions at the same time
             $dPm->retreiveReadPermissionsForItems($itemIds, $user);
             // Build hierarchy: only keep displayable items
             foreach ($itemIds as $id) {
                 if ($ignorePerms || $dPm->userCanRead($user, $id)) {
                     $itemList[$id] =& $this->getItemFromRow($itemRows[$id]);
                     $itemList[$itemList[$id]->getParentId()]->addItem($itemList[$id]);
                 } else {
                     unset($parentIds[$id]);
                 }
             }
         }
     } while (count($parentIds) > 0);
     return $itemList[$rootItem->getId()];
 }
コード例 #12
0
 /**
  * Logging a version deletion event
  *
  * @param Docman_Item    $item
  * @param User           $user
  *
  * @return void
  */
 function fireDeleteEvent($item, $user)
 {
     $value = $this->getNumber();
     if ($this->getLabel() != '') {
         $value .= ' (' . $this->getLabel() . ')';
     }
     $params = array('group_id' => $item->getGroupId(), 'item' => $item, 'old_value' => $value, 'user' => $user);
     EventManager::instance()->processEvent('plugin_docman_event_del_version', $params);
 }
コード例 #13
0
 /**
  * Returns the list of values that watermark the document
  * 
  * @param Docman_Item $item
  * 
  * @return Array of Docman_MetadataListOfValuesElement
  */
 public function getWatermarkingValues($item)
 {
     if (!isset($this->_watermarkedValues[$item->getId()])) {
         $md = $this->_getWatermarkedMetadata($item->getGroupId());
         $this->_getWatermarkingValues($item, $md);
     }
     return $this->_watermarkedValues[$item->getId()];
 }
コード例 #14
0
 /**
  * Get the JS action for the item/user couple
  * 
  * @param Docman_Item $item
  */
 function getActionForItem($item)
 {
     $js = 'docman.addActionForItem(' . $item->getId() . ', ';
     $params = array();
     $itemMenuVisitor =& new Docman_View_GetMenuItemsVisitor($this->_controller->getUser(), $item->getGroupId());
     $user_actions = $item->accept($itemMenuVisitor, $params);
     $js .= $this->phpArrayToJsArray($user_actions);
     $js .= ");\n";
     return $js;
 }
コード例 #15
0
 private function createSystemEvent($type, $priority, Docman_Item $item, $additional_params = '')
 {
     if ($this->isAllowed($item->getGroupId())) {
         $params = $item->getGroupId() . SystemEvent::PARAMETER_SEPARATOR . $item->getId();
         if ($additional_params) {
             $params .= SystemEvent::PARAMETER_SEPARATOR . $additional_params;
         }
         SystemEventManager::instance()->createEvent($type, $params, $priority);
     }
 }