From 569fe1a2aebf19a503f27f934891fe71de74e3c7 Mon Sep 17 00:00:00 2001 From: conemint Date: Wed, 23 Dec 2015 18:16:12 -0500 Subject: [PATCH 1/4] OneClickSearch.html Get rid of button to execute. to fix: on click search --- TestMult.html | 207 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 132 insertions(+), 75 deletions(-) diff --git a/TestMult.html b/TestMult.html index d2746ab..c206d44 100644 --- a/TestMult.html +++ b/TestMult.html @@ -38,6 +38,7 @@ left: 0; } .esriPopup .action.zoomTo { display: none; } + .esriPopup .titleButton.maximize { display: none; } /* Hide the progress bar when map is not updating */ #map:not([data-updating]) progress { display: none; @@ -100,9 +101,10 @@ display: hide; } - .arcgisSearch .searchBtn { + .arcgisSearch .searchBtn { display: none; } + */ #intro{ padding: 10px; @@ -141,18 +143,18 @@ .tg td{ font-family:Arial, sans-serif;font-size:14px;padding:1px 10px; border-style:solid;border-width:0px;overflow:hidden;word-break:normal; - border-top-width:1px;border-bottom-width:0px;} - .tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:1px 17px;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;border-top-width:1px;border-bottom-width:0px;} - .tg .tg-qmme{font-family:Arial, Helvetica, sans-serif !important;;vertical-align:top} + border-top-width:1px;border-bottom-width:0px;border-color: #0052A3;} + .tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:bold;padding:1px 17px;background-color:#b3d9ff;text-align:left;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;border-top-width:1px;border-bottom-width:0px;border-color: #0052A3;} + .tg .tg-qmme{font-family:Arial, Helvetica, sans-serif !important;;font-color:#808080;vertical-align:top; font-weight: bold; } .tg .tg-yw4l{vertical-align:top} .tg tr:hover {background-color:#e5f2ff;} - .tftable {font-size:12px;color:#333333;width:100%;border-width: 1px;border-color: #0052A3;border-collapse: collapse;} - .tftable th {font-size:12px;background-color:#b3d9ff;border-width: 1px;padding: 8px;border-style: solid;border-color: #0052A3;text-align:left;} - .tftable tr {background-color:#ffffff;} - .tftable td {font-size:12px;border-width: 1px;padding: 8px;border-style: solid;border-color: #0052A3;} - .tftable tr:hover {background-color:#e5f2ff;} + /*.tftable {font-family:Arial, sans-serif;font-size:14px;font-weight:normal;color:#333333;width:100%;border-width: 0px;border-color: #0052A3;border-collapse: collapse;} + .tftable th {font-size:12px;border-width: 1px;padding: 8px;border-style: solid;border-color: #0052A3;text-align:left;} + .tftable tr {background-color:#ffffff; border-width:0px;} + .tftable td {font-size:12px;border-width: 1px;padding:1px 10px; border-style: solid;border-color: #0052A3;} + .tftable tr:hover {background-color:#e5f2ff;}*/ a:link { text-decoration: none; } @@ -207,7 +209,7 @@ parser.parse(); - var curCDkey, curCDkey_s, curCDunit; + var curCDkey, curCDkey_s, curCDunit, curBBL,curLot; /* registry.byId("searchValue").on("click", doSearchValue); @@ -285,7 +287,8 @@ //Info Window: set size map.infoWindow.resize(245,300); - + + //4.a. Hover popup window set up dialog = new TooltipDialog({ id: "tooltipDialog", @@ -308,27 +311,36 @@ //listen for when the onMouseOver event fires on the layer //when fired, create a new graphic with the geometry from the event.graphic and add it to the maps graphics layer var hovergraph = new esri.layers.GraphicsLayer(); + var flag=0; layer.on("mouse-over", function(evt){ closeDialog(); - var t = "${BORO}/${BLOCK}/${LOT}
Adress:${Street_Num}, ${Street_Nam}, New York, NY
DOF Value 2017 Tentative: $${fmv:NumberFormat}
"; - var content = esriLang.substitute(evt.graphic.attributes,t); - //var highlightGraphic = new Graphic(evt.graphic.geometry,highlightSymbol); - //map.graphics.add(highlightGraphic); + var t = "${BORO}/${BLOCK}/${LOT}
Adress:${Street_Num}, ${Street_Nam}, New York, NY
DOF Value 2017 Tentative: $${fmv:NumberFormat}
"; + var content = esriLang.substitute(evt.graphic.attributes,t); + //var highlightGraphic = new Graphic(evt.graphic.geometry,highlightSymbol); + //map.graphics.add(highlightGraphic); map.addLayer(hovergraph); var highlightGraphic = new Graphic(evt.graphic.geometry,highlightSymbol); hovergraph.add(highlightGraphic); - dialog.setContent(content); + dialog.setContent(content); + + domStyle.set(dialog.domNode, "opacity", 0.85); + dijitPopup.open({ + popup: dialog, + x: evt.pageX, + y: evt.pageY + }); + var t2 = "${BORO}/${BLOCK}/${LOT}"; //add for search on click + curLot = esriLang.substitute(evt.graphic.attributes, "${LOT}"); + curBBL = esriLang.substitute(evt.graphic.attributes, t2);//add for search on click(4.b) + + map.setMapCursor("pointer"); //Add mouse change at hover + if (flag==0){ + hovergraph.enableMouseEvents(); + hovergraph.on("click", MapClickSearchHanlder); + flag=1; + } - domStyle.set(dialog.domNode, "opacity", 0.85); - dijitPopup.open({ - popup: dialog, - x: evt.pageX, - y: evt.pageY - }); - var t2 = "${BORO}/${BLOCK}/${LOT}"; //add for search on click - curBBL = esriLang.substitute(evt.graphic.attributes, t2);//add for search on click(4.b) - map.setMapCursor("pointer"); //Add mouse change at hover - }); + }); layercdm.on("mouse-over", function(evt){ closeDialog(); var t = "${Boro}/${Block}/${Lot}
Adress:${Street_Num}, ${Street_Nam}, New York, NY
"; @@ -348,7 +360,8 @@ x: evt.pageX, y: evt.pageY }); - var t2 = "{Boro}/${Block}/${Lot}"; //add for search on click + var t2 = "${Boro}/${Block}/${Lot}"; //add for search on click + curLot = esriLang.substitute(evt.graphic.attributes, "${Lot}"); curBBL = esriLang.substitute(evt.graphic.attributes, t2);//add for search on click(4.b) map.setMapCursor("pointer"); //Add mouse change at hover }); @@ -365,7 +378,7 @@ } //Clear: set mouse pointer back to default after move-out; hovergraph.on("mouse-out", closeDialog); - + //Search var searchvar = new Search({ enableButtonMode: false, //this enables the search widget to display as a single button @@ -415,7 +428,7 @@ sources.push({ featureLayer: new FeatureLayer("//services3.arcgis.com/aD88pT4hjL80xq0F/arcgis/rest/services/MHcdmain/FeatureServer/0"), - searchFields: ["CONDO_KEY"], + searchFields: ["CONDO_KEY","bl_sp"], displayField: "CONDO_KEY", exactMatch: true, name: "Search on Condo main", @@ -441,7 +454,7 @@ //Set the sources above to the search widget searchvar.set("sources", sources); searchvar.set("activeSourceIndex", 1); - + var searchcd; searchvar.on("search-results", function (e) { var rs, h; @@ -466,7 +479,7 @@ resultItems.push("" + attr + ": " + featureAttributes[attr] + "
"); }*/ resultItems.push("

Building Information

"); - resultItems.push("
Address: "+setNullValue(featureAttributes.Street_Num,"--") + " " + resultItems.push("" +"" +"" @@ -478,31 +491,36 @@ +"" +"" +"" - +"" + +"" +"
Address: "+setNullValue(featureAttributes.Street_Num,"--") + " " + setNullValue(featureAttributes.Street_Nam,"--") +"
Neighborhood: "+setNullValue(featureAttributes.NBHD, "--")+"
Property Type: "+setNullValue(featureAttributes.Structure, "--")+"
Commercial Units: "+setNullValue(featureAttributes.comunit, "--")+"
Total Story: "+setNullValue(featureAttributes.story, "--")+"
Year Built: "+setNullValue(featureAttributes.AYB, "--")+"
Zoning: "+setNullValue(featureAttributes.Zone_1, "--")+"
Zoning Code: "+setNullValue(featureAttributes.Zone_1, "--")+"
"); resultItems.push("

"); resultItems.push("

Tax Information

"); resultItems.push("" - +"" + +"" +"" +"" +"" +"
fmv: $"+setNullValue(localeNumber.format(featureAttributes.fmv), "--")+"
DOF Value: $"+setNullValue(localeNumber.format(featureAttributes.fmv), "--")+"
Agi_Pgsf: $"+setNullValue(localeNumber.format(featureAttributes.Agi_Pgsf), "--")+"
Exp_Pgsf: $"+setNullValue(localeNumber.format(featureAttributes.Exp_Pgsf), "--")+"
Noi_Pgsf: $"+setNullValue(localeNumber.format(featureAttributes.Noi_Pgsf), "--")+"
"); resultItems.push("

Guideline Information

"); - resultItems.push("" - +"" - +"" - +"" - +"" - +"" - +"" - +"" - +"" - +"" + resultItems.push("
Bcat:Row:1
Vacancy Rate:Row:1
Effective Tax Rate:Row:1
Header 1LowMedianHigh
IncomeRow:4 Cell:2Row:4 Cell:3Row:4 Cell:4
ExpenseRow:5 Cell:2Row:5 Cell:3Row:5 Cell:4
Expense RatioRow:6 Cell:2Row:6 Cell:3Row:6 Cell:4
Cap RateRow:7 Cell:2Row:7 Cell:3Row:7 Cell:4
Approximate Market Value RangeRow:8 Cell:2Row:8 Cell:3Row:8 Cell:4
" + +"" + +"" + +"" + +"" + +"" + +"" + +"" + +"" + +"" +"
Bcat:Row:1
Vacancy Rate:Row:1
Effective Tax Rate:Row:1
LowMedianHigh
IncomeRow:4 Cell:2Row:4 Cell:3Row:4 Cell:4
ExpenseRow:5 Cell:2Row:5 Cell:3Row:5 Cell:4
Expense RatioRow:6 Cell:2Row:6 Cell:3Row:6 Cell:4
Cap RateRow:7 Cell:2Row:7 Cell:3Row:7 Cell:4
Approximate Market Value RangeRow:8 Cell:2Row:8 Cell:3Row:8 Cell:4
"); resultItems.push("

Income= Gross Income per sq.ft.

Expense= Total Expense per sq.ft.

"); + resultItems.push("" + +"" + +"" + +""); + function setNullValue(value, defaultValue){ if (value == 0 || value ==""||value == "0" ||value == "$0") { @@ -516,14 +534,15 @@ var titlePane1 = new TitlePane({ id: "titlePane11", open: true, - title: featureAttributes.bbl_sp, + title: "Boro/Block/Lot:"+featureAttributes.bbl_sp, content: resultItems }, domConstruct.create('div', {}, containerNode)); }; }else{//CONDO ([1]) //h = inspect(rs[0][0].feature.attributes, 5, 0); var attrs = rs[1][0].feature.attributes; - searchcd=attrs.CONDO_KEY; + searchcd=attrs.CONDO_KEY; + //curCDunit = ""; }; }); @@ -563,23 +582,24 @@ //var searchx= dom.byId("searchtext").value; queryunit.where = "bl_sp = '"+searchx+"'"; queryTaskunit.execute(queryunit, GetResultsUnit,function(error){console.log(error);}); - document.getElementById("execute").disabled = false; + //document.getElementById("execute").disabled = false; } function GetResultsUnit (results) { - var resultItems = []; - var resultCount = results.features.length; - if (resultCount==1){ - var featureAttributes = results.features[0].attributes; - curCDkey = featureAttributes.CONDO_KEY; - curCDunit = featureAttributes.unit; - searchvar.set("activeSourceIndex", 1); - curCDkey_s = curCDkey.toString(); - searchvar.set("value", curCDkey_s); - searchvar.search(); - }else{ + var resultItems = []; + var resultCount = results.features.length; + if (resultCount==1){ + var featureAttributes = results.features[0].attributes; + curCDkey = featureAttributes.CONDO_KEY; + curCDunit = featureAttributes.unit; + searchvar.set("activeSourceIndex", 1); + curCDkey_s = curCDkey.toString(); + searchvar.set("value", curCDkey_s); + searchvar.search(); + execute(); + }else{ document.getElementById("alerttext").innerHTML = "BBL cannot be find\nPlease enter a valid block and lot for Condominium Unit."; return; - }; + }; }; @@ -590,9 +610,18 @@ query.returnGeometry = false; query.outFields = ["*"] //Execute Query - on(dom.byId("execute"), "click", execute); + //on(dom.byId("execute"), "click", execute); function execute () { - query.where = "CONDO_KEY = "+searchcd +" and Unit='"+curCDunit+"'"; + if (curCDunit){ + /*if (searchcd){ + query.where = "CONDO_KEY = "+searchcd +" and Unit='"+curCDunit+"'"; + }else{ + query.where = "CONDO_KEY = "+curCDkey +" and Unit='"+curCDunit+"'"; + }*/ + query.where = "CONDO_KEY = "+curCDkey +" and Unit='"+curCDunit+"'"; + }else{ + query.where = "bl_sp = '"+ curBL +"'" ; + } queryTask.execute(query, showResults,function(error){console.log(error);}); } function showResults (results) { @@ -604,7 +633,7 @@ var featureAttributes = results.features[i].attributes; resultItems.push("

Building Information

"); - resultItems.push("
Address: "+setNullValue(featureAttributes.Street_Number,"--") + " " + resultItems.push("" +"" +"" @@ -616,28 +645,28 @@ +"" +"" +"" - +"" + +"" +"
Address: "+setNullValue(featureAttributes.Street_Number,"--") + " " + setNullValue(featureAttributes.Street_Name,"--") +"
Neighborhood: "+setNullValue(featureAttributes.NBHD, "--")+"
Property Type: "+setNullValue(featureAttributes.Structure, "--")+"
Commercial Units: "+setNullValue(featureAttributes.comunit, "--")+"
Total Story: "+setNullValue(featureAttributes.story, "--")+"
Year Built: "+setNullValue(featureAttributes.AYB, "--")+"
Zoning: "+setNullValue(featureAttributes.Zone_1, "--")+"
Zoning Code: "+setNullValue(featureAttributes.Zone_1, "--")+"
"); resultItems.push("

"); resultItems.push("

Tax Information

"); resultItems.push("" - +"" + +"" +"" +"" +"" +"
fmv: $"+setNullValue(localeNumber.format(featureAttributes.fmv), "--")+"
DOF Value: $"+setNullValue(localeNumber.format(featureAttributes.fmv), "--")+"
Agi_Pgsf: $"+setNullValue(localeNumber.format(featureAttributes.Agi_Pgsf), "--")+"
Exp_Pgsf: $"+setNullValue(localeNumber.format(featureAttributes.Exp_Pgsf), "--")+"
Noi_Pgsf: $"+setNullValue(localeNumber.format(featureAttributes.Noi_Pgsf), "--")+"
"); resultItems.push("

Guideline Information

"); - resultItems.push("" - +"" - +"" - +"" - +"" - +"" - +"" - +"" - +"" - +"" + resultItems.push("
Bcat:Row:1
Vacancy Rate:Row:1
Effective Tax Rate:Row:1
Header 1LowMedianHigh
IncomeRow:4 Cell:2Row:4 Cell:3Row:4 Cell:4
ExpenseRow:5 Cell:2Row:5 Cell:3Row:5 Cell:4
Expense RatioRow:6 Cell:2Row:6 Cell:3Row:6 Cell:4
Cap RateRow:7 Cell:2Row:7 Cell:3Row:7 Cell:4
Approximate Market Value RangeRow:8 Cell:2Row:8 Cell:3Row:8 Cell:4
" + +"" + +"" + +"" + +"" + +"" + +"" + +"" + +"" + +"" +"
Bcat:Row:1
Vacancy Rate:Row:1
Effective Tax Rate:Row:1
LowMedianHigh
IncomeRow:4 Cell:2Row:4 Cell:3Row:4 Cell:4
ExpenseRow:5 Cell:2Row:5 Cell:3Row:5 Cell:4
Expense RatioRow:6 Cell:2Row:6 Cell:3Row:6 Cell:4
Cap RateRow:7 Cell:2Row:7 Cell:3Row:7 Cell:4
Approximate Market Value RangeRow:8 Cell:2Row:8 Cell:3Row:8 Cell:4
"); resultItems.push("

Income= Gross Income per sq.ft.

Expense= Total Expense per sq.ft.

"); @@ -654,14 +683,14 @@ var titlePane1 = new TitlePane({ id: "titlePane"+i, open: true, - title: featureAttributes.bblu_sp, + title: "Boro/Block/Lot:"+featureAttributes.bblu_sp, content: resultItems }, domConstruct.create('div', {}, containerNode)); }else{ var titlePane1 = new TitlePane({ id: "titlePane"+i, open: false, - title: featureAttributes.bblu_sp, + title: "Boro/Block/Lot:"+featureAttributes.bblu_sp, content: resultItems }, domConstruct.create('div', {}, containerNode)); } @@ -672,6 +701,33 @@ + //6. add for search on click + + + function MapClickSearchHanlder(evt){ + curCDkey=""; + curCDkey_s=""; + curCDunit=""; + searchcd=""; + document.getElementById("alerttext").innerHTML = ""; + if (curLot>7500){ + //executeunit(); + curBL = curBBL.substring(2,curBBL.length); + searchvar.set("activeSourceIndex", 1); + searchvar.search(curBL); + //document.getElementById("execute").disabled = false; + execute(); + //searchcd=attrs.CONDO_KEY; + }else{ + curBL = curBBL.substring(2,curBBL.length); + searchvar.set("activeSourceIndex", 0); + //searchvar.value = curBL; + //dojo.attr("search_input", "value", curBL); + //search.search(curBBL); + //searchvar.search(); + searchvar.search(curBL); + } + } }); @@ -725,6 +781,7 @@

This is an interactive map for Tax Class 2 Properties in New York City.


+

From a4780b7633da6cd133b0757dce9fe89e6c4bd33d Mon Sep 17 00:00:00 2001 From: conemint Date: Wed, 23 Dec 2015 22:27:51 -0500 Subject: [PATCH 2/4] Update TestMult.html fix search --- TestMult.html | 53 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/TestMult.html b/TestMult.html index c206d44..714dc56 100644 --- a/TestMult.html +++ b/TestMult.html @@ -10,7 +10,7 @@