Author: jablko
Date: Sat Oct 23 08:56:30 2010
New Revision: 8396
Log:
Factor into Qubit::renderDateStartEnd()
Modified:
trunk/apps/qubit/modules/event/actions/editComponent.class.php
trunk/js/date.js
trunk/lib/Qubit.class.php
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_event.php
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedAuthorityRecord.php
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/indexSuccess.php
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedAuthorityRecord.php
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedFunction.php
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedResource.php
Modified: trunk/apps/qubit/modules/event/actions/editComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/event/actions/editComponent.class.php Sat Oct
23 00:03:15 2010 (r8395)
+++ trunk/apps/qubit/modules/event/actions/editComponent.class.php Sat Oct
23 08:56:30 2010 (r8396)
@@ -147,10 +147,7 @@
foreach ($this->request->deleteEvents as $item)
{
$params = $this->context->routing->parse(Qubit::pathInfo($item));
- if (isset($params['_sf_route']->resource))
- {
- $params['_sf_route']->resource->delete();
- }
+ $params['_sf_route']->resource->delete();
}
}
}
Modified: trunk/js/date.js
==============================================================================
--- trunk/js/date.js Sat Oct 23 00:03:15 2010 (r8395)
+++ trunk/js/date.js Sat Oct 23 08:56:30 2010 (r8396)
@@ -7,15 +7,15 @@
{
$('.date', context).each(function ()
{
- var $dateStart = $('[id$=startDate]', this);
- var $dateEnd = $('[id$=endDate]', this);
+ var $start = $('[id$=startDate]', this);
+ var $end = $('[id$=endDate]', this);
var min = '';
var max = '';
$('[id$=dateDisplay]', this).change(function ()
{
- if (min === $dateStart.val() && max === $dateEnd.val())
+ if (min === $start.val() && max === $end.val())
{
min = max = [];
@@ -60,8 +60,8 @@
});
}
- $dateStart.val(min = min.join('-'));
- $dateEnd.val(max = max.join('-'));
+ $start.val(min = min.join('-'));
+ $end.val(max = max.join('-'));
}
});
});
Modified: trunk/lib/Qubit.class.php
==============================================================================
--- trunk/lib/Qubit.class.php Sat Oct 23 00:03:15 2010 (r8395)
+++ trunk/lib/Qubit.class.php Sat Oct 23 08:56:30 2010 (r8396)
@@ -60,6 +60,27 @@
return preg_replace($pattern, $replacement, $value);
}
+ public static function renderDateStartEnd($date, $start, $end)
+ {
+ if (isset($date))
+ {
+ return $date;
+ }
+
+ if (isset($start) || isset($end))
+ {
+ $start = Qubit::renderDate($start);
+ $end = Qubit::renderDate($end);
+
+ if ($end == $start)
+ {
+ return $start;
+ }
+
+ return "$start - $end";
+ }
+ }
+
public static function saveTemporaryFile($name, $contents)
{
// Set temporary directory path
Modified: trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_event.php
==============================================================================
--- trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_event.php
Sat Oct 23 00:03:15 2010 (r8395)
+++ trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_event.php
Sat Oct 23 08:56:30 2010 (r8396)
@@ -33,15 +33,7 @@
</td><td>
<?php echo $item->type ?>
</td><td>
- <?php if (isset($item->dateDisplay)): ?>
- <?php echo $item->dateDisplay ?>
- <?php elseif (isset($item->startDate) && isset($item->endDate)): ?>
- <?php echo __('%1% - %2%', array('%1%' =>
Qubit::renderDate($item->startDate), '%2%' =>
Qubit::renderDate($item->endDate))) ?>
- <?php elseif (isset($item->startDate)): ?>
- <?php echo Qubit::renderDate($item->startDate) ?>
- <?php elseif (isset($item->endDate)): ?>
- <?php echo Qubit::renderDate($item->endDate) ?>
- <?php endif; ?>
+ <?php echo Qubit::renderDateStartEnd($item->dateDisplay,
$item->startDate, $item->endDate) ?>
</td><td style="text-align: right">
<input class="multiDelete" name="deleteEvents[]" type="checkbox"
value="<?php echo url_for(array($item, 'module' => 'event')) ?>"/>
</td>
Modified:
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedAuthorityRecord.php
==============================================================================
---
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedAuthorityRecord.php
Sat Oct 23 00:03:15 2010 (r8395)
+++
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_relatedAuthorityRecord.php
Sat Oct 23 08:56:30 2010 (r8396)
@@ -39,13 +39,7 @@
</td><td>
<?php echo $item->type ?>
</td><td>
- <?php if (null !== $note =
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)): ?>
- <?php echo $note ?>
- <?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; ?>
+ <?php echo
Qubit::renderDateStartEnd($item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID),
$item->startDate, $item->endDate) ?>
</td><td>
<?php echo
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID) ?>
</td><td style="text-align: center">
@@ -62,7 +56,7 @@
$editHtml = image_tag('pencil', array('alt' => 'edit', 'style' => 'align:
top'));
$rowTemplate = json_encode(<<<value
-<tr id="{{$form->getWidgetSchema()->generateName('id')}}">"
+<tr id="{{$form->getWidgetSchema()->generateName('id')}}">
<td>
{{$form->resource->renderName()}}
</td><td>
Modified:
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/indexSuccess.php
==============================================================================
---
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/indexSuccess.php
Sat Oct 23 00:03:15 2010 (r8395)
+++
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/indexSuccess.php
Sat Oct 23 08:56:30 2010 (r8396)
@@ -78,18 +78,7 @@
<?php echo render_show(__('Category of the relationship'),
render_value($item->type)) ?>
- <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>
+ <?php echo render_show(__('Dates of the relationship'),
Qubit::renderDateStartEnd($item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID),
$item->startDate, $item->endDate)) ?>
<?php echo render_show(__('Description of relationship'),
render_value($item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID)))
?>
Modified:
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedAuthorityRecord.php
==============================================================================
---
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedAuthorityRecord.php
Sat Oct 23 00:03:15 2010 (r8395)
+++
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedAuthorityRecord.php
Sat Oct 23 08:56:30 2010 (r8396)
@@ -33,13 +33,7 @@
</td><td>
<?php echo
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID) ?>
</td><td>
- <?php if (0 < strlen($note =
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID))): ?>
- <?php echo $note ?>
- <?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; ?>
+ <?php echo
Qubit::renderDateStartEnd($item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID),
$item->startDate, $item->endDate) ?>
</td><td style="text-align: center">
<input class="multiDelete" name="deleteRelations[]"
type="checkbox" value="<?php echo url_for(array($item, 'module' => 'relation'))
?>"/>
</td>
Modified:
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedFunction.php
==============================================================================
---
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedFunction.php
Sat Oct 23 00:03:15 2010 (r8395)
+++
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedFunction.php
Sat Oct 23 08:56:30 2010 (r8396)
@@ -41,13 +41,7 @@
</td><td>
<?php echo
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID) ?>
</td><td>
- <?php if (0 < strlen($note =
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID))): ?>
- <?php echo $note ?>
- <?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; ?>
+ <?php echo
Qubit::renderDateStartEnd($item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID),
$item->startDate, $item->endDate) ?>
</td><td style="text-align: center">
<input class="multiDelete" name="deleteRelations[]"
type="checkbox" value="<?php echo url_for(array($item, 'module' => 'relation'))
?>"/>
</td>
Modified:
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedResource.php
==============================================================================
---
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedResource.php
Sat Oct 23 00:03:15 2010 (r8395)
+++
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/_relatedResource.php
Sat Oct 23 08:56:30 2010 (r8396)
@@ -33,13 +33,7 @@
</td><td>
<?php echo
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID) ?>
</td><td>
- <?php if (0 < strlen($note =
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID))): ?>
- <?php echo $note ?>
- <?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; ?>
+ <?php echo
Qubit::renderDateStartEnd($item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID),
$item->startDate, $item->endDate) ?>
</td><td style="text-align: center">
<input class="multiDelete" name="deleteRelations[]"
type="checkbox" value="<?php echo url_for(array($item, 'module' => 'relation'))
?>"/>
</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.