Ejemplo n.º 1
0
 /**
  * @return string rendered legend box
  */
 function legendBox()
 {
     $output = _("file text");
     foreach ($this->highlightTypeToStringMap as $colorKey => $txt) {
         $output .= '<br/>' . $this->highlightRenderer->createStartSpan($colorKey, $txt) . $txt . '</span>';
     }
     return $output;
 }
Ejemplo n.º 2
0
 /**
  * @brief extends standard Output to handle empty uploads
  */
 function Output()
 {
     if ($this->invalidParm) {
         $this->vars['content'] = 'This upload contains no files!<br><a href="' . Traceback_uri() . '?mod=browse">Go back to browse view</a>';
         return $this->render("include/base.html.twig");
     }
     $uploadId = GetParm("upload", PARM_INTEGER);
     if (empty($uploadId)) {
         return new Response("", Response::HTTP_BAD_REQUEST);
     }
     $uploadTreeId = GetParm("item", PARM_INTEGER);
     if (empty($uploadTreeId)) {
         return new Response("", Response::HTTP_BAD_REQUEST);
     }
     $userId = Auth::getUserId();
     $groupId = Auth::getGroupId();
     $lastItem = GetParm("lastItem", PARM_INTEGER);
     if (!empty($lastItem)) {
         $this->updateLastItem($userId, $groupId, $lastItem);
     }
     $uploadTreeTableName = $this->uploadDao->getUploadtreeTableName($uploadId);
     $itemTreeBounds = $this->uploadDao->getItemTreeBounds($uploadTreeId, $uploadTreeTableName);
     $this->vars['micromenu'] = Dir2Browse('license', $uploadTreeId, NULL, $showBox = 0, "View", -1, '', '', $uploadTreeTableName);
     global $Plugins;
     /** @var ui_view $view */
     $view =& $Plugins[plugin_find_id("view")];
     $licenseId = GetParm("licenseId", PARM_INTEGER);
     $selectedAgentId = GetParm("agentId", PARM_INTEGER);
     $highlightId = GetParm("highlightId", PARM_INTEGER);
     $clearingId = GetParm("clearingId", PARM_INTEGER);
     if ($clearingId !== null) {
         $highlightId = -1;
     } else {
         if ($highlightId !== null) {
             $clearingId = -1;
         }
     }
     $baseUri = Traceback_uri();
     $this->vars['baseuri'] = $baseUri;
     $this->vars['uri'] = $baseUri . "?mod=" . $this->Name . Traceback_parm_keep(array('upload', 'folder'));
     $this->vars['bulkHistoryHighlightUri'] = $this->vars['uri'];
     $this->vars['optionName'] = "skipFile";
     $this->vars['formName'] = "uiClearingForm";
     $this->vars['ajaxAction'] = "setNextPrev";
     $highlights = $this->getSelectedHighlighting($itemTreeBounds, $licenseId, $selectedAgentId, $highlightId, $clearingId, $uploadId);
     $isSingleFile = !$itemTreeBounds->containsFiles();
     $hasWritePermission = $this->uploadDao->isEditable($uploadId, $groupId);
     $clearingDecisions = null;
     if ($isSingleFile || $hasWritePermission) {
         $clearingDecisions = $this->clearingDao->getFileClearings($itemTreeBounds, $groupId, false);
     }
     if ($isSingleFile && $hasWritePermission) {
         $this->vars['bulkUri'] = Traceback_uri() . "?mod=popup-license";
         $licenseArray = $this->licenseDao->getLicenseArray($groupId);
         // $clearingDecision = $this->clearingDao->getRelevantClearingDecision($itemTreeBounds, $groupId);
         list($addedResults, $removedResults) = $this->clearingDecisionEventProcessor->getCurrentClearings($itemTreeBounds, $groupId, LicenseMap::CONCLUSION);
         if (count($addedResults) + count($removedResults) > 0) {
             array_unshift($licenseArray, array('id' => 0, 'fullname' => '', 'shortname' => '------'));
         }
         /** @var ClearingResult $result */
         foreach ($removedResults as $result) {
             array_unshift($licenseArray, array('id' => $result->getLicenseId(), 'fullname' => $result->getLicenseFullName(), 'shortname' => $result->getLicenseShortName()));
         }
         /** @var ClearingResult $result */
         foreach ($addedResults as $result) {
             array_unshift($licenseArray, array('id' => $result->getLicenseId(), 'fullname' => $result->getLicenseFullName(), 'shortname' => $result->getLicenseShortName()));
         }
         $this->vars['licenseArray'] = $licenseArray;
     } elseif ($isSingleFile) {
         $this->vars['auditDenied'] = true;
     }
     $clearingHistory = array();
     $selectedClearingType = false;
     if ($hasWritePermission) {
         $clearingHistory = $this->getClearingHistory($clearingDecisions);
     }
     if (count($clearingHistory) > 0) {
         $selectedClearingType = $this->decisionTypes->getTypeByName($clearingHistory[0]['type']);
     }
     $bulkHistory = $this->clearingDao->getBulkHistory($itemTreeBounds, $groupId);
     $ModBack = GetParm("modback", PARM_STRING) ?: "license";
     list($pageMenu, $textView) = $view->getView(NULL, $ModBack, 0, "", $highlights, false, true);
     $this->vars['uploadId'] = $uploadId;
     $this->vars['itemId'] = $uploadTreeId;
     $this->vars['pageMenu'] = $pageMenu;
     $this->vars['textView'] = $textView;
     $this->vars['legendData'] = $this->highlightRenderer->getLegendData($selectedAgentId || $clearingId);
     $this->vars['clearingTypes'] = $this->decisionTypes->getMap();
     $this->vars['selectedClearingType'] = $selectedClearingType;
     $this->vars['tmpClearingType'] = $this->clearingDao->isDecisionWip($uploadTreeId, $groupId);
     $this->vars['clearingHistory'] = $clearingHistory;
     $this->vars['bulkHistory'] = $bulkHistory;
     $noLicenseUploadTreeView = new UploadTreeProxy($uploadId, $options = array(UploadTreeProxy::OPT_SKIP_THESE => "noLicense", UploadTreeProxy::OPT_GROUP_ID => $groupId), $uploadTreeTableName, $viewName = 'no_license_uploadtree' . $uploadId);
     $filesOfInterest = $noLicenseUploadTreeView->count();
     $nonClearedUploadTreeView = new UploadTreeProxy($uploadId, $options = array(UploadTreeProxy::OPT_SKIP_THESE => "alreadyCleared", UploadTreeProxy::OPT_GROUP_ID => $groupId), $uploadTreeTableName, $viewName = 'already_cleared_uploadtree' . $uploadId);
     $filesToBeCleared = $nonClearedUploadTreeView->count();
     $filesAlreadyCleared = $filesOfInterest - $filesToBeCleared;
     $this->vars['message'] = _("Cleared") . ": {$filesAlreadyCleared}/{$filesOfInterest}";
     return $this->render("ui-clearing-view.html.twig");
 }
 public function testCreateSpanEndWithWrappeingHtmlElement()
 {
     $this->highlight->shouldReceive('getHtmlElement')->andReturn($this->htmlElement);
     $result = $this->highlightRenderer->createSpanEnd($this->splitPosition);
     assertThat($result, is("</element></span>"));
 }
Ejemplo n.º 4
0
 /**
  * @param SplitPosition $entry
  * @return string
  */
 protected function startSpan(SplitPosition $entry)
 {
     $anchorText = $this->checkForAnchor($entry) ? "<a id=\"highlight\"" . ($this->insertBacklink ? " href=\"#top\">&nbsp;&#8593;&nbsp;" : ">") . "</a>" : "";
     return $anchorText . $this->highlightRenderer->createSpanStart($entry);
 }