From cd219f685ad9455a8154ea749a68a513f75546e4 Mon Sep 17 00:00:00 2001 From: Christopher Tyrrell <43977100+cdtyrrell@users.noreply.github.com> Date: Fri, 12 Feb 2021 17:31:44 -0600 Subject: [PATCH 01/22] Basic trait-attribute search Basic functionality for searching by traits/attributes; need to 1) add criterion notice in list/table, 2) fix empty form checker, 3) fix setAttributeTree (js) --- classes/OccurrenceManager.php | 27 ++++++++- collections/harvestparams.php | 57 +++++++++++++++++-- config/symbini_template.php | 3 +- content/lang/collections/harvestparams.en.php | 3 +- content/lang/collections/harvestparams.es.php | 3 +- js/symb/collections.traitsearch.js | 52 +++++++++++++++++ 6 files changed, 136 insertions(+), 9 deletions(-) create mode 100644 js/symb/collections.traitsearch.js diff --git a/classes/OccurrenceManager.php b/classes/OccurrenceManager.php index e0477884cc..073fed4ba5 100644 --- a/classes/OccurrenceManager.php +++ b/classes/OccurrenceManager.php @@ -423,6 +423,21 @@ protected function setSqlWhere(){ $this->displaySearchArr[] = 'includes cultivated/captive occurrences'; } } + $anyTraitsHere = 0; + $traitSql = ''; + foreach($this->searchTermArr as $stkey => $stval){ + if("traitid-" == substr($stkey, 0, 8)){ + if($stval){ + if($anyTraitsHere == 1) { $traitSql .= ' OR '; } + $traitSql .= 'stateid = ' . $stval; + //$this->displaySearchArr[] = ''; // need to pull the trait name and state to fill this in + $anyTraitsHere = 1; + } + } + } + if($anyTraitsHere == 1) { + $sqlWhere .= 'AND (o.occid IN(SELECT occid FROM tmattributes WHERE ' . $traitSql . '))'; + } if($sqlWhere){ $this->sqlWhere = 'WHERE '.substr($sqlWhere,4); } @@ -832,6 +847,16 @@ protected function readRequestVariables(){ unset($this->searchTermArr["includecult"]); } } + // Traits search: loop over all "traitid-" fields + foreach ($_REQUEST as $reqkey => $reqval){ + if("traitid-" == substr($reqkey, 0, 8)){ + if($reqval){ + $this->searchTermArr[$reqkey] = $reqval[0]; + } else { + unset($this->searchTermArr[$reqkey]); + } + } + } $llPattern = '-?\d+\.{0,1}\d*'; if(array_key_exists("upperlat",$_REQUEST)){ $upperLat = ''; $bottomlat = ''; $leftLong = ''; $rightlong = ''; @@ -953,4 +978,4 @@ public function getErrorMessage(){ return $this->errorMessage; } } -?> \ No newline at end of file +?> diff --git a/collections/harvestparams.php b/collections/harvestparams.php index 54f55c707c..5e08aa8c35 100644 --- a/collections/harvestparams.php +++ b/collections/harvestparams.php @@ -2,10 +2,12 @@ include_once('../config/symbini.php'); include_once($SERVER_ROOT.'/content/lang/collections/harvestparams.'.$LANG_TAG.'.php'); include_once($SERVER_ROOT.'/classes/OccurrenceManager.php'); +include_once($SERVER_ROOT.'/classes/OccurrenceAttributes.php'); header("Content-Type: text/html; charset=".$CHARSET); $collManager = new OccurrenceManager(); $searchVar = $collManager->getQueryTermStr(); +$attribSearch = new OccurrenceAttributes(); ?> @@ -24,6 +26,7 @@ + + setCommonDisplay(true);; +if($displayMode) $dataManager->setDisplayMode(true); +if($displayCommon) $dataManager->setDisplayCommon(1); $dataManager->setLanguage($langValue); if($pid) $dataManager->setProject($pid); if($dynClid) $dataManager->setDynClid($dynClid); @@ -42,18 +47,16 @@ if($attrsValues) $dataManager->setAttrs($attrsValues); if($rv) $dataManager->setRelevanceValue($rv); -$data = $dataManager->getData(); -$chars = $data["chars"]; //$chars = Array(HTML Strings) -$taxa = $data["taxa"]; //$taxa = Array(family => array(TID => DisplayName)) +$taxa = $dataManager->getTaxaList(); +$chars = $dataManager->getCharList(); //Harevest and remove language list from $chars $languages = Array(); if($chars){ - $languages = $chars["Languages"]; - unset($chars["Languages"]); + $languages = $chars['Languages']; + unset($chars['Languages']); } ?> - <?php echo $DEFAULT_TITLE.$LANG['WEBKEY'].preg_replace('/\<[^\>]+\>/','',$dataManager->getClName()); ?> @@ -123,7 +126,7 @@

'; - echo $dataManager->getClName()." "; + echo $dataManager->getClName().' '; if($FLORA_MOD_IS_ACTIVE) echo ''; ?>

@@ -135,12 +138,11 @@
:
@@ -150,22 +152,25 @@ //echo "
Relevance value:
"; //List char Data with selected states checked if(count($languages) > 1){ - echo "
Languages: '; foreach($languages as $l){ - echo "\n"; + echo ''; } - echo "
\n"; + echo ''; } ?>
- +
+
+ +
Show All Characters\n"; From 4936ff898c27a8c1c8ab0c4400031ea82455171d Mon Sep 17 00:00:00 2001 From: Edward Gilbert Date: Thu, 25 Mar 2021 13:15:42 -0400 Subject: [PATCH 05/22] base CSS modifications - Remove identification styling which will be defined within a separate css file dedicated to key and checklist pages --- css/base.css | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/css/base.css b/css/base.css index 5cf3eb6497..53b87504fc 100644 --- a/css/base.css +++ b/css/base.css @@ -252,39 +252,6 @@ div.button:hover { width: 80%; } - -/*Dynamic Key module*/ - -#keytable {} - -#keycharcolumn { - vertical-align: top; - width: 30%; -} - -#keymidcolumn { - width: 20px; -} - -#keytaxacolumn { - vertical-align: top; - width: 65%; -} - -.charHeading {} - -.characterStateName {} - -.dynam {} - -.dynamlang { - margin-top: 0.5em; - font-weight: bold; -} - -.dynamopt {} - - /* General Image thumbnails */ div.tndiv { From 806ae943f4e2865418c795c576ed13389351831c Mon Sep 17 00:00:00 2001 From: Edward Gilbert Date: Thu, 25 Mar 2021 13:19:17 -0400 Subject: [PATCH 06/22] Minor Occurrence editor modification --- collections/editor/occurrenceeditor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collections/editor/occurrenceeditor.php b/collections/editor/occurrenceeditor.php index f408cb3c8f..7aa82e0bdf 100644 --- a/collections/editor/occurrenceeditor.php +++ b/collections/editor/occurrenceeditor.php @@ -428,7 +428,7 @@ } else{ ?> - +
- +
From 7b8eca223744aba3349ea6440e3f505d7191185c Mon Sep 17 00:00:00 2001 From: Edward Gilbert Date: Fri, 26 Mar 2021 07:51:27 -0400 Subject: [PATCH 07/22] Occurrence Editor Development - First stage of the addition of a function to batch clone an occurrence record along with an assigned relationship to source record --- classes/OccurrenceEditorManager.php | 11 +++++ collections/editor/occurrenceeditor.php | 40 ++++++++++++++++--- images/downarrow.png | Bin 0 -> 3896 bytes images/downarrow.svg | 47 ++++++++++++++++++++++ js/symb/collections.editor.main.js | 51 +++++++++++++++++++++--- 5 files changed, 137 insertions(+), 12 deletions(-) create mode 100644 images/downarrow.png create mode 100644 images/downarrow.svg diff --git a/classes/OccurrenceEditorManager.php b/classes/OccurrenceEditorManager.php index 5b3ea381cb..45f5539ecb 100644 --- a/classes/OccurrenceEditorManager.php +++ b/classes/OccurrenceEditorManager.php @@ -2182,6 +2182,17 @@ public function getQuickHost(){ return $retArr; } + public function getAssociationControlVocab(){ + $retArr = array(); + $sql = 'SELECT cvTermID, term FROM ctcontrolvocabterm ORDER BY term'; + $rs = $this->conn->query($sql); + while($r = $rs->fetch_object()){ + $retArr[$r->cvTermID] = $r->term; + } + $rs->free(); + return $retArr; + } + public function isCrowdsourceEditor(){ $isEditor = false; $sql = 'SELECT reviewstatus, uidprocessor FROM omcrowdsourcequeue WHERE occid = '.$this->occid; diff --git a/collections/editor/occurrenceeditor.php b/collections/editor/occurrenceeditor.php index 7aa82e0bdf..8b7fde825e 100644 --- a/collections/editor/occurrenceeditor.php +++ b/collections/editor/occurrenceeditor.php @@ -10,7 +10,7 @@ $occIndex = array_key_exists('occindex',$_REQUEST)?$_REQUEST['occindex']:false; $crowdSourceMode = array_key_exists('csmode',$_REQUEST)?$_REQUEST['csmode']:0; $action = array_key_exists('submitaction',$_REQUEST)?$_REQUEST['submitaction']:''; -if(!$action && array_key_exists('carryloc',$_REQUEST)) $goToMode = 2; +if(!$action && array_key_exists('carryover',$_REQUEST)) $goToMode = 2; //Sanitation if(!is_numeric($occId)) $occId = ''; @@ -478,7 +478,7 @@ function requestImage(){ - + @@ -1458,10 +1458,38 @@ function requestImage(){ ?>
- Additional Options -
- - Carry over locality values + Clone Record +
+ Relationship Type: + +
+
+
Carry over:
+
+ No fields
+ Locality fields
+ Locality and taxonomic fields +
+
+
+ Number of records: +
+ + +
+ +
zaB^>EX>4U6ba`-PAZ2)IW&i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RS%PCP@m$W?=pLt_R$%p|U6d(8c00jp#R5@NVSfwzfmH z*4CEM<>g;FW^J;@q0o7=Q0NTuac~)Uh^FJlMe!How7QUT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/js/symb/collections.editor.main.js b/js/symb/collections.editor.main.js index 54786e6442..a6500f11c8 100644 --- a/js/symb/collections.editor.main.js +++ b/js/symb/collections.editor.main.js @@ -1,7 +1,6 @@ var pauseSubmit = false; var imgAssocCleared = false; var voucherAssocCleared = false; -var abortFormVerification = false; $(document).ready(function() { @@ -678,7 +677,6 @@ function parseVerbatimCoordinates(f,verbose){ //Form verification code function verifyFullForm(f){ f.submitaction.focus(); - if(abortFormVerification) return true; if(searchDupesCatalogNumber(f,false)) return false; var validformat1 = /^\d{4}-[0]{1}[0-9]{1}-\d{1,2}$/; //Format: yyyy-mm-dd @@ -759,10 +757,51 @@ function verifyFullFormEdits(f){ return true; } -function verifyGotoNew(f){ - abortFormVerification = true; - f.gotomode.value = 1; - f.submit(); +function prePopulateCatalogNumbers(){ + $("#cloneCatalogNumber-Fieldset").show(); + var catCnt = document.getElementById("clonecount").value; + if(!isNumeric(catCnt)) return false; + var cloneDiv = document.getElementById("cloneCatalogNumberDiv"); + cloneDiv.innerHTML = ""; + for(var i=0;i < catCnt;i++){ + var newInput = document.createElement("input"); + newInput.setAttribute("id", "clonecat-"+i); + newInput.setAttribute("name", "clonecatnum[]"); + newInput.setAttribute("type", "text"); + newInput.setAttribute("value", ""); + var newDiv = document.createElement("div"); + var newText = document.createTextNode("Catalog Number "+(i+1)+": "); + newDiv.appendChild(newText); + newDiv.setAttribute("class", "fieldGroupDiv"); + newDiv.appendChild(newInput); + if(i == 0){ + var newImg = document.createElement("img"); + newImg.setAttribute("src", "../../images/downarrow.png"); + newImg.setAttribute("style", "width:12px"); + var newAnchor = document.createElement("a"); + newAnchor.setAttribute("onclick", "autoIncrementCat()"); + newAnchor.appendChild(newImg); + newDiv.appendChild(newAnchor); + } + cloneDiv.appendChild(newDiv); + } + return false; +} + +function autoIncrementCat(){ + let catSeed = document.getElementById("clonecat-0").value; + let prefix = ''; + for(let i = 0; i < catSeed.length; i++) { + if(isNumberic(str.charAt(i))) break; + else prefix = prefix + str.charAt(i); + } + let suffix = ''; + for(let i = catSeed.length; i > 0; i--) { + if(isNumberic(str.charAt(i))) break; + else suffix = suffix + str.charAt(i); + } + alert("prefix: "+prefix); + alert("suffix: "+suffix); } function verifyDecimalLatitude(f){ From 85a1d03f9d196305138c57c530fab59f4d297e44 Mon Sep 17 00:00:00 2001 From: Edward Gilbert Date: Fri, 26 Mar 2021 08:07:21 -0400 Subject: [PATCH 08/22] Occurrence Editor Adjustments - Add label project to batch update function - Changed "label Project" to just "project" within editor filter function --- collections/editor/includes/queryform.php | 2 +- collections/editor/occurrencetabledisplay.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/collections/editor/includes/queryform.php b/collections/editor/includes/queryform.php index 90584f362a..c5254adbc9 100644 --- a/collections/editor/includes/queryform.php +++ b/collections/editor/includes/queryform.php @@ -175,7 +175,7 @@ 'georeferenceVerificationStatus'=>'Georeference Verification Status','georeferencedBy'=>'Georeferenced By','habitat'=>'Habitat', 'identificationQualifier'=>'Identification Qualifier','identificationReferences'=>'Identification References', 'identificationRemarks'=>'Identification Remarks','identifiedBy'=>'Identified By','individualCount'=>'Individual Count', - 'informationWithheld'=>'Information Withheld','institutionCode'=>'Institution Code (override)','labelProject'=>'Label Project', + 'informationWithheld'=>'Information Withheld','institutionCode'=>'Institution Code (override)','labelProject'=>'Project', 'language'=>'Language','lifeStage'=>'Life Stage','locationid'=>'Location ID','locality'=>'Locality', 'localitySecurity'=>'Locality Security','localitySecurityReason'=>'Locality Security Reason','locationRemarks'=>'Location Remarks', 'username'=>'Modified By','municipality'=>'Municipality','occurrenceRemarks'=>'Notes (Occurrence Remarks)','ocrFragment'=>'OCR Fragment', diff --git a/collections/editor/occurrencetabledisplay.php b/collections/editor/occurrencetabledisplay.php index ee2464119c..2e8a4589de 100644 --- a/collections/editor/occurrencetabledisplay.php +++ b/collections/editor/occurrencetabledisplay.php @@ -43,7 +43,7 @@ 'verbatimattributes' => 'Description','lifestage' => 'Life Stage', 'sex' => 'Sex', 'individualcount' => 'Individual Count', 'samplingprotocol' => 'Sampling Protocol', 'preparations' => 'Preparations', 'reproductivecondition' => 'Reproductive Condition', 'typestatus' => 'Type Status','cultivationstatus' => 'Cultivation Status','establishmentmeans' => 'Establishment Means', - 'disposition' => 'Disposition','duplicatequantity' => 'Duplicate Qty','datelastmodified' => 'Date Last Modified', + 'disposition' => 'Disposition','duplicatequantity' => 'Duplicate Qty','datelastmodified' => 'Date Last Modified', 'labelproject' => 'Project', 'processingstatus' => 'Processing Status','recordenteredby' => 'Entered By','dbpk' => 'dbpk','basisofrecord' => 'Basis Of Record','language' => 'Language'); $headMap = array(); From 37001b3fd008532ff25f9d39e98c2d50c9741f02 Mon Sep 17 00:00:00 2001 From: Edward Gilbert Date: Fri, 26 Mar 2021 08:33:00 -0400 Subject: [PATCH 09/22] Update harvestparams.es.php --- content/lang/collections/harvestparams.es.php | 1 + 1 file changed, 1 insertion(+) diff --git a/content/lang/collections/harvestparams.es.php b/content/lang/collections/harvestparams.es.php index 40bf9b6e08..3069e7c041 100644 --- a/content/lang/collections/harvestparams.es.php +++ b/content/lang/collections/harvestparams.es.php @@ -56,6 +56,7 @@ $LANG['TYPE'] = 'Limitar a ejemplares tipo'; $LANG['HAS_IMAGE'] = 'Limitar a ejemplares con imágenes'; $LANG['HAS_GENETIC'] = 'Limitar a ejemplares con datos genéticos'; +$LANG['HAS_COORDS'] = 'Limitar a ejemplares con coordenadas geográficas'; $LANG['INCLUDE_CULTIVATED'] = 'Incluye ejemplares cultivadas/cautivas'; $LANG['TRAIT_HEADER'] = 'Criterios de Rasgos'; ?> From 2205ba0709e0af5f3932463324dbd5e6c5fec62b Mon Sep 17 00:00:00 2001 From: Edward Gilbert Date: Fri, 26 Mar 2021 14:25:02 -0400 Subject: [PATCH 10/22] Occurrence Harvester Developments - Move header styling into head style definition - Move text into language configuration files - Various minor adjustments to occurrence trait search elements --- collections/harvestparams.php | 107 +++++++++--------- content/lang/collections/harvestparams.en.php | 1 + content/lang/collections/harvestparams.es.php | 1 + 3 files changed, 53 insertions(+), 56 deletions(-) diff --git a/collections/harvestparams.php b/collections/harvestparams.php index 3162ecc067..f3ecf8bbbc 100644 --- a/collections/harvestparams.php +++ b/collections/harvestparams.php @@ -43,7 +43,7 @@ diff --git a/js/symb/collections.editor.query.js b/js/symb/collections.editor.query.js index b966020aaf..dea650e012 100644 --- a/js/symb/collections.editor.query.js +++ b/js/symb/collections.editor.query.js @@ -103,39 +103,6 @@ function setOrderBy(formObject){ */ } -function resetQueryForm(f){ - f.occid.value = ""; - f.occidlist.value = ""; - f.direction.value = ""; - f.occindex.value = "0"; - f.q_catalognumber.value = ""; - f.q_othercatalognumbers.value = ""; - f.q_recordedby.value = ""; - f.q_recordnumber.value = ""; - f.q_eventdate.value = ""; - f.q_recordenteredby.value = ""; - f.q_dateentered.value = ""; - f.q_datelastmodified.value = ""; - f.q_processingstatus.value = ""; - if(document.getElementById("q_exsiccatiid")){ - f.q_exsiccatiid.value = ""; - } - f.q_customfield1.options[0].selected = true; - f.q_customtype1.options[0].selected = true; - f.q_customvalue1.value = ""; - f.q_customfield2.options[0].selected = true; - f.q_customtype2.options[0].selected = true; - f.q_customvalue2.value = ""; - f.q_customfield3.options[0].selected = true; - f.q_customtype3.options[0].selected = true; - f.q_customvalue3.value = ""; - f.q_imgonly.checked = false; - f.q_withoutimg.checked = false; - f.orderby.value = ""; - f.orderbydir.value = "ASC"; -} - - function customSelectChanged(targetSelect){ var sourceObj = document.queryform.q_customfield1; var targetObj = document.queryform.q_customtype1; From 4dd8a2b476ec16408bfda1faf76842d87b65d908 Mon Sep 17 00:00:00 2001 From: Edward Gilbert Date: Fri, 2 Apr 2021 16:01:41 -0400 Subject: [PATCH 22/22] Occurrence Details Development - Integrate Occurrence traits/attribute encodings via a trait tab within the Occurrence Details page - Schema modifications to support private/public display, project groupings, and exclude from search --- classes/OccurrenceIndividual.php | 59 ++++++++++++++ collections/individual/index.php | 81 +++++++++---------- .../dev/db_schema_patch_pending.sql | 6 ++ 3 files changed, 103 insertions(+), 43 deletions(-) diff --git a/classes/OccurrenceIndividual.php b/classes/OccurrenceIndividual.php index 3e28e90a6a..26bcde9444 100644 --- a/classes/OccurrenceIndividual.php +++ b/classes/OccurrenceIndividual.php @@ -363,6 +363,65 @@ public function getDuplicateArr(){ return $retArr; } + //Occurrence trait and attribute functions + public function getTraitArr(){ + $retArr = array(); + if($this->occid){ + $sql = 'SELECT t.traitid, t.traitName, t.description AS t_desc, t.refUrl AS t_url, s.stateid, s.stateName, s.description AS s_desc, s.refUrl AS s_url, d.parentstateid '. + 'FROM tmattributes a INNER JOIN tmstates s ON a.stateid = s.stateid '. + 'INNER JOIN tmtraits t ON s.traitid = t.traitid '. + 'LEFT JOIN tmtraitdependencies d ON t.traitid = d.traitid '. + 'WHERE t.isPublic = 1 AND a.occid = '.$this->occid.' ORDER BY t.traitName, s.sortSeq'; + $rs = $this->conn->query($sql); + if($rs){ + while($r = $rs->fetch_object()){ + $retArr[$r->traitid]['name'] = $r->traitName; + $retArr[$r->traitid]['desc'] = $r->t_desc; + $retArr[$r->traitid]['url'] = $r->t_url; + $retArr[$r->traitid]['depStateID'] = $r->parentstateid; + $retArr[$r->traitid]['state'][$r->stateid]['name'] = $r->stateName; + $retArr[$r->traitid]['state'][$r->stateid]['desc'] = $r->s_desc; + $retArr[$r->traitid]['state'][$r->stateid]['url'] = $r->s_url; + } + $rs->free(); + } + if($retArr){ + //Set dependent traits + $sql = 'SELECT DISTINCT s.traitid AS parentTraitID, d.parentStateID, d.traitid AS depTraitID '. + 'FROM tmstates s INNER JOIN tmtraitdependencies d ON s.stateid = d.parentstateid '. + 'WHERE s.traitid IN('.implode(',',array_keys($retArr)).')'; + //echo $sql.'
'; + $rs = $this->conn->query($sql); + while($r = $rs->fetch_object()){ + $retArr[$r->parentTraitID]['state'][$r->parentStateID]['depTraitID'][] = $r->depTraitID; + } + $rs->free(); + } + } + return $retArr; + } + + public function echoTraitDiv($traitArr, $targetID, $ident = 15){ + $tArr = $traitArr[$targetID]; + foreach($tArr['state'] as $stateID => $sArr){ + $this->echoTraitUnit($sArr,$ident); + if(array_key_exists('depTraitID',$sArr)){ + foreach($sArr['depTraitID'] as $depTraitID){ + $this->echoTraitDiv($traitArr, $depTraitID, $ident+15); + } + } + } + } + + public function echoTraitUnit($outArr, $indent=0){ + echo '
'; + if($outArr['url']) echo ''; + echo ''.$outArr['name'].' '; + if($outArr['url']) echo ''; + if($outArr['desc']) echo ': '.$outArr['desc']; + echo '
'; + } + //Occurrence comment functions public function getCommentArr($isEditor){ $retArr = array(); diff --git a/collections/individual/index.php b/collections/individual/index.php index 2ad430acc9..a3919d5667 100644 --- a/collections/individual/index.php +++ b/collections/individual/index.php @@ -3,6 +3,7 @@ include_once($SERVER_ROOT.'/classes/OccurrenceIndividual.php'); include_once($SERVER_ROOT.'/classes/DwcArchiverCore.php'); include_once($SERVER_ROOT.'/classes/RdfUtility.php'); +header("Content-Type: text/html; charset=".$CHARSET); $occid = array_key_exists("occid",$_REQUEST)?trim($_REQUEST["occid"]):0; $collid = array_key_exists("collid",$_REQUEST)?trim($_REQUEST["collid"]):0; @@ -139,8 +140,7 @@ if(!$securityCode && $occArr && is_numeric($occArr['decimallatitude']) && is_numeric($occArr['decimallongitude'])) $displayMap = true; $dupClusterArr = $indManager->getDuplicateArr(); $commentArr = $indManager->getCommentArr($isEditor); - -header("Content-Type: text/html; charset=".$CHARSET); +$traitArr = $indManager->getTraitArr(); ?> @@ -187,24 +187,16 @@ function toggle(target){ var objDiv = document.getElementById(target); if(objDiv){ - if(objDiv.style.display=="none"){ - objDiv.style.display = "block"; - } - else{ - objDiv.style.display = "none"; - } + if(objDiv.style.display=="none") objDiv.style.display = "block"; + else objDiv.style.display = "none"; } else{ var divObjs = document.getElementsByTagName("div"); for (i = 0; i < divObjs.length; i++) { var obj = divObjs[i]; if(obj.getAttribute("class") == target || obj.getAttribute("className") == target){ - if(obj.style.display=="none"){ - obj.style.display="inline"; - } - else { - obj.style.display="none"; - } + if(obj.style.display=="none") obj.style.display="inline"; + else obj.style.display="none"; } } } @@ -220,9 +212,7 @@ function verifyVoucherForm(f){ } function verifyCommentForm(f){ - if(f.commentstr.value.replace(/^\s+|\s+$/g,"")){ - return true; - } + if(f.commentstr.value.replace(/^\s+|\s+$/g,"")) return true; alert("Please enter a comment"); return false; } @@ -261,6 +251,7 @@ function initializeMap(){ .label{ font-weight:bold; } .imgDiv{ max-width:200; float:left; text-align:center; padding:5px } .occur-ref{ margin: 10px 0px } + .traitDiv{ margin:20px; } @@ -273,6 +264,15 @@ function initializeMap(){ js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); + + window.twttr=(function(d,s,id){ + var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{}; + if(d.getElementById(id))return;js=d.createElement(s); + js.id=id;js.src="https://platform.twitter.com/widgets.js"; + fjs.parentNode.insertBefore(js,fjs);t._e=[]; + t.ready=function(f){t._e.push(f);}; + return t; + }(document,"script","twitter-wjs"));