Author: jablko
Date: Mon Oct 18 20:56:30 2010
New Revision: 8267

Log:
Use base component

Modified:
   
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedAuthorityRecordComponent.class.php
   
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedResourceComponent.class.php

Modified: 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedAuthorityRecordComponent.class.php
==============================================================================
--- 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedAuthorityRecordComponent.class.php
 Mon Oct 18 20:50:30 2010        (r8266)
+++ 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedAuthorityRecordComponent.class.php
 Mon Oct 18 20:56:30 2010        (r8267)
@@ -33,14 +33,6 @@
   {
     switch ($name)
     {
-      case 'resource':
-        $choices = array();
-
-        $this->form->setValidator($name, new sfValidatorString);
-        $this->form->setWidget($name, new sfWidgetFormSelect(array('choices' 
=> $choices)));
-
-        break;
-
       case 'type':
         $this->form->setValidator('type', new sfValidatorString);
 
@@ -55,20 +47,6 @@
 
         break;
 
-      case 'dateDisplay':
-      case 'startDate':
-      case 'endDate':
-        $this->form->setValidator($name, new sfValidatorString);
-        $this->form->setWidget($name, new sfWidgetFormInput);
-
-        break;
-
-      case 'description':
-        $this->form->setValidator('description', new sfValidatorString);
-        $this->form->setWidget('description', new sfWidgetFormTextarea);
-
-        break;
-
       default:
 
         return parent::addField($name);
@@ -157,10 +135,9 @@
 
     if (isset($this->request->deleteRelations))
     {
-      foreach ((array) $this->request->deleteRelations as $relationId => 
$value)
+      foreach ($this->request->deleteRelations as $item)
       {
-        $relation = QubitRelation::getById($relationId);
-        $relation->delete();
+        QubitRelation::getById($item)->delete();
       }
     }
 

Modified: 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedResourceComponent.class.php
==============================================================================
--- 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedResourceComponent.class.php
        Mon Oct 18 20:50:30 2010        (r8266)
+++ 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedResourceComponent.class.php
        Mon Oct 18 20:56:30 2010        (r8267)
@@ -34,10 +34,8 @@
     switch ($name)
     {
       case 'informationObject':
-        $choices = array();
-
         $this->form->setValidator($name, new sfValidatorString);
-        $this->form->setWidget($name, new sfWidgetFormSelect(array('choices' 
=> $choices)));
+        $this->form->setWidget($name, new sfWidgetFormSelect(array('choices' 
=> array())));
 
         break;
 
@@ -58,20 +56,12 @@
       case 'resourceType':
         $term = QubitTerm::getById(QubitTerm::ARCHIVAL_MATERIAL_ID);
 
-        $this->form->setValidator('resourceType', new sfValidatorString);
         $this->form->setDefault('resourceType', 
$this->context->routing->generate(null, array($term, 'module' => 'term')));
+        $this->form->setValidator('resourceType', new sfValidatorString);
         $this->form->setWidget('resourceType', new 
sfWidgetFormSelect(array('choices' => 
array($this->context->routing->generate(null, array($term, 'module' => 'term')) 
=> $term))));
 
         break;
 
-      case 'dateDisplay':
-      case 'endDate':
-      case 'startDate':
-        $this->form->setValidator($name, new sfValidatorString);
-        $this->form->setWidget($name, new sfWidgetFormInput);
-
-        break;
-
       default:
 
         return parent::addField($name);
@@ -152,14 +142,11 @@
       $this->resource->events[] = $event;
     }
 
-    if (is_array($deleteEvents = $this->request->deleteEvents))
+    if (isset($this->request->deleteEvents))
     {
-      foreach ($deleteEvents as $deleteId => $doDelete)
+      foreach ($deleteEvents as $item)
       {
-        if (null !== $event = QubitEvent::getById($deleteId))
-        {
-          $event->delete();
-        }
+        QubitEvent::getById($item)->delete();
       }
     }
 

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