Project

General

Profile

Download (5.75 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
// $Id$
3

    
4
/*
5
 * @file
6
 * An optional media gallery for the CDM DataPortal based on the FSI viewer
7
 *
8
 * Copyright (C) 2011 EDIT
9
 * European Distributed Institute of Taxonomy
10
 * http://www.e-taxonomy.eu
11
 *
12
 * The contents of this file are subject to the Mozilla Public License Version 1.1
13
 * See http://www.mozilla.org/MPL/MPL-1.1.html for the full license terms.
14
 *
15
 * Author:Andreas Kohlbecker
16
 */
17

    
18
/**
19
 * Display help and module information
20
 * @param path which path of the site we're displaying help
21
 * @param arg array that holds the current path as would be returned from arg() function
22
 * @return help text for the path
23
 */
24
function fsi_gallery_help($section) {
25
  $output = '';
26
  switch ($section) {
27
    case 'admin/help#fsi_gallery':
28
      $output = '<p>'. t("An optional media gallery for the CDM DataPortal based on the FSI viewer") .'</p>';
29
      break;
30
  }
31
  return $output;
32
}
33

    
34
/**
35
 * Generate the HTML text for the ext_link login block
36
 * @param op the operation from the URL
37
 * @param delta offset
38
 * @returns block HTML
39
 */
40
function fsi_gallery_admin() {
41

    
42
	$form['fsi_query'] = array(
43
      '#type' => 'textfield',
44
      '#title' => t('FSI Viewer query'),
45
      '#default_value' => variable_get('fsi_query', "{name}"),
46
      '#maxlength' => 255,
47
	  '#required' => TRUE,
48
	  '#description' => "<p>" . t("You must at least add {name}, to search images matching a specific taxon name. You also can add other search terms which can be combined with 'AND' or 'OR'.")  . "<p></p>" . t("For a comprehensive documentation please refer to ") .
49
			l("NeptuneLabs FSI Manual.pdf ", "http://erez-server.dyndns.org/erez/pdf/NeptuneLabs%20FSI%20Manual.pdf")
50
			. t("or") . t(" to ")
51
			. l("eRez Imaging Server 5 Advanced Configuration ", "http://erez-server.dyndns.org/erez/html/Advanced%20Configuration.html")
52
			. "</p>"
53

    
54
	);
55
	/*
56
	 * not yet used
57
	$form['fsi_name_substitutions'] = array(
58
      '#type' => 'textarea',
59
      '#title' => t('Taxon name subtitution rules'),
60
      '#default_value' => variable_get('fsi_name_substitutions', false),
61
      '#description' => t("One regex substitution rule per line")
62
	);
63
	*/
64
	$form['fsi_caption'] = array(
65
      '#type' => 'textarea',
66
      '#title' => t("Gallery caption"),
67
      '#default_value' => variable_get('fsi_caption', false),
68
      '#description' => t("Copyright statements or similar text can be entered here.")
69
	);
70

    
71
	return system_settings_form($form);
72
}
73

    
74

    
75
/**
76
* Implementation of hook_menu().
77
*/
78
function fsi_gallery_menu($may_cache) {
79

    
80
  $items = array();
81

    
82
  	if (!$may_cache) {
83

    
84
	  $items[] = array(
85
	    'path' => 'admin/settings/cdm_dataportal/fsi_gallery',
86
	    'title' => t('FSI Gallery'),
87
	    'description' => t('An optional media gallery for the CDM DataPortal based on the FSI viewer'),
88
	    'callback' => 'drupal_get_form',
89
	    'callback arguments' => 'fsi_gallery_admin',
90
	    'access' => user_access('access administration pages'),
91
	    'type' => MENU_NORMAL_ITEM,
92
	  	'weight' => 10
93
	   );
94
  	}
95

    
96
  return $items;
97
}
98

    
99
function _showcase_query_name($taxon){
100

    
101
	$taggedName = $taxon->name->taggedName;
102

    
103
    $nameArray = array();
104
    foreach($taggedName as $taggedText){
105
      if($taggedText->type == 'name'){
106
        $nameArray[] = $taggedText->text;
107
      }
108
      if($taggedText->type == 'rank'){
109
        $nameArray[] = substr($taggedText->text, 0 ,1);
110
      }
111
    }
112

    
113
	return join("%5F", $nameArray);
114
}
115

    
116

    
117
function theme_fsi_gallery($taxon, $media) {
118

    
119

    
120
    $query = variable_get('fsi_query', "{name}");
121
    $query = str_replace("{name}", _showcase_query_name($taxon), $query);
122
    $out = '
123

    
124
<script type="text/javascript" src="http://media.bgbm.org/erez/js/fsiwriter.js"></script>
125

    
126
<script type="text/javascript">
127
<!--
128
  writeFlashCode( "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&param_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343&plugins=textbox,fullscreen",
129
    "http://media.bgbm.org/erez/erez?src=erez-private/flashrequired.svg&tmp=Large&quality=97&width=620&height=400",
130
    "width=620;height=400;bgcolor=454343;wmode=opaque");
131
// -->
132
</script>
133
<noscript>
134
  <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">
135
    <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&param_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=textbox,fullscreen"/>
136
    <param name="bgcolor" value="454343" />
137
    <param name="wmode" value="opaque" />
138
    <param name="allowscriptaccess" value="always" />
139
    <param name="allowfullscreen" value="true" />
140
    <param name="quality" value="high" />
141
    <embed src="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&param_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=PrintSave,textbox,fullscreen"
142
      width="620"
143
      height="400"
144
      bgcolor="454343"
145
      wmode="opaque"
146
      allowscriptaccess="always"
147
      allowfullscreen="true"
148
      quality="high"
149
      type="application/x-shockwave-flash"
150
      pluginspage="http://www.adobe.com/go/getflashplayer">
151
    </embed>
152
  </object>
153

    
154
</noscript>';
155

    
156
    if(variable_get('fsi_caption', false)) {
157
    	$out .= '<div id="fsi_caption">' . check_markup( variable_get('fsi_caption', false) ) . '</div>';
158
    }
159
    return $out;
160

    
161
}
(2-2/2)