Project

General

Profile

« Previous | Next » 

Revision 281c9477

Added by Alex Theys almost 12 years ago

AT: committing External links changes to Dataportal

View differences:

5.x/modules/cdm_dataportal/ext_links/ext_links.js
1 1
function popupExternalLinks( x_url)
2 2
{
3 3
	var		oWindow = null;
4
	var		iWidth = 820;
4
	var		iWidth = 1050;
5 5
	var		iHeight = 700;
6
	oWindow = window.open( x_url, "POPUP_EXTERNAL_LINKS", "dependent=yes,locationbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no,screenX=0,screenY=0,height="+iHeight+",width="+iWidth); 
6
	oWindow = window.open( x_url, "POPUP_EXTERNAL_LINKS", "dependent=yes,locationbar=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes,status=no,screenX=0,screenY=0,height="+iHeight+",width="+iWidth); 
7 7
	if( top.window.opener)
8 8
	oWindow.opener = top.window.opener;
9 9
	oWindow.focus();
5.x/modules/cdm_dataportal/ext_links/ext_links.module
13 13
 * @return help text for the path
14 14
 */
15 15
function ext_links_help($section) {
16
  $output = '';
17
  switch ($section) { 
18
    case 'admin/help#ext_links':
19
      //TODO
20
      $output = '<p>'. t("Link to external sources like ## for taxa.") .'</p>';
21
      break;
22
  }
23
  return $output;
16
	$output = '';
17
	switch ($section) {
18
		case 'admin/help#ext_links':
19
			//TODO
20
			$output = '<p>'. t("Link to external sources like ## for taxa.") .'</p>';
21
			break;
22
	}
23
	return $output;
24 24
} // function ext_links_help
25 25

  
26 26
/**
27 27
 * Generate the HTML text for the ext_link login block
28 28
 * @param op the operation from the URL
29 29
 * @param delta offset
30
 * @returns block HTML 
30
 * @returns block HTML
31 31
 */
32 32
function ext_links_admin() {
33 33
	global $ext_links_default;
......
40 40
		'concat_default_value' => ' ',
41 41
		'text_title' => 'GBIF text',
42 42
		'text_description' => 'The text of the link that is displayed..',
43
		'category' => 'Category',
43 44
	);
44 45
	$ext_links[1] = array(
45 46
		'form' => 'biocase',
......
50 51
		'concat_default_value' => ' ',
51 52
		'text_title' => 'BioCASE text',
52 53
		'text_description' => 'The text of the link that is displayed..',
54
		'category' => 'Category',
53 55
	);
54 56
	$ext_links[2] = array(
55 57
		'form' => 'nybg',
......
60 62
		'concat_default_value' => ' ',
61 63
		'text_title' => 'NYBG text',
62 64
		'text_description' => 'The text of the link that is displayed..',
65
		'category' => 'Category',
63 66
	);
64 67
	$ext_links[3] = array(
65 68
		'form' => 'tropicos',
......
70 73
		'concat_default_value' => '+',
71 74
		'text_title' => 'Tropicos text',
72 75
		'text_description' => 'The text of the link that is displayed..',
76
		'category' => 'Category',
73 77
	);
74 78
	$ext_links[4] = array(
75 79
		'form' => 'ncbi',
......
80 84
		'concat_default_value' => '+AND+',
81 85
		'text_title' => 'NCBI text',
82 86
		'text_description' => 'The text of the link that is displayed..',
87
		'category' => 'Category',
83 88
	);
84 89
	$ext_links[5] = array(
85 90
		'form' => 'google',
......
90 95
		'concat_default_value' => '+',
91 96
		'text_title' => 'Google Images text',
92 97
		'text_description' => 'The text of the link that is displayed..',
98
		'category' => 'Category',
93 99
	);
94 100
	$ext_links[6] = array(
95 101
		'form' => 'flickr',
......
100 106
		'concat_default_value' => '+',
101 107
		'text_title' => 'flickr text',
102 108
		'text_description' => 'The text of the link that is displayed..',
109
		'category' => 'Category',
103 110
	);
104 111
	$ext_links[7] = array(
105 112
		'form' => 'scholar',
......
110 117
		'concat_default_value' => '+',
111 118
		'text_title' => 'Google scholar text',
112 119
		'text_description' => 'The text of the link that is displayed..',
120
		'category' => 'Category',
113 121
	);
114 122
	$ext_links[8] = array(
115 123
		'form' => 'bhl',
......
120 128
		'concat_default_value' => ' ',
121 129
		'text_title' => 'BHL text',
122 130
		'text_description' => 'The text of the link that is displayed..',
131
		'category' => 'Category',
132
	);
133
	$ext_links[9] = array(
134
		'form' => 'arkive',
135
		'form_title' => 'ARKive',
136
		'check_title' => 'Display ARKive link?',
137
		'link_title' => 'ARKive link',
138
		'link_description' => 'The link to ARKive without the taxon name.',
139
		'concat_default_value' => '+',
140
		'text_title' => 'ARKive text',
141
		'text_description' => 'The text of the link that is displayed..',
142
		'category' => 'Category',
143
	);
144
	$ext_links[10] = array(
145
		'form' => 'herbcat',
146
		'form_title' => 'Kew Herbarium Catalogue',
147
		'check_title' => 'Display Kew Herbarium Catalogue link?',
148
		'link_title' => 'Kew Herbarium Catalogue link',
149
		'link_description' => 'The link to Kew Herbarium Catalogue without the taxon name.',
150
		'concat_default_value' => '+',
151
		'text_title' => 'Kew Herbarium Catalogue text',
152
		'text_description' => 'The text of the link that is displayed..',
153
		'category' => 'Category',
154
	);
155
	$ext_links[11] = array(
156
		'form' => 'iucn',
157
		'form_title' => 'IUCN Red List',
158
		'check_title' => 'Display IUCN Red List link?',
159
		'link_title' => 'IUCN Red List link',
160
		'link_description' => 'The link to IUCN Red List without the taxon name.',
161
		'concat_default_value' => ' ',
162
		'text_title' => 'IUCN Red List text',
163
		'text_description' => 'The text of the link that is displayed..',
164
		'category' => 'Category',
165
	);
166
	$ext_links[12] = array(
167
		'form' => 'ipni',
168
		'form_title' => 'IPNI',
169
		'check_title' => 'Display IPNI link?',
170
		'link_title' => 'IPNI link',
171
		'link_description' => 'The link to IPNI without the taxon name.',
172
		'concat_default_value' => '&',
173
		'text_title' => 'IPNI text',
174
		'text_description' => 'The text of the link that is displayed..',
175
		'category' => 'Category',
176
	);
177
	$ext_links[13] = array(
178
		'form' => 'wcsp',
179
		'form_title' => 'World Checklist of Monocots',
180
		'check_title' => 'Display World Checklist of Monocots link?',
181
		'link_title' => 'World Checklist of Monocots link',
182
		'link_description' => 'The link to World Checklist of Monocots without the taxon name.',
183
		'concat_default_value' => ' ',
184
		'text_title' => 'World Checklist of Monocots text',
185
		'text_description' => 'The text of the link that is displayed..',
186
		'category' => 'Category',
187
	);
188
	$ext_links[14] = array(
189
		'form' => 'tpl',
190
		'form_title' => 'The Plant List',
191
		'check_title' => 'Display The Plant List link?',
192
		'link_title' => 'The Plant List link',
193
		'link_description' => 'The link to The Plant List without the taxon name.',
194
		'concat_default_value' => '+',
195
		'text_title' => 'The Plant List text',
196
		'text_description' => 'The text of the link that is displayed..',
197
		'category' => 'Category',
123 198
	);
199
	$ext_links[15] = array(
200
		'form' => 'eol',
201
		'form_title' => 'Encyclopaedia of Life',
202
		'check_title' => 'Display Encyclopaedia of Life link?',
203
		'link_title' => 'Encyclopaedia of Life link',
204
		'link_description' => 'The link to Encyclopaedia of Life without the taxon name.',
205
		'concat_default_value' => '+',
206
		'text_title' => 'Encyclopaedia of Life text',
207
		'text_description' => 'The text of the link that is displayed..',
208
		'category' => 'Category',
209
	);
210
	$ext_links[16] = array(
211
		'form' => 'jstor',
212
		'form_title' => 'JSTOR Plant Science',
213
		'check_title' => 'Display JSTOR Plant Science link?',
214
		'link_title' => 'JSTOR Plant Science link',
215
		'link_description' => 'The link to JSTOR Plant Science without the taxon name.',
216
		'concat_default_value' => ' ',
217
		'text_title' => 'JSTOR Plant Science text',
218
		'text_description' => 'The text of the link that is displayed..',
219
		'category' => 'Category',
220
	);
221
	$ext_links[17] = array(
222
		'form' => 'epic',
223
		'form_title' => 'ePIC',
224
		'check_title' => 'Display ePIC link?',
225
		'link_title' => 'ePIC link',
226
		'link_description' => 'The link to ePIC without the taxon name.',
227
		'concat_default_value' => '+',
228
		'text_title' => 'ePIC text',
229
		'text_description' => 'The text of the link that is displayed..',
230
		'category' => 'Category',
231
	);
232
	$ext_links[18] = array(
233
		'form' => 'fairchild',
234
		'form_title' => 'Fairchild Guide To Palms',
235
		'check_title' => 'Display Fairchild Guide To Palms link?',
236
		'link_title' => 'Fairchild Guide To Palms link',
237
		'link_description' => 'The link to Fairchild Guide To Palms without the taxon name.',
238
		'concat_default_value' => '+',
239
		'text_title' => 'Fairchild Guide To Palms text',
240
		'text_description' => 'The text of the link that is displayed..',
241
		'category' => 'Category',
242
	);
243
	
124 244

  
125 245
	for($i=0; $i<sizeof($ext_links); $i++){
126
	  $form[$ext_links[$i][form]] = array(
246
		$form[$ext_links[$i][form]] = array(
127 247
	    '#type' => 'fieldset',
128 248
	    '#title' => t($ext_links[$i][form_title]),
129 249
	    '#collapsible' => TRUE,
130 250
	    '#collapsed' => TRUE,
131
	  );
132
	  $form[$ext_links[$i][form]]['ext_links_'.$ext_links[$i][form].'_check'] = array(
251
		);
252
		$form[$ext_links[$i][form]]['ext_links_'.$ext_links[$i][form].'_check'] = array(
133 253
	    '#type' => 'checkbox',
134 254
	    '#title' => t($ext_links[$i][check_title]),
135 255
	    '#default_value' => variable_get('ext_links_'.$ext_links[$i][form].'_check', 1),
136
	  );
137
	  $form[$ext_links[$i][form]]['ext_links_'.$ext_links[$i][form].'_link'] = array(
256
		);
257
		$form[$ext_links[$i][form]]['ext_links_'.$ext_links[$i][form].'_link'] = array(
138 258
	    '#type' => 'textfield',
139 259
	    '#title' => t($ext_links[$i][link_title]),
140 260
	    '#default_value' => variable_get('ext_links_'.$ext_links[$i][form].'_link', $ext_links_default[$ext_links[$i][form]][link_default_value]),
141 261
	    '#size' => 70,
142 262
	    '#maxlength' => 255,
143 263
	    '#description' => t($ext_links[$i][link_description])
144
	  );
145
	  $form[$ext_links[$i][form]]['ext_links_'.$ext_links[$i][form].'_concat'] = array(
264
		);
265
		$form[$ext_links[$i][form]]['ext_links_'.$ext_links[$i][form].'_concat'] = array(
146 266
	    '#type' => 'textfield',
147 267
	    '#title' => t('Concatenate string'),
148 268
	    '#default_value' => variable_get('ext_links_'.$ext_links[$i][form].'_concat', $ext_links[$i][concat_default_value]),
149 269
	    '#size' => 70,
150 270
	    '#maxlength' => 255,
151 271
	    '#description' => t('Concatenate string between genus and species')
152
	  );
153
	$form[$ext_links[$i][form]]['ext_links_'.$ext_links[$i][form].'_text'] = array(
272
		);
273
		$form[$ext_links[$i][form]]['ext_links_'.$ext_links[$i][form].'_text'] = array(
154 274
	    '#type' => 'textfield',
155 275
	    '#title' => t($ext_links[$i][text_title]),
156 276
	    '#default_value' => variable_get('ext_links_'.$ext_links[$i][form].'_text', $ext_links_default[$ext_links[$i][form]][text_default_value]),
157 277
	    '#size' => 70,
158 278
	    '#maxlength' => 255,
159 279
	    '#description' => t($ext_links[$i][text_description])
160
	  );
280
		);
281
		$form[$ext_links[$i][form]]['ext_links_'.$ext_links[$i][form].'_category'] = array(
282
	    '#type' => 'textfield',
283
	    '#title' => t($ext_links[$i][category]),
284
	    '#default_value' => variable_get('ext_links_'.$ext_links[$i][form].'_category', $ext_links_default[$ext_links[$i][form]][category_default_value]),
285
	    '#size' => 70,
286
	    '#maxlength' => 255,
287
	    '#description' => t($ext_links[$i][category])
288
		);
161 289
	}
162
  return system_settings_form($form);
290
	$form['ext_links_options'] = array(
291
		'#type' => 'checkbox',
292
		'#title' => t('Enable sorted list with headings'),
293
		'#default_value' => variable_get('ext_links_options', 0),
294
		'#prefix' => "<div class = \"sorted_list_option\"",
295
		'#suffix' => "</div>",
296
	);
297

  
298
	return system_settings_form($form);
163 299
} // function ext_links_admin()
164 300

  
165 301
function ext_links_perm() {
......
169 305
} // function onthisdate_perm
170 306

  
171 307
/**
172
* Implementation of hook_menu().
173
*/
308
 * Implementation of hook_menu().
309
 */
174 310
function ext_links_menu() {
175 311

  
176 312
	// default values for the external links defined as global variables
177
 	global $ext_links_default;
313
	global $ext_links_default;
178 314
	$ext_links_default["gbif"] = array(
179 315
		'link_default_value' => 'http://data.gbif.org/species/',
180 316
		'text_default_value' => 'Search GBIF...',
181
 	); 
317
		'category_default_value' => 'Specimens/Occurrences',
318
	);
182 319
	$ext_links_default["biocase"] = array(
183 320
 		'link_default_value' => 'http://search.biocase.org/edit/search/units/simpleSearch/query1?unitName=',
184 321
		'text_default_value' => 'Search BioCASE...',
185
 	); 
186
 	$ext_links_default["nybg"] = array(
322
	'category_default_value' => 'Specimens/Occurrences',
323
	);
324
	$ext_links_default["nybg"] = array(
187 325
 		'link_default_value' => 'http://rbg-web2.rbge.org.uk/cgi-bin/nph-readbtree.pl/dataset=NYBG/filename=names3/firstval=1/multiaddr=/multiform=multisite3.php?ETI=',
188 326
		'text_default_value' => 'Search NYBG...',
189
 	); 
327
		'category_default_value' => 'Specimens/Occurrences',
328
	);
190 329
	$ext_links_default["tropicos"] = array(
191 330
		'link_default_value' => 'http://www.tropicos.org/NameSearch.aspx?name=',
192 331
		'text_default_value' => 'Search Tropicos...',
193
	); 
194
 	$ext_links_default["ncbi"] = array(
332
	'category_default_value' => 'Specimens/Occurrences',
333
	);
334
	$ext_links_default["ncbi"] = array(
195 335
		'link_default_value' => 'http://www.ncbi.nlm.nih.gov/gquery/gquery.fcgi?term=',
196 336
		'text_default_value' => 'Search NCBI...',
197
 		); 
198
 	$ext_links_default["google"] = array(
337
		'category_default_value' => 'Molecular Resources',
338
	);
339
	$ext_links_default["google"] = array(
199 340
		'link_default_value' => 'http://images.google.com/images?q=',
200 341
		'text_default_value' => 'Search Google Images...',
201
 	); 
202
 	$ext_links_default["flickr"] = array(
342
		'category_default_value' => 'Images',
343
	);
344
	$ext_links_default["flickr"] = array(
203 345
		'link_default_value' => 'http://www.flickr.com/search/?w=all&q=',
204 346
		'text_default_value' => 'Search flickr...',
205
 	); 
206
 	$ext_links_default["scholar"] = array(
347
		'category_default_value' => 'Images',	
348
	);
349
	$ext_links_default["scholar"] = array(
207 350
		'link_default_value' => 'http://scholar.google.de/scholar?hl=de&btnG=Suche&lr=&as_ylo=&as_vis=0&q=',
208 351
		'text_default_value' => 'Search Google scholar...',
209
 	); 
210
 	$ext_links_default["bhl"] = array(
352
		'category_default_value' => 'Literature',
353
	);
354
	$ext_links_default["bhl"] = array(
211 355
		'link_default_value' => 'http://www.biodiversitylibrary.org/Search.aspx?searchCat=&searchTerm=',
212 356
		'text_default_value' => 'Search BHL...',
213
 	); 
214
 	
357
		'category_default_value' => 'Literature',
358
	);
359
	$ext_links_default["arkive"] = array(
360
		'link_default_value' => 'http://www.arkive.org/search.html?q=',
361
		'text_default_value' => 'Search ARKive...',
362
		'category_default_value' => 'Images',
363
	);
364
	$ext_links_default["herbcat"] = array(
365
		'link_default_value' => 'http://apps.kew.org/herbcat/getHomePageResults.do?homePageSearchText=',
366
		'text_default_value' => 'Search Kew Herbarium Catalogue...',
367
		'category_default_value' => 'Specimens/Occurrences',
368
	);
369
	$ext_links_default["iucn"] = array(
370
		'link_default_value' => 'http://www.iucnredlist.org/',
371
		'text_default_value' => 'Go to IUCN Red List...',
372
		'category_default_value' => 'Conservation',
373
	);
374
	$ext_links_default["ipni"] = array(
375
		'link_default_value' => 'http://www.ipni.org/ipni/advPlantNameSearch.do?',
376
		'text_default_value' => 'Search IPNI...',
377
		'category_default_value' => 'Classification',
378
	);
379
		
380
	$ext_links_default["wcsp"] = array(
381
		'link_default_value' => 'http://apps.kew.org/wcsp/prepareChecklist.do?checklist=monocots%40%40150290520121019541',
382
		'text_default_value' => 'Search World Checklist Monocots...',
383
		'category_default_value' => 'Classification',
384
	);
385
	$ext_links_default["tpl"] = array(
386
		'link_default_value' => 'http://www.theplantlist.org/tpl/search?q=',
387
		'text_default_value' => 'Search The Plant List...',
388
		'category_default_value' => 'Classification',
389
	);
390
	$ext_links_default["eol"] = array(
391
		'link_default_value' => 'http://eol.org/search/?q=',
392
		'text_default_value' => 'Search Encyclopaedia of Life...',
393
		'category_default_value' => 'General',
394
	);
395
	$ext_links_default["jstor"] = array(
396
		'link_default_value' => 'http://plants.jstor.org/search?searchText=',
397
		'text_default_value' => 'Search JSTOR Plant Science...',
398
		'category_default_value' => 'General',
399
	);
400
	$ext_links_default["epic"] = array(
401
		'link_default_value' => 'http://epic.kew.org/searchepic/summaryquery.do?scientificName=',
402
		'text_default_value' => 'Search ePIC...',
403
		'category_default_value' => 'General',
404
	);
405
		$ext_links_default["fairchild"] = array(
406
		'link_default_value' => 'http://palmguide.org/palmsearch.php?query=',
407
		'text_default_value' => 'Search Fairchild Guide To Palms...',
408
		'category_default_value' => 'Specimens/Occurrences',
409
	);
215 410
	$items = array();
216 411

  
217
  $items[] = array(
412
	$items[] = array(
218 413
    'path' => 'admin/settings/extlinks',
219 414
    'title' => t('External links'),
220 415
    'description' => t('Description of your External links'),
......
222 417
    'callback arguments' => 'ext_links_admin',
223 418
    'access' => user_access('access administration pages'),
224 419
    'type' => MENU_NORMAL_ITEM,
225
   );
420
	);
226 421

  
227
  return $items;
422
	return $items;
228 423
} // function ext_links_menu()
229 424

  
230 425
/**
......
238 433
	while(isset($taxon->name->taggedName[$i]) && !$speciesName[species]){
239 434
		if($taxon->name->taggedName[$i]->type == "name"){
240 435
			if(!isset($speciesName[genus]))
241
				$speciesName[genus] = $taxon->name->taggedName[$i]->text;
436
			$speciesName[genus] = $taxon->name->taggedName[$i]->text;
242 437
			else
243
				$speciesName[species] = $taxon->name->taggedName[$i]->text;
438
			$speciesName[species] = $taxon->name->taggedName[$i]->text;
244 439
		}
245 440
		$i++;
246 441
	}
......
250 445
 * Generate the HTML text for the ext_link login block
251 446
 * @param op the operation from the URL
252 447
 * @param delta offset
253
 * @returns block HTML 
448
 * @returns block HTML
254 449
 */
255 450
function ext_links_block($op='list', $delta=0) {
256
  // listing of blocks, such as on the admin/block page
451
	// listing of blocks, such as on the admin/block page
257 452
	global $ext_links_default;
258
	
259
   if ($op == "list"){
260
    	$block[0]["info"] = t("External Taxon Links");
453
	$listOption = variable_get("ext_links_options", 0);
454

  
455
	if ($op == "list"){
456
		$block[0]["info"] = t("External Taxon Links");
261 457
		return $block;
262
   } else if ($op == 'view') {
263
      switch($delta){
264
        case 0:
265
        		if (arg(0)=="cdm_dataportal" && arg(1)=="taxon" && arg(2)!== 0){
266
        			$uuid = arg(2);
267
        		    $taxon = cdm_ws_get(CDM_WS_PORTAL_TAXON, $uuid);
268
        		    //var_dump($taxon);
269
        		    //$taxon->titleCache;
270
        		    //var_export()
271
        		    if($taxon){
272
          		    	drupal_add_js(drupal_get_path('module', 'ext_links') . '/ext_links.js');
273
        		    	$speciesName = getSpeciesName($taxon);
274
          		    	$genus = $taxon->name->taggedName[0]->text;
275
          		    	$species = $taxon->name->taggedName[1]->text;
276
          		    	$block_content = '';
277
          		    	if(variable_get('ext_links_gbif_check', true)) {
278
          		    		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_gbif_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]).'</a><br />';
279
          		    		/*
280
          		    		$block_content .= l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
281
          		    		           'JavaScript:popupExternalLinks('.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).$speciesName[genus].variable_get('ext_links_gbif_concat', ' ').$speciesName[species],
282
          		    					array(), null, null, true);
283
          		    		*/
284
          		    	}
285
          		    	if(variable_get('ext_links_biocase_check', 1)) {
286
          		    		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_biocase_link', $ext_links_default[biocase][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_biocase_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_biocase_text', $ext_links_default[biocase][text_default_value]).'</a><br />';
287
          		    	}
288
          		    	if(variable_get('ext_links_nybg_check', 1)) {
289
          		    		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_nybg_link', $ext_links_default[nybg][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_nybg_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_nybg_text', $ext_links_default[nybg][text_default_value]).'</a><br />';
290
          		    	}
291
          		    	if(variable_get('ext_links_tropicos_check', 1)) {
292
          		    		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_tropicos_link', $ext_links_default[tropicos][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_tropicos_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_tropicos_text', $ext_links_default[tropicos][text_default_value]).'</a><br />';
293
          		    	}
294
          		    	if(variable_get('ext_links_ncbi_check', 1)) {
295
          		    		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_ncbi_link', $ext_links_default[ncbi][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_ncbi_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_ncbi_text', $ext_links_default[ncbi][text_default_value]).'</a><br />';
296
          		    	}
297
          		    	if(variable_get('ext_links_google_check', 1)) {
298
          		    		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_google_link', $ext_links_default[google][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_google_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_google_text', $ext_links_default[google][text_default_value]).'</a><br />';
299
          		    	}
300
          		    	if(variable_get('ext_links_flickr_check', 1)) {
301
          		    		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_flickr_link', $ext_links_default[flickr][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_flickr_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_flickr_text', $ext_links_default[flickr][text_default_value]).'</a><br />';
302
          		    	}
303
          		    	if(variable_get('ext_links_scholar_check', 1)) {
304
          		    		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_scholar_link', $ext_links_default[scholar][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_scholar_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_scholar_text', $ext_links_default[scholar][text_default_value]).'</a><br />';
305
          		    	}
306
          		    	if(variable_get('ext_links_bhl_check', 1)) {
307
          		    		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_bhl_link', $ext_links_default[bhl][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_bhl_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_bhl_text', $ext_links_default[bhl][text_default_value]).'</a><br />';
308
          		    	}
309
          			    $block['subject'] = 'External links';
310
          			    $block['content'] = $block_content;
311
	       				
312
          			    return $block;
313
  		          } // if taxon
314
  	  	} // if path
315
      } // switch 
316
    } // op ?
458
	} else if ($op == 'view') {
459
		switch($delta){
460
			case 0:
461
				$block['subject'] = 'External links';
462

  
463
				if (arg(0)=="cdm_dataportal" && arg(1)=="taxon" && arg(2)!== 0){
464
					$uuid = arg(2);
465
					$taxon = cdm_ws_get(CDM_WS_PORTAL_TAXON, $uuid);
466
					//var_dump($taxon);
467
					//$taxon->titleCache;
468
					//var_export()
469
					if($taxon){
470

  
471
						drupal_add_js(drupal_get_path('module', 'ext_links') . '/ext_links.js');
472
						$speciesName = getSpeciesName($taxon);
473
						$genus = $taxon->name->taggedName[0]->text;
474
						$species = $taxon->name->taggedName[1]->text;
475
						$block_content = '';
476
						if($listOption) {
477
							$block['content'] = theme('ext_links_list_grouped', $speciesName, $genus, $species);
478
						}
479
						else {
480
							$block['content'] = theme('ext_links_list_plain', $speciesName, $genus, $species );
481
						}
482
							
483
						//if(variable_get('ext_links_gbif_check', true)) {
484
						//$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_gbif_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]).'</a><br />';
485
						/*
486
						$block_content .= l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
487
						'JavaScript:popupExternalLinks('.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).$speciesName[genus].variable_get('ext_links_gbif_concat', ' ').$speciesName[species],
488
						array(), null, null, true);
489
						*/
490
						/*}
491
							if(variable_get('ext_links_biocase_check', 1)) {
492
							$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_biocase_link', $ext_links_default[biocase][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_biocase_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_biocase_text', $ext_links_default[biocase][text_default_value]).'</a><br />';
493
							}
494
							if(variable_get('ext_links_nybg_check', 1)) {
495
							$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_nybg_link', $ext_links_default[nybg][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_nybg_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_nybg_text', $ext_links_default[nybg][text_default_value]).'</a><br />';
496
							}
497
							if(variable_get('ext_links_tropicos_check', 1)) {
498
							$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_tropicos_link', $ext_links_default[tropicos][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_tropicos_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_tropicos_text', $ext_links_default[tropicos][text_default_value]).'</a><br />';
499
							}
500
							if(variable_get('ext_links_ncbi_check', 1)) {
501
							$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_ncbi_link', $ext_links_default[ncbi][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_ncbi_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_ncbi_text', $ext_links_default[ncbi][text_default_value]).'</a><br />';
502
							}
503
							if(variable_get('ext_links_google_check', 1)) {
504
							$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_google_link', $ext_links_default[google][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_google_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_google_text', $ext_links_default[google][text_default_value]).'</a><br />';
505
							}
506
							if(variable_get('ext_links_flickr_check', 1)) {
507
							$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_flickr_link', $ext_links_default[flickr][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_flickr_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_flickr_text', $ext_links_default[flickr][text_default_value]).'</a><br />';
508
							}
509
							if(variable_get('ext_links_scholar_check', 1)) {
510
							$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_scholar_link', $ext_links_default[scholar][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_scholar_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_scholar_text', $ext_links_default[scholar][text_default_value]).'</a><br />';
511
							}
512
							if(variable_get('ext_links_bhl_check', 1)) {
513
							$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_bhl_link', $ext_links_default[bhl][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_bhl_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_bhl_text', $ext_links_default[bhl][text_default_value]).'</a><br />';
514
							}
515

  
516
							$block['content'] = $block_content;
517
							$block['content'] = theme('ext_links_list_plain');
518

  
519

  
520

  
521
							}
522

  
523
							}*/ // if taxon
524
					}
525
				}
526
				return $block; // if path
527
		} // switch
528
	} // op ?
317 529
} // function ext_link_block()
318 530

  
531
function theme_ext_links_list_grouped($speciesName = null, $genus = null, $species=null) {
532
	global $ext_links_default;	
533
	$block_content = '';
534
	$categories = null;
535
	
536
	
537
	
538
	/*foreach ($ext_links_default as $ext_link) {
539
		
540
		//$block_content .= $ext_link['ext_links_bhl_category'];
541
		$category[] = variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
542
		$block_content .= variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
543
	}*/
544
	
545
	//images section
546
	if(variable_get('ext_links_google_check', 1)) {
547
		$categoryTitles[] = variable_get('ext_links_google_category', $ext_links_default[google][category_default_value]);
548
		$categories['google']['title'] = variable_get('ext_links_google_category', $ext_links_default[google][category_default_value]);
549
		$categories['google']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_google_link', $ext_links_default[google][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_google_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_google_text', $ext_links_default[google][text_default_value]).'</a><br />';
550
		 
551
	}
552
	if(variable_get('ext_links_flickr_check', 1)) {
553
		$categoryTitles[] = variable_get('ext_links_flickr_category', $ext_links_default[flickr][category_default_value]);
554
		$categories['flickr']['title'] = variable_get('ext_links_flickr_category', $ext_links_default[flickr][category_default_value]);
555
		$categories['flickr']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_flickr_link', $ext_links_default[flickr][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_flickr_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_flickr_text', $ext_links_default[flickr][text_default_value]).'</a><br />';
556
	}
557
	
558
	//Specimen/pccurences section
559
	if(variable_get('ext_links_gbif_check', true)) {
560
		$categoryTitles[] = variable_get('ext_links_gbif_category', $ext_links_default[gbif][category_default_value]);
561
		$categories['gbif']['title'] = variable_get('ext_links_gbif_category', $ext_links_default[gbif][category_default_value]);
562
		$categories['gbif']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_gbif_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]).'</a><br />';
563
	}
564
	if(variable_get('ext_links_biocase_check', 1)) {
565
		$categoryTitles[] = variable_get('ext_links_biocase_category', $ext_links_default[biocase][category_default_value]);
566
		$categories['biocase']['title'] = variable_get('ext_links_biocase_category', $ext_links_default[biocase][category_default_value]);
567
		$categories['biocase']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_biocase_link', $ext_links_default[biocase][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_biocase_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_biocase_text', $ext_links_default[biocase][text_default_value]).'</a><br />';
568
	}
569
	if(variable_get('ext_links_nybg_check', 1)) {
570
		$genusQuery = '';
571
		$speciesQuery = '';
572
		if($speciesName[genus] != null) {
573
			$genusQuery = 'DetFiledAsGenusLocal+%3D+\%27'. $speciesName[genus]. '\%27';
574
		}
575
		if($speciesName[species] != null) {
576
			$speciesQuery = 'DetFiledAsSpeciesLocal+%3D+\%27'. $speciesName[species] . '\%27';
577
		}
578
		$categoryTitles[] = variable_get('ext_links_nybg_category', $ext_links_default[nybg][category_default_value]);
579
		$categories['nybg']['title'] = variable_get('ext_links_nybg_category', $ext_links_default[nybg][category_default_value]);
580
		$categories['nybg']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_nybg_link', $ext_links_default[nybg][link_default_value]).$genusQuery.variable_get('ext_links_nybg_concat', '+AND+').$speciesQuery.'\')">'.variable_get('ext_links_nybg_text', $ext_links_default[nybg][text_default_value]).'</a><br />';
319 581

  
582
	}
583
	if(variable_get('ext_links_tropicos_check', 1)) {
584
		$categoryTitles[] = variable_get('ext_links_tropicos_category', $ext_links_default[tropicos][category_default_value]);
585
		$categories['tropicos']['title'] = variable_get('ext_links_tropicos_category', $ext_links_default[tropicos][category_default_value]);
586
		$categories['tropicos']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_tropicos_link', $ext_links_default[tropicos][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_tropicos_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_tropicos_text', $ext_links_default[tropicos][text_default_value]).'</a><br />';
587
	}
588
	
589
	
590
	//Literature
591
	if(variable_get('ext_links_scholar_check', 1)) {
592
		$categoryTitles[] = variable_get('ext_links_scholar_category', $ext_links_default[scholar][category_default_value]);
593
		$categories['scholar']['title'] = variable_get('ext_links_scholar_category', $ext_links_default[scholar][category_default_value]);
594
		$categories['scholar']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_scholar_link', $ext_links_default[scholar][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_scholar_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_scholar_text', $ext_links_default[scholar][text_default_value]).'</a><br />';
595
	}
596
	if(variable_get('ext_links_bhl_check', 1)) {
597
		$categoryTitles[] = variable_get('ext_links_bhl_category', $ext_links_default[bhl][category_default_value]);
598
		$categories['bhl']['title'] = variable_get('ext_links_bhl_category', $ext_links_default[bhl][category_default_value]);
599
		$categories['bhl']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_bhl_link', $ext_links_default[bhl][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_bhl_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_bhl_text', $ext_links_default[bhl][text_default_value]).'</a><br />';
600
	}
601
	
602
	
603
	//Molecular resources
604
	if(variable_get('ext_links_ncbi_check', 1)) {
605
		$categoryTitles[] = variable_get('ext_links_ncbi_category', $ext_links_default[ncbi][category_default_value]);
606
		$categories['ncbi']['title'] = variable_get('ext_links_ncbi_category', $ext_links_default[ncbi][category_default_value]);
607
		$categories['ncbi']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_ncbi_link', $ext_links_default[ncbi][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_ncbi_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_ncbi_text', $ext_links_default[ncbi][text_default_value]).'</a><br />';
608
	
609
	}
610
	if(variable_get('ext_links_arkive_check', 1)) {
611
		$postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
612
		$categoryTitles[] = variable_get('ext_links_arkive_category', $ext_links_default[arkive][category_default_value]);
613
		$categories['arkive']['title'] = variable_get('ext_links_arkive_category', $ext_links_default[arkive][category_default_value]);
614
		$categories['arkive']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_arkive_link', $ext_links_default[arkive][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_arkive_concat', '+').str_replace('"','%22',$speciesName[species]). $postURL .'\')">'.variable_get('ext_links_arkive_text', $ext_links_default[arkive][text_default_value]).'</a><br />';
615
	
616
	}
617
	if(variable_get('ext_links_herbcat_check', 1)) {
618
		$postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
619
		$categoryTitles[] = variable_get('ext_links_herbcat_category', $ext_links_default[herbcat][category_default_value]);
620
		$categories['herbcat']['title'] = variable_get('ext_links_herbcat_category', $ext_links_default[herbcat][category_default_value]);
621
		$categories['herbcat']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_herbcat_link', $ext_links_default[herbcat][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_herbcat_concat', '+').str_replace('"','%22',$speciesName[species]). $postURL .'\')">'.variable_get('ext_links_herbcat_text', $ext_links_default[herbcat][text_default_value]).'</a><br />';
622
	
623
	}
624
	if(variable_get('ext_links_iucn_check', 1)) {
625
		$categoryTitles[] = variable_get('ext_links_iucn_category', $ext_links_default[iucn][category_default_value]);
626
		$categories['iucn']['title'] = variable_get('ext_links_iucn_category', $ext_links_default[iucn][category_default_value]);
627
		$categories['iucn']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_iucn_link', $ext_links_default[iucn][link_default_value]).'\')">'.variable_get('ext_links_iucn_text', $ext_links_default[iucn][text_default_value]).'</a><br />';
628
	
629
	}
630
	if(variable_get('ext_links_ipni_check', 1)) {
631
		$genusQuery= 'find_genus=' . $speciesName[genus];
632
		$speciesQuery='find_species=' . $speciesName[species];
633
		$categoryTitles[] = variable_get('ext_links_ipni_category', $ext_links_default[ipni][category_default_value]);
634
		$categories['ipni']['title'] = variable_get('ext_links_ipni_category', $ext_links_default[ipni][category_default_value]);
635
		$categories['ipni']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_ipni_link', $ext_links_default[ipni][link_default_value]).$genusQuery.variable_get('ext_links_ipni_concat', '&').$speciesQuery . '\')">'.variable_get('ext_links_ipni_text', $ext_links_default[ipni][text_default_value]).'</a><br />';
636
	}
637
	if(variable_get('ext_links_wcsp_check', 1)) {
638
		$categoryTitles[] = variable_get('ext_links_wcsp_category', $ext_links_default[wcsp][category_default_value]);
639
		$categories['wcsp']['title'] = variable_get('ext_links_wcsp_category', $ext_links_default[wcsp][category_default_value]);
640
		$categories['wcsp']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_wcsp_link', $ext_links_default[wcsp][link_default_value]).'\')">'.variable_get('ext_links_wcsp_text', $ext_links_default[wcsp][text_default_value]).'</a><br />';
641
	
642
	}
643
	if(variable_get('ext_links_tpl_check', 1)) {
644
		$categoryTitles[] = variable_get('ext_links_tpl_category', $ext_links_default[tpl][category_default_value]);
645
		$categories['tpl']['title'] = variable_get('ext_links_tpl_category', $ext_links_default[tpl][category_default_value]);
646
		$categories['tpl']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_tpl_link', $ext_links_default[tpl][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_tpl_concat', '+').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_tpl_text', $ext_links_default[tpl][text_default_value]).'</a><br />';
647
	}
648
	if(variable_get('ext_links_eol_check', 1)) {
649
		$categoryTitles[] = variable_get('ext_links_eol_category', $ext_links_default[eol][category_default_value]);
650
		$categories['eol']['title'] = variable_get('ext_links_eol_category', $ext_links_default[eol][category_default_value]);
651
		$categories['eol']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_eol_link', $ext_links_default[eol][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_eol_concat', '+').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_eol_text', $ext_links_default[eol][text_default_value]).'</a><br />';
652
	}
653
	if(variable_get('ext_links_jstor_check', 1)) {
654
		$categoryTitles[] = variable_get('ext_links_jstor_category', $ext_links_default[jstor][category_default_value]);
655
		$categories['jstor']['title'] = variable_get('ext_links_jstor_category', $ext_links_default[jstor][category_default_value]);
656
		$categories['jstor']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_jstor_link', $ext_links_default[jstor][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_jstor_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_jstor_text', $ext_links_default[jstor][text_default_value]).'</a><br />';
657
	}
658
	if(variable_get('ext_links_epic_check', 1)) {
659
		$postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
660
		$categoryTitles[] = variable_get('ext_links_epic_category', $ext_links_default[epic][category_default_value]);
661
		$categories['epic']['title'] = variable_get('ext_links_epic_category', $ext_links_default[epic][category_default_value]);
662
		$categories['epic']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_epic_link', $ext_links_default[epic][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_epic_concat', '+').str_replace('"','%22',$speciesName[species]). $postURL . '\')">'.variable_get('ext_links_epic_text', $ext_links_default[epic][text_default_value]).'</a><br />';
663
	}
664
	if(variable_get('ext_links_fairchild_check', 1)) {
665
		$categoryTitles[] = variable_get('ext_links_fairchild_category', $ext_links_default[fairchild][category_default_value]);
666
		$categories['fairchild']['title'] = variable_get('ext_links_fairchild_category', $ext_links_default[fairchild][category_default_value]);
667
		$categories['fairchild']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_fairchild_link', $ext_links_default[fairchild][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_fairchild_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_fairchild_text', $ext_links_default[fairchild][text_default_value]).'</a><br />';
668
	
669
	}
670
	
671
	$categoryTitles = array_unique($categoryTitles);
672
	foreach ($categoryTitles as $categoryTitle) {
673
		//$block_content .= "specName" . $speciesName;
674
		$block_content .= "<div class=\"category\"><h5>" . $categoryTitle . "</h5>";                                                                                                                                                              
675
		foreach ($categories as $category) {
676
			if ($category['title'] == $categoryTitle){
677
				$block_content .= $category['content'];
678
			}
679
		}
680
		$block_content .= "</div>";		
681
	}
682
	
683
	
684
	return $block_content;
685
}
320 686

  
687
function theme_ext_links_list_plain($speciesName = null, $genus = null, $species=null) {
688
	global $ext_links_default;
689
	$block_content = '';
690
	if(variable_get('ext_links_gbif_check', true)) {
691
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_gbif_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]).'</a><br />';
692
		/*
693
		 $block_content .= l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
694
		 'JavaScript:popupExternalLinks('.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).$speciesName[genus].variable_get('ext_links_gbif_concat', ' ').$speciesName[species],
695
		 array(), null, null, true);
696
		 */
697
	}
698
	if(variable_get('ext_links_biocase_check', 1)) {
699
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_biocase_link', $ext_links_default[biocase][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_biocase_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_biocase_text', $ext_links_default[biocase][text_default_value]).'</a><br />';
700
	}
701
	if(variable_get('ext_links_nybg_check', 1)) {
702
		//$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_nybg_link', $ext_links_default[nybg][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_nybg_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_nybg_text', $ext_links_default[nybg][text_default_value]).'</a><br />';
703
		$genusQuery = '';
704
		$speciesQuery = '';
705
		if($speciesName[genus] != null) {
706
			$genusQuery = 'DetFiledAsGenusLocal+%3D+\%27'. $speciesName[genus]. '\%27';
707
		}
708
		if($speciesName[species] != null) {
709
			$speciesQuery = 'DetFiledAsSpeciesLocal+%3D+\%27'. $speciesName[species] . '\%27';
710
		}
711
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_nybg_link', $ext_links_default[nybg][link_default_value]).$genusQuery.variable_get('ext_links_nybg_concat', '+AND+').$speciesQuery.'\')">'.variable_get('ext_links_nybg_text', $ext_links_default[nybg][text_default_value]).'</a><br />';
712
	}
713
	if(variable_get('ext_links_tropicos_check', 1)) {
714
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_tropicos_link', $ext_links_default[tropicos][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_tropicos_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_tropicos_text', $ext_links_default[tropicos][text_default_value]).'</a><br />';
715
	}
716
	if(variable_get('ext_links_ncbi_check', 1)) {
717
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_ncbi_link', $ext_links_default[ncbi][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_ncbi_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_ncbi_text', $ext_links_default[ncbi][text_default_value]).'</a><br />';
718
	}
719
	if(variable_get('ext_links_google_check', 1)) {
720
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_google_link', $ext_links_default[google][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_google_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_google_text', $ext_links_default[google][text_default_value]).'</a><br />';
721
	}
722
	if(variable_get('ext_links_flickr_check', 1)) {
723
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_flickr_link', $ext_links_default[flickr][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_flickr_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_flickr_text', $ext_links_default[flickr][text_default_value]).'</a><br />';
724
	}
725
	if(variable_get('ext_links_scholar_check', 1)) {
726
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_scholar_link', $ext_links_default[scholar][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_scholar_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_scholar_text', $ext_links_default[scholar][text_default_value]).'</a><br />';
727
	}
728
	if(variable_get('ext_links_bhl_check', 1)) {
729
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_bhl_link', $ext_links_default[bhl][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_bhl_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_bhl_text', $ext_links_default[bhl][text_default_value]).'</a><br />';
730
	}
731
	if(variable_get('ext_links_fairchild_check', 1)) {
732
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_fairchild_link', $ext_links_default[fairchild][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_fairchild_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_fairchild_text', $ext_links_default[fairchild][text_default_value]).'</a><br />';
733
	}
734
	if(variable_get('ext_links_arkive_check', 1)) {
735
		$postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
736
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_arkive_link', $ext_links_default[arkive][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_arkive_concat', ' ').str_replace('"','%22',$speciesName[species]). $postURL .'\')">'.variable_get('ext_links_arkive_text', $ext_links_default[arkive][text_default_value]).'</a><br />';
737
	}
738
	if(variable_get('ext_links_herbcat_check', 1)) {
739
		$postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
740
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_herbcat_link', $ext_links_default[herbcat][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_herbcat_concat', '+').str_replace('"','%22',$speciesName[species]). $postURL .'\')">'.variable_get('ext_links_herbcat_text', $ext_links_default[herbcat][text_default_value]).'</a><br />';
741
	}
742
	if(variable_get('ext_links_iucn_check', 1)) {
743
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_iucn_link', $ext_links_default[iucn][link_default_value]).'\')">'.variable_get('ext_links_iucn_text', $ext_links_default[iucn][text_default_value]).'</a><br />';
744
	
745
	}
746
	if(variable_get('ext_links_ipni_check', 1)) {
747
		$genusQuery= 'find_genus=' . $speciesName[genus];
748
		$speciesQuery='find_species=' . $speciesName[species];
749
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_ipni_link', $ext_links_default[ipni][link_default_value]).$genusQuery.variable_get('ext_links_ipni_concat', '&').$speciesQuery . '\')">'.variable_get('ext_links_ipni_text', $ext_links_default[ipni][text_default_value]).'</a><br />';
750
	}
751
	if(variable_get('ext_links_wcsp_check', 1)) {
752
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_wcsp_link', $ext_links_default[wcsp][link_default_value]).'\')">'.variable_get('ext_links_wcsp_text', $ext_links_default[wcsp][text_default_value]).'</a><br />';
753
	
754
	}
755
	if(variable_get('ext_links_tpl_check', 1)) {
756
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_tpl_link', $ext_links_default[tpl][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_tpl_concat', '+').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_tpl_text', $ext_links_default[tpl][text_default_value]).'</a><br />';
757
	}
758
	if(variable_get('ext_links_eol_check', 1)) {
759
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_eol_link', $ext_links_default[eol][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_eol_concat', '+').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_eol_text', $ext_links_default[eol][text_default_value]).'</a><br />';
760
	}
761
	if(variable_get('ext_links_jstor_check', 1)) {
762
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_jstor_link', $ext_links_default[jstor][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_jstor_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_jstor_text', $ext_links_default[jstor][text_default_value]).'</a><br />';
763
	}
764
	if(variable_get('ext_links_epic_check', 1)) {
765
		$postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
766
		$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_epic_link', $ext_links_default[epic][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_epic_concat', '+').str_replace('"','%22',$speciesName[species]). $postURL .'\')">'.variable_get('ext_links_epic_text', $ext_links_default[epic][text_default_value]).'</a><br />';
767
	}
768
	
769
	return $block_content;
770
}
321 771

  
322 772
// include the admin form if it really want to use
323 773
//if (arg(0) === 'admin' AND arg(1) === 'user' AND arg(2) === 'ext_link') {
5.x/modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
1266 1266
				}
1267 1267
				
1268 1268
				if (!$isSynonym) {
1269
					$descriptionOut .='<li class="descriptionText DescriptionElement">';
1269
					/*$descriptionOut .='<li class="descriptionText DescriptionElement">';
1270 1270
					$name_used_in_source_link_to_show_use = l($source->originalNameString, path_to_name($originalTaxonUsedInSource->uuid),array(), NULL, NULL, FALSE ,TRUE);
1271 1271
					$descriptionOut .= $name_used_in_source_link_to_show_use . ': ';
1272 1272
					$descriptionOut .= $useSummary;
......
1283 1283
							$descriptionOut .= '<li class="use_record_list">- ' . $useRecordTags[0] . '[' . $useRecordTags[1] . ']'  . ' - ' . $useRecordTags[3]. ' - ' . $useRecordTags[4]. '[' .   $useRecordTags[5] . ']' .  ' - ' . $useRecordTags[2] . '</li>';
1284 1284
						}
1285 1285
					}
1286
					$descriptionOut .= '</ul></li>';
1286
					$descriptionOut .= '</ul></li>';*/
1287 1287
					
1288
					$descriptionOut .='<li class="descriptionText DescriptionElement">';
1289
					$name_used_in_source_link_to_show_use = l($source->originalNameString, path_to_name($originalTaxonUsedInSource->uuid),array(), NULL, NULL, FALSE ,TRUE);
1290
					$descriptionOut .= $name_used_in_source_link_to_show_use . ': ';
1291
					$descriptionOut .= $useSummary;
1292
					foreach ($description->sources as $source) {
1293
						if($source->originalNameString) {
1294
							//$out = $source->originalNameString . ':' . $out;
1295
						}
1296
						$descriptionOut .= " (" . theme('cdm_DescriptionElementSource', $source, true) . ")";
1297
					}
1298
					$hasUseRecords = false;
1299
					$descriptionUseRecordOut = '<table><th>Use Category</th><th>Use Sub Category</th><th>Plant Part</th><th>Human Group</th><th>Ethnic Group</th><th>Country</th>';
1300
					foreach ($description->elements as $descriptionElement) {
1301
						if($descriptionElement->feature->uuid == UUID_USE_RECORD){
1302
							$hasUseRecords = true;
1303
							$useRecordTags = explode(';', $descriptionElement->modifyingText->English->text);
1304
							$descriptionUseRecordOut .= '<tr>'; 
1305
							$descriptionUseRecordOut .= '<td>' .$useRecordTags[0] . '</td>' . '<td>' .$useRecordTags[1] . '</td>' .'<td>' .$useRecordTags[3] . '</td>'.'<td>' .$useRecordTags[4]. '</td>'.'<td>' .$useRecordTags[5] . '</td>'.'<td>' .$useRecordTags[2] . '</td>';
1306
							$descriptionUseRecordOut .= '</tr>';
1307
							//$descriptionOut .= '<li class="use_record_list">- ' . $useRecordTags[0] . '[' . $useRecordTags[1] . ']'  . ' - ' . $useRecordTags[3]. ' - ' . $useRecordTags[4]. '[' .   $useRecordTags[5] . ']' .  ' - ' . $useRecordTags[2] . '</li>';
1308
						}
1309
					}
1310
					$descriptionUseRecordOut .= '</table>';
1311
					//$descriptionOut .= '</ul></li>';
1312
					if ($hasUseRecords) {
1313
						$descriptionOut .= $descriptionUseRecordOut;
1314
					}
1288 1315
					
1289 1316
				}
1290 1317
				else {
1291 1318
					
1292
					$synonymOut .='<li class="descriptionText DescriptionElement">';
1319
					/*$synonymOut .='<li class="descriptionText DescriptionElement">';
1293 1320
					$name_used_in_source_link_to_show_use = l($source->originalNameString, path_to_name($originalTaxonUsedInSource->uuid),array(), NULL, NULL, FALSE ,TRUE);
1294 1321
						
1295 1322
					//$out .= $source->originalNameString . ': ';
......
1302 1329
						$synonymOut .= " (" . theme('cdm_DescriptionElementSource', $source, true) . ")";
1303 1330
					}
1304 1331
					$synonymOut .= '<ul>';
1332
					
1305 1333
					foreach ($description->elements as $descriptionElement) {
1306 1334
						if($descriptionElement->feature->uuid == UUID_USE_RECORD){
1307 1335
							$useRecordTags = explode(';', $descriptionElement->modifyingText->English->text);
......
1309 1337
						}
1310 1338
					}
1311 1339
					$synonymOut .= '</ul></li>';
1340
					$isSynonym = false;*/
1341
					$synonymOut .='<li class="descriptionText DescriptionElement">';
1342
					$name_used_in_source_link_to_show_use = l($source->originalNameString, path_to_name($originalTaxonUsedInSource->uuid),array(), NULL, NULL, FALSE ,TRUE);
1343
						
1344
					//$out .= $source->originalNameString . ': ';
1345
					$synonymOut .= $name_used_in_source_link_to_show_use . ': ';
1346
					$synonymOut .= $useSummary;
1347
					foreach ($description->sources as $source) {
1348
						if($source->originalNameString) {
1349
							//$out = $source->originalNameString . ':' . $out;
1350
						}
1351
						$synonymOut .= " (" . theme('cdm_DescriptionElementSource', $source, true) . ")";
1352
					}
1353
					
1354
					//$synonymOut .= '<ul>';
1355
					$hasUseRecords = false;
1356
					$useRecordTableOut = '<table><th>Use Category</th><th>Use Sub Category</th><th>Plant Part</th><th>Human Group</th><th>Ethnic Group</th><th>Country</th>';
1357
					foreach ($description->elements as $descriptionElement) {
1358
						if($descriptionElement->feature->uuid == UUID_USE_RECORD){
1359
							$hasUseRecords = true;
1360
							$useRecordTags = explode(';', $descriptionElement->modifyingText->English->text);
1361
							$useRecordTableOut .= '<tr>'; 
1362
							$useRecordTableOut .= '<td>' .$useRecordTags[0] . '</td>' . '<td>' .$useRecordTags[1] . '</td>' .'<td>' .$useRecordTags[3] . '</td>'.'<td>' .$useRecordTags[4]. '</td>'.'<td>' .$useRecordTags[5] . '</td>'.'<td>' .$useRecordTags[2] . '</td>';
1363
							$useRecordTableOut .= '</tr>';
1364
						
1365
							//$synonymOut .='<li class="use_record_list">- ' . $useRecordTags[0] . '[' . $useRecordTags[1] . ']'  . ' - ' . $useRecordTags[3]. ' - ' . $useRecordTags[4]. '[' .   $useRecordTags[5] . ']' .  ' - ' . $useRecordTags[2] . '</li>';
1366
						}
1367
					}
1368
					$useRecordTableOut .= '</table>';
1369
					if($hasUseRecords) {
1370
						$synonymOut .= $useRecordTableOut; 
1371
					}
1372
					
1373
					//$synonymOut .= '</ul></li>';
1374
					
1312 1375
					$isSynonym = false;
1313 1376
					
1314 1377
				}

Also available in: Unified diff