/[drupal]/contributions/modules/biblio/biblio.module
ViewVC logotype

Diff of /contributions/modules/biblio/biblio.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.196.2.14 by rjerome, Tue Nov 10 22:09:18 2009 UTC revision 1.196.2.15 by rjerome, Mon Nov 16 02:24:22 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: biblio.module,v 1.196.2.13 2009/11/10 02:50:32 rjerome Exp $  // $Id: biblio.module,v 1.196.2.14 2009/11/10 22:09:18 rjerome Exp $
3  /**  /**
4   *   biblio.module for Drupal   *   biblio.module for Drupal
5   *   *
# Line 1085  function biblio_form(stdClass $node, $fo Line 1085  function biblio_form(stdClass $node, $fo
1085      $options["$option->tid"] = $option->name;      $options["$option->tid"] = $option->name;
1086    }    }
1087    if (!isset($node->nid)) {// only show the doi lookup and paste boxes if this is a new entry    if (!isset($node->nid)) {// only show the doi lookup and paste boxes if this is a new entry
1088      if(phpversion() > 5 && !isset($form_state['storage']['biblio_doi'])) {      if($user->uid > 0 && phpversion() > 5 && !isset($form_state['storage']['biblio_doi'])) {
1089        $form['doi_lookup'] = array(        $form['doi_lookup'] = array(
1090          '#type' => 'fieldset',          '#type' => 'fieldset',
1091          '#title' => t('DOI Lookup'),          '#title' => t('DOI Lookup'),
# Line 1562  function _biblio_text_year($year) { Line 1562  function _biblio_text_year($year) {
1562   * @return none   * @return none
1563   */   */
1564  function _biblio_prepare_submit(&$node) {  function _biblio_prepare_submit(&$node) {
1565    require_once(drupal_get_path('module', 'biblio') .'/biblio.contributors.inc');    // this is now done within the _save_contributors() function
1566    $node->biblio_contributors = biblio_parse_contributors($node->biblio_contributors);    //$node->biblio_contributors = biblio_parse_contributors($node->biblio_contributors);
1567    
1568    $node->biblio_year = _biblio_numeric_year($node->biblio_year);    $node->biblio_year = _biblio_numeric_year($node->biblio_year);
1569    
# Line 1584  function _biblio_prepare_submit(&$node) Line 1584  function _biblio_prepare_submit(&$node)
1584   * database inserts.   * database inserts.
1585   */   */
1586  function biblio_insert($node) {  function biblio_insert($node) {
1587      require_once(drupal_get_path('module', 'biblio') .'/biblio.contributors.inc');
1588    require_once(drupal_get_path('module', 'biblio') .'/biblio.keywords.inc');    require_once(drupal_get_path('module', 'biblio') .'/biblio.keywords.inc');
1589    _biblio_prepare_submit($node);    _biblio_prepare_submit($node);
1590    drupal_write_record('biblio', $node);    drupal_write_record('biblio', $node);
# Line 1637  function biblio_load($nodes) { Line 1638  function biblio_load($nodes) {
1638    
1639    require_once(drupal_get_path('module', 'biblio') .'/biblio.contributors.inc');    require_once(drupal_get_path('module', 'biblio') .'/biblio.contributors.inc');
1640    require_once(drupal_get_path('module', 'biblio') .'/biblio.keywords.inc');    require_once(drupal_get_path('module', 'biblio') .'/biblio.keywords.inc');
1641      $vids = array();
1642      foreach($nodes as $nid => $node) $vids[] = $node->vid;
1643    
1644    $result = db_query('SELECT b.*, bt.name as biblio_type_name    $result = db_query('SELECT b.*, bt.name as biblio_type_name
1645                                           FROM {biblio} b                                           FROM {biblio} b
1646                                           LEFT JOIN {biblio_types} bt on b.biblio_type = bt.tid                                           LEFT JOIN {biblio_types} bt on b.biblio_type = bt.tid
1647                                           WHERE b.nid IN (:nids)', array(':nids' => array_keys($nodes)), array('fetch' => PDO::FETCH_ASSOC));                                           WHERE b.vid IN (:vids)', array(':vids' => $vids), array('fetch' => PDO::FETCH_ASSOC));
1648    foreach ($result as $record) {    foreach ($result as $record) {
1649  //    $nodes[$record['nid']]->biblio = $record;  //    $nodes[$record['nid']]->biblio = $record;
1650          foreach ($record as $key => $value) {          foreach ($record as $key => $value) {
# Line 2168  function biblio_hash($node) { Line 2172  function biblio_hash($node) {
2172    }    }
2173  //TODO title value??  //TODO title value??
2174    $hash_string = str_replace(' ', '', drupal_strtolower($node->title['zxx'][0]['value']));    $hash_string = str_replace(' ', '', drupal_strtolower($node->title['zxx'][0]['value']));
2175    $hash_string .= str_replace(' ', '', drupal_strtolower($node->biblio_contributors[1][0]['lastname']));    if (isset($node->biblio_contributors[1][0])) {
2176        $hash_string .= str_replace(' ', '', drupal_strtolower($node->biblio_contributors[1][0]['lastname']));
2177      }
2178    $hash_string .= $node->biblio_year;    $hash_string .= $node->biblio_year;
2179    
2180    $sum = md5($hash_string);    $sum = md5($hash_string);

Legend:
Removed from v.1.196.2.14  
changed lines
  Added in v.1.196.2.15

  ViewVC Help
Powered by ViewVC 1.1.3