Author: jablko
Date: Thu Oct 7 18:52:57 2010
New Revision: 8025
Log:
Use symfony form for start date, end date, and date display fields
Modified:
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php
trunk/apps/qubit/modules/informationobject/templates/_eventForm.php
trunk/plugins/sfDcPlugin/modules/sfDcPlugin/templates/editSuccess.php
trunk/plugins/sfModsPlugin/modules/sfModsPlugin/templates/editSuccess.php
trunk/plugins/sfRadPlugin/modules/sfRadPlugin/actions/editAction.class.php
trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/editSuccess.php
Modified:
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php
==============================================================================
---
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php
Thu Oct 7 17:25:54 2010 (r8024)
+++
trunk/apps/qubit/modules/informationobject/actions/eventFormComponent.class.php
Thu Oct 7 18:52:57 2010 (r8025)
@@ -139,11 +139,26 @@
$this->form->getWidgetSchema()->actor->setHelp($this->context->i18n->__('Use
the actor name field to link an authority record to this description. Search
for an existing name in the authority records by typing the first few
characters of the name. Alternatively, type a new name to create and link to a
new authority record.'));
+ $this->form->setValidator('dateDisplay', new sfValidatorString);
+ $this->form->setWidget('dateDisplay', new sfWidgetFormInput);
+
+
$this->form->getWidgetSchema()->dateDisplay->setHelp($this->context->i18n->__('Enter
free-text information, including qualifiers or typographical symbols to
express uncertainty, to change the way the date displays. If this field is not
used, the default will be the start and end years only.'));
+
+ $this->form->setValidator('endDate', new sfValidatorString);
+ $this->form->setWidget('endDate', new sfWidgetFormInput);
+
+
$this->form->getWidgetSchema()->endDate->setHelp($this->context->i18n->__('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.'));
+
$this->form->setValidator('place', new sfValidatorString);
$this->form->setWidget('place', new sfWidgetFormSelect(array('choices' =>
array())));
$this->form->getWidgetSchema()->place->setHelp($this->context->i18n->__('Search
for an existing term in the places taxonomy by typing the first few characters
of the term name. Alternatively, type a new term to create and link to a new
place term.'));
+ $this->form->setValidator('startDate', new sfValidatorString);
+ $this->form->setWidget('startDate', new sfWidgetFormInput);
+
+
$this->form->getWidgetSchema()->startDate->setHelp($this->context->i18n->__('Enter
the start year. Do not use any qualifiers or typographical symbols to express
uncertainty.'));
+
// Event types, Dublin Core is restricted
$eventTypes = QubitTerm::getEventTypes();
if ('sfDcPlugin' == $request->getParameter('module'))
Modified: trunk/apps/qubit/modules/informationobject/templates/_eventForm.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/_eventForm.php Thu Oct
7 17:25:54 2010 (r8024)
+++ trunk/apps/qubit/modules/informationobject/templates/_eventForm.php Thu Oct
7 18:52:57 2010 (r8025)
@@ -144,42 +144,34 @@
</td>
</tr><tr>
<th>
- <?php echo __('Date') ?>
+ <?php echo $form->startDate
+ ->label(__('Date'))
+ ->renderLabel() ?>
</th><th>
- <?php echo __('End date') ?>
+ <?php echo $form->endDate->renderLabel() ?>
</th><th>
- <?php echo __('Date display (defaults to date range)') ?>
+ <?php echo $form->dateDisplay
+ ->label(__('Date display (defaults to date range)'))
+ ->renderLabel() ?>
</th>
</tr><tr>
<td class="noline">
- <input name="updateEvent[startDate]"/>
+ <?php echo $form->startDate->render() ?>
- <?php if (isset($help['startDate'])): ?>
- <div class="description">
- <?php echo $help['startDate'] ?>
- </div>
- <?php endif; ?>
+ <?php echo $form->startDate->renderHelp() ?>
</td><td class="noline">
- <input name="updateEvent[endDate]"/>
+ <?php echo $form->endDate->render() ?>
- <?php if (isset($help['endDate'])): ?>
- <div class="description">
- <?php echo $help['endDate'] ?>
- </div>
- <?php endif; ?>
+ <?php echo $form->endDate->renderHelp() ?>
</td><td class="noline">
- <input name="updateEvent[dateDisplay]"/>
+ <?php echo $form->dateDisplay->render() ?>
- <?php if (isset($help['dateDisplay'])): ?>
- <div class="description">
- <?php echo $help['dateDisplay'] ?>
- </div>
- <?php endif; ?>
+ <?php echo $form->dateDisplay->renderHelp() ?>
</td>
</tr><tr>
Modified: trunk/plugins/sfDcPlugin/modules/sfDcPlugin/templates/editSuccess.php
==============================================================================
--- trunk/plugins/sfDcPlugin/modules/sfDcPlugin/templates/editSuccess.php
Thu Oct 7 17:25:54 2010 (r8024)
+++ trunk/plugins/sfDcPlugin/modules/sfDcPlugin/templates/editSuccess.php
Thu Oct 7 18:52:57 2010 (r8025)
@@ -32,10 +32,7 @@
<div class="form-item">
<label for="events"><?php echo __('Names and dates') ?></label>
<?php echo get_partial('informationobject/relatedEvents', array('resource'
=> $resource)) ?>
- <?php echo get_partial('informationobject/eventForm',
$eventComponent->getVarHolder()->getAll() + array('help' => array(
- 'startDate' => __('Enter the start year. Do not use any qualifiers or
typographical symbols to express uncertainty.'),
- 'endDate' => __('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.'),
- 'dateDisplay' => __('Enter free-text information, including qualifiers
or typographical symbols to express uncertainty, to change the way the date
displays. If this field is not used, the default will be the start and end
years only.')))) ?>
+ <?php echo get_partial('informationobject/eventForm',
$eventComponent->getVarHolder()->getAll()) ?>
</div>
<div class="form-item">
Modified:
trunk/plugins/sfModsPlugin/modules/sfModsPlugin/templates/editSuccess.php
==============================================================================
--- trunk/plugins/sfModsPlugin/modules/sfModsPlugin/templates/editSuccess.php
Thu Oct 7 17:25:54 2010 (r8024)
+++ trunk/plugins/sfModsPlugin/modules/sfModsPlugin/templates/editSuccess.php
Thu Oct 7 18:52:57 2010 (r8025)
@@ -34,10 +34,7 @@
<div class="form-item">
<label><?php echo __('Add new name and/or origin info') ?></label>
- <?php echo get_partial('informationobject/eventForm',
$eventComponent->getVarHolder()->getAll() + array('help' => array(
- 'startDate' => __('Enter the start year. Do not use any qualifiers or
typographical symbols to express uncertainty.'),
- 'endDate' => __('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.'),
- 'dateDisplay' => __('Enter free-text information, including qualifiers
or typographical symbols to express uncertainty, to change the way the date
displays. If this field is not used, the default will be the start and end
years only.')))) ?>
+ <?php echo get_partial('informationobject/eventForm',
$eventComponent->getVarHolder()->getAll()) ?>
</div>
<?php echo $form->type
Modified:
trunk/plugins/sfRadPlugin/modules/sfRadPlugin/actions/editAction.class.php
==============================================================================
--- trunk/plugins/sfRadPlugin/modules/sfRadPlugin/actions/editAction.class.php
Thu Oct 7 17:25:54 2010 (r8024)
+++ trunk/plugins/sfRadPlugin/modules/sfRadPlugin/actions/editAction.class.php
Thu Oct 7 18:52:57 2010 (r8025)
@@ -104,6 +104,7 @@
$this->eventComponent = new
InformationObjectEventFormComponent($this->context, 'informationobject',
'eventForm');
$this->eventComponent->execute($this->request);
+
$this->eventComponent->form->getWidgetSchema()->dateDisplay->setHelp($this->context->i18n->__('"Give
the date(s) of creation of the unit being described either as a single date,
or range of dates (for inclusive dates and/or predominant dates). Always give
the inclusive dates. When providing predominant dates, specify them as such,
preceded by the word predominant..." (1.4B2). Record probable and uncertain
dates in square brackets, using the conventions described in RAD 1.4B5.'));
$this->eventComponent->form->getWidgetSchema()->place->setHelp($this->context->i18n->__("\"For
an item, transcribe a place of publication, distribution, etc., in the form
and the grammatical case in which it appears.\" (RAD 1.4C1)
{$this->eventComponent->form->getWidgetSchema()->place->getHelp()}"));
$this->eventComponent->form->getWidgetSchema()->type->setHelp($this->context->i18n->__('Select
the type of activity that established the relation between the authority
record and the archival description (e.g. creation, accumulation, collection,
publication, etc.)'));
}
Modified:
trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/editSuccess.php
==============================================================================
--- trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/editSuccess.php
Thu Oct 7 17:25:54 2010 (r8024)
+++ trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/editSuccess.php
Thu Oct 7 18:52:57 2010 (r8025)
@@ -174,9 +174,6 @@
<div class="form-item">
<label for=""><?php echo __('Add new name and/or origin info') ?></label>
<?php echo get_partial('informationobject/eventForm',
$eventComponent->getVarHolder()->getAll() + array('help' => array(
- 'startDate' => __('Enter the start year. Do not use any qualifiers or
typographical symbols to express uncertainty.'),
- 'endDate' => __('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.'),
- 'dateDisplay' => __('"Give the date(s) of creation of the unit being
described either as a single date, or range of dates (for inclusive dates
and/or predominant dates). Always give the inclusive dates. When providing
predominant dates, specify them as such, preceded by the word predominant..."
(1.4B2). Record probable and uncertain dates in square brackets, using the
conventions described in RAD 1.4B5.'),
'description' => __('"Make notes on dates and any details pertaining
to the dates of creation, publication, or distribution, of the unit being
described that are not included in the Date(s) of creation, including
publication, distribution, etc., area and that are considered to be important.
" (RAD 1.8B8) "Make notes on the date(s) of accumulation or collection of the
unit being described." RAD 1.8B8a)')))) ?>
</div>
--
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.