Author: jablko
Date: Tue Aug 11 15:31:12 2009
New Revision: 3010
Log:
Use switch statement to collect common field definitions
Modified:
trunk/apps/qubit/modules/informationobject/actions/editDcAction.class.php
trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
trunk/apps/qubit/modules/informationobject/actions/editModsAction.class.php
trunk/apps/qubit/modules/informationobject/actions/editRadAction.class.php
Modified:
trunk/apps/qubit/modules/informationobject/actions/editDcAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editDcAction.class.php
Tue Aug 11 14:48:27 2009 (r3009)
+++ trunk/apps/qubit/modules/informationobject/actions/editDcAction.class.php
Tue Aug 11 15:31:12 2009 (r3010)
@@ -45,27 +45,6 @@
{
switch ($name)
{
- case 'accessConditions':
- $this->form->setDefault('accessConditions',
$this->informationObject->accessConditions);
- $this->form->setValidator('accessConditions', new sfValidatorString);
- $this->form->setWidget('accessConditions', new sfWidgetFormTextarea);
-
- break;
-
- case 'extentAndMedium':
- $this->form->setDefault('extentAndMedium',
$this->informationObject->extentAndMedium);
- $this->form->setValidator('extentAndMedium', new sfValidatorString);
- $this->form->setWidget('extentAndMedium', new sfWidgetFormTextarea);
-
- break;
-
- case 'identifier':
- $this->form->setDefault('identifier',
$this->informationObject->identifier);
- $this->form->setValidator('identifier', new sfValidatorString);
- $this->form->setWidget('identifier', new sfWidgetFormInput);
-
- break;
-
case 'language':
$criteria = new Criteria;
$this->informationObject->addPropertysCriteria($criteria);
@@ -82,13 +61,6 @@
break;
- case 'locationOfOriginals':
- $this->form->setDefault('locationOfOriginals',
$this->informationObject->locationOfOriginals);
- $this->form->setValidator('locationOfOriginals', new
sfValidatorString);
- $this->form->setWidget('locationOfOriginals', new
sfWidgetFormTextarea);
-
- break;
-
case 'relation':
$criteria = new Criteria;
$this->informationObject->addPropertysCriteria($criteria);
@@ -106,17 +78,21 @@
break;
+ case 'accessConditions':
+ case 'extentAndMedium':
+ case 'locationOfOriginals':
case 'scopeAndContent':
- $this->form->setDefault('scopeAndContent',
$this->informationObject->scopeAndContent);
- $this->form->setValidator('scopeAndContent', new sfValidatorString);
- $this->form->setWidget('scopeAndContent', new sfWidgetFormTextarea);
+ $this->form->setDefault($name, $this->informationObject[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormTextarea);
break;
+ case 'identifier':
case 'title':
- $this->form->setDefault('title', $this->informationObject->title);
- $this->form->setValidator('title', new sfValidatorString);
- $this->form->setWidget('title', new sfWidgetFormInput);
+ $this->form->setDefault($name, $this->informationObject[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
break;
Modified:
trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
Tue Aug 11 14:48:27 2009 (r3009)
+++ trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
Tue Aug 11 15:31:12 2009 (r3010)
@@ -65,55 +65,13 @@
{
switch ($name)
{
- case 'accessConditions':
- $this->form->setDefault('accessConditions',
$this->informationObject->accessConditions);
- $this->form->setValidator('accessConditions', new sfValidatorString);
- $this->form->setWidget('accessConditions', new sfWidgetFormTextarea);
-
- break;
-
- case 'accruals':
- $this->form->setDefault('accruals',
$this->informationObject->accruals);
- $this->form->setValidator('accruals', new sfValidatorString);
- $this->form->setWidget('accruals', new sfWidgetFormTextarea);
-
- break;
-
- case 'acquisition':
- $this->form->setDefault('acquisition',
$this->informationObject->acquisition);
- $this->form->setValidator('acquisition', new sfValidatorString);
- $this->form->setWidget('acquisition', new sfWidgetFormTextarea);
-
- break;
-
- case 'appraisal':
- $this->form->setDefault('appraisal',
$this->informationObject->appraisal);
- $this->form->setValidator('appraisal', new sfValidatorString);
- $this->form->setWidget('appraisal', new sfWidgetFormTextarea);
-
- break;
-
- case 'archivalHistory':
- $this->form->setDefault('archivalHistory',
$this->informationObject->archivalHistory);
- $this->form->setValidator('archivalHistory', new sfValidatorString);
- $this->form->setWidget('archivalHistory', new sfWidgetFormTextarea);
-
- break;
-
- case 'arrangement':
- $this->form->setDefault('arrangement',
$this->informationObject->arrangement);
- $this->form->setValidator('arrangement', new sfValidatorString);
- $this->form->setWidget('arrangement', new sfWidgetFormTextarea);
-
+ case 'creatorIds':
$values = array();
foreach ($this->informationObject->getCreators() as $actor)
{
$values[] = $actor->id;
}
- break;
-
- case 'creatorIds':
$this->form->setDefault('creatorIds', $values);
$this->form->setValidator('creatorIds', new sfValidatorPass);
@@ -125,70 +83,20 @@
break;
- case 'descriptionIdentifier':
- $this->form->setDefault('descriptionIdentifier',
$this->informationObject->descriptionIdentifier);
- $this->form->setValidator('descriptionIdentifier', new
sfValidatorString);
- $this->form->setWidget('descriptionIdentifier', new
sfWidgetFormInput);
-
- break;
-
- case 'extentAndMedium':
- $this->form->setDefault('extentAndMedium',
$this->informationObject->extentAndMedium);
- $this->form->setValidator('extentAndMedium', new sfValidatorString);
- $this->form->setWidget('extentAndMedium', new sfWidgetFormTextarea);
-
- break;
-
- case 'findingAids':
- $this->form->setDefault('findingAids',
$this->informationObject->findingAids);
- $this->form->setValidator('findingAids', new sfValidatorString);
- $this->form->setWidget('findingAids', new sfWidgetFormTextarea);
-
- break;
-
- case 'identifier':
- $this->form->setDefault('identifier',
$this->informationObject->identifier);
- $this->form->setValidator('identifier', new sfValidatorString);
- $this->form->setWidget('identifier', new sfWidgetFormInput);
-
- break;
-
- case 'institutionResponsibleIdentifier':
- $this->form->setDefault('institutionResponsibleIdentifier',
$this->informationObject->institutionResponsibleIdentifier);
- $this->form->setValidator('institutionResponsibleIdentifier', new
sfValidatorString);
- $this->form->setWidget('institutionResponsibleIdentifier', new
sfWidgetFormInput);
-
- break;
-
case 'languageOfDescription':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'languageOfDescription');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->languageOfDescription = $query[0];
- $this->form->setDefault('languageOfDescription',
unserialize($this->languageOfDescription->__get('value', array('sourceCulture'
=> true))));
- }
-
- $this->form->setValidator('languageOfDescription', new
sfValidatorI18nChoiceLanguage(array('multiple' => true)));
- $this->form->setWidget('languageOfDescription', new
sfWidgetFormI18nSelectLanguage(array('culture' =>
$this->context->user->getCulture(), 'multiple' => true)));
-
- break;
-
case 'language':
$criteria = new Criteria;
$this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'language');
+ $criteria->add(QubitProperty::NAME, $name);
if (1 == count($query = QubitProperty::get($criteria)))
{
- $this->language = $query[0];
- $this->form->setDefault('language',
unserialize($this->language->__get('value', array('sourceCulture' => true))));
+ $this[$name] = $query[0];
+ $this->form->setDefault($name,
unserialize($this[$name]->__get('value', array('sourceCulture' => true))));
}
- $this->form->setValidator('language', new
sfValidatorI18nChoiceLanguage(array('multiple' => true)));
- $this->form->setWidget('language', new
sfWidgetFormI18nSelectLanguage(array('culture' =>
$this->context->user->getCulture(), 'multiple' => true)));
+ $this->form->setValidator($name, new
sfValidatorI18nChoiceLanguage(array('multiple' => true)));
+ $this->form->setWidget($name, new
sfWidgetFormI18nSelectLanguage(array('culture' =>
$this->context->user->getCulture(), 'multiple' => true)));
break;
@@ -207,34 +115,6 @@
break;
- case 'locationOfCopies':
- $this->form->setDefault('locationOfCopies',
$this->informationObject->locationOfCopies);
- $this->form->setValidator('locationOfCopies', new sfValidatorString);
- $this->form->setWidget('locationOfCopies', new sfWidgetFormTextarea);
-
- break;
-
- case 'locationOfOriginals':
- $this->form->setDefault('locationOfOriginals',
$this->informationObject->locationOfOriginals);
- $this->form->setValidator('locationOfOriginals', new
sfValidatorString);
- $this->form->setWidget('locationOfOriginals', new
sfWidgetFormTextarea);
-
- break;
-
- case 'physicalCharacteristics':
- $this->form->setDefault('physicalCharacteristics',
$this->informationObject->physicalCharacteristics);
- $this->form->setValidator('physicalCharacteristics', new
sfValidatorString);
- $this->form->setWidget('physicalCharacteristics', new
sfWidgetFormTextarea);
-
- break;
-
- case 'relatedUnitsOfDescription':
- $this->form->setDefault('relatedUnitsOfDescription',
$this->informationObject->relatedUnitsOfDescription);
- $this->form->setValidator('relatedUnitsOfDescription', new
sfValidatorString);
- $this->form->setWidget('relatedUnitsOfDescription', new
sfWidgetFormTextarea);
-
- break;
-
case 'repositoryId':
$this->form->setDefault('repositoryId',
$this->informationObject->repository->id);
$this->form->setValidator('repositoryId', new sfValidatorInteger);
@@ -250,74 +130,45 @@
break;
- case 'reproductionConditions':
- $this->form->setDefault('reproductionConditions',
$this->informationObject->reproductionConditions);
- $this->form->setValidator('reproductionConditions', new
sfValidatorString);
- $this->form->setWidget('reproductionConditions', new
sfWidgetFormTextarea);
-
- break;
-
- case 'revisionHistory':
- $this->form->setDefault('revisionHistory',
$this->informationObject->revisionHistory);
- $this->form->setValidator('revisionHistory', new sfValidatorString);
- $this->form->setWidget('revisionHistory', new sfWidgetFormTextarea);
-
- break;
-
- case 'rules':
- $this->form->setDefault('rules', $this->informationObject->rules);
- $this->form->setValidator('rules', new sfValidatorString);
- $this->form->setWidget('rules', new sfWidgetFormTextarea);
-
- break;
-
- case 'scopeAndContent':
- $this->form->setDefault('scopeAndContent',
$this->informationObject->scopeAndContent);
- $this->form->setValidator('scopeAndContent', new sfValidatorString);
- $this->form->setWidget('scopeAndContent', new sfWidgetFormTextarea);
-
- break;
-
case 'scriptOfDescription':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'scriptOfDescription');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->scriptOfDescription = $query[0];
- $this->form->setDefault('scriptOfDescription',
unserialize($this->scriptOfDescription->__get('value', array('sourceCulture' =>
true))));
- }
-
- $this->form->setValidator('scriptOfDescription', new
sfValidatorPass);
-
- $c = new sfCultureInfo($this->context->user->getCulture());
- $this->form->setWidget('scriptOfDescription', new
sfWidgetFormSelect(array('choices' => $c->getScripts(), 'multiple' => true)));
-
- break;
-
case 'script':
$criteria = new Criteria;
$this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'script');
+ $criteria->add(QubitProperty::NAME, $name);
if (1 == count($query = QubitProperty::get($criteria)))
{
- $this->script = $query[0];
- $this->form->setDefault('script',
unserialize($this->script->__get('value', array('sourceCulture' => true))));
+ $this[$name] = $query[0];
+ $this->form->setDefault($name,
unserialize($this[$name]->__get('value', array('sourceCulture' => true))));
}
- $this->form->setValidator('script', new sfValidatorPass);
+ $this->form->setValidator($name, new sfValidatorPass);
$c = new sfCultureInfo($this->context->user->getCulture());
- $this->form->setWidget('script', new
sfWidgetFormSelect(array('choices' => $c->getScripts(), 'multiple' => true)));
+ $this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> $c->getScripts(), 'multiple' => true)));
break;
+ case 'accessConditions':
+ case 'accruals':
+ case 'acquisition':
+ case 'appraisal':
+ case 'archivalHistory':
+ case 'arrangement':
+ case 'extentAndMedium':
+ case 'findingAids':
+ case 'locationOfCopies':
+ case 'locationOfOriginals':
+ case 'physicalCharacteristics':
+ case 'relatedUnitsOfDescription':
+ case 'reproductionConditions':
+ case 'revisionHistory':
+ case 'rules':
+ case 'scopeAndContent':
case 'sources':
- $this->form->setDefault('sources',
$this->informationObject->sources);
- $this->form->setValidator('sources', new sfValidatorString);
- $this->form->setWidget('sources', new sfWidgetFormTextarea);
+ $this->form->setDefault($name, $this->informationObject[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormTextarea);
break;
@@ -336,10 +187,13 @@
break;
+ case 'descriptionIdentifier':
+ case 'identifier':
+ case 'institutionResponsibleIdentifier':
case 'title':
- $this->form->setDefault('title', $this->informationObject->title);
- $this->form->setValidator('title', new sfValidatorString);
- $this->form->setWidget('title', new sfWidgetFormInput);
+ $this->form->setDefault($name, $this->informationObject[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
break;
}
Modified:
trunk/apps/qubit/modules/informationobject/actions/editModsAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editModsAction.class.php
Tue Aug 11 14:48:27 2009 (r3009)
+++ trunk/apps/qubit/modules/informationobject/actions/editModsAction.class.php
Tue Aug 11 15:31:12 2009 (r3010)
@@ -48,13 +48,6 @@
break;
- case 'identifier':
- $this->form->setDefault('identifier',
$this->informationObject->identifier);
- $this->form->setValidator('identifier', new sfValidatorString);
- $this->form->setWidget('identifier', new sfWidgetFormInput);
-
- break;
-
case 'language':
$criteria = new Criteria;
$this->informationObject->addPropertysCriteria($criteria);
@@ -71,10 +64,11 @@
break;
+ case 'identifier':
case 'title':
- $this->form->setDefault('title', $this->informationObject->title);
- $this->form->setValidator('title', new sfValidatorString);
- $this->form->setWidget('title', new sfWidgetFormInput);
+ $this->form->setDefault($name, $this->informationObject[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
break;
Modified:
trunk/apps/qubit/modules/informationobject/actions/editRadAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editRadAction.class.php
Tue Aug 11 14:48:27 2009 (r3009)
+++ trunk/apps/qubit/modules/informationobject/actions/editRadAction.class.php
Tue Aug 11 15:31:12 2009 (r3010)
@@ -81,153 +81,20 @@
{
switch ($name)
{
- case 'accessConditions':
- $this->form->setDefault('accessConditions',
$this->informationObject->accessConditions);
- $this->form->setValidator('accessConditions', new sfValidatorString);
- $this->form->setWidget('accessConditions', new sfWidgetFormTextarea);
-
- break;
-
- case 'accruals':
- $this->form->setDefault('accruals',
$this->informationObject->accruals);
- $this->form->setValidator('accruals', new sfValidatorString);
- $this->form->setWidget('accruals', new sfWidgetFormTextarea);
-
- break;
-
- case 'acquisition':
- $this->form->setDefault('acquisition',
$this->informationObject->acquisition);
- $this->form->setValidator('acquisition', new sfValidatorString);
- $this->form->setWidget('acquisition', new sfWidgetFormTextarea);
-
- break;
-
- case 'alternateTitle':
- $this->form->setDefault('alternateTitle',
$this->informationObject->alternateTitle);
- $this->form->setValidator('alternateTitle', new sfValidatorString);
- $this->form->setWidget('alternateTitle', new sfWidgetFormInput);
-
- break;
-
- case 'archivalHistory':
- $this->form->setDefault('archivalHistory',
$this->informationObject->archivalHistory);
- $this->form->setValidator('archivalHistory', new sfValidatorString);
- $this->form->setWidget('archivalHistory', new sfWidgetFormTextarea);
-
- break;
-
- case 'arrangement':
- $this->form->setDefault('arrangement',
$this->informationObject->arrangement);
- $this->form->setValidator('arrangement', new sfValidatorString);
- $this->form->setWidget('arrangement', new sfWidgetFormTextarea);
-
- break;
-
- case 'descriptionIdentifier':
- $this->form->setDefault('descriptionIdentifier',
$this->informationObject->descriptionIdentifier);
- $this->form->setValidator('descriptionIdentifier', new
sfValidatorString);
- $this->form->setWidget('descriptionIdentifier', new
sfWidgetFormInput);
-
- break;
-
- case 'edition':
- $this->form->setDefault('edition',
$this->informationObject->edition);
- $this->form->setValidator('edition', new sfValidatorString);
- $this->form->setWidget('edition', new sfWidgetFormInput);
-
- break;
-
- case 'editionStatementOfResponsibility':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME,
'editionStatementOfResponsibility');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->editionStatementOfResponsibility = $query[0];
- $this->form->setDefault('editionStatementOfResponsibility',
unserialize($this->editionStatementOfResponsibility->value));
- }
-
- $this->form->setValidator('editionStatementOfResponsibility', new
sfValidatorString);
- $this->form->setWidget('editionStatementOfResponsibility', new
sfWidgetFormInput);
-
- break;
-
- case 'extentAndMedium':
- $this->form->setDefault('extentAndMedium',
$this->informationObject->extentAndMedium);
- $this->form->setValidator('extentAndMedium', new sfValidatorString);
- $this->form->setWidget('extentAndMedium', new sfWidgetFormTextarea);
-
- break;
-
- case 'findingAids':
- $this->form->setDefault('findingAids',
$this->informationObject->findingAids);
- $this->form->setValidator('findingAids', new sfValidatorString);
- $this->form->setWidget('findingAids', new sfWidgetFormTextarea);
-
- break;
-
- case 'identifier':
- $this->form->setDefault('identifier',
$this->informationObject->identifier);
- $this->form->setValidator('identifier', new sfValidatorString);
- $this->form->setWidget('identifier', new sfWidgetFormInput);
-
- break;
-
- case 'institutionResponsibleIdentifier':
- $this->form->setDefault('institutionResponsibleIdentifier',
$this->informationObject->institutionResponsibleIdentifier);
- $this->form->setValidator('institutionResponsibleIdentifier', new
sfValidatorString);
- $this->form->setWidget('institutionResponsibleIdentifier', new
sfWidgetFormInput);
-
- break;
-
- case 'issuingJurisdictionAndDenomination':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME,
'issuingJurisdictionAndDenomination');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->issuingJurisdictionAndDenomination = $query[0];
- $this->form->setDefault('issuingJurisdictionAndDenomination',
unserialize($this->issuingJurisdictionAndDenomination->value));
- }
-
- $this->form->setValidator('issuingJurisdictionAndDenomination', new
sfValidatorString);
- $this->form->setWidget('issuingJurisdictionAndDenomination', new
sfWidgetFormInput);
-
- break;
-
case 'language':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'language');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->language = $query[0];
- $this->form->setDefault('language',
unserialize($this->language->__get('value', array('sourceCulture' => true))));
- }
-
- $this->form->setValidator('language', new
sfValidatorI18nChoiceLanguage(array('multiple' => true)));
- $this->form->setWidget('language', new
sfWidgetFormI18nSelectLanguage(array('culture' =>
$this->context->user->getCulture(), 'multiple' => true)));
-
- break;
-
case 'languageOfDescription':
$criteria = new Criteria;
$this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'languageOfDescription');
+ $criteria->add(QubitProperty::NAME, $name);
if (1 == count($query = QubitProperty::get($criteria)))
{
- $this->languageOfDescription = $query[0];
- $this->form->setDefault('languageOfDescription',
unserialize($this->languageOfDescription->__get('value', array('sourceCulture'
=> true))));
+ $this[$name] = $query[0];
+ $this->form->setDefault($name,
unserialize($this[$name]->__get('value', array('sourceCulture' => true))));
}
- $this->form->setValidator('languageOfDescription', new
sfValidatorI18nChoiceLanguage(array('multiple' => true)));
- $this->form->setWidget('languageOfDescription', new
sfWidgetFormI18nSelectLanguage(array('culture' =>
$this->context->user->getCulture(), 'multiple' => true)));
+ $this->form->setValidator($name, new
sfValidatorI18nChoiceLanguage(array('multiple' => true)));
+ $this->form->setWidget($name, new
sfWidgetFormI18nSelectLanguage(array('culture' =>
$this->context->user->getCulture(), 'multiple' => true)));
break;
@@ -246,119 +113,6 @@
break;
- case 'locationOfCopies':
- $this->form->setDefault('locationOfCopies',
$this->informationObject->locationOfCopies);
- $this->form->setValidator('locationOfCopies', new sfValidatorString);
- $this->form->setWidget('locationOfCopies', new sfWidgetFormTextarea);
-
- break;
-
- case 'locationOfOriginals':
- $this->form->setDefault('locationOfOriginals',
$this->informationObject->locationOfOriginals);
- $this->form->setValidator('locationOfOriginals', new
sfValidatorString);
- $this->form->setWidget('locationOfOriginals', new
sfWidgetFormTextarea);
-
- break;
-
- case 'noteOnPublishersSeries':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'noteOnPublishersSeries');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->noteOnPublishersSeries = $query[0];
- $this->form->setDefault('noteOnPublishersSeries',
unserialize($this->noteOnPublishersSeries->value));
- }
-
- $this->form->setValidator('noteOnPublishersSeries', new
sfValidatorString);
- $this->form->setWidget('noteOnPublishersSeries', new
sfWidgetFormTextarea);
-
- break;
-
- case 'numberingWithinPublishersSeries':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME,
'numberingWithinPublishersSeries');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->numberingWithinPublishersSeries = $query[0];
- $this->form->setDefault('numberingWithinPublishersSeries',
unserialize($this->numberingWithinPublishersSeries->value));
- }
-
- $this->form->setValidator('numberingWithinPublishersSeries', new
sfValidatorString);
- $this->form->setWidget('numberingWithinPublishersSeries', new
sfWidgetFormInput);
-
- break;
-
- case 'otherTitleInformation':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'otherTitleInformation');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->otherTitleInformation = $query[0];
- $this->form->setDefault('otherTitleInformation',
unserialize($this->otherTitleInformation->value));
- }
-
- $this->form->setValidator('otherTitleInformation', new
sfValidatorString);
- $this->form->setWidget('otherTitleInformation', new
sfWidgetFormInput);
-
- break;
-
- case 'otherTitleInformationOfPublishersSeries':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME,
'otherTitleInformationOfPublishersSeries');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->otherTitleInformationOfPublishersSeries = $query[0];
- $this->form->setDefault('otherTitleInformationOfPublishersSeries',
unserialize($this->otherTitleInformationOfPublishersSeries->value));
- }
-
- $this->form->setValidator('otherTitleInformationOfPublishersSeries',
new sfValidatorString);
- $this->form->setWidget('otherTitleInformationOfPublishersSeries',
new sfWidgetFormInput);
-
- break;
-
- case 'parallelTitleOfPublishersSeries':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME,
'parallelTitleOfPublishersSeries');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->parallelTitleOfPublishersSeries = $query[0];
- $this->form->setDefault('parallelTitleOfPublishersSeries',
unserialize($this->parallelTitleOfPublishersSeries->value));
- }
-
- $this->form->setValidator('parallelTitleOfPublishersSeries', new
sfValidatorString);
- $this->form->setWidget('parallelTitleOfPublishersSeries', new
sfWidgetFormInput);
-
- break;
-
- case 'physicalCharacteristics':
- $this->form->setDefault('physicalCharacteristics',
$this->informationObject->physicalCharacteristics);
- $this->form->setValidator('physicalCharacteristics', new
sfValidatorString);
- $this->form->setWidget('physicalCharacteristics', new
sfWidgetFormTextarea);
-
- break;
-
- case 'relatedUnitsOfDescription':
- $this->form->setDefault('relatedUnitsOfDescription',
$this->informationObject->relatedUnitsOfDescription);
- $this->form->setValidator('relatedUnitsOfDescription', new
sfValidatorString);
- $this->form->setWidget('relatedUnitsOfDescription', new
sfWidgetFormTextarea);
-
- break;
-
case 'repositoryId':
$this->form->setDefault('repositoryId',
$this->informationObject->repository->id);
$this->form->setValidator('repositoryId', new sfValidatorInteger);
@@ -374,176 +128,44 @@
break;
- case 'reproductionConditions':
- $this->form->setDefault('reproductionConditions',
$this->informationObject->reproductionConditions);
- $this->form->setValidator('reproductionConditions', new
sfValidatorString);
- $this->form->setWidget('reproductionConditions', new
sfWidgetFormTextarea);
-
- break;
-
- case 'revisionHistory':
- $this->form->setDefault('revisionHistory',
$this->informationObject->revisionHistory);
- $this->form->setValidator('revisionHistory', new sfValidatorString);
- $this->form->setWidget('revisionHistory', new sfWidgetFormTextarea);
-
- break;
-
- case 'rules':
- $this->form->setDefault('rules', $this->informationObject->rules);
- $this->form->setValidator('rules', new sfValidatorString);
- $this->form->setWidget('rules', new sfWidgetFormTextarea);
-
- break;
-
- case 'scopeAndContent':
- $this->form->setDefault('scopeAndContent',
$this->informationObject->scopeAndContent);
- $this->form->setValidator('scopeAndContent', new sfValidatorString);
- $this->form->setWidget('scopeAndContent', new sfWidgetFormTextarea);
-
- break;
-
case 'script':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'script');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->script = $query[0];
- $this->form->setDefault('script',
unserialize($this->script->__get('value', array('sourceCulture' => true))));
- }
-
- $this->form->setValidator('script', new sfValidatorPass);
-
- $c = new sfCultureInfo($this->context->user->getCulture());
- $this->form->setWidget('script', new
sfWidgetFormSelect(array('choices' => $c->getScripts(), 'multiple' => true)));
-
- break;
-
case 'scriptOfDescription':
$criteria = new Criteria;
$this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'scriptOfDescription');
+ $criteria->add(QubitProperty::NAME, $name);
if (1 == count($query = QubitProperty::get($criteria)))
{
- $this->scriptOfDescription = $query[0];
- $this->form->setDefault('scriptOfDescription',
unserialize($this->scriptOfDescription->__get('value', array('sourceCulture' =>
true))));
+ $this[$name] = $query[0];
+ $this->form->setDefault($name,
unserialize($this[$name]->__get('value', array('sourceCulture' => true))));
}
- $this->form->setValidator('scriptOfDescription', new
sfValidatorPass);
+ $this->form->setValidator($name, new sfValidatorPass);
$c = new sfCultureInfo($this->context->user->getCulture());
- $this->form->setWidget('scriptOfDescription', new
sfWidgetFormSelect(array('choices' => $c->getScripts(), 'multiple' => true)));
+ $this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> $c->getScripts(), 'multiple' => true)));
break;
+ case 'accessConditions':
+ case 'accruals':
+ case 'acquisition':
+ case 'archivalHistory':
+ case 'arrangement':
+ case 'extentAndMedium':
+ case 'findingAids':
+ case 'locationOfCopies':
+ case 'locationOfOriginals':
+ case 'physicalCharacteristics':
+ case 'relatedUnitsOfDescription':
+ case 'reproductionConditions':
+ case 'revisionHistory':
+ case 'rules':
+ case 'scopeAndContent':
case 'sources':
- $this->form->setDefault('sources',
$this->informationObject->sources);
- $this->form->setValidator('sources', new sfValidatorString);
- $this->form->setWidget('sources', new sfWidgetFormTextarea);
-
- break;
-
- case 'standardNumber':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'standardNumber');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->standardNumber = $query[0];
- $this->form->setDefault('standardNumber',
unserialize($this->standardNumber->value));
- }
-
- $this->form->setValidator('standardNumber', new sfValidatorString);
- $this->form->setWidget('standardNumber', new sfWidgetFormInput);
-
- break;
-
- case 'statementOfCoordinates':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'statementOfCoordinates');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->statementOfCoordinates = $query[0];
- $this->form->setDefault('statementOfCoordinates',
unserialize($this->statementOfCoordinates->value));
- }
-
- $this->form->setValidator('statementOfCoordinates', new
sfValidatorString);
- $this->form->setWidget('statementOfCoordinates', new
sfWidgetFormInput);
-
- break;
-
- case 'statementOfProjection':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'statementOfProjection');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->statementOfProjection = $query[0];
- $this->form->setDefault('statementOfProjection',
unserialize($this->statementOfProjection->value));
- }
-
- $this->form->setValidator('statementOfProjection', new
sfValidatorString);
- $this->form->setWidget('statementOfProjection', new
sfWidgetFormInput);
-
- break;
-
- case 'statementOfResponsibilityRelatingToPublishersSeries':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME,
'statementOfResponsibilityRelatingToPublishersSeries');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->statementOfResponsibilityRelatingToPublishersSeries =
$query[0];
-
$this->form->setDefault('statementOfResponsibilityRelatingToPublishersSeries',
unserialize($this->statementOfResponsibilityRelatingToPublishersSeries->value));
- }
-
-
$this->form->setValidator('statementOfResponsibilityRelatingToPublishersSeries',
new sfValidatorString);
-
$this->form->setWidget('statementOfResponsibilityRelatingToPublishersSeries',
new sfWidgetFormInput);
-
- break;
-
- case 'statementOfScaleArchitectural':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'statementOfScaleArchitectural');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->statementOfScaleArchitectural = $query[0];
- $this->form->setDefault('statementOfScaleArchitectural',
unserialize($this->statementOfScaleArchitectural->value));
- }
-
- $this->form->setValidator('statementOfScaleArchitectural', new
sfValidatorString);
- $this->form->setWidget('statementOfScaleArchitectural', new
sfWidgetFormInput);
-
- break;
-
- case 'statementOfScaleCartographic':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'statementOfScaleCartographic');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->statementOfScaleCartographic = $query[0];
- $this->form->setDefault('statementOfScaleCartographic',
unserialize($this->statementOfScaleCartographic->value));
- }
-
- $this->form->setValidator('statementOfScaleCartographic', new
sfValidatorString);
- $this->form->setWidget('statementOfScaleCartographic', new
sfWidgetFormInput);
+ $this->form->setDefault($name, $this->informationObject[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormTextarea);
break;
@@ -562,44 +184,46 @@
break;
+ case 'alternateTitle':
+ case 'descriptionIdentifier':
+ case 'edition':
+ case 'identifier':
+ case 'institutionResponsibleIdentifier':
case 'title':
- $this->form->setDefault('title', $this->informationObject->title);
- $this->form->setValidator('title', new sfValidatorString);
- $this->form->setWidget('title', new sfWidgetFormInput);
+ $this->form->setDefault($name, $this->informationObject[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
break;
+ case 'editionStatementOfResponsibility':
+ case 'issuingJurisdictionAndDenomination':
+ case 'noteOnPublishersSeries':
+ case 'numberingWithinPublishersSeries':
+ case 'otherTitleInformation':
+ case 'otherTitleInformationOfPublishersSeries':
+ case 'parallelTitleOfPublishersSeries':
+ case 'standardNumber':
+ case 'statementOfCoordinates':
+ case 'statementOfProjection':
+ case 'statementOfResponsibilityRelatingToPublishersSeries':
+ case 'statementOfScaleArchitectural':
+ case 'statementOfScaleCartographic':
case 'titleStatementOfResponsibility':
- $criteria = new Criteria;
- $this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME,
'titleStatementOfResponsibility');
- $criteria->add(QubitProperty::SCOPE, 'rad');
-
- if (1 == count($query = QubitProperty::get($criteria)))
- {
- $this->titleStatementOfResponsibility = $query[0];
- $this->form->setDefault('titleStatementOfResponsibility',
unserialize($this->titleStatementOfResponsibility->value));
- }
-
- $this->form->setValidator('titleStatementOfResponsibility', new
sfValidatorString);
- $this->form->setWidget('titleStatementOfResponsibility', new
sfWidgetFormInput);
-
- break;
-
case 'titleProperOfPublishersSeries':
$criteria = new Criteria;
$this->informationObject->addPropertysCriteria($criteria);
- $criteria->add(QubitProperty::NAME, 'titleProperOfPublishersSeries');
+ $criteria->add(QubitProperty::NAME, $name);
$criteria->add(QubitProperty::SCOPE, 'rad');
if (1 == count($query = QubitProperty::get($criteria)))
{
- $this->titleProperOfPublishersSeries = $query[0];
- $this->form->setDefault('titleProperOfPublishersSeries',
unserialize($this->titleProperOfPublishersSeries->value));
+ $this[$name] = $query[0];
+ $this->form->setDefault($name, unserialize($this[$name]->value));
}
- $this->form->setValidator('titleProperOfPublishersSeries', new
sfValidatorString);
- $this->form->setWidget('titleProperOfPublishersSeries', new
sfWidgetFormInput);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
break;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---