[Koha-patches] [PATCH] DB and syspref update for Tags and BakerTaylor
Joe Atzberger
joe.atzberger at liblime.com
Tue Apr 8 16:02:08 CEST 2008
Feel free to apply this before the other related Tags/B&T patches.
---
admin/systempreferences.pl | 23 ++++++
installer/data/mysql/updatedatabase.pl | 72 ++++++++++++++++++--
.../prog/en/includes/sysprefs-menu.inc | 2 +
kohaversion.pl | 2 +-
4 files changed, 93 insertions(+), 6 deletions(-)
diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index 37a30cf..7c36156 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 b82d9f1..b7da6ac 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -1230,6 +1230,73 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = "3.00.00.068";
+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.<br /> 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 <br />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
@@ -1258,11 +1325,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 8464d79..ed4f760 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 @@
<!-- TMPL_IF NAME="Acquisitions" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Acquisitions" href="/cgi-bin/koha/admin/systempreferences.pl?tab=Acquisitions">Acquisitions</a></li>
<!-- TMPL_IF NAME="Amazon" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Amazon.com module" href="/cgi-bin/koha/admin/systempreferences.pl?tab=Amazon">Amazon.com</a></li>
<!-- TMPL_IF NAME="Authorities" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Authority Control" href="/cgi-bin/koha/admin/systempreferences.pl?tab=Authorities">Authorities</a></li>
+<!-- TMPL_IF NAME="BakerTaylor" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Baker and Taylor" href="/cgi-bin/koha/admin/systempreferences.pl?tab=BakerTaylor">Baker & Taylor</a></li>
<!-- TMPL_IF NAME="Cataloguing" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Cataloging" href="/cgi-bin/koha/admin/systempreferences.pl?tab=Cataloguing">Cataloguing</a></li>
<!-- TMPL_IF NAME="Circulation" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Circulation" href="/cgi-bin/koha/admin/systempreferences.pl?tab=Circulation">Circulation</a></li>
<!-- TMPL_IF NAME="FRBR" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Functional Requiremnets for Bibliographic Records" href="/cgi-bin/koha/admin/systempreferences.pl?tab=FRBR">FRBR</a></li>
@@ -14,6 +15,7 @@
<!-- TMPL_IF NAME="Patrons" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Patrons" href="/cgi-bin/koha/admin/systempreferences.pl?tab=Patrons">Patrons</a></li>
<!-- TMPL_IF NAME="Searching" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Searching" href="/cgi-bin/koha/admin/systempreferences.pl?tab=Searching">Searching</a></li>
<!-- TMPL_IF NAME="StaffClient" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Staff Client" href="/cgi-bin/koha/admin/systempreferences.pl?tab=StaffClient">Staff Client</a></li>
+<!-- TMPL_IF NAME="Tags" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Tags" href="/cgi-bin/koha/admin/systempreferences.pl?tab=Tags">Tags</a></li>
<!-- TMPL_IF NAME="" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/admin/systempreferences.pl">Local Use</a></li>
</ul>
</div>
diff --git a/kohaversion.pl b/kohaversion.pl
index b41e3ad..6a67751 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
use strict;
sub kohaversion {
- our $VERSION = "3.00.00.067";
+ our $VERSION = "3.00.00.068";
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
--
1.5.2.1
More information about the Koha-patches
mailing list