1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* An optional media gallery for the CDM DataPortal based on the FSI viewer.
|
5
|
*
|
6
|
* @copyright
|
7
|
* (C) 2007-2012 EDIT
|
8
|
* European Distributed Institute of Taxonomy
|
9
|
* http://www.e-taxonomy.eu
|
10
|
*
|
11
|
* The contents of this module are subject to the Mozilla
|
12
|
* Public License Version 1.1.
|
13
|
* @see http://www.mozilla.org/MPL/MPL-1.1.html
|
14
|
*
|
15
|
* @author
|
16
|
* - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
|
17
|
* - Wouter Addink <w.addink@eti.uva.nl> (migration from Drupal 5 to Drupal7)
|
18
|
*/
|
19
|
|
20
|
/*
|
21
|
* @file An optional media gallery for the CDM DataPortal based on the FSI
|
22
|
* viewer Copyright (C) 2011 EDIT European Distributed Institute of Taxonomy
|
23
|
* http://www.e-taxonomy.eu The contents of this file are subject to the Mozilla
|
24
|
* Public License Version 1.1 See http://www.mozilla.org/MPL/MPL-1.1.html for
|
25
|
* the full license terms. Author:Andreas Kohlbecker
|
26
|
*/
|
27
|
|
28
|
/**
|
29
|
* Display help and module information.
|
30
|
*
|
31
|
* @param string $path
|
32
|
* Which path of the site we're displaying help.
|
33
|
* @param array $arg
|
34
|
* Array that holds the current path as would be returned from arg() function.
|
35
|
*
|
36
|
* @return string
|
37
|
* Help text for the path.
|
38
|
*/
|
39
|
function fsi_gallery_help($path, $arg) {
|
40
|
$output = '';
|
41
|
switch ($path) {
|
42
|
case 'admin/help#fsi_gallery':
|
43
|
$output = '<p>' . t("An optional media gallery for the CDM DataPortal based on the FSI viewer") . '</p>';
|
44
|
break;
|
45
|
}
|
46
|
return $output;
|
47
|
}
|
48
|
|
49
|
/**
|
50
|
* Generate the HTML text for the ext_link login block.
|
51
|
*/
|
52
|
function fsi_gallery_admin($form, &$form_state) {
|
53
|
$form['fsi_query'] = array(
|
54
|
'#type' => 'textfield',
|
55
|
'#title' => t('FSI Viewer query'),
|
56
|
'#default_value' => variable_get('fsi_query', '{name}'),
|
57
|
'#maxlength' => 255,
|
58
|
'#required' => TRUE,
|
59
|
'#description' => '<p>' . t("You must at least add {name}, to search images
|
60
|
matching a specific taxon name. You also can add other search terms which
|
61
|
can be combined with 'AND' or 'OR'.") . '<p></p>'
|
62
|
. t('For a comprehensive documentation please refer to !link1 or to !link2.', array (
|
63
|
'!link1' => l(t('NeptuneLabs FSI Manual.pdf'), 'http://erez-server.dyndns.org/erez/pdf/NeptuneLabs%20FSI%20Manual.pdf'),
|
64
|
'!link2' => l(t('eRez Imaging Server 5 Advanced Configuration'), 'http://erez-server.dyndns.org/erez/html/Advanced%20Configuration.html'),
|
65
|
)) . '</p>',
|
66
|
);
|
67
|
/*
|
68
|
* not yet used $form['fsi_name_substitutions'] = array( '#type' =>
|
69
|
* 'textarea', '#title' => t('Taxon name subtitution rules'), '#default_value'
|
70
|
* => variable_get('fsi_name_substitutions', FALSE), '#description' => t("One
|
71
|
* regex substitution rule per line") );
|
72
|
*/
|
73
|
$form['fsi_caption'] = array(
|
74
|
'#type' => 'textarea',
|
75
|
'#title' => t('Gallery caption'),
|
76
|
'#default_value' => variable_get('fsi_caption', FALSE),
|
77
|
'#description' => t('Copyright statements or similar text can be entered here.'),
|
78
|
);
|
79
|
|
80
|
return system_settings_form($form);
|
81
|
}
|
82
|
|
83
|
/**
|
84
|
* Implements hook_menu().
|
85
|
*/
|
86
|
function fsi_gallery_menu() {
|
87
|
$items = array();
|
88
|
|
89
|
$items['admin/config/cdm_dataportal/fsi_gallery'] = array(
|
90
|
'title' => 'FSI Gallery',
|
91
|
'description' => 'An optional media gallery for the CDM DataPortal based on the FSI viewer.',
|
92
|
'page callback' => 'drupal_get_form',
|
93
|
'page arguments' => array('fsi_gallery_admin'),
|
94
|
'access arguments' => array('access administration pages'),
|
95
|
'type' => MENU_NORMAL_ITEM,
|
96
|
'weight' =>40,
|
97
|
);
|
98
|
|
99
|
return $items;
|
100
|
}
|
101
|
|
102
|
/**
|
103
|
* @todo document this function.
|
104
|
*/
|
105
|
function _showcase_query_name($taxon) {
|
106
|
$taggedName = $taxon->name->taggedName;
|
107
|
|
108
|
$nameArray = array();
|
109
|
foreach ($taggedName as $taggedText) {
|
110
|
if ($taggedText->type == 'name') {
|
111
|
$nameArray[] = $taggedText->text;
|
112
|
}
|
113
|
if ($taggedText->type == 'rank') {
|
114
|
$nameArray[] = substr($taggedText->text, 0, 1);
|
115
|
}
|
116
|
}
|
117
|
|
118
|
return join("%5F", $nameArray);
|
119
|
}
|
120
|
/**
|
121
|
* @todo Please document this function.
|
122
|
* @see http://drupal.org/node/1354
|
123
|
*/
|
124
|
function theme_fsi_gallery($variables) {
|
125
|
|
126
|
$taxon = $variables['taxon'];
|
127
|
$media = $variables['media'];
|
128
|
|
129
|
$query = variable_get('fsi_query', "{name}");
|
130
|
$query = str_replace("{name}", _showcase_query_name($taxon), $query);
|
131
|
|
132
|
// see http://www.adobe.com/cn/devnet/flashplayer/articles/swfobject.html
|
133
|
drupal_add_js(drupal_get_path('module', 'fsi_gallery') . '/js/swfobject-debug.js');
|
134
|
|
135
|
$out = '
|
136
|
<script type="text/javascript">
|
137
|
<!--
|
138
|
var flashvars = {}; // can be used for the swf URI query parameters
|
139
|
|
140
|
var params = {};
|
141
|
params.menu = "false";
|
142
|
params.quality = "high"; // low
|
143
|
params.width="620";
|
144
|
params.height="400";
|
145
|
params.bgcolor="#454343";
|
146
|
params.wmode="opaque";
|
147
|
params.allowscriptaccess="always";
|
148
|
params.allowfullscreen="true";
|
149
|
|
150
|
swfobject.embedSWF(
|
151
|
"http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query='
|
152
|
. $query . '&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50&'
|
153
|
. 'param_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343&plugins=textbox,fullscreen",
|
154
|
"default-gallery-viewer" , // id of alternative content
|
155
|
"620", // width
|
156
|
"400", // height
|
157
|
"11", // swfVersionStr (required) specifies the Flash Player version for which your content is published
|
158
|
false,
|
159
|
params,
|
160
|
flashvars
|
161
|
);
|
162
|
// -->
|
163
|
</script>
|
164
|
<noscript>
|
165
|
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="470" height="400">
|
166
|
<param name="movie" value="http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query=' . $query . '&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50¶m_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=textbox,fullscreen"/>
|
167
|
<param name="bgcolor" value="454343" />
|
168
|
<param name="wmode" value="opaque" />
|
169
|
<param name="allowscriptaccess" value="always" />
|
170
|
<param name="allowfullscreen" value="true" />
|
171
|
<param name="quality" value="high" />
|
172
|
<embed src="http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query='
|
173
|
. $query . '&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50¶m_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=PrintSave,textbox,fullscreen"
|
174
|
width="620"
|
175
|
height="400"
|
176
|
bgcolor="454343"
|
177
|
wmode="opaque"
|
178
|
allowscriptaccess="always"
|
179
|
allowfullscreen="true"
|
180
|
quality="high"
|
181
|
type="application/x-shockwave-flash"
|
182
|
pluginspage="http://www.adobe.com/go/getflashplayer">
|
183
|
</embed>
|
184
|
</object>
|
185
|
</noscript>';
|
186
|
|
187
|
if (variable_get('fsi_caption', FALSE)) {
|
188
|
$out .= '<div id="fsi_caption">' . variable_get('fsi_caption', FALSE) . '</div>';
|
189
|
}
|
190
|
return $out;
|
191
|
}
|
192
|
/**
|
193
|
* @todo Please document this function.
|
194
|
* @see http://drupal.org/node/1354
|
195
|
*/
|
196
|
function fsi_gallery_theme() {
|
197
|
return array(
|
198
|
'fsi_gallery' => array('variables' => array('taxon' => NULL, 'media' => NULL)),
|
199
|
);
|
200
|
}
|