Browse Source

Merge branch '7.x' of github.com:Islandora/islandora into 7.x

pull/108/head
jonathangreen 13 years ago
parent
commit
86a57e5394
  1. 15
      islandora-object-default-view.tpl.php
  2. 18
      islandora.module
  3. 2
      islandora_basic_image/islandora-basic-image-view-object.tpl.php
  4. 23
      islandora_basic_image/islandora_basic_image.module

15
islandora-object-default-view.tpl.php

@ -24,7 +24,20 @@
?> ?>
<?php <?php
$object = $variables['object']; /*object is a fedora tuque Object
* $object->label
* $object->id
* to get the contents of a datastream
* $object['dsid']->content
* etc.
*
*/
$mods = $variables['object'];
$title = $mods['title'];
//dsm($object);
print('this is the default view for '. $object->label .' ' .$object->id); print('this is the default view for '. $object->label .' ' .$object->id);
//print($object['MODS']->contentasJson->'key')
?> ?>

18
islandora.module

@ -266,7 +266,7 @@ function islandora_view_object($object_id) {
module_load_include('inc', 'islandora', 'RestConnection'); module_load_include('inc', 'islandora', 'RestConnection');
$user = new stdClass(); $user = new stdClass();
$user->name = 'fedoraAdmin'; $user->name = 'fedoraAdmin';
$user->password = 'fedoraAdmin'; $user->password = 'islandora';
try { try {
$restConnection = new RestConnection($user); $restConnection = new RestConnection($user);
$fedora_object = new FedoraObject($object_id, $restConnection->repository); $fedora_object = new FedoraObject($object_id, $restConnection->repository);
@ -313,6 +313,22 @@ function islandora_theme() {
); );
} }
function islandora_datastream_as_attachment($object_id, $dsid){
module_load_include('inc', 'islandora', 'RestConnection');
$user = new stdClass();
$user->name = 'fedoraAdmin';
$user->password = 'islandora';
try {
$restConnection = new RestConnection($user);
$fedora_object = new FedoraObject($object_id, $restConnection->repository);
} catch (Exception $e) {
drupal_set_message(t('Error getting Islanndora datastream $d for object %s', array('%s' => $object_id, '%d' => $dsid)), 'error');
return"";
}
print($fedora_object[$dsid]->content);
exit();
}
/** /**
* drupal hook_permissions function * drupal hook_permissions function
* @return array * @return array

2
islandora_basic_image/islandora-basic-image-view-object.tpl.php

@ -24,7 +24,7 @@
?> ?>
<?php <?php
$object = $variables['objects']; $object = $variables['object'];
print($object->label); print($object->label);
?> ?>

23
islandora_basic_image/islandora_basic_image.module

@ -83,7 +83,7 @@ function islandora_basic_image_theme() {
), ),
'islandora_basic_image_view_object' => array( 'islandora_basic_image_view_object' => array(
'template' => 'islandora-basic-image-view-object', 'template' => 'islandora-basic-image-view-object',
'variables' => array('objects' => NULL), 'variables' => array('object' => NULL),
) )
); );
} }
@ -97,6 +97,8 @@ function islandora_basic_image_islandora_get_types() {
return array('info:fedora/islandora:imgageCModel', 'info:fedora/islandora:sp_basic_image'); return array('info:fedora/islandora:imgageCModel', 'info:fedora/islandora:sp_basic_image');
} }
/** /**
* this modules implentation of view_object will handle objects of type islandora:basicImageCModel and info:fedora/islandora:sp_basic_image * this modules implentation of view_object will handle objects of type islandora:basicImageCModel and info:fedora/islandora:sp_basic_image
* as registered in its return types * as registered in its return types
@ -116,9 +118,26 @@ function islandora_basic_image_islandora_view_object($object, $user, $page_numbe
if (empty($combined_list)) { if (empty($combined_list)) {
return NULL;//we don't handle any of this objects cmodels return NULL;//we don't handle any of this objects cmodels
} }
$output = theme('islandora_basic_image_view_object', array('objects' => $object)); $output = theme('islandora_basic_image_view_object', array('object' => $object));
return $output; return $output;
} }
function islandora_preprocess_islandora_basic_image_view_object(&$variables){
$object = $variables['object'];
try{
$dc = $object['DC']->content;
$dc_xml = simplexml_load_string($dc);
$dc_json = json_decode(json_encode((array)simplexml_load_string($dc)),1);
}catch(Exception $e){
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $object->id,'%t'=>$e->getMessage())),'error');
}
$variables['dc'] = $dc_json;
$variables['label'] = $object->label;
global $base_url;
$variables['image_url'] = $base_url.'islandora/object/'.$object->id.'/datastream/OBJ/view';
$variables['thumbnail_url'] = $base_url.'islandora/object/'.$object->id.'datastream/TN/view';
//return;
}
?> ?>

Loading…
Cancel
Save