Browse Source

updated restconnection to use anonymous properly

pull/109/merge
Paul Pound 13 years ago
parent
commit
c965576954
  1. 9
      RestConnection.inc
  2. 7
      islandora-object-edit.tpl.php
  3. 15
      islandora_basic_image/islandora_basic_image.module

9
RestConnection.inc

@ -42,8 +42,15 @@ class RestConnection {
public $repository = NULL; public $repository = NULL;
function RestConnection($user) { function RestConnection($user) {
if(!isset($user) || $user->uid == 0){
$user_string = 'anonymous';
$pass_string = 'anonymous';
} else {
$user_string = $user->name;
$pass_string = $user->pass;
}
$url = variable_get('islandora_base_url', 'http://localhost:8080/fedora'); $url = variable_get('islandora_base_url', 'http://localhost:8080/fedora');
$this->connection = new RepositoryConnection($url, $user->name, $user->pass); $this->connection = new RepositoryConnection($url, $user_string, $pass_string);
$this->connection->reuseConnection = TRUE; $this->connection->reuseConnection = TRUE;
$this->api = new FedoraApi($this->connection); $this->api = new FedoraApi($this->connection);
$this->cache = new SimpleCache(); $this->cache = new SimpleCache();

7
islandora-object-edit.tpl.php

@ -1,7 +1,7 @@
<?php <?php
/* /*
* islandora-object.tpl.php * islandora-object-edit.tpl.php
* *
* *
* *
@ -37,10 +37,7 @@
* and each element has an array of values. dc.title can have none, one or many titles * and each element has an array of values. dc.title can have none, one or many titles
* this is the case for all dc elements. * this is the case for all dc elements.
* *
* we can get a list of datastreams by doing *
* foreach ($object as $ds){
* do something here
* }
* *
*/ */

15
islandora_basic_image/islandora_basic_image.module

@ -99,6 +99,21 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error'); drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error');
} }
$variables['islandora_dublin_core'] = $dc_object; $variables['islandora_dublin_core'] = $dc_object;
//create a nicer array for themers
//TODO: give this a better home
$dc_array = array();
foreach ($dc_object as $element) {
if (!empty($element)) {
foreach ($element as $key => $value) {
foreach ($value as $v) {
if (!empty($v)) {
$dc_array[] = array($key => $v);
}
}
}
}
}
$variables['dc_array'] = $dc_array;
$variables['islandora_object_label'] = $islandora_object->label; $variables['islandora_object_label'] = $islandora_object->label;
$variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id); $variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id);
global $base_url; global $base_url;

Loading…
Cancel
Save