Author: jablko
Date: Thu Oct 14 16:34:00 2010
New Revision: 8139
Log:
Refactor maintenance notes into ISDIAH plugin
Modified:
trunk/apps/qubit/modules/repository/actions/editAction.class.php
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/actions/editAction.class.php
Modified: trunk/apps/qubit/modules/repository/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/editAction.class.php Thu Oct
14 16:28:40 2010 (r8138)
+++ trunk/apps/qubit/modules/repository/actions/editAction.class.php Thu Oct
14 16:34:00 2010 (r8139)
@@ -113,22 +113,6 @@
break;
- case 'maintenanceNotes':
- $this->maintenanceNote = null;
-
- // Check for existing maintenance note related to this object
- $maintenanceNotes = $this->resource->getNotesByType(array('noteTypeId'
=> QubitTerm::MAINTENANCE_NOTE_ID));
-
- if (0 < count($maintenanceNotes))
- {
- $this->maintenanceNote = $maintenanceNotes[0];
- $this->form->setDefault('maintenanceNotes',
$this->maintenanceNote->content);
- }
- $this->form->setValidator('maintenanceNotes', new sfValidatorString);
- $this->form->setWidget('maintenanceNotes', new sfWidgetFormTextarea);
-
- break;
-
case 'identifier':
case 'authorizedFormOfName':
case 'descIdentifier':
@@ -222,31 +206,6 @@
break;
- case 'maintenanceNotes':
- // Check for existing maintenance note related to this object
- $maintenanceNotes = $this->resource->getNotesByType(array('noteTypeId'
=> QubitTerm::MAINTENANCE_NOTE_ID));
-
- if (0 < count($maintenanceNotes))
- {
- $note = $maintenanceNotes[0];
- }
- else if (null !== $this->form->getValue('maintenanceNotes'))
- {
- // Create a maintenance note for this object if one doesn't exist
- $note = new QubitNote;
- $note->typeId = QubitTerm::MAINTENANCE_NOTE_ID;
- }
- else
- {
- break;
- }
-
- $note->content = $this->form->getValue('maintenanceNotes');
-
- $this->resource->notes[] = $note;
-
- break;
-
default:
return parent::processField($field);
Modified:
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/actions/editAction.class.php
==============================================================================
---
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/actions/editAction.class.php
Thu Oct 14 16:28:40 2010 (r8138)
+++
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/actions/editAction.class.php
Thu Oct 14 16:34:00 2010 (r8139)
@@ -80,4 +80,64 @@
$this->response->setTitle("$title - {$this->response->getTitle()}");
}
+
+ protected function addField($name)
+ {
+ switch ($name)
+ {
+ case 'maintenanceNotes':
+ // Check for existing maintenance note related to this object
+ $maintenanceNotes = $this->resource->getNotesByType(array('noteTypeId'
=> QubitTerm::MAINTENANCE_NOTE_ID));
+
+ if (0 < count($maintenanceNotes))
+ {
+ $note = $maintenanceNotes[0];
+ }
+ else if (null !== $this->form->getValue('maintenanceNotes'))
+ {
+ // Create a maintenance note for this object if one doesn't exist
+ $note = new QubitNote;
+ $note->typeId = QubitTerm::MAINTENANCE_NOTE_ID;
+ }
+ else
+ {
+ break;
+ }
+
+ $note->content = $this->form->getValue('maintenanceNotes');
+
+ $this->resource->notes[] = $note;
+
+ break;
+
+ default:
+
+ return parent::addField($name);
+ }
+ }
+
+ protected function processField($field)
+ {
+ switch ($field->getName())
+ {
+ case 'maintenanceNotes':
+ $this->maintenanceNote = null;
+
+ // Check for existing maintenance note related to this object
+ $maintenanceNotes = $this->resource->getNotesByType(array('noteTypeId'
=> QubitTerm::MAINTENANCE_NOTE_ID));
+
+ if (0 < count($maintenanceNotes))
+ {
+ $this->maintenanceNote = $maintenanceNotes[0];
+ $this->form->setDefault('maintenanceNotes',
$this->maintenanceNote->content);
+ }
+ $this->form->setValidator('maintenanceNotes', new sfValidatorString);
+ $this->form->setWidget('maintenanceNotes', new sfWidgetFormTextarea);
+
+ break;
+
+ default:
+
+ return parent::processField($field);
+ }
}
--
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.com/group/qubit-commits?hl=en.