-
Notifications
You must be signed in to change notification settings - Fork 0
/
islandora_csv_to_mods.module
98 lines (93 loc) · 3.49 KB
/
islandora_csv_to_mods.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/**
* @file
* Defines all the hooks this module implements.
*
* islandora_csv_to_mods.module: defines paths as entry points and acts
* as a hub for dispatching tasks to other modules.
*
* This file is a utility module for use with Islandora.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
// Permissions.
define('ISLANDORA_CSV_TO_MODS', 'csv to mods permission');
define('ISLANDORA_CSV_TO_MODS_UPDATE_OBJECTS', 'csv to mods update objects');
/**
* Implements hook_menu().
*/
function islandora_csv_to_mods_menu() {
return array(
'admin/islandora/tools/csv_to_mods' => array(
'title' => 'Islandora CSV to MODS Utility',
'description' => 'Settings for the Islandora CSV to MODS Utility module.',
'page callback' => 'drupal_get_form',
'page arguments' => array('islandora_csv_to_mods_admin_form'),
'access arguments' => array(ISLANDORA_CSV_TO_MODS),
'file' => 'includes/admin.form.inc',
),
'islandora/csv_to_mods/import_csv' => array(
'title' => 'CSV to MODS',
'page callback' => 'drupal_get_form',
'page arguments' => array('islandora_csv_to_mods_import_csv_form'),
'type' => MENU_CALLBACK,
'file' => 'includes/import_csv.form.inc',
'access arguments' => array(ISLANDORA_CSV_TO_MODS),
),
'islandora/csv_to_mods/update_objects/%/%' => array(
'title' => 'Update Object MODS',
'page callback' => 'islandora_csv_to_mods_update_objects',
'page arguments' => array(3, 4),
'file' => 'includes/import_csv.form.inc',
'access arguments' => array(ISLANDORA_CSV_TO_MODS_UPDATE_OBJECTS),
),
'islandora/csv_to_mods/download_mods/%/%' => array(
'title' => 'Download MODS',
'page callback' => 'islandora_csv_to_mods_download_mods',
'page arguments' => array(3, 4),
'file' => 'includes/import_csv.form.inc',
'access arguments' => array(ISLANDORA_CSV_TO_MODS),
),
);
}
/**
* Implements hook_permission().
*/
function islandora_csv_to_mods_permission() {
return array(
ISLANDORA_CSV_TO_MODS => array(
'title' => t('Use the CSV to MODS tool'),
'description' => t('User can create MODS from CSV upload.'),
),
ISLANDORA_CSV_TO_MODS_UPDATE_OBJECTS => array(
'title' => t('Update Islandora objects with MODS created from CSV upload.'),
'description' => t('User can update Islandora objects with MODS created from CSV file upload.'),
),
);
}
/**
* Implements hook_presprocess_theme().
*
* This code will remove the sidebar and must check to see whether or not the
* path is on a user page.
*/
function islandora_csv_to_mods_preprocess_page(&$vars) {
$item = menu_get_item();
if (is_array($item)) {
if ((strstr($item['path'], 'islandora/csv_to_mods') <> '') || $item['path'] == 'admin/islandora/tools/csv_to_mods') {
$path = drupal_get_path('module', 'islandora_csv_to_mods');
drupal_add_css($path . '/css/csv_to_mods.css');
}
}
}