Thank you both for your replies! I have tried Andy's suggestions, but that does not give me the result I am after.
I would like to go with John's suggestion to have a select in the advanced search page, if I would know where to implement them. I have double checked the advanced search page, but the sort already seems to be there...
<div class="inputs">
<?php
//If the form has been submitted, retain the number of search fields used and rebuild the form
if(!empty($_GET['advanced'])) {
$search = $_GET['advanced'];
}else {
$search = array(array('field'=>'','type'=>'','value'=>'', array('sort_field'=>'Dublin Core,Identifier')));
}
I do not quite understand why it is not working. Adding another select myself makes things worse, i.e. error page.
Would you be able to pinpoint where I need to add the select in the php below? I would really appreciate that (after having spent the last 3 hours trying out your suggestions...)
Thanks!
<?php
if (!$isPartial): // If we are using the partial view of this search form.
head(array('title'=>'Advanced Search', 'bodyclass' => 'advanced-search', 'bodyid' => 'advanced-search-page'));
?>
<h1>Search Collections</h1>
<div id="primary">
<?php endif; ?>
<?php if (!$formActionUri): ?>
<?php $formActionUri = uri(array('controller'=>'items', 'action'=>'browse')); ?>
<?php echo js('jquery'); ?>
<script type="text/javascript" charset="utf-8">
jQuery.noConflict();
jQuery(document).ready(function() {
var blackListElements = new Array();
blackListElements[0] = "Coverage";
blackListElements[1] = "Creator";
blackListElements[2] = "Language";
blackListElements[3] = "Rights";
blackListElements[4] = "Source";
blackListElements[5] = "Subject";
blackListElements[6] = "Type";
blackListElements[7] = "1st Author Initials";
blackListElements[8] = "1st Author Surname";
blackListElements[9] = "2nd Author Initials";
blackListElements[10] = "2nd Author Surname";
blackListElements[11] = "3rd Author Initials";
blackListElements[12] = "3rd Author Surname";
blackListElements[13] = "Atlas Cat";
blackListElements[14] = "Author Ref";
blackListElements[15] = "BCC";
blackListElements[16] = "Bibliography";
blackListElements[17] = "Biographical Text";
blackListElements[18] = "Birth Date";
blackListElements[19] = "Birthplace";
blackListElements[20] = "Bit Rate/Frequency";
blackListElements[21] = "CC";
blackListElements[22] = "Compression";
blackListElements[23] = "Date Published";
blackListElements[24] = "Date Received";
blackListElements[25] = "Death Date";
blackListElements[26] = "Director";
blackListElements[27] = "Duration";
blackListElements[28] = "Edition";
blackListElements[29] = "Email Body";
blackListElements[30] = "Event Type";
blackListElements[31] = "Flag";
blackListElements[32] = "Interviewee";
blackListElements[33] = "Interviewer";
blackListElements[34] = "From";
blackListElements[35] = "ISBN";
blackListElements[36] = "Lesson Plan Text";
blackListElements[37] = "Local URL";
blackListElements[38] = "Location";
blackListElements[39] = "Maker";
blackListElements[40] = "Materials";
blackListElements[41] = "Misc Info";
blackListElements[42] = "Name";
blackListElements[43] = "Number of Attachments";
blackListElements[44] = "Number of parts";
blackListElements[45] = "Objectives";
blackListElements[46] = "Occupation";
blackListElements[47] = "Original Format";
blackListElements[48] = "Participants";
blackListElements[49] = "Physical Dimensions";
blackListElements[50] = "Producer";
blackListElements[51] = "Published";
blackListElements[52] = "Standards";
blackListElements[53] = "Storage id";
blackListElements[54] = "Subject Line";
blackListElements[55] = "Subject Ref";
blackListElements[56] = "Text";
blackListElements[57] = "Time Summary";
blackListElements[58] = "";
blackListElements[59] = "To";
blackListElements[60] = "Transcription";
blackListElements[61] = "UBSC";
blackListElements[62] = "UDCS";
blackListElements[63] = "URL";
blackListElements[64] = "Image url";
blackListElements[65] = "Level of description";
blackListElements[66] = "Relation";
blackListElements[67] = "Format";
for (var i = 0; i < blackListElements.length; i++){
jQuery("#advanced-0-element_id option[label='" +
blackListElements[i] + "']").remove();
}
});
</script>
<?php endif; ?>
<form <?php echo _tag_attributes($formAttributes); ?> action="<?php echo html_escape($formActionUri); ?>" method="get">
<div id="search-narrow-by-fields" class="field">
<div class="label">Narrow by Specific Fields</div>
<div class="inputs">
<?php
//If the form has been submitted, retain the number of search fields used and rebuild the form
if(!empty($_GET['advanced'])) {
$search = $_GET['advanced'];
}else {
$search = array(array('field'=>'','type'=>'','value'=>'', array('sort_field'=>'Dublin Core,Identifier')));
}
//Here is where we actually build the search form
foreach ($search as $i => $rows): ?>
<div class="search-entry">
<?php
//The POST looks like =>
// advanced[0] =>
//[field] = 'description'
//[type] = 'contains'
//[terms] = 'foobar'
//etc
echo select_element(
array('name'=>"advanced[$i][element_id]"),
@$rows['element_id'],
null,
array('record_types'=>array('Item', 'All'), 'sort'=>'alpha')); ?>
<?php
echo select(
array('name'=>"advanced[$i][type]"),
array('contains'=>'contains', 'does not contain'=>'does not contain', 'is empty'=>'is empty', 'is not empty'=>'is not empty'),
@$rows['type']
);
?>
<?php
echo text(
array('name'=>"advanced[$i][terms]", 'size'=>20),
@$rows['terms']);
?>
<button type="button" class="remove_search" disabled="disabled" style="display: none;">-</button>
</div>
<?php endforeach; ?>
</div>
<button type="button" class="add_search">Add a Field</button>
</div>
<?php is_admin_theme() ? fire_plugin_hook('admin_append_to_advanced_search') : fire_plugin_hook('public_append_to_advanced_search'); ?>
<div>
<input type="submit" class="submit submit-medium" name="submit_search" id="submit_search_advanced" value="Search" />
</div>
</form>
<?php echo js('search'); ?>
<script type="text/javascript">
jQuery(document).ready(function () {
Omeka.Search.activateSearchButtons();
});
</script>
<?php if (!$isPartial): ?>
</div> <!-- Close 'primary' div. -->
<?php foot(); ?>
<?php endif; ?>