问题
I need to modify it to the home's div's order, the default current DRI is
<div id="aspect.artifactbrowser.CommunityBrowser.div.comunity-browser" rend="primary" n="comunity-browser">...</div>
<div id="aspect.discovery.SiteRecentSubmissions.div.site-home" rend="primary repository" n="site-home">...</div>
And I need to be
<div id="aspect.discovery.SiteRecentSubmissions.div.site-home" rend="primary repository" n="site-home">
<div id="aspect.artifactbrowser.CommunityBrowser.div.comunity-browser" rend="primary" n="comunity-browser">...</div>
The idea is to show recent submissions first than community abbreviated links. I could modify it via CSS but also affects the Comunity Browse option.
Germán
回答1:
You should be able to just reorder those div
s using their id
values (as those id
values will be different on the Homepage and on individual Communities).
There is a "Use CSS to reorder DIVs" question which gives some good options on how to reorder HTML div
s based on their id
values. Personally, I'd recommend the JQuery solution, as DSpace already embeds and uses JQuery.
So, in the end, something like this should work:
$('#aspect.discovery.SiteRecentSubmissions.div.site-home').insertBefore('#aspect.artifactbrowser.CommunityBrowser.div.comunity-browser');
I'm not sure exactly which version of DSpace (or which theme) you are using. But, assuming you are using DSpace 4.2 (latest version as of now) and the default theme (Mirage), you can place this custom Javascript into the page-structure.xsl
file of the theme, specifically in the <xsl:template name="buildHead">
(which builds the HTML head
tag for every page). Here's a direct link to that area of the code for the DSpace 4.2 Mirage Theme:
https://github.com/DSpace/DSpace/blob/dspace-4.2/dspace-xmlui/src/main/webapp/themes/Mirage/lib/xsl/core/page-structure.xsl#L220
回答2:
If you are running XMLUI, you could override the template for ds:body. See the xsl:otherwise block below.
<xsl:template match="dri:body">
<div id="ds-body">
<xsl:if test="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='alert'][@qualifier='message']">
<div id="ds-system-wide-alert">
<p>
<xsl:copy-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='alert'][@qualifier='message']/node()"/>
</p>
</div>
</xsl:if>
<!-- Check for the custom pages -->
<xsl:choose>
<xsl:when test="starts-with($request-uri, 'page/about')">
<div>
<h1>About This Repository</h1>
<p>To add your own content to this page, edit webapps/xmlui/themes/dri2xhtml/structural.xsl and
add your own content to the title, trail, and body. If you wish to add additional pages, you
will need to create an additional xsl:when block and match the request-uri to whatever page
you are adding. Currently, static pages created through altering XSL are only available
under the URI prefix of page/.</p>
</div>
</xsl:when>
<!-- Otherwise use default handling of body -->
<xsl:otherwise>
<xsl:apply-templates select="*[@n='item-related-container']"/>
<xsl:apply-templates select="*[not(@n='item-related-container')]"/>
</xsl:otherwise>
</xsl:choose>
<xsl:copy-of select="$SFXLink"/>
</div>
</xsl:template>
来源:https://stackoverflow.com/questions/25413032/how-to-reorder-dri-divs-in-dspace-xmlui