Author: jablko
Date: Sun Oct 17 18:41:53 2010
New Revision: 8210
Log:
Process some fields
Modified:
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php
trunk/apps/qubit/modules/relation/actions/editComponent.class.php
Modified:
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php
==============================================================================
---
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php
Sun Oct 17 18:13:01 2010 (r8209)
+++
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php
Sun Oct 17 18:41:53 2010 (r8210)
@@ -29,15 +29,15 @@
{
public function processForm()
{
- $updatedEvents = array($this->request->updateEvent);
+ $params = array($this->request->updateEvent);
if (isset($this->request->updateEvents))
{
// If event dialog JavaScript has done it's work, then use the array of
// updated events
- $updatedEvents = $this->request->updateEvents;
+ $params = $this->request->updateEvents;
}
- foreach ($updatedEvents as $item)
+ foreach ($params as $item)
{
// Continue only if user typed something
foreach ($item as $value)
Modified: trunk/apps/qubit/modules/relation/actions/editComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/relation/actions/editComponent.class.php Sun Oct
17 18:13:01 2010 (r8209)
+++ trunk/apps/qubit/modules/relation/actions/editComponent.class.php Sun Oct
17 18:41:53 2010 (r8210)
@@ -43,6 +43,16 @@
{
switch ($field->getName())
{
+ case 'dateDisplay':
+ $this->relation->updateNote($this->form->getValue('description'),
QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID);
+
+ break;
+
+ case 'description':
+ $this->relation->updateNote($this->form->getValue('dateDisplay'),
QubitTerm::RELATION_NOTE_DESCRIPTION_ID);
+
+ break;
+
default:
$this->resource[$field->getName()] =
$this->form->getValue($field->getName());
}
@@ -50,15 +60,52 @@
protected function processForm()
{
- foreach ($this->form as $field)
+ // HACK For now, parameter name and action name are the same. Should
+ // really be configurable, ideally by interpreting
+ // $form->getWidgetSchema()->getNameFormat()?
+ $params = array($this->request[$this->actionName]);
+ if (isset($this->request["{$this->actionName}s"]))
{
- if (isset($this->request[$field->getName()]))
+ // If dialog JavaScript has done it's work, then use the array of
+ // parameters
+ $params = $this->request["{$this->actionName}s"];
+ }
+
+ foreach ($params as $item)
+ {
+ // Continue only if user typed something
+ foreach ($item as $value)
{
- $this->processField($field);
+ if (0 < strlen($value))
+ {
+ break;
+ }
}
- }
- $this->resource->save();
+ if (1 > strlen($value))
+ {
+ continue;
+ }
+
+ $this->relation = new QubitRelation;
+ if (isset($item['id']))
+ {
+ $params = $this->context->routing->parse(Qubit::pathInfo($item['id']));
+ $this->relation = $params['_sf_route']->resource;
+ }
+
+ $this->form->bind($item);
+ if ($this->form->isValid())
+ {
+ foreach ($this->form as $field)
+ {
+ if (isset($this->request[$field->getName()]))
+ {
+ $this->processField($field);
+ }
+ }
+ }
+ }
}
public function execute($request)
--
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.