Author: david
Date: Mon Dec  7 13:57:36 2009
New Revision: 4113

Log:
Create distinct namespace for relations form and embed in ISDF form.

Modified:
   trunk/apps/qubit/modules/function/actions/relationshipsComponent.class.php
   trunk/apps/qubit/modules/function/templates/_relationships.php
   trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php

Modified: 
trunk/apps/qubit/modules/function/actions/relationshipsComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/function/actions/relationshipsComponent.class.php  
Mon Dec  7 11:57:38 2009        (r4112)
+++ trunk/apps/qubit/modules/function/actions/relationshipsComponent.class.php  
Mon Dec  7 13:57:36 2009        (r4113)
@@ -34,7 +34,7 @@
     switch ($name)
     {
       case 'type':
-        $this->form->setValidator($name, new sfValidatorString);
+        $this->relationsForm->setValidator($name, new sfValidatorString);
 
         $choices = array();
         $choices[null] = null;
@@ -44,12 +44,12 @@
           $choices[$this->context->routing->generate(null, array('module' => 
'term', 'action' => 'show', 'id' => $term->id))] = $term;
         }
 
-        $this->form->setWidget($name, new sfWidgetFormSelect(array('choices' 
=> $choices)));
+        $this->relationsForm->setWidget($name, new 
sfWidgetFormSelect(array('choices' => $choices)));
 
         break;
 
       case 'category':
-        $this->form->setValidator($name, new sfValidatorString);
+        $this->relationsForm->setValidator($name, new sfValidatorString);
 
         $choices = array();
         $choices[null] = null;
@@ -59,7 +59,7 @@
           $choices[$this->context->routing->generate(null, array('module' => 
'term', 'action' => 'show', 'id' => $term->id))] = $term;
         }
 
-        $this->form->setWidget($name, new sfWidgetFormSelect(array('choices' 
=> $choices)));
+        $this->relationsForm->setWidget($name, new 
sfWidgetFormSelect(array('choices' => $choices)));
 
         break;
 
@@ -67,14 +67,14 @@
       case 'dateStart':
       case 'dateEnd':
       case 'dateDisplay':
-        $this->form->setValidator($name, new sfValidatorString);
-        $this->form->setWidget($name, new sfWidgetFormInput);
+        $this->relationsForm->setValidator($name, new sfValidatorString);
+        $this->relationsForm->setWidget($name, new sfWidgetFormInput);
 
         break;
 
       case 'description':
-        $this->form->setValidator($name, new sfValidatorString);
-        $this->form->setWidget($name, new sfWidgetFormTextarea);
+        $this->relationsForm->setValidator($name, new sfValidatorString);
+        $this->relationsForm->setWidget($name, new sfWidgetFormTextarea);
 
         break;
     }
@@ -82,8 +82,10 @@
 
   public function execute($request)
   {
-    $this->form = new sfForm;
-    //$this->form->getValidatorSchema()->setOption('allow_extra_fields', true);
+    $this->relationsForm = new sfForm;
+    
//$this->relationsForm->getValidatorSchema()->setOption('allow_extra_fields', 
true);
+    $this->form->embedForm('relations_', $this->relationsForm);
+    $this->relationsForm->getWidgetSchema()->setNameFormat('relation[%s]');
 
     $this->relatedFunctions = 
QubitRelation::getRelationsBySubjectOrObjectId($this->func->id);
 

Modified: trunk/apps/qubit/modules/function/templates/_relationships.php
==============================================================================
--- trunk/apps/qubit/modules/function/templates/_relationships.php      Mon Dec 
 7 11:57:38 2009        (r4112)
+++ trunk/apps/qubit/modules/function/templates/_relationships.php      Mon Dec 
 7 13:57:36 2009        (r4113)
@@ -49,60 +49,60 @@
   <tbody>
   <tr>
     <th colspan="4">
-      <?php echo $form->authorizedFormOfName->label('authorized form(s) of 
name')->renderLabel() ?>
+      <?php echo $relationsForm->authorizedFormOfName->label('authorized 
form(s) of name')->renderLabel() ?>
     </th>
   </tr>
   <tr>
     <td colspan="4">
-      <?php echo $form->authorizedFormOfName->render() ?>
+      <?php echo $relationsForm->authorizedFormOfName->render() ?>
     </td>
   </tr>
   <tr>
     <th colspan="2" style="width: 50%">
-      <?php echo $form->type->renderLabel() ?>
+      <?php echo $relationsForm->type->renderLabel() ?>
     </th>
     <th colspan="2" style="width: 50%">
-      <?php echo $form->category->renderLabel() ?>
+      <?php echo $relationsForm->category->renderLabel() ?>
     </th>
   </tr>
   <tr>
     <td colspan="2">
-      <?php echo $form->type->render() ?>
+      <?php echo $relationsForm->type->render() ?>
     </td>
     <td colspan="2">
-      <?php echo $form->category->render() ?>
+      <?php echo $relationsForm->category->render() ?>
     </td>
   </tr>
   <tr>
     <th colspan="4">
-      <?php echo $form->description->renderLabel() ?>
+      <?php echo $relationsForm->description->renderLabel() ?>
     </th>
   </tr>
   <tr>
     <td colspan="4">
-      <?php echo $form->authorizedFormOfName->render() ?>
+      <?php echo $relationsForm->authorizedFormOfName->render() ?>
     </td>
   </tr>
   <tr>
     <th style="width: 25%">
-      <?php echo $form->dateStart->label('date&dagger;')->renderLabel() ?>
+      <?php echo 
$relationsForm->dateStart->label('date&dagger;')->renderLabel() ?>
     </th>
     <th style="width: 25%">
-      <?php echo $form->dateEnd->label('end date&dagger;')->renderLabel() ?>
+      <?php echo $relationsForm->dateEnd->label('end 
date&dagger;')->renderLabel() ?>
     </th>
     <th colspan="2" style="width: 50%">
-      <?php echo $form->dateDisplay->label('date 
display&dagger;')->renderLabel() ?>
+      <?php echo $relationsForm->dateDisplay->label('date 
display&dagger;')->renderLabel() ?>
     </th>
   </tr>
   <tr>
     <td style="width: 25%">
-      <?php echo $form->dateStart->render() ?>
+      <?php echo $relationsForm->dateStart->render() ?>
     </td>
     <td style="width: 25%">
-      <?php echo $form->dateEnd->render() ?>
+      <?php echo $relationsForm->dateEnd->render() ?>
     </td>
     <td colspan="2" style="width: 50%">
-      <?php echo $form->dateDisplay->render() ?>
+      <?php echo $relationsForm->dateDisplay->render() ?>
     </td>
   </tr>
   <tr>

Modified: trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php     Mon Dec 
 7 11:57:38 2009        (r4112)
+++ trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php     Mon Dec 
 7 13:57:36 2009        (r4113)
@@ -62,7 +62,7 @@
   <fieldset class="collapsible collapsed" id="relationshipsArea">
     <legend><?php echo __('relationships area'); ?></legend>
 
-    <?php include_component('function', 'relationships', array('func' => 
$func)) ?>
+    <?php include_component('function', 'relationships', array('func' => 
$func, 'form' => $form)) ?>
   </fieldset>
 
   <fieldset class="collapsible collapsed" id="controlArea">

--

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