Browse Source

added admin form for basic collection and basic image

pull/110/merge
Paul Pound 13 years ago
parent
commit
cbc38c5f93
  1. 7
      islandora.module
  2. 16
      islandora_basic_collection/admin/islandora_basic_collection.admin.inc
  3. 15
      islandora_basic_collection/islandora_basic_collection.module
  4. 16
      islandora_basic_image/admin/islandora_basic_image.admin.inc
  5. 22
      islandora_basic_image/islandora_basic_image.module

7
islandora.module

@ -55,7 +55,7 @@ function islandora_menu() {
'type' => MENU_NORMAL_ITEM,
'weight' => 0,
);
/* may not need this
$items['admin/islandora/solution_packs'] = array(
'title' => 'Solution Packs',
'description' => 'Install content models and collections required by installed solution packs.',
@ -63,7 +63,7 @@ function islandora_menu() {
'access arguments' => array(FEDORA_ADD_DS),
'file' => 'admin/islandora.solutionpacks.inc',
'type' => MENU_NORMAL_ITEM,
);
);*/
$items['islandoracm.xsd'] = array(
'title' => 'Islandora Content Model XML Schema Definition',
@ -471,6 +471,7 @@ function islandora_view_object($object_id) {
foreach ($arr as $key => $value) {
$output .= $value; //if we have multiple modules handle one cmodel we need to iterate over multiple
}
//we could do another module invoke all here to build the edit tab with a default implemented in this module?
return $output; //just an example as we could have more then one array element
}
@ -485,7 +486,7 @@ function islandora_islandora_view_object($object) {
$supported_models = islandora_get_types();
$output = "";
foreach ($object->models as $model) {
if (isset($supported_models[$model][ISLANDORA_VIEW_HOOK]) && $supported_models[$model][ISLANDORA_VIEW_HOOK] == TRUE) {//another module is handling the view
if (isset($supported_models[$model][ISLANDORA_VIEW_HOOK]) && (boolean)$supported_models[$model][ISLANDORA_VIEW_HOOK] === TRUE) {//another module is handling the view
return;
}
}

16
islandora_basic_collection/admin/islandora_basic_collection.admin.inc

@ -0,0 +1,16 @@
<?php
function islandora_basic_collection_admin() {
$form = array();
$form['islandora_basic_collection_use_for_default_tab'] = array(
'#type' => 'checkbox',
'#title' => t('Provide the view for the default tab'),
'#default_value' => variable_get('islandora_basic_collection_use_for_default_tab', 'TRUE'),
'#description' => t('Should this module provide the view for the default view tab. If you are seeing unexpected content
on a view tab you may have multiple modules configured to provide content for the default tab.'),
'#weight' => -10
);
return system_settings_form($form);
}

15
islandora_basic_collection/islandora_basic_collection.module

@ -36,6 +36,17 @@ function islandora_basic_collection_menu() {
'access callback' => 'islandora_basic_collection_access',
'access arguments' => array(2),
);
$items['admin/islandora/basic_collection'] = array(
'title' => 'Islandora Basic Collection',
'description' => 'Configure the basic Collection solution pack.',
'page callback' => 'drupal_get_form',
'access arguments' => array('administer site configuration'),
'page arguments' => array('islandora_basic_collection_admin'),
'file' => 'admin/islandora_basic_collection.admin.inc',
'type' => MENU_NORMAL_ITEM,
);
/* an example of adding a tab for view
$items['islandora/object/%/view/collection'] = array(
'title' => 'Collection View',
@ -111,12 +122,14 @@ function islandora_basic_collection_theme($existing, $type, $theme, $path) {
/**
* tells the main module what types of objects we support. This is used to determine whether or not
* this module should attempt to respond.
* If ISLANDORA_VIEW_HOOK = TRUE this function will populate the default tab. This should be configurable
* in the modules admin section, otherwise two modules can populate one tab.
* @return array
* array of content model pids that this module supports
*/
function islandora_basic_collection_islandora_get_types() {
$types = array();
$types['islandora:collectionCModel'][ISLANDORA_VIEW_HOOK] = TRUE;
$types['islandora:collectionCModel'][ISLANDORA_VIEW_HOOK] = variable_get('islandora_basic_collection_use_for_default_tab', TRUE);
//$types['islandora:collectionCModel'][ISLANDORA_EDIT_HOOK] = FALSE;
return $types;
}

16
islandora_basic_image/admin/islandora_basic_image.admin.inc

@ -0,0 +1,16 @@
<?php
function islandora_basic_image_admin() {
$form = array();
$form['islandora_basic_image_use_for_default_tab'] = array(
'#type' => 'checkbox',
'#title' => t('Provide the view for the default tab'),
'#default_value' => variable_get('islandora_basic_image_use_for_default_tab', 'TRUE'),
'#description' => t('Should this module provide the view for the default view tab. If you are seeing unexpected content
on a view tab you may have multiple modules configured to provide content for the default tab.'),
'#weight' => -10
);
return system_settings_form($form);
}

22
islandora_basic_image/islandora_basic_image.module

@ -28,8 +28,18 @@
* hook_menu function similar to below. You would also need to create an access function
* to tell islandora when to show your tabs. There is an example below.
*/
/*function islandora_basic_image_menu() {
function islandora_basic_image_menu() {
$items = array();
$items['admin/islandora/basic_image'] = array(
'title' => 'Islandora Basic Image',
'description' => 'Configure the basic image solution pack.',
'page callback' => 'drupal_get_form',
'access arguments' => array('administer site configuration'),
'page arguments' => array('islandora_basic_image_admin'),
'file' => 'admin/islandora_basic_image.admin.inc',
'type' => MENU_NORMAL_ITEM,
);
/* example menu paths
$items['islandora/object/%/manage/image'] = array(
'title' => 'Manage Image Types',
'page callback' => 'islandora_basic_image_manage_object',
@ -54,9 +64,9 @@
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_basic_image_access',
'access arguments' => array(2),
);
);*/
return $items;
}*/
}
/**
* an example of adding a new managment section to the manage section of islandora.
@ -134,7 +144,7 @@ function islandora_basic_image_theme($existing, $type, $theme, $path) {
return array(
'islandora_basic_image_objects' => array(
'template' => 'islandora-basic-image-view-objects',
'variables' => array('islandor_objects' => NULL),
'variables' => array('islandora_objects' => NULL),
),
'islandora_basic_image' => array(
'template' => 'islandora-basic-image',
@ -154,8 +164,8 @@ function islandora_basic_image_theme($existing, $type, $theme, $path) {
*/
function islandora_basic_image_islandora_get_types() {
$types = array();
$types['islandora:sp_basic_image'][ISLANDORA_VIEW_HOOK] = TRUE;
$types['islandora:sp_basic_image'][ISLANDORA_EDIT_HOOK] = FALSE;
$types['islandora:sp_basic_image'][ISLANDORA_VIEW_HOOK] = variable_get('islandora_basic_image_use_for_default_tab', TRUE);
//$types['islandora:sp_basic_image'][ISLANDORA_EDIT_HOOK] = FALSE;
return $types;
}

Loading…
Cancel
Save