Author: jablko
Date: Tue Oct 12 16:34:58 2010
New Revision: 8072

Log:
Bind form to event parameters

Modified:
   trunk/apps/qubit/modules/actor/actions/editAction.class.php
   trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
   
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php
   trunk/apps/qubit/modules/repository/actions/editAction.class.php

Modified: trunk/apps/qubit/modules/actor/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/actor/actions/editAction.class.php Tue Oct 12 
14:02:59 2010        (r8071)
+++ trunk/apps/qubit/modules/actor/actions/editAction.class.php Tue Oct 12 
16:34:58 2010        (r8072)
@@ -284,7 +284,6 @@
     if ($request->isMethod('post'))
     {
       $this->form->bind($request->getPostParameters());
-
       if ($this->form->isValid())
       {
         $this->processForm();

Modified: 
trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editAction.class.php     
Tue Oct 12 14:02:59 2010        (r8071)
+++ trunk/apps/qubit/modules/informationobject/actions/editAction.class.php     
Tue Oct 12 16:34:58 2010        (r8072)
@@ -485,7 +485,6 @@
     if ($request->isMethod('post'))
     {
       $this->form->bind($request->getPostParameters());
-
       if ($this->form->isValid())
       {
         $this->processForm();

Modified: 
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php
==============================================================================
--- 
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php 
    Tue Oct 12 14:02:59 2010        (r8071)
+++ 
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php 
    Tue Oct 12 16:34:58 2010        (r8072)
@@ -46,61 +46,65 @@
         $event = $params['_sf_route']->resource;
       }
 
-      // Use existing actor if one is selected (overrides new actor creation)
-      if (0 < strlen($item['actor']))
+      $this->form->bind($item);
+      if ($this->form->isValid())
       {
-        $params = 
$this->context->routing->parse(Qubit::pathInfo($item['actor']));
-        $event->actorId = $params['id'];
-      }
+        // Use existing actor if one is selected (overrides new actor creation)
+        if (0 < strlen($item['actor']))
+        {
+          $params = 
$this->context->routing->parse(Qubit::pathInfo($item['actor']));
+          $event->actorId = $params['id'];
+        }
 
-      $event->startDate = $item['startDate'];
-      $event->endDate = $item['endDate'];
-      $event->dateDisplay = $item['dateDisplay'];
+        $event->startDate = $item['startDate'];
+        $event->endDate = $item['endDate'];
+        $event->dateDisplay = $item['dateDisplay'];
 
-      if (0 < strlen($item['type']))
-      {
-        $params = 
$this->context->routing->parse(Qubit::pathInfo($item['type']));
-        $event->typeId = $params['id'];
-      }
+        if (0 < strlen($item['type']))
+        {
+          $params = 
$this->context->routing->parse(Qubit::pathInfo($item['type']));
+          $event->typeId = $params['id'];
+        }
 
-      if (0 < strlen($item['description']))
-      {
-        $event->description = $item['description'];
-      }
-      else
-      {
-        unset($event->description);
-      }
+        if (0 < strlen($item['description']))
+        {
+          $event->description = $item['description'];
+        }
+        else
+        {
+          unset($event->description);
+        }
 
-      // Save the event if it's valid (has an actor OR date)
-      if (0 < strlen($item['actor'])
-        || 0 < strlen($item['startDate'])
-        || 0 < strlen($item['endDate'])
-        || 0 < strlen($item['dateDisplay']))
-      {
-        // Update the "place" object term relation object
-        if (0 < strlen($item['place']))
+        // Save the event if it's valid (has an actor OR date)
+        if (0 < strlen($item['actor'])
+          || 0 < strlen($item['startDate'])
+          || 0 < strlen($item['endDate'])
+          || 0 < strlen($item['dateDisplay']))
         {
-          // If this event didn't exist or didn't have a 'place' associated
-          if (null === $event->id || null === ($place = 
QubitObjectTermRelation::getOneByObjectId($event->id)))
+          // Update the "place" object term relation object
+          if (0 < strlen($item['place']))
           {
-            $place = new QubitObjectTermRelation;
-          }
+            // If this event didn't exist or didn't have a 'place' associated
+            if (null === $event->id || null === ($place = 
QubitObjectTermRelation::getOneByObjectId($event->id)))
+            {
+              $place = new QubitObjectTermRelation;
+            }
 
-          $params = 
$this->context->routing->parse(Qubit::pathInfo($item['place']));
-          $place->termId = $params['id'];
+            $params = 
$this->context->routing->parse(Qubit::pathInfo($item['place']));
+            $place->termId = $params['id'];
 
-          $event->objectTermRelationsRelatedByobjectId[] = $place;
-        }
+            $event->objectTermRelationsRelatedByobjectId[] = $place;
+          }
 
-        // Or delete an existing "place" object term relation, if it's no
-        // longer needed
-        else if (0 < $event->getId() && null !== ($place = 
QubitObjectTermRelation::getOneByObjectId($event->getId())))
-        {
-          $place->delete();
-        }
+          // Or delete an existing "place" object term relation, if it's no
+          // longer needed
+          else if (0 < $event->getId() && null !== ($place = 
QubitObjectTermRelation::getOneByObjectId($event->getId())))
+          {
+            $place->delete();
+          }
 
-        $this->resource->events[] = $event;
+          $this->resource->events[] = $event;
+        }
       }
     }
 

Modified: trunk/apps/qubit/modules/repository/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/editAction.class.php    Tue Oct 
12 14:02:59 2010        (r8071)
+++ trunk/apps/qubit/modules/repository/actions/editAction.class.php    Tue Oct 
12 16:34:58 2010        (r8072)
@@ -326,7 +326,6 @@
     if ($request->isMethod('post'))
     {
       $this->form->bind($request->getPostParameters());
-
       if ($this->form->isValid())
       {
         $this->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