Author: david
Date: Thu Oct 22 17:00:49 2009
New Revision: 3806

Log:
Replace event dialog 'place' select with an autocomplete control.

Modified:
   trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
   trunk/apps/qubit/modules/informationobject/templates/_eventForm.php
   trunk/web/js/eventDialog.js

Modified: 
trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editAction.class.php     
Thu Oct 22 16:52:47 2009        (r3805)
+++ trunk/apps/qubit/modules/informationobject/actions/editAction.class.php     
Thu Oct 22 17:00:49 2009        (r3806)
@@ -610,15 +610,17 @@
       )
       {
         // Update the "place" object term relation object
-        if (0 < strlen($eventFormData['placeId']))
+        if (0 < strlen($eventFormData['place']))
         {
           // If this event didn't exist or didn't have a 'place' associated
-          if (null === $event->getId() || null === ($place = 
QubitObjectTermRelation::getOneByObjectId($event->getId())))
+          if (null === $event->id || null === ($place = 
QubitObjectTermRelation::getOneByObjectId($event->id)))
           {
             $place = new QubitObjectTermRelation;
           }
 
-          $place->setTermId($eventFormData['placeId']);
+          $params = 
$this->context->routing->parse(preg_replace('/.*'.preg_quote($this->request->getPathInfoPrefix(),
 '/').'/', null, $eventFormData['place']));
+          $place->termId = $params['id'];
+
           $event->objectTermRelationsRelatedByobjectId[] = $place;
         }
 

Modified: trunk/apps/qubit/modules/informationobject/templates/_eventForm.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/_eventForm.php Thu Oct 
22 16:52:47 2009        (r3805)
+++ trunk/apps/qubit/modules/informationobject/templates/_eventForm.php Thu Oct 
22 17:00:49 2009        (r3806)
@@ -33,7 +33,10 @@
       </tr>
       <tr>
         <td colspan="2" class="noline"><?php echo 
select_tag('newEvent[typeId]', options_for_select($eventTypes, 
$defaultEventType))?></td>
-        <td class="noline"><?php echo select_tag('newEvent[placeId]', 
options_for_select($eventPlaces))?></td>
+        <td class="noline">
+          <select id="newEventPlace" name="newEvent[place]" 
class="form-autocomplete" />
+          <input class="list" type="hidden" value="<?php echo 
url_for(array('module' => 'term', 'action' => 'autocomplete', 'taxonomyId' => 
'12')) ?>"/>
+        </td>
       </tr>
       <tr>
         <td class="headerCell"><?php echo __('date') ?></td><td 
class="headerCell"><?php echo __('end date') ?></td>

Modified: trunk/web/js/eventDialog.js
==============================================================================
--- trunk/web/js/eventDialog.js Thu Oct 22 16:52:47 2009        (r3805)
+++ trunk/web/js/eventDialog.js Thu Oct 22 17:00:49 2009        (r3806)
@@ -388,7 +388,7 @@
 
   this.fields = {
     "typeId": {"type": "select", "value": null},
-    "placeId": {"type": "select", "value": null},
+    "place": {"type": "select", "value": null, "id": "newEventPlace"},
     "actor": {"type": "input", "value": null, "id": "newEventActor"},
     "startDate": {"type": "input", "value": null},
     "endDate": {"type": "input", "value": null},
@@ -401,7 +401,7 @@
     this.id = (formData['newEvent[id]'] != undefined) ? 
formData['newEvent[id]'] : 'new' + i;
 
     this.fields.typeId.value = formData['newEvent[typeId]'];
-    this.fields.placeId.value = formData['newEvent[placeId]'];
+    this.fields.place.value = formData['newEvent[place]'];
     this.fields.actor.value = formData['newEvent[actor]'];
     this.fields.startDate.value = formData['newEvent[startDate]'];
     this.fields.endDate.value = formData['newEvent[endDate]'];

--~--~---------~--~----~------------~-------~--~----~
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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to