Author: sevein
Date: Thu Jul 14 16:00:49 2011
New Revision: 9315

Log:
Update related donors dialog to get data from the object correctly

Modified:
   
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php
   trunk/plugins/qtAccessionPlugin/modules/accession/templates/_relatedDonor.php
   trunk/plugins/qtAccessionPlugin/modules/donor/actions/indexAction.class.php

Modified: 
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php
==============================================================================
--- 
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php
   Thu Jul 14 15:17:21 2011        (r9314)
+++ 
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php
   Thu Jul 14 16:00:49 2011        (r9315)
@@ -22,8 +22,25 @@
   // Arrays not allowed in class constants
   public static
     $NAMES = array(
+      'authorizedFormOfName',
       'resource');
 
+  protected function addField($name)
+  {
+    switch ($name)
+    {
+      case 'authorizedFormOfName':
+        $this->form->setValidator('authorizedFormOfName', new 
sfValidatorString);
+        $this->form->setWidget('authorizedFormOfName', new sfWidgetFormInput);
+
+        break;
+
+      default:
+
+        return parent::addField($name);
+    }
+  }
+
   public function execute($request)
   {
     parent::execute($request);

Modified: 
trunk/plugins/qtAccessionPlugin/modules/accession/templates/_relatedDonor.php
==============================================================================
--- 
trunk/plugins/qtAccessionPlugin/modules/accession/templates/_relatedDonor.php   
    Thu Jul 14 15:17:21 2011        (r9314)
+++ 
trunk/plugins/qtAccessionPlugin/modules/accession/templates/_relatedDonor.php   
    Thu Jul 14 16:00:49 2011        (r9315)
@@ -20,7 +20,7 @@
       </tr>
     </thead><tbody>
       <?php foreach ($relatedDonorRecord as $item): ?>
-        <tr class="<?php echo 0 == ++$row % 2 ? 'even' : 'odd' ?> 
related_obj_<?php echo $item->id ?>" id="<?php echo url_for(array($item, 
'module' => 'relation')) ?>">
+        <tr class="<?php echo 0 == @++$row % 2 ? 'even' : 'odd' ?> 
related_obj_<?php echo $item->id ?>" id="<?php echo 
url_for(array($item->object, 'module' => 'donor')) ?>">
           <td>
             <?php echo render_title($item->object) ?>
           </td><td style="text-align: center">
@@ -39,7 +39,7 @@
 $rowTemplate = json_encode(<<<value
 <tr id="{{$form->getWidgetSchema()->generateName('id')}}">
   <td>
-    {{$form->resource->renderName()}}
+    {{$form->authorizedFormOfName->renderName()}}
   </td><td style="text-align: right">
     $editHtml <button class="delete-small" name="delete" type="button"/>
   </td>
@@ -84,10 +84,10 @@
     <div>
 
       <div class="form-item">
-        <?php echo $form->resource
+        <?php echo $form->authorizedFormOfName
           ->label(__('Name'))
           ->renderLabel() ?>
-        <?php echo $form->resource->render(array('class' => 
'form-autocomplete')) ?>
+        <?php echo $form->authorizedFormOfName->render(array('class' => 
'form-autocomplete')) ?>
         <input class="add" type="hidden" value="<?php echo 
url_for(array('module' => 'donor', 'action' => 'add')) ?> 
#authorizedFormOfName"/>
         <input class="list" type="hidden" value="<?php echo 
url_for(array('module' => 'donor', 'action' => 'autocomplete')) ?>"/>
       </div>

Modified: 
trunk/plugins/qtAccessionPlugin/modules/donor/actions/indexAction.class.php
==============================================================================
--- trunk/plugins/qtAccessionPlugin/modules/donor/actions/indexAction.class.php 
Thu Jul 14 15:17:21 2011        (r9314)
+++ trunk/plugins/qtAccessionPlugin/modules/donor/actions/indexAction.class.php 
Thu Jul 14 16:00:49 2011        (r9315)
@@ -35,6 +35,16 @@
       QubitAcl::forwardUnauthorized();
     }
 
+    // Donor dialog
+    if ($request->isXmlHttpRequest())
+    {
+      $value = array();
+
+      $value['authorizedFormOfName'] = $this->resource->authorizedFormOfName;
+
+      return $this->renderText(json_encode($value));
+    }
+
     if (1 > strlen($title = $this->resource->__toString()))
     {
       $title = $this->context->i18n->__('Untitled');

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