helix84,
Thanks for the fast and info-filled responses. You have really helped me out!
On Thu, Nov 15, 2012 at 5:09 PM, helix84 <[email protected]> wrote:
> Ouch, this hurts my eyes. What's with the variablttln names? I'd also
> shorten at least "$context/mets:fileSec/mets:fileGrp" into another
> variable to make it more readable.
You got me there, my code was not very readable. I took your suggestions.
> So is there anything you'd like to improve in this part?
I added in another test to ensure that lightbox code isn't produced in
the absence of a branded preview bitstream. I've attached an updated
template in case anyone is interested.
> I'm not quite following. What are you trying to achieve?
> 1) Didn't your numbering rules and my matching code work?
> 2) I thought you made it work using the title attribute instead, so
> what do you want to do here?
1) Yep, it's working like a champ for this case.
2) I was hoping to make a more general-purpose solution for derivative
bitstreams. If I create a new media filter, I'd like to be able to
mark it as a derivative and group it with the original. That way my
templates could access any derived bitstream in the same way as
thumbnails. It would make adding filters and adding their bitstreams
to the ui much more intuitive. Maybe this is a development issue?
> I'd avoid modifying Java classes unless you really need to because
> you'll have to remember to forward-port your changes on each upgrade.
> The more such changes you make, the more reluctant you'll be to
> upgrade, trust me.
Sage advice, I'll take it. I've been tracking which files I've been
messing with. I think I'll revert them and move my experiments to
another server. It may make more sense to try to contribute to dspace
instead of managing local patches. That's a cart before the horse,
though.
> Did you run "mvn package" (or "mvn clean package") in [dspace-source]
> or in [dspace-source]/dspace? The latter would rebuild only changes in
> overlays and somesuch and wouldn't care about your changes in
> dspace-xmlui. See quick build vs. full build here:
>
> https://wiki.duraspace.org/display/DSPACE/Rebuild+DSpace
Ah, maybe this was part of my issue. I made separate quick build and
clean build bash scripts based off the info in the wiki. Even for the
clean build, it says to start from [dspace-source]/dspace/. I updated
my clean build script to run "mvn clean package" from [dspace-source]
instead.
> No need to run "mvn clean package", but it may save you from some
> nasty surprises, so I'd run it only if something doesn't work as
> expected after "mvn package" (it's just quicker).
Noted.
> I don't think the jars you built contained your changes (see above),
> but there would be another gotcha - if you went around ant and did the
> copying manually, you would need to copy them in 2 places - both
> [dspace]/lib and [dspace]/webapps/xmlui/WEB-INF/lib/
Also noted.
> It will be easier to link to particular line numbers here if you want
> to point out something specific:
Good point. On line 695 of the item adapter class
[https://github.com/DSpace/DSpace/blob/dspace-1_8_x/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/objectmanager/ItemAdapter.java#L695]
I made the following change
- if ("TEXT".equals(bundle.getName()) || "THUMBNAIL".equals(bundle.getName()))
+ if ("TEXT".equals(bundle.getName()) ||
"THUMBNAIL".equals(bundle.getName()) ||
"BRANDED_PREVIEW".equals(bundle.getName()))
I thought that would cause isDerivedBundle to be set to true for
branded preview bitstreams and thus get assigned the original
bitstream's group id. It doesn't seem to alter the behavior though.
I thought that I had a problem with my build process, but I made your
suggested directory change and I still get the same result. Branded
previews are still getting unique group ids. Ideally there would be a
place to register additional bundles as derived, but again, this may
be creeping into a discussion more appropriate for development.
Thanks again. I was fairly stuck, and your responses helped get me unstuck.
--
Jason Sherman
Systems Librarian
University of Science and Arts of Oklahoma
405.574.1340
<!-- this is from ../dri2xhtml/General-Handler.xsl -->
<!-- Build a single row in the bitsreams table of the item view page -->
<xsl:template match="mets:file">
<xsl:param name="context" select="."/>
<tr>
<xsl:attribute name="class">
<xsl:text>ds-table-row </xsl:text>
<xsl:if test="(position() mod 2 = 0)">even </xsl:if>
<xsl:if test="(position() mod 2 = 1)">odd </xsl:if>
</xsl:attribute>
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:title"/>
</xsl:attribute>
<xsl:choose>
<xsl:when
test="string-length(mets:FLocat[@LOCTYPE='URL']/@xlink:title) > 50">
<xsl:variable name="title_length"
select="string-length(mets:FLocat[@LOCTYPE='URL']/@xlink:title)"/>
<xsl:value-of
select="substring(mets:FLocat[@LOCTYPE='URL']/@xlink:title,1,15)"/>
<xsl:text> ... </xsl:text>
<xsl:value-of
select="substring(mets:FLocat[@LOCTYPE='URL']/@xlink:title,$title_length -
25,$title_length)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:title"/>
</xsl:otherwise>
</xsl:choose>
</a>
</td>
<!-- File size always comes in bytes and thus needs conversion -->
<td>
<xsl:choose>
<xsl:when test="@SIZE < 1024">
<xsl:value-of select="@SIZE"/>
<i18n:text>xmlui.dri2xhtml.METS-1.0.size-bytes</i18n:text>
</xsl:when>
<xsl:when test="@SIZE < 1024 * 1024">
<xsl:value-of select="substring(string(@SIZE div
1024),1,5)"/>
<i18n:text>xmlui.dri2xhtml.METS-1.0.size-kilobytes</i18n:text>
</xsl:when>
<xsl:when test="@SIZE < 1024 * 1024 * 1024">
<xsl:value-of select="substring(string(@SIZE div (1024
* 1024)),1,5)"/>
<i18n:text>xmlui.dri2xhtml.METS-1.0.size-megabytes</i18n:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring(string(@SIZE div (1024
* 1024 * 1024)),1,5)"/>
<i18n:text>xmlui.dri2xhtml.METS-1.0.size-gigabytes</i18n:text>
</xsl:otherwise>
</xsl:choose>
</td>
<!-- Lookup File Type description in local messages.xml based on
MIME Type.
In the original DSpace, this would get resolved to an
application via
the Bitstream Registry, but we are constrained by the
capabilities of METS
and can't really pass that info through. -->
<td>
<xsl:call-template name="getFileTypeDesc">
<xsl:with-param name="mimetype">
<xsl:value-of select="substring-before(@MIMETYPE,'/')"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="substring-after(@MIMETYPE,'/')"/>
</xsl:with-param>
</xsl:call-template>
</td>
<td>
<xsl:choose>
<!-- If there is a branded jpeg preview for a bitstream
with a thumbnail,
generate a thumbnail that links into a lightbox gallery
for that handle. -->
<xsl:when
test="$context/mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/
mets:file[@GROUPID=current()/@GROUPID]">
<xsl:variable name="fileGrp"
select="$context/mets:fileSec/mets:fileGrp" />
<xsl:variable name="original_title_len"
select="string-length($fileGrp[@USE='THUMBNAIL']/
mets:file[@GROUPID=current()/@GROUPID]/mets:FLocat[@LOCTYPE='URL']/@xlink:title)-4"
/>
<xsl:variable name="original_title"
select="substring($fileGrp[@USE='THUMBNAIL']/
mets:file[@GROUPID=current()/@GROUPID]/mets:FLocat[@LOCTYPE='URL']/@xlink:title,1,$original_title_len)"
/>
<xsl:variable name="branded_preview_title"
select="concat($original_title,'.preview.jpg')"/>
<xsl:choose>
<xsl:when test="$fileGrp[@USE='BRANDED_PREVIEW']/
mets:file/mets:FLocat[@LOCTYPE='URL'][@xlink:title=$branded_preview_title]">
<a class="image-link">
<xsl:attribute name="rel">
<xsl:text>lightbox[BrandedPreview]</xsl:text>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of
select="$fileGrp[@USE='BRANDED_PREVIEW']/
mets:file/mets:FLocat[@LOCTYPE='URL'][@xlink:title=$branded_preview_title]/@xlink:href"/>
</xsl:attribute>
<img alt="Thumbnail">
<xsl:attribute name="src">
<xsl:value-of
select="$fileGrp[@USE='THUMBNAIL']/
mets:file[@GROUPID=current()/@GROUPID]/mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:attribute>
</img>
</a>
</xsl:when>
<xsl:when
test="$fileGrp[@USE='THUMBNAIL']/mets:file[@GROUPID=current()/@GROUPID]">
<a class="image-link">
<xsl:attribute name="href">
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:attribute>
<img alt="Thumbnail">
<xsl:attribute name="src">
<xsl:value-of
select="$fileGrp[@USE='THUMBNAIL']/
mets:file[@GROUPID=current()/@GROUPID]/mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:attribute>
</img>
</a>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<a>
<xsl:attribute name="href">
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
</xsl:attribute>
<i18n:text>xmlui.dri2xhtml.METS-1.0.item-files-viewOpen</i18n:text>
</a>
</xsl:otherwise>
</xsl:choose>
</td>
<!-- Display the contents of 'Description' as long as at least one
bitstream contains a description -->
<xsl:if
test="$context/mets:fileSec/mets:fileGrp[@USE='CONTENT']/mets:file/mets:FLocat/@xlink:label
!= ''">
<td>
<xsl:value-of
select="mets:FLocat[@LOCTYPE='URL']/@xlink:label"/>
</td>
</xsl:if>
</tr>
</xsl:template>
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech