/**
  * @param Request $request
  * @return Response
  */
 protected function handle(Request $request)
 {
     $upload = intval($request->get("upload"));
     $groupId = Auth::getGroupId();
     if (!$this->uploadDao->isAccessible($upload, $groupId)) {
         return $this->flushContent(_("Permission Denied"));
     }
     $item = intval($request->get("item"));
     $vars['baseuri'] = Traceback_uri();
     $vars['uploadId'] = $upload;
     $this->uploadtree_tablename = $this->uploadDao->getUploadtreeTableName($upload);
     if ($request->get('show') == 'quick') {
         $item = $this->uploadDao->getFatItemId($item, $upload, $this->uploadtree_tablename);
     }
     $vars['itemId'] = $item;
     $vars['micromenu'] = Dir2Browse($this->Name, $item, NULL, $showBox = 0, "Browse", -1, '', '', $this->uploadtree_tablename);
     $vars['licenseArray'] = $this->licenseDao->getLicenseArray();
     $itemTreeBounds = $this->uploadDao->getItemTreeBounds($item, $this->uploadtree_tablename);
     $left = $itemTreeBounds->getLeft();
     if (empty($left)) {
         return $this->flushContent(_("Job unpack/adj2nest hasn't completed."));
     }
     $histVars = $this->showUploadHist($itemTreeBounds);
     if (is_a($histVars, 'Symfony\\Component\\HttpFoundation\\RedirectResponse')) {
         return $histVars;
     }
     $vars = array_merge($vars, $histVars);
     $vars['content'] = js_url();
     return $this->render("browse.html.twig", $this->mergeWithDefault($vars));
 }
Esempio n. 2
0
 public function testGetFatItem()
 {
     $this->prepareUploadTree($this->getTestFileStructure());
     $isContainer = 536888320;
     $itemM1a = 13655;
     $this->prepareUploadTree(array(array($itemM1a, 3655, 32, 0, $isContainer, 39 + 0, 40 - 0, 'M1a')));
     $this->dbManager->queryOnce('UPDATE uploadtree SET realparent=parent WHERE ufile_mode&(1<<28)=0', __METHOD__ . '.fixRealparent');
     $fatA = $this->uploadDao->getFatItemId($itemA = 3653, 32, 'uploadtree');
     assertThat($fatA, equalTo($itemA));
     $fatB = $this->uploadDao->getFatItemId($itemBEmpty = 3663, 32, 'uploadtree');
     assertThat($fatB, equalTo($itemBEmpty));
     $fatD = $this->uploadDao->getFatItemId($itemDFolder = 3682, 32, 'uploadtree');
     assertThat($fatD, equalTo($itemDFolder));
     $fatL1 = $this->uploadDao->getFatItemId($itemL1ToFolder = 3666, 32, 'uploadtree');
     assertThat($fatL1, equalTo(3667));
     $fatL2 = $this->uploadDao->getFatItemId($itemL2ToItem = 3664, 32, 'uploadtree');
     assertThat($fatL2, equalTo(3665));
     $fatM = $this->uploadDao->getFatItemId(3654, 32, 'uploadtree');
     assertThat($fatM, equalTo($itemM1a));
 }