Author: jablko
Date: Mon Oct 18 20:34:47 2010
New Revision: 8262

Log:
Use ->setNameFormat()

Modified:
   
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedAuthorityRecordComponent.class.php
   
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedResourceComponent.class.php
   
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedAuthorityRecord.php
   
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedResource.php

Modified: 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedAuthorityRecordComponent.class.php
==============================================================================
--- 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedAuthorityRecordComponent.class.php
 Mon Oct 18 20:26:03 2010        (r8261)
+++ 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedAuthorityRecordComponent.class.php
 Mon Oct 18 20:34:47 2010        (r8262)
@@ -23,7 +23,7 @@
   {
     switch ($name)
     {
-      case 'relatedActor[authorizedFormOfName]':
+      case 'authorizedFormOfName':
         $choices = array();
 
         $this->form->setValidator($name, new sfValidatorString);
@@ -31,8 +31,8 @@
 
         break;
 
-      case 'relatedActor[type]':
-        $this->form->setValidator('relatedActor[type]', new sfValidatorString);
+      case 'type':
+        $this->form->setValidator('type', new sfValidatorString);
 
         $choices = array();
         $choices[null] = null;
@@ -41,21 +41,21 @@
           $choices[$this->context->routing->generate(null, array($item, 
'module' => 'term'))] = $item;
         }
 
-        $this->form->setWidget('relatedActor[type]', new 
sfWidgetFormSelect(array('choices' => $choices)));
+        $this->form->setWidget('type', new sfWidgetFormSelect(array('choices' 
=> $choices)));
 
         break;
 
-      case 'relatedActor[dateDisplay]':
-      case 'relatedActor[endDate]':
-      case 'relatedActor[startDate]':
+      case 'dateDisplay':
+      case 'startDate':
+      case 'endDate':
         $this->form->setValidator($name, new sfValidatorString);
         $this->form->setWidget($name, new sfWidgetFormInput);
 
         break;
 
-      case 'relatedActor[description]':
-        $this->form->setValidator('relatedActor[description]', new 
sfValidatorString);
-        $this->form->setWidget('relatedActor[description]', new 
sfWidgetFormTextarea);
+      case 'description':
+        $this->form->setValidator('description', new sfValidatorString);
+        $this->form->setWidget('description', new sfWidgetFormTextarea);
 
         break;
 
@@ -83,6 +83,13 @@
     return parent::processForm();
   }
 
+  public function execute($request)
+  {
+    parent::execute($request);
+
+    
$this->form->getWidgetSchema()->setNameFormat('relatedAuthorityRecord[%s]');
+  }
+
   /**
    * Update actor relationships
    */

Modified: 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedResourceComponent.class.php
==============================================================================
--- 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedResourceComponent.class.php
        Mon Oct 18 20:26:03 2010        (r8261)
+++ 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/relatedResourceComponent.class.php
        Mon Oct 18 20:34:47 2010        (r8262)
@@ -23,7 +23,7 @@
   {
     switch ($name)
     {
-      case 'relatedResource[informationObject]':
+      case 'informationObject':
         $choices = array();
 
         $this->form->setValidator($name, new sfValidatorString);
@@ -31,8 +31,8 @@
 
         break;
 
-      case 'relatedResource[type]':
-        $this->form->setValidator('relatedResource[type]', new 
sfValidatorString);
+      case 'type':
+        $this->form->setValidator('type', new sfValidatorString);
 
         $choices = array();
         $choices[null] = null;
@@ -41,22 +41,22 @@
           $choices[$this->context->routing->generate(null, array($item, 
'module' => 'term'))] = $item;
         }
 
-        $this->form->setWidget('relatedResource[type]', new 
sfWidgetFormSelect(array('choices' => $choices)));
+        $this->form->setWidget('type', new sfWidgetFormSelect(array('choices' 
=> $choices)));
 
         break;
 
-      case 'relatedResource[resourceType]':
+      case 'resourceType':
         $term = QubitTerm::getById(QubitTerm::ARCHIVAL_MATERIAL_ID);
 
-        $this->form->setValidator('relatedResource[resourceType]', new 
sfValidatorString);
-        $this->form->setDefault('relatedResource[resourceType]', 
$this->context->routing->generate(null, array($term, 'module' => 'term')));
-        $this->form->setWidget('relatedResource[resourceType]', new 
sfWidgetFormSelect(array('choices' => 
array($this->context->routing->generate(null, array($term, 'module' => 'term')) 
=> $term))));
+        $this->form->setValidator('resourceType', new sfValidatorString);
+        $this->form->setDefault('resourceType', 
$this->context->routing->generate(null, array($term, 'module' => 'term')));
+        $this->form->setWidget('resourceType', new 
sfWidgetFormSelect(array('choices' => 
array($this->context->routing->generate(null, array($term, 'module' => 'term')) 
=> $term))));
 
         break;
 
-      case 'relatedResource[dateDisplay]':
-      case 'relatedResource[endDate]':
-      case 'relatedResource[startDate]':
+      case 'dateDisplay':
+      case 'endDate':
+      case 'startDate':
         $this->form->setValidator($name, new sfValidatorString);
         $this->form->setWidget($name, new sfWidgetFormInput);
 
@@ -86,6 +86,13 @@
     return parent::processForm();
   }
 
+  public function execute($request)
+  {
+    parent::execute($request);
+
+    $this->form->getWidgetFormSchema()->setNameFormat('relatedResource[%s]');
+  }
+
   /**
    * Add or update events related to this actor
    *

Modified: 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedAuthorityRecord.php
==============================================================================
--- 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedAuthorityRecord.php
     Mon Oct 18 20:26:03 2010        (r8261)
+++ 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedAuthorityRecord.php
     Mon Oct 18 20:34:47 2010        (r8262)
@@ -162,72 +162,72 @@
   </caption><tbody>
     <tr>
       <th colspan="3">
-        <?php echo $form['relatedActor[authorizedFormOfName]']
+        <?php echo $form->authorizedFormOfName
           ->label(__('Authorized form of name'))
           ->renderLabel() ?>
       </th>
     </tr><tr>
       <td colspan="3">
-        <?php echo 
$form['relatedActor[authorizedFormOfName]']->render(array('class' => 
'form-autocomplete')) ?>
+        <?php echo $form->authorizedFormOfName->render(array('class' => 
'form-autocomplete')) ?>
         <input class="list" type="hidden" value="<?php echo 
url_for(array('module' => 'actor', 'action' => 'autocomplete')) ?>" />
-        <?php echo $form['relatedActor[authorizedFormOfName]']
+        <?php echo $form->authorizedFormOfName
           ->help(__('"Record the authorized form of name and any relevant 
unique identifiers, including the authority record identifier, for the related 
entity." (ISAAR 5.3.1) Select the name from the drop-down menu; enter the first 
few letters to narrow the choices.'))
           ->renderHelp() ?>
       </td>
     </tr><tr>
       <th colspan="3">
-        <?php echo $form['relatedActor[type]']
+        <?php echo $form->type
           ->label(__('Category of relationship'))
           ->renderLabel() ?>
       </th>
     </tr><tr>
       <td colspan="3">
-        <?php echo $form['relatedActor[type]']->render(array('class' => 
'form-autocomplete')) ?>
-        <?php echo $form['relatedActor[type]']
+        <?php echo $form->type->render(array('class' => 'form-autocomplete')) 
?>
+        <?php echo $form->type
           ->help(__('"Purpose: To identify the general category of 
relationship between the entity being described and another corporate body, 
person or family." (ISAAR 5.3.2). Select a category from the drop-down menu: 
hierarchical, temporal, family or associative.'))
           ->renderHelp() ?>
       </td>
     </tr><tr>
       <th colspan="3">
-        <?php echo $form['relatedActor[description]']
+        <?php echo $form->description
           ->label(__('Description of relationship'))
           ->renderLabel() ?>
       </th>
     </tr><tr>
       <td colspan="3" style="width: 100%">
-        <?php echo $form['relatedActor[description]'] ?>
-        <?php echo $form['relatedActor[description]']
+        <?php echo $form->description ?>
+        <?php echo $form->description
           ->help(__('"Record a precise description of the nature of the 
relationship between the entity described in this authority record and the 
other related entity....Record in the Rules and/or conventions element (5.4.3) 
any classification scheme used as a source of controlled vocabulary terms to 
describe the relationship. A narrative description of the history and/or nature 
of the relationship may also be provided here." (ISAAR 5.3.3). Note that the 
text entered in this field will also appear in the related authority record.'))
           ->renderHelp() ?>
       </td>
     </tr><tr>
       <th style="width: 25%">
-        <?php echo $form['relatedActor[startDate]']
+        <?php echo $form->startDate
           ->label(__('Date&dagger;'))
           ->renderLabel() ?>
       </th><th style="width: 25%">
-        <?php echo $form['relatedActor[endDate]']
+        <?php echo $form->endDate
           ->label(__('End date&dagger;'))
           ->renderLabel() ?>
       </th><th style="width: 50%">
-        <?php echo $form['relatedActor[dateDisplay]']
+        <?php echo $form->dateDisplay
           ->label(__('Date display&dagger;'))
           ->renderLabel() ?>
       </th>
     </tr><tr>
       <td style="width: 25%">
-        <?php echo $form['relatedActor[startDate]'] ?>
-        <?php echo $form['relatedActor[startDate]']
+        <?php echo $form->startDate ?>
+        <?php echo $form->startDate
           ->help(__('Enter the start year. Do not use any qualifiers or 
typographical symbols to express uncertainty.'))
           ->renderHelp() ?>
       </td><td style="width: 25%">
-        <?php echo $form['relatedActor[endDate]'] ?>
-        <?php echo $form['relatedActor[endDate]']
+        <?php echo $form->endDate ?>
+        <?php echo $form->endDate
           ->help(__('Enter the end year. Do not use any qualifiers or 
typographical symbols to express uncertainty. If the start and end years are 
the same, enter data only in the "Date" field and leave the "End date" blank.'))
           ->renderHelp() ?>
       </td><td style="width: 50%">
-        <?php echo $form['relatedActor[dateDisplay]'] ?>
-        <?php echo $form['relatedActor[dateDisplay]']
+        <?php echo $form->dateDisplay ?>
+        <?php echo $form->dateDisplay
           ->help(__('"Record when relevant the commencement date of the 
relationship or succession date and, when relevant, the cessation date of the 
relationship." (ISAAR 5.3.4) Enter the date as you would like it to appear in 
the show page for the authority record, using qualifiers and/or typographical 
symbols to express uncertainty if desired.'))
           ->renderHelp() ?>
       </td>

Modified: 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedResource.php
==============================================================================
--- 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedResource.php
    Mon Oct 18 20:26:03 2010        (r8261)
+++ 
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedResource.php
    Mon Oct 18 20:34:47 2010        (r8262)
@@ -122,68 +122,68 @@
   <tbody>
     <tr>
       <th colspan="3" style="width: 55%">
-        <?php echo $form['relatedResource[informationObject]']
+        <?php echo $form->informationObject
           ->label(__('Title of related resource'))
           ->renderLabel() ?>
       </th>
     </tr><tr>
       <td colspan="3" class="noline">
-        <?php echo 
$form['relatedResource[informationObject]']->render(array('class' => 
'form-autocomplete')) ?>
+        <?php echo $form->informationObject->render(array('class' => 
'form-autocomplete')) ?>
         <input class="list" type="hidden" value="<?php echo 
url_for(array('module' => 'informationobject', 'action' => 'autocomplete')) ?>" 
/>
-        <?php echo $form['relatedResource[informationObject]']
+        <?php echo $form->informationObject
           ->help(__('"Provide the unique identifiers/reference codes and/or 
titles for the related resources." (ISAAR 6.1) Select the title from the 
drop-down menu; enter the identifier or the first few letters to narrow the 
choices.'))
           ->renderHelp() ?>
       </td>
     </tr><tr>
       <th colspan="2" style="width: 60%">
-        <?php echo $form['relatedResource[type]']
+        <?php echo $form->type
           ->label(__('Nature of relationship'))
           ->renderLabel() ?>
       </th><th style="width: 40%">
-        <?php echo $form['relatedResource[resourceType]']
+        <?php echo $form->resourceType
           ->label(__('Type of related resource'))
           ->renderLabel() ?>
       </th>
     </tr><tr>
       <td colspan="2" class="noline">
-        <?php echo $form['relatedResource[type]']->render(array('class' => 
'form-autocomplete')) ?>
-        <?php echo $form['relatedResource[type]']
+        <?php echo $form->type->render(array('class' => 'form-autocomplete')) 
?>
+        <?php echo $form->type
           ->help(__('"Describe the nature of the relationships between the 
corporate body, person or family and the related resource." (ISAAR 6.3) Select 
the type of relationship from the drop-down menu; these values are drawn from 
the Event Types taxonomy.'))
           ->renderHelp() ?>
       </td><td class="noline">
-        <?php echo 
$form['relatedResource[resourceType]']->render(array('disabled' => 'true', 
'class' => 'disabled')) ?>
-        <?php echo $form['relatedResource[resourceType]']
+        <?php echo $form->resourceType->render(array('disabled' => 'true', 
'class' => 'disabled')) ?>
+        <?php echo $form->resourceType
           ->help(__('"Identify the type of related resources, e.g. Archival 
materials (fonds, record series, etc), archival description, finding aid, 
monograph, journal article, web site, photograph, museum collection, 
documentary film, oral history recording." (ISAAR 6.2) In the current version 
of the software, Archival material is provided as the only default value.'))
           ->renderHelp() ?>
       </td>
     </tr><tr>
       <th style="width: 25%">
-        <?php echo $form['relatedResource[startDate]']
+        <?php echo $form->startDate
           ->label(__('Date&dagger;'))
           ->renderLabel() ?>
       </th><th style="width: 25%">
-        <?php echo $form['relatedResource[endDate]']
+        <?php echo $form->endDate
           ->label(__('End date&dagger;'))
           ->renderLabel() ?>
       </th><th style="width: 50%">
-        <?php echo $form['relatedResource[dateDisplay]']
+        <?php echo $form->dateDisplay
           ->label(__('Date display&dagger;'))
           ->renderLabel() ?>
       </th>
     </tr><tr>
       <td style="width: 25%">
-        <?php echo $form['relatedResource[startDate]'] ?>
-        <?php echo $form['relatedResource[startDate]']
+        <?php echo $form->startDate ?>
+        <?php echo $form->startDate
           ->help(__('Enter the start year. Do not use any qualifiers or 
typographical symbols to express uncertainty.'))
           ->renderHelp() ?>
       </td><td style="width: 25%">
-        <?php echo $form['relatedResource[endDate]'] ?>
-        <?php echo $form['relatedResource[endDate]']
+        <?php echo $form->endDate ?>
+        <?php echo $form->endDate
           ->help(__('Enter the end year. Do not use any qualifiers or 
typographical symbols to express uncertainty. If the start and end years are 
the same, enter data only in the "Date" field and leave the "End date" blank.'))
           ->renderHelp() ?>
       </td><td style="width: 50%">
-        <?php echo $form['relatedResource[dateDisplay]'] ?>
-        <?php echo $form['relatedResource[dateDisplay]']
+        <?php echo $form->dateDisplay ?>
+        <?php echo $form->dateDisplay
           ->help(__('"Provide any relevant dates for the related resources 
and/or the relationship between the corporate body, person or family and the 
related resource." (ISAAR 6.4) Enter the date as you would like it to appear in 
the show page for the authority record, using qualifiers and/or typographical 
symbols to express uncertainty if desired.'))
           ->renderHelp() ?>
       </td>

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