'; } function theme_biblio_openurl($openURL) { $openurl_image = variable_get('biblio_openurlimage',''); if ($openurl_image !='') { $output .= '
'; } else { $output .= '
'.t('Find It Via OpenURL!').'
'; } return $output; } function biblio_openURL($node) { // Copyright: Matthias Steffens and the file's // original author. // Original Author: Richard Karnesky // // Adapted for biblio: Ron Jerome // global $openURLResolver; // these variables are defined in 'ini.inc.php' // global $hostInstitutionAbbrevName; $openURLResolver = variable_get('biblio_baseopenurl',''); $co = biblio_contextObject($node); $co["sid"] = "biblio:" . variable_get('site_name', 'Drupal'); $openURL = $openURLResolver; if (!ereg("\?", $openURLResolver)) $openURL .= "?"; else $openURL .= "&"; $openURL .= "ctx_ver=Z39.88-2004"; foreach ($co as $coKey => $coValue) { $coKey = ereg_replace("rft.", "", $coKey); $coKey = ereg_replace("au[0-9]*", "au", $coKey); $openURL .= "&" . $coKey . "=" . rawurlencode($coValue); } return $openURL; } function theme_biblio_export_links($nid) { $base = variable_get('biblio_base', 'biblio'); $links .= '

'; return $links; } function theme_biblio_short(&$node, $base='biblio', $style_name='classic', $inline=false) { require_once( drupal_get_path('module', 'biblio') . "/biblio_style_$style_name.inc"); $style_function = "biblio_style_$style_name"; $styled_node = $style_function($node, $base, $inline); if (empty($node->biblio_coins)) biblio_coins_generate($node); return($styled_node.$node->biblio_coins); } function theme_biblio_long($node,$base='biblio',$style='classic') { if (empty($node->biblio_coins)) biblio_coins_generate($node); $output .= $node->biblio_coins; $layout = variable_get('biblio_node_layout', 'orig'); if (variable_get('biblio_node_layout', 'orig') == 'ft' && strlen(trim($node->body)) && user_access('view full text') ) { $output .= '
'.theme('biblio_short', $node,$base,$style).'
'; $annotation_field = variable_get('biblio_annotations','none'); if ($annotation_field != 'none' && $node->$annotation_field) { $output .= '
'; $output .= check_markup($node->$annotation_field, $node->format, FALSE); $output .= '
'; } $output .= check_markup($node->body, $node->format, FALSE) ; if ( biblio_access('export',$node)) { $output .= theme('biblio_export_links',$node->nid); } return $output; } // if (variable_get('biblio_normalize', 0)) { // $authors = _biblio_parse_authors($node->biblio_authors); // } else { // $authors = $node->biblio_authors; // } $openurl_base = variable_get('biblio_baseopenurl',''); if ($openurl_base) $output .= theme('biblio_openurl', biblio_openurl($node, $openurl_base)); $output .= '

'.t("Publication Type").":

$node->biblio_type_name
\n"; $output .= '

'.t("Authors").':

' . _biblio_author_links($authors,$base) . "
\n"; $output .= '

'.t("Source").':

'; $source = null; if ($node->biblio_secondary_title) $source .= check_plain($node->biblio_secondary_title); if ($node->biblio_publisher) { $source .= $source?", ":""; $source .= check_plain($node->biblio_publisher); } if ($node->biblio_volume) { $source .= $source?", ":""; $source .= t('Volume ') . check_plain($node->biblio_volume); } if ($node->biblio_issue) { $source .= $source?", ":""; $source .= t('Issue ') . check_plain($node->biblio_issue); } if ($node->biblio_number) { $source .= $source?", ":""; $source .= t('Number ') . check_plain($node->biblio_number); } if ($node->biblio_place_published) { $source .= $source?", ":""; $source .= check_plain($node->biblio_place_published); } if ($node->biblio_pages) { $source .= $source?", ":""; $source .= 'p.' . check_plain($node->biblio_pages); } if (isset($node->biblio_year)) { if ($node->biblio_year == 9998) { $node->biblio_year = t("In Press"); } if ($node->biblio_year == 9999) { $node->biblio_year = t("Submitted"); } $source .= ' (' . check_plain($node->biblio_year) . ')'; } $output .= "$source
\n"; if ($node->biblio_isbn) $output .= '

'.t("ISBN").':

' . check_plain($node->biblio_isbn) . "\n"; if ($node->biblio_call_number) $output .= '

'.t("Call Number").':

' . check_plain($node->biblio_call_number) . "\n"; if ($node->biblio_accession_number) $output .= '

'.t("Accession Number").':

' . check_plain($node->biblio_accession_number) . "\n"; if ($node->biblio_other_number) $output .= '

'.t("Other Number").':

' . check_plain($node->biblio_other_number) . "\n"; if ($node->biblio_url) { $attrib = (variable_get('biblio_links_target_new_window',null)) ? array('target'=>'_blank') : array(); $output .= '

'.t("URL").':

'.l($node->biblio_url,$node->biblio_url,$attrib) . "\n"; } if ($node->biblio_keywords) $output .= '

'.t("Keywords").':

' . _biblio_keyword_links($node->biblio_keywords,$base) . "\n"; if ($node->biblio_abst_e) $output .= '

'.t("Abstract").':

' . check_markup($node->biblio_abst_e, $node->format, FALSE) . "\n"; if ($node->biblio_abst_f) $output .= '

' . check_markup($node->biblio_abst_f, $node->format, FALSE) . "\n"; if ($node->biblio_notes) $output .= '

'.t("Notes").':

' . check_markup($node->biblio_notes, $node->format, FALSE) . "\n"; /* if ( strlen(trim($node->body)) && user_access('view full text') ) { $output .= '

'.t('Full Text').':

'.check_markup($node->body, $node->format, FALSE); } */ if ( biblio_access('export',$node)) { $output .= theme('biblio_export_links',$node->nid); } return $output; } function theme_biblio_tabular($node, $base = 'biblio', $teaser = false) { $tid = $node->biblio_type; $result = db_query("SELECT b.*, btd.*, btt.name AS type_name FROM {biblio_fields} AS b, {biblio_field_type} AS bt, {biblio_field_type_data} AS btd, {biblio_types} as btt WHERE bt.fid = b.fid AND btd.ftdid = bt.ftdid AND btt.tid = bt.tid AND bt.tid = %d ORDER BY btd.weight ASC", $tid); while ($row = db_fetch_array($result)) { $fields[$row['fid']] = $row; } $rows[] = array(array('data' => ''. t('Publication Type') .'', 'align' => 'right'), array('data' => '  '), array('data' => $node->biblio_type_name)); $tagged_link = theme('biblio_tagged_link',$base, $node ); if ($node->biblio_keywords) { $node->biblio_keywords = _biblio_keyword_links($node->biblio_keywords, $base); } if ($node->biblio_url) { $attrib = (variable_get('biblio_links_target_new_window',null)) ? array('target'=>'_blank') : array(); $node->biblio_url = l($node->biblio_url, $node->biblio_url, $attrib); } $contrib_array = biblio_get_contributor_strings($node->biblio_contributors); $ctypes = db_query('SELECT * FROM {biblio_contributor_type} ORDER BY ctid ASC'); while ($ctype = db_fetch_object($ctypes)) { if(!empty($contrib_array[$ctype->ctid])) { $rows[] = array(array('data' => ''. t('!typename',array('!typename' => $ctype->type)) .'', 'align' => 'right'), array('data' => '  '), array('data' => $contrib_array[$ctype->ctid])); } } foreach ($fields as $key => $row) { if (!empty($node->$row['name']) && ($row['name'] != 'biblio_coins')&& ($row['name'] != 'biblio_contributors') ) { switch ($row['name']) { case 'biblio_keywords': case 'biblio_url': // check_plain is not need on these since they have gone through // the l() function which does a check_plain $data = $node->$row['name']; break; default: if ( $row['type'] == 'textarea' ) { $data = check_markup($node->$row['name'], $node->format, FALSE); }else{ $data = check_plain($node->$row['name']); } } $rows[] = array(array('data' => ''. $row['title'] .'', 'align' => 'right', 'valign' => 'top', 'width' => '20%'), array('data' => '  '), array('data' => $data)); } } /* if ( strlen(trim($node->body)) && $teaser == false && user_access('view full text') ) { $rows[] = array(array('data' => ''. t('Full Text') .'', 'align' => 'right', 'valign' => 'center', 'width' => '20%'), array('data' => '  '), array('data' => check_markup($node->body,FILTER_HTML_ESCAPE, FALSE)) ); } */ if ( biblio_access('export', $node) && $teaser == false ) { $rows[] = array(array('data' => ''. t('Export') .'', 'align' => 'right', 'valign' => 'center', 'width' => '20%'), array('data' => '  '), array('data' => $tagged_link .' '. l(t("XML"),"$base/export/xml/$node->nid").' '. l(t("BibTex"),"$base/export/bib/$node->nid") )); } $output = '
'; $output .= $node->biblio_coins; $header = array(); $output .= theme('table', $header, $rows); $output .= '
'; return $output; } function theme_biblio_list($node, $base='biblio', $style='classic', $inline=false) { $output = theme('biblio_short', $node, $base, $style, $inline); if ($node->biblio_abst_e) { $output .= ''; $output .= l(" Abstract", "node/$node->nid") . "\n"; $output .= ''; } $annotation_field = variable_get('biblio-annotations','none'); if ($annotation_field != 'none' && $node->$annotation_field) { $output .= '
'; $output .= check_markup($node->$annotation_field,FILTER_HTML_ESCAPE,FALSE); $output .= '
'; } $openurl_base = variable_get('biblio_baseopenurl',''); if ($openurl_base) $output .= theme('biblio_openurl',biblio_openurl($node)); if ( biblio_access('export', $node)) { $base = variable_get('biblio_base', 'biblio'); $output .= ''; $output .= theme('biblio_tagged_link', $base, $node ); $output .= theme('biblio_bibtex_link', $base, $node); $output .= theme('biblio_xml_link', $base, $node); $output .= ''; } if ( biblio_access('download',$node)) { // add links to attached files (if any) if ( !empty($node->files) && count($node->files) > 0 && user_access('view uploaded files') ) { $output .= ''; $output .= ' '. t('Download') .': '; foreach ($node->files as $file) { $href = file_create_url($file->filepath); $output .= l($file->filename, $href) . ' '. format_size($file->filesize); } $output .= ''; } } return $output; } function theme_biblio_filters(&$form) { if (sizeof($form['current'])) { $output .= ''; } $output .= '
' . (sizeof($form['current']) ? '
'. t('and') .' '. t('where') .'
' : '') . '
'; foreach (element_children($form['filter']) as $key) { $output .= drupal_render($form['filter'][$key]); } $output .= '
'; $output .= '
'. t('is') .'
' . '
'; foreach (element_children($form['status']) as $key) { $output .= drupal_render($form['status'][$key]); } $output .= '
'; $output .= '
'; $output .= '
'. drupal_render($form['buttons']) .'
'; $output .= '
'; return $output; } function theme_biblio_form_filter(&$form) { $output .= '
'; $output .= drupal_render($form['filters']); $output .= '
'; $output .= drupal_render($form); return $output; } function theme_biblio_admin_types_edit_form($form) { $base = variable_get('biblio_base', 'biblio'); $tid = (!empty($form['#parameters'][2])) ? $form['#parameters'][2] : FALSE; drupal_set_title($form['type_name']?$form['type_name']['#value']:"Default"); // build the table with all the fields if no $tid is given, or only the common // and customized fields if $tid is given $conf_table = array(); foreach(element_children($form['configured_flds']) as $fld) { $conf_row = array(); $conf_row[] = array('data' => drupal_render($form['configured_flds'][$fld]['name'])); $conf_row[] = array('data' => drupal_render($form['configured_flds'][$fld]['title']),'align' => 'center'); $conf_row[] = array('data' => drupal_render($form['configured_flds'][$fld]['hint']),'align' => 'center'); foreach (element_children($form['configured_flds'][$fld]['checkboxes']) as $oid) { if (is_array($form['configured_flds'][$fld]['checkboxes'])) { $conf_row[] = array('data' => drupal_render($form['configured_flds'][$fld]['checkboxes'][$oid]), 'align' => 'center', 'title' => $oid); } } $conf_row[] = array('data' => drupal_render($form['configured_flds'][$fld]['weight']),'align' => 'center'); $conf_table[] = $conf_row; } if ($tid) { $header =array(t('Field Name'),t('Title'),t('Hint'),t('Visible'),t('Required'),t('Weight')); }else{ $header =array(t('Field Name'),t('Default Title'),t('Hint'),t('Common'),t('Required'),t('Autocomplete'),t('Weight')); } $output .= '

'; $output .= drupal_render($form['help']); $output .= theme('table',$header,$conf_table); $output .= '

'.drupal_render($form['submit']).'

'; $output .= drupal_render($form); return $output; } function theme_biblio_tagged_link($base, $node = NULL) { $output = ''; if (module_exists('hovertip')) { $output .= 'Tagged '; require_once drupal_get_path('module','biblio') . '/biblio.import.export.inc'; $output .= '

EndNote Tagged Format

'.nl2br(biblio_endnote_tagged_export($node)) .'
'; }else { $output .= l(t("Tagged"),"$base/export/tagged/$node->nid") .'
'; } return $output; } function theme_biblio_bibtex_link($base, $node = NULL) { $output=''; if (module_exists('hovertip')) { $output .= 'Bibtex '; require_once drupal_get_path('module','biblio') . '/biblio.import.export.inc'; $output .= '

BibTex

'.nl2br(biblio_bibtex_export($node)) .'
'; } else { $output .= l(t("BibTex"),"$base/export/bibtex/$node->nid"); } return $output; } function theme_biblio_xml_link($base, $node = NULL) { $output=''; if (module_exists('hovertip')) { $output .= 'XML '; require_once drupal_get_path('module','biblio') . '/biblio.import.export.inc'; $output .= '

XML

'.nl2br(htmlentities(biblio_endnote_XML_export($node,7))) .'
'; } else { $output .= l(t("xml"),"$base/export/xml/$node->nid"); } return $output; } function theme_biblio_contributors($form) { //print_r($form); // Change the button title to reflect the behavior when using JavaScript. //drupal_add_js('if (Drupal.jsEnabled) { $(document).ready(function() { $("#edit-'.str_replace('_', '-', $form['#parents'][0]) .'-more").val("'. t('Add another contributor') .'"); }); }', 'inline'); $rows = array(); $headers = array( t('Name'), t('Type'), ); foreach (element_children($form) as $key) { // No need to print the field title every time. unset($form[$key]['name']['#title'], $form[$key]['type']['#title']); // Build the table row. $row = array( 'data' => array( array('data' => drupal_render($form[$key]['name']), 'class' => 'biblio-contributor'), array('data' => drupal_render($form[$key]['type']), 'class' => 'biblio-contributor-type'), ), ); // Add additional attributes to the row, such as a class for this row. if (isset($form[$key]['#attributes'])) { $row = array_merge($row, $form[$key]['#attributes']); } $rows[] = $row; } $output = theme('table', $headers, $rows); $output .= drupal_render($form); return $output; } function theme_biblio_alpha_line($type='author') { if (!isset($_GET['sort']) || $_GET['sort'] == 'year' ||$_GET['sort'] == 'type' ) return; $options = array(); $inline = $inline ? "/inline" : ""; if (isset($_GET['sort'])) { $options['query'] .= "sort=" . $_GET['sort']; if ($_GET['sort'] == 'author') $group = 'ag/'; if ($_GET['sort'] == 'title') $group = 'tg/'; } if (isset($_GET['order'])) { $options['query'] .= $options['query'] ? "&" : "" ; $options['query'] .= "order=" . $_GET['order']; } $base = variable_get('biblio_base','biblio'); $output = '
'; for ($i=65; $i<=90; $i++) { $output .= l(chr($i),"$base/$group".chr($i), $options).' '; } $output .= '
'; return $output; }