Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
Merge pull request #3 from adam-vessey/6.x
Browse files Browse the repository at this point in the history
6.x - small fixes
  • Loading branch information
bwoodhead committed Dec 5, 2011
2 parents 44e96a0 + 2ed4f44 commit f037ea3
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 18 deletions.
5 changes: 4 additions & 1 deletion Batch.inc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ function scholar_bulk_ingest_file_upload_validate(array $element, array &$form_s
function scholar_bulk_ingest_form_submit(array &$form, array &$form_state) {
$collection_pid = $form_state['values']['collection_pid'];
$content_model_pid = ContentModel::getPidFromIdentifier($form_state['values']['content_model_pid']);
$mime_type = $_FILES['files']['type']['file'];
$mime_type = $_FILES['files']['type']['file']; //Not using $file->filemime,
//because the underlying Drupal stuff doesn't do XML... Blargh.
$file = file_save_upload('file');
$filename = $file->filepath;
$function = ($mime_type == 'text/xml') ? 'scholar_batch_ingest_endnote_document' : 'scholar_batch_ingest_ris_document';
Expand Down Expand Up @@ -182,6 +183,8 @@ function scholar_batch_ingest_endnote_document($filename, $collection_pid, $cont
if (Bibutils::Convert($endnote_filename, 'EndNoteXML', $mods_filename, 'MODS')) {
scholar_batch_ingest_mods($mods_filename, $collection_pid, $content_model_pid, array('ENDNOTE' => $endnote_filename));
}
unlink($endnote_filename);
unlink($mods_filename);
$context['sandbox']['progress']++;
if ($context['sandbox']['progress'] != $context['sandbox']['total']) {
$context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['total'];
Expand Down
6 changes: 3 additions & 3 deletions IslandoraSolrResultsCitation.inc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class IslandoraSolrResultsCitation extends IslandoraSolrResults {
$record_start = $results->response->start;
$limit_results = variable_get('islandora_solr_search_limit_result_fields', 0);
module_load_include('inc', 'csl', 'CSL');
$styles = CSL::GetNames();
$style = citeproc_style('APA');
$styles = array_values(CSL::GetNames()); //Array returned has keys == values, for some reason... Whatever.
$style = citeproc_style($styles[0]);
foreach ($results->response->docs as $doc) {
$pid = $doc->PID;
$item = new Fedora_Item($pid);
Expand Down Expand Up @@ -283,4 +283,4 @@ function theme_scholar_search_results_table(array $element) {
}
$attributes = isset($element['#id']) ? array('id' => $element['#id']) : NULL;
return '<div class="scholar-search-results">' . theme_table($element['#header'], $rows, $attributes) . '</div>';
}
}
8 changes: 4 additions & 4 deletions SearchForm.inc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function scholar_search_form(array &$form_state) {
'#title' => t('Field'),
'#type' => 'select',
'#default_value' => isset($values['terms'][$i]['field']) ? $values['terms'][$i]['field'] : 'coh_search_title',
'#options' => array(
'#options' => variable_get('islandora_solr_searchterms', array(
'coh_search_abstract' => t('Abstract'),
'coh_search_author_identifier' => t('Author Identifier'),
'coh_search_author' => t('Author'),
Expand Down Expand Up @@ -83,7 +83,7 @@ function scholar_search_form(array &$form_state) {
'coh_search_division_name' => t('Division Name'),
'coh_search_cores' => t('Cores'),
//'dc.text' => t('Text'),
)
))
),
'search' => array(
'#title' => t('Search'),
Expand Down Expand Up @@ -131,9 +131,9 @@ function scholar_search_form(array &$form_state) {
'sort' => array(
'#title' => t('Sort By'),
'#type' => 'select',
'#default_value' => isset($values['sort']) ? $values['sort'] : NULL,
'#default_value' => isset($values['sort']) ? $values['sort'] : 'score',
'#options' => array(
NULL => t('Relevance'),
'score' => t('Relevance'),
'coh_sort_title' => t('Title'),
'coh_sort_date' => t('Date Added'),
),
Expand Down
10 changes: 6 additions & 4 deletions citation/citeproc/generators/converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,12 @@ function convert_mods_to_citeproc_json_names(SimpleXMLElement $mods) {
foreach ($queries as $query) {
list($path, $default_role, $valid_roles) = $query;
$names = $mods->xpath($path);
foreach ($names as $name) {
$name->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
$role = convert_mods_to_citeproc_json_name_role($name, $valid_roles, $default_role);
$output[$role][] = convert_mods_to_citeproc_json_name($name);
if (!empty($names)) {
foreach ($names as $name) {
$name->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
$role = convert_mods_to_citeproc_json_name_role($name, $valid_roles, $default_role);
$output[$role][] = convert_mods_to_citeproc_json_name($name);
}
}
}
return $output;
Expand Down
9 changes: 7 additions & 2 deletions citation/csl/csl.module
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,13 @@ function csl_manage(array &$form_state) {
function csl_manage_delete_style_submit(array $form, array &$form_state) {
module_load_include('inc', 'csl', 'CSL');
$style = $form_state['clicked_button']['#style'];
$msg = CSL::Delete($style) ? 'Successfully deleted style: %style' : 'Failed to deleted style: %style';
drupal_set_message(t($msg, array('%style' => $style)));
$style_t = array('%style' => $style);
if (CSL::Delete($style)) {
drupal_set_message(t('Successfully deleted style: %style', $style_t));
}
else {
drupal_set_message(t('Failed to deleted style: %style', $style_t));
}
}

/**
Expand Down
8 changes: 5 additions & 3 deletions citation/exporter/citation_exporter.module
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ function citation_exporter_export() {
function citation_exporter_include_download_redirect() {
module_load_include('inc', 'citation_exporter', 'CitationExporter');
if (CitationExporter::ReadyToExport()) {
$path = MENU_CITATION_EXPORTER_EXPORT;
drupal_set_html_head("<meta http-equiv='refresh' content='0;url=/$path'/>");
$path = url(MENU_CITATION_EXPORTER_EXPORT, array(
'absolute' => TRUE
));
drupal_set_html_head("<meta http-equiv='refresh' content='0;url=$path'/>");
}
}
}
2 changes: 1 addition & 1 deletion scholar.module
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,4 @@ function scholar_form_content_model_viewer_edit_metadata_form_alter(array &$form
array_unshift($form, $title);
$form['#attributes'] = array('enctype' => 'multipart/form-data'); // Allow the uploading of files.
}
}
}

0 comments on commit f037ea3

Please sign in to comment.