Author: david
Date: Thu Dec 10 13:35:33 2009
New Revision: 4140
Log:
Remove separate component for function relationships.
Deleted:
trunk/apps/qubit/modules/function/actions/relationshipsComponent.class.php
trunk/apps/qubit/modules/function/templates/_relationships.php
Modified:
trunk/apps/qubit/modules/function/actions/editAction.class.php
trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php
trunk/web/js/dialog.js
Modified: trunk/apps/qubit/modules/function/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/function/actions/editAction.class.php Thu Dec
10 10:12:36 2009 (r4139)
+++ trunk/apps/qubit/modules/function/actions/editAction.class.php Thu Dec
10 13:35:33 2009 (r4140)
@@ -46,7 +46,14 @@
'language',
'script',
'sources',
- 'maintenanceNotes'
+ 'maintenanceNotes',
+ 'relation[authorizedFormOfName]',
+ 'relation[type]',
+ 'relation[category]',
+ 'relation[description]',
+ 'relation[dateStart]',
+ 'relation[dateEnd]',
+ 'relation[dateDisplay]'
);
protected function addField($name)
@@ -169,11 +176,42 @@
break;
+ case 'relation[category]':
+ $this->form->setValidator($name, new sfValidatorString);
+
+ $choices = array();
+ $choices[null] = null;
+
+ foreach
(QubitTaxonomy::getTermsById(QubitTaxonomy::ACTOR_RELATION_TYPE_ID) as $term)
+ {
+ $choices[$this->context->routing->generate(null, array('module' =>
'term', 'action' => 'show', 'id' => $term->id))] = $term;
+ }
+
+ $this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> $choices)));
+
+ break;
+
+ case 'relation[type]':
+ $this->form->setValidator($name, new sfValidatorString);
+
+ $choices = array();
+ $choices[null] = null;
+
+ foreach (QubitTaxonomy::getTermsById(QubitTaxonomy::FUNCTION_ID) as
$term)
+ {
+ $choices[$this->context->routing->generate(null, array('module' =>
'term', 'action' => 'show', 'id' => $term->id))] = $term;
+ }
+
+ $this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> $choices)));
+
+ break;
+
case 'authorizedFormOfName':
case 'classification':
case 'dates':
case 'descriptionIdentifier':
case 'institutionIdentifier':
+
$this->form->setDefault($name, $this->func[$name]);
$this->form->setValidator($name, new sfValidatorString);
$this->form->setWidget($name, new sfWidgetFormInput);
@@ -191,6 +229,21 @@
$this->form->setWidget($name, new sfWidgetFormTextarea);
break;
+
+ case 'relation[authorizedFormOfName]':
+ case 'relation[dateStart]':
+ case 'relation[dateEnd]':
+ case 'relation[dateDisplay]':
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
+
+ break;
+
+ case 'relation[description]':
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormTextarea);
+
+ break;
}
}
@@ -340,6 +393,8 @@
$this->form->setWidget('serialNumber', new sfWidgetFormInputHidden);
}
+ $this->relatedFunctions =
QubitRelation::getRelationsBySubjectOrObjectId($this->func->id);
+
// Determine if user has edit priviliges
$this->editTaxonomyCredentials = false;
if (SecurityPriviliges::editCredentials($this->getUser(), 'term'))
@@ -370,26 +425,6 @@
$this->setTemplate('editIsdf');
}
- public function updateEventRelations()
- {
- //used to be updateInformationObjectRelations - TO DO: update to handle
relations via Event object
-
- if ($this->getRequestParameter('informationObjectId'))
- {
- if ($this->getRequestParameter('func_role_id'))
- {
- $funcRoleId = $this->getRequestParameter('func_role_id');
- }
- else
- {
- //default role is Creator
- $funcRoleId = QubitTerm::EXISTENCE_ID;
- }
-
-
$this->func->addInformationObjectRelation($this->getRequestParameter('informationObjectId'),
$funcRoleId, $this->getRequestParameter('relation_dates'));
- }
- }
-
/**
* Update func relationships
*
Modified: trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php Thu Dec
10 10:12:36 2009 (r4139)
+++ trunk/apps/qubit/modules/function/templates/editIsdfSuccess.php Thu Dec
10 13:35:33 2009 (r4140)
@@ -62,7 +62,137 @@
<fieldset class="collapsible collapsed" id="relationshipsArea">
<legend><?php echo __('relationships area'); ?></legend>
- <?php include_component('function', 'relationships', array('func' =>
$func, 'form' => $form)) ?>
+<?php if(0 < count($relatedFunctions)): ?>
+<div class="form-item">
+ <table class="inline" id="relatedFunctions">
+ <caption><?php echo __('Related corporate bodies, archival materials and
other resources'); ?></caption>
+ <tr>
+ <th style="width: 25%"><?php echo __('name'); ?></th>
+ <th style="width: 15%"><?php echo __('type'); ?></th>
+ <th style="width: 20%"><?php echo __('dates'); ?></th>
+ <th style="width: 30%"><?php echo __('description'); ?></th>
+ <th style="width: 10%; text-align: center"><?php echo
image_tag('delete', array('align' => 'top', 'class' => 'deleteIcon')) ?></th>
+ </tr>
+ <?php if (0 < count($relatedFunctions)): ?>
+ <?php foreach ($relatedFunctions as $relatedFunction): ?>
+ <tr id="<?php echo 'functionRelation_'.$relatedFunction->getId() ?>"
class="<?php echo 'related_obj_'.$relatedFunction->getId() ?>">
+ <?php if ($relatedFunction->getObjectId() == $func->getId()): ?>
+ <td><?php echo
$relatedFunction->getSubject()->getAuthorizedFormOfName() ?></td>
+ <?php else: ?>
+ <td><?php echo
$relatedFunction->getObject()->getAuthorizedFormOfName() ?></td>
+ <?php endif; ?>
+ <td><?php echo $relatedFunction->getType() ?></td>
+ <td>
+ <?php if (0 < strlen($dateDisplay =
$relatedFunction->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)) ||
0 < count($dateArray = $relatedFunction->getDates())): ?>
+ <?php if (0 < strlen($dateDisplay)): ?>
+ <?php echo $dateDisplay ?>
+ <?php elseif (2 == count($dateArray)): ?>
+ <?php echo __('%1% - %2%', array('%1%' =>
collapse_date($dateArray['start']), '%2%' => collapse_date($dateArray['end'])))
?>
+ <?php else: ?>
+ <?php echo collapse_date(array_shift($dateArray)) ?>
+ <?php endif; ?>
+ <?php endif; ?>
+ </td>
+ <td><?php echo
$relatedFunction->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID)
?></td>
+ <td style="text-align: center;">
+ <input type="checkbox" name="deleteRelations[<?php echo
$relatedFunction->getId() ?>]" value="delete" class="multiDelete" />
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ <?php endif; ?>
+ </table>
+ </div>
+ <?php endif; ?>
+
+ <?php echo javascript_tag(<<<EOF
+// Bind relationship submit behavior
+Drupal.behaviors.relationFormSubmit = {
+ attach: function (context)
+ {
+ $('form#editForm').submit(function ()
+ {
+ appendHiddenFields($(this), {
+ "inputNamePattern": /relation\[(\w+)\]/,
+ "outputNameFormat": "relations[%d][%s]"
+ } )
+ } );
+ }
+}
+EOF
+) ?>
+ <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
+ <!-- NOTE: The dialog.js script cuts this *entire* table and pastes -->
+ <!-- it in a YUI dialog object. -->
+ <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
+ <table class="inline dialog" 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() ?>
+ </td>
+ </tr>
+ <tr>
+ <th colspan="2" style="width: 50%">
+ <?php echo $form['relation[type]']->label('type')->renderLabel() ?>
+ </th>
+ <th colspan="2" style="width: 50%">
+ <?php echo
$form['relation[category]']->label('category')->renderLabel() ?>
+ </th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <?php echo $form['relation[type]']->label('type')->render() ?>
+ </td>
+ <td colspan="2">
+ <?php echo $form['relation[category]']->render() ?>
+ </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]']->render() ?>
+ </td>
+ </tr>
+ <tr>
+ <th style="width: 25%">
+ <?php echo
$form['relation[dateStart]']->label('date†')->renderLabel() ?>
+ </th>
+ <th style="width: 25%">
+ <?php echo $form['relation[dateEnd]']->label('end
date†')->renderLabel() ?>
+ </th>
+ <th colspan="2" style="width: 50%">
+ <?php echo $form['relation[dateDisplay]']->label('date
display†')->renderLabel() ?>
+ </th>
+ </tr>
+ <tr>
+ <td style="width: 25%">
+ <?php echo $form['relation[dateStart]']->render() ?>
+ </td>
+ <td style="width: 25%">
+ <?php echo $form['relation[dateEnd]']->render() ?>
+ </td>
+ <td colspan="2" style="width: 50%">
+ <?php echo $form['relation[dateDisplay]']->render() ?>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="4">
+ <?php echo __('%1% - required field', array('%1%' => '*'))?><br />
+ <?php echo __('%1% - dates must be specified in ISO-8601 format
(YYYY-MM-DD)', array('%1%' => '†'))?>
+ </td>
+ </tr>
+ </tbody>
+ </table>
</fieldset>
<fieldset class="collapsible collapsed" id="controlArea">
Modified: trunk/web/js/dialog.js
==============================================================================
--- trunk/web/js/dialog.js Thu Dec 10 10:12:36 2009 (r4139)
+++ trunk/web/js/dialog.js Thu Dec 10 13:35:33 2009 (r4140)
@@ -1,6 +1,5 @@
// $Id$
-
-
+
// Build object for holding dialog data
var QubitDialog = function()
{
--
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.