/*
	Copyright (c) 2009 - 2012 W�hlke EDV-Beratung GmbH, Weyhe, Germany - All Rights Reserved.
	http://www.woehlke-edv.de
*/

if(!dojo._hasResource["custom.facultyCenter.Login"]){dojo._hasResource["custom.facultyCenter.Login"]=true;dojo.provide("custom.facultyCenter.Login");dojo.declare("custom.facultyCenter.Login",[dijit._Widget,dijit._Templated],{widgetsInTemplate:true,templatePath:dojo.moduleUrl("custom.facultyCenter","templates/Login.html"),id:"csi_login",_onLogin:function(){dojo.xhrPost({url:"/facultycenter/authentification/login/format/json",form:this.formWidget.domNode,content:{domId:this.id,action:"login"},handleAs:"json",preventCache:true,timeout:5000,load:function(_1,_2){return dijit.byId(_2.args.content.domId)._onLoad(_1,_2);},error:function(_3,_4){return dijit.byId(_4.args.content.domId)._onError(_3,_4);}});this.passwordWidget.attr("value","");},_onLoad:function(_5,_6){if(_5.success){dojo.addClass(this.loginFormNode,"hidden");dojo.removeClass(this.logoutFormNode,"hidden");if("admin"==_5.user.usergroup){dojo.removeClass(this.adminNode,"hidden");}dojo.removeClass(this.atHomeNode,"hidden");this.messageNode.innerHTML=_5.message;this._onLoginSuccess();}else{this.messageNode.innerHTML=_5.message;}},_onLoginSuccess:function(){},_onError:function(_7,_8){dojo.addClass(this.loginFormNode,"hidden");this.messageNode.innerHTML="<h2 class='errormessage'>An error occurred</h2>"+"<p>Possibly the database is currently unavailable. Please try again later!</p>";},_onLogout:function(){dojo.xhrPost({url:"/facultycenter/authentification/logout/format/json",content:{domId:this.id,action:"logout"},handleAs:"json",preventCache:true,timeout:5000,load:function(_9,_a){return dijit.byId(_a.args.content.domId)._onLogoutLoad(_9,_a);},error:function(_b,_c){return dijit.byId(_c.args.content.domId)._onError(_b,_c);}});},_onLogoutLoad:function(_d,_e){if(_d.success){dojo.removeClass(this.loginFormNode,"hidden");dojo.addClass(this.logoutFormNode,"hidden");dojo.addClass(this.adminNode,"hidden");dojo.addClass(this.atHomeNode,"hidden");this.messageNode.innerHTML=_d.message;this._onLogoutSuccess();}else{this.messageNode.innerHTML=_d.message;}},_onLogoutSuccess:function(){},_onKeyDownUsername:function(_f){if(_f){if(_f.keyCode){if((13==_f.keyCode)||(40==_f.keyCode)||(38==_f.keyCode)){this.passwordWidget.focus();}}}},_onKeyDownPassword:function(obj){if(obj){if(obj.keyCode){if(13==obj.keyCode){this._onLogin();}else{if((40==obj.keyCode)||(38==obj.keyCode)){this.usernameWidget.focus();}}}}},startup:function(){this.inherited("startup",arguments);dojo.xhrPost({url:"/facultycenter/authentification/login/format/json/check/status",form:this.formWidget.domNode,content:{domId:this.id,action:"login"},handleAs:"json",preventCache:true,timeout:5000,load:function(_11,_12){return dijit.byId(_12.args.content.domId)._onLoad(_11,_12);},error:function(_13,_14){return dijit.byId(_14.args.content.domId)._onError(_13,_14);}});}});}if(!dojo._hasResource["custom.data.ItemFileWriteStore"]){dojo._hasResource["custom.data.ItemFileWriteStore"]=true;dojo.provide("custom.data.ItemFileWriteStore");dojo.declare("custom.data.ItemFileWriteStore",dojo.data.ItemFileWriteStore,{constructor:function(_15){this._datatypeMap["Date"].serialize=function(obj){return dojo.date.stamp.toISOString(obj,{zulu:false});};},_isEmpty:function(_17){var _18=true;if(dojo.isObject(_17)){for(var key in _17){_18=false;}}else{if(dojo.isArray(_17)){if(_17.length){_18=false;}}else{if(dojo.isString(_17)){if(_17.length){_18=false;}}}}return _18;},_itemToContentString:function(_1a){var _1b={};var _1c=this._getIdentifierAttribute();if(_1c!==Number){_1b.identifier=_1c;}if(this._labelAttr){_1b.label=this._labelAttr;}_1b.items=[];if(_1a!==null){var _1d={};for(var key in _1a){if(key!==this._storeRefPropName&&key!==this._itemNumPropName&&key!==this._reverseRefMap&&key!==this._rootItemPropName){var _1f=key;var _20=this.getValues(_1a,_1f);if(_20.length==1){_1d[_1f]=this._flatten(_20[0]);}else{var _21=[];for(var j=0;j<_20.length;++j){_21.push(this._flatten(_20[j]));_1d[_1f]=_21;}}}}_1b.items.push(_1d);}var _23=true;return dojo.toJson(_1b,_23);},_saveCustom:function(_24,_25){var _26=null;var _27=null;var _28=null;var _29=[];var _2a=this._jsonFileUrl;if(!this._isEmpty(this._pending._deletedItems)){for(var key in this._pending._deletedItems){_26=key;_2a+="/delete/true";var _2c={};_2c.identifier="id";_2c.items=[];_2c.items[0]={};_2c.items[0].id=_26;var _2d=true;_28=dojo.toJson(_2c,_2d);}}else{if(!this._isEmpty(this._pending._newItems)){for(var key in this._pending._newItems){_26=key;_27=this._pending._newItems[key];_28=this._itemToContentString(_27);}}else{if(!this._isEmpty(this._pending._modifiedItems)){for(var key in this._pending._modifiedItems){_26=key;_26=key;modifiedItem=this._pending._modifiedItems[key];_27=modifiedItem._S._arrayOfAllItems[modifiedItem._0];_28=this._itemToContentString(_27);}}else{console.error("No modifications found in this._pending! ",this._pending);_25();return false;}}}dojo.rawXhrPost({url:_2a,handleAs:"json",postData:_28,headers:{"Content-Type":"application/json"},handle:function(_2e,_2f){if(typeof (_2e)=="error"){_25(_2e);}else{if(_2e.error){_25(_2e);}else{_24();}}}});return;}});}if(!dojo._hasResource["custom.facultyCenter.Profile"]){dojo._hasResource["custom.facultyCenter.Profile"]=true;dojo.provide("custom.facultyCenter.Profile");dojo.declare("custom.facultyCenter.Profile",[dijit._Widget,dijit._Templated],{widgetsInTemplate:true,templatePath:dojo.moduleUrl("custom.facultyCenter","templates/Profile.html"),id:"faculty_profile",store:null,storeUrl:"/facultycenter/user/all-user/userprofile/true/format/json/",disableOnChange:true,hospitalCompanyStore:null,countryStore:null,departmentStore:null,cityStore:null,firstStartup:true,_onSave:function(){dojo.stopEvent(arguments[0]);if(confirm("Click 'ok' to save your changes.")){this._saveStore();this._buttonCheck();}else{}},_onReset:function(){this.disableOnChange=true;dojo.stopEvent(arguments[0]);this.store.revert();this._fetchItem();this._buttonCheck();},_onChangeError:function(){alert("Error\n\nAn Error ocurred while Loading or Saving Data!\n\nPlease reload this Page and try again.");},_changePassword:function(_30){this.passwordDialogWidget.show();},_onPwCancel:function(_31){this.passwordDialogWidget.hide();},_onChangeName:function(_32){this._onChange("name",this.nameWidget,_32);},_onChangeFirstName:function(_33){this._onChange("firstName",this.firstNameWidget,_33);},_onChangeHospitalCompany:function(_34){this._onChange("hospitalCompany",this.hospitalCompanyWidget,_34);},_onChangeDepartment:function(_35){this._onChange("department",this.departmentWidget,_35);},_onChangeStreet:function(_36){this._onChange("street",this.streetWidget,_36);},_onChangeNo:function(_37){this._onChange("no",this.noWidget,_37);},_onChangeZipCode:function(_38){this._onChange("zipCode",this.zipCodeWidget,_38);},_onChangeCity:function(_39){this._onChange("city",this.cityWidget,_39);},_onChangeCountry:function(_3a){this._onChange("country",this.countryWidget,_3a);},_onChangePhone:function(_3b){this._onChange("phone",this.phoneWidget,_3b);},_onChangeMobilePhone:function(_3c){this._onChange("mobilePhone",this.mobilePhoneWidget,_3c);},_onChangeFax:function(_3d){this._onChange("fax",this.faxWidget,_3d);},_onChangeEmail:function(_3e){this._onChange("email",this.emailWidget,_3e);},_onChange:function(_3f,_40,_41){if(!this.disableOnChange){if(_40.isValid()){if(this.store.getValue(this.activeItem,_3f)!=_40.attr("value")){this.store.setValue(this.activeItem,_3f,_40.attr("value"));}else{}}else{}this._buttonCheck();}},_onChangeSalutation:function(_42){if(!this.disableOnChange){var _43;this._salutationValidate();if(this.salutationMsWidget.attr("checked")){_43="Ms.";}else{if(this.salutationMrsWidget.attr("checked")){_43="Mrs.";}else{if(this.salutationMrWidget.attr("checked")){_43="Mr.";}}}if(this.store.getValue(this.activeItem,"salutation")!=_43){this.store.setValue(this.activeItem,"salutation",_43);}else{}}else{}this._buttonCheck();},_onChangeTitle:function(_44){if(!this.disableOnChange){var _45="";if(this.titleProfWidget.attr("checked")){_45=_45+"Prof. ";}if(this.titleDrWidget.attr("checked")){_45=_45+"Dr.";}if(this.store.getValue(this.activeItem,"title")!=_45){this.store.setValue(this.activeItem,"title",_45);}else{}}else{}this._buttonCheck();},_onChangeMd:function(_46){if(!this.disableOnChange){var md;if(this.mdWidget.attr("checked")){md="MD";}else{md="";}if(this.store.getValue(this.activeItem,"md")!=md){this.store.setValue(this.activeItem,"md",md);}else{}}else{}this._buttonCheck();},_onChangePhd:function(_48){if(!this.disableOnChange){var phd;if(this.phdWidget.attr("checked")){phd="Ph.D.";}else{phd="";}if(this.store.getValue(this.activeItem,"phd")!=phd){this.store.setValue(this.activeItem,"phd",phd);}else{}}else{}this._buttonCheck();},_onFocusCity:function(){this.cityStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/city/format/json",urlPreventCache:"true"});this.cityWidget.attr("store",this.cityStore);},_onFocusCountry:function(){this.countryStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/country/format/json",urlPreventCache:"true"});this.countryWidget.attr("store",this.countryStore);},_onFocusHospitalCompany:function(){this.hospitalCompanyStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/hospital-company/format/json",urlPreventCache:"true"});this.hospitalCompanyWidget.attr("store",this.hospitalCompanyStore);},_onFocusDepartment:function(){this.departmentStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/department/format/json",urlPreventCache:"true"});this.departmentWidget.attr("store",this.departmentStore);},_fetchItem:function(){this.store.fetch({query:{id:"*"},queryOptions:{ignoreCase:true},scope:this,onComplete:this._onFetchComplete,onItem:this._onItemFetched,onError:this._onFetchError});},_onItemFetched:function(_4a,_4b){this.activeItem=_4a;return _4b;},_onFetchComplete:function(_4c,_4d){this._refreshForm();return _4d;},_onFetchError:function(_4e,_4f){activeItem=null;alert("Error\n\nAn Error ocurred while Loading or Saving Data!\n\nPlease try again later.");this._refreshForm();return _4f;},_refreshForm:function(){this.disableOnChange=true;if("new"!=this.store.getValue(this.activeItem,"id")){this.formWidget.reset();if(this.activeItem){var _50=this.store.getValue(this.activeItem,"salutation");switch(_50){case "Ms.":this.salutationMsWidget.attr("checked","true");break;case "Mrs.":this.salutationMrsWidget.attr("checked","true");break;case "Mr.":this.salutationMrWidget.attr("checked","true");break;default:break;}var _51=this.store.getValue(this.activeItem,"title");if(_51){_51=_51.split(" ");for(var i in _51){switch(_51[i]){case "Prof.":this.titleProfWidget.attr("checked","true");break;case "Dr.":this.titleDrWidget.attr("checked","true");break;default:break;}}}var md=this.store.getValue(this.activeItem,"md");if("MD"==md){this.mdWidget.attr("checked","true");}var phd=this.store.getValue(this.activeItem,"phd");if("Ph.D."==phd){this.phdWidget.attr("checked","true");}this.idWidget.attr("value",this.store.getValue(this.activeItem,"id"));this.usernameWidget.attr("value",this.store.getValue(this.activeItem,"username"));this.nameWidget.attr("value",this.store.getValue(this.activeItem,"name"));this.firstNameWidget.attr("value",this.store.getValue(this.activeItem,"firstName"));this.hospitalCompanyWidget.attr("value",this.store.getValue(this.activeItem,"hospitalCompany"));this.departmentWidget.attr("value",this.store.getValue(this.activeItem,"department"));this.streetWidget.attr("value",this.store.getValue(this.activeItem,"street"));this.noWidget.attr("value",this.store.getValue(this.activeItem,"no"));this.zipCodeWidget.attr("value",this.store.getValue(this.activeItem,"zipCode"));this.cityWidget.attr("value",this.store.getValue(this.activeItem,"city"));this.countryWidget.attr("value",this.store.getValue(this.activeItem,"country"));this.phoneWidget.attr("value",this.store.getValue(this.activeItem,"phone"));this.mobilePhoneWidget.attr("value",this.store.getValue(this.activeItem,"mobilePhone"));this.faxWidget.attr("value",this.store.getValue(this.activeItem,"fax"));this.emailWidget.attr("value",this.store.getValue(this.activeItem,"email"));}}this.formWidget.validate();this._salutationValidate();this.disableOnChange=false;this._buttonCheck();},_buttonCheck:function(){if(!this.disableOnChange){if(this.store.isDirty()){this.resetWidget.attr("disabled",false);if(this.formWidget.isValid()&&this._salutationIsValid()){this.saveWidget.attr("disabled",false);}else{this.saveWidget.attr("disabled","disabled");}}else{this.resetWidget.attr("disabled","disabled");this.saveWidget.attr("disabled","disabled");}}else{this.resetWidget.attr("disabled","disabled");this.saveWidget.attr("disabled","disabled");}},_salutationIsValid:function(){var _55=false;if(this.salutationMrWidget.attr("checked")||this.salutationMrsWidget.attr("checked")||this.salutationMsWidget.attr("checked")){var _55=true;}return _55;},_salutationValidate:function(){if(this._salutationIsValid()){dojo.removeClass(this.salutationNode,"invalid");}else{dojo.addClass(this.salutationNode,"invalid");}},_setStore:function(){this.store=new custom.data.ItemFileWriteStore({url:this.storeUrl,urlPreventCache:"true"});return this.store;},_saveStore:function(){this.store.save({scope:this,onComplete:function(){this.disableOnChange=true;this._setStore();this._fetchItem();this.disableOnChange=false;this._buttonCheck();},onError:function(_56){if(_56.error){alert(_56.error);this._setStore();this._fetchItem();}else{alert("When saving an error has occurred!\n Please reload this Tool and try again!");this.formWidget.reset();}}});},startup:function(){this.inherited("startup",arguments);if(this.firstStartup){this.firstStartup=false;this.cityStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/city/format/json",urlPreventCache:"true"});this.cityWidget.attr("store",this.cityStore);this.countryStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/country/format/json",urlPreventCache:"true"});this.countryWidget.attr("store",this.countryStore);this.hospitalCompanyStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/hospital-company/format/json",urlPreventCache:"true"});this.hospitalCompanyWidget.attr("store",this.hospitalCompanyStore);this.departmentStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/department/format/json",urlPreventCache:"true"});this.departmentWidget.attr("store",this.departmentStore);this._setStore();this._fetchItem();this.disableOnChange=false;this._buttonCheck();}}});}if(!dojo._hasResource["custom.facultyCenter.Password"]){dojo._hasResource["custom.facultyCenter.Password"]=true;dojo.provide("custom.facultyCenter.Password");dojo.declare("custom.facultyCenter.Password",[dijit._Widget,dijit._Templated],{widgetsInTemplate:true,templatePath:dojo.moduleUrl("custom.facultyCenter","templates/Password.html"),id:"faculty_password",store:null,storeUrl:"/facultycenter/authentification/set-password/format/json/",disableOnChange:true,firstStartup:true,_onSave:function(){dojo.stopEvent(arguments[0]);if(this.store.getValue(this.activeItem,"newPassword")!=this.store.getValue(this.activeItem,"retypeNewPassword")){alert("Password confirmation failed!\n\n'New Password' and 'Retype new password' are different.\n\nPlease try again.");}else{if(this.store.getValue(this.activeItem,"newPassword")==this.store.getValue(this.activeItem,"username")){alert("Password check failed!\n\n'New Password' contains 'Username'.\n\nPlease try again with another password.");}else{this._saveStore();this._buttonCheck();}}},_onCancel:function(){this.disableOnChange=true;dojo.stopEvent(arguments[0]);this.store.revert();this._fetchItem();this._buttonCheck();this.onPwCancel();},_onChangeError:function(){alert("Error\n\nAn Error ocurred while Loading or Saving Data!\n\nPlease reload this Page and try again.");},_onChangePassword:function(_57){this._onChange("password",this.passwordWidget,_57);},_onChangeNewPassword:function(_58){this._onChange("newPassword",this.newPasswordWidget,_58);},_onChangeRetypeNewPassword:function(_59){this._onChange("retypeNewPassword",this.retypeNewPasswordWidget,_59);},_onChange:function(_5a,_5b,_5c){if(!this.disableOnChange){if(_5b.isValid()){if(this.store.getValue(this.activeItem,_5a)!=_5b.attr("value")){this.store.setValue(this.activeItem,_5a,_5b.attr("value"));}else{}}else{}this._buttonCheck();}},_fetchItem:function(){this.store.fetch({query:{id:"*"},queryOptions:{ignoreCase:true},scope:this,onComplete:this._onFetchComplete,onItem:this._onItemFetched,onError:this._onFetchError});},_onItemFetched:function(_5d,_5e){this.activeItem=_5d;return _5e;},_onFetchComplete:function(_5f,_60){this._refreshForm();return _60;},_onFetchError:function(_61,_62){activeItem=null;alert("Error\n\nAn Error ocurred while Loading or Saving Data!\n\nPlease try again later.");this._refreshForm();return _62;},_refreshForm:function(){this.disableOnChange=true;this.formWidget.reset();if(this.activeItem){this.idWidget.attr("value",this.store.getValue(this.activeItem,"id"));this.usernameWidget.attr("value",this.store.getValue(this.activeItem,"username"));}this.disableOnChange=false;this._buttonCheck();},_buttonCheck:function(){if(!this.disableOnChange){if(this.store.isDirty()){this.cancelWidget.attr("disabled",false);if(this.formWidget.isValid()){this.saveWidget.attr("disabled",false);}else{this.saveWidget.attr("disabled","disabled");}}else{this.cancelWidget.attr("disabled",false);this.saveWidget.attr("disabled","disabled");}}else{this.cancelWidget.attr("disabled","disabled");this.saveWidget.attr("disabled","disabled");}},_setStore:function(){this.store=new custom.data.ItemFileWriteStore({url:this.storeUrl,urlPreventCache:"true"});return this.store;},_saveStore:function(){this.store.save({scope:this,onComplete:function(){this.disableOnChange=true;this._setStore();this._fetchItem();this.disableOnChange=false;this._buttonCheck();this.onPwChanged();},onError:function(_63){if(_63.error){alert(_63.error);this._setStore();this._fetchItem();}else{alert("When saving an error has occurred!\n Please reload this Tool and try again!");this.formWidget.reset();}}});},onPwChanged:function(){},onPwCancel:function(){},startup:function(){this.inherited("startup",arguments);if(this.firstStartup){this.firstStartup=false;this._setStore();this._fetchItem();this.disableOnChange=false;this._buttonCheck();console.debug(this);console.debug(this.store);}}});}if(!dojo._hasResource["custom.facultyCenter.HotelAndTravel"]){dojo._hasResource["custom.facultyCenter.HotelAndTravel"]=true;dojo.provide("custom.facultyCenter.HotelAndTravel");dojo.declare("custom.facultyCenter.HotelAndTravel",[dijit._Widget,dijit._Templated],{widgetsInTemplate:true,templatePath:dojo.moduleUrl("custom.facultyCenter","templates/HotelAndTravel.html?no-cache=2011-12-22"),id:"faculty_hotelAndTravel",store:null,storeUrl:"/facultycenter/hotel-and-travel/data/userprofile/true/format/json",activeItem:null,disableOnChange:true,dateFormatter:{locale:"en-us",datePattern:"MMM dd, yyyy"},countryStore:null,stationStore:null,airportStore:null,cityStore:null,firstStartup:true,_onSave:function(){dojo.stopEvent(arguments[0]);if(confirm("Click 'ok' to save your changes.")){this._saveStore();this._buttonCheck();}else{}},_onReset:function(){this.disableOnChange=true;dojo.stopEvent(arguments[0]);this.store.revert();this._fetchItem();this._buttonCheck();},_onNoItemSelected:function(){alert("No record selected!\n\nAn Please select any record from the table below.");},_onChangeSpecialWishes:function(_64){this._onChangeNoValidation("specialWishes",this.specialWishesWidget,_64);},_onChangeArrDayDepStation:function(_65){this._onChange("arrDayDepStation",this.arrDayDepStationWidget,_65);},_onChangeArrDayDepAirport:function(_66){this._onChange("arrDayDepAirport",this.arrDayDepAirportWidget,_66);},_onChangeArrDayDepCity:function(_67){this._onChange("arrDayDepCity",this.arrDayDepCityWidget,_67);},_onChangeArrDayDepCountry:function(_68){this._onChange("arrDayDepCountry",this.arrDayDepCountryWidget,_68);},_onChangeDepDayArrStation:function(_69){this._onChange("depDayArrStation",this.depDayArrStationWidget,_69);},_onChangeDepDayArrAirport:function(_6a){this._onChange("depDayArrAirport",this.depDayArrAirportWidget,_6a);},_onChangeDepDayArrCity:function(_6b){this._onChange("depDayArrCity",this.depDayArrCityWidget,_6b);},_onChangeDepDayArrCountry:function(_6c){this._onChange("depDayArrCountry",this.depDayArrCountryWidget,_6c);},_onChangeTraveling:function(_6d){if(!this.disableOnChange){var _6e;if(this.travelingCarWidget.attr("checked")){_6e="Car";}else{if(this.travelingPlaneWidget.attr("checked")){_6e="Plane";}else{if(this.travelingTrainWidget.attr("checked")){_6e="Train";}}}if(this.store.getValue(this.activeItem,"traveling")!=_6e){this.store.setValue(this.activeItem,"traveling",_6e);}else{}}else{}this._buttonCheck();this._travelingCheck();},_onChangeNoValidation:function(_6f,_70,_71){if(!this.disableOnChange){if(this._checkId()){if(this.store.getValue(this.activeItem,_6f)!=_70.attr("value")){this.store.setValue(this.activeItem,_6f,_70.attr("value"));}else{}}else{this._onNoItemSelected();}this._buttonCheck();}},_onChange:function(_72,_73,_74){if(!this.disableOnChange){if(this._checkId()){if(_73.isValid()){if(this.store.getValue(this.activeItem,_72)!=_73.attr("value")){this.store.setValue(this.activeItem,_72,_73.attr("value"));}else{}}else{}}else{this._onNoItemSelected();}this._buttonCheck();}},_onChangeBookingService:function(_75){this._bookingServiceCheck();if(!this.disableOnChange){if(this._checkId()){var _76;if(this.bookingServiceWidget.attr("checked")){_76=true;}else{_76=false;}this.store.setValue(this.activeItem,"bookingService",_76);}else{this._onNoItemSelected();}}else{}this._buttonCheck();},_onChangeArrDayDate:function(){if(this.arrDayDateWidget.isValid()&&!this.disableOnChange){if(this._checkId()){var _77=null;if(this.store.getValue(this.activeItem,"arrDayDate")){_77=dojo.date.stamp.toISOString(this.store.getValue(this.activeItem,"arrDayDate"),{selector:"date"});}var _78=null;var _79=null;if(this.arrDayDateWidget.attr("value")){_78=dojo.date.stamp.toISOString(this.arrDayDateWidget.attr("value"),{selector:"date"});_79=new Date(dojo.date.locale.format(this.arrDayDateWidget.attr("value"),this.dateFormatter));}if(_77!=_78){this.store.setValue(this.activeItem,"arrDayDate",_79);}else{}}else{this._onNoItemSelected();}}else{}this._buttonCheck();},_onChangeDepDayDate:function(){if(this.depDayDateWidget.isValid()&&!this.disableOnChange){if(this._checkId()){var _7a=null;if(this.store.getValue(this.activeItem,"depDayDate")){_7a=dojo.date.stamp.toISOString(this.store.getValue(this.activeItem,"depDayDate"),{selector:"date"});}var _7b=null;var _7c=null;if(this.depDayDateWidget.attr("value")){_7b=dojo.date.stamp.toISOString(this.depDayDateWidget.attr("value"),{selector:"date"});_7c=new Date(dojo.date.locale.format(this.depDayDateWidget.attr("value"),this.dateFormatter));}if(_7a!=_7b){this.store.setValue(this.activeItem,"depDayDate",_7c);}else{}}else{this._onNoItemSelected();}}else{}this._buttonCheck();},_onChangeArrDayDepTime:function(){if(this.arrDayDepTimeWidget.isValid()&&!this.disableOnChange){if(this._checkId()){if(this.store.getValue(this.activeItem,"arrDayDepTime")!=this.arrDayDepTimeWidget.attr("value")){this.store.setValue(this.activeItem,"arrDayDepTime",this.arrDayDepTimeWidget.attr("value"));}else{}}else{this._onNoItemSelected();}}else{}this._buttonCheck();},_onChangeDepDayDepTime:function(){if(this.depDayDepTimeWidget.isValid()&&!this.disableOnChange){if(this._checkId()){if(this.store.getValue(this.activeItem,"depDayDepTime")!=this.depDayDepTimeWidget.attr("value")){this.store.setValue(this.activeItem,"depDayDepTime",this.depDayDepTimeWidget.attr("value"));}else{}}else{this._onNoItemSelected();}}else{}this._buttonCheck();},_onFocusCity:function(){this.cityStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/city/format/json",urlPreventCache:"true"});this.arrDayDepCityWidget.attr("store",this.cityStore);this.depDayArrCityWidget.attr("store",this.cityStore);},_onFocusCountry:function(){this.countryStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/country/format/json",urlPreventCache:"true"});this.arrDayDepCountryWidget.attr("store",this.countryStore);this.depDayArrCountryWidget.attr("store",this.countryStore);},_onFocusStation:function(){this.stationStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/hotel-and-travel/distinct-values/column/station/format/json",urlPreventCache:"true"});this.arrDayDepStationWidget.attr("store",this.stationStore);this.depDayArrStationWidget.attr("store",this.stationStore);},_onFocusAirport:function(){this.airportStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/hotel-and-travel/distinct-values/column/airport/format/json",urlPreventCache:"true"});this.arrDayDepAirportWidget.attr("store",this.airportStore);this.depDayArrAirportWidget.attr("store",this.airportStore);},_fetchItem:function(){this.store.fetch({query:{id:"*"},queryOptions:{ignoreCase:true},scope:this,onComplete:this._onFetchComplete,onItem:this._onItemFetched,onError:this._onFetchError});},_onItemFetched:function(_7d,_7e){this.activeItem=_7d;return _7e;},_onFetchComplete:function(_7f,_80){this._refreshForm();return _80;},_onFetchError:function(_81,_82){activeItem=null;alert("Error\n\nAn Error ocurred while Loading or Saving Data!\n\nPlease try again later.");this._refreshForm();return _82;},_refreshForm:function(){this.disableOnChange=true;this.formWidget.reset();var _83=false;if(this.activeItem){_83=this.store.getValue(this.activeItem,"userCanEdit");var _84="";if(this.store.getValue(this.activeItem,"title")&&(""!=this.store.getValue(this.activeItem,"title"))){_84+=this.store.getValue(this.activeItem,"title")+" ";}if(this.store.getValue(this.activeItem,"firstName")&&(""!=this.store.getValue(this.activeItem,"firstName"))){_84+=this.store.getValue(this.activeItem,"firstName")+" ";}_84+=this.store.getValue(this.activeItem,"name");this.nameNode.innerHTML=_84;this.statusNode.innerHTML=this.store.getValue(this.activeItem,"status");if(_83){this.statusNode.innerHTML+="";}else{this.statusNode.innerHTML+=" - Currently no changes can be made.<br />"+"In case of an error, please contact the congress organisation.";}if(this.store.getValue(this.activeItem,"documentName")){this.documentNode.innerHTML="<a class=\"link\" style=\"font-weight: bold;\" target=\"_blank\" href=\"/facultycenter/download/hotel-and-travel/file/"+this.store.getValue(this.activeItem,"documentName")+"\">Download your online-ticket here</a>";}else{this.documentNode.innerHTML="";}var _85=this.store.getValue(this.activeItem,"traveling");switch(_85){case "Car":this.travelingCarWidget.attr("checked","true");break;case "Plane":this.travelingPlaneWidget.attr("checked","true");break;case "Train":this.travelingTrainWidget.attr("checked","true");break;default:break;}if(this.store.getValue(this.activeItem,"bookingService")){this.bookingServiceWidget.attr("checked",true);}else{if(this.store.getValue(this.activeItem,"hotelAndTravelStatusId")!=1){this.selfPlannerWidget.attr("checked",true);}}this.idWidget.attr("value",this.store.getValue(this.activeItem,"id"));this.specialWishesWidget.attr("value",this.store.getValue(this.activeItem,"specialWishes"));this.arrDayDateWidget.attr("value",this.store.getValue(this.activeItem,"arrDayDate"));this.arrDayDepTimeWidget.attr("value",this.store.getValue(this.activeItem,"arrDayDepTime"));this.arrDayDepStationWidget.attr("value",this.store.getValue(this.activeItem,"arrDayDepStation"));this.arrDayDepAirportWidget.attr("value",this.store.getValue(this.activeItem,"arrDayDepAirport"));if(this.store.getValue(this.activeItem,"arrDayFlightNumber")){this.arrDayFlightNumberWidget.attr("value",this.store.getValue(this.activeItem,"arrDayFlightNumber"));}else{dojo.style(this.arrDayFlightNumberRowNode,{"display":"none"});}this.arrDayDepCityWidget.attr("value",this.store.getValue(this.activeItem,"arrDayDepCity"));this.arrDayDepCountryWidget.attr("value",this.store.getValue(this.activeItem,"arrDayDepCountry"));this.depDayDateWidget.attr("value",this.store.getValue(this.activeItem,"depDayDate"));this.depDayDepTimeWidget.attr("value",this.store.getValue(this.activeItem,"depDayDepTime"));this.depDayArrStationWidget.attr("value",this.store.getValue(this.activeItem,"depDayArrStation"));this.depDayArrAirportWidget.attr("value",this.store.getValue(this.activeItem,"depDayArrAirport"));if(this.store.getValue(this.activeItem,"depDayFlightNumber")){this.depDayFlightNumberWidget.attr("value",this.store.getValue(this.activeItem,"depDayFlightNumber"));}else{dojo.style(this.depDayFlightNumberRowNode,{"display":"none"});}this.depDayArrCityWidget.attr("value",this.store.getValue(this.activeItem,"depDayArrCity"));this.depDayArrCountryWidget.attr("value",this.store.getValue(this.activeItem,"depDayArrCountry"));dojo.query("td.csiLabel.bServiceIndependent").removeClass("tempDisabled");}else{this._disableForm();}this.disableOnChange=false;if(_83){this._bookingServiceCheck();}else{this._disableForm();}this.formWidget.validate();this._buttonCheck();},_disableForm:function(){dojo.query("td.csiLabel.bServiceLabel").removeClass("bServiceDisabled");dojo.query(".csiLabel").addClass("tempDisabled");dojo.query("form fieldset").addClass("disabled");dojo.query("form div.csiFormElement.dijit").forEach(function(_86,_87,_88){dijit.byNode(_86).attr("disabled",true);});dojo.query("form textarea.csiFormElement.dijit").forEach(function(_89,_8a,_8b){dijit.byNode(_89).attr("disabled",true);},this);},_bookingServiceCheck:function(){if(this.bookingServiceWidget.attr("checked")){dojo.query("td.csiLabel.bServiceLabel").removeClass("tempDisabled, bServiceDisabled");dojo.query(".csiLabel").removeClass("tempDisabled");dojo.query("form fieldset.bookingService").removeClass("disabled");dojo.query("form fieldset.selfPlanner").addClass("disabled");dojo.query("form div.csiFormElement.dijit").forEach(function(_8c,_8d,_8e){dijit.byNode(_8c).attr("disabled",false);},this);dojo.query("form textarea.csiFormElement.dijit").forEach(function(_8f,_90,_91){dijit.byNode(_8f).attr("disabled",false);},this);}else{dojo.query("td.csiLabel.bServiceLabel").addClass("bServiceDisabled");dojo.query(".csiLabel.bService").addClass("tempDisabled");dojo.query("form fieldset.bookingService").addClass("disabled");if(this.selfPlannerWidget.attr("checked")){dojo.query("form fieldset.selfPlanner").removeClass("disabled");}dojo.query("form div.csiFormElement.dijit").forEach(function(_92,_93,_94){if((_92!=this.bookingServiceWidget.domNode)&&(_92!=this.selfPlannerWidget.domNode)){dijit.byNode(_92).attr("disabled",true);}else{dijit.byNode(_92).attr("disabled",false);}},this);dojo.query("form textarea.csiFormElement.dijit").forEach(function(_95,_96,_97){dijit.byNode(_95).attr("disabled",true);},this);}},_travelingCheck:function(){var _98;if(this.travelingCarWidget.attr("checked")){_98="Car";}else{if(this.travelingPlaneWidget.attr("checked")){_98="Plane";}else{if(this.travelingTrainWidget.attr("checked")){_98="Train";}}}switch(_98){case "Car":dojo.query(".notCar").addClass("hidden");dojo.query(".train").addClass("hidden");dojo.query(".plane").addClass("hidden");break;case "Plane":dojo.query(".notCar").removeClass("hidden");dojo.query(".train").addClass("hidden");dojo.query(".plane").removeClass("hidden");break;case "Train":dojo.query(".notCar").removeClass("hidden");dojo.query(".train").removeClass("hidden");dojo.query(".plane").addClass("hidden");break;default:dojo.query(".notCar").addClass("hidden");dojo.query(".train").addClass("hidden");dojo.query(".plane").addClass("hidden");break;}},_buttonCheck:function(){if(!this.disableOnChange){if(this.store.isDirty()){this.resetWidget.attr("disabled",false);if(this.formWidget.isValid()){this.saveWidget.attr("disabled",false);}else{this.saveWidget.attr("disabled","disabled");}}else{this.resetWidget.attr("disabled","disabled");this.saveWidget.attr("disabled","disabled");}}else{this.resetWidget.attr("disabled","disabled");this.saveWidget.attr("disabled","disabled");}},_checkId:function(){if(this.activeItem&&(this.store.getValue(this.activeItem,"id")==this.idWidget.attr("value"))){return true;}else{return false;}},_setStore:function(){this.store=new custom.data.ItemFileWriteStore({url:this.storeUrl,urlPreventCache:"true"});this._fetchItem();return this.store;},_saveStore:function(){this.store.save({scope:this,onComplete:function(){this.disableOnChange=true;this._setStore();this._fetchItem();this.disableOnChange=false;this._buttonCheck();},onError:function(_99){if(_99.error){alert(_99.error);this._setStore();this._fetchItem();}else{alert("When saving an error has occurred!\n Please reload this Tool and try again!");this.formWidget.reset();}}});},startup:function(){this.inherited("startup",arguments);if(this.firstStartup){this.firstStartup=false;this.cityStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/city/format/json",urlPreventCache:"true"});this.arrDayDepCityWidget.attr("store",this.cityStore);this.depDayArrCityWidget.attr("store",this.cityStore);this.countryStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/user/distinct-values/column/country/format/json",urlPreventCache:"true"});this.arrDayDepCountryWidget.attr("store",this.countryStore);this.depDayArrCountryWidget.attr("store",this.countryStore);this.stationStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/hotel-and-travel/distinct-values/column/station/format/json",urlPreventCache:"true"});this.arrDayDepStationWidget.attr("store",this.stationStore);this.depDayArrStationWidget.attr("store",this.stationStore);this.airportStore=new dojo.data.ItemFileReadStore({url:"/facultycenter/hotel-and-travel/distinct-values/column/airport/format/json",urlPreventCache:"true"});this.arrDayDepAirportWidget.attr("store",this.airportStore);this.depDayArrAirportWidget.attr("store",this.airportStore);this._setStore();this._disableForm();this.disableOnChange=false;this._buttonCheck();}}});}

