-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathislandora_streaming.module
170 lines (160 loc) · 5.83 KB
/
islandora_streaming.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
/**
* @file
* Handles the creation/display of islandora:streaming objects.
*/
/**
* Implements hook_menu().
*/
function islandora_streaming_menu() {
return array(
'admin/islandora/solution_pack_config/streaming_media' => array(
'title' => 'Streaming Media Solution Pack',
'description' => 'Configure Streaming',
'page callback' => 'drupal_get_form',
'access arguments' => array('administer site configuration'),
'page arguments' => array('islandora_streaming_admin'),
'file' => 'includes/admin.form.inc',
'type' => MENU_NORMAL_ITEM,
),
'islandora/object/%islandora_object/manage/object/streamingsources/edit' => array(
'title' => t('Edit Streaming Sources'),
'page callback' => 'drupal_get_form',
'page arguments' => array('islandora_streaming_edit_streams_form', 2),
'access callback' => 'islandora_object_manage_access_callback',
'access arguments' => array(
array(
ISLANDORA_MANAGE_PROPERTIES,
ISLANDORA_METADATA_EDIT,
ISLANDORA_ADD_DS,
), 2),
'file' => 'includes/streaming_edit_streams.form.inc',
'type' => MENU_CALLBACK,
),
);
}
/**
* Implements hook_theme().
*/
function islandora_streaming_theme($existing, $type, $theme, $path) {
return array(
'islandora_streaming' => array(
'file' => 'theme/theme.inc',
'template' => 'theme/islandora-streaming',
'pattern' => 'islandora_streaming__',
'variables' => array('object' => NULL),
),
);
}
/**
* Implements hook_islandora_required_objects().
*/
function islandora_streaming_islandora_required_objects(IslandoraTuque $connection) {
$module_path = drupal_get_path('module', 'islandora_streaming');
// Streaming Media Content Model.
$streaming_content_model = $connection->repository->constructObject('islandora:sp_streaming');
$streaming_content_model->owner = 'fedoraAdmin';
$streaming_content_model->label = 'Islandora Streaming Media Content Model';
$streaming_content_model->models = 'fedora-system:ContentModel-3.0';
// DS-COMPOSITE-MODEL Datastream.
$datastream = $streaming_content_model->constructDatastream('DS-COMPOSITE-MODEL', 'X');
$datastream->label = 'DS-COMPOSITE-MODEL';
$datastream->mimetype = 'application/xml';
$datastream->setContentFromFile("$module_path/xml/islandora_streaming_ds_composite_model.xml", FALSE);
$streaming_content_model->ingestDatastream($datastream);
// Streaming Media Collection.
$streaming_collection = $connection->repository->constructObject('islandora:sp_streaming_collection');
$streaming_collection->owner = 'fedoraAdmin';
$streaming_collection->label = 'Streaming Media Collection';
$streaming_collection->models = 'islandora:collectionCModel';
$streaming_collection->relationships->add(FEDORA_RELS_EXT_URI, 'isMemberOfCollection', 'islandora:root');
// Collection Policy Datastream.
$datastream = $streaming_collection->constructDatastream('COLLECTION_POLICY', 'X');
$datastream->label = 'Collection policy';
$datastream->mimetype = 'application/xml';
$datastream->setContentFromFile("$module_path/xml/islandora_streaming_collection_policy.xml", FALSE);
$streaming_collection->ingestDatastream($datastream);
// TN Datastream.
$datastream = $streaming_collection->constructDatastream('TN', 'M');
$datastream->label = 'Thumbnail';
$datastream->mimetype = 'image/png';
$datastream->setContentFromFile("$module_path/images/folder.png", FALSE);
$streaming_collection->ingestDatastream($datastream);
return array(
'islandora_streaming' => array(
'title' => 'Islandora Streaming Media',
'objects' => array(
$streaming_content_model,
$streaming_collection,
),
),
);
}
/**
* Implements hook_CMODEL_PID_islandora_view_object().
*/
function islandora_streaming_islandora_sp_streaming_islandora_view_object($object, $page_number, $page_size) {
$output = theme('islandora_streaming', array('object' => $object));
return array('' => $output);
}
/**
* Implements hook_islandora_xml_form_builder_forms().
*/
function islandora_streaming_islandora_xml_form_builder_forms() {
$module_path = drupal_get_path('module', 'islandora_streaming');
return array(
'Streaming Media MODS form' => array(
'form_file' => "$module_path/xml/islandora_streaming_mods_form.xml",
),
);
}
/**
* Implements hook_islandora_xml_form_builder_form_associations().
*/
function islandora_streaming_islandora_xml_form_builder_form_associations() {
return array(
'islandora_streaming_mods_form' => array(
'content_model' => 'islandora:sp_streaming',
'form_name' => 'Streaming Media MODS form',
'dsid' => 'MODS',
'title_field' => array('titleInfo', 'title'),
'transform' => 'mods_to_dc.xsl',
'template' => FALSE,
),
);
}
/**
* Implements hook_islandora_ingest_steps().
*/
function islandora_streaming_islandora_sp_streaming_islandora_ingest_steps() {
return array(
'islandora_streaming_edit_streams' => array(
'weight' => 9,
'type' => 'form',
'form_id' => 'islandora_streaming_edit_streams_form',
'module' => 'islandora_streaming',
'file' => 'includes/streaming_edit_streams.form.inc',
),
'islandora_streaming_upload' => array(
'weight' => 10,
'type' => 'form',
'form_id' => 'islandora_streaming_upload_form',
'module' => 'islandora_streaming',
'file' => 'includes/streaming_file_upload.form.inc',
),
);
}
/**
* Implements hook_islandora_edit_datastream_registry().
*/
function islandora_streaming_islandora_edit_datastream_registry(AbstractObject $object, AbstractDatastream $datastream) {
if (($datastream->id) == 'STREAMING') {
return array(
array(
'Name' => t('Edit Streaming Sources'),
'url' => "islandora/object/{$object->id}/manage/object/streamingsources/edit",
'weight' => 5,
),
);
}
}