Revision beb914ef
Added by Andreas Kohlbecker over 7 years ago
modules/cdm_dataportal/cdm_dataportal.css | ||
---|---|---|
32 | 32 |
padding: 0; |
33 | 33 |
} |
34 | 34 |
|
35 |
#block-cdm-dataportal-back-to-search-results { |
|
36 |
float: right; |
|
37 |
} |
|
38 |
|
|
35 | 39 |
#cdm-ws-debug-table { |
36 | 40 |
width: 100%; |
37 | 41 |
} |
modules/cdm_dataportal/cdm_dataportal.install | ||
---|---|---|
395 | 395 |
* - grant new permission 'access cdm content' to default roles |
396 | 396 |
*/ |
397 | 397 |
function cdm_dataportal_update_7400() { |
398 |
|
|
399 |
$tasks_performed = array(); |
|
400 |
|
|
398 | 401 |
// additional permission for the anonymous user authenticated user roles |
399 | 402 |
$additional_default_permissions = array( |
400 | 403 |
'access cdm content' |
401 | 404 |
); |
402 | 405 |
user_role_grant_permissions(1, $additional_default_permissions); // anonymous user |
403 | 406 |
user_role_grant_permissions(2, $additional_default_permissions); // authenticated user |
404 |
$tasks_performed = array(); |
|
405 | 407 |
$tasks_performed[] = "grant new permission 'access cdm content' to default roles"; |
408 |
|
|
409 |
// enable the back_to_search_results block |
|
410 |
$show_button = variable_get('cdm_dataportal_show_back_to_search_results'); |
|
411 |
if(isset($show_button) && $show_button == 1) { |
|
412 |
$default_theme = variable_get('theme_default', 'zen_dataportal'); |
|
413 |
_block_rehash($default_theme); // ensure the block table is up to date |
|
414 |
db_update('block') |
|
415 |
->fields(array( |
|
416 |
'weight' => 20, |
|
417 |
'region' => 'navigation', |
|
418 |
'status' => 1, |
|
419 |
)) |
|
420 |
->condition('delta', 'back_to_search_results') |
|
421 |
->condition('theme', 'zen_dataportal') |
|
422 |
->execute(); |
|
423 |
db_update('block') |
|
424 |
->fields(array( |
|
425 |
'weight' => -20, |
|
426 |
'region' => 'content', |
|
427 |
'status' => 1, |
|
428 |
)) |
|
429 |
->condition('delta', 'back_to_search_results') |
|
430 |
->condition('theme', 'zen_dataportal', '<>') |
|
431 |
->execute(); |
|
432 |
$tasks_performed[] = "back_to_search_results block enabled"; |
|
433 |
} |
|
434 |
// $tasks_performed[] = _remove_variable('cdm_dataportal_show_back_to_search_results'); |
|
435 |
|
|
436 |
return join(', ',$tasks_performed); |
|
406 | 437 |
} |
407 | 438 |
|
408 | 439 |
/* ======================================================================== */ |
modules/cdm_dataportal/cdm_dataportal.module | ||
---|---|---|
811 | 811 |
// $block[0]["info"] = t("CDM DataPortal DevLinks"); |
812 | 812 |
// $block[1]["info"] = t("CDM DataPortal Credits"); |
813 | 813 |
$block["2"] = array( |
814 |
"info" => t("CDM Search Taxa"), |
|
814 |
"info" => t("CDM - Search Taxa"),
|
|
815 | 815 |
"cache" => DRUPAL_NO_CACHE |
816 | 816 |
); |
817 | 817 |
// $block[3]["info"] = t("CDM Filters"); |
818 |
$block["4"]["info"] = t("CDM Dataportal Print"); |
|
819 |
$block["keys"]["info"] = t("CDM identification keys");
|
|
818 |
$block["4"]["info"] = t("CDM - Dataportal Print");
|
|
819 |
$block["keys"]["info"] = t("CDM - Identification keys");
|
|
820 | 820 |
$block["fundedByEDIT"]["info"] = t('Funded by EDIT'); |
821 | 821 |
$block["classification_breadcrumbs"] = array( |
822 |
'info' => t('Classification breadcrumbs'), |
|
822 |
'info' => t('CDM - Classification breadcrumbs'),
|
|
823 | 823 |
'cache' => DRUPAL_CACHE_PER_PAGE |
824 | 824 |
); |
825 | 825 |
$block["taxonomic_children"] = array( |
826 |
'info' => t('Taxonomic children'), |
|
826 |
'info' => t('CDM - Taxonomic children'),
|
|
827 | 827 |
'cache' => DRUPAL_CACHE_PER_PAGE |
828 | 828 |
); |
829 |
$block["back_to_search_results"] = array( |
|
830 |
'title' => '<none>', |
|
831 |
'info' => t('CDM - Back to search Results'), |
|
832 |
'cache' => DRUPAL_CACHE_PER_PAGE, |
|
833 |
'visibility' => BLOCK_VISIBILITY_LISTED, |
|
834 |
'pages' => "cdm_dataportal/taxon/*", // multiple page paths separated by "\n"!!! |
|
835 |
); |
|
829 | 836 |
|
830 | 837 |
return $block; |
831 | 838 |
} |
... | ... | |
878 | 885 |
$block['subject'] = '<none>'; |
879 | 886 |
$block['content'] = compose_taxonomic_children($taxon_uuid); |
880 | 887 |
return $block; |
888 |
case 'back_to_search_results': |
|
889 |
$block['subject'] = '<none>'; |
|
890 |
if (isset($_SESSION['cdm']['search'])) { |
|
891 |
$block['content'] = l(t('Back to search result'), "http://" . $_SERVER['SERVER_NAME'] . $_SESSION['cdm']['last_search']); |
|
892 |
} |
|
893 |
return $block; |
|
894 |
default: |
|
895 |
return null; |
|
881 | 896 |
} |
882 | 897 |
} |
883 | 898 |
|
modules/cdm_dataportal/includes/pages.inc | ||
---|---|---|
467 | 467 |
|
468 | 468 |
// -------------------------------------------- // |
469 | 469 |
|
470 |
$render_array['back_to_search'] = markup_to_render_array(theme('cdm_back_to_search_result_button'), -103); |
|
471 |
|
|
472 | 470 |
if (variable_get('cdm_dataportal_display_is_accepted_for', CDM_DATAPORTAL_DISPLAY_IS_ACCEPTED_FOR) && isset($_REQUEST['acceptedFor'])) { |
473 | 471 |
$render_array['accepted_for'] = markup_to_render_array(cdm_accepted_for($_REQUEST['acceptedFor']), $weight++); |
474 | 472 |
} |
modules/cdm_dataportal/profile/CDM_Portal/CDM_Portal.install | ||
---|---|---|
45 | 45 |
// After the standard_install() the dataportal |
46 | 46 |
// customization can be applied |
47 | 47 |
|
48 |
include_once DRUPAL_ROOT . '/profiles/standard/standard.install';
|
|
48 |
require_once DRUPAL_ROOT . '/profiles/standard/standard.install';
|
|
49 | 49 |
standard_install(); |
50 | 50 |
|
51 | 51 |
// >>> admin/appearance/settings |
... | ... | |
260 | 260 |
) |
261 | 261 |
->execute(); |
262 | 262 |
|
263 |
$new_blocks = array( |
|
264 |
// enable "CDM Search Taxa" block for all themes |
|
265 |
array( |
|
266 |
'block' => array( |
|
267 |
'module' => 'cdm_dataportal', |
|
268 |
'delta' => '2', |
|
269 |
'theme' => $default_theme, |
|
270 |
'status' => 1, |
|
271 |
'weight' => -11, |
|
272 |
'region' => 'sidebar_first', |
|
273 |
'pages' => '', |
|
274 |
'cache' => -1, |
|
275 |
) |
|
276 |
), |
|
277 |
// CDM web service debug block |
|
278 |
array( |
|
279 |
'block' => array( |
|
280 |
'module' => 'cdm_api', |
|
281 |
'delta' => 'cdm_ws_debug', |
|
282 |
'theme' => $default_theme, |
|
283 |
'status' => 1, |
|
284 |
'weight' => -50, |
|
285 |
'region' => 'sidebar_first', |
|
286 |
'pages' => '', |
|
287 |
'cache' => -1, |
|
288 |
), |
|
289 |
'block_role' => array( |
|
290 |
'module' => 'cdm_api', |
|
291 |
'delta' => 'cdm_ws_debug', |
|
292 |
'rid' => $admin_role->rid |
|
293 |
) |
|
263 |
$new_blocks = array(); |
|
264 |
|
|
265 |
; |
|
266 |
// enable "CDM Search Taxa" block for all themes |
|
267 |
$block_search_taxa = cdm_dataportal_block_info()["2"]; |
|
268 |
$block_search_taxa= array_merge($block_search_taxa, array( |
|
269 |
'module' => 'cdm_dataportal', |
|
270 |
'delta' => '2', |
|
271 |
'theme' => $default_theme, |
|
272 |
'status' => 1, |
|
273 |
'weight' => -11, |
|
274 |
'region' => 'sidebar_first', |
|
275 |
'pages' => '', |
|
276 |
)); |
|
277 |
$new_blocks[] = array( |
|
278 |
'block' => $block_search_taxa |
|
279 |
); |
|
280 |
|
|
281 |
$block_back_to_search_results = cdm_dataportal_block_info()["back_to_search_results"]; |
|
282 |
$block_back_to_search_results= array_merge($block_back_to_search_results, array( |
|
283 |
'module' => 'cdm_dataportal', |
|
284 |
'delta' => 'back_to_search_results', |
|
285 |
'theme' => $default_theme, |
|
286 |
'status' => 1, |
|
287 |
'weight' => 10, |
|
288 |
'region' => 'navigation' |
|
289 |
)); |
|
290 |
$new_blocks[] = array( |
|
291 |
'block' => $block_back_to_search_results |
|
292 |
); |
|
293 |
|
|
294 |
// CDM web service debug block |
|
295 |
$block_cdm_ws_debug = cdm_api_block_info()['cdm_ws_debug']; |
|
296 |
$block_cdm_ws_debug= array_merge($block_cdm_ws_debug, array( |
|
297 |
'module' => 'cdm_api', |
|
298 |
'delta' => 'cdm_ws_debug', |
|
299 |
'theme' => $default_theme, |
|
300 |
'status' => 1, |
|
301 |
'weight' => -50, |
|
302 |
'region' => 'sidebar_first', |
|
303 |
'pages' => '', |
|
304 |
)); |
|
305 |
|
|
306 |
$new_blocks[] = array( |
|
307 |
'block' => $block_cdm_ws_debug, |
|
308 |
'block_role' => array( |
|
309 |
'module' => 'cdm_api', |
|
310 |
'delta' => 'cdm_ws_debug', |
|
311 |
'rid' => $admin_role->rid |
|
294 | 312 |
) |
295 | 313 |
); |
314 |
|
|
315 |
// TODO consider using block_flush_caches() to initially populate the block table with blocks from contributed |
|
316 |
// modules, and only update the blocks afterwards with block_save()? |
|
296 | 317 |
$block_insert = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache')); |
297 | 318 |
$block_role_insert = db_insert('block_role')->fields(array('module', 'delta', 'rid')); |
298 | 319 |
foreach ($new_blocks as $block) { |
modules/cdm_dataportal/settings.php | ||
---|---|---|
1768 | 1768 |
|
1769 | 1769 |
$form['#submit'][] = 'cdm_settings_layout_taxon_submit'; |
1770 | 1770 |
|
1771 |
$form['cdm_dataportal_show_back_to_search_results'] = array( |
|
1772 |
'#type' => 'checkbox', |
|
1773 |
'#title' => t('Show <em>Back to search results</em> link at the taxon site.'), |
|
1774 |
'#default_value' => variable_get('cdm_dataportal_show_back_to_search_results', 1), |
|
1775 |
'#description' => t('<p>If checked the link to search results is rendered at |
|
1776 |
the top of the taxon site. Clicking on the link the last search performed |
|
1777 |
is rendered again.</p>'), |
|
1778 |
); |
|
1779 |
|
|
1780 | 1771 |
// --------- TABBED TAXON ------- // |
1781 | 1772 |
$form['taxon_tabs'] = array( |
1782 | 1773 |
'#type' => 'fieldset', |
modules/cdm_dataportal/theme/cdm_dataportal.common.theme | ||
---|---|---|
448 | 448 |
} |
449 | 449 |
|
450 | 450 |
/* ============================ special buttons ============================= */ |
451 |
/** |
|
452 |
* @todo Please document this function. |
|
453 |
* @see http://drupal.org/node/1354 |
|
454 |
*/ |
|
455 |
function theme_cdm_back_to_search_result_button() { |
|
456 |
$out = ''; |
|
457 |
|
|
458 |
$show_button = variable_get('cdm_dataportal_show_back_to_search_results'); |
|
459 |
if (isset($_SESSION['cdm']['search']) && isset($show_button) && $show_button == 1) { |
|
460 |
/* ['cdm']['last_search'] */ |
|
461 |
// $out .= '<div id="backButton">'.l(t('Back to search result'), $_SESSION |
|
462 |
// ).'</div>'; |
|
463 |
$out .= '<div id="backButton" class="clearfix">' . l(t('Back to search result'), "http://" . $_SERVER['SERVER_NAME'] . $_SESSION['cdm']['last_search']) . '</div>'; |
|
464 |
} |
|
465 |
return $out; |
|
466 |
} |
|
467 | 451 |
|
468 | 452 |
/** |
469 | 453 |
* @todo Please document this function. |
modules/cdm_dataportal/theme/theme_registry.inc | ||
---|---|---|
63 | 63 |
'parameters' => array(), |
64 | 64 |
'attributes' => NULL, |
65 | 65 |
)), |
66 |
'cdm_back_to_search_result_button' => array('variables' => array()), |
|
67 | 66 |
'cdm_back_to_image_gallery_button' => array('variables' => array()), |
68 | 67 |
'cdm_print_button' => array('variables' => array()), |
69 | 68 |
|
themes/garland_cichorieae/styleOverride.css | ||
---|---|---|
339 | 339 |
padding: 0.4em 0; |
340 | 340 |
} |
341 | 341 |
|
342 |
span.acceptedFor, |
|
343 |
#backButton { |
|
342 |
span.acceptedFor { |
|
344 | 343 |
font-size: 0.9em; |
345 | 344 |
} |
346 | 345 |
|
347 |
#backButton { |
|
348 |
/* Renders the link unusable because it is overlayed by tabs-wrapper. */ |
|
349 |
/* margin-top: -2em; */ |
|
350 |
margin-top:-0.4em; |
|
351 |
} |
|
352 |
|
|
353 | 346 |
#cdm-dataportal-settings .form-item fieldset { |
354 | 347 |
padding: 0.5em; |
355 | 348 |
} |
themes/palmweb_2/style.css | ||
---|---|---|
730 | 730 |
position: relative; |
731 | 731 |
} |
732 | 732 |
|
733 |
#backButton { |
|
734 |
margin: 0 0 10px; |
|
735 |
font-size: 80%; |
|
736 |
} |
|
737 |
|
|
738 | 733 |
#funded-by { |
739 | 734 |
text-align: center; |
740 | 735 |
} |
themes/zen_dataportal/sass/cdm.scss | ||
---|---|---|
12 | 12 |
|
13 | 13 |
/* style links only for content in blocks and node and backbutton |
14 | 14 |
added also #identificationKey since there are not yet drupal nodes */ |
15 |
.block, .node, #backButton, #identificationKey {
|
|
15 |
.block, .node, #identificationKey { |
|
16 | 16 |
@include cdm-link-style; |
17 | 17 |
} |
18 | 18 |
|
... | ... | |
46 | 46 |
} |
47 | 47 |
} |
48 | 48 |
|
49 |
|
|
50 |
#backButton { |
|
51 |
text-align: right; |
|
52 |
} |
|
53 |
|
|
54 | 49 |
.breadcrumbs li { |
55 | 50 |
padding: 0 0 0 0; |
56 | 51 |
} |
Also available in: Unified diff
fix #5943 back to search button/link moved to drupal block