Skip to content

Instantly share code, notes, and snippets.

View peterdietz's full-sized avatar

Peter Dietz peterdietz

View GitHub Profile
@peterdietz
peterdietz / complex-dri:xref.xsl
Created September 15, 2010 22:20
structural.xsl from dspace xmlui - improving dri:xref
<xsl:template match="dri:xref">
<a>
<xsl:if test="@target">
<xsl:attribute name="href"><xsl:value-of select="@target"/></xsl:attribute>
</xsl:if>
<xsl:if test="@rend">
<xsl:attribute name="class"><xsl:value-of select="@rend"/></xsl:attribute>
</xsl:if>
SELECT
*
FROM
public.item2bundle,
public.bundle,
public.bundle2bitstream,
public.resourcepolicy
WHERE
item2bundle.bundle_id = bundle.bundle_id AND
bundle.bundle_id = bundle2bitstream.bundle_id AND
#!/bin/bash
set -e
if test -z "$2" -o -n "$3"; then
echo "usage: $0 REPO BRANCHNAME" >&2
exit 1
fi
repo=$1
@peterdietz
peterdietz / solr-warmup-next-month.sh
Created October 21, 2010 20:24
Maintenance task to run on dspace-solr at the end of the month to switch to prefetch queries.
#!/usr/bin/env perl
use POSIX qw(floor);
my $second;
my $minute;
my $hour;
my $day;
my $month;
my $year;
my $week_day;
public static Collection[] findDirectMapped(Context context, int actionID) throws java.sql.SQLException
{
//eperson_id -> resourcepolicy.eperson_id
TableRowIterator tri = DatabaseManager.query(context,
"SELECT * FROM collection, resourcepolicy, eperson " +
"WHERE resourcepolicy.resource_id = collection.collection_id AND " +
"eperson.eperson_id = resourcepolicy.eperson_id AND "+
"resourcepolicy.resource_type_id = 3 AND "+
"( resourcepolicy.action_id = 3 OR resourcepolicy.action_id = 11 ) AND "+
"eperson.eperson_id = ?", context.getCurrentUser().getID());
@peterdietz
peterdietz / dspace-add-about.diff
Created February 24, 2011 15:32
DSpace adding a java page to /about
diff --git a/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/AboutPage.java b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/AboutPage.java
new file mode 100644
index 0000000..8a23488
--- /dev/null
+++ b/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/AboutPage.java
@@ -0,0 +1,78 @@
+/*
+ * AboutPage.java
+ *
+ * Version: $Revision$
@peterdietz
peterdietz / some-changes.xsl
Created March 11, 2011 21:48
adding rss links to dspace
<!-- Peter: Add RSS Links to Page -->
<!-- bds: xsl:if test prevents box from appearing when there aren't any RSS feeds for a page -->
<xsl:if test="count(/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='feed']) != 0">
<h3 id="ds-feed-option-head" class="ds-option-set-head"><xsl:text>RSS Feeds</xsl:text></h3>
<div id="ds-feed-option" class="ds-option-set">
<!-- bds: see OSU-local.xsl for addRSSLinks -->
<ul><xsl:call-template name="addRSSLinks"/></ul>
</div>
</xsl:if>
@peterdietz
peterdietz / scobe.rb
Created March 17, 2011 16:37
some screwy ruby code
scope = Contact.scoped({})
scope = scope.in_project(@project.id) if @project
scope = scope.visible unless @project
scope = scope.tagged_with(params[:tag]) unless params[:tag].blank?
scope = scope.scoped :conditions => cond.conditions
if pages
@contacts_pages = Paginator.new(self, scope.count, 20, params[:page])
offset = @contacts_pages.current.offset
@peterdietz
peterdietz / SimpleSearchServlet-hitcount.java
Created March 29, 2011 18:13
quick and dirty look at restricting hits based on items user has authorization to actually view
// now instantiate the results and put them in their buckets
for (int i = 0; i < qResults.getHitTypes().size(); i++)
{
Integer myType = qResults.getHitTypes().get(i);
// add the handle to the appropriate lists
switch (myType.intValue())
{
case Constants.ITEM:
Item item = Item.find(context, qResults.getHitIds().get(i));
@peterdietz
peterdietz / upgrading-from-dspace-170-to-171.log
Created March 30, 2011 19:29
Shell output from merging our source code from dspace 1.7.0 to 1.7.1, with git, it was automatically easy.
peter@sul272peter ~/NetBeansProjects/git-dspace-clone/kb-source[kb-source-sandbox]$ git merge connecting-1.7.x
Auto-merging dspace-api/pom.xml
Removing dspace/docs/html/images/icons/home_16.gif
Merge made by recursive.
LICENSE | 2 +-
NOTICE | 2 +-
README | 10 +-
dspace-api/pom.xml | 8 +-
.../test/resources/dspaceFolder/config/dspace.cfg | 6 +-
dspace-discovery/dspace-discovery-provider/pom.xml | 246 ++--