Browse Source

Merge pull request #65 from ajstanley/6.x

6.x
pull/67/head
Ben Woodhead 13 years ago
parent
commit
8b8c6247d9
  1. 25
      fedora_repository.module
  2. 5
      plugins/FedoraObjectDetailedContent.inc
  3. 55
      xsl/sparql_to_html.xsl

25
fedora_repository.module

@ -455,9 +455,9 @@ function add_stream_form_validate($form, &$form_state) {
return FALSE;
}
$validators = array(
// 'file_validate_is_image' => array(),
// 'file_validate_image_resolution' => array('85x85'),
// 'file_validate_size' => array(30 * 1024),
// 'file_validate_is_image' => array(),
// 'file_validate_image_resolution' => array('85x85'),
// 'file_validate_size' => array(30 * 1024),
);
$fileObject = file_save_upload('add-stream-file-location', $validators);
@ -496,6 +496,23 @@ function fedora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL)
return $output;
}
function fedora_repository_purge_object_form_validate($form, &$form_state) {
module_load_include('inc', 'fedora_repository', 'api/fedora_collection');
$pid = $form_state['values']['pid'];
$objectHelper = new ObjectHelper();
$contentModels = $objectHelper->get_content_models_list($pid);
foreach ($contentModels as $contentModel) {
if ($contentModel->pid == 'islandora:collectionCModel') {
$member_pids = get_related_items_as_array($pid, 'isMemberOfCollection');
if (is_array($member_pids)){
form_set_error('new_collection_pid', t("Please purge all members of this collection before deleting the collection itself."));
return;
}
}
}
}
/**
* fedora repository purge object form submit
* @param type $form
@ -667,7 +684,7 @@ function fedora_repository_replace_stream_form_submit($form, &$form_state) {
$pid = $form_state['values']['pid'];
$dsid = $form_state['values']['dsId'];
$dsLabel = $form_state['values']['dsLabel'];
// Remove the original file extension from the label and add the new one
// Remove the original file extension from the label and add the new one
$indexOfDot = strrpos($dsLabel, '.'); //use strrpos to get the last dot
if ($indexOfDot !== FALSE) {
$dsLabel = substr($dsLabel, 0, $indexOfDot);

5
plugins/FedoraObjectDetailedContent.inc

@ -1,7 +1,5 @@
<?php
/**
* @file
* FedoraObjectDetailedContent class
@ -34,12 +32,13 @@ class FedoraObjectDetailedContent {
*/
public function showFieldSets() {
global $user;
drupal_set_title($this->item->objectProfile->objLabel);
$objectHelper = new ObjectHelper();
$tabset = array();
$show_purge_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_purge_object_form');
$show_edit_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_edit_qdc_form');
$purge_form = drupal_get_form('fedora_repository_purge_object_form', $this->pid, check_plain(substr(request_uri(), strlen(base_path()))));
$details_selected = ($show_purge_tab ||$show_edit_tab);
$details_selected = ($show_purge_tab || $show_edit_tab);
$tabset['fedora_object_details'] = array(
'#type' => 'tabpage',
'#title' => t('Object Details'),

55
xsl/sparql_to_html.xsl

@ -72,23 +72,23 @@
</td></tr>
<!--<xsl:for-each select="/sparql/results/result[position()>=$start and position() &lt;=$end]">
<xsl:variable name='OBJECTURI' select="object/@uri"/>
<xsl:variable name='PID' select="substring-after($OBJECTURI,'/')"/>
<tr>
<td>
<img>
<xsl:attribute name="src"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$PID"/>/TN
</xsl:attribute>
</img>
<a>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="title"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
</td>
</tr>
</xsl:for-each>-
-->
<xsl:variable name='OBJECTURI' select="object/@uri"/>
<xsl:variable name='PID' select="substring-after($OBJECTURI,'/')"/>
<tr>
<td>
<img>
<xsl:attribute name="src"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$PID"/>/TN
</xsl:attribute>
</img>
<a>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="title"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
</td>
</tr>
</xsl:for-each>-
-->
<xsl:apply-templates select="s:sparql/s:results"/>
</table><br clear="all" />
<!-- start previous next -->
@ -172,7 +172,7 @@
</xsl:when>
<xsl:otherwise>
<!--the below is an example of going straight to a datastream instead of the details page.
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/OBJ/<xsl:value-of select="s:title"/>-->
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/OBJ/<xsl:value-of select="s:title"/>-->
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="$cleanTitle"/>
</xsl:otherwise>
</xsl:choose>
@ -185,7 +185,7 @@
<img>
<xsl:attribute name="src"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$PID"/>/TN
</xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="$newTitle" disable-output-escaping="yes"/>
<xsl:attribute name="alt"><xsl:value-of select="$newTitle" disable-output-escaping="yes"/>
</xsl:attribute>
</img> </a> <br clear="all" />
<a>
@ -194,14 +194,14 @@
<xsl:value-of select="$newTitle" disable-output-escaping="yes" />
</a>
<!-- example of a url that would drill down to the details page if the url above went directly to a datastream
<xsl:if test="($CONTENTMODEL!='islandora:collectionCModel')">
<br />[[ <a>
<xsl:attribute name="href">
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="$cleanTitle"/>
</xsl:attribute>
DETAILS
</a> ]]
</xsl:if>-->
<xsl:if test="($CONTENTMODEL!='islandora:collectionCModel')">
<br />[[ <a>
<xsl:attribute name="href">
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="$cleanTitle"/>
</xsl:attribute>
DETAILS
</a> ]]
</xsl:if>-->
</td>
<xsl:if test="(position() = last()) and (position() &lt; $cellsPerRow)">
@ -245,3 +245,4 @@
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

Loading…
Cancel
Save