Author: david
Date: Tue Nov 24 16:50:00 2009
New Revision: 3959

Log:
Implement QubitWidgetFormInputMany for parallel names and other names.

Modified:
   trunk/apps/qubit/modules/function/actions/editAction.class.php
   trunk/apps/qubit/modules/function/templates/editSuccess.php

Modified: trunk/apps/qubit/modules/function/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/function/actions/editAction.class.php      Tue Nov 
24 16:47:33 2009        (r3958)
+++ trunk/apps/qubit/modules/function/actions/editAction.class.php      Tue Nov 
24 16:50:00 2009        (r3959)
@@ -30,8 +30,8 @@
   public static $NAMES = array(
     'type',
     'authorizedFormOfName',
-    //'parallel_name',
-    //'other_name',
+    'parallelName',
+    'otherName',
     'classification',
     'dates',
     'description',
@@ -72,6 +72,36 @@
 
         break;
 
+      case 'parallelName':
+      case 'otherName':
+        $criteria = new Criteria;
+        $criteria = $this->func->addotherNamesCriteria($criteria);
+
+        switch ($name)
+        {
+          case 'parallelName':
+            $criteria->add(QubitOtherName::TYPE_ID, 
QubitTerm::PARALLEL_FORM_OF_NAME_ID);
+            break;
+          default:
+            $criteria->add(QubitOtherName::TYPE_ID, 
QubitTerm::OTHER_FORM_OF_NAME_ID);
+        }
+
+        $values = $defaultNames = array();
+        if (0 < count($otherNames = QubitOtherName::get($criteria)))
+        {
+          foreach ($otherNames as $otherName)
+          {
+            $values[] = $otherName->id;
+            $defaultNames[$otherName->id] = 
$otherName->getName(array('cultureFallback' => true));
+          }
+        }
+
+        $this->form->setDefault($name, $values);
+        $this->form->setValidator($name, new sfValidatorPass);
+        $this->form->setWidget($name, new 
QubitWidgetFormInputMany(array('defaultNames' => $defaultNames)));
+
+        break;
+
       case 'descriptionStatus':
         if (null !== $this->func->descriptionStatus)
         {
@@ -162,6 +192,11 @@
 
         break;
 
+      case 'parallelName':
+      case 'otherName':
+
+        break;
+
       default:
         $this->func[$field->getName()] = 
$this->form->getValue($field->getName());
     }

Modified: trunk/apps/qubit/modules/function/templates/editSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/function/templates/editSuccess.php Tue Nov 24 
16:47:33 2009        (r3958)
+++ trunk/apps/qubit/modules/function/templates/editSuccess.php Tue Nov 24 
16:50:00 2009        (r3959)
@@ -40,9 +40,9 @@
 
     <?php echo $form->authorizedFormOfName->label('authorized form(s) of 
name')->renderRow() ?>
 
-    <?php //echo $form->parallelNames->renderRow() ?>
+    <?php echo $form->parallelName->label('parallel form(s) of 
name')->renderRow(array('class' => 'resizable')) ?>
 
-    <?php //echo $form->otherNames->renderRow() ?>
+    <?php echo $form->otherName->label('other form(s) of 
name')->renderRow(array('class' => 'resizable')) ?>
 
     <?php echo $form->classification->renderRow() ?>
   </fieldset>

--

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