private function wrapperTestMoveUploadBeyond($moveUpload = 4, $beyondUpload = 2, $expectedPrio = 1.5)
 {
     $this->testDb->getDbManager()->insertTableRow('upload', array('upload_pk' => 4, 'upload_filename' => 'for.all4', 'user_fk' => 1, 'upload_mode' => 1, 'public_perm' => Auth::PERM_READ));
     $this->testDb->getDbManager()->insertTableRow('upload', array('upload_pk' => 5, 'upload_filename' => 'for.all5', 'user_fk' => 1, 'upload_mode' => 1, 'public_perm' => Auth::PERM_READ));
     $this->testDb->getDbManager()->insertTableRow('upload_clearing', array('upload_fk' => 1, 'group_fk' => $this->groupId, UploadBrowseProxy::PRIO_COLUMN => 1));
     $this->testDb->getDbManager()->insertTableRow('upload_clearing', array('upload_fk' => 2, 'group_fk' => $this->groupId, UploadBrowseProxy::PRIO_COLUMN => 2));
     $this->testDb->getDbManager()->insertTableRow('upload_clearing', array('upload_fk' => 4, 'group_fk' => $this->groupId, UploadBrowseProxy::PRIO_COLUMN => 4));
     $this->testDb->getDbManager()->insertTableRow('upload_clearing', array('upload_fk' => 5, 'group_fk' => $this->groupId, UploadBrowseProxy::PRIO_COLUMN => 5));
     $uploadBrowseProxy = new UploadBrowseProxy($this->groupId, UserDao::USER, $this->testDb->getDbManager());
     $uploadBrowseProxy->moveUploadBeyond($moveUpload, $beyondUpload);
     $updatedRow = $this->testDb->getDbManager()->getSingleRow('SELECT ' . UploadBrowseProxy::PRIO_COLUMN . ' FROM upload_clearing WHERE upload_fk=$1 AND group_fk=$2', array($moveUpload, $this->groupId));
     assertThat($updatedRow[UploadBrowseProxy::PRIO_COLUMN], equalTo($expectedPrio));
 }
Exemple #2
0
 /**
  * @brief Display the loaded menu and plugins.
  */
 protected function handle(Request $request)
 {
     $groupId = Auth::getGroupId();
     $gup = $this->dbManager->getSingleRow('SELECT group_perm FROM group_user_member WHERE user_fk=$1 AND group_fk=$2', array(Auth::getUserId(), $groupId), __METHOD__ . '.user_perm');
     if (!$gup) {
         throw new \Exception('You are assigned to wrong group.');
     }
     $this->userPerm = $gup['group_perm'];
     $uploadId = intval($request->get('uploadId'));
     if ($uploadId && !$this->uploadDao->isAccessible($uploadId, $groupId)) {
         throw new \Exception('You cannot access to this upload');
     }
     $columnName = $request->get('columnName');
     $statusId = intval($request->get('statusId'));
     $value = intval($request->get('value'));
     $moveUpload = intval($request->get("move"));
     $beyondUpload = intval($request->get("beyond"));
     $commentText = $request->get('commentText');
     $direction = $request->get('direction');
     if (!empty($columnName) && !empty($uploadId) && !empty($value)) {
         $uploadBrowseProxy = new UploadBrowseProxy($groupId, $this->userPerm, $this->dbManager);
         $uploadBrowseProxy->updateTable($columnName, $uploadId, $value);
     } else {
         if (!empty($moveUpload) && !empty($beyondUpload)) {
             $uploadBrowseProxy = new UploadBrowseProxy($groupId, $this->userPerm, $this->dbManager);
             $uploadBrowseProxy->moveUploadBeyond($moveUpload, $beyondUpload);
         } else {
             if (!empty($uploadId) && !empty($direction)) {
                 $uploadBrowseProxy = new UploadBrowseProxy($groupId, $this->userPerm, $this->dbManager);
                 $uploadBrowseProxy->moveUploadToInfinity($uploadId, $direction == 'top');
             } else {
                 if (!empty($uploadId) && !empty($commentText) && !empty($statusId)) {
                     $uploadBrowseProxy = new UploadBrowseProxy($groupId, $this->userPerm, $this->dbManager);
                     $uploadBrowseProxy->setStatusAndComment($uploadId, $statusId, $commentText);
                 } else {
                     return $this->respondFolderGetTableData($request);
                 }
             }
         }
     }
     return new Response('');
 }