Author: jablko
Date: Sun Oct 17 10:44:18 2010
New Revision: 8192

Log:
Move ISDF templates to sfIsdfPlugin

Added:
   trunk/plugins/sfIsdfPlugin/
   trunk/plugins/sfIsdfPlugin/modules/
   trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/
   trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/
   trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/editSuccess.php
      - copied unchanged from r8186, 
trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php
   trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/indexSuccess.php
      - copied unchanged from r8186, 
trunk/apps/qubit/modules/function/templates/indexIsdfSuccess.php
Deleted:
   trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php
   trunk/apps/qubit/modules/function/templates/indexIsdfSuccess.php
Modified:
   trunk/apps/qubit/modules/function/actions/editAction.class.php
   trunk/apps/qubit/modules/function/actions/indexAction.class.php

Modified: trunk/apps/qubit/modules/function/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/function/actions/editAction.class.php      Sun Oct 
17 10:20:28 2010        (r8191)
+++ trunk/apps/qubit/modules/function/actions/editAction.class.php      Sun Oct 
17 10:44:18 2010        (r8192)
@@ -315,7 +315,7 @@
       }
     }
 
-    $this->setTemplate('editIsdf');
+    
$this->setTemplate(sfConfig::get('sf_plugins_dir').'/sfIsdfPlugin/modules/sfIsdfPlugin/templates/edit');
 
     QubitDescription::addAssets($this->response);
   }

Modified: trunk/apps/qubit/modules/function/actions/indexAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/function/actions/indexAction.class.php     Sun Oct 
17 10:20:28 2010        (r8191)
+++ trunk/apps/qubit/modules/function/actions/indexAction.class.php     Sun Oct 
17 10:44:18 2010        (r8192)
@@ -90,6 +90,6 @@
       }
     }
 
-    $this->setTemplate('indexIsdf');
+    
$this->setTemplate(sfConfig::get('sf_plugins_dir').'/sfIsdfPlugin/modules/sfIsdfPlugin/templates/index');
   }
 }

Copied: 
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/editSuccess.php (from 
r8186, trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/editSuccess.php   
Sun Oct 17 10:44:18 2010        (r8192, copy of r8186, 
trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php)
@@ -0,0 +1,688 @@
+<?php use_helper('Javascript') ?>
+
+<h1><?php echo __('Edit %1% - ISDF', array('%1%' => 
sfConfig::get('app_ui_label_function'))) ?></h1>
+
+<h1 class="label"><?php echo render_title($resource->getLabel()) ?></h1>
+
+<?php echo $form->renderGlobalErrors() ?>
+
+<?php if (isset($sf_request->id)): ?>
+  <?php echo $form->renderFormTag(url_for(array($resource, 'module' => 
'function', 'action' => 'edit')), array('id' => 'editForm')) ?>
+<?php else: ?>
+  <?php echo $form->renderFormTag(url_for(array('module' => 'function', 
'action' => 'create')), array('id' => 'editForm')) ?>
+<?php endif; ?>
+
+  <?php echo $form->renderHiddenFields() ?>
+
+  <fieldset class="collapsible collapsed" id="identityArea">
+
+    <legend><?php echo __('Identity area') ?></legend>
+
+    <?php echo $form->type
+      ->help(__('"Specify whether the description is a function or one of its 
subdivisions." (ISDF 5.1.1) Select the type from the drop-down menu; these 
values are drawn from the ISDF Function Types taxonomy.'))
+      ->label(__('Type').' <span class="form-required" title="'.__('This is a 
mandatory element.').'">*</span>')
+      ->renderRow() ?>
+
+    <?php echo render_field($form->authorizedFormOfName
+      ->help(__('"Record the authorised name of the function being described. 
In cases where the name is not enough, add qualifiers to make it unique such as 
the territorial or administrative scope, or the name of the institution which 
performs it. This element is to be used in conjunction with the Function 
description identifier element (5.4.1)." (ISDF 5.1.2)'))
+      ->label(__('Authorized form of name').' <span class="form-required" 
title="'.__('This is a mandatory element.').'">*</span>'), $resource) ?>
+
+    <?php echo $form->parallelName
+      ->help(__('"Purpose: To indicate the various forms in which the 
authorized form(s) of name occurs in other languages or script forms. Rule: 
Record the parallel form(s) of name in accordance with any relevant national or 
international conventions or rules applied by the agency that created the 
description, including any necessary sub elements and/or qualifiers required by 
those conventions or rules. Specify in the Rules and/or conventions element 
(5.4.3.) which rules have been applied." (ISDF 5.1.3)'))
+      ->label(__('Parallel form(s) of name'))
+      ->renderRow() ?>
+
+    <?php echo $form->otherName
+      ->help(__('"Record any other names for the function being described." 
(ISDF 5.1.4)'))
+      ->label(__('Other form(s) of name'))
+      ->renderRow() ?>
+
+    <?php echo render_field($form->classification
+      ->help(__('"Record any term and/or code from a classification scheme of 
functions. Record the classification scheme used in the element Rules and/or 
conventions used (5.4.3)." (ISDF 5.1.5)')), $resource) ?>
+
+  </fieldset>
+
+  <fieldset class="collapsible collapsed" id="descriptionArea">
+
+    <legend><?php echo __('Context area') ?></legend>
+
+    <?php echo render_field($form->dates
+      ->help(__('"Provide a date or date span which covers the dates when the 
function was started and when it finished. If a function is ongoing, no end 
date is needed." (ISDF 5.2.1)')), $resource) ?>
+
+    <?php echo render_field($form->description
+      ->help(__('"Record a narrative description of the purpose of the 
function." (ISDF 5.2.2)')), $resource, array('class' => 'resizable')) ?>
+
+    <?php echo render_field($form->history
+      ->help(__('"Record in narrative form or as a chronology the main events 
relating to the function." (ISDF 5.2.3)')), $resource, array('class' => 
'resizable')) ?>
+
+    <?php echo render_field($form->legislation
+      ->help(__('"Record any law, directive or charter which creates, changes 
or ends the function." (ISDF 5.2.4)')), $resource, array('class' => 
'resizable')) ?>
+
+  </fieldset>
+
+  <fieldset class="collapsible collapsed" id="relationshipsArea">
+
+    <legend><?php echo __('Relationships area') ?></legend>
+
+    <table class="inline" id="relatedFunctions">
+      <caption>
+        <?php echo __('Related functions') ?>
+      </caption><thead>
+        <tr>
+          <th style="width: 25%">
+            <?php echo __('Name') ?>
+          </th><th style="width: 15%">
+            <?php echo __('Category') ?>
+          </th><th style="width: 30%">
+            <?php echo __('Description') ?>
+          </th><th style="width: 20%">
+            <?php echo __('Dates') ?>
+          </th><th style="width: 10%; text-align: center">
+            <?php echo image_tag('delete', array('align' => 'top', 'class' => 
'deleteIcon')) ?>
+          </th>
+        </tr>
+      </thead><tbody>
+        <?php foreach ($relatedFunctions as $item): ?>
+          <tr class="related_obj_<?php echo $item->id ?>" id="<?php echo 
url_for(array($item, 'module' => 'relation')) ?>">
+            <td>
+              <?php if ($resource->id == $item->objectId): ?>
+                <?php echo render_title($item->subject) ?>
+              <?php else: ?>
+                <?php echo render_title($item->object) ?>
+              <?php endif; ?>
+            </td><td>
+              <?php echo $item->type ?>
+            </td><td>
+              <?php echo 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID) ?>
+            </td><td>
+              <?php if (0 < strlen($dateDisplay = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)) || 0 < 
count($dateArray = $item->getDates())): ?>
+                <?php if (0 < strlen($dateDisplay)): ?>
+                  <?php echo $dateDisplay ?>
+                <?php elseif (2 == count($dateArray)): ?>
+                  <?php echo __('%1% - %2%', array('%1%' => 
Qubit::renderDate($dateArray['start']), '%2%' => 
Qubit::renderDate($dateArray['end']))) ?>
+                <?php else: ?>
+                  <?php echo Qubit::renderDate(array_shift($dateArray)) ?>
+                <?php endif; ?>
+              <?php endif; ?>
+            </td><td style="text-align: center">
+              <input type="checkbox" name="deleteRelations[<?php echo 
$item->id ?>]" value="delete" class="multiDelete"/>
+            </td>
+          </tr>
+        <?php endforeach; ?>
+      </tbody>
+    </table>
+
+    <?php
+
+    // Define template for new relation table rows added by dialog
+    $editImage = image_tag('pencil', array('alt' => 'edit', 'style' => 'align: 
top'));
+    $deleteBtn = '<button class="delete-small" name="delete"/>';
+
+    $rowTemplate = '<tr id="{relation[id]}">'
+      .'  <td>'
+      .'    {relation[authorizedFormOfName]}'
+      .'  </td><td>'
+      .'    {relation[category]}'
+      .'  </td><td>'
+      .'    {relation[description]}'
+      .'  </td><td>'
+      .'    {relation[dateDisplay]}'
+      .'  </td><td style="text-align: right">'
+      ."    $editImage $deleteBtn"
+      .'  </td>'
+      .'</tr>';
+
+    $linkToShow = url_for(array($resource, 'module' => 'function'));
+
+    echo javascript_tag(<<<content
+// Add special rendering rules
+var handleFieldRender = function (obj, fname)
+  {
+    var matches = fname.match(/(\w+)\[(\w+)\]/);
+    if (null == matches)
+    {
+      return obj.renderField(fname);
+    }
+
+    switch (matches[2])
+    {
+      case 'dateDisplay':
+
+        if (0 < obj.getField('dateDisplay').value.length)
+        {
+          return obj.getField('dateDisplay').value;
+        }
+        else if (0 < obj.getField('startDate').value.length && 0 < 
obj.getField('endDate').value.length)
+        {
+          return obj.getField('startDate').value + ' - ' + 
obj.getField('endDate').value;
+        }
+        else
+        {
+          return obj.getField('startDate').value;
+        }
+
+        break;
+
+      default:
+
+        return obj.renderField(fname);
+    }
+  }
+
+Drupal.behaviors.dialog = {
+  attach: function (context)
+    {
+      // Map relation table data to dialog fields
+      var relationTableMap = function (data)
+        {
+          var output = {};
+          for (col in data)
+          {
+            switch(col)
+            {
+              case 'subject':
+              case 'object':
+
+                if ('$linkToShow' != data[col])
+                {
+                  output['relation[authorizedFormOfName]'] = data[col];
+                }
+
+                break;
+
+              case 'type':
+                output['relation[category]'] = data[col];
+
+                break;
+
+              default:
+                output['relation[' + col + ']'] = data[col];
+            }
+          }
+
+          return output;
+        }
+
+      // Define dialog
+      Qubit.dialog = new QubitDialog('functionRelation', {
+        'displayTable': 'relatedFunctions',
+        'newRowTemplate': '$rowTemplate',
+        'handleFieldRender': handleFieldRender,
+        'relationTableMap': relationTableMap }, jQuery);
+
+      // Add edit link/icon to "relatedFunctions" rows
+      jQuery('#relatedFunctions tr').each(function ()
+        {
+          var thisUri = this.id;
+          if (undefined != thisUri)
+          {
+            jQuery('td:last', this).prepend('<a 
href="javascript:Qubit.dialog.open(\'' + thisUri + '\')">$editImage</a>');
+          }
+        });
+    } }
+
+content
+) ?>
+
+    <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
+    <!-- NOTE: The dialog.js script cuts this *entire* table and pastes   -->
+    <!-- it in a YUI dialog object.                                       -->
+    <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
+    <table class="inline" id="functionRelation">
+      <caption>
+        <?php echo __('Relationship') ?>
+      </caption><tbody>
+        <tr>
+          <th colspan="4">
+            <?php echo $form['relation[authorizedFormOfName]']
+              ->label(__('Authorized form of name'))
+              ->renderLabel() ?>
+          </th>
+        </tr><tr>
+          <td colspan="4">
+            <?php echo 
$form['relation[authorizedFormOfName]']->render(array('class' => 
'form-autocomplete')) ?>
+            <input class="list" type="hidden" value="<?php echo 
url_for(array('module' => 'function', 'action' => 'autocomplete')) ?>"/>
+            <?php echo $form['relation[authorizedFormOfName]']
+              ->help(__('"Record the authorised form of name and any unique 
identifier of the related function." (ISDF 5.3.1)'))
+              ->renderHelp() ?>
+          </td>
+        </tr><tr>
+          <th colspan="4">
+            <?php echo $form['relation[category]']
+              ->label(__('Category'))
+              ->renderLabel() ?>
+          </th>
+        </tr><tr>
+          <td colspan="4">
+            <?php echo $form['relation[category]'] ?>
+            <?php echo $form['relation[category]']
+              ->help(__('"Record a general category into which the 
relationship being described falls." (ISDF 5.3.2) Select a category from the 
drop-down menu: hierarchical, temporal or associative.'))
+              ->renderHelp() ?>
+          </td>
+        </tr><tr>
+          <th colspan="4">
+            <?php echo $form['relation[description]']
+              ->label(__('Description'))
+              ->renderLabel() ?>
+          </th>
+        </tr><tr>
+          <td colspan="4">
+            <?php echo $form['relation[description]'] ?>
+            <?php echo $form['relation[description]']
+              ->help(__('"Record a precise description of the nature of the 
relationship between the function being described and the related function." 
(ISDF 5.3.3) Note that the text entered in this field will also appear in the 
related function.'))
+              ->renderHelp() ?>
+          </td>
+        </tr><tr>
+          <th style="width: 25%">
+            <?php echo $form['relation[startDate]']
+              ->label('Date&dagger;')
+              ->renderLabel() ?>
+          </th><th style="width: 25%">
+            <?php echo $form['relation[endDate]']
+              ->label('End date&dagger;')
+              ->renderLabel() ?>
+          </th><th colspan="2" style="width: 50%">
+            <?php echo $form['relation[dateDisplay]']
+              ->label('Date display&dagger;')
+              ->renderLabel() ?>
+          </th>
+        </tr><tr>
+          <td style="width: 25%">
+            <?php echo $form['relation[startDate]'] ?>
+            <?php echo $form['relation[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['relation[endDate]'] ?>
+            <?php echo $form['relation[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 colspan="2" style="width: 50%">
+            <?php echo $form['relation[dateDisplay]'] ?>
+            <?php echo $form['relation[dateDisplay]']
+              ->help(__('"Record the start and, when relevant, the end date of 
the relationship." (ISDF 5.3.4) Enter the date as you would like it to appear 
in the show page for the function, using qualifiers and/or typographical 
symbols to express uncertainty if desired.'))
+              ->renderHelp() ?>
+          </td>
+        </tr><tr>
+          <td colspan="4">
+            <?php echo __('%1% - dates must be specified in ISO-8601 format 
(YYYY-MM-DD)', array('%1%' => '&dagger;'))?>
+          </td>
+        </tr>
+      </tbody>
+    </table>
+
+    <table class="inline" id="relatedEntityDisplay">
+      <caption>
+        <?php echo __('Related authority records') ?>
+      </caption><thead>
+        <tr>
+          <th style="width: 25%">
+            <?php echo __('Identifier/name') ?>
+          </th><th style="width: 30%">
+            <?php echo __('Nature of relationship') ?>
+          </th><th style="width: 20%">
+            <?php echo __('Dates') ?>
+          </th><th style="width: 10%; text-align: center">
+            <?php echo image_tag('delete', array('align' => 'top', 'class' => 
'deleteIcon')) ?>
+          </th>
+        </tr>
+      </thead><tbody>
+        <?php foreach ($actorRelations as $item): ?>
+          <tr id="<?php echo url_for(array($item, 'module' => 'relation')) ?>" 
class="related_obj_<?php echo $item->id ?>">
+            <td>
+              <?php echo render_title($item->object) ?>
+            </td><td>
+              <?php echo 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID) ?>
+            </td><td>
+              <?php if (0 < strlen($dateDisplay = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)) || 0 < 
count($dateArray = $item->getDates())): ?>
+                <?php if (0 < strlen($dateDisplay)): ?>
+                  <?php echo $dateDisplay ?>
+                <?php elseif (2 == count($dateArray)): ?>
+                  <?php echo __('%1% - %2%', array('%1%' => 
Qubit::renderDate($dateArray['start']), '%2%' => 
Qubit::renderDate($dateArray['end']))) ?>
+                <?php else: ?>
+                  <?php echo Qubit::renderDate(array_shift($dateArray)) ?>
+                <?php endif; ?>
+              <?php endif; ?>
+            </td><td style="text-align: center">
+              <input type="checkbox" name="deleteRelations[<?php echo 
$item->id ?>]" value="delete" class="multiDelete" />
+            </td>
+          </tr>
+        <?php endforeach; ?>
+      </tbody>
+    </table>
+
+    <?php
+
+    // Template for new display table rows
+    $rowTemplate = '<tr id="{relatedEntity[id]}">'
+      .'  <td>'
+      .'    {relatedEntity[object]}'
+      .'  </td><td>'
+      .'    {relatedEntity[description]}'
+      .'  </td><td>'
+      .'    {relatedEntity[dateDisplay]}'
+      .'  </td><td style="text-align: right">'
+      ."    $editImage $deleteBtn"
+      .'  </td>'
+      .'</tr>';
+
+    echo javascript_tag(<<<content
+Drupal.behaviors.dialogRelatedEntity = {
+  attach: function (context)
+    {
+      // Define dialog
+      Qubit.dialogRelatedEntity = new QubitDialog('relatedEntity', {
+        'displayTable': 'relatedEntityDisplay',
+        'newRowTemplate': '$rowTemplate',
+        'handleFieldRender': handleFieldRender }, jQuery);
+
+      // Add edit link/icon to "relatedFunctions" rows
+      jQuery('#relatedEntityDisplay tr').each(function ()
+        {
+          var thisUri = this.id;
+          if (undefined != thisUri)
+          {
+            jQuery('td:last', this).prepend('<a 
href="javascript:Qubit.dialogRelatedEntity.open(\'' + thisUri + 
'\')">$editImage</a>');
+          }
+        });
+    } }
+
+content
+) ?>
+
+    <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
+    <!-- NOTE: The dialog.js script cuts this *entire* table and pastes   -->
+    <!-- it in a YUI dialog object.                                       -->
+    <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
+    <table class="inline" id="relatedEntity">
+      <caption>
+        <?php echo __('Related authority record') ?>
+      </caption><tbody>
+        <tr>
+          <th colspan="4">
+            <?php echo $form['relatedEntity[object]']
+              ->label(__('Authorized form of name'))
+              ->renderLabel() ?>
+          </th>
+        </tr><tr>
+          <td colspan="4">
+            <?php echo $form['relatedEntity[object]']->render(array('class' => 
'form-autocomplete')) ?>
+            <input class="list" type="hidden" value="<?php echo 
url_for(array('module' => 'actor', 'action' => 'autocomplete', 'showOnlyActors' 
=> 'true')) ?>"/>
+            <?php echo $form['relatedEntity[object]']
+              ->help(__('Select the name from the drop-down menu; enter the 
identifier or the first few letters to narrow the choices. (ISDF 6.1)'))
+              ->renderHelp() ?>
+          </td>
+        </tr><tr>
+          <th colspan="4">
+            <?php echo $form['relatedEntity[description]']
+              ->label(__('Nature of relationship'))
+              ->renderLabel() ?>
+          </th>
+        </tr><tr>
+          <td colspan="4">
+            <?php echo $form['relatedEntity[description]'] ?>
+            <?php echo $form['relatedEntity[description]']
+              ->help(__('Describe the nature of the relationship between the 
function and the related authority record. (ISDF 6.2)'))
+              ->renderHelp() ?>
+          </td>
+        </tr><tr>
+          <th style="width: 25%">
+            <?php echo $form['relatedEntity[startDate]']
+              ->label(__('Date&dagger;'))
+              ->renderLabel() ?>
+          </th><th style="width: 25%">
+            <?php echo $form['relatedEntity[endDate]']
+              ->label(__('End date&dagger;'))
+              ->renderLabel() ?>
+          </th><th colspan="2" style="width: 50%">
+            <?php echo $form['relatedEntity[dateDisplay]']
+              ->label(__('Date display&dagger;'))
+              ->renderLabel() ?>
+          </th>
+        </tr><tr>
+          <td style="width: 25%">
+            <?php echo $form['relatedEntity[startDate]'] ?>
+            <?php echo $form['relatedEntity[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['relatedEntity[endDate]'] ?>
+            <?php echo $form['relatedEntity[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 colspan="2" style="width: 50%">
+            <?php echo $form['relatedEntity[dateDisplay]'] ?>
+            <?php echo $form['relatedEntity[dateDisplay]']
+              ->help(__('"Record, when relevant, the start and the end date of 
the relationship." (ISDF 6.3) Enter the date as you would like it to appear in 
the show page for the function, using qualifiers and/or typographical symbols 
to express uncertainty if desired.'))
+              ->renderHelp() ?>
+          </td>
+        </tr><tr>
+          <td colspan="4">
+            <?php echo __('%1% - dates must be specified in ISO-8601 format 
(YYYY-MM-DD)', array('%1%' => '&dagger;'))?>
+          </td>
+        </tr>
+      </tbody>
+    </table>
+
+    <table class="inline" id="relatedResourceDisplay">
+      <caption>
+        <?php echo __('Related resources') ?>
+      </caption><thead>
+        <tr>
+          <th style="width: 25%">
+            <?php echo __('Identifier/title') ?>
+          </th><th style="width: 30%">
+            <?php echo __('Nature of relationship') ?>
+          </th><th style="width: 20%">
+            <?php echo __('Dates') ?>
+          </th><th style="width: 10%; text-align: center">
+            <?php echo image_tag('delete', array('align' => 'top', 'class' => 
'deleteIcon')) ?>
+          </th>
+        </tr>
+      </thead><tbody>
+        <?php foreach ($infoObjectRelations as $item): ?>
+          <tr id="<?php echo url_for(array($item, 'module' => 'relation')) ?>" 
class="<?php echo 'related_obj_'.$item->id ?>">
+            <td>
+              <?php echo render_title($item->object) ?>
+            </td><td>
+              <?php echo 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID) ?>
+            </td><td>
+              <?php if (0 < strlen($dateDisplay = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)) || 0 < 
count($dateArray = $item->getDates())): ?>
+                <?php if (0 < strlen($dateDisplay)): ?>
+                  <?php echo $dateDisplay ?>
+                <?php elseif (2 == count($dateArray)): ?>
+                  <?php echo __('%1% - %2%', array('%1%' => 
Qubit::renderDate($dateArray['start']), '%2%' => 
Qubit::renderDate($dateArray['end']))) ?>
+                <?php else: ?>
+                  <?php echo Qubit::renderDate(array_shift($dateArray)) ?>
+                <?php endif; ?>
+              <?php endif; ?>
+            </td><td style="text-align: center">
+              <input type="checkbox" name="deleteRelations[<?php echo 
$item->id ?>]" value="delete" class="multiDelete" />
+            </td>
+          </tr>
+        <?php endforeach; ?>
+      </tbody>
+    </table>
+
+    <?php
+
+    // Template for new display table rows
+    $rowTemplate = '<tr id="{relatedResource[id]}">'
+      .'  <td>'
+      .'    {relatedResource[object]}'
+      .'  </td><td>'
+      .'    {relatedResource[description]}'
+      .'  </td><td>'
+      .'    {relatedResource[dateDisplay]}'
+      .'  </td><td style="text-align: right">'
+      ."    $editImage $deleteBtn"
+      .'  </td>'
+      .'</tr>';
+
+    echo javascript_tag(<<<content
+Drupal.behaviors.dialog2 = {
+  attach: function (context)
+    {
+      // Define dialog
+      Qubit.dialog2 = new QubitDialog('relatedResource', {
+        'displayTable': 'relatedResourceDisplay',
+        'newRowTemplate': '$rowTemplate',
+        'handleFieldRender': handleFieldRender }, jQuery);
+
+      // Add edit link/icon to "relatedFunctions" rows
+      jQuery('#relatedResourceDisplay tr').each(function ()
+        {
+          var thisUri = this.id;
+          if (undefined != thisUri)
+          {
+            jQuery('td:last', this).prepend('<a 
href="javascript:Qubit.dialog2.open(\'' + thisUri + '\')">$editImage</a>');
+          }
+        });
+    } }
+
+content
+) ?>
+
+    <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
+    <!-- NOTE: The dialog.js script cuts this *entire* table and pastes   -->
+    <!-- it in a YUI dialog object.                                       -->
+    <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
+    <table class="inline" id="relatedResource">
+      <caption>
+        <?php echo __('Related resource') ?>
+      </caption><tbody>
+        <tr>
+          <th colspan="4">
+            <?php echo $form['relatedResource[object]']
+              ->label(__('Title'))
+              ->renderLabel() ?>
+          </th>
+        </tr><tr>
+          <td colspan="4">
+            <?php echo $form['relatedResource[object]']->render(array('class' 
=> 'form-autocomplete')) ?>
+            <input class="list" type="hidden" value="<?php echo 
url_for(array('module' => 'informationobject', 'action' => 'autocomplete')) 
?>"/>
+            <?php echo $form['relatedResource[object]']
+              ->help(__('Select the title from the drop-down menu; enter the 
identifier or the first few letters to narrow the choices. (ISDF 6.1)'))
+              ->renderHelp() ?>
+          </td>
+        </tr><tr>
+          <th colspan="4">
+            <?php echo $form['relatedResource[description]']
+              ->label(__('Nature of relationship'))
+              ->renderLabel() ?>
+          </th>
+        </tr><tr>
+          <td colspan="4">
+            <?php echo $form['relatedResource[description]'] ?>
+            <?php echo $form['relatedResource[description]']
+              ->help(__('Describe the nature of the relationship between the 
function and the related resource. (ISDF 6.2)'))
+              ->renderHelp() ?>
+          </td>
+        </tr><tr>
+          <th style="width: 25%">
+            <?php echo $form['relatedResource[startDate]']
+              ->label(__('Date&dagger;'))
+              ->renderLabel() ?>
+          </th><th style="width: 25%">
+            <?php echo $form['relatedResource[endDate]']
+              ->label(__('End date&dagger;'))
+              ->renderLabel() ?>
+          </th><th colspan="2" style="width: 50%">
+            <?php echo $form['relatedResource[dateDisplay]']
+              ->label(__('Date display&dagger;'))
+              ->renderLabel() ?>
+          </th>
+        </tr><tr>
+          <td style="width: 25%">
+            <?php echo $form['relatedResource[startDate]'] ?>
+            <?php echo $form['relatedResource[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]']
+              ->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 colspan="2" style="width: 50%">
+            <?php echo $form['relatedResource[dateDisplay]'] ?>
+            <?php echo $form['relatedResource[dateDisplay]']
+              ->help(__('"Record, when relevant, the start and the end date of 
the relationship." (ISDF 6.3) Enter the date as you would like it to appear in 
the show page for the function, using qualifiers and/or typographical symbols 
to express uncertainty if desired.'))
+              ->renderHelp() ?>
+          </td>
+        </tr><tr>
+          <td colspan="4">
+            <?php echo __('%1% - dates must be specified in ISO-8601 format 
(YYYY-MM-DD)', array('%1%' => '&dagger;'))?>
+          </td>
+        </tr>
+      </tbody>
+    </table>
+
+  </fieldset>
+
+  <fieldset class="collapsible collapsed" id="controlArea">
+
+    <legend><?php echo __('Control area') ?></legend>
+
+    <?php echo render_field($form->descriptionIdentifier
+      ->help(__('"Record a unique description identifier in accordance with 
local and/or national conventions. If the description is to be used 
internationally, record the code of the country in which the description was 
created in accordance with the latest version of ISO 3166 Codes for the 
representation of names of countries. Where the creator of the description is 
an international organisation, give the organisational identifier in place of 
the country code." (ISDF 5.4.1)'))
+      ->label(__('Description identifier').'<span class="form-required" 
title="'.__('This is a mandatory element.').'">*</span>'), $resource) ?>
+
+    <?php echo render_field($form->institutionIdentifier
+      ->help(__('"Record the full authorised form of name(s) of agency(ies) 
responsible for creating, modifying or disseminating the description or, 
alternatively, record a recognized code for the agency." (ISDF 5.4.2)'))
+      ->label(__('Institution identifier')), $resource) ?>
+
+    <?php echo render_field($form->rules
+      ->help(__('"Purpose: To identify the national or international 
conventions or rules applied in creating the archival description. Rule: Record 
the names and where useful the editions or publication dates of the conventions 
or rules applied." (ISDF 5.4.3)'))
+      ->label(__('Rules and/or conventions used')), $resource, array('class' 
=> 'resizable')) ?>
+
+    <?php echo $form->descriptionStatus
+      ->help(__('The purpose of this field is "[t]o indicate the drafting 
status of the description so that users can understand the current status of 
the description." (ISDF 5.4.4). Select Final, Revised or Draft from the 
drop-down menu.'))
+      ->label(__('Status'))
+      ->renderRow() ?>
+
+    <?php echo $form->descriptionDetail
+      ->help(__('Select Full, Partial or Minimal from the drop-down menu. "In 
the absence of national guidelines or rules, minimum records are those that 
consist only of the three essential elements of an ISDF compliant record (see 
4.7), while full records are those that convey information for all relevant 
ISDF elements of description." (ISDF 5.4.5)'))
+      ->label(__('Level of detail'))
+      ->renderRow() ?>
+
+    <?php echo render_field($form->revisionHistory
+      ->help(__('"Record the date the description was created and the dates of 
any revisions to the description." (ISDF 5.4.6)'))
+      ->label(__('Dates of creation, revision or deletion')), $resource, 
array('class' => 'resizable')) ?>
+
+    <?php echo $form->language
+      ->help(__('Select the language(s) of this record from the drop-down 
menu; enter the first few letters to narrow the choices. (ISDF 5.4.7)'))
+      ->label(__('Language(s)'))
+      ->renderRow(array('class' => 'form-autocomplete')) ?>
+
+    <?php echo $form->script
+      ->help(__('Select the script(s) of this record from the drop-down menu; 
enter the first few letters to narrow the choices. (ISDF 5.4.7)'))
+      ->label(__('Script(s)'))
+      ->renderRow(array('class' => 'form-autocomplete')) ?>
+
+    <?php echo render_field($form->sources
+      ->help(__('"Record the sources consulted in establishing the function 
description." (ISDF 5.4.8)')), $resource, array('class' => 'resizable')) ?>
+
+    <?php echo render_field($form->maintenanceNotes
+      ->help(__('"Record notes pertinent to the creation and maintenance of 
the description." (ISDF 5.4.9)')), $maintenanceNote, array('name' => 'content', 
'class' => 'resizable')) ?>
+
+  </fieldset>
+
+  <div class="actions section">
+
+    <h2 class="element-invisible"><?php echo __('Actions') ?></h2>
+
+    <div class="content">
+      <ul class="clearfix links">
+        <?php if (isset($sf_request->id)): ?>
+          <li><?php echo link_to(__('Cancel'), array($resource, 'module' => 
'function')) ?></li>
+          <li><input class="form-submit" type="submit" value="<?php echo 
__('Save') ?>"/></li>
+        <?php else: ?>
+          <li><?php echo link_to(__('Cancel'), array('module' => 'function', 
'action' => 'list')) ?></li>
+          <li><input class="form-submit" type="submit" value="<?php echo 
__('Create') ?>"/></li>
+        <?php endif; ?>
+      </ul>
+    </div>
+
+  </div>
+
+</form>

Copied: 
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/indexSuccess.php 
(from r8186, trunk/apps/qubit/modules/function/templates/indexIsdfSuccess.php)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/indexSuccess.php  
Sun Oct 17 10:44:18 2010        (r8192, copy of r8186, 
trunk/apps/qubit/modules/function/templates/indexIsdfSuccess.php)
@@ -0,0 +1,242 @@
+<h1><?php echo __('View ISDF function') ?></h1>
+
+<?php echo link_to_if(QubitAcl::check($resource, 'update'), '<h1 
class="label">'.render_title($resource).'</h1>', array($resource, 'module' => 
'function', 'action' => 'edit'), array('title' => __('Edit function'))) ?>
+
+<?php if (isset($errorSchema)): ?>
+  <div class="messages error">
+    <ul>
+      <?php foreach ($errorSchema as $error): ?>
+        <li><?php echo $error ?></li>
+      <?php endforeach; ?>
+    </ul>
+  </div>
+<?php endif; ?>
+
+<div class="section" id="identityArea">
+
+  <?php echo link_to_if(QubitAcl::check($resource, 'update'), 
'<h2>'.__('Identity area').'</h2>', array($resource, 'module' => 'function', 
'action' => 'edit'), array('anchor' => 'identityArea', 'title' => __('Edit 
identity area'))) ?>
+
+  <?php echo render_show(__('Type'), render_value($resource->type)) ?>
+
+  <?php echo render_show(__('Authorized form of name'), 
render_value($resource->getAuthorizedFormOfName(array('cultureFallback' => 
true)))) ?>
+
+  <div class="field">
+    <h3><?php echo __('Parallel form(s) of name') ?></h3>
+    <div>
+      <ul>
+        <?php foreach ($resource->getOtherNames(array('typeId' => 
QubitTerm::PARALLEL_FORM_OF_NAME_ID)) as $item): ?>
+          <li><?php echo render_value($item) ?></li>
+        <?php endforeach; ?>
+      </ul>
+    </div>
+  </div>
+
+  <div class="field">
+    <h3><?php echo __('Other form(s) of name') ?></h3>
+    <div>
+      <ul>
+        <?php foreach ($resource->getOtherNames(array('typeId' => 
QubitTerm::OTHER_FORM_OF_NAME_ID)) as $item): ?>
+          <li><?php echo render_value($item) ?></li>
+        <?php endforeach; ?>
+      </ul>
+    </div>
+  </div>
+
+  <?php echo render_show(__('Classification'), 
render_value($resource->getClassification(array('cultureFallback' => true)))) ?>
+
+</div> <!-- /.section#identityArea -->
+
+<!-- Context area -->
+<div class="section" id="contextArea">
+
+  <?php echo link_to_if(QubitAcl::check($resource, 'update'), 
'<h2>'.__('Context area').'</h2>', array($resource, 'module' => 'function', 
'action' => 'edit'), array('anchor' => 'contextArea', 'title' => __('Edit 
context area'))) ?>
+
+  <?php echo render_show(__('Dates'), 
render_value($resource->getDates(array('cultureFallback' => true)))) ?>
+
+  <?php echo render_show(__('Description'), 
render_value($resource->getDescription(array('cultureFallback' => true)))) ?>
+
+  <?php echo render_show(__('History'), 
render_value($resource->getHistory(array('cultureFallback' => true)))) ?>
+
+  <?php echo render_show(__('Legislation'), 
render_value($resource->getLegislation(array('cultureFallback' => true)))) ?>
+
+</div> <!-- /.section#contextArea -->
+
+<!-- Relationships area -->
+<div class="section" id="relationshipsArea">
+
+  <?php echo link_to_if(QubitAcl::check($resource, 'update'), 
'<h2>'.__('Relationships area').'</h2>', array($resource, 'module' => 
'function', 'action' => 'edit'), array('anchor' => 'relationshipsArea', 'title' 
=> __('Edit relationships area'))) ?>
+
+  <?php foreach ($resourcetionRelations as $item): ?>
+    <div class="field">
+      <h3><?php echo __('Related function') ?></h3>
+      <div>
+
+        <?php echo render_show(__('Authorized form of name'), 
link_to($item->getOpposedObject($resource->id), 
array($item->getOpposedObject($resource->id), 'module' => 'function'))) ?>
+
+        <?php echo render_show(__('Identifier'), 
$item->getOpposedObject($resource->id)->getDescriptionIdentifier(array('cultureFallback'
 => true))) ?>
+
+        <?php echo render_show(__('Type'), 
render_value($item->getOpposedObject($resource->id)->type)) ?>
+
+        <?php echo render_show(__('Category of relationship'), 
render_value($item->type)) ?>
+
+        <?php if (null !== $note = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID)): ?>
+          <?php echo render_show(__('Description of relationship'), 
render_value($note->getContent(array('cultureFallback' => true)))) ?>
+        <?php endif; ?>
+
+        <div class="field">
+          <h3><?php echo __('Dates of relationship') ?></h3>
+          <div>
+            <?php if (null !== $note = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)): ?>
+              <?php echo 
render_value($note->getContent(array('cultureFallback' => true))) ?>
+            <?php elseif (1 < count($dateArray = $relation->getDates())): ?>
+              <?php echo __('%1% - %2%', array('%1%' => 
Qubit::renderDate($dateArray['start']), '%2%' => 
Qubit::renderDate($dateArray['end']))) ?>
+            <?php else: ?>
+              <?php echo Qubit::renderDate(array_shift($dateArray)) ?>
+            <?php endif; ?>
+          </div>
+        </div>
+
+      </div>
+    </div>
+  <?php endforeach; ?>
+
+  <?php foreach ($actorRelations as $item): ?>
+    <div class="field">
+      <h3><?php echo __('Related authority record') ?></h3>
+      <div>
+
+        <?php echo render_show(__('Authorized form of name'), 
link_to($item->object->getAuthorizedFormOfName(array('cultureFallback' => 
true)), array($item->object, 'module' => 'actor'))) ?>
+
+        <?php echo render_show(__('Identifier'), 
render_value($item->object->descriptionIdentifier)) ?>
+
+        <?php if (null !== $note = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID)): ?>
+          <?php echo render_show(__('Nature of relationship'), 
render_value($note->getContent(array('cultureFallback' => true)))) ?>
+        <?php endif; ?>
+
+        <div class="field">
+          <h3><?php echo __('Dates of the relationship') ?></h3>
+          <div>
+            <?php if (null !== $note = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)): ?>
+              <?php echo 
render_value($note->getContent(array('cultureFallback' => true))) ?>
+            <?php elseif (1 < count($dateArray = $item->getDates())): ?>
+              <?php echo __('%1% - %2%', array('%1%' => 
Qubit::renderDate($dateArray['start']), '%2%' => 
Qubit::renderDate($dateArray['end']))) ?>
+            <?php else: ?>
+              <?php echo Qubit::renderDate(array_shift($dateArray)) ?>
+            <?php endif; ?>
+          </div>
+        </div>
+
+      </div>
+    </div>
+  <?php endforeach; ?>
+
+  <!-- Related archival material -->
+  <?php foreach ($infoObjectRelations as $item): ?>
+    <div class="field">
+      <h3><?php echo __('Related resource') ?></h3>
+      <div>
+
+        <?php echo render_show(__('Title'), 
link_to($item->object->getTitle(array('cultureFallback' => true)), 
array($item->object, 'module' => 'informationobject'))) ?>
+
+        <?php $isad = new sfIsadPlugin($item->object); echo 
render_show(__('Identifier'), $isad->referenceCode) ?>
+
+        <?php if (null !== $note = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID)): ?>
+          <?php echo render_show(__('Nature of relationship'), 
render_value($note->getContent(array('cultureFallback' => true)))) ?>
+        <?php endif; ?>
+
+        <div class="field">
+          <h3><?php echo __('Dates of the relationship') ?></h3>
+          <div>
+            <?php if (null !== $note = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)): ?>
+              <?php echo 
render_value($note->getContent(array('cultureFallback' => true))) ?>
+            <?php elseif (1 < count($item->getDates())): ?>
+              <?php echo __('%1% - %2%', array('%1%' => 
Qubit::renderDate($dateArray['start']), '%2%' => 
Qubit::renderDate($dateArray['end']))) ?>
+            <?php else: ?>
+              <?php echo Qubit::renderDate(array_shift($dateArray)) ?>
+            <?php endif; ?>
+          </div>
+        </div>
+
+      </div>
+    </div>
+  <?php endforeach; ?>
+
+</div> <!-- /.section#relationshipsArea -->
+
+<!-- Control area -->
+<div class="section" id="controlArea">
+
+  <?php echo link_to_if(QubitAcl::check($resource, 'update'), 
'<h2>'.__('Control area').'</h2>', array($resource, 'module' => 'function', 
'action' => 'edit'), array('anchor' => 'controlArea', 'title' => __('Edit 
control area'))) ?>
+
+  <?php echo render_show(__('Description identifier'), 
render_value($resource->descriptionIdentifier)) ?>
+
+  <?php echo render_show(__('Institution identifier'), 
render_value($resource->getInstitutionIdentifier(array('cultureFallback' => 
true)))) ?>
+
+  <?php echo render_show(__('Rules and/or conventions used'), 
render_value($resource->getRules(array('cultureFallback' => true)))) ?>
+
+  <?php echo render_show(__('Status'), 
render_value($resource->descriptionStatus)) ?>
+
+  <?php echo render_show(__('Level of detail'), 
render_value($resource->descriptionDetail)) ?>
+
+  <?php echo render_show(__('Dates of creation, revision or deletion'), 
render_value($resource->getRevisionHistory(array('cultureFallback' => true)))) 
?>
+
+  <div class="field">
+    <h3><?php echo __('Language(s)') ?></h3>
+    <div>
+      <ul>
+        <?php foreach ($resource->language as $code): ?>
+          <li><?php echo format_language($code) ?></li>
+        <?php endforeach; ?>
+      </ul>
+    </div>
+  </div>
+
+  <div class="field">
+    <h3><?php echo __('Script(s)') ?></h3>
+    <div>
+      <ul>
+        <?php foreach ($resource->script as $code): ?>
+          <li><?php echo format_script($code) ?></li>
+        <?php endforeach; ?>
+      </ul>
+    </div>
+  </div>
+
+  <?php echo render_show(__('Sources'), 
render_value($resource->getSources(array('cultureFallback' => true)))) ?>
+
+  <div class="field">
+    <h3><?php echo __('Maintenance notes') ?></h3>
+    <div>
+      <?php if (isset($maintenanceNotes[0])): ?>
+        <?php echo 
render_value($maintenanceNotes[0]->getContent(array('cultureFallback' => 
true))) ?>
+      <?php endif; ?>
+    </div>
+  </div>
+
+</div> <!-- /.section#controlArea -->
+
+<?php if (QubitAcl::check($resource, 'update') || QubitAcl::check($resource, 
'delete') || QubitAcl::check($resource, 'create')): ?>
+  <div class="actions section">
+
+    <h2 class="element-invisible"><?php echo __('Actions') ?></h2>
+
+    <div class="content">
+      <ul class="clearfix links">
+
+        <?php if (QubitAcl::check($resource, 'update')): ?>
+          <li><?php echo link_to(__('Edit'), array($resource, 'module' => 
'function', 'action' => 'edit'), array('title' => __('Edit'))) ?></li>
+        <?php endif; ?>
+
+        <?php if (QubitAcl::check($resource, 'delete')): ?>
+          <li><?php echo link_to(__('Delete'), array($resource, 'module' => 
'function', 'action' => 'delete'), array('title' => __('Delete'))) ?></li>
+        <?php endif; ?>
+
+        <?php if (QubitAcl::check($resource, 'create')): ?>
+          <li><?php echo link_to(__('Add new'), array('module' => 'function', 
'action' => 'create'), array('title' => __('Add new'))) ?></li>
+        <?php endif; ?>
+
+      </ul>
+    </div>
+
+  </div>
+<?php endif; ?>

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