Browse Source

File cleanup and moving around

pull/122/merge
jonathangreen 13 years ago
parent
commit
3f2b0c9d3a
  1. 0
      includes/breadcrumb.inc
  2. 10
      includes/datastream.inc
  3. 2
      includes/mime.detect.inc
  4. 2
      includes/purge.form.inc
  5. 97
      islandora.module
  6. 4
      islandora_basic_image/includes/image.process.inc
  7. 0
      theme/islandora-object-edit.tpl.php
  8. 0
      theme/islandora-object.tpl.php
  9. 91
      theme/islandora.theme.inc

0
includes/Breadcrumbs.inc → includes/breadcrumb.inc

10
includes/datastream.inc

@ -204,8 +204,8 @@ function islandora_add_datastream_form_submit($form, &$form_state) {
return;
}
module_load_include('inc', 'islandora', 'includes/MimeClass');
$mimetype = new MimeClass();
module_load_include('inc', 'islandora', 'includes/mime.detect');
$mimetype = new MimeDetect();
$file = $form_state['values']['add-stream-file-location'];
$file = drupal_realpath($file);
@ -242,9 +242,9 @@ function islandora_add_datastream_form_submit($form, &$form_state) {
* @return boolean
*/
function islandora_add_datastream_form_validate($form, &$form_state) {
module_load_include('inc', 'islandora', 'includes/MimeClass');
module_load_include('inc', 'islandora', 'includes/mime.detect');
module_load_include('inc', 'islandora', 'RestConnection');
$mimetype = new MimeClass();
$mimetype = new MimeDetect();
if ($form_state['clicked_button']['#value'] == 'OK') {
$form_state['rebuild'] = TRUE;
return;
@ -277,7 +277,7 @@ function islandora_add_datastream_form_validate($form, &$form_state) {
return FALSE;
}
$mimetype = new MimeClass();
$mimetype = new MimeDetect();
$object = islandora_object_load($form_state['values']['pid']);
$unused_dsids = islandora_get_unused_dsids($object);
if(isset($unused_dsids[$dsid])) {

2
includes/MimeClass.inc → includes/mime.detect.inc

@ -22,7 +22,7 @@
*
*/
class MimeClass {
class MimeDetect {
protected $protectedMimeTypes = array(
/*

2
includes/purge.form.inc

@ -154,6 +154,6 @@ function islandora_purge_datastream_submit($form, &$form_state) {
}
//notify modules post deletion
module_invoke_all('islandora_post_purge_datastream', $object, $datastream_id);
drupal_set_message(t('%d datastream sucessfully purged from Islandora object %o', array('%d' => $datastream_id, '%o' => $object->id)));
drupal_set_message(t('%d datastream sucessfully purged from Islandora object %o', array('%d' => $datastream_id, '%o' => $object->label)));
drupal_goto('islandora/object/' . $object->id);
}

97
islandora.module

@ -318,7 +318,7 @@ function islandora_view_default_object() {
* @return string
*/
function islandora_view_object($fedora_object = NULL) {
module_load_include('inc', 'islandora', 'includes/Breadcrumbs');
module_load_include('inc', 'islandora', 'includes/breadcrumb');
global $user;
if(!$fedora_object) {
@ -371,11 +371,13 @@ function islandora_islandora_view_object($object) {
function islandora_theme() {
return array(
'islandora_default' => array(
'template' => 'islandora-object',
'file' => 'theme/islandora.theme.inc',
'template' => 'theme/islandora-object',
'variables' => array('islandora_object' => NULL),
),
'islandora_default_edit' => array(
'template' => 'islandora-object-edit',
'file' => 'theme/islandora.theme.inc',
'template' => 'theme/islandora-object-edit',
'variables' => array('islandora_object' => NULL),
),
);
@ -418,53 +420,6 @@ function islandora_permission() {
);
}
/**
* preprocess for the default view template
* @global string $base_url
* @param array $variables
*/
function islandora_preprocess_islandora_default(&$variables) {
drupal_add_js('misc/form.js');
drupal_add_js('misc/collapse.js');
$islandora_object = $variables['islandora_object'];
module_load_include('inc', 'islandora', 'includes/islandora_dublin_core');
module_load_include('inc', 'islandora', 'includes/utilities');
module_load_include('inc', 'islandora', 'includes/datastream');
$variables['parent_collections'] = islandora_datastream_get_parents($islandora_object);
$datastreams = array();
foreach ($islandora_object as $ds) {
$pid = $islandora_object->id;
$id = $ds->id;
$label = $ds->label;
$download_path = islandora_datastream_get_url($ds, 'download');
$datastreams[$id]['id'] = $id;
$datastreams[$id]['label'] = $label;
$datastreams[$id]['label_link'] = l($label, $download_path);
$datastreams[$id]['download_url'] = $download_path;
$datastreams[$id]['mimetype'] = $ds->mimetype;
$datastreams[$id]['size'] = islandora_datastream_get_human_readable_size($ds);
$datastreams[$id]['created_date'] = $ds->createdDate->format("Y-m-d");
$datastreams[$id]['class'] = strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $id));
}
$variables['datastreams'] = $datastreams;
try {
$dc = $islandora_object['DC']->content;
//$dc_xml = simplexml_load_string($dc);
$dc_object = Dublin_Core::import_from_xml_string($dc);
} catch (Exception $e) {
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error');
}
$variables['dc_array'] = $dc_object->as_formatted_array();
$variables['islandora_dublin_core'] = $dc_object;
$variables['islandora_object_label'] = $islandora_object->label;
global $base_url;
if (isset($islandora_object['TN'])) {
$variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view';
}
}
/**
* a helper function to get a connection and return an object
* @global object $user
@ -488,48 +443,6 @@ function islandora_object_load($object_id) {
return $fedora_object;
}
/**
* preprocess the edit template
* @global string $base_url
* @param array $variables
* theme variables for the edit template
*/
function islandora_preprocess_islandora_default_edit(&$variables) {
$islandora_object = $variables['islandora_object'];
global $base_url;
$datastreams = array();
$variables['islandora_editmetadata_url'] = $base_url . '/islandora/edit_form/' . $islandora_object->id;
module_load_include('inc', 'islandora', 'includes/datastream');
module_load_include('inc', 'islandora', 'includes/utilities');
// $variables['add_datastream_form'] = drupal_get_form('islandora_add_datastream_form', $islandora_object->id);
$header = array(
array('data' => t('ID')),
array('data' => t('Label')),
array('data' => t('Type')),
array('data' => t('Mime type')),
array('data' => t('Size')),
array('data' => t('Operations'), 'colspan' => '3'),
//array('data' => t('Delete')),
);
$table_attributes = array('class' => array('manage-datastreams'));
$rows = array();
foreach ($islandora_object as $ds) {
$rows[] = array(
array('class' => 'datastream-id', 'data' => l($ds->id, islandora_datastream_get_url($ds, 'view'))),
array('class' => 'datastream-label', 'data' => $ds->label),
array('class' => 'datastream-control', 'data' => islandora_control_group_to_human_readable($ds->controlGroup)),
array('class' => 'datastream-mime', 'data' => $ds->mimeType),
array('class' => 'datastream-size', 'data' => islandora_datastream_get_human_readable_size($ds)),
array('class' => 'datastream-download', 'data' => l(t('download'), islandora_datastream_get_url($ds, 'download'))),
array('class' => 'datstream-edit', 'data' => islandora_datastream_edit_get_link($islandora_object, $ds->id)),
array('class' => 'datastream-delete', 'data' => islandora_datastream_get_delete_link($ds)),
);
}
$caption = $islandora_object->label . ' - ' . $islandora_object->id;
$table = array('colgroups' => NULL, 'sticky' => TRUE, 'empty' => 'Error loading datastreams', 'caption' => $caption, 'header' => $header, 'rows' => $rows, 'attributes' => $table_attributes);
$variables['datastream_table'] = theme_table($table);
}
function islandora_ingest_access_callback($object, $perm) {
if(islandora_access_callback($object, $perm) === FALSE) {
return FALSE;

4
islandora_basic_image/includes/image.process.inc

@ -7,9 +7,9 @@
*/
function islandora_basic_image_create_all_derivatives($object) {
module_load_include('inc', 'islandora', 'includes/MimeClass');
module_load_include('inc', 'islandora', 'includes/mime.detect');
module_load_include('inc', 'islandora_basic_image', 'includes/image_process');
$mime_class = new MimeClass();
$mime_class = new MimeDetect();
if (!isset($object['OBJ'])) {
drupal_set_message(t('Could not create image derivatives for %s. No image file was uploaded.', array('%s' => $object->id)),'error');
return "";

0
islandora-object-edit.tpl.php → theme/islandora-object-edit.tpl.php

0
islandora-object.tpl.php → theme/islandora-object.tpl.php

91
theme/islandora.theme.inc

@ -0,0 +1,91 @@
<?php
/**
* preprocess the edit template
* @global string $base_url
* @param array $variables
* theme variables for the edit template
*/
function islandora_preprocess_islandora_default_edit(&$variables) {
$islandora_object = $variables['islandora_object'];
global $base_url;
$datastreams = array();
$variables['islandora_editmetadata_url'] = $base_url . '/islandora/edit_form/' . $islandora_object->id;
module_load_include('inc', 'islandora', 'includes/datastream');
module_load_include('inc', 'islandora', 'includes/utilities');
// $variables['add_datastream_form'] = drupal_get_form('islandora_add_datastream_form', $islandora_object->id);
$header = array(
array('data' => t('ID')),
array('data' => t('Label')),
array('data' => t('Type')),
array('data' => t('Mime type')),
array('data' => t('Size')),
array('data' => t('Operations'), 'colspan' => '3'),
//array('data' => t('Delete')),
);
$table_attributes = array('class' => array('manage-datastreams'));
$rows = array();
foreach ($islandora_object as $ds) {
$rows[] = array(
array('class' => 'datastream-id', 'data' => l($ds->id, islandora_datastream_get_url($ds, 'view'))),
array('class' => 'datastream-label', 'data' => $ds->label),
array('class' => 'datastream-control', 'data' => islandora_control_group_to_human_readable($ds->controlGroup)),
array('class' => 'datastream-mime', 'data' => $ds->mimeType),
array('class' => 'datastream-size', 'data' => islandora_datastream_get_human_readable_size($ds)),
array('class' => 'datastream-download', 'data' => l(t('download'), islandora_datastream_get_url($ds, 'download'))),
array('class' => 'datstream-edit', 'data' => islandora_datastream_edit_get_link($islandora_object, $ds->id)),
array('class' => 'datastream-delete', 'data' => islandora_datastream_get_delete_link($ds)),
);
}
$caption = $islandora_object->label . ' - ' . $islandora_object->id;
$table = array('colgroups' => NULL, 'sticky' => TRUE, 'empty' => 'Error loading datastreams', 'caption' => $caption, 'header' => $header, 'rows' => $rows, 'attributes' => $table_attributes);
$variables['datastream_table'] = theme_table($table);
}
/**
* preprocess for the default view template
* @global string $base_url
* @param array $variables
*/
function islandora_preprocess_islandora_default(&$variables) {
drupal_add_js('misc/form.js');
drupal_add_js('misc/collapse.js');
$islandora_object = $variables['islandora_object'];
module_load_include('inc', 'islandora', 'includes/islandora_dublin_core');
module_load_include('inc', 'islandora', 'includes/utilities');
module_load_include('inc', 'islandora', 'includes/datastream');
$variables['parent_collections'] = islandora_datastream_get_parents($islandora_object);
$datastreams = array();
foreach ($islandora_object as $ds) {
$pid = $islandora_object->id;
$id = $ds->id;
$label = $ds->label;
$download_path = islandora_datastream_get_url($ds, 'download');
$datastreams[$id]['id'] = $id;
$datastreams[$id]['label'] = $label;
$datastreams[$id]['label_link'] = l($label, $download_path);
$datastreams[$id]['download_url'] = $download_path;
$datastreams[$id]['mimetype'] = $ds->mimetype;
$datastreams[$id]['size'] = islandora_datastream_get_human_readable_size($ds);
$datastreams[$id]['created_date'] = $ds->createdDate->format("Y-m-d");
$datastreams[$id]['class'] = strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $id));
}
$variables['datastreams'] = $datastreams;
try {
$dc = $islandora_object['DC']->content;
//$dc_xml = simplexml_load_string($dc);
$dc_object = Dublin_Core::import_from_xml_string($dc);
} catch (Exception $e) {
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error');
}
$variables['dc_array'] = $dc_object->as_formatted_array();
$variables['islandora_dublin_core'] = $dc_object;
$variables['islandora_object_label'] = $islandora_object->label;
global $base_url;
if (isset($islandora_object['TN'])) {
$variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view';
}
}
Loading…
Cancel
Save