Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Stanley committed Jul 18, 2011
1 parent efdd693 commit 84bdf6b
Show file tree
Hide file tree
Showing 27 changed files with 6,660 additions and 0 deletions.
400 changes: 400 additions & 0 deletions book.inc

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions image_rotator_tagger_block.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php
// $Id$

/*
* @file image_rotator_tagger_block.inc
*/


function get_random_image() {
module_load_include('inc', 'fedora_repository', 'CollectionClass');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
$itqlquery = 'select $object $title from <#ri>
where $object <info:fedora/fedora-system:def/relations-external#isMemberOfCollection> <info:fedora/ilives:figures>
and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>
and $object <dc:title> $title';
$collection = new CollectionClass('ilives:figures');
$results = $collection->getRelatedItems('ilives:figures', $itqlquery);
//drupal_set_message($results);


if (empty($results)) {
return NULL;
}
$resultsdoc = new DomDocument();
$resultsdoc->loadXML($results);

$resultslist = $resultsdoc->getElementsByTagName('result');
if ( $resultslist->length == 0 ) {
return NULL;
}
//return htmlentities(substr($results, 0, 1000));
$randresult = $resultslist->item( rand()%$resultslist->length );
if (empty($randresult)) {
return NULL;
}
$objs = $randresult->getElementsByTagName('object');
$obj = $objs->item(0);
$pid = substr( $obj->getAttribute('uri'), 12);
$titles = $randresult->getElementsByTagName('title');
$title = $titles->item(0);

return array('pid' => $pid,
//'title' => $randresult->textContent);
'title' => $title->nodeValue);

}


function _fedora_image_rotator_tagger_block_content() {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'plugins/tagging_form');

global $base_url;
if (!empty($_POST['pid'])) {
$image_item = new Fedora_Item($_POST['pid']);
$result['pid'] = $_POST['pid'];
$result['title'] = $image_item->objectProfile->objLabel;
}
elseif (empty($_POST) && !empty($_SESSION['fedora_tagged_image']['pid'])) {
$image_item = new Fedora_Item($_SESSION['fedora_tagged_image']['pid']);
$result['pid'] = $_SESSION['fedora_tagged_image']['pid'];
$result['title'] = $image_item->objectProfile->objLabel;
unset($_SESSION['fedora_tagged_image']);
}
else {
$result = get_random_image();

$image_item = new Fedora_Item($result['pid']);
}
if (!empty ($result)) {
return '<p>'
. l( '<img src="'. $base_url . '/fedora/imageapi/'. $result['pid'] . '/JPG?op=scale&height=500&width=300" />', 'fedora/repository/'. $result['pid'], array('html' => TRUE, 'alias' => TRUE))
.'<p>This image is from '. l($result['title'], 'fedora/ilives_book_viewer/'. substr($image_item->pid, 0, strrpos($image_item->pid, '-')), array('html' => TRUE, 'alias' => TRUE)) . '.'
. drupal_get_form('fedora_repository_image_tagging_form', $result['pid']) . '</p>';
}
else {
return '';
}
}


/*
function fedora_ilives_preprocess_page(&$variables) {
drupal_add_js(drupal_get_path('module', 'fedora_ilives').'/fedora_ilives_ajax.js', 'theme');
return TRUE;
}*/

class ShowILivesStreamsInFieldSets {

private $pid =NULL;

function ShowILivesStreamsInFieldSets($pid) {
//drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$this->pid=$pid;
}

function showJPG() {
module_load_include('inc', 'fedora_repository', 'plugins/tagging_form');
global $base_url;
$collection_fieldset = array(
'#collapsible' => FALSE,
'#value' => '<a href="' . $base_url . '/fedora/repository/' . $this->pid . '/JPG/"><img src="' . $base_url . '/fedora/repository/' . $this->pid . '/JPG/JPG.jpg' . '" /></a>',
);
return theme('fieldset', $collection_fieldset)
. drupal_get_form('fedora_repository_image_tagging_form', $this->pid);
}
}
Binary file added images/Crystal_Clear_mimetype_man.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions islandora_book.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; $Id$
name = Islandora Book
description = Provides book interface
package = Fedora Repository
dependencies[] = fedora_repository
version = 6.1dev
core = 6.x
13 changes: 13 additions & 0 deletions islandora_book.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
// $Id$

/*
* @file islandora_book.install
*/

/**
* Implementation of hook_enable()
*/
function islandora_book_enable() {

}
Loading

0 comments on commit 84bdf6b

Please sign in to comment.