### Eclipse Workspace Patch 1.0 #P biblio Index: biblio.field.type.data.csv =================================================================== RCS file: /cvs/drupal/contributions/modules/biblio/biblio.field.type.data.csv,v retrieving revision 1.1.2.4 diff -u -r1.1.2.4 biblio.field.type.data.csv --- biblio.field.type.data.csv 17 Apr 2009 01:52:44 -0000 1.1.2.4 +++ biblio.field.type.data.csv 17 Nov 2009 20:07:00 -0000 @@ -1,19 +1,19 @@ -,tid,biblio_year,title,biblio_secondary_title,biblio_tertiary_title,biblio_short_title,biblio_secondary_authors,biblio_tertiary_authors,biblio_subsidiary_authors,biblio_corp_authors,biblio_alternate_title,biblio_place_published,biblio_publisher,biblio_volume,biblio_number_of_volumes,biblio_number,biblio_issue,biblio_pages,biblio_section,biblio_edition,biblio_date,biblio_type_of_work,biblio_issn,,biblio_original_publication,biblio_reprint_edition,,biblio_custom1,biblio_custom2,biblio_custom3,biblio_custom4,biblio_custom5,biblio_custom6,biblio_custom7,biblio_abst_e -Generic ,,Year ,Title ,Secondary Title ,Tertiary Title ,Short Title ,Editor ,Tertiary Author ,Subsidiary Author ,Corporate Author,Alternate Title ,Place Published ,Publisher ,Volume ,Number of Volumes ,Number ,Issue,Pages ,Section ,Edition ,Date ,Type of Work ,ISBN/ISSN ,Electronic Resource Number ,Original Publication ,Reprint Edition ,Reviewed Item ,Custom 1 ,Custom 2 ,Custom 3 ,Custom 4 ,Custom 5 ,Custom 6 ,Custom 7 ,Abstract -Ancient Text ,,,,Publication Title ,Volume Title ,,Editor ,~,Translator ,,Abbreviated Publication ,City ,,,,,~,,~,,,,ISBN ,,,,Reviewed Item ,~,~,~,~,~,~,~, -Artwork ,112,,,~,~,,~,~,~,,,City ,,~,~,~,~,Description ,~,~,,,~,,~,~,,~,~,~,~,~,~,~, -Audiovisual Material ,114,,,Series Title ,~,,Series Editor ,~,Performers ,,,City ,,~,Extent of Work ,Number ,~,~,~,,,Type ,ISBN ,,Contents ,~,,Cast ,Credits ,~,~,Format ,~,~, -Bill ,117,,,Code ,Legislative Body ,,~,~,Sponsor ,,~,~,~,Code Volume ,~,Bill Number ,~,Code Pages ,Code Section ,Session ,,~,~,,History ,~,,~,~,~,~,~,~,~, -Book ,100,,,Series Title ,~,,Series Editor ,~,Translator ,,Abbreviation ,City ,,,,Series Volume ,~,Number of Pages ,~,,~,~,ISBN ,,,,~,~,~,~,~,~,~,~, -Book Section ,101,,,Book Title ,Series Title ,,Editor ,Series Editor ,Translator ,,Abbreviation ,City ,,,,Series Volume ,~,,Chapter ,,~,~,ISBN ,,,,,~,~,~,~,~,~,~, -Case ,116,,Case Name ,Reporter ,~,Abbreviated Case Name ,~,~,Counsel ,,~,~,Court ,Reporter Volume ,Reporter Abbreviation ,~,~,First Page ,Page Cited ,~,Date Decided ,~,~,,History ,~,~,~,~,~,~,~,~,~, -Classical Work ,127,,,Series Title ,~,,Series Editor ,~,Translator ,,,City ,,,,Series Volume ,~,Number of Pages ,~,,~,Type ,ISSN/ISBN ,,,,~,~,~,~,~,~,~,~, -Computer Program ,113,,,Series Title ,~,,Series Editor ,~,~,,,City ,,~,~,~,~,Description ,~,Version ,~,Type ,ISBN ,,Contents ,~,~,Computer ,~,~,~,~,~,~, -Conference Paper ,103,,,Conference Name ,~,~,Editor ,~,~,,~,Conference Location ,,~,~,~,~,~,~,~,,~,~,,~,~,~,~,~,~,~,~,~,~, -Conference Proceeding ,104,Year of Conference ,,Conference Name ,Series Title ,,Editor ,Series Editor ,Sponsor ,,~,Conference Location ,,,,~,~,,~,,,~,ISBN ,,~,~,~,~,~,~,~,~,~,~, -Chart or Table ,123,,,Image Source Program ,Name of File ,~,~,~,~,,~,City ,,Image Size ,~,,~,Description ,~,Version ,,Type of Image ,~,,~,~,~,~,~,~,~,~,~,~, -Dictionary ,,,,Dictionary Title ,~,,Editor ,~,Translator ,,Abbreviation ,City ,,,,,~,,~,,~,~,ISBN ,,,,,~,~,~,~,~,~,~, -Edited Book ,,,,Series Title ,~,,Series Editor ,~,Translator ,,,City ,,,,Series Volume ,~,Number of Pages ,~,,~,~,ISBN ,,,,,~,~,~,~,~,~,~, +,tid,biblio_year,title,biblio_secondary_title,biblio_tertiary_title,biblio_short_title,biblio_secondary_authors,biblio_tertiary_authors,biblio_subsidiary_authors,biblio_corp_authors,biblio_alternate_title,biblio_place_published,biblio_publisher,biblio_volume,biblio_number_of_volumes,biblio_number,biblio_issue,biblio_pages,biblio_section,biblio_edition,biblio_date,biblio_type_of_work,biblio_issn,,biblio_original_publication,biblio_reprint_edition,,biblio_custom1,biblio_custom2,biblio_custom3,biblio_custom4,biblio_custom5,biblio_custom6,biblio_custom7,biblio_abst_e,biblio_refereed +Generic ,,Year ,Title ,Secondary Title ,Tertiary Title ,Short Title ,Editor ,Tertiary Author ,Subsidiary Author ,Corporate Author,Alternate Title ,Place Published ,Publisher ,Volume ,Number of Volumes ,Number ,Issue,Pages ,Section ,Edition ,Date ,Type of Work ,ISBN/ISSN ,Electronic Resource Number ,Original Publication ,Reprint Edition ,Reviewed Item ,Custom 1 ,Custom 2 ,Custom 3 ,Custom 4 ,Custom 5 ,Custom 6 ,Custom 7 ,Abstract ,Refereed Designation +Ancient Text ,,,,Publication Title ,Volume Title ,,Editor ,~,Translator ,,Abbreviated Publication ,City ,,,,,~,,~,,,,ISBN ,,,,Reviewed Item ,~,~,~,~,~,~,~,, +Artwork ,112,,,~,~,,~,~,~,,,City ,,~,~,~,~,Description ,~,~,,,~,,~,~,,~,~,~,~,~,~,~,, +Audiovisual Material ,114,,,Series Title ,~,,Series Editor ,~,Performers ,,,City ,,~,Extent of Work ,Number ,~,~,~,,,Type ,ISBN ,,Contents ,~,,Cast ,Credits ,~,~,Format ,~,~,, +Bill ,117,,,Code ,Legislative Body ,,~,~,Sponsor ,,~,~,~,Code Volume ,~,Bill Number ,~,Code Pages ,Code Section ,Session ,,~,~,,History ,~,,~,~,~,~,~,~,~,, +Book ,100,,,Series Title ,~,,Series Editor ,~,Translator ,,Abbreviation ,City ,,,,Series Volume ,~,Number of Pages ,~,,~,~,ISBN ,,,,~,~,~,~,~,~,~,~,, +Book Section ,101,,,Book Title ,Series Title ,,Editor ,Series Editor ,Translator ,,Abbreviation ,City ,,,,Series Volume ,~,,Chapter ,,~,~,ISBN ,,,,,~,~,~,~,~,~,~,, +Case ,116,,Case Name ,Reporter ,~,Abbreviated Case Name ,~,~,Counsel ,,~,~,Court ,Reporter Volume ,Reporter Abbreviation ,~,~,First Page ,Page Cited ,~,Date Decided ,~,~,,History ,~,~,~,~,~,~,~,~,~,, +Classical Work ,127,,,Series Title ,~,,Series Editor ,~,Translator ,,,City ,,,,Series Volume ,~,Number of Pages ,~,,~,Type ,ISSN/ISBN ,,,,~,~,~,~,~,~,~,~,, +Computer Program ,113,,,Series Title ,~,,Series Editor ,~,~,,,City ,,~,~,~,~,Description ,~,Version ,~,Type ,ISBN ,,Contents ,~,~,Computer ,~,~,~,~,~,~,, +Conference Paper ,103,,,Conference Name ,~,~,Editor ,~,~,,~,Conference Location ,,~,~,~,~,~,~,~,,~,~,,~,~,~,~,~,~,~,~,~,~,, +Conference Proceeding ,104,Year of Conference ,,Conference Name ,Series Title ,,Editor ,Series Editor ,Sponsor ,,~,Conference Location ,,,,~,~,,~,,,~,ISBN ,,~,~,~,~,~,~,~,~,~,~,, +Chart or Table ,123,,,Image Source Program ,Name of File ,~,~,~,~,,~,City ,,Image Size ,~,,~,Description ,~,Version ,,Type of Image ,~,,~,~,~,~,~,~,~,~,~,~,, +Dictionary ,,,,Dictionary Title ,~,,Editor ,~,Translator ,,Abbreviation ,City ,,,,,~,,~,,~,~,ISBN ,,,,,~,~,~,~,~,~,~,, +Edited Book ,,,,Series Title ,~,,Series Editor ,~,Translator ,,,City ,,,,Series Volume ,~,Number of Pages ,~,,~,~,ISBN ,,,,,~,~,~,~,~,~,~,, Electronic Article ,,,,Periodical Title ,~,~,,~,~,,,~,~,,~,~,,,~,~,Date Accessed ,~,ISSN ,,~,~,~,~,~,~,~,~,~,~, Electronic Book ,,,,Secondary Title ,~,~,Editor ,~,~,,~,~,,,~,~,~,~,~,~,Date Accessed ,Type of Medium ,ISBN ,,~,~,~,~,~,~,~,~,~,~, Equation ,,,,Image Source Program ,Name of File ,~,~,~,~,,~,City ,,Image Size ,~,,~,Description ,~,Version ,,Type of Image ,~,,~,~,~,~,~,~,~,~,~,~, Index: biblio.install =================================================================== RCS file: /cvs/drupal/contributions/modules/biblio/biblio.install,v retrieving revision 1.30.2.93 diff -u -r1.30.2.93 biblio.install --- biblio.install 22 Jul 2009 02:37:35 -0000 1.30.2.93 +++ biblio.install 17 Nov 2009 20:07:04 -0000 @@ -1,5 +1,11 @@ '255', 'description' =>'', ), + 'biblio_refereed' => array ( + 'type' => 'varchar', + 'length' => '20', + 'description' =>'', + ), 'biblio_md5' => array ( 'type' => 'varchar', 'length' => '32', @@ -1737,4 +1748,47 @@ return $result; } -*/ + */ + /* add the new field -refereed- on the biblio table */ + +function biblio_update_6024(){ + $result = array(); + + db_add_field($result, 'biblio', 'biblio_refereed', array('type' => 'varchar', 'length' => '20') ); + + /* add the field data for -refereed- on the biblo_fields table + you need to get the last inserted record from biblio_fields and increment it by one + so you don't step on customized fields added via the user online interface */ + + $sql = 'SELECT fid FROM {biblio_fields} ORDER BY fid DESC'; + $lastfid = db_query_range($sql,0,1); + + $lastfid = db_result($lastfid); + $newfid = $lastfid + 1; + /* echo "
" . print_r($newfid, TRUE) . "";*/ + + $result[] = db_query("INSERT INTO {biblio_fields} (fid, name, type, size, maxsize) VALUES + (%n, 'biblio_refereed', 'textfield', 20, 125)", + $newfid); + + /*use the same fid and insert an entry in the biblio_field_type_data */ + $result[] = db_query("INSERT INTO {biblio_field_type_data} + (ftdid, title, hint) VALUES (%n, 'Refereed Designation', NULL)", + $newfid); + + /* get a list of unique tids from the biblio_field_type table. You want to + insert a tid,fid using the new fid for every available tid */ + + $newsql = "SELECT DISTINCT tid FROM {biblio_field_type} ORDER BY tid DESC"; + + $tidlist = db_query($newsql); + while ($result = db_fetch_array($tidlist)) { + $newtid = $result['tid'] ; + db_query('INSERT INTO {biblio_field_type} + (tid, fid, ftdid, cust_tdid, common, autocomplete, required, weight, visible) + VALUES (%d, %d, %d, %d, %d, %d, %d, %d, %d)', + $newtid, $newfid, $newfid, $newfid, 1, 1, 0, 1, 1); + } + return $result; + + } Index: biblio.field.link.data.csv =================================================================== RCS file: /cvs/drupal/contributions/modules/biblio/biblio.field.link.data.csv,v retrieving revision 1.1.2.11 diff -u -r1.1.2.11 biblio.field.link.data.csv --- biblio.field.link.data.csv 29 May 2009 01:24:16 -0000 1.1.2.11 +++ biblio.field.link.data.csv 17 Nov 2009 20:07:00 -0000 @@ -51,3 +51,4 @@ 50,Remote Database Provider,,0,0,0,177,0,biblio_remote_db_provider,textfield,60,255 51,Label,,0,0,0,178,0,biblio_label,textfield,60,255 52,Access Date,,0,0,0,179,0,biblio_access_date,textfield,60,255 +53,Refereed Designation,,0,0,0,180,0,biblio_refereed,textfield,60,128 Index: biblio.module =================================================================== RCS file: /cvs/drupal/contributions/modules/biblio/biblio.module,v retrieving revision 1.123.2.152 diff -u -r1.123.2.152 biblio.module --- biblio.module 11 Nov 2009 18:09:35 -0000 1.123.2.152 +++ biblio.module 17 Nov 2009 20:07:07 -0000 @@ -1,5 +1,5 @@ auth_category][$row->biblio_type][] = $row->auth_type; } @@ -1035,7 +1035,7 @@ $options["$option->tid"] = $option->name; } if (!isset($node->nid)) {// only show the doi lookup and paste boxes if this is a new entry - if($user->uid > 0 && phpversion() > 5 && !isset($form_state['storage']['biblio_doi'])) { + if(phpversion() > 5 && !isset($form_state['storage']['biblio_doi'])) { $form['doi_lookup'] = array( '#type' => 'fieldset', '#title' => t('DOI Lookup'), @@ -1047,7 +1047,7 @@ if ($have_pid) { $form['doi_lookup']['doi_register'] = array( '#prefix' => '
', - '#suffix' => '
', + '#suffix' => ' l('You need to register with CrossRef', 'http://www.crossref.org/requestaccount/', array('attributes' => array('target' => '_blank'), 'absolue' => TRUE)). t(' and then enter your CrossRef UserID in the "CrossRef Login Information" section of your account profile '). l('here...',"user/$user->uid/edit"), ); } @@ -1169,6 +1169,31 @@ $fld['hint'] = t('Separate keywords using the " @sep " character', array('@sep' => $sep)); } + + if ($key == 'biblio_refereed' ) { + $field_widget = array( + '#default_value' => ($form_state['values'][$key]?$form_state['values'][$key]:$node->$key), + '#type' => 'radios', + '#title' => $fld['title'], + '#options' => array( + 'None' => t('None'), + 'Refereed' => t('Refereed'), + 'Non-Refereed' => t('Non-Refereed'), + 'Does Not Apply' => t('Does Not Apply'), + 'Unknown' => t('Unknown'), + ), + '#size' => $fld['size'], + '#required' => $fld['required'], + '#maxlength' => $fld['maxsize'], + '#weight' => $fld['weight'] / 10, + '#autocomplete_path' => ($fld['autocomplete']) ? 'biblio/autocomplete/'. $fld['name'] : '', + '#description' => $fld['hint'] + ); + + $fld['hint'] = t('If you are not sure, set this to Unknown or Does Not Apply'); + } + else { + if ($key <> 'biblio_refereed' ) { $field_widget = array( '#default_value' => ($form_state['values'][$key]?$form_state['values'][$key]:$node->$key), '#type' => $fld['type'], @@ -1180,7 +1205,8 @@ '#autocomplete_path' => ($fld['autocomplete']) ? 'biblio/autocomplete/'. $fld['name'] : '', '#description' => $fld['hint'] ); - + } + } if ($main_area && $fld['type'] == 'textarea') { /* wrap all textarea fields in collapsed field sets to save space on the page */ $field_widget = array( @@ -1209,7 +1235,7 @@ $form['other_fields']['#weight'] = $max_visible_weight + 0.1; $form['body_field'] = array( '#type' => 'fieldset', - '#collapsible' => TRUE, + '#collapsible' => TRUE, '#collapsed' => TRUE, '#title' => t('Full Text'), '#description' => '', @@ -1548,8 +1574,11 @@ drupal_write_record('biblio', $node, 'vid'); } - biblio_update_contributors($node); - biblio_update_keywords($node); + biblio_save_contributors($node, TRUE); + if (variable_get('biblio_auto_orphaned_author_delete', 0)) { + db_query('DELETE FROM {biblio_contributor_data} WHERE cid NOT IN (SELECT DISTINCT(cid) FROM {biblio_contributor})'); + } + biblio_save_keywords($node); } /** @@ -1560,8 +1589,12 @@ function biblio_delete($node) { //first remove data from the biblio table db_query('DELETE FROM {biblio} WHERE nid = %d', $node->nid); - biblio_delete_contributors($node); - biblio_delete_keywords($node); + //now remove the entries from the contributor linking table + db_query('DELETE FROM {biblio_contributor} WHERE nid = %d', $node->nid); + if (variable_get('biblio_auto_orphaned_author_delete', 0)) { + db_query('DELETE FROM {biblio_contributor_data} WHERE cid NOT IN (SELECT DISTINCT(cid) FROM {biblio_contributor})'); + } + db_query('DELETE FROM {biblio_keyword} WHERE nid = %d', $node->nid); } /** * Implementation of hook_load(). @@ -1657,7 +1690,6 @@ if ($num_rows) { $query = "SELECT n.nid, n.title FROM {node} n - LEFT JOIN {biblio} b on n.vid=b.vid WHERE n.type = 'biblio' AND n.status=1 ORDER BY $block_order DESC"; $result = db_query_range(db_rewrite_sql($query), 0, $num_in_block); @@ -2208,7 +2240,7 @@ } function biblio_get_allowed_tags() { - return array('a', 'b', 'i', 'u', 'sub', 'sup', 'span'); + return array('a', 'b', 'i', 'u', 'sub', 'sup'); } function biblio_get_title_url_info($node) { Index: .project =================================================================== RCS file: .project diff -N .project --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ .project 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,11 @@ + +