Skip to content

Instantly share code, notes, and snippets.

Avatar

Terry Brady terrywbrady

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am terrywbrady on github.
  • I am terrywbrady (https://keybase.io/terrywbrady) on keybase.
  • I have a public key ASCUdDs5dO-EZlFetC02Ta16Lof1jUlIUCnlXna4RDrmlwo

To claim this, I am signing this object:

@terrywbrady
terrywbrady / sharestream.xsl
Created Jan 28, 2019
Sharestream Embed Logic
View sharestream.xsl
<xsl:template name="summaryHeaderSharestream">
<xsl:variable name="isAudio" select="dim:field[@element='type'][text()='Audio']"/>
<xsl:for-each select="dim:field[@element='relation' and @qualifier='uri']">
<div class="row">
<div class="col-sm-12">
<xsl:variable name="media">
<xsl:choose>
<xsl:when test="contains(.,'/sharestream2gui')">
<xsl:text>https://mediapilot.georgetown.edu:443/ssdcms/embedplayer.do?aid=</xsl:text>
<xsl:value-of select="substring-before(substring-after(.,'mediaPath='),'&amp;')"/>
@terrywbrady
terrywbrady / vendor.xsl
Last active Apr 24, 2018
Alma to GMS Vendor Stylesheet
View vendor.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:vend="http://com/exlibris/repository/acq/invoice/xmlbeans" version="1.0">
<xsl:output method="text"/>
<xsl:template match="/vend:payment_data">
<xsl:apply-templates select="vend:invoice_list/vend:invoice"/>
</xsl:template>
<!-- Question: Special handling of Credit Card Stuff -->
@terrywbrady
terrywbrady / Mirage2Theme.xsl
Last active Mar 25, 2019
DSpace / IIIF Integration for DigitalGeorgetown
View Mirage2Theme.xsl
<!--
The following XSL lives in a top-level theme xsl file.
This block of code controls all of loose integrations that we have embedded in our custom themes.
Since our work with IIIF is still evolving, we offer a number of mechanisms for linking a IIIF manifest into DSpace
- Add the manifest file as a specially named item bitstream ("IIIF Manifest")
- Link a manifest to an item in dc.relation.uri
- Link a manifest file to a collection page with special markup in dc.description.tableofcontents
We expect to eventually standardize the integration on a smaller set of options.
@terrywbrady
terrywbrady / sample.xsl
Created Dec 12, 2017
DSpace XMLUI XSLT to convert URL's to links and Markdown to Html
View sample.xsl
<xsl:template name="summaryHeaderMarkdown">
<xsl:apply-templates select="dim:field[@element='description' and not(@qualifier)][starts-with(.,'[MD]')]" mode="markdown"/>
</xsl:template>
<xsl:template match="dim:field[@element='description' and not(@qualifier)][starts-with(.,'[MD]')]" mode="markdown">
<xsl:call-template name="markdown-text">
<xsl:with-param name="val" select="substring-after(text(),'[MD]')"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dim:field" mode="markdown"/>
@terrywbrady
terrywbrady / LightweightNavigableObjectRest.java
Last active Mar 17, 2017
Community/collection hierarchy navigation object
View LightweightNavigableObjectRest.java
DSpaceObjectRest extends BaseObjectRest {
private String uuid;
private String name;
private String type}
}
BrowsableObjectRest extends DSpaceObjectRest {
private String handle;
//link to breadcrumb trail
@terrywbrady
terrywbrady / NavigableObjectRest.java
Last active Mar 20, 2017
Community/Collection Hierarchy in DSpace 7 REST
View NavigableObjectRest.java
/*
* Only items, collections, communities, and sites have handles, so handle should move out to a separate object.
* Every navigable item has a breadcrumb trail.
*/
NavigableObjectRest extends DSpaceObjectRest {
private String handle;
//Is this embedded - too slow
//Is this retrieved through a separate endpoint - cumbersome
//Is this embedded but populated only on request - how do we represent that in our framework
@terrywbrady
terrywbrady / theme.css
Created Dec 12, 2016
XMLUI: Avoiding Broken Image Icon Display for Restricted Thumbnails
View theme.css
/*
Code to prevent broken image icon display
http://stackoverflow.com/questions/22051573/how-to-hide-image-broken-icon-using-only-css-html-without-js/37192970#answer-37192970
*/
a.image-link img,div.artifact-preview img {
font-family: 'Helvetica';
font-weight: 300;
line-height: 2;
text-align: center;
height: auto;
@terrywbrady
terrywbrady / XmluiThumbnailPermission.xsl
Created Dec 12, 2016
Evaluating the access rights for a Thumbnail in DSpace XMLUI
View XmluiThumbnailPermission.xsl
<xsl:template name="gu-thumbnail-link">
<xsl:param name="thumb" select="."/>
<xsl:param name="src"/>
<xsl:variable name="thumbmets" select="$EXTMETS//mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/mets:file[@GROUPID=$thumb/@GROUPID]"/>
<xsl:variable name="authid" select="$thumbmets/@ADMID"/>
<xsl:variable name="thumbauth" select="$EXTMETS//mets:rightsMD[@ID=$authid]"/>
<xsl:variable name="angrec" select="$thumbauth//metsrights:Context[@in-effect='true'][@CONTEXTCLASS='MANAGED GRP'][metsrights:UserName[text()=$GUCOMM]]"/>
<xsl:variable name="pubrec" select="$thumbauth//metsrights:Context[@in-effect='true'][@CONTEXTCLASS='GENERAL PUBLIC']"/>
<xsl:choose>
View isbnLookup.js
function isbnLookup(id) {
var url = "https://www.googleapis.com/books/v1/volumes?country=US&q=isbn:"+id;
var options = {contentType : "application/json"};
var resp = UrlFetchApp.fetch(url, options);
if (resp == null || resp == "") return "N/A";
var respdata = JSON.parse(resp.getContentText());
if (respdata["items"].length == 0) return "Not found";
return respdata["items"][0]["volumeInfo"]["title"];
}