public function setUp()
 {
     parent::setUp();
     $collectionRole = new Opus_CollectionRole();
     $collectionRole->setName('TestCollectionRole-Name');
     $collectionRole->setOaiName('TestCollectionRole-OaiName');
     $collectionRole->setVisible(1);
     $collectionRole->setVisibleBrowsingStart(1);
     $collectionRole->setVisibleFrontdoor(1);
     $collectionRole->setVisibleOai(1);
     $collectionRole->setDisplayBrowsing('Number');
     $collectionRole->setDisplayFrontdoor('Name');
     $collectionRole->setDisplayOai('NumberName');
     $collectionRole->setPosition(99);
     $collectionRole->addRootCollection();
     $this->collectionRoleId = $collectionRole->store();
     $this->model = new Admin_Model_Collections();
     $this->model->setView(Zend_Registry::get('Opus_View'));
 }
Esempio n. 2
0
 private function create_collection_roles()
 {
     $roles = array("Collections" => array("name" => "collections", "position" => 9));
     foreach ($roles as $r) {
         $role = new Opus_CollectionRole();
         $role->setName($r["name"]);
         $role->setOaiName($r["name"]);
         $role->setPosition($r["position"]);
         $role->setVisible(1);
         $role->setVisibleBrowsingStart(1);
         $role->setDisplayBrowsing('Name');
         $role->setVisibleFrontdoor(1);
         $role->setDisplayFrontdoor('Name');
         $role->setVisibleOai(1);
         $role->setDisplayOai('Name');
         $role->store();
         $root = $role->addRootCollection()->setVisible(1);
         $root->store();
     }
     $role = Opus_CollectionRole::fetchByName('institutes');
     $root = $role->addRootCollection()->setVisible(1);
     $root->store();
 }
 public function testPopulateFromModel()
 {
     $form = new Admin_Form_CollectionRole();
     $model = new Opus_CollectionRole();
     $model->setName('TestName');
     $model->setOaiName('TestOaiName');
     $model->setPosition(5);
     $model->setVisible(1);
     $model->setVisibleBrowsingStart(1);
     $model->setVisibleFrontdoor(1);
     $model->setVisibleOai(1);
     $model->setDisplayBrowsing('Name');
     $model->setDisplayFrontdoor('Number,Name');
     $form->populateFromModel($model);
     $this->assertEquals('TestName', $form->getElement('Name')->getValue());
     $this->assertEquals('TestOaiName', $form->getElement('OaiName')->getValue());
     $this->assertEquals(5, $form->getElement('Position')->getValue());
     $this->assertEquals(1, $form->getElement('Visible')->getValue());
     $this->assertEquals(1, $form->getElement('VisibleBrowsingStart')->getValue());
     $this->assertEquals(1, $form->getElement('VisibleFrontdoor')->getValue());
     $this->assertEquals(1, $form->getElement('VisibleOai')->getValue());
     $this->assertEquals('Name', $form->getElement('DisplayBrowsing')->getValue());
     $this->assertEquals('Number,Name', $form->getElement('DisplayFrontdoor')->getValue());
 }
 /**
  * Wenn eine übergeordnete Collection (z.B. die Root-Collection) für das Attribut visiblePublish = false gesetzt ist,
  * sollen die Kinder auch unsichtbar sein im Publish-Modul.
  */
 public function testRootCollectionFieldVisiblePublish()
 {
     $collectionRole = new Opus_CollectionRole();
     $collectionRole->setName("test");
     $collectionRole->setOaiName("test");
     $collectionRole->setDisplayBrowsing("Name");
     $collectionRole->setDisplayFrontdoor("Name");
     $collectionRole->setDisplayOai("Name");
     $collectionRole->setPosition(101);
     $collectionRole->setVisible(true);
     $collectionRole->store();
     $rootCollection = $collectionRole->addRootCollection();
     $rootCollection->setName("rootInvisible");
     $rootCollection->setVisible(true);
     $rootCollection->setVisiblePublish(false);
     $rootCollection->store();
     $visibleCollection = new Opus_Collection();
     $visibleCollection->setName("visible collection");
     $visibleCollection->setNumber("123");
     $visibleCollection->setVisible(true);
     $visibleCollection->setVisiblePublish(true);
     $rootCollection->addFirstChild($visibleCollection);
     $visibleCollection->store();
     $invisibleCollection = new Opus_Collection();
     $invisibleCollection->setName("collection to invisible root collection");
     $invisibleCollection->setNumber("123");
     $invisibleCollection->setVisible(true);
     $invisibleCollection->setVisiblePublish(false);
     $rootCollection->addFirstChild($invisibleCollection);
     $invisibleCollection->store();
     $childCollection = new Opus_Collection();
     $childCollection->setName("collection child");
     $childCollection->setNumber("123");
     $childCollection->setVisible(true);
     $childCollection->setVisiblePublish(true);
     $invisibleCollection->addFirstChild($childCollection);
     $childCollection->store();
     $val = new Publish_Model_Validation('Collection', $this->session, 'test');
     $children = $val->selectOptions('Collection');
     // clean-up
     $collectionRole->delete();
     $this->assertEquals(0, count($children), "root collection should be invisible in publish");
 }
Esempio n. 5
0
    exit;
}
// find next valid position for collection role
$table = Opus_Db_TableGateway::getInstance(Opus_CollectionRole::getTableGatewayClass());
$select = $table->select()->from($table, array('MAX(position) AS max_position'));
$row = $table->fetchRow($select);
$position = $row->max_position + 1;
// create root collection
$collectionRole = new Opus_CollectionRole();
$collectionRole->setPosition($position);
$collectionRole->setName('ddc_dnb');
$collectionRole->setOaiName('ddc_dnb');
$collectionRole->setVisible(true);
$collectionRole->setVisibleBrowsingStart(true);
$collectionRole->setDisplayBrowsing('Number,Name');
$collectionRole->setDisplayFrontdoor('Number,Name');
$collectionRole->setVisibleFrontdoor(true);
$collectionRole->setVisibleOai(true);
$collectionRoleId = $collectionRole->store();
$rootCollection = new Opus_Collection();
$rootCollection->setPositionKey('Root');
$rootCollection->setVisible(true);
$rootCollection->setRoleId($collectionRoleId);
$rootCollection->store();
if (!is_null($rootCollection)) {
    $line_count = 0;
    $lines_imported = 0;
    foreach (file($input_file) as $line) {
        $line_count++;
        if (trim($line) === '') {
            continue;
 public function testMove()
 {
     $colRole = new Opus_CollectionRole();
     $colRole->setName('MoveTestColRole-Name');
     $colRole->setOaiName('MoveTestColRole-OaiName');
     $colRole->setDisplayFrontdoor('Number');
     $colRole->setDisplayBrowsing('Name');
     $colRole->setPosition(100);
     $this->moveTestColId = $colRole->store();
     $colRoles = Opus_CollectionRole::fetchAll();
     $colRolesCount = count($colRoles);
     $this->assertEquals($this->moveTestColId, $colRoles[$colRolesCount - 1]->getId());
     $this->assertEquals($this->collectionRoleId, $colRoles[$colRolesCount - 2]->getId());
     $model = new Admin_Model_CollectionRole($this->collectionRoleId);
     $model->move(100);
     $colRoles = Opus_CollectionRole::fetchAll();
     $colRolesCount = count($colRoles);
     // Reihenfolge ist jetzt vertauscht
     $this->assertEquals($this->collectionRoleId, $colRoles[$colRolesCount - 1]->getId());
     $this->assertEquals($this->moveTestColId, $colRoles[$colRolesCount - 2]->getId());
 }
 public function testCreateActionForEdit()
 {
     $this->useEnglish();
     $roles = Opus_CollectionRole::fetchAll();
     $role = new Opus_CollectionRole();
     $role->setName('EditTestName');
     $role->setOaiName('EditTestOaiName');
     $role->setDisplayBrowsing('Name');
     $role->setDisplayFrontdoor('Number');
     $role->setVisible(1);
     $role->setVisibleBrowsingStart(1);
     $role->setVisibleFrontdoor(0);
     $role->setVisibleOai(0);
     $role->setPosition(20);
     $roleId = $role->store();
     $post = array('oid' => $roleId, 'Name' => 'ModifiedName', 'OaiName' => 'ModifiedOaiName', 'DisplayBrowsing' => 'Number,Name', 'DisplayFrontdoor' => 'Name,Number', 'Visible' => '0', 'VisibleBrowsingStart' => '0', 'VisibleFrontdoor' => '1', 'VisibleOai' => '1', 'Position' => '19', 'Save' => 'Speichern');
     $this->getRequest()->setMethod('POST')->setPost($post);
     $this->dispatch('/admin/collectionroles/create');
     $this->assertEquals(count($roles) + 1, count(Opus_CollectionRole::fetchAll()));
     // keine neue Collection
     $role = new Opus_CollectionRole($roleId);
     $role->delete();
     $this->assertEquals('ModifiedName', $role->getName());
     $this->assertEquals('ModifiedOaiName', $role->getOaiName());
     $this->assertEquals('Number,Name', $role->getDisplayBrowsing());
     $this->assertEquals('Name,Number', $role->getDisplayFrontdoor());
     $this->assertEquals(0, $role->getVisible());
     $this->assertEquals(0, $role->getVisibleBrowsingStart());
     $this->assertEquals(1, $role->getVisibleFrontdoor());
     $this->assertEquals(1, $role->getVisibleOai());
     $this->assertEquals(19, $role->getPosition());
     $this->assertRedirectTo('/admin/collectionroles');
     $this->verifyFlashMessage('Collection role \'ModifiedName\' was edited successfully.', self::MESSAGE_LEVEL_NOTICE);
 }
 /**
  * Regression Test for OPUSVIER-2651
  */
 public function testOPUSVIER2651Number()
 {
     $role = new Opus_CollectionRole(7);
     $displayFrontdoor = $role->getDisplayFrontdoor();
     $role->setDisplayFrontdoor('Number');
     $role->store();
     $this->dispatch('/frontdoor/index/index/docId/89');
     // undo changes
     $role->setDisplayBrowsing($displayFrontdoor);
     $role->store();
     $this->assertQueryContentContains('td', '52.00', $this->getResponse()->getBody());
     $this->assertNotQueryContentContains('td', 'Maschinenbau, Energietechnik, Fertigungstechnik: Allgemeines', $this->getResponse()->getBody());
 }