Author: sevein
Date: Thu Feb 9 22:14:18 2012
New Revision: 10838
Log:
Advanced search: add level of description drop-down (issue 2248), leave default
100% width for all the filter fields for consistency with other forms in the
application
Modified:
trunk/apps/qubit/modules/search/actions/advancedAction.class.php
trunk/apps/qubit/modules/search/templates/_advancedSearch.php
Modified: trunk/apps/qubit/modules/search/actions/advancedAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/search/actions/advancedAction.class.php Thu Feb
9 21:03:30 2012 (r10837)
+++ trunk/apps/qubit/modules/search/actions/advancedAction.class.php Thu Feb
9 22:14:18 2012 (r10838)
@@ -24,7 +24,8 @@
'searchFields',
'repository',
'mediatype',
- 'hasDigitalObject'
+ 'hasDigitalObject',
+ 'levelOfDescription'
);
public function execute($request)
@@ -62,7 +63,7 @@
switch ($name)
{
case 'searchFields':
-
+
break;
case 'repository':
@@ -74,14 +75,15 @@
$criteria->addAscendingOrderByColumn('authorized_form_of_name');
- $choices = array('' => '');
+ $choices = array();
+ $choices[null] = null;
foreach (QubitRepository::get($criteria) as $repository)
{
$choices[$repository->id] = $repository;
}
$this->form->setValidator($name, new sfValidatorChoice(array('choices'
=> array_keys($choices))));
- $this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> $choices), array('style' => 'min-width: 50%; width: auto')));
+ $this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> $choices)));
break;
@@ -95,14 +97,15 @@
$criteria->addAscendingOrderByColumn('name');
- $choices = array('' => '');
+ $choices = array();
+ $choices[null] = null;
foreach (QubitTerm::get($criteria) as $mediatype)
{
$choices[$mediatype->id] = $mediatype;
}
$this->form->setValidator($name, new sfValidatorChoice(array('choices'
=> array_keys($choices))));
- $this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> $choices), array('style' => 'width: auto')));
+ $this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> $choices)));
break;
@@ -114,9 +117,25 @@
);
$this->form->setValidator($name, new sfValidatorChoice(array('choices'
=> array_keys($choices))));
- $this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> $choices), array('style' => 'width: auto')));
+ $this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> $choices)));
+
+ break;
+
+ case 'levelOfDescription':
+ $this->form->setValidator('levelOfDescription', new sfValidatorString);
+
+ $choices = array();
+ $choices[null] = null;
+ foreach
(QubitTaxonomy::getTaxonomyTerms(QubitTaxonomy::LEVEL_OF_DESCRIPTION_ID) as
$item)
+ {
+ $choices[$item->getName()] = $item;
+ }
+
+ $this->form->setValidator('levelOfDescription', new sfValidatorString);
+ $this->form->setWidget('levelOfDescription', new
sfWidgetFormSelect(array('choices' => $choices)));
break;
+
}
}
@@ -211,12 +230,19 @@
$this->queryTerms[] = array('term' => $this->getContext()->i18n->__('No
digital object is available'), 'operator' => 'and');
}
+ // limit to a media type if selected
if (!empty($this->request->mediatype))
{
$query->addSubquery(QubitSearch::getInstance()->addTerm($this->request->mediatype,
'do_mediaTypeId'), true);
$this->queryTerms[] = array('term' => 'mediatype:
'.QubitTerm::getById($this->request->mediatype)->__toString(), 'operator' =>
'and');
}
+ if (!empty($this->request->levelOfDescription))
+ {
+ $query->addSubquery(QubitSearch::getInstance()->addTerm('Fonds',
'levelOfDescription'), true);
+ $this->queryTerms[] = array('term' =>
$this->getContext()->i18n->__('Level of description').': TODO', 'operator' =>
'and');
+ }
+
$query = parent::filterQuery($query);
return $query;
Modified: trunk/apps/qubit/modules/search/templates/_advancedSearch.php
==============================================================================
--- trunk/apps/qubit/modules/search/templates/_advancedSearch.php Thu Feb
9 21:03:30 2012 (r10837)
+++ trunk/apps/qubit/modules/search/templates/_advancedSearch.php Thu Feb
9 22:14:18 2012 (r10838)
@@ -15,7 +15,7 @@
</table>
</div>
-<fieldset class="collapsible <?php echo ($form->getValue('repository') .
$form->getValue('media') . $form->getValue('hasDigitalObject') ? '' :
'collapsed'); ?>" id="filterLimit">
+<fieldset class="collapsible <?php echo ($form->getValue('repository') .
$form->getValue('media') . $form->getValue('hasDigitalObject') .
$form->getValue('levelOfDescription') ? '' : 'collapsed'); ?>" id="filterLimit">
<legend><?php echo __('Filter/Limit') ?></legend>
@@ -35,6 +35,8 @@
->label(__('Digital object available'))
->renderRow() ?>
+ <?php echo $form->levelOfDescription->renderRow() ?>
+
</fieldset>
<?php if (isset($form->pager) && 'globalReplace' == $action): ?>
--
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.