View source
<?php
function biblio_install() {
$result = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$result[] = db_query("alter table {node} modify title varchar(255);");
$result[] = db_query("alter table {node_revisions} modify title varchar(255);");
$result[] = db_query("CREATE TABLE {biblio} (\n `nid` int(10) NOT NULL default '0',\n `vid` int(10) NOT NULL default '0',\n `biblio_type` int(11) NOT NULL default '0',\n `biblio_number` varchar(10) default NULL,\n `biblio_section` varchar(10) default NULL,\n `biblio_other_number` varchar(24) default NULL,\n `biblio_secondary_title` varchar(255) default NULL,\n `biblio_tertiary_title` varchar(255) default NULL,\n `biblio_short_title` varchar(255) default NULL,\n `biblio_alternate_title` varchar(255) default NULL,\n `biblio_translated_title` varchar(255) default NULL,\n `biblio_authors` varchar(255) default NULL,\n `biblio_secondary_authors` varchar(255) default NULL,\n `biblio_tertiary_authors` varchar(255) default NULL,\n `biblio_corp_author` varchar(255) default NULL,\n `biblio_other_author_affiliations` varchar(255) default NULL,\n `biblio_edition` varchar(255) default NULL,\n `biblio_publisher` varchar(255) default NULL,\n `biblio_original_publication` varchar(255) default NULL,\n `biblio_reprint_edition` varchar(255) default NULL,\n `biblio_place_published` varchar(255) default NULL,\n `biblio_year` int(11) NOT NULL default '9999',\n `biblio_volume` varchar(10) default NULL,\n `biblio_number_of_volumes` varchar(10) default NULL,\n `biblio_pages` varchar(128) default NULL,\n `biblio_date` varchar(16) default NULL,\n `biblio_isbn` varchar(24) default NULL,\n `biblio_issn` varchar(24) default NULL,\n `biblio_lang` varchar(24) default 'eng',\n `biblio_abst_e` text,\n `biblio_abst_f` text,\n `biblio_full_text` tinyint(4) default '0',\n `biblio_keywords` varchar(255) default NULL,\n `biblio_url` varchar(255) default NULL,\n `biblio_doi` varchar(100) default NULL,\n `biblio_issue` varchar(10) default NULL,\n `biblio_type_of_work` varchar(255) default NULL,\n `biblio_accession_number` varchar(24) default NULL,\n `biblio_call_number` varchar(24) default NULL,\n `biblio_notes` text,\n `biblio_coins` text,\n `biblio_research_notes` text,\n `biblio_custom1` text,\n `biblio_custom2` text,\n `biblio_custom3` text,\n `biblio_custom4` text,\n `biblio_custom5` text,\n `biblio_custom6` text,\n `biblio_custom7` text,\n `biblio_auth_address` text,\n `biblio_remote_db_name` varchar(255) default NULL,\n `biblio_remote_db_provider` varchar(255) default NULL,\n `biblio_citekey` varchar(16) default NULL,\n `biblio_label` varchar(255) default NULL,\n `biblio_access_date` varchar(255) default NULL,\n PRIMARY KEY (`vid`),\n KEY `nid` (`nid`),\n KEY `type` (`biblio_type`),\n KEY `year` (`biblio_year`),\n FULLTEXT KEY `keywords` (`biblio_keywords`),\n FULLTEXT KEY `publisher` (`biblio_publisher`),\n FULLTEXT KEY `authors` (`biblio_authors`)\n ) /*!40100 ENGINE=MyISAM DEFAULT CHARACTER SET utf8 */;");
$result[] = db_query("CREATE TABLE {biblio_author_index} (\n `aid` int(11) NOT NULL default '0',\n `author` varchar(100) NOT NULL default '',\n PRIMARY KEY (`aid`)\n ) /*!40100 DEFAULT CHARSET=utf8 */;");
$result[] = db_query("CREATE TABLE {biblio_has_author} (\n `nid` int(11) NOT NULL default '0',\n `aid` int(11) NOT NULL default '0',\n `rank` int(11) NOT NULL default '0',\n PRIMARY KEY (`nid`,`aid`,`rank`)\n ) /*!40100 DEFAULT CHARSET=utf8 */;");
$result[] = db_query("CREATE TABLE {biblio_fields} (\n `fid` int(11) NOT NULL default '0',\n `name` varchar(128) NOT NULL default '',\n `title` varchar(128) NOT NULL default '',\n `common` tinyint(1) NOT NULL default '0',\n `type` varchar(128) NOT NULL default '',\n `size` int(11) NOT NULL default '0',\n `maxsize` int(11) NOT NULL default '0',\n `hint` varchar(255) default '',\n `required` tinyint(1) NOT NULL default '0',\n `autocomplete` tinyint(1) NOT NULL default '0',\n `visible` tinyint(4) NOT NULL default '0',\n `weight` int(11) NOT NULL default '0',\n PRIMARY KEY (`fid`)\n ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
$result[] = db_query("INSERT INTO {biblio_fields} (`fid`,`name`,`title`,`common`,`type`,`size`,`maxsize`,`hint`,`required`,`visible`,`autocomplete`,`weight`) VALUES\n (1,'biblio_authors','Authors',1,'textfield',60,255,'Author names must be separated by semicolons',1,0,0,1),\n (2,'biblio_secondary_authors','Secondary Authors',0,'textfield',60,255,'',0,0,0,21),\n (3,'biblio_tertiary_authors','Tertiary Authors',0,'textfield',60,255,'',0,0,0,26),\n (4,'biblio_corp_author','Corporate Author',0,'textfield',60,255,'',0,0,1,25),\n (5,'biblio_secondary_title','Secondary Title',0,'textfield',60,255,'',0,0,1,12),\n (6,'biblio_tertiary_title','Tertiary Title',0,'textfield',60,255,'',0,0,1,13),\n (7,'biblio_accession_number','Accession Number',1,'textfield',24,24,'',0,0,0,151),\n (8,'biblio_isbn','ISBN Number',1,'textfield',24,24,'',0,0,0,150),\n (9,'biblio_call_number','Call Number',1,'textfield',24,24,'',0,0,0,152),\n (10,'biblio_other_number','Other Numbers',1,'textfield',10,24,'',0,0,0,153),\n (11,'biblio_other_author_affiliations','Other Author Affiliations',0,'textfield',60,255,'',0,0,0,24),\n (12,'biblio_publisher','Publisher',0,'textfield',60,255,'',0,0,1,19);");
$result[] = db_query("INSERT INTO {biblio_fields} (`fid`,`name`,`title`,`common`,`type`,`size`,`maxsize`,`hint`,`required`,`visible`,`autocomplete`,`weight`) VALUES\n (13,'biblio_place_published','Place Published',0,'textfield',60,255,'',0,0,1,20),\n (14,'biblio_year','Year of Publication',1,'textfield',9,9,'(Submitted, In Press or YYYY)',1,0,0,-45),\n (15,'biblio_edition','Edition',0,'textfield',60,255,'',0,0,0,15),\n (16,'biblio_volume','Volume',0,'textfield',10,10,'',0,0,0,14),\n (17,'biblio_number','Number',0,'textfield',10,10,'',0,0,0,16),\n (18,'biblio_pages','Pagination',0,'textfield',24,128,'',0,0,0,17),\n (19,'biblio_date','Date Published',0,'textfield',16,16,'(mm/yyyy)',0,0,0,18),\n (20,'biblio_lang','Publication Language',0,'textfield',24,24,'',0,0,0,23),\n (21,'biblio_abst_e','Abstract',1,'textarea',60,65535 ,'',0,0,0,155),\n (22,'biblio_abst_f','French Abstract',0,'textarea',60,65535 ,'',0,0,0,156),\n (23,'biblio_keywords','Key Words',1,'textfield',60,255,'',0,0,0,154),\n (24,'biblio_type_of_work','Type of Work',0,'textfield',60,255,'Masters Thesis, PhD Thesis, etc.',0,0,0,22),\n (25,'biblio_url','URL',1,'textfield',60,255,'',0,0,0,158);");
$result[] = db_query("INSERT INTO {biblio_fields} (`fid`,`name`,`title`,`common`,`type`,`size`,`maxsize`,`hint`,`required`,`visible`,`autocomplete`,`weight`) VALUES\n (26,'biblio_notes','Notes',1,'textarea',60,65535 ,'',0,0,0,157),\n (27,'biblio_issue','Issue',0,'textfield',10,10,'',0,0,0,15),\n (28,'biblio_research_notes','Reseach Notes',0,'textarea',60,65535 ,'',0,0,0,160),\n (29,'biblio_custom1','Custom 1',0,'textarea',60,65535,'',0,0,0,161),\n (30,'biblio_custom2','Custom 2',0,'textarea',60,65535,'',0,0,0,162),\n (31,'biblio_custom3','Custom 3',0,'textarea',60,65535,'',0,0,0,163),\n (32,'biblio_custom4','Custom 4',0,'textarea',60,65535,'',0,0,0,164),\n (33,'biblio_custom5','Custom 5',0,'textarea',60,65535,'',0,0,0,165),\n (34,'biblio_custom6','Custom 6',0,'textarea',60,65535,'',0,0,0,167),\n (35,'biblio_custom7','Custom 7',0,'textarea',60,65535,'',0,0,0,168),\n (36,'biblio_number_of_volumes','Number of Volumes',0,'textfield',10,10,'',0,0,0,15),\n (37,'biblio_short_title','Short Title',0,'textfield',60,255,'',0,0,0,169),\n (38,'biblio_alternate_title','Alternate Title',0,'textfield',60,255,'',0,0,0,170),\n (39,'biblio_translated_title','Translated Title',0,'textfield',60,255,'',0,0,0,170),\n (40,'biblio_original_publication','Original Publication',0,'textfield',60,255,'',0,0,0,171),\n (41,'biblio_reprint_edition','Reprint Edition',0,'textfield',120,255,'',0,0,0,172),\n (42,'biblio_section','Section',0,'textfield',10,10,'',0,0,0,15),\n (43,'biblio_citekey','Citation Key',0,'textfield',16,16,'',0,0,1,175),\n (44,'biblio_coins','COinS Data',1,'textarea',60,65535 ,'This will be automatically generated, only edit if you know what you are doing.',0,0,0,176),\n (45,'biblio_issn','ISSN Number',1,'textfield',24,24,'',0,0,0,150),\n (46,'biblio_doi','DOI',1,'textfield',60,255,'',0,0,0,159),\n (47,'biblio_auth_address','Author Address',0,'textarea',60,65535,'',0,0,0,178),\n (48,'biblio_remote_db_name','Remote Database Name',0,'textfield',60,255,'',0,0,0,176),\n (49,'biblio_remote_db_provider','Remote Database Provider',0,'textfield',60,255,'',0,0,0,177),\n (50,'biblio_label','Label',0,'textfield',60,255,'',0,0,0,178),\n (51,'biblio_access_date','Access Date',0,'textfield',60,255,'',0,0,0,179)\n ;");
$result[] = db_query("CREATE TABLE {biblio_types} (\n `tid` int(11) NOT NULL auto_increment,\n `name` varchar(64) NOT NULL default '',\n `description` varchar(255) default NULL,\n `weight` int(11) NOT NULL default '0',\n `visible` tinyint(1) NOT NULL default '1' ,\n PRIMARY KEY (`tid`)\n ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
$result[] = db_query("INSERT INTO {biblio_types} (`tid`,`name`,`description`,weight) VALUES\n (-1,'Select Type...',NULL,-10),\n (100,'Book',NULL,1),\n\t\t\t\t(101,'Book Chapter',NULL,2),\n\t\t\t\t(102,'Journal Article',NULL,3),\n\t\t\t\t(103,'Conference Paper',NULL,4),\n\t\t\t\t(104,'Conference Proceedings',NULL,5),\n\t\t\t\t(105,'Newspaper Article',NULL,6),\n\t\t\t\t(106,'Magazine Article',NULL,7),\n\t\t\t\t(107,'Web Article',NULL,8),\n\t\t\t\t(108,'Thesis',NULL,9),\n\t\t\t\t(109,'Report',NULL,10),\n\t\t\t\t(110,'Film',NULL,11),\n\t\t\t\t(111,'Broadcast',NULL,12),\n\t\t\t\t(112,'Artwork',NULL,13),\n\t\t\t\t(113,'Software',NULL,14),\n\t\t\t\t(114,'Audiovisual',NULL,15),\n\t\t\t\t(115,'Hearing',NULL,16),\n\t\t\t\t(116,'Case',NULL,17),\n\t\t\t\t(117,'Bill',NULL,18),\n\t\t\t\t(118,'Statute',NULL,19),\n\t\t\t\t(119,'Patent',NULL,20),\n\t\t\t\t(120,'Personal',NULL,21),\n\t\t\t\t(121,'Manuscript',NULL,22),\n\t\t\t\t(122,'Map',NULL,23),\n\t\t\t\t(123,'Chart',NULL,24),\n\t\t\t\t(124,'Unpublished',NULL,25),\n\t\t\t\t(125,'Database',NULL,26),\n\t\t\t\t(126,'Government Report',NULL,27),\n\t\t\t\t(127,'Classical'\t,NULL,28),\n\t\t\t\t(128,'Legal Ruling'\t,NULL,29),\n\t\t\t\t(129,'Miscellaneous'\t,NULL,30),\n\t\t\t\t(130,'Miscellaneous Section'\t,NULL,31);");
_add_types($result);
break;
case 'pgsql':
break;
}
if (count($result) == count(array_filter($result))) {
drupal_set_message(t('The biblio module has successfully added its tables to the database.'));
}
else {
drupal_set_message(t('Drupal was unable to install the database tables for the biblio module.'), 'error');
}
}
function biblio_reset_types() {
$result = array();
$result[] = db_query("DROP TABLE {biblio_type_details} ");
_add_types($result);
}
function _add_types(&$result) {
$result[] = db_query("CREATE TABLE {biblio_type_details} (\n `tid` int(11) NOT NULL default '0',\n `fid` int(11) NOT NULL default '0',\n `title` varchar(100) NOT NULL default '',\n `hint` varchar(100) default '',\n `required` tinyint(1) NOT NULL default '0',\n `weight` int(11) NOT NULL default '0',\n PRIMARY KEY (`tid`,`fid`),\n KEY `tid` (`tid`)\n ) /*!40100 ENGINE=MyISAM DEFAULT CHARACTER SET utf8 */;");
$result[] = db_query("/*!40000 ALTER TABLE {biblio_type_details} DISABLE KEYS */;");
$result[] = db_query("INSERT INTO {biblio_type_details} (`tid`,`fid`,`title`,`hint`,`required`,`weight`) VALUES\n (100,5,'Series Title','',0,3),\n (100,15,'Edition','',0,10),\n (100,18,'Number of Pages','',0,9),\n (100,12,'Publisher','',0,5),\n (100,13,'City','',0,4),\n (100,2,'Series Editor','',0,2),\n (100,16,'Volume','',0,6),\n (100,36,'Number of Volumes','',0,7),\n (100,17,'Series Volume','',0,8),\n (100,37,'Short Title','',0,11),\n (100,41,'Reprint Edition','',0,12),\n (101,36,'Number of Volumes','',0,7),\n (101,16,'Volume','',0,6),\n (101,17,'Series Volume','',0,8),\n (101,18,'Pages','',0,9),\n (101,42,'Chapter','',0,10),\n (101,3,'Series Editor','',0,11),\n (101,6,'Series Title','',0,12),\n (101,15,'Edition','',0,13),\n (101,37,'Short Title','',0,14),\n (101,40,'Original Publication','',0,171),\n (101,41,'Reprint Edition','',0,172),\n (101,20,'Language','',0,23),\n (101,12,'Publisher','',0,5),\n (101,5,'Book Title','',0,3),\n (101,2,'Editor','',0,2),\n (101,13,'City','',0,4);");
$result[] = db_query("INSERT INTO {biblio_type_details} (`tid`,`fid`,`title`,`hint`,`required`,`weight`) VALUES\n (102,42,'Start Page','',0,6),\n (102,37,'Short Title','',0,15),\n (102,41,'Reprint Edition','',0,172),\n (102,12,'Publisher','',0,19),\n (102,16,'Volume','',0,3),\n (102,19,'Journal Date','(mm/yyyy)',0,14),\n (102,5,'Journal Title','',1,2),\n (102,27,'Issue','',0,4),\n (102,18,'Pages','',0,5),\n (103,5,'Conference Name','',0,12),\n (103,6,'Series Title','',0,13),\n (103,16,'Volume','',0,14),\n (103,15,'Edition','',0,15),\n (103,18,'Pagination','',0,17),\n (103,19,'Conference Start Date','(dd/mm/yyyy)',0,18),\n (103,12,'Publisher','',0,19),\n (103,13,'Conference Location','',0,20),\n (103,2,'Editor','',0,21),\n (104,5,'Conference Name','',0,12),\n (104,6,'Series Title','',0,13),\n (104,16,'Volume','',0,14),\n (104,15,'Edition','',0,15),\n (104,18,'Pagination','',0,17),\n (104,19,'Conference Start Date','(dd/mm/yyyy)',0,18),\n (104,12,'Publisher','',0,19),\n (104,13,'Conference Location','',0,20),\n (104,2,'Editor','',0,21);");
$result[] = db_query("INSERT INTO {biblio_type_details} (`tid`,`fid`,`title`,`hint`,`required`,`weight`) VALUES\n (108,5,'Academic Department','',0,12),\n (108,18,'Number of Pages','',0,17),\n (108,12,'University','',0,19),\n (108,13,'City','',0,20),\n (108,24,'Degree','Masters Thesis, PhD Thesis, etc.',0,22),\n (109,19,'Date','(mm/yyyy)',0,18),\n (109,18,'Pages','',0,17),\n (109,5,'Prepared for','',0,12),\n (109,12,'Institution','',0,19),\n (109,13,'City','',0,20),\n (119,12,'Assignee','',0,19),\n (119,19,'Date','(mm/yyyy)',0,18),\n (119,18,'Pages','',0,17),\n (119,27,'Issue','',0,15),\n (119,5,'Published Source','',0,12),\n (119,13,'Country','',0,13),\n (119,16,'Volume','',0,14),\n (129,5,'Prepared for','',0,12);");
$result[] = db_query("/*!40000 ALTER TABLE {biblio_type_details} ENABLE KEYS */;");
}
function biblio_uninstall() {
$result = db_query("SELECT * FROM {node} where type='biblio' ");
while ($row = db_fetch_object($result)) {
node_delete($row->nid);
}
db_query("DROP TABLE {biblio} ");
db_query("DROP TABLE {biblio_types} ");
db_query("DROP TABLE {biblio_fields} ");
db_query("DROP TABLE {biblio_type_details} ");
db_query("DROP TABLE {biblio_author_index} ");
db_query("DROP TABLE {biblio_has_author} ");
variable_del('biblio_base');
variable_del('biblio_baseopenurl');
variable_del('biblio_auto_citekey');
variable_del('biblio_citekey_prefix');
variable_del('biblio_citekey_field1');
variable_del('biblio_citekey_field2');
variable_del('biblio_footnotes_integration');
variable_del('biblio_freetagging_vocab');
variable_del('biblio_keyword_freetagging');
variable_del('biblio_links_target_new_window');
variable_del('biblio_max_user_tid');
variable_del('biblio_node_layout');
variable_del('biblio_normalize');
variable_del('biblio_openurlimage');
variable_del('biblio_order');
variable_del('biblio_rowsperpage');
variable_del('biblio_rss');
variable_del('biblio_rss_number_of_entries');
variable_del('biblio_sort');
variable_del('biblio_sort_tabs');
variable_del('biblio_style');
variable_del('biblio_view_only_own');
variable_del('biblio_annotations');
}
function biblio_update_1() {
return _system_update_utf8(array(
'biblio',
'biblio_fields',
'biblio_types',
'biblio_type_details',
));
}
function biblio_update_2() {
$result = array();
$result = update_sql("alter table {biblio_types} modify tid int(11) auto_increment;");
return $result;
}
function biblio_update_3() {
$result = update_sql("alter table {node} modify title varchar(255);");
$result = update_sql("alter table {node_revisions} modify title varchar(255);");
return $result;
}
function biblio_update_4() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio_type_details} DROP COLUMN visible;");
$result[] = update_sql("ALTER TABLE {biblio}\n ADD `biblio_custom1` varchar(255) default NULL,\n ADD `biblio_custom2` varchar(255) default NULL,\n ADD `biblio_custom3` varchar(255) default NULL,\n ADD `biblio_custom4` varchar(255) default NULL,\n ADD `biblio_custom5` varchar(255) default NULL,\n ADD `biblio_custom6` varchar(255) default NULL,\n ADD `biblio_custom7` varchar(255) default NULL,\n ADD `biblio_research_notes` text,\n ADD `biblio_number_of_volumes` varchar(10) default NULL,\n ADD `biblio_short_title` varchar(255) default NULL,\n ADD `biblio_alternate_title` varchar(255) default NULL,\n ADD `biblio_original_publication` varchar(255) default NULL,\n ADD `biblio_reprint_edition` varchar(255) default NULL,\n ADD `biblio_translated_title` varchar(255) default NULL;");
$result[] = update_sql("INSERT INTO {biblio_fields} (`fid`,`name`,`title`,`common`,`type`,`size`,`maxsize`,`hint`,`required`,`visible`,`weight`) VALUES\n (28,'biblio_research_notes','Reseach Notes',0,'textarea',60,15,'',0,0,160),\n (29,'biblio_custom1','Custom 1',0,'textfield',120,255,'',0,0,161),\n (30,'biblio_custom2','Custom 2',0,'textfield',120,255,'',0,0,162),\n (31,'biblio_custom3','Custom 3',0,'textfield',120,255,'',0,0,163),\n (32,'biblio_custom4','Custom 4',0,'textfield',120,255,'',0,0,164),\n (33,'biblio_custom5','Custom 5',0,'textfield',120,255,'',0,0,165),\n (34,'biblio_custom6','Custom 6',0,'textfield',120,255,'',0,0,167),\n (35,'biblio_custom7','Custom 7',0,'textfield',120,255,'',0,0,168),\n (36,'biblio_number_of_volumes','Number of Volumes',0,'textfield',10,10,'',0,0,15),\n (37,'biblio_short_title','Short Title',0,'textfield',120,255,'',0,0,169),\n (38,'biblio_alternate_title','Alternate Title',0,'textfield',120,255,'',0,0,170),\n (39,'biblio_translated_title','Translated Title',0,'textfield',120,255,'',0,0,170),\n (40,'biblio_original_publication','Original Publication',0,'textfield',120,255,'',0,0,171),\n (41,'biblio_reprint_edition','Reprint Edition',0,'textfield',120,255,'',0,0,172);");
return $result;
}
function biblio_update_5() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio_types}\n ADD `weight` int(11) NOT NULL default '0';");
$result[] = update_sql("INSERT INTO {biblio_types} (`tid`,`name`,`description`,weight) VALUES\n (100,'Book',NULL,1),\n\t\t\t\t(101,'Book Article',NULL,2),\n\t\t\t\t(102,'Journal Article',NULL,3),\n\t\t\t\t(103,'Conference Paper',NULL,4),\n\t\t\t\t(104,'Proceedings Article',NULL,5),\n\t\t\t\t(105,'Newspaper Article',NULL,6),\n\t\t\t\t(106,'Magazine Article',NULL,7),\n\t\t\t\t(107,'Web Article',NULL,8),\n\t\t\t\t(108,'Thesis',NULL,9),\n\t\t\t\t(109,'Report',NULL,10),\n\t\t\t\t(110,'Film',NULL,11),\n\t\t\t\t(111,'Broadcast',NULL,12),\n\t\t\t\t(112,'Artwork',NULL,13),\n\t\t\t\t(113,'Software',NULL,14),\n\t\t\t\t(114,'Audiovisual',NULL,15),\n\t\t\t\t(115,'Hearing',NULL,16),\n\t\t\t\t(116,'Case',NULL,17),\n\t\t\t\t(117,'Bill',NULL,18),\n\t\t\t\t(118,'Statute',NULL,19),\n\t\t\t\t(119,'Patent',NULL,20),\n\t\t\t\t(120,'Personal',NULL,21),\n\t\t\t\t(121,'Manuscript',NULL,22),\n\t\t\t\t(122,'Map',NULL,23),\n\t\t\t\t(123,'Chart',NULL,24),\n\t\t\t\t(124,'Unpublished',NULL,25),\n\t\t\t\t(125,'Database',NULL,26),\n\t\t\t\t(126,'Government Report',NULL,27),\n\t\t\t\t(127,'Classical'\t,NULL,28),\n\t\t\t\t(128,'Legal Ruling'\t,NULL,29),\n\t\t\t\t(129,'Miscellaneous'\t,NULL,30),\n\t\t\t\t(130,'Miscellaneous Section'\t,NULL,31);");
$result[] = update_sql("UPDATE {biblio} SET biblio_type = 102 WHERE biblio_type = 1 ");
$result[] = update_sql("UPDATE {biblio} SET biblio_type = 103 WHERE biblio_type = 2 ");
$result[] = update_sql("UPDATE {biblio} SET biblio_type = 104 WHERE biblio_type = 3 ");
$result[] = update_sql("UPDATE {biblio} SET biblio_type = 104 WHERE biblio_type = 4 ");
$result[] = update_sql("UPDATE {biblio} SET biblio_type = 109 WHERE biblio_type = 5 ");
$result[] = update_sql("UPDATE {biblio} SET biblio_type = 100 WHERE biblio_type = 6 ");
$result[] = update_sql("UPDATE {biblio} SET biblio_type = 108 WHERE biblio_type = 7 ");
$result[] = update_sql("UPDATE {biblio} SET biblio_type = 119 WHERE biblio_type = 8 ");
$result[] = update_sql("UPDATE {biblio} SET biblio_type = 129 WHERE biblio_type = 9 ");
return $result;
}
function biblio_update_6() {
$result = array();
$result[] = update_sql("UPDATE {biblio_types} SET tid = -11 WHERE tid = 1 ");
$result[] = update_sql("UPDATE {biblio_types} SET tid = -12 WHERE tid = 2 ");
$result[] = update_sql("UPDATE {biblio_types} SET tid = -13 WHERE tid = 3 ");
$result[] = update_sql("UPDATE {biblio_types} SET tid = -14 WHERE tid = 4 ");
$result[] = update_sql("UPDATE {biblio_types} SET tid = -15 WHERE tid = 5 ");
$result[] = update_sql("UPDATE {biblio_types} SET tid = -16 WHERE tid = 6 ");
$result[] = update_sql("UPDATE {biblio_types} SET tid = -17 WHERE tid = 7 ");
$result[] = update_sql("UPDATE {biblio_types} SET tid = -18 WHERE tid = 8 ");
$result[] = update_sql("UPDATE {biblio_types} SET tid = -19 WHERE tid = 9 ");
return $result;
}
function biblio_update_7() {
$result = array();
$result[] = update_sql("UPDATE {biblio_type_details} SET tid = 102 WHERE tid = 1 ");
$result[] = update_sql("UPDATE {biblio_type_details} SET tid = 103 WHERE tid = 2 ");
$result[] = update_sql("UPDATE {biblio_type_details} SET tid = 104 WHERE tid = 3 ");
$result[] = update_sql("UPDATE {biblio_type_details} SET tid = 104 WHERE tid = 4 ");
$result[] = update_sql("UPDATE {biblio_type_details} SET tid = 109 WHERE tid = 5 ");
$result[] = update_sql("UPDATE {biblio_type_details} SET tid = 100 WHERE tid = 6 ");
$result[] = update_sql("UPDATE {biblio_type_details} SET tid = 108 WHERE tid = 7 ");
$result[] = update_sql("UPDATE {biblio_type_details} SET tid = 119 WHERE tid = 8 ");
$result[] = update_sql("UPDATE {biblio_type_details} SET tid = 129 WHERE tid = 9 ");
return $result;
}
function biblio_update_8() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio}\n ADD `biblio_section` varchar(10) default NULL ;");
$result[] = update_sql("INSERT INTO {biblio_fields} (`fid`,`name`,`title`,`common`,`type`,`size`,`maxsize`,`hint`,`required`,`visible`,`weight`) VALUES\n (42,'biblio_section','Section',0,'textfield',10,10,'',0,0,15);");
return $result;
}
function biblio_update_9() {
$result = array();
$result[] = update_sql("alter table {node} modify title varchar(255);");
$result[] = update_sql("alter table {node_revisions} modify title varchar(255);");
return $result;
}
function biblio_update_10() {
$result = array();
$result[] = update_sql("UPDATE {biblio_fields} SET maxsize = 65535 WHERE type = 'textarea' ");
$result[] = update_sql("ALTER TABLE {biblio} ADD `vid` int(10) NOT NULL default '0';");
return $result;
}
function biblio_update_11() {
$result = array();
$nodes = db_query("SELECT * FROM {node} as n WHERE n.type='biblio' ");
while ($node = db_fetch_object($nodes)) {
$node->vid = db_next_id('{node_revisions}_vid');
$result[] = update_sql("UPDATE {node} SET vid = {$node->vid} WHERE nid = {$node->nid};");
$result[] = update_sql("UPDATE {node_revisions} SET vid = {$node->vid} WHERE nid = {$node->nid};");
$result[] = update_sql("UPDATE {biblio} SET vid = {$node->vid} WHERE nid = {$node->nid};");
}
return $result;
}
function biblio_update_12() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio_types} ADD `visible` tinyint(1) NOT NULL default '1' ;");
return $result;
}
function biblio_update_13() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio} ADD `biblio_citekey` varchar(16) ;");
$result[] = update_sql("INSERT INTO {biblio_fields} (`fid`,`name`,`title`,`common`,`type`,`size`,`maxsize`,`hint`,`required`,`visible`,`weight`) VALUES\n (43,'biblio_citekey','Citation Key',0,'textfield',16,16,'',0,0,175);");
return $result;
}
function biblio_update_14() {
$result = array();
$result[] = update_sql("CREATE TABLE {biblio_author_index} (\n `aid` int(11) NOT NULL default '0',\n `author` varchar(100) NOT NULL default '',\n PRIMARY KEY (`aid`) ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
$result[] = update_sql("CREATE TABLE {biblio_has_author} (\n `nid` int(11) NOT NULL default '0',\n `aid` int(11) NOT NULL default '0',\n `rank` int(11) NOT NULL default '0',\n PRIMARY KEY (`nid`,`aid`,`rank`) ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
return $result;
}
function biblio_update_15() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio} DROP PRIMARY KEY ;");
$result[] = update_sql("ALTER TABLE {biblio} ADD PRIMARY KEY (`nid`,`vid`) ;");
return $result;
}
function biblio_update_16() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio} DROP PRIMARY KEY ;");
$result[] = update_sql("ALTER TABLE {biblio} ADD PRIMARY KEY (`vid`) ;");
$result[] = update_sql("ALTER TABLE {biblio} ADD KEY nid (`nid`) ;");
$result[] = update_sql("ALTER TABLE {biblio} ADD FULLTEXT KEY `keywords` (`biblio_keywords`) ;");
$result[] = update_sql("ALTER TABLE {biblio} ADD FULLTEXT KEY `publisher` (`biblio_publisher`) ;");
return $result;
}
function biblio_update_17() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio} MODIFY biblio_pages varchar(128);");
$result[] = update_sql("UPDATE {biblio_fields} SET maxsize = 128 WHERE name = 'biblio_pages';");
return $result;
}
function biblio_update_18() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio_fields} ADD `autocomplete` tinyint(1) NOT NULL default '0' ;");
return $result;
}
function biblio_update_20() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio} ADD `biblio_coins` text ;");
$result[] = update_sql("INSERT INTO {biblio_fields} (`fid`,`name`,`title`,`common`,`type`,`size`,`maxsize`,`hint`,`required`,`visible`,`autocomplete`,`weight`) VALUES\n (44,'biblio_coins','COinS Data',1,'textarea',60,65535 ,'This will be automatically generated, only edit if you know what you are doing.',0,0,0,176);");
return $result;
}
function biblio_update_21() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio} ADD `biblio_doi` varchar(100) default NULL;");
$result[] = update_sql("ALTER TABLE {biblio} ADD `biblio_issn` varchar(24) default NULL;");
$result[] = update_sql("INSERT INTO {biblio_fields} (`fid`,`name`,`title`,`common`,`type`,`size`,`maxsize`,`hint`,`required`,`visible`,`autocomplete`,`weight`) VALUES\n (45,'biblio_issn','ISSN Number',1,'textfield',24,24,'',0,0,0,150),\n (46,'biblio_doi','DOI',1,'textfield',60,255,'',0,0,0,159);");
$result[] = update_sql("UPDATE {biblio_fields} SET title = 'ISBN Number' WHERE name = 'biblio_isbn';");
return $result;
}
function biblio_update_22() {
$result = array();
$result[] = update_sql("alter table {biblio} modify `biblio_custom1` text ;");
$result[] = update_sql("alter table {biblio} modify `biblio_custom2` text ;");
$result[] = update_sql("alter table {biblio} modify `biblio_custom3` text ;");
$result[] = update_sql("alter table {biblio} modify `biblio_custom4` text ;");
$result[] = update_sql("alter table {biblio} modify `biblio_custom5` text ;");
$result[] = update_sql("alter table {biblio} modify `biblio_custom6` text ;");
$result[] = update_sql("alter table {biblio} modify `biblio_custom7` text ;");
$result[] = update_sql("UPDATE {biblio_fields} SET type = 'textarea',size=60,maxsize=65535 WHERE name LIKE 'biblio_custom%';");
$result[] = update_sql("ALTER TABLE {biblio} ADD `biblio_auth_address` text ;");
$result[] = update_sql("ALTER TABLE {biblio} ADD `biblio_remote_db_name` varchar(255) default NULL;");
$result[] = update_sql("ALTER TABLE {biblio} ADD `biblio_remote_db_provider` varchar(255) default NULL;");
$result[] = update_sql("ALTER TABLE {biblio} ADD `biblio_label` varchar(255) default NULL;");
$result[] = update_sql("ALTER TABLE {biblio} ADD `biblio_access_date` varchar(255) default NULL;");
$result[] = update_sql("INSERT INTO {biblio_fields} (`fid`,`name`,`title`,`common`,`type`,`size`,`maxsize`,`hint`,`required`,`visible`,`autocomplete`,`weight`) VALUES\n (47,'biblio_auth_address','Author Address',0,'textarea',60,65535,'',0,0,0,178),\n (48,'biblio_remote_db_name','Remote Database Name',0,'textfield',60,255,'',0,0,0,176),\n (49,'biblio_remote_db_provider','Remote Database Provider',0,'textfield',60,255,'',0,0,0,177),\n (50,'biblio_label','Label',0,'textfield',60,255,'',0,0,0,178),\n (51,'biblio_access_date','Access Date',0,'textfield',60,255,'',0,0,0,179)\n ;");
return $result;
}
function biblio_update_23() {
$result = array();
$result[] = update_sql("UPDATE {biblio} SET biblio_year = 9999 WHERE biblio_year = 0 ;");
return $result;
}
function biblio_update_24() {
$result = array();
$result[] = update_sql("UPDATE {biblio} SET biblio_year = 9998 WHERE biblio_year = 1 ;");
$result[] = update_sql("UPDATE {biblio_fields} SET size = 9 WHERE name = 'biblio_year';");
$result[] = update_sql("UPDATE {biblio_fields} SET maxsize = 9 WHERE name = 'biblio_year';");
return $result;
}
function biblio_update_25() {
$result = array();
$result[] = update_sql("UPDATE {biblio_fields} SET hint = '(YYYY, In Press or Submitted)' WHERE name = 'biblio_year';");
return $result;
}
function biblio_update_26() {
$result = array();
$result[] = update_sql("UPDATE {biblio} SET biblio_year = 9997 WHERE biblio_year = 9999 ;");
$result[] = update_sql("UPDATE {biblio} SET biblio_year = 9999 WHERE biblio_year = 9998 ;");
$result[] = update_sql("UPDATE {biblio} SET biblio_year = 9998 WHERE biblio_year = 9997 ;");
$result[] = update_sql("UPDATE {biblio_fields} SET hint = '(Submitted, In Press or YYYY)' WHERE name = 'biblio_year';");
return $result;
}
function biblio_update_27() {
$result = array();
$result[] = update_sql("ALTER TABLE {biblio_fields} MODIFY hint varchar(255);");
return $result;
}
function biblio_update_28() {
$result = array();
$custom_title = variable_get('biblio_block_title', '');
if (!empty($custom_title)) {
$db_result = db_query("SELECT title FROM {blocks} b where module='biblio' ");
while ($block = db_fetch_object($db_result)) {
if (empty($block->title)) {
$block->title = $custom_title;
$result[] = update_sql("UPDATE {blocks} SET title='" . $block->title . "' module='biblio' ");
}
}
variable_del('biblio_block_title');
}
return $result;
}