From 83b7624e133ea87d4455bd888595e12097d9f274 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Mon, 21 Apr 2008 16:22:35 -0500 Subject: [PATCH] DB and syspref update for Tags and BakerTaylor Feel free to apply this before the other related Tags/B&T patches. Signed-off-by: Joshua Ferraro --- admin/systempreferences.pl | 23 ++++++ installer/data/mysql/updatedatabase.pl | 71 +++++++++++++++++-- .../prog/en/includes/sysprefs-menu.inc | 2 + kohaversion.pl | 2 +- 4 files changed, 92 insertions(+), 6 deletions(-) diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index c3fc633d50..f7523fb009 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -56,6 +56,14 @@ use C4::Context; # FIXME, shouldnt we store this stuff in the systempreferences table? +# FIXME: This uses hash in a backwards way. What we really want is: +# $tabsysprefs{key} = $array_ref; +# like +# $tabsysprefs{Cataloguing} = [qw(autoBarcode ISBD marc ...)]; +# +# Because some things *should* be on more than one tab. +# And the tabname is the unique part (the key). + my %tabsysprefs; # Acquisitions $tabsysprefs{acquisitions}="Acquisitions"; @@ -274,6 +282,21 @@ my %tabsysprefs; $tabsysprefs{'OAI-PMH:Set'} = "OAI-PMH"; $tabsysprefs{'OAI-PMH:Subset'} = "OAI-PMH"; +# Tags + $tabsysprefs{TagsEnabled} = 'Tags'; + $tabsysprefs{TagsExternalDictionary} = 'Tags'; + $tabsysprefs{TagsInputOnDetail} = 'Tags'; + $tabsysprefs{TagsInputOnList} = 'Tags'; + $tabsysprefs{TagsShowOnDetail} = 'Tags'; + $tabsysprefs{TagsShowOnList} = 'Tags'; + $tabsysprefs{TagsModeration} = 'Tags'; + +# Baker & Taylor + $tabsysprefs{BakerTaylorBookstoreURL} = 'BakerTaylor'; + $tabsysprefs{BakerTaylorEnabled} = 'BakerTaylor'; + $tabsysprefs{BakerTaylorPassword} = 'BakerTaylor'; + $tabsysprefs{BakerTaylorUsername} = 'BakerTaylor'; + sub StringSearch { my ($searchstring,$type)=@_; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a8a6623f44..ee58ae0e3a 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -1312,6 +1312,72 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.00.00.073"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("DROP TABLE IF EXISTS `tags_all`;"); + $dbh->do(q# + CREATE TABLE `tags_all` ( + `tag_id` int(11) NOT NULL auto_increment, + `borrowernumber` int(11) NOT NULL, + `biblionumber` int(11) NOT NULL, + `term` varchar(255) NOT NULL, + `language` int(4) default NULL, + `date_created` datetime NOT NULL, + PRIMARY KEY (`tag_id`), + KEY `tags_borrowers_fk_1` (`borrowernumber`), + KEY `tags_biblionumber_fk_1` (`biblionumber`), + CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`) + REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) + REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + #); + $dbh->do("DROP TABLE IF EXISTS `tags_approval`;"); + $dbh->do(q# + CREATE TABLE `tags_approval` ( + `term` varchar(255) NOT NULL, + `approved` int(1) NOT NULL default '0', + `date_approved` datetime default NULL, + `approved_by` int(11) default NULL, + `weight_total` int(9) NOT NULL default '1', + PRIMARY KEY (`term`), + KEY `tags_approval_borrowers_fk_1` (`approved_by`), + CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) + REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + #); + $dbh->do("DROP TABLE IF EXISTS `tags_index`;"); + $dbh->do(q# + CREATE TABLE `tags_index` ( + `term` varchar(255) NOT NULL, + `biblionumber` int(11) NOT NULL, + `weight` int(9) NOT NULL default '1', + PRIMARY KEY (`term`,`biblionumber`), + KEY `tags_index_biblionumber_fk_1` (`biblionumber`), + CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`) + REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) + REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + #); + $dbh->do(q# + INSERT INTO `systempreferences` VALUES + ('BakerTaylorBookstoreURL','','','URL template for \"My Libary Bookstore\" links, to which the \"key\" value is appended, and \"https://\" is prepended. It should include your hostname and \"Parent Number\". Make this variable empty to turn MLB links off.
Example: ocls.mylibrarybookstore.com/MLB/actions/searchHandler.do?nextPage=bookDetails&parentNum=10923&key=',''), + ('BakerTaylorEnabled','0','','Enable or disable all Baker & Taylor features.','YesNo'), + ('BakerTaylorPassword','','','Baker & Taylor Password for Content Cafe (external content)','Textarea'), + ('BakerTaylorUsername','','','Baker & Taylor Username for Content Cafe (external content)','Textarea'), + ('TagsEnabled','1','','Enables or disables all tagging features. This is the main switch for tags.','YesNo'), + ('TagsExternalDictionary','/usr/bin/ispell','','Path on server to local ispell executable, used to set $Lingua::Ispell::path
This dictionary is used as a \"whitelist\" of pre-allowed tags.',''), + ('TagsInputOnDetail','1','','Allow users to input tags from the detail page.', 'YesNo'), + ('TagsInputOnList', '0','','Allow users to input tags from the search results list.', 'YesNo'), + ('TagsModeration', NULL,'','(unimplemented) Requires tags from patrons to be approved before becoming visible.','YesNo'), + ('TagsShowOnDetail','10','','Number of tags to display on detail page. 0 is off.', 'Integer'), + ('TagsShowOnList', '6','','Number of tags to display on search results list. 0 is off.','Integer') + #); + print "Upgrade to $DBversion done (Baker/Taylor,Tags: sysprefs and tables (tags_all, tags_index, tags_approval)) "; + SetVersion ($DBversion); +} + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table @@ -1340,11 +1406,6 @@ sub DropAllForeignKeys { } - - - - - =item TransformToNum Transform the Koha version from a 4 parts string diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/sysprefs-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/sysprefs-menu.inc index 73280bebef..6b83ce5275 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/sysprefs-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/sysprefs-menu.inc @@ -4,6 +4,7 @@
  • Acquisitions
  • Amazon.com
  • Authorities
  • +
  • Baker & Taylor
  • Cataloguing
  • Circulation
  • FRBR
  • @@ -14,6 +15,7 @@
  • Patrons
  • Searching
  • Staff Client
  • +
  • Tags
  • Local Use
  • diff --git a/kohaversion.pl b/kohaversion.pl index 5d949cf9eb..3e1346a63a 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = "3.00.00.072"; + our $VERSION = "3.00.00.073"; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install -- 2.39.5