Browse Source

Get rid of more explicit markup output, in favour of Drupal methods.

pull/99/head
Adam Vessey 13 years ago
parent
commit
eaff54436b
  1. 8
      ObjectHelper.inc
  2. 5
      formClass.inc
  3. 5
      plugins/ShowDemoStreamsInFieldSets.inc
  4. 40
      plugins/ShowStreamsInFieldSets.inc
  5. 4
      plugins/herbarium.inc
  6. 59
      plugins/qt_viewer.inc
  7. 6
      plugins/slide_viewer.inc
  8. 30
      plugins/tagging_form.inc

8
ObjectHelper.inc

@ -702,9 +702,11 @@ class ObjectHelper {
}
if ($allow) {
// $ingestObject = '<a title="'. t('Ingest a New object into ') . $collectionName . ' '. $collection_pid . '" href="'. base_path() .
$ingestObject = '<a title="' . t('Ingest a New object into !collection_name PID !collection_pid', array('!collection_name' => $collectionName, '!collection_pid' => $collection_pid)) . '" href="' . base_path() .
'fedora/ingestObject/' . $collection_pid . '/' . $collectionName . '"><img src="' . $base_url . '/' . $path .
'/images/ingest.png" alt="' . t('Add a New Object') . '" class="icon"></a> ' . t('Add to this Collection');
$ingest_text = t('Ingest a new object into @collection_name PID @collection_pid', array('@collection_name' => $collectionName, '@collection_pid' => $collection_pid));
$ingestObject = l(theme('image', "$path/images/ingest.png", $ingest_text), "fedora/ingestObject/$collection_pid/$collectionName", array('attributes' => array(
'class' => 'icon',
'title' => $ingest_text,
))) . t('Add to this Collection');
}
}
}

5
formClass.inc

@ -230,7 +230,10 @@ class formClass {
'#description' => t('The URL to use for SOAP connections'),
'#required' => TRUE,
'#weight' => -12,
'#suffix' => '<p>' . (fedora_available() ? '<img src="' . url('misc/watchdog-ok.png') . '"/>' . t('Successfully connected to Fedora server at !fedora_soap_url', array('!fedora_soap_url' => variable_get('fedora_soap_url', ''))) : '<img src="' . url('misc/watchdog-error.png') . '"/> ' . t('Unable to connect to Fedora server at !fedora_soap_url</p>', array('!fedora_soap_url' => variable_get('fedora_soap_url', '')))),
'#suffix' => '<p>' . (
fedora_available() ?
theme('image', 'misc/watchdog-ok.png') . t('Successfully connected to Fedora server at @fedora_soap_url', array('@fedora_soap_url' => variable_get('fedora_soap_url', ''))) :
theme('image', 'misc/watchdog-error.png') . t('Unable to connect to Fedora server at @fedora_soap_url', array('@fedora_soap_url' => variable_get('fedora_soap_url', '')))) . '</p>',
);
$form['fedora_soap_manage_url'] = array(

5
plugins/ShowDemoStreamsInFieldSets.inc

@ -29,11 +29,10 @@ class ShowDemoStreamsInFieldSets {
* @return type
*/
function showMediumSize() {
global $base_url;
$path = "fedora/repository/{$this->pid}/MEDIUM_SIZE";
$collection_fieldset = array(
'#collapsible' => FALSE,
'#value' => '<a href="' . $base_url . '/fedora/repository/' . $this->pid . '/MEDIUM_SIZE/"><img src="' .
$base_url . '/fedora/repository/' . $this->pid . '/MEDIUM_SIZE/MEDIUM_SIZE' . '" /></a>',
'#value' => l(theme('image', $path), $path, array('html' => TRUE)),
);
return theme('fieldset', $collection_fieldset);
}

40
plugins/ShowStreamsInFieldSets.inc

@ -29,15 +29,21 @@ class ShowStreamsInFieldSets {
function showFlv() {
//FLV is the datastream id
$path = drupal_get_path('module', 'Fedora_Repository');
$fullPath = base_path() . $path;
$fullPath = url($path);
$content = "";
$pathTojs = drupal_get_path('module', 'Fedora_Repository') . '/js/swfobject.js';
drupal_add_js("$pathTojs");
$content .= '<div id="player' . $this->pid . 'FLV"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>';
drupal_add_js('var s1 = new SWFObject("' . $fullPath . '/flash/flvplayer.swf","single","320","240","7");
$div_id = "player' . $this->pid . 'FLV";
$content .= <<<EOH
<div id="$div_id"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
EOH;
drupal_add_js(<<<EOJS
var s1 = new SWFObject("$fullPath/flash/flvplayer.swf","single","320","240","7");
s1.addParam("allowfullscreen","TRUE");
s1.addVariable("file","' . base_path() . 'fedora/repository/' . $this->pid . '/FLV/FLV.flv");
s1.write("player' . $this->pid . 'FLV");', 'inline', 'footer');
s1.addVariable("file", "$fullPath/fedora/repository/{$this->pid}/FLV/FLV.flv");
s1.write("$div_id");
EOJS
, 'inline', 'footer');
$collection_fieldset = array(
'#title' => t('Flash Video'),
'#collapsible' => TRUE,
@ -48,30 +54,26 @@ class ShowStreamsInFieldSets {
/**
* Show the TN ??
* @global type $base_url
* @return type
*/
function showTN() {
global $base_url;
$collection_fieldset = array(
'#title' => '',
'#attributes' => array(),
'#collapsible' => FALSE,
'#value' => '<a href="' . $base_url . '/fedora/repository/' . $this->pid . '/OBJ/"><img src="' . $base_url . '/fedora/repository/' . $this->pid . '/TN/TN' . '" /></a>',
'#value' => l(theme('image', "fedora/repository/{$this->pid}/TN/TN", '', '', NULL, FALSE), "fedora/repository/{$this->pid}/OBJ", array('html' => TRUE)),
);
return theme('fieldset', $collection_fieldset);
}
/**
* Same as showTN but artinventory stores the image in a dsid of IMAGE instead of OBJ
* @global type $base_url
* @return type
*/
function showArtInventoryTN() {
global $base_url;
$collection_fieldset = array(
'#collapsible' => FALSE,
'#value' => '<a href="' . $base_url . '/fedora/repository/' . $this->pid . '/IMAGE/image.jpg"><img src="' . $base_url . '/fedora/repository/' . $this->pid . '/TN/TN' . '" /></a>',
'#value' => l(theme('image', "fedora/repository/{$this->pid}/TN/TN", '', '', NULL, FALSE), "fedora/repository/{$this->pid}/IMAGE/image.jpg", array('html' => TRUE)),
);
return theme('fieldset', $collection_fieldset);
}
@ -102,14 +104,16 @@ class ShowStreamsInFieldSets {
$objectHelper = new ObjectHelper();
$item = new Fedora_Item($this->pid);
if (key_exists('TN', $item->datastreams)) {
$tn_url = $base_url . '/fedora/repository/' . $item->pid . '/TN';
$tn_url = "fedora/repository/{$item->pid}/TN";
}
else {
$tn_url = $base_path . drupal_get_path('module', 'fedora_repository') . '/images/Crystal_Clear_app_download_manager.png';
$tn_url = drupal_get_path('module', 'fedora_repository') . '/images/Crystal_Clear_app_download_manager.png';
}
$tn_url = url($tn_url);
$dc_html = $objectHelper->getFormattedDC($item);
$dl_link = l('<div style="float:left; padding: 10px"><img src="' . $tn_url . '"><br />' . t('View Document') .'</div>', 'fedora/repository/' . $this->pid . '/OBJ', array('html' => TRUE));
$dl_link = l('<div style="float:left; padding: 10px">' . theme('image', $tn_url, '', '', NULL, FALSE) . '<br />' . t('View Document') .'</div>', "fedora/repository/{$this->pid}/OBJ", array('html' => TRUE));
$tabset['first_tab']['tabs']['view'] = array(
'#type' => 'tabpage',
@ -126,11 +130,13 @@ class ShowStreamsInFieldSets {
);
}
$viewer_url = 'http://docs.google.com/viewer?url=' . url("fedora/repository/{$this->pid}/OBJ/preview.pdf", array('absolute' => TRUE)) . '&embedded=TRUE';
$tabset['second_tab'] = array(
'#type' => 'tabpage',
'#title' => t('Read Online'),
'#content' => "<iframe src=\"http://docs.google.com/viewer?url=" . $base_url . '/fedora/repository/' .
$this->pid . '/OBJ/preview.pdf' . "&embedded=TRUE\" style=\"width:600px; height:500px;\" frameborder=\"0\"></iframe>"
'#content' => <<<EOM
<iframe src="$viewer_url" style="width:600px; height:500px;" frameborder="0"></iframe>"
EOM
);
// Render the tabset.
@ -164,7 +170,7 @@ class ShowStreamsInFieldSets {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$item = new Fedora_Item($this->pid);
$streams = $item->get_datastreams_list_as_array();
return "<a href='" . $base_url . "/fedora/repository/" . $this->pid . "/OBJ/" . $streams['OBJ']['label'] . "'>" . $streams['OBJ']['label'] . "</a>";
return l($streams['OBJ']['label'], "fedora/repository/{$this->pid}/OBJ");
}
/**

4
plugins/herbarium.inc

@ -161,13 +161,13 @@ class Herbarium {
'#title' => t('Full-size'),
'#content' => $html
);
$image = theme('image', "fedora/imageapi/{$this->pid}/JPG/JPG.jpg", '', '', NULL, FALSE);
$tabset['first_tab'] = array(
// #type and #title are the minimum requirements.
'#type' => 'tabpage',
'#title' => t('View'),
// This will be the content of the tab.
'#content' => '<a href="' . $base_url . '/fedora/repository/' . $this->pid . '/FULL_JPG/"><img src="' . $base_url . '/fedora/imageapi/' .
$this->pid . '/JPG/JPG.jpg' . '" /></a>' . '<p>' . drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '</p>',
'#content' => l($image, "fedora/repository/{$this->pid}/FULL_JPG", array('html' => TRUE)), '<p>' . drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '</p>',
);
$dwc = new DarwinCore($this->item);

59
plugins/qt_viewer.inc

@ -125,29 +125,51 @@ class ShowQtStreamsInFieldSets {
if ($media === FALSE) {
return '';
}
global $base_url;
$path = drupal_get_path('module', 'Fedora_Repository');
$fullPath = base_path() . $path;
$content = '';
$pathTojs = drupal_get_path('module', 'Fedora_Repository') . '/js/AC_Quicktime.js';
drupal_add_js($pathTojs);
drupal_add_js("$path/js/AC_Quicktime.js");
$divid = 'player' . md5($this->pid) . 'MOV';
$content .= '<div class="player" id="' . $divid . '">';
$collection_fieldset = array(
'#title' => t('Quicktime'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'player' => array(
'#type' => 'markup',
'#prefix' => '<div class="player" id="' . $divid . '">',
'#suffix' => '</div>',
),
);
if ($pframe !== FALSE) {
$content .= '<div class="poster" style="cursor: pointer; position: relative; width: ' . $width . 'px; min-height: ' . ($height) . 'px;">';
$content .= '<img src="' . base_path() . 'fedora/repository/' . $this->pid . '/' . $pframe->ID . '/poster.jpg' . '" />';
$content .= '<div class="play" style="font-size: 128px; color: white; position: absolute; top: 50%; left: 50%; margin-top: -0.085em; margin-left: -0.33em; opacity: 0.9; "></div>';
$content .= '</div>';
$collection_fieldset['player']['poster_container'] = array(
'#type' => 'markup',
'#prefix' => '<div class="poster" style="cursor: pointer; position: relative; width: ' . $width . 'px; min-height: ' . ($height) . 'px;">',
'#suffix' => '</div>',
'poster' => array(
'#type' => 'markup',
'#value' => theme('image', "fedora/repository/{$this->pid}/{$pframe->ID}/poster.jpg", '', '', NULL, FALSE)
)
'play' => array(
'#type' => 'markup',
'#prefix' => '<div class="play" style="font-size: 128px; color: white; position: absolute; top: 50%; left: 50%; margin-top: -0.085em; margin-left: -0.33em; opacity: 0.9;">',
'#suffix' => '</div>',
'#value' => '&nbsp;',
),
);
}
$content .= '</div>';
if ($this->enableDownload()) {
$url = base_path() . 'fedora/repository/' . $this->pid . '/OBJ/MOV.mov';
$content .= '<a class="download" href="' . $url . '">Download Media File</a>';
//$url = url();
$collection_fieldset['download_link'] = array(
'#type' => 'markup',
'#value' => l(t('Download Media File'), "fedora/repository/{$this->pid}/OBJ/MOV.mov", array('attributes' => array('class' => 'download'))),
);
}
$src = base_path() . 'fedora/repository/' . $this->pid . '/' . $media->ID . '/MOV.mov';
$qtparams = '';
$qtparams .= "'autostart', '" . ($pframe !== FALSE ? 'TRUE' : 'FALSE') . "', ";
$src = url("fedora/repository/{$this->pid}/{$media->ID}/MOV.mov";
$qtparams = "'autostart', '" . ($pframe !== FALSE ? 'TRUE' : 'FALSE') . "', ";
$init = <<<EOD
$(function() {
src = "$src";
@ -173,11 +195,6 @@ EOD;
drupal_add_js($init, 'inline', 'footer');
$collection_fieldset = array(
'#title' => t('Quicktime'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#value' => $content);
return theme('fieldset', $collection_fieldset);
}

6
plugins/slide_viewer.inc

@ -30,14 +30,13 @@ class ShowSlideStreamsInFieldSets {
function showJPG() {
module_load_include('inc', 'fedora_repository', 'plugins/tagging_form');
module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets');
global $base_url;
global $user;
$tabset = array();
$qs = '';
if ($user->uid != 0) {
$qs = '?uid=' . base64_encode($user->name . ':' . $user->pass);
$qs = '?uid=' . base64_encode($user->name . ':' . $user->pass); //XXX: Base64 encoding is not encryption; SSL would be nice...
}
$viewer_url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/get/' . $this->pid . '/ilives:viewerSdef/getViewer' . $qs;
@ -55,8 +54,7 @@ class ShowSlideStreamsInFieldSets {
'#type' => 'tabpage',
'#title' => t('View'),
// This will be the content of the tab.
'#content' => '<img src="' . $base_url .
'/fedora/imageapi/' . $this->pid . '/JPG/JPG.jpg' . '" />' . '<p>' . drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '</p>',
'#content' => theme('image', "fedora/imageapi/{$this->pid}/JPG/JPG.jpg", '', '', NULL, FALSE) . '<p>' . drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '</p>',
);
return $tabset;

30
plugins/tagging_form.inc

@ -19,13 +19,15 @@ function _show_subject_tags($pid) {
$obj = new Fedora_Item($pid);
$tags = new TagSet($obj);
if (!empty($tags->tags)) {
$output = "<ul>";
$items = array();
foreach ($tags->tags as $tag) {
$output .= "<li title=" . $tag['creator'] . '>' . $tag['name'] . '</li> ';
$items[] = array(
'data' => $tag['name'],
'title' => $tag['creator'],
);
}
$output .= "</ul>";
return theme('item_list', $items);
}
return $output;
}
/**
@ -57,21 +59,27 @@ function fedora_repository_image_tagging_form($form_state, $pid) {
// Add the current tags to the form.
$tagset = new TagSet($obj);
$tags = array();
foreach ($tagset->tags as $tag) {
$form['tags-wrapper']['tags'][$tag['name']] = array(
$form_tag =& $form['tags-wrapper']['tags'][$tag['name']] = array(
'#prefix' => '<li>',
'#suffix' => '</li>',
);
$form['tags-wrapper']['tags'][$tag['name']]['tag'] = array(
'#prefix' => '<a title="Added by ' . $tag['creator'] . '" href="' . $base_url . '/fedora/repository/mnpl_advanced_search/tag:' . $tag['name'] . '">',
'#value' => $tag['name'],
'#suffix' => '</a>',
$tag_title_text = t('Added by @creator.', array(
'@creator' => $tag['creator'],
));
$tag_mnpl_search_path = "fedora/repository/mnpl_advanced_search/tag:{$tag['name']}"
$form_tag['tag'] = array(
'#value' => l($tag['name'], $tag_mnpl_search_path, array('attributes' => array(
'title' => $tag_title_text
))),
);
if (user_access('modify fedora datastreams') || user_access('add fedora tags')) {
// Delete button for each existing tag.
$form['tags-wrapper']['tags'][$tag['name']]['delete'] = array(
$form_tag['delete'] = array(
'#type' => 'imagebutton',
'#image' => $base_url . '/' . drupal_get_path('module', 'fedora_repository') . '/images/remove_icon.png',
'#image' => drupal_get_path('module', 'fedora_repository') . '/images/remove_icon.png',
'#default_value' => $tag['name'],
'#title' => t('Delete this tag'),
);

Loading…
Cancel
Save