From 3faafdbc2830745c62851425ead0acfd33177b43 Mon Sep 17 00:00:00 2001 From: James Mickley Date: Thu, 5 Aug 2021 12:25:15 -0700 Subject: [PATCH 1/7] Standardized collection templates & fixed bugs - Some constants were defined with dollar signs, a syntax error. Fixed syntax in templates and code where they were used (using defined() instead of isset()) - Added all variables that are settable to the default, genObs, and collection-specific templates - Added and standardized comments in the templates - Standardized the default state across code when variables are not set - Standardized label names between the templates and the occurrence editor (some were missing or had the wrong name) --- collections/editor/dev/occurdataentry.php | 6 +-- collections/editor/dev/occureditor.php | 2 +- collections/editor/imageoccursubmit.php | 4 +- .../config/occurVarColl1_template.php | 54 +++++++++++-------- .../config/occurVarDefault_template.php | 51 ++++++++++-------- .../config/occurVarGenObsDefault_template.php | 54 +++++++++++-------- collections/editor/includes/queryform.php | 4 +- collections/editor/occurrenceeditor.php | 18 +++---- 8 files changed, 112 insertions(+), 81 deletions(-) diff --git a/collections/editor/dev/occurdataentry.php b/collections/editor/dev/occurdataentry.php index 254fcb33aa..1a25dd5d0e 100644 --- a/collections/editor/dev/occurdataentry.php +++ b/collections/editor/dev/occurdataentry.php @@ -245,7 +245,7 @@ <<
- +
@@ -324,7 +324,7 @@
'; } ?> @@ -349,7 +349,7 @@
- +
diff --git a/collections/editor/dev/occureditor.php b/collections/editor/dev/occureditor.php index 21c071cb84..d627077a59 100644 --- a/collections/editor/dev/occureditor.php +++ b/collections/editor/dev/occureditor.php @@ -1124,7 +1124,7 @@ function requestImage(){
'; } ?> diff --git a/collections/editor/imageoccursubmit.php b/collections/editor/imageoccursubmit.php index 8f62833256..2d9a665c67 100644 --- a/collections/editor/imageoccursubmit.php +++ b/collections/editor/imageoccursubmit.php @@ -175,8 +175,8 @@ function validateImgOccurForm(f){ : '; } } - if(isset($JSARR)){ - foreach($JSARR as $jsVal){ + if(defined('JSARR')){ + foreach(JSARR as $jsVal){ echo ''; } } @@ -834,12 +834,12 @@ function requestImage(){ ?>
-
+
-
+
@@ -1069,7 +1069,7 @@ function requestImage(){
- +
@@ -1224,7 +1224,7 @@ function requestImage(){
'; } ?> @@ -1607,4 +1607,4 @@ function requestImage(){ ?>
- \ No newline at end of file + From c5c25ee5a53ce6d9680e3f7c4ddbcc52bdbf1694 Mon Sep 17 00:00:00 2001 From: James Mickley Date: Thu, 5 Aug 2021 16:43:13 -0700 Subject: [PATCH 2/7] Added custom processing status across collection tools, standardized - Added custom processing status from the collections editor includes/config to the editor search query form, Batch Update, Import/Update Specimen Records, Skeletal Records and Create New Records Using Image - Standardized processing status dropdowns (displayed with words capitalized, similar defaults wording) - When getting a list of processing statuses from the database, use SQL query to sort rather than javascript (better sort) - Note: for occurrencetabledisplay.php, Katie added language tags to the processing statuses that were hard-coded before. I've set it up to prioritize collection templates first, then language tags. For this to work, the language tag has to be an all-caps version of the processing status, so I changed the names of these slightly in the language file. --- classes/OccurrenceDownload.php | 3 +- classes/SpecProcessorManager.php | 4 +- collections/admin/specupload.php | 57 +++++++++++++++--- collections/editor/imageoccursubmit.php | 2 +- collections/editor/includes/queryform.php | 2 +- collections/editor/occurrenceeditor.php | 2 +- collections/editor/occurrencetabledisplay.php | 59 +++++++++++++++---- collections/editor/skeletalsubmit.php | 41 +++++++++---- collections/georef/batchgeoreftool.php | 43 ++++++++++---- collections/specprocessor/ocrprocessor.php | 6 +- .../editor/occurrencetabledisplay.en.php | 12 ++-- js/symb/collections.editor.table.js | 13 +--- 12 files changed, 176 insertions(+), 68 deletions(-) diff --git a/classes/OccurrenceDownload.php b/classes/OccurrenceDownload.php index 80ebdd3089..54caebe991 100644 --- a/classes/OccurrenceDownload.php +++ b/classes/OccurrenceDownload.php @@ -610,13 +610,14 @@ public function getProcessingStatusList($collid = 0){ if($collid){ $sql .= 'WHERE collid = '.$collid; } + $sql .= ' ORDER BY processingstatus ASC'; $rs = $this->conn->query($sql); while($r = $rs->fetch_object()){ if($r->processingstatus) $psArr[] = $r->processingstatus; } $rs->free(); //Special sort - $templateArr = array('unprocessed','unprocessed-nlp','pending duplicate','stage 1','stage 2','stage 3','pending review','reviewed'); + $templateArr = array('unprocessed','unprocessed-nlp','stage 1','stage 2','stage 3','pending duplicate','pending review','expert required','reviewed', 'closed'); //Get all active processing statuses and then merge all extra statuses that may exists for one reason or another return array_merge(array_intersect($templateArr,$psArr),array_diff($psArr,$templateArr)); } diff --git a/classes/SpecProcessorManager.php b/classes/SpecProcessorManager.php index 221d3effd4..ff2647a260 100644 --- a/classes/SpecProcessorManager.php +++ b/classes/SpecProcessorManager.php @@ -284,14 +284,14 @@ public function getSpecNoOcr($procStatus = ''){ public function getProcessingStatusList(){ $retArr = array(); if($this->collid){ - $sql = 'SELECT DISTINCT processingstatus FROM omoccurrences WHERE collid = '.$this->collid; + $sql = 'SELECT DISTINCT processingstatus FROM omoccurrences WHERE collid = '.$this->collid.' ORDER BY processingstatus ASC'; //echo $sql; $rs = $this->conn->query($sql); while($r = $rs->fetch_object()){ if($r->processingstatus) $retArr[] = $r->processingstatus; } $rs->free(); - sort($retArr); + //sort($retArr); } return $retArr; } diff --git a/collections/admin/specupload.php b/collections/admin/specupload.php index e4bec8d074..87895d39e0 100644 --- a/collections/admin/specupload.php +++ b/collections/admin/specupload.php @@ -92,6 +92,28 @@ $duManager->setVerifyImageUrls($verifyImages); $duManager->setProcessingStatus($processingStatus); +//Bring in config variables +if($duManager->getCollInfo('colltype') == 'General Observations'){ + if(file_exists('../editor/includes/config/occurVarGenObs'.$SYMB_UID.'.php')){ + //Specific to particular general observation collection + include('../editor/includes/config/occurVarGenObs'.$SYMB_UID.'.php'); + } + elseif(file_exists('../editor/includes/config/occurVarGenObsDefault.php')){ + //Specific to Default values for portal + include('../editor/includes/config/occurVarGenObsDefault.php'); + } +} +else{ + if($collid && file_exists('../editor/includes/config/occurVarColl'.$collid.'.php')){ + //Specific to particular collection + include('../editor/includes/config/occurVarColl'.$collid.'.php'); + } + elseif(file_exists('../editor/includes/config/occurVarDefault.php')){ + //Specific to Default values for portal + include('../editor/includes/config/occurVarDefault.php'); + } +} + if($action == 'Automap Fields'){ $autoMap = true; } @@ -642,8 +664,16 @@ function pkChanged(selObj){ 'Unprocessed', 'stage 1' => 'Stage 1', 'stage 2' => 'Stage 2', 'stage 3' => 'STAGE_3', 'pending review' => 'Pending Review', - 'expert required' => 'Expert Required', 'pending review-nfn' => 'Pending Review-NfN', 'reviewed' => 'Reviewed', 'closed' => 'Closed'); + + // Set the list of processing statuses, from the collection editor template + $processingStatusArr = array(); + if(defined('PROCESSINGSTATUS') && PROCESSINGSTATUS){ + $processingStatusArr = PROCESSINGSTATUS; + } + else{ + $processingStatusArr = array('unprocessed','unprocessed/NLP','stage 1','stage 2','stage 3','pending duplicate','pending review-nfn','pending review','expert required','reviewed','closed'); + } + if($ulPath && ($uploadType == $DWCAUPLOAD || $uploadType == $IPTUPLOAD)){ //Data has been uploaded and it's a DWCA upload type if($duManager->analyzeUpload()){ @@ -826,8 +856,11 @@ function pkChanged(selObj){ '.ucwords($ps).''; + foreach($processingStatusArr as $v){ + + $keyOut = strtolower($v); + + echo ''; } ?> @@ -871,8 +904,11 @@ function pkChanged(selObj){ '.ucwords($ps).''; + foreach($processingStatusArr as $v){ + + $keyOut = strtolower($v); + + echo ''; } ?> @@ -1001,8 +1037,11 @@ function pkChanged(selObj){ '.ucwords($ps).''; + foreach($processingStatusArr as $v){ + + $keyOut = strtolower($v); + + echo ''; } ?> @@ -1055,4 +1094,4 @@ function pkChanged(selObj){ include($SERVER_ROOT.'/includes/footer.php'); ?> - \ No newline at end of file + diff --git a/collections/editor/imageoccursubmit.php b/collections/editor/imageoccursubmit.php index 2d9a665c67..cd74ade67a 100644 --- a/collections/editor/imageoccursubmit.php +++ b/collections/editor/imageoccursubmit.php @@ -179,7 +179,7 @@ function validateImgOccurForm(f){ $processingStatusArr = PROCESSINGSTATUS; } else{ - $processingStatusArr = array('unprocessed','unprocessed/NLP','stage 1','stage 2','stage 3','pending review-nfn','pending review','expert required','reviewed','closed'); + $processingStatusArr = array('unprocessed','unprocessed/NLP','stage 1','stage 2','stage 3','pending duplicate','pending review-nfn','pending review','expert required','reviewed','closed'); } ?> diff --git a/collections/editor/occurrencetabledisplay.php b/collections/editor/occurrencetabledisplay.php index 863dcce1f7..fd9dccfd2c 100644 --- a/collections/editor/occurrencetabledisplay.php +++ b/collections/editor/occurrencetabledisplay.php @@ -79,6 +79,32 @@ } } + //Bring in config variables + if($isGenObs){ + if(file_exists('includes/config/occurVarGenObs'.$SYMB_UID.'.php')){ + //Specific to particular collection + include('includes/config/occurVarGenObs'.$SYMB_UID.'.php'); + } + elseif(file_exists('includes/config/occurVarGenObsDefault.php')){ + //Specific to Default values for portal + include('includes/config/occurVarGenObsDefault.php'); + } + } + else{ + if($collId && file_exists('includes/config/occurVarColl'.$collId.'.php')){ + //Specific to particular collection + include('includes/config/occurVarColl'.$collId.'.php'); + } + elseif(file_exists('includes/config/occurVarDefault.php')){ + //Specific to Default values for portal + include('includes/config/occurVarDefault.php'); + } + if($crowdSourceMode && file_exists('includes/config/crowdSourceVar.php')){ + //Specific to Crowdsourcing + include('includes/config/crowdSourceVar.php'); + } + } + if(array_key_exists('bufieldname',$_POST)){ $occManager->setQueryVariables(); $statusStr = $occManager->batchUpdateField($_POST['bufieldname'],$_POST['buoldvalue'],$_POST['bunewvalue'],$_POST['bumatch']); @@ -220,16 +246,15 @@ if($buFieldName=='processingstatus'){ ?>
+ @@ -351,4 +388,4 @@ ?>
- \ No newline at end of file + diff --git a/collections/editor/skeletalsubmit.php b/collections/editor/skeletalsubmit.php index 4495035a24..1ae77ff5f4 100644 --- a/collections/editor/skeletalsubmit.php +++ b/collections/editor/skeletalsubmit.php @@ -28,6 +28,17 @@ $isEditor = 1; } } + +// Add collection customization variables +if($collid && file_exists('includes/config/occurVarColl'.$collid.'.php')){ + //Specific to particular collection + include('includes/config/occurVarColl'.$collid.'.php'); +} +elseif(file_exists('includes/config/occurVarDefault.php')){ + //Specific to Default values for portal + include('includes/config/occurVarDefault.php'); +} + ?> @@ -180,16 +191,26 @@
@@ -535,16 +545,25 @@ Georefer by: diff --git a/collections/specprocessor/ocrprocessor.php b/collections/specprocessor/ocrprocessor.php index f804eaf3b6..7c84bbc1f3 100644 --- a/collections/specprocessor/ocrprocessor.php +++ b/collections/specprocessor/ocrprocessor.php @@ -92,7 +92,7 @@ function validateOcrUploadForm(f){ getProcessingStatusList(); foreach($psList as $psVal){ - echo ''; + echo ''; } ?> @@ -112,14 +112,14 @@ function validateOcrUploadForm(f){
Processing Status: '; - buNewValue += ''; - buNewValue += ''; - buNewValue += ''; - buNewValue += ''; - buNewValue += ''; - buNewValue += ''; - buNewValue += ''; - buNewValue += ''; - buNewValue += ''; - buNewValue += ''; - buNewValue += ''; + buNewValue += processingStatus; buNewValue += ''; document.getElementById("bunewvaluediv").innerHTML = buNewValue; } From eeca884913288f4ab5ef1e7ee63907bf37ddc9e8 Mon Sep 17 00:00:00 2001 From: James Mickley Date: Thu, 19 Aug 2021 16:53:57 -0700 Subject: [PATCH 3/7] Added missing language tag for Occurrence Image Submission Missing NO_SET_STATUS from imageoccursubmit.php --- content/lang/collections/editor/imageoccursubmit.en.php | 1 + 1 file changed, 1 insertion(+) diff --git a/content/lang/collections/editor/imageoccursubmit.en.php b/content/lang/collections/editor/imageoccursubmit.en.php index 927157269b..dfdcd7fb66 100644 --- a/content/lang/collections/editor/imageoccursubmit.en.php +++ b/content/lang/collections/editor/imageoccursubmit.en.php @@ -26,6 +26,7 @@ $LANG['UPLOAD_LOCAL'] = 'Upload Local Image'; $LANG['DONT_MAP_LARGE'] = 'Do not map large version of image (when applicable)'; $LANG['PROCESSING_STATUS'] = 'Processing Status'; +$LANG['NO_SET_STATUS'] = 'No Set Status'; $LANG['SKELETAL_DATA'] = 'Skeletal Data'; $LANG['CAT_NUM'] = 'Catalog Number'; $LANG['SCINAME'] = 'Scientific Name'; From dc350ced88860bd972e04d97e668c4f689045870 Mon Sep 17 00:00:00 2001 From: James Mickley Date: Thu, 19 Aug 2021 18:25:37 -0700 Subject: [PATCH 4/7] Added collections templating field labels to all Data Editor tools This includes: - Quick search from the collection profile page - Create new records using image - Skeletal data entry - Determination History tab of the occurrence editor - Add batch determinations - Specimen label printing - Annotation label printing - Outgoing loan specimens Previously, these field labels were only used in the occurrence editor, but if set, it would make sense to have them the same throughout at least the Data Editor tools for consistency. Where these fields are defined in language files, the collections template takes priority, falling back to the language file definition if the collection template is not set. One exception to this is the list of fields in the Custom Field dropdown in the occurrence editor search query form. Since this pulls field names from elsewhere, I've set it up to look for a field label named [FIELDNAME]LABEL. Since some of these fields are not present in the collection editor template, they aren't customizable in this way. --- collections/editor/batchdeterminations.php | 32 ++++--- collections/editor/imageoccursubmit.php | 13 +-- .../editor/includes/determinationtab.php | 70 ++++++++++----- collections/editor/includes/queryform.php | 60 +++++++------ collections/editor/occurrenceeditor.php | 6 +- collections/editor/occurrencetabledisplay.php | 89 ++++++++++++++----- collections/editor/skeletalsubmit.php | 53 +++++------ collections/loans/specimentab.php | 36 +++++--- collections/misc/collprofiles.php | 12 ++- collections/reports/annotationmanager.php | 16 +++- collections/reports/labelmanager.php | 38 +++++--- 11 files changed, 278 insertions(+), 147 deletions(-) diff --git a/collections/editor/batchdeterminations.php b/collections/editor/batchdeterminations.php index 0077b201d4..b0acd681d0 100644 --- a/collections/editor/batchdeterminations.php +++ b/collections/editor/batchdeterminations.php @@ -41,6 +41,16 @@ } } } + +// Add collection customization variables +if($collid && file_exists('includes/config/occurVarColl'.$collid.'.php')){ + //Specific to particular collection + include('includes/config/occurVarColl'.$collid.'.php'); +} +elseif(file_exists('includes/config/occurVarDefault.php')){ + //Specific to Default values for portal + include('includes/config/occurVarDefault.php'); +} ?> @@ -316,7 +326,7 @@ function openPopup(urlStr){
- : + :
@@ -354,8 +364,8 @@ function openPopup(urlStr){   - - + + @@ -375,21 +385,21 @@ function openPopup(urlStr){

- : + :
- : + :
- : + :
- : + :
- : + :
- : + :
- : + :
- : + :
diff --git a/collections/editor/imageoccursubmit.php b/collections/editor/imageoccursubmit.php index cd74ade67a..95ca4d1361 100644 --- a/collections/editor/imageoccursubmit.php +++ b/collections/editor/imageoccursubmit.php @@ -198,27 +198,28 @@ function validateImgOccurForm(f){
- : + + :
- : + :
- : + :
- :
+ :
- :
+ :
- :
+ :
diff --git a/collections/editor/includes/determinationtab.php b/collections/editor/includes/determinationtab.php index b55faae33c..b731d95ae2 100644 --- a/collections/editor/includes/determinationtab.php +++ b/collections/editor/includes/determinationtab.php @@ -10,6 +10,8 @@ $sciName = $_GET['sciname']; $crowdSourceMode = $_GET['csmode']; $editMode = $_GET['em']; +$collId = $_GET['collid']; +$isGenObs = $_GET['isgenobs']; $annotatorname = $_GET['annotatorname']; $annotatoremail = $_GET['annotatoremail']; @@ -24,6 +26,32 @@ $specImgArr = $occManager->getImageMap(); // find out if there are images in order to show/hide the button to display/hide images. +//Bring in config variables +if($isGenObs){ + if(file_exists('config/occurVarGenObs'.$SYMB_UID.'.php')){ + //Specific to particular collection + include('config/occurVarGenObs'.$SYMB_UID.'.php'); + } + elseif(file_exists('config/occurVarGenObsDefault.php')){ + //Specific to Default values for portal + include('config/occurVarGenObsDefault.php'); + } +} +else{ + if($collId && file_exists('config/occurVarColl'.$collId.'.php')){ + //Specific to particular collection + include('config/occurVarColl'.$collId.'.php'); + } + elseif(file_exists('config/occurVarDefault.php')){ + //Specific to Default values for portal + include('config/occurVarDefault.php'); + } + if($crowdSourceMode && file_exists('config/crowdSourcingVar.php')){ + //Specific to Crowdsourcing + include('config/crowdSourcingVar.php'); + } +} + ?>
@@ -45,7 +73,7 @@