MINOR: renaming forever to indefinitely (embargo)
This commit is contained in:
parent
9d0f8ade7e
commit
1a4ba2b5dd
|
@ -7,7 +7,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||
"Description" => 'Text',
|
||||
"LastChanged" => 'SS_DateTime', //when this document's file was created or last replaced (small changes like updating title don't count)
|
||||
|
||||
"EmbargoedForever" => 'Boolean(false)',
|
||||
"EmbargoedIndefinitely" => 'Boolean(false)',
|
||||
"EmbargoedUntilPublished" => 'Boolean(false)',
|
||||
"EmbargoedUntilDate" => 'SS_DateTime',
|
||||
"ExpireAtDate" => 'SS_DateTime'
|
||||
|
@ -240,8 +240,8 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||
* should be used to hide documents that have not yet gone live.
|
||||
* @return null
|
||||
*/
|
||||
function embargoForever($write = true) {
|
||||
$this->EmbargoedForever = true;
|
||||
function embargoIndefinitely($write = true) {
|
||||
$this->EmbargoedIndefinitely = true;
|
||||
if ($write) $this->write();
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||
if (is_object($this->EmbargoedUntilDate)) $this->EmbargoedUntilDate = $this->EmbargoedUntilDate->Value;
|
||||
|
||||
$embargoed = false;
|
||||
if ($this->EmbargoedForever) $embargoed = true;
|
||||
if ($this->EmbargoedIndefinitely) $embargoed = true;
|
||||
elseif ($this->EmbargoedUntilPublished) $embargoed = true;
|
||||
elseif (!empty($this->EmbargoedUntilDate) && SS_Datetime::now()->Value < $this->EmbargoedUntilDate) $embargoed = true;
|
||||
|
||||
|
@ -293,7 +293,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||
* @return null
|
||||
*/
|
||||
function clearEmbargo($write = true) {
|
||||
$this->EmbargoedForever = false;
|
||||
$this->EmbargoedIndefinitely = false;
|
||||
$this->EmbargoedUntilPublished = false;
|
||||
$this->EmbargoedUntilDate = null;
|
||||
if ($write) $this->write();
|
||||
|
@ -522,10 +522,10 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||
'</ul></div>'));
|
||||
|
||||
$embargoValue = 'None';
|
||||
if ($this->EmbargoedForever) $embargoValue = 'Forever';
|
||||
if ($this->EmbargoedIndefinitely) $embargoValue = 'Indefinitely';
|
||||
elseif ($this->EmbargoedUntilPublished) $embargoValue = 'Published';
|
||||
elseif (!empty($this->EmbargoedUntilDate)) $embargoValue = 'Date';
|
||||
$embargo = new OptionsetField('Embargo','Embargo',array('None'=>'None','Published'=>'Hide document until page is published','Forever'=>'Hide document forever','Date'=>'Hide until set date'),$embargoValue);
|
||||
$embargo = new OptionsetField('Embargo','Embargo',array('None'=>'None','Published'=>'Hide document until page is published','Indefinitely'=>'Hide document indefinitely','Date'=>'Hide until set date'),$embargoValue);
|
||||
$embargoDatetime = DatetimeField::create('EmbargoedUntilDate','');
|
||||
$embargoDatetime->getDateField()->setConfig('showcalendar', true)->setConfig('dateformat', 'yyyy-MM-dd')->setConfig('datavalueformat', 'yyyy-MM-dd');
|
||||
|
||||
|
@ -563,7 +563,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||
$this->clearEmbargo(false); //clear all previous settings and re-apply them on save
|
||||
|
||||
if ($this->Embargo == 'Published') $this->embargoUntilPublished(false);
|
||||
if ($this->Embargo == 'Forever') $this->embargoForever(false);
|
||||
if ($this->Embargo == 'Indefinitely') $this->embargoIndefinitely(false);
|
||||
if ($this->Embargo == 'Date') $this->embargoUntilDate($savedDate, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ interface DMSDocumentInterface {
|
|||
* @abstract
|
||||
* @return null
|
||||
*/
|
||||
function embargoForever();
|
||||
function embargoIndefinitely();
|
||||
|
||||
/**
|
||||
* Returns if this is DMSDocument is embargoed or expired.
|
||||
|
|
|
@ -35,7 +35,7 @@ class DMSEmbargoTest extends SapphireTest {
|
|||
$result = $controller->index($this->createFakeHTTPRequest($docID));
|
||||
$this->assertEquals($doc->getFullPath(),$result,"Correct underlying file returned (in test mode)");
|
||||
|
||||
$doc->embargoForever();
|
||||
$doc->embargoIndefinitely();
|
||||
|
||||
$result = $controller->index($this->createFakeHTTPRequest($docID));
|
||||
$this->assertNotEquals($doc->getFullPath(),$result,"File no longer returned (in test mode)");
|
||||
|
@ -43,13 +43,13 @@ class DMSEmbargoTest extends SapphireTest {
|
|||
DMS::$dmsFolder = $oldDMSFolder;
|
||||
}
|
||||
|
||||
function testEmbargoForever() {
|
||||
function testEmbargoIndefinitely() {
|
||||
$doc = new DMSDocument();
|
||||
$doc->Filename = "DMS-test-lorum-file.pdf";
|
||||
$doc->Folder = "tests";
|
||||
$doc->write();
|
||||
|
||||
$doc->embargoForever();
|
||||
$doc->embargoIndefinitely();
|
||||
$this->assertTrue($doc->isHidden(),"Document is hidden");
|
||||
$this->assertTrue($doc->isEmbargoed(),"Document is embargoed");
|
||||
$this->assertFalse($doc->isExpired(),"Document is not expired");
|
||||
|
@ -165,7 +165,7 @@ class DMSEmbargoTest extends SapphireTest {
|
|||
$this->assertTrue($doc->isEmbargoed(),"Document is embargoed");
|
||||
$this->assertFalse($doc->isExpired(),"Document is not expired");
|
||||
|
||||
$doc->embargoForever();
|
||||
$doc->embargoIndefinitely();
|
||||
$doc = DataObject::get_by_id("DMSDocument",$dID);
|
||||
$this->assertTrue($doc->isHidden(),"Document is hidden");
|
||||
$this->assertTrue($doc->isEmbargoed(),"Document is embargoed");
|
||||
|
@ -174,7 +174,7 @@ class DMSEmbargoTest extends SapphireTest {
|
|||
$s1->publish('Stage','Live');
|
||||
$s1->doPublish();
|
||||
$doc = DataObject::get_by_id("DMSDocument",$dID);
|
||||
$this->assertTrue($doc->isHidden(),"Document is still hidden because although the untilPublish flag is cleared, the forever flag is still there");
|
||||
$this->assertTrue($doc->isHidden(),"Document is still hidden because although the untilPublish flag is cleared, the indefinitely flag is still there");
|
||||
$this->assertTrue($doc->isEmbargoed(),"Document is embargoed");
|
||||
$this->assertFalse($doc->isExpired(),"Document is not expired");
|
||||
|
||||
|
|
Loading…
Reference in New Issue