Skip to content

Commit

Permalink
Improve form accessibility (#447)
Browse files Browse the repository at this point in the history
* add first global and form specific fixes

* internationalize and add labels to forms in checklist, checklistadmin, and several others

* add form labels and make forms more friendly for harvestparams.php

* add add form labels and make forms more friendly for several collections/ and content/ files
  • Loading branch information
Atticus29 authored May 4, 2023
1 parent 8c1b6d0 commit e128645
Show file tree
Hide file tree
Showing 39 changed files with 294 additions and 161 deletions.
4 changes: 2 additions & 2 deletions admin/portalindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function validateHandshakeForm(f){
<div class="handshake-div"><a href="#" onclick="$('.handshake-div').toggle(); return false;">Initiate Handshake with External Portal</a></div>
<div class="handshake-div" style="display:none">
<form action="portalindex.php" method="post" onsubmit="return validateHandshakeForm(this)">
<div class="field-row"><label>Path to Remote Portal:</label> <input name="remotePath" type="text" value="<?php echo $remotePath; ?>" style="width: 500px" /></div>
<div class="field-row"><label for="remotePath">Path to Remote Portal</label> <input name="remotePath" id="remotePath" type="text" value="<?php echo $remotePath; ?>" style="width: 500px" /></div>
<div class="field-row"><button name="formsubmit" type="submit" value="initiateHandshake">Initiate Handshake</button></div>
</form>
</div>
Expand Down Expand Up @@ -215,4 +215,4 @@ function validateHandshakeForm(f){
include($SERVER_ROOT.'/includes/footer.php');
?>
</body>
</html>
</html>
8 changes: 4 additions & 4 deletions admin/schemamanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@
</select>
</div>
<div class="form-section">
<label>Username:</label>
<input name="username" type="text" value="<?php echo $username; ?>" required autocomplete="off">
<label for="username">Username: </label>
<input id="username" name="username" type="text" value="<?php echo $username; ?>" required autocomplete="off">
</div>
<div class="form-section">
<label>Password: </label>
<input name="password" type="password" value="" required autocomplete="off">
<label for="password">Password: </label>
<input id="password" name="password" type="password" value="" required autocomplete="off">
</div>
<div class="form-section">
<label>Host:</label>
Expand Down
3 changes: 2 additions & 1 deletion agents/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ function searchform($name="") {
global $CLIENT_ROOT;
$result = "<div id='formDiv'>";
$result .= "<form method='GET' id='queryForm' style='display:inline;' >\n";
$result .= "<input type='text' name='name' value='$name'>";
$result .= "<label for='name'>Name</label>";
$result .= "<input type='text' id='name' name='name' value='$name'>";
$result .= "<input type='submit'>";
$result .= "</form>\n";
$result .= "<span id='plinkSpan'></span></div>\n";
Expand Down
20 changes: 11 additions & 9 deletions checklists/checklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,18 @@ function changeImageSource(elem){
<div id="taxonfilterdiv">
<div>
<b><?php echo $LANG['SEARCH'];?>:</b>
<label for="taxonfilter"><?php echo $LANG['TAXONFILTER'] ?></label>
<input type="text" id="taxonfilter" name="taxonfilter" value="<?php echo $taxonFilter;?>" size="20" />
</div>
<div>
<div style="margin-left:10px;">
<?php
if($DISPLAY_COMMON_NAMES){
echo "<input type='checkbox' name='searchcommon' value='1'".($searchCommon?"checked":"")."/> ".$LANG['COMMON']."<br/>";
echo "<label for='searchcommon'>Search common names</label><input type='checkbox' name='searchcommon' id='searchcommon' value='1'" . ($searchCommon?"checked":"") . "/> " . $LANG['COMMON'] . "<br/>";
}
?>
<input type="checkbox" name="searchsynonyms" value="1"<?php echo ($searchSynonyms?"checked":"");?>/> <?php echo $LANG['SYNONYMS'];?>
<input type="checkbox" name="searchsynonyms" id="searchsynonyms" value="1"<?php echo ($searchSynonyms?"checked":"");?>/> <?php echo $LANG['SYNONYMS'];?>
<label for="searchsynonyms"><?php echo $LANG['SEARCHSYNONYMS'] ?></label>
</div>
</div>
</div>
Expand All @@ -352,26 +354,26 @@ function changeImageSource(elem){
</select>
</div>
<div id="showsynonymsdiv" style="display:<?php echo ($showImages?"none":"block");?>">
<input name='showsynonyms' type='checkbox' value='1' <?php echo ($showSynonyms?"checked":""); ?> />
<?php echo $LANG['DISPLAY_SYNONYMS'];?>
<input name='showsynonyms' id='showsynonyms' type='checkbox' value='1' <?php echo ($showSynonyms?"checked":""); ?> />
<label for="showsynonyms"><?php echo $LANG['DISPLAY_SYNONYMS'];?></label>
</div>
<?php
if($DISPLAY_COMMON_NAMES){
echo '<div>';
echo "<input id='showcommon' name='showcommon' type='checkbox' value='1' ".($showCommon?"checked":"")."/> ".$LANG['COMMON']."";
echo "<input id='showcommon' name='showcommon' type='checkbox' value='1' " . ($showCommon?"checked":"") . "/> " . "<label for='showcommon'>" . $LANG['COMMON'] . "</label>";
echo '</div>';
}
?>
<div>
<input name='showimages' type='checkbox' value='1' <?php echo ($showImages?"checked":""); ?> onclick="showImagesChecked(this.form);" />
<?php echo $LANG['DISPLAYIMAGES'];?>
<input name='showimages' id='showimages' type='checkbox' value='1' <?php echo ($showImages?"checked":""); ?> onclick="showImagesChecked(this.form);" />
<label for="showimages"><?php echo $LANG['DISPLAYIMAGES'];?></label>
</div>
<?php
if($clid){
?>
<div id="showvouchersdiv" style="display:<?php echo ($showImages?"none":"block");?>">
<input name='showvouchers' type='checkbox' value='1' <?php echo ($showVouchers?"checked":""); ?>/>
<?php echo $LANG['NOTESVOUC'];?>
<input name='showvouchers' id='showvouchers' type='checkbox' value='1' <?php echo ($showVouchers?"checked":""); ?>/>
<label for="showvouchers"><?php echo $LANG['NOTESVOUC'];?></label>
</div>
<?php
}
Expand Down
27 changes: 15 additions & 12 deletions checklists/checklistadminchildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,16 @@ function validateAddChildForm(f){
<div style="margin:10px 0px;">Use the following tool to parse a list into multiple children checklists based on taxonomic nodes (Liliopsida, Eudicots, Pinopsida, etc)</div>
<form name="parsechecklistform" target="checklistadmin.php" method="post" onsubmit="validateParseChecklistForm(this)">
<div class="section-div">
<label>Taxonomic node:</label>
<label for="taxon"><?php echo $LANG['TAXONOMICNODE'] ?>:</label>
<input id="taxon" name="taxon" type="text" required />
<label for="parsetid"><?php echo $LANG['PARSETID'] ?>:</label>
<input id="parsetid" name="parsetid" type="text" required >
</div>
<div class="section-div">
<label>Target checklist:</label>
<select name="targetclid" required>
<option value="">Select Target Checklist</option>
<option value="0">Create New Checklist</option>
<label for="targetclid"><?php echo $LANG['TARGETCHECKLIST'] ?>:</label>
<select name="targetclid" id="targetclid" required>
<option value=""><?php echo $LANG['SELECTTARGETCHECKLIST'] ?></option>
<option value="0"><?php echo $LANG['CREATENEWCHECKLIST'] ?></option>
<option value="">--------------------------</option>
<?php
foreach($clArr as $k => $name){
Expand All @@ -167,14 +168,16 @@ function validateAddChildForm(f){
</div>
<div class="section-div">
<label>Transfer method:</label>
<input name="transmethod" type="radio" value="0" <?php if(!$transferMethod) echo 'checked'; ?>> transfer taxa
<input name="transmethod" type="radio" value="1" <?php if($transferMethod == 1) echo 'checked'; ?>> copy taxa
<input name="transmethod" id="transtaxa" type="radio" value="0" <?php if(!$transferMethod) echo 'checked'; ?>>
<label for="transtaxa"><?php echo $LANG['TRANSFERTAXA'] ?></label>
<input name="transmethod" id="copytaxa" type="radio" value="1" <?php if($transferMethod == 1) echo 'checked'; ?>>
<label for="copytaxa"><?php echo $LANG['COPYTAXA'] ?></label>
</div>
<div class="section-div">
<label>Link to parent checklist:</label>
<select name="parentclid">
<option value="">No Parent Checklist</option>
<option value="0" <?php if($parentClid === 0) echo 'SELECTED'; ?>>Create New Checklist</option>
<option value=""><?php echo $LANG['NOPARENTCHECKLIST'] ?></option>
<option value="0" <?php if($parentClid === 0) echo 'SELECTED'; ?>><?php echo $LANG['CREATENEWCHECKLIST'] ?></option>
<option value="">--------------------------</option>
<?php
foreach($clArr as $k => $name){
Expand All @@ -187,7 +190,7 @@ function validateAddChildForm(f){
<label>Add to project:</label>
<select name="targetpid">
<option value="">--no action--</option>
<option value="0">New Project</option>
<option value="0"><?php echo $LANG['NEWPROJECT'] ?></option>
<option value="">--------------------------</option>
<?php
$projArr = $clManager->getUserProjectArr();
Expand All @@ -198,8 +201,8 @@ function validateAddChildForm(f){
</select>
</div>
<div class="section-div">
<input name="copyattributes" type="checkbox" value="1" <?php if($copyAttributes) echo 'checked'; ?>>
<label>copy over permission and general attributes</label>
<input name="copyattributes" id="copyattributes" type="checkbox" value="1" <?php if($copyAttributes) echo 'checked'; ?>>
<label for="copyattributes"><?php echo $LANG['COPYPERMISSIONANDGENERAL'] ?></label>
</div>
<div class="section-div">
<input name="tabindex" type="hidden" value="2" >
Expand Down
8 changes: 4 additions & 4 deletions checklists/dynamicmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

//Sanitation
if(!is_numeric($tid)) $tid = 0;
$taxa = filter_var($taxa,FILTER_SANITIZE_STRING);
$taxa = htmlspecialchars($taxa, HTML_SPECIAL_CHARS_FLAGS);
if($interface && $interface != 'key') $interface = 'checklist';

//$dynClManager = new DynamicChecklistManager();
Expand Down Expand Up @@ -167,13 +167,13 @@ function checkForm(){
</div>
<div style="float:left;">
<div style="margin-right:35px;">
<b><?php echo (isset($LANG['TAXON_FILTER'])?$LANG['TAXON_FILTER']:'Taxon Filter'); ?>:</b>
<label for="taxa"><?php echo (isset($LANG['TAXON_FILTER'])?$LANG['TAXON_FILTER']:'Taxon Filter'); ?>:</label>
<input id="taxa" name="taxa" type="text" value="<?php echo $taxa; ?>" />
<input id="tid" name="tid" type="hidden" value="<?php echo $tid; ?>" />
</div>
<div>
<b><?php echo (isset($LANG['RADIUS'])?$LANG['RADIUS']:'Radius'); ?>:</b>
<input name="radius" value="(optional)" type="text" style="width:140px;" onfocus="this.value = ''" />
<label for="radius"><?php echo (isset($LANG['RADIUS'])?$LANG['RADIUS']:'Radius'); ?>:</label>
<input name="radius" id="radius" value="(optional)" type="text" style="width:140px;" onfocus="this.value = ''" />
<select name="radiusunits">
<option value="km"><?php echo (isset($LANG['KM'])?$LANG['KM']:'Kilometers'); ?></option>
<option value="mi"><?php echo (isset($LANG['MILES'])?$LANG['MILES']:'Miles'); ?></option>
Expand Down
2 changes: 1 addition & 1 deletion collections/admin/restorebackup.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ function verifyFileSize(inputObj){
$errStr = 'ERROR: Either you have tried to reach this page without going through the collection management menuor you have tried to upload a file that is too large.
You may want to breaking the upload file into smaller files or compressing the file into a zip archive (.zip extension). You may want to contact portal administrator
to request assistance in uploading the file (hint to admin: increasing PHP upload limits may help, current upload_max_filesize = ';
echo (isset($LANG['NO_SETTING'])?$LANG['NO_SETTING']:$errStr).ini_get("upload_max_filesize").'; post_max_size = '.ini_get("post_max_size");
echo (isset($LANG['NO_SETTING'])?$LANG['NO_SETTING']:$errStr) . '. ' . ini_get("upload_max_filesize") . '; post_max_size = '.ini_get("post_max_size") . '. ';
echo (isset($LANG['USE_BACK'])?$LANG['USE_BACK']:'Use the back arrows to get back to the file upload page.');
?>
</div>
Expand Down
27 changes: 20 additions & 7 deletions collections/cleaning/coordinatevalidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,24 @@ function checkSelectCollidForm(f){
<legend><b>Collection Selector</b></legend>
<form name="selectcollidform" action="coordinatevalidator.php" method="post" onsubmit="return checkSelectCollidForm(this)">
<div>
<input type="checkbox" onclick="selectAllCollections(this,'');" /> Select / Unselect All<br/>
<input type="checkbox" onclick="selectAllCollections(this,'specimen');" /> Select / Unselect All Specimens<br/>
<input type="checkbox" onclick="selectAllCollections(this,'observation');" /> Select / Unselect All Observations<br/>
<input type="checkbox" onclick="selectAllCollections(this,'live');" /> Select / Unselect All Live Management<br/>
<input type="checkbox" onclick="selectAllCollections(this,'snapshot');" /> Select / Unselect All Snapshot Management
<input type="checkbox" name="select-all" id="select-all" onclick="selectAllCollections(this,'');" />
<label for="select-all"> Select / Unselect All</label>
</div>
<div>
<input type="checkbox" name="select-all-specimens" id="select-all-specimens" onclick="selectAllCollections(this,'specimen');" />
<label for="select-all-specimens">Select / Unselect All Specimens</label>
</div>
<div>
<input type="checkbox" name="select-all-observations" id="select-all-observations" onclick="selectAllCollections(this,'observation');" />
<label for="select-all-observations">Select / Unselect All Observations</label>
</div>
<div>
<input type="checkbox" name="select-all-live-management" id="select-all-live-management" onclick="selectAllCollections(this,'live');" />
<label for="select-all-live-management">Select / Unselect All Live Management</label>
</div>
<div>
<input type="checkbox" name="select-all-snapshot-management" id="select-all-snapshot-management" onclick="selectAllCollections(this,'snapshot');" />
<label for="select-all-snapshot-management">Select / Unselect All Snapshot Management</label>
</div>
<hr/>
<?php
Expand All @@ -203,8 +216,8 @@ function checkSelectCollidForm(f){
if($collArr['managementtype'] == 'Live Data') $classStr .= ' live';
elseif($collArr['managementtype'] == 'Snapshot') $classStr .= ' snapshot';
elseif($collArr['managementtype'] == 'Aggregate') $classStr .= ' aggregate';
echo '<input name="collid[]" class="'.$classStr.'" type="checkbox" value="'.$id.'" /> ';
echo $collArr['collectionname'].' ('.$collArr['code'].') - '.$collArr['colltype'].':'.$collArr['managementtype'];
echo '<input name="collid[]" id="collid[]" class="' . $classStr . '" type="checkbox" value="' . $id . '" /> ';
echo '<label for="collid[]">' . $collArr['collectionname'].' ('.$collArr['code'].') - '.$collArr['colltype'].':'.$collArr['managementtype'] . '</label>';
echo '</div>';
}
?>
Expand Down
12 changes: 8 additions & 4 deletions collections/cleaning/fieldstandardization.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
<fieldset style="padding:20px;">
<legend><b>Country</b></legend>
<div style="margin:5px">
<select name="country_old">
<label for="country-old-field">Old field:</label>
<select name="country-old-field" id="country-old-field">
<option value="">Select Target Field</option>
<option value="">--------------------------------</option>
<?php
Expand All @@ -88,7 +89,10 @@

?>
</select>
<select name="country_old">
</div>
<div style="margin:5px">
<label for="country-old-value">Old value:</label>
<select name="country-old-value" id="country-old-value">
<option value="">Select Target Value</option>
<option value="">--------------------------------</option>
<?php
Expand All @@ -100,8 +104,8 @@
</select>
</div>
<div style="margin:5px">
<b>Replacement Value:</b>
<input name="country_new" type="text" value="" />
<label for="country-new">Replacement Value:</label>
<input name="country-new" id="country-new" type="text" value="" />
</div>
</fieldset>
<?php
Expand Down
5 changes: 3 additions & 2 deletions collections/datasets/datapublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ function checkAllColl(cb) {
<b><?php echo $LANG['DWCA_PUBLISHER']; ?></b>
</div>
<!-- This is inner text! -->
<div id="innertext">
<div id="innertext" style="font-size:14px;">
<!-- I could not figure out which css file to modify to get the above styling to work -->
<?php
if (!$collid && $IS_ADMIN) {
?>
Expand Down Expand Up @@ -289,7 +290,7 @@ function checkAllColl(cb) {
<form action="datapublisher.php" method="post" style="display:inline;" onsubmit="return window.confirm('<?php echo $LANG['SURE_DELETE']; ?>');">
<input type="hidden" name="colliddel" value="<?php echo $dArr['collid']; ?>">
<input type="hidden" name="collid" value="<?php echo $dArr['collid']; ?>">
<input type="image" src="../../images/del.png" name="action" value="DeleteCollid" title="<?php echo $LANG['DELETE_ARCHIVE']; ?>" style="width:15px;">
<input type="image" src="../../images/del.png" name="action" alt="<?php echo $LANG['DELETE_ARCHIVE']; ?>" value="DeleteCollid" title="<?php echo $LANG['DELETE_ARCHIVE']; ?>" style="width:15px;">
</form>
</div>
<div><b><?php echo $LANG['DESCRIPTION']; ?>:</b> <?php echo $dArr['description']; ?></div>
Expand Down
12 changes: 6 additions & 6 deletions collections/datasets/occurharvester.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,16 @@ function openIndPopup(occid){
<div style="margin:20px 0px">
<hr/>
</div>
<div style="width:450px;float:right;">
<div style="margin-bottom:10px;">
<label for="occidsubmit">Occurrence ID:</label>
<input type="text" name="occidsubmit" id="occidsubmit" onchange="loadOccurRecord(this)" />
</div>
<div style="width:450px;">
<form name="dlform" method="post" action="occurharvester.php" target="_blank">
<fieldset>
<legend><b>Specimen Queue</b></legend>
<div id="emptylistdiv" style="margin:20px;">
<b>List Empty: </b>enter barcode in field to left
<b>List Empty: </b>enter barcode in Occurrence ID field
</div>
<div id="occidlist" style="margin:10px;">
</div>
Expand All @@ -166,10 +170,6 @@ function openIndPopup(occid){
</fieldset>
</form>
</div>
<div style="">
<b>Occurrence ID:</b><br/>
<input type="text" name="occidsubmit" onchange="loadOccurRecord(this)" />
</div>

</div>
<?php
Expand Down
Loading

0 comments on commit e128645

Please sign in to comment.