/**
  * 
  * @param number $id Not used.
  * @param FieldList $fields Not used.
  * @return Form
  * @todo what template is used here? AssetAdmin_UploadContent.ss doesn't seem to be used anymore
  */
 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     $folder = $this->currentPage();
     $backLink = LiteralField::create('BackLink', sprintf('<a href="%s" class="backlink ss-ui-button cms-panel-link" data-icon="back">%s</a>', Controller::join_links(singleton('NonSecuredAssetAdmin')->Link('show'), $folder->ID), _t('AssetAdmin.BackToFolder', 'Back to folder')));
     $fields = $form->Fields();
     $fields->removeByName("BackLink");
     $fields->push($backLink);
     return $form;
 }
 /**
  * 
  * @param boolean $unlinked
  * @return ArrayList
  */
 public function Breadcrumbs($unlinked = false)
 {
     $itemsDefault = parent::Breadcrumbs($unlinked);
     $items = new ArrayList();
     $i = 0;
     $originalLink = singleton('AssetAdmin')->Link('show');
     $changedLink = singleton('SecuredAssetAdmin')->Link('show');
     foreach ($itemsDefault as $item) {
         if ($i !== 0) {
             $item->Link = str_replace($originalLink, $changedLink, $item->Link);
             $items->push($item);
         }
         $i++;
     }
     if (isset($items[0]->Title)) {
         $items[0]->Title = _t("SECUREDASSETADMIN.SecuriedFiles", "Advanced Assets");
     }
     return $items;
 }
 /**
  * Exercises SecuredFilesystem::get_numeric_identifier() with both types of expected controller
  * Ensures expected outputs given a variety of inputs
  *
  * @todo Add 'ParentID' ensure this works as expected
  * @todo  Test with "unexpected" class, assert exedcption or error thrown as expecced (Zero is returned)
  */
 public function testGetNumericIdentifierPost()
 {
     $controller = $this->getTestController(array('ID' => '40'), 'POST', AssetAdmin::create());
     $result = SecuredFilesystem::get_numeric_identifier($controller, 'ID');
     $this->assertInternalType('integer', $result);
     $this->assertEquals(40, $result);
     $controller = $this->getTestController(array('ID' => '40'), 'POST', CMSFileAddController::create());
     $result = SecuredFilesystem::get_numeric_identifier($controller, 'ID');
     $this->assertInternalType('integer', $result);
     $this->assertEquals(40, $result);
     $controller = $this->getTestController(array('ID' => '0'), 'POST', AssetAdmin::create());
     $result = SecuredFilesystem::get_numeric_identifier($controller, 'ID');
     $this->assertInternalType('integer', $result);
     $this->assertEquals(0, $result);
     $controller = $this->getTestController(array('ID' => '0'), 'POST', CMSFileAddController::create());
     $result = SecuredFilesystem::get_numeric_identifier($controller, 'ID');
     $this->assertInternalType('integer', $result);
     $this->assertEquals(0, $result);
     $controller = $this->getTestController(array('ParentID' => '40'), 'POST', AssetAdmin::create());
     $result = SecuredFilesystem::get_numeric_identifier($controller, 'ParentID');
     $this->assertInternalType('integer', $result);
     $this->assertEquals(40, $result);
     $controller = $this->getTestController(array('ParentID' => '40'), 'POST', CMSFileAddController::create());
     $result = SecuredFilesystem::get_numeric_identifier($controller, 'ParentID');
     $this->assertInternalType('integer', $result);
     $this->assertEquals(40, $result);
     $controller = $this->getTestController(array('ParentID' => '0'), 'POST', AssetAdmin::create());
     $result = SecuredFilesystem::get_numeric_identifier($controller, 'ParentID');
     $this->assertInternalType('integer', $result);
     $this->assertEquals(0, $result);
     $controller = $this->getTestController(array('ParentID' => '0'), 'POST', CMSFileAddController::create());
     $result = SecuredFilesystem::get_numeric_identifier($controller, 'ParentID');
     $this->assertInternalType('integer', $result);
     $this->assertEquals(0, $result);
     $controller = $this->getTestController(array('DUMMY' => '40'), 'POST', AssetAdmin::create());
     $result = SecuredFilesystem::get_numeric_identifier($controller, 'ID');
     $this->assertInternalType('integer', $result);
     $this->assertEquals(0, $result);
     $controller = $this->getTestController(array('DUMMY' => '40'), 'POST', CMSFileAddController::create());
     $result = SecuredFilesystem::get_numeric_identifier($controller, 'ID');
     $this->assertInternalType('integer', $result);
     $this->assertEquals(0, $result);
     $controller = $this->getTestController(array('ID' => '40'), 'POST', Controller::create());
     $result = SecuredFilesystem::get_numeric_identifier($controller, 'ID');
     $this->assertInternalType('integer', $result);
     $this->assertEquals(0, $result);
 }