/*
 COPYRIGHT 2009 ESRI

 TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
 Unpublished material - all rights reserved under the
 Copyright Laws of the United States and applicable international
 laws, treaties, and conventions.

 For additional information, contact:
 Environmental Systems Research Institute, Inc.
 Attn: Contracts and Legal Services Department
 380 New York Street
 Redlands, California, 92373
 USA

 email: contracts@esri.com
 */
//>>built
require({cache:{"url:esri/dijit/geoenrichment/templates/EnrichDataCollectionsPage.html":"<div data-dojo-type=\"dijit/layout/ContentPane\" data-dojo-props=\"row: 0\">\r\n    <div style=\"margin-bottom: 2em;\">\r\n        ${nls.chooseCountry}\r\n        <select data-dojo-type=\"dijit/form/Select\"\r\n            data-dojo-attach-point=\"countrySelect\"\r\n            data-dojo-props=\"maxHeight: 151\"\r\n            data-dojo-attach-event=\"onChange: _onCountryChanged\"></select>\r\n    </div>\r\n    ${nls.chooseDataCollection}\r\n</div>\r\n<div data-dojo-type=\"dijit/layout/ContentPane\" data-dojo-props=\"row: 1\">\r\n    <div data-dojo-attach-point=\"itemsDiv\" style=\"min-height: 70px;\"></div>\r\n    <div data-dojo-attach-point=\"progressDiv\" class=\"Wizard_Progress\"></div>\r\n</div>\r\n<div data-dojo-type=\"dijit/layout/ContentPane\" data-dojo-props=\"row: 2\">\r\n    <button class=\"Wizard_Button\" data-dojo-attach-point=\"backButton\" data-dojo-attach-event=\"click: _back\">${nls.back}</button>\r\n    <button class=\"Wizard_Button\" data-dojo-attach-point=\"nextButton\" data-dojo-attach-event=\"click: _next\" disabled=\"disabled\">${nls.next}</button>\r\n</div>"}});define("esri/dijit/geoenrichment/EnrichDataCollectionsPage",["../../declare","dojo/_base/lang","dojo/dom-class","dojo/dom-construct","./dom","dojo/on","./_WizardPage","dojo/i18n!../../nls/jsapi","dojo/text!./templates/EnrichDataCollectionsPage.html","../../tasks/geoenrichment/GeoenrichmentTask","./config","dijit/form/CheckBox","dijit/layout/ContentPane","dijit/form/Select"],function(_1,_2,_3,_4,_5,on,_6,_7,_8,_9,_a,_b){_7=_7.geoenrichment.dijit.DataCollectionsPage;var _c="_";return _1("esri.dijit.geoenrichment.EnrichDataCollectionsPage",[_6],{templateString:_8,nls:_7,country:null,dataCollections:null,showBackButton:true,_request:null,_countriesLoaded:null,_loaded:false,_task:null,_items:null,_checks:null,_eventMap:{"back":true,"next":["dataCollections"]},constructor:function(){this._task=new _9(_a.server);this._task.token=_a.token;},buildRendering:function(){this.inherited(arguments);if(!this.showBackButton){this.backButton.style.display="none";}},_setCountryAttr:function(_d){if(this.country==_d){return;}this._set("country",_d);this._loaded=false;},load:function(){if(!this._loaded){if(this._countriesLoaded){this._onCountryChanged();}else{this.countrySelect.addOption({value:_c,label:_7.loading});this.countrySelect.set("disabled",true);this._request=this._task.getAvailableCountries();this.showProgress(this._request,this._onCountriesResponse);}}this.inherited(arguments);},_onCountriesResponse:function(_e){this._countriesLoaded=true;this.countrySelect.set("disabled",false);var _f=[{value:_c,label:_7.global}];for(var i=0;i<_e.length;i++){_f.push({value:_e[i].id,label:_e[i].name});}this.countrySelect.set("options",_f);this.countrySelect.set("value",this.country||_c);},_onCountryChanged:function(){var _10=this.countrySelect.get("value");this.country=_10!=_c?_10:null;this._request=this._task.getDataCollections(this.country);this.showProgress(this._request,this._onDataCollectionsResponse);},_onDataCollectionsResponse:function(_11){this.dataCollections=_11;_5.clear(this.itemsDiv);this._items=[];var _12=document.createDocumentFragment();for(var i=0;i<_11.length;i++){var _13=_11[i];var _14=_4.create("table",{"class":"DataCollection"},_12);var tr=_4.create("tr",null,_14);var td=_4.create("td",{"class":"DataCollection_Icon"},tr);var _15=_13.metadata["icon"];if(_15){_3.add(td,"DataCollection_"+_15);}var _16=new _b({checked:!!this._checks[_13.id],"class":"DataCollection_Check DataCollection_ShowOnHover"});_16.placeAt(td);_4.create("td",{"class":"DataCollection_Label",innerHTML:_13.metadata["title"]},tr);on(_14,"click",_2.hitch(this,this._onDataCollectionClick,_14,_16));this._items.push({table:_14,check:_16,data:_13});}this.itemsDiv.appendChild(_12);this.resize();this._loaded=true;},_setChecksAttr:function(_17){this._checks=_17;if(this._items){for(var i=0;i<this._items.length;i++){this._items[i].check.set("checked",_17&&!!_17[this._items[i].data.id]);this._onCheckChange(this._items[i].table,this._items[i].check);}this._onAnyCheckChange();}},_getChecksAttr:function(){if(this._items){var _18={};for(var i=0;i<this._items.length;i++){_18[this._items[i].data.id]=this._items[i].check.get("checked");}return _18;}else{return this._checks;}},_next:function(){this.onNext();},onNext:function(_19){},_onDataCollectionClick:function(_1a,_1b,evt){if(evt.target.type!="checkbox"){_1b.set("checked",!_1b.get("checked"));}this._onCheckChange(_1a,_1b);this._onAnyCheckChange();},_onCheckChange:function(_1c,_1d){if(_1d.get("checked")){_3.remove(_1d.domNode,"DataCollection_ShowOnHover");_3.add(_1c,"DataCollection_Checked");}else{_3.add(_1d.domNode,"DataCollection_ShowOnHover");_3.remove(_1c,"DataCollection_Checked");}},_onAnyCheckChange:function(){var _1e=false;for(var i=0;i<this._items.length;i++){if(this._items[i].check.get("checked")){_1e=true;break;}}this.nextButton.disabled=!_1e;},destroy:function(){this._cancel();this.inherited(arguments);},_cancel:function(){if(this._request){this._request.cancel();this._request=null;}},_back:function(){this._cancel();this.onBack();},onBack:function(){}});});