Author: sevein
Date: Tue Nov  2 14:40:10 2010
New Revision: 8760

Log:
Handle "type" of event field for ISAD: restrict type of events to "Creation" 
and "Accumulation". Fixes issue 1871.

Modified:
   
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php

Modified: 
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
==============================================================================
--- 
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
    Tue Nov  2 13:05:28 2010        (r8759)
+++ 
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
    Tue Nov  2 14:40:10 2010        (r8760)
@@ -27,6 +27,34 @@
       'startDate',
       'type');
 
+  protected function addField($name)
+  {
+    switch ($name)
+    {
+      case 'type':
+
+        foreach (sfIsadPlugin::eventTypes() as $item)
+        {
+          // Default event type is creation
+          if (QubitTerm::CREATION_ID == $item->id)
+          {
+            $this->form->setDefault('type', 
$this->context->routing->generate(null, array($item, 'module' => 'term')));
+          }
+
+          $choices[$this->context->routing->generate(null, array($item, 
'module' => 'term'))] = $item->__toString();
+        }
+      
+        $this->form->setValidator('type', new sfValidatorString);
+        $this->form->setWidget('type', new sfWidgetFormSelect(array('choices' 
=> $choices)));
+
+        break;
+      
+      default:
+
+        return parent::addField($name);
+    }
+  }
+
   // TODO Refactor with parent::processForm()
   public function processForm()
   {

-- 
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.

Reply via email to