Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.1] Minimal header - part 1 (incomplete implementation that defaults as disabled until [3.2] part 2 is done) #1429

Merged
merged 18 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions checklists/checklistmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
$coordJson = json_encode($coords);
$metaJson = json_encode($clMeta);

$shouldUseMinimalMapHeader = $SHOULD_USE_MINIMAL_MAP_HEADER ?? false;

?>
<!DOCTYPE html>
<html lang="<?php echo $LANG_TAG ?>">
Expand Down Expand Up @@ -256,6 +258,9 @@ function openIndPU(occId){
</style>
</head>
<body style="background-color:#ffffff;" onload="initialize();">
<?php
if($shouldUseMinimalMapHeader) include_once($SERVER_ROOT . '/includes/minimal_header_template.php');
?>
<h1 class="page-heading screen-reader-only"><?= $LANG['MAP_SECTION'] . ' ' . $clName; ?></h1>
<?php
if(!$coordArr){
Expand Down
9 changes: 8 additions & 1 deletion checklists/clgmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
include_once($SERVER_ROOT.'/classes/ChecklistManager.php');
if($LANG_TAG != 'en' && file_exists($SERVER_ROOT.'/content/lang/checklists/clgmap.' . $LANG_TAG . '.php')) include_once($SERVER_ROOT . '/content/lang/checklists/clgmap.' . $LANG_TAG . '.php');
else include_once($SERVER_ROOT.'/content/lang/checklists/clgmap.en.php');
if($LANG_TAG == 'en' || !file_exists($SERVER_ROOT.'/content/lang/header.' . $LANG_TAG . '.php')) include_once($SERVER_ROOT . '/content/lang/header.en.php');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this just be in the include file so that is a all in one package?

Copy link
Collaborator Author

@Atticus29 Atticus29 Jun 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried implementing this in collections/map/index.php, and it doesn't seem to be working. I think it's because includes/minimal_header_template.php doesn't get included until the <body> of the page.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(And by, "doesn't work", I mean gives developer warnings about tags that can't be translated).

else include_once($SERVER_ROOT . '/content/lang/header.' . $LANG_TAG . '.php');
header("Content-Type: text/html; charset=".$CHARSET);

$pid = $_REQUEST['pid'];
Expand All @@ -14,6 +16,8 @@

$clManager = new ChecklistManager();
$clManager->setProj($pid);

$shouldUseMinimalMapHeader = $SHOULD_USE_MINIMAL_MAP_HEADER ?? false;
?>
<!DOCTYPE html>
<html lang="<?php echo $LANG_TAG ?>">
Expand Down Expand Up @@ -129,7 +133,10 @@ function initialize(){
</style>
</head>
<body style="background-color:#ffffff;" onload="initialize()">
<h1 class="page-heading screen-reader-only">Checklist Map</h1>
<?php
// if($shouldUseMinimalMapHeader) include_once($SERVER_ROOT . '/includes/minimal_header_template.php');
?>
<h1 class="page-heading screen-reader-only" style="margin-top:30px;">Checklist Map</h1>
<div id="map_canvas"></div>
<div
id="service-container"
Expand Down
14 changes: 13 additions & 1 deletion checklists/tools/mappointaid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
include_once('../../config/symbini.php');
include_once($SERVER_ROOT.'/content/lang/collections/tools/mapaids.'.$LANG_TAG.'.php');
header("Content-Type: text/html; charset=".$CHARSET);
if($LANG_TAG == 'en' || !file_exists($SERVER_ROOT.'/content/lang/header.' . $LANG_TAG . '.php')) include_once($SERVER_ROOT . '/content/lang/header.en.php');
else include_once($SERVER_ROOT . '/content/lang/header.' . $LANG_TAG . '.php');

$formName = array_key_exists("formname",$_REQUEST)?$_REQUEST["formname"]:"";
$latName = array_key_exists("latname",$_REQUEST)?$_REQUEST["latname"]:"";
Expand All @@ -28,6 +30,8 @@
$lat = 42.877742;
$lng = -97.380979;
}

$shouldUseMinimalMapHeader = $SHOULD_USE_MINIMAL_MAP_HEADER ?? false;
?>
<!DOCTYPE html>
<html lang="<?php echo $LANG_TAG ?>">
Expand All @@ -50,6 +54,11 @@
position: absolute;
left: -10000px;
}
<?php if($shouldUseMinimalMapHeader){ ?>
.minimal-header-margin{
margin-top: 6rem;
}
<?php } ?>
</style>
<script type="text/javascript">
var map;
Expand Down Expand Up @@ -169,8 +178,11 @@ function updateParentForm() {
</script>
</head>
<body style="display:flex; flex-direction: column; background-color:#ffffff;" onload="initialize()">
<?php
if($shouldUseMinimalMapHeader) include_once($SERVER_ROOT . '/includes/minimal_header_template.php');
?>
<h1 class="page-heading screen-reader-only">Map Point Helper</h1>
<div style="padding:0.5rem; width: fit-content; height:fit-content">
<div style="padding:0.5rem; width: fit-content; height:fit-content" class="minimal-header-margin">
<div>
<?php echo isset($LANG['MPR_INSTRUCTIONS']) ?$LANG['MPR_INSTRUCTIONS']: 'Click once to capture coordinates. Click on the submit button to transfer coordinates.' ?>
</div>
Expand Down
15 changes: 14 additions & 1 deletion collections/georef/georefclone.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
include_once($SERVER_ROOT.'/classes/OccurrenceGeorefTools.php');
include_once($SERVER_ROOT.'/content/lang/collections/georef/georefclone.' . $LANG_TAG . '.php');
header("Content-Type: text/html; charset=".$CHARSET);
if($LANG_TAG == 'en' || !file_exists($SERVER_ROOT.'/content/lang/header.' . $LANG_TAG . '.php')) include_once($SERVER_ROOT . '/content/lang/header.en.php');
else include_once($SERVER_ROOT . '/content/lang/header.' . $LANG_TAG . '.php');

$country = array_key_exists('country',$_REQUEST)?$_REQUEST['country']:'';
$state = array_key_exists('state',$_REQUEST)?$_REQUEST['state']:'';
Expand All @@ -13,6 +15,9 @@
$collid = array_key_exists('collid',$_REQUEST)?$_REQUEST['collid']:0;
$submitAction = array_key_exists('submitaction',$_POST)?$_POST['submitaction']:'';

$shouldUseMinimalMapHeader = $SHOULD_USE_MINIMAL_MAP_HEADER ?? false;
$topVal = $shouldUseMinimalMapHeader ? '1rem' : '0';

//Remove country, state, county from beginning of string
if(!$country || !$state || !$county){
$locArr = explode(";",$locality);
Expand Down Expand Up @@ -177,16 +182,24 @@ function verifyCloneForm(f){
}

</script>
<style type="text/css">
.header-wrapper {
z-index: 1000;
}
</style>
</head>
<body style="background-color:#ffffff;" onload="initialize()">
<?php
if($shouldUseMinimalMapHeader) include_once($SERVER_ROOT . '/includes/minimal_header_template.php');
?>
<!-- Data Container for Passing to Js -->
<div id="service-container"
data-clones="<?=htmlspecialchars(json_encode($clones))?>"
data-lat="<?=htmlspecialchars($latCen)?>"
data-lng="<?=htmlspecialchars($lngCen)?>"
/>
<!-- This is inner text! -->
<div role="main" id="innertext">
<div role="main" id="innertext" style="margin-top: <?php echo $topVal; ?>">
<h1 class="page-heading">Georeference Clone Tool</h1>
<fieldset style="padding:10px;">
<legend><b>
Expand Down
14 changes: 13 additions & 1 deletion collections/individual/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
else include_once($SERVER_ROOT.'/content/lang/collections/individual/index.en.php');
if($LANG_TAG != 'en' && file_exists($SERVER_ROOT.'/content/lang/collections/fieldterms/materialSampleVars.'.$LANG_TAG.'.php')) include_once($SERVER_ROOT.'/content/lang/collections/fieldterms/materialSampleVars.'.$LANG_TAG.'.php');
else include_once($SERVER_ROOT.'/content/lang/collections/fieldterms/materialSampleVars.en.php');
if($LANG_TAG == 'en' || !file_exists($SERVER_ROOT.'/content/lang/header.' . $LANG_TAG . '.php')) include_once($SERVER_ROOT . '/content/lang/header.en.php');
else include_once($SERVER_ROOT . '/content/lang/header.' . $LANG_TAG . '.php');
header('Content-Type: text/html; charset=' . $CHARSET);

$submit = array_key_exists('formsubmit', $_REQUEST) ? $_REQUEST['formsubmit'] : '';
Expand All @@ -20,6 +22,8 @@
$clid = array_key_exists('clid', $_REQUEST) ? $indManager->sanitizeInt($_REQUEST['clid']) : 0;
$format = isset($_GET['format']) ? $_REQUEST['format'] : '';

$shouldUseMinimalMapHeader = $SHOULD_USE_MINIMAL_MAP_HEADER ?? false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just make this a single line of if($SHOULD_USE_MINIMAL_MAP_HEADER ?? false) include(...). I realize it is also being used for the css logic but if you look at the other comments you see that I recommend styling changes that wouldn't require this conditional spacing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried this. I can't seem to get the header to display nicely along with the "Open Search Panel" button in collections/map/index.php, even if I explicitly set display: block; to the minimal header.

Maybe we meet about this and problem solve together in Part 2? I have a feeling that I have something to learn here, but I couldn't find an immediate solution.

I added it to the TODO list in Part 2: https://github.com/BioKIC/Symbiota/issues/1428.


if($occid) $indManager->setOccid($occid);
elseif($guid) $occid = $indManager->setGuid($guid);
elseif($collid && $pk){
Expand Down Expand Up @@ -307,12 +311,20 @@ function initializeMap(){
.smaller-header {
font-size: 2rem;
}
<?php if($shouldUseMinimalMapHeader){ ?>
.minimal-header-margin{
margin-top: 6rem;
}
<?php } ?>
</style>
</head>
<body>
<?php
if($shouldUseMinimalMapHeader) include_once($SERVER_ROOT . '/includes/minimal_header_template.php');
?>
<header style="background-image: none;">
<a class="screen-reader-only" href="#end-nav"><?php echo $LANG['SKIP_NAV'] ?></a>
<h1 class="page-heading">
<h1 class="page-heading minimal-header-margin">
<?php echo $LANG['FULL_RECORD_DETAILS']; ?>
</h1>
<div id="end-nav"></div>
Expand Down
Loading