Revision c5ed6357
Added by Andreas Kohlbecker over 10 years ago
7.x/modules/cdm_dataportal/cdm_dataportal.module | ||
---|---|---|
1332 | 1332 |
* Returns the state of the the showThumbnails flag set in the |
1333 | 1333 |
* users session ($_SESSION['pageoption']['searchtaxa']['showThumbnails']). |
1334 | 1334 |
* |
1335 |
* @return Ambigous <boolean, number>
|
|
1335 |
* @return boolean
|
|
1336 | 1336 |
* returns 1 if the flag is set |
1337 | 1337 |
*/ |
1338 | 1338 |
function do_showThumbnails() { |
1339 | 1339 |
static $showThumbnails = null; |
1340 | 1340 |
|
1341 | 1341 |
if($showThumbnails == null) { |
1342 |
$showThumbnails = FALSE; |
|
1343 |
if (isset($_SESSION['pageoption']['searchtaxa']['showThumbnails'])) { |
|
1344 |
$showThumbnails = $_SESSION['pageoption']['searchtaxa']['showThumbnails']; |
|
1345 |
} |
|
1342 |
$showThumbnails = 0; |
|
1343 |
if (!isset($_SESSION['pageoption']['searchtaxa']['showThumbnails'])) { |
|
1344 |
$showThumbnails = 0; |
|
1345 |
$search_gallery_settings = variable_get(CDM_DATAPORTAL_SEARCH_GALLERY_NAME, null); |
|
1346 |
$showThumbnails = is_array($search_gallery_settings) |
|
1347 |
&& isset($search_gallery_settings['cdm_dataportal_show_taxon_thumbnails']) |
|
1348 |
&& ( |
|
1349 |
$search_gallery_settings['cdm_dataportal_show_taxon_thumbnails'] + |
|
1350 |
$search_gallery_settings['cdm_dataportal_show_synonym_thumbnails'] + |
|
1351 |
$search_gallery_settings['cdm_dataportal_show_thumbnail_captions'] > 0 |
|
1352 |
) |
|
1353 |
? 1 : 0; |
|
1354 |
|
|
1355 |
drupal_array_set_nested_value($_SESSION, array('pageoption', 'searchtaxa', 'showThumbnails'), $showThumbnails); |
|
1356 |
} |
|
1357 |
$showThumbnails = $_SESSION['pageoption']['searchtaxa']['showThumbnails']; |
|
1346 | 1358 |
if (!is_numeric($showThumbnails)) { |
1347 | 1359 |
$showThumbnails = 1; |
1348 | 1360 |
} |
7.x/modules/cdm_dataportal/settings.php | ||
---|---|---|
1480 | 1480 |
|
1481 | 1481 |
$form = array(); |
1482 | 1482 |
|
1483 |
$form['#submit'][] = 'cdm_settings_layout_search_submit'; |
|
1484 |
|
|
1483 | 1485 |
$form['search_settings'] = array( |
1484 | 1486 |
'#type' => 'fieldset', |
1485 | 1487 |
'#title' => t('Taxa Search'), |
... | ... | |
1533 | 1535 |
'#type' => 'checkbox', |
1534 | 1536 |
'#title' => t('Sets use of default values in the advanced search form.'), |
1535 | 1537 |
'#default_value' => variable_get('cdm_search_use_default_values', 1), |
1536 |
'#description' => t('<p>If checked the defqult values set abovewill be used for the search.</p>'),
|
|
1538 |
'#description' => t('<p>If checked the default values set above will be used for the search.</p>'),
|
|
1537 | 1539 |
); |
1538 | 1540 |
|
1539 | 1541 |
|
... | ... | |
2102 | 2104 |
} |
2103 | 2105 |
} |
2104 | 2106 |
|
2107 |
function cdm_settings_layout_search_submit($form, &$form_state){ |
|
2108 |
// the visibility of media thumbnails also affects the ui of the search results |
|
2109 |
// so reset the according session variable |
|
2110 |
// 1. in order to give the user immediate |
|
2111 |
// feedback on potential setting changes |
|
2112 |
// 2. let refresh the default if it has changed |
|
2113 |
if (isset($_SESSION['pageoption']['searchtaxa']['showThumbnails'])) { |
|
2114 |
unset($_SESSION['pageoption']['searchtaxa']['showThumbnails']); |
|
2115 |
} |
|
2116 |
} |
|
2117 |
|
|
2105 | 2118 |
/** |
2106 | 2119 |
* Form validation handler for cdm_settings_general |
2107 | 2120 |
* |
Also available in: Unified diff
fixing #3703 ( Show Thumbnails shown even if thumbnails options are not checked in the setting)