Browse Source

Added metadata edit form to collection view.

pull/105/head
Alexander O'Neill 14 years ago
parent
commit
4e23d8ddc6
  1. 22
      CollectionClass.inc
  2. 38
      ObjectHelper.inc

22
CollectionClass.inc

@ -431,14 +431,14 @@ class CollectionClass {
// This will be the content of the tab. // This will be the content of the tab.
'#content' => $add_to_collection, '#content' => $add_to_collection,
); );
$tabset['my_tabset']['third_tab'] = array( $tabset['my_tabset']['third_tab'] = array(
'#type' => 'tabpage', '#type' => 'tabpage',
'#title' => t('Description'), '#title' => t('Description'),
); );
$tabset['my_tabset']['third_tab']['tabset'] = array( $tabset['my_tabset']['third_tab']['tabset'] = array(
'#type' => 'tabset', '#type' => 'tabset',
); );
$dc_html = $objectHelper->getQDC($this->pid); $dc_html = $objectHelper->getFormattedDC($collection_item);
$ds_list = $objectHelper->getFormattedDatastreamList($this->pid, NULL, $collection_item); $ds_list = $objectHelper->getFormattedDatastreamList($this->pid, NULL, $collection_item);
@ -448,29 +448,15 @@ class CollectionClass {
'#content' => $dc_html . $ds_list, '#content' => $dc_html . $ds_list,
); );
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
/* $obj = new ObjectHelper();
if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) {
$editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DARWIN_CORE'); $editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC');
$tabset['my_tabset']['third_tab']['tabset']['edit'] = array( $tabset['my_tabset']['third_tab']['tabset']['edit'] = array(
'#type' => 'tabpage', '#type' => 'tabpage',
'#title' => t('Edit'), '#title' => t('Edit'),
'#content' => $editform, '#content' => $editform,
); );
$tabset['my_tabset']['third_tab']['tabset']['source'] = array(
'#type' => 'tabpage',
'#title' => t('Vew Source'),
);
$xmlsrc = $dwc->asXML();
$tabset['my_tabset']['third_tab']['tabset']['source']['srctext'] = array(
'#name' => 'source',
'#type' => 'textarea',
'#value' => $xmlsrc,
'#id' => 'source',
'#height' => 50,
);
} }
*/
return tabs_render($tabset); return tabs_render($tabset);
} }

38
ObjectHelper.inc

@ -313,16 +313,8 @@ class ObjectHelper {
return $content; return $content;
} }
/** function getFormattedDC($item) {
* Queries fedora for what we call the qualified dublin core. Currently only dc.coverage has global $base_url;
* any qualified fields
* Transforms the returned xml to html
* This is the default metadata view. With icons for searching a dublin core field
* @param $pid String
* @return String
*/
function getQDC($pid) {
global $base_url;
$path = drupal_get_path('module', 'fedora_repository'); $path = drupal_get_path('module', 'fedora_repository');
module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); module_load_include('inc', 'fedora_repository', 'ConnectionHelper');
@ -331,7 +323,7 @@ class ObjectHelper {
$dsId = 'QDC'; $dsId = 'QDC';
$params = array( $params = array(
'pid' => "$pid", 'pid' => "$item->pid",
'dsID' => "$dsId", 'dsID' => "$dsId",
'asOfDateTime' => "" 'asOfDateTime' => ""
); );
@ -343,7 +335,7 @@ class ObjectHelper {
try { //probably no QDC so we will try for the DC stream. try { //probably no QDC so we will try for the DC stream.
$dsId = 'DC'; $dsId = 'DC';
$params = array( $params = array(
'pid' => "$pid", 'pid' => "$item->pid",
'dsID' => "$dsId", 'dsID' => "$dsId",
'asOfDateTime' => "" 'asOfDateTime' => ""
); );
@ -377,7 +369,25 @@ class ObjectHelper {
$xsl = $proc->importStylesheet($xsl); $xsl = $proc->importStylesheet($xsl);
$newdom = $proc->transformToDoc($input); $newdom = $proc->transformToDoc($input);
$output = $newdom->saveXML(); $output = $newdom->saveXML();
$baseUrl = base_path(); return $output;
}
/**
* Queries fedora for what we call the qualified dublin core. Currently only dc.coverage has
* any qualified fields
* Transforms the returned xml to html
* This is the default metadata view. With icons for searching a dublin core field
* @param $pid String
* @return String
*/
function getQDC($pid) {
global $base_url;
$item = new Fedora_Item($pid);
$ds_list = $item->get_datastreams_list_as_array();
$output = $this->getFormattedDC($item);
$dsid = array_key_exists('QDC', $ds_list) ? 'QDC' : 'DC';
//$baseUrl=substr($baseUrl, 0, (strpos($baseUrl, "/")-1)); //$baseUrl=substr($baseUrl, 0, (strpos($baseUrl, "/")-1));
if (user_access(ObjectHelper :: $EDIT_FEDORA_METADATA)) { if (user_access(ObjectHelper :: $EDIT_FEDORA_METADATA)) {
$allow=TRUE; $allow=TRUE;
@ -386,7 +396,7 @@ class ObjectHelper {
} }
if ($allow) { if ($allow) {
$output .= '<br /><a title = "' . t('Edit Meta Data') . '" href="' . $base_url . '/fedora/repository/' . 'editmetadata/' . $pid . '/' . $output .= '<br /><a title = "' . t('Edit Meta Data') . '" href="' . $base_url . '/fedora/repository/' . 'editmetadata/' . $pid . '/' .
$dsId . '"><img src="' . $base_url . '/' . $path . '/images/edit.gif" alt="' . t('Edit Meta Data') . '" /></a>'; $dsid . '"><img src="' . $base_url . '/' . drupal_get_path('module', 'fedora_repository') . '/images/edit.gif" alt="' . t('Edit Meta Data') . '" /></a>';
} }
} }
return $output; return $output;

Loading…
Cancel
Save