
FPoi=Ext.extend(FPoiUi,{initComponent:function(){Ext.apply(this,{width:400,autoScroll:true,frame:true,title:'Datenblatt',collapsible:true,collapsedTitle:true,collapsed:false,disabled:true});FPoi.superclass.initComponent.call(this);},showSubForm:function(type){this.items.each(function(item){if((item.itemId||'').startsWith('opt')){item.hide();}});this.getComponent('fieldset').getComponent('opt'+type).show();}});FPoiUi=Ext.extend(Ext.form.FormPanel,{labelWidth:100,labelAlign:'left',monitorValid:true,initComponent:function(){var self=this;this.items=[{xtype:'fieldset',itemId:'fieldset',title:'Parameter',layout:'form',items:[{xtype:'textfield',fieldLabel:'Name',anchor:'100%',name:'title',allowBlank:false,maxLength:45},{xtype:'combo',fieldLabel:'Typ',name:'cb_poitypes',hiddenName:'type',valueField:'idpoitypes',displayField:'poitype',store:Ext.StoreMgr.get('poiTypesStore'),typeAhead:true,triggerAction:'all',selectOnFocus:true,allowBlank:false,listeners:{'select':function(combo,record,index){self.showSubForm(record.get('idpoitypes'));}},scope:this},{xtype:'textfield',name:'lat',hidden:true,height:0},{xtype:'textfield',name:'lng',hidden:true,height:0},{itemId:'opt1',xtype:'fieldset',title:'Optionen',layout:'form',hidden:true,hideMode:'offsets',items:[{xtype:'textfield',fieldLabel:'URL des Bildes',anchor:'100%',name:'imgUrl1',maxLength:255},{xtype:'textfield',fieldLabel:'Website',anchor:'100%',name:'homepage1',maxLength:255},{xtype:'numberfield',fieldLabel:'Seehöhe',anchor:'100%',name:'altitude1',allowDecimals:false}]},{itemId:'opt2',xtype:'fieldset',title:'Optionen',layout:'form',hidden:true,hideMode:'offsets',items:[{fieldLabel:'Quelltext (HTML)',name:'html2',xtype:'htmleditor',enableColors:false,enableAlignments:false,enableFont:false,enableFontSize:false}]},{itemId:'opt3',xtype:'fieldset',title:'Optionen',layout:'form',hidden:true,hideMode:'offsets',items:[{fieldLabel:'Quelltext (HTML)',name:'html3',xtype:'htmleditor',enableColors:false,enableAlignments:false,enableFont:false,enableFontSize:false}]},{itemId:'opt4',xtype:'fieldset',title:'Optionen',layout:'form',hidden:true,hideMode:'offsets',items:[{fieldLabel:'Quelltext (HTML)',name:'html4',xtype:'htmleditor',enableColors:false,enableAlignments:false,enableFont:false,enableFontSize:false}]},{itemId:'opt5',xtype:'fieldset',title:'Optionen',layout:'form',hidden:true,hideMode:'offsets',items:[{name:'html5',xtype:'htmleditor',enableColors:false,enableAlignments:false,enableFont:false,enableFontSize:false}]}]}];FPoiUi.superclass.initComponent.call(this);}});FPreferences=Ext.extend(FPreferencesUi,{initComponent:function(){this.overlayStore=new Ext.data.Store({id:'id',reader:new Ext.data.JsonReader({successProperty:'success',idProperty:'id',root:'data'},Tom.MapServerOverlayRecord)})
FPreferences.superclass.initComponent.call(this);},onUpdateMaps:function(){var f=this.getForm();var startId=f.findField('ms_id_start').getValue();var endId=f.findField('ms_id_end').getValue();Ext.Msg.show({title:'Lokale Karten',progressText:'Suche Kartenverzeichnisse...',width:300,height:60,buttons:Ext.Msg.CANCEL,progress:true,closable:true});this.local=new Array();Tom.tmpCounter=0;Tom.tmpCounterMax=endId-startId;Tom.tmpOverlays=new Array();for(var i=startId;i<=endId;i++){CSSHttpRequest.get(Tom.MyApp.MapServer.fullServerUrl()
+pad(i,3)+'/config.css',function(response){if(Ext.isString(response)){if(response.length>0){var data=Ext.decode(response);if(Ext.isDefined(data.title)&&Ext.isDefined(data.subFolder)){Tom.tmpOverlays.push(data);}}}
Tom.tmpCounter++;var p=Tom.tmpCounter/Tom.tmpCounterMax;Ext.Msg.updateProgress(p);if(Tom.tmpCounter>Tom.tmpCounterMax){Ext.Msg.show({title:'Lokale Karten',progressText:Tom.tmpOverlays.length
+' Karten gefunden!',width:300,height:60,progress:true,buttons:Ext.Msg.OK});Ext.Msg.updateProgress(1);Ext.getCmp('ms_overlays_tf').setValue(Ext.encode({data:Tom.tmpOverlays}));}});}}});Tom.editPrefs=Ext.extend(Ext.Window,{constructor:function(config){config=Ext.apply({title:'Benutzereinstellungen',iconCls:'i_settings',items:new FPreferences({itemId:'prefForm'}),width:800,autoScroll:true,autoHeight:true,buttons:[{text:'Anwenden',icon:'/icon/save/'+ip+'_16.png',scope:this,handler:function(){this.updateMember();}},{text:'<b>Speichern</b>',icon:'/icon/ok/'+ip+'_16.png',scope:this,handler:function(){this.updateMember();this.close();}},{text:'Abbrechen',icon:'/icon/cancel/'+ip+'_16.png',scope:this,handler:function(){this.close();}}],scope:this,listeners:{beforeClose:function(){}}},config);Tom.editPrefs.superclass.constructor.call(this,config);},updateMember:function(){var values=this.getComponent('prefForm').getForm().getValues();Tom.MyApp.member.user=values.user;Tom.MyApp.member.name=values.name;Tom.MyApp.member.email=values.email;Tom.MyApp.member.newPassword=values.password;delete(values.user);delete(values.name);delete(values.email);delete(values.password);delete(values.passcfrm);Tom.MyApp.member.config=values;if(Ext.isString(values.ms_overlays_tf)){if(values.ms_overlays_tf.length>0){Tom.MyApp.member.config.ms_overlays=Ext.decode(values.ms_overlays_tf);}
delete(values.ms_overlays_tf);}
Tom.MyApp.MapServer.update(values);Tom.MyApp.saveMember();}});FPreferencesUi=Ext.extend(Ext.form.FormPanel,{labelWidth:150,labelAlign:'left',bodyStyle:'padding:5px 5px 0',monitorValid:true,initComponent:function(){var thisPanel=this;this.items=[{layout:'column',border:false,items:[{columnWidth:.5,layout:'form',border:false,defaultType:'textfield',items:[{fieldLabel:'Benutzername',name:'user',disabled:true,anchor:'95%'},{fieldLabel:'Passwort',inputType:'password',name:'password',id:'FPreferencesPassword',anchor:'95%'},{fieldLabel:'Passwort bestätigen',inputType:'password',name:'passcfrm',vtype:'password',initialPassField:'FPreferencesPassword',anchor:'95%'}]},{columnWidth:.5,layout:'form',border:false,defaultType:'textfield',items:[{fieldLabel:'Name',name:'name',anchor:'95%'},{fieldLabel:'Email',name:'email',vtype:'email',anchor:'95%'}]}]},{xtype:'tabpanel',plain:true,activeTab:0,height:400,deferredRender:false,defaults:{bodyStyle:'padding:10px'},items:[{title:'Allgemein',layout:'form',autoScroll:true,items:[{xtype:'combo',name:'theme_cb',hiddenName:'theme',fieldLabel:'Design',forceSelection:true,mode:'local',triggerAction:'all',width:250,editable:false,store:new Ext.data.ArrayStore({id:0,fields:['myId','displayText'],data:[['blue','Blau'],['gray','Silber'],['access','Dunkel']]}),valueField:'myId',displayField:'displayText',listeners:{select:function(combo,record,index){setActiveStyleSheet(record.get('myId'));}}}]},{title:'Online Karten',layout:'form',autoScroll:true,items:[{xtype:'displayfield',fieldLabel:'Swiss Map',html:'<h1>Problem</h1>'
+'<p>Der Webserver auf <a href="www.mapplus.ch" target="_blank">mapplus.ch</a>, welcher die SwissMap online zur Verfügung stellt, verfügt über eine sogenannte Referrer-Prüfung. Das bedeutet: Wenn eine Anfrage nicht vom eigenen Server kommt, wird diese blockiert. Durch Modifikation der eigenen HTTP-Anfragen lässt sich dieser Mechanismus leicht aushebeln.</p>'
+'<h1>Lösung am Beispiel Firefox 3.6</h1>'
+'<p><ol>'
+'<li>Installation des Addons &quot;RefControl&quot;<br>'
+'Menü Extras &gt; Add-Ons &gt; Add-Ons herunterladen &gt; nach &quot;RefControl&quot; suchen.</li>'
+'Menü Extras &gt; Add-Ons &gt; Erweiterungen &gt; RefControl &gt; Einstellungen auswählen<br>'
+'&quot;Seite hinzufügen&quot; mit Seite: <b>mapplus.ch</b> und Spezifisch: <b>http://www.mapplus.ch/NeapoljsMapPage.php?uid=public&group=public&sessID=12345678901234567890123456789012</b>'},{xtype:'checkbox',name:'swissmap',boxLabel:'Ja, ich habe die Referrer Einstellungen durchgeführt und möchte die SwissMap verwenden'}]},{title:'Lokaler Kartenserver',layout:'form',autoScroll:true,defaultType:'textfield',items:[{xtype:'displayfield',fieldLabel:'Erklärung',html:'<p>Neben den online frei verfügbaren Karten kann eigenes Kartenmaterial verwendet werden. Voraussetzung dafür ist ein Webserver im eigenen LAN.</p>'
+'<p><a href="http://code.google.com/p/mongoose/" target="_blank">Mongoose</a> gibts für Windows, Linux, Mac. Das Programm (128kB) muss nicht installiert werden, nach dem Start läuft auf http://localhost:8080 der Mini-Webserver...</p>'},{xtype:'combo',name:'ms_mode_cb',hiddenName:'ms_mode',fieldLabel:'Server Typ',forceSelection:true,mode:'local',triggerAction:'all',width:250,editable:false,store:new Ext.data.ArrayStore({id:0,fields:['myId','displayText'],data:[['none','Kein lokaler Kartenserver'],['own','Eigener Server']]}),valueField:'myId',displayField:'displayText'},{xtype:'fieldset',title:'Eigener Webserver',autoHeight:true,defaultType:'textfield',collapsed:false,items:[{fieldLabel:'Host Name',name:'ms_hostname',emptyText:'Host Name oder IP-Adresse (ohne http://)',width:250},{fieldLabel:'Webroot',validator:function(validateValue){if(validateValue.length>0){if(validateValue.charAt(validateValue.length
-1)=="/"){return true;}else{return"Am Ende des Pfades muss ein '/' sein";}}else{return true;}},name:'ms_webroot',width:250},{xtype:'numberfield',name:'ms_port',fieldLabel:'Port',emptyText:'8080',maxLength:5,width:50}]}]},{title:'Lokale Karten',layout:'form',autoScroll:true,defaultType:'textfield',items:[{xtype:'displayfield',fieldLabel:'Hinweis',html:'<p>Am Root-Verzeichnisses des lokalen Kartenservers müssen durchnummerierte Ordner (001-999) liegen, welche jeweils eine Karte im Google Maps Overlay Format enthalten kann.</p>'
+'<p>Werden Karten hinzugefügt/gelöscht, muss das Kartenverzeichnis aktualisiert werden.</p>'},{xtype:'compositefield',width:100,fieldLabel:'Kartenverzeichnis',anchor:'-20',defaults:{flex:1},items:[{xtype:'displayfield',value:'Von'},{xtype:'spinnerfield',name:'ms_id_start',minValue:0,maxValue:999,allowDecimals:false,accelerate:true,allowBlank:false,value:1},{xtype:'displayfield',value:'bis'},{xtype:'spinnerfield',name:'ms_id_end',minValue:0,maxValue:999,allowDecimals:false,accelerate:true,allowBlank:false,value:30},{xtype:'button',fieldLabel:'',text:'Kartenverzeichnis neu einlesen',flex:3,scope:this,handler:function(){this.onUpdateMaps();}},{xtype:'displayfield',value:'',anchor:'200'}]},{xtype:'textarea',id:'ms_overlays_tf',name:'ms_overlays_tf',hidden:true}]}]}];FTrailUi.superclass.initComponent.call(this);this.addEvents('onUpdateMaps');}});FProject=Ext.extend(FProjectUi,{initComponent:function(){Ext.apply(this,{width:400,autoScroll:true,frame:true,title:'Datenblatt',collapsible:true,collapsedTitle:true,collapsed:false,disabled:true,method:'POST',url:'/queries/projectstore/create.php'});FProject.superclass.initComponent.call(this);}});FProjectUi=Ext.extend(Ext.form.FormPanel,{labelWidth:100,labelAlign:'left',monitorValid:true,initComponent:function(){this.items=[{xtype:'container',autoEl:'div',layout:'form',autoScroll:true,items:[{xtype:'container',layout:'hbox',layoutConfig:{pack:'start',align:'stretchmax'},items:[{xtype:'fieldset',title:'Parameter',layout:'form',flex:1.5,items:[{xtype:'textfield',fieldLabel:'Name',anchor:'100%',name:'title',allowBlank:false,maxLength:45},{xtype:'textarea',fieldLabel:'Kurzbeschreibung',anchor:'100%',name:'description',allowBlank:false,maxLength:255}]}]}]},{xtype:'textfield',name:'idprojects',hidden:true,height:0},{xtype:'textarea',name:'encLatLngs',hidden:true,height:0},{xtype:'textarea',name:'encLevels',hidden:true,height:0},{xtype:'textfield',name:'label_lat',hidden:true,height:0},{xtype:'textfield',name:'label_lng',hidden:true,height:0},{xtype:'textfield',name:'bounds',hidden:true,height:0}];FProjectUi.superclass.initComponent.call(this);this.addEvents('getTrackProperties');}});FTrail=Ext.extend(FTrailUi,{initComponent:function(){this.generateTagCheckboxes();FTrail.superclass.initComponent.call(this);},setTagCheckboxes:function(checked){if(Ext.isArray(checked)){var cbs=this.getForm().findField('tagGroup').items.items;for(var i=0;i<cbs.length;i++){var cb=cbs[i];if(Ext.isString(cb.name)){if(checked.inArray(cb.name.replace(/cbtag/g,""))){cb.setValue(true);}}}}},getTagCheckboxes:function(){var checked=new Array();var cbs=this.getForm().findField('tagGroup').items.items;for(var i=0;i<cbs.length;i++){cb=cbs[i];if(Ext.isString(cb.name)){if(cb.name.indexOf(cb.name.replace(/cbtag/g,""))>=0){if(cb.getValue()){checked.push(cb.name.replace(/cbtag/g,""));}}}}
return checked.join(";");},generateTagCheckboxes:function(){this.tagCheckboxes=new Ext.form.CheckboxGroup({xtype:'checkboxgroup',itemCls:'x-check-group-alt',fieldLabel:'Besondere Merkmale',anchor:'95%',name:'tagGroup',items:[{columnWidth:'.25',name:'tags1',items:[{xtype:'label',text:'Abfahrt',cls:'x-form-check-group-label',anchor:'-15'}]},{columnWidth:'.25',name:'tags2',items:[{xtype:'label',text:'Aufstieg',cls:'x-form-check-group-label',anchor:'-15'}]},{columnWidth:'.25',name:'tags3',items:[{xtype:'label',text:'Shuttlemöglichkeiten',cls:'x-form-check-group-label',anchor:'-15'}]},{columnWidth:'.25',name:'tags4',items:[{xtype:'label',text:'Sonstiges',cls:'x-form-check-group-label',anchor:'-15'}]}]});for(var i in Tom.MyApp.availableTags){tag=Tom.MyApp.availableTags[i];this.tagCheckboxes.items[tag.type-1].items.push(new Ext.form.Checkbox({xtype:'checkbox',boxLabel:tag.tag,name:'cbtag'+tag.idtags}))}}});FTrailUi=Ext.extend(Ext.form.FormPanel,{labelWidth:100,labelAlign:'left',monitorValid:true,initComponent:function(){this.items=[{xtype:'container',width:670,autoEl:'div',layout:'form',autoScroll:true,items:[{xtype:'container',layout:'hbox',layoutConfig:{pack:'start',align:'stretchmax'},items:[{xtype:'fieldset',title:'Parameter',layout:'form',flex:1.5,items:[{xtype:'textfield',fieldLabel:'Name',anchor:'100%',name:'title',allowBlank:false,maxLength:45},{xtype:'combo',name:'cb_idcountries',anchor:'100%',store:Tom.MyApp.CountryStore,valueField:'idcountries',displayField:'country',hiddenName:'idcountries',mode:'local',fieldLabel:'Land',displayField:'country',forceSelection:true,emptyText:'Ein Land auswählen...',editable:false,triggerAction:'all',allowBlank:false},{xtype:'textfield',fieldLabel:'Wegnummern',anchor:'100%',name:'trailnumbers',maxLength:255},{xtype:'textfield',fieldLabel:'Kurzbeschreibung',anchor:'100%',name:'description',allowBlank:false,maxLength:255},{xtype:'checkbox',fieldLabel:'Track-Qualität',boxLabel:'GPS-Aufzeichnung',name:'isgps'},{xtype:'compositefield',fieldLabel:'Bewertung',items:[{xtype:'displayfield',value:'S'},{xtype:'spinnerfield',name:'s',minValue:0,maxValue:10,allowDecimals:true,decimalPrecision:1,incrementValue:0.5,alternateIncrementValue:1.0,accelerate:false,allowBlank:false,width:50},{xtype:'displayfield',value:'G'},{xtype:'spinnerfield',name:'g',minValue:0,maxValue:10,allowDecimals:true,decimalPrecision:1,incrementValue:0.5,alternateIncrementValue:1.0,accelerate:false,allowBlank:false,width:50}]}]},{xtype:'fieldset',title:'Statistik',layout:'form',flex:1,items:[{xtype:'numberfield',fieldLabel:'Höhenmeter',anchor:'100%',name:'alt_down',allowDecimals:false,allowNegative:false,emptyText:'0',invalidText:'Nur positive Ganzzahlen erlaubt',maxValue:65535},{xtype:'numberfield',fieldLabel:'Gegenanstiege',anchor:'100%',name:'alt_up',allowDecimals:false,allowNegative:false,emptyText:'0',invalidText:'Nur positive Ganzzahlen erlaubt',maxValue:65535},{xtype:'numberfield',fieldLabel:'Höchster Punkt',anchor:'100%',nanText:'',name:'alt_max',allowDecimals:false,allowNegative:false,emptyText:'0',invalidText:'Nur positive Ganzzahlen erlaubt',maxValue:65535},{xtype:'numberfield',fieldLabel:'Tiefster Punkt',anchor:'100%',name:'alt_min',allowDecimals:false,allowNegative:false,emptyText:'0',invalidText:'Nur positive Ganzzahlen erlaubt',maxValue:65535},{xtype:'numberfield',fieldLabel:'Länge',anchor:'100%',name:'len',allowDecimals:false,allowNegative:false,emptyText:'0',invalidText:'Nur positive Ganzzahlen erlaubt',maxValue:65535},{xtype:'button',text:'Aus GPS-Track errechnen',anchor:'100%',scope:this,handler:function(){this.fireEvent('gettrackproperties',this.getForm());}}]}]},{xtype:'fieldset',title:'Tags',layout:'auto',items:[this.tagCheckboxes]},{xtype:'fieldset',title:'Beschreibung',layout:'form',flex:1,defaults:{frame:false},items:[{xtype:'textarea',fieldLabel:'Ausgangspunkt',name:'description_starting_point',anchor:'100%',maxLength:65535,height:100},{xtype:'textarea',fieldLabel:'Aufstieg',name:'description_up',anchor:'100%',emptyText:'Beschreibung des Aufstiegs',maxLength:65535,allowBlank:false,height:100},{xtype:'textarea',fieldLabel:'Abfahrt',name:'description_down',anchor:'100%',emptyText:'Beschreibung der Abfahrt',maxLength:65535,allowBlank:false,height:100}]},{xtype:'textfield',name:'idtrails',hidden:true,height:0},{xtype:'textfield',name:'tags',hidden:true,height:0},{xtype:'textfield',name:'idcountries',hidden:true,height:0},{xtype:'textarea',name:'gpstrack',hidden:true,height:0},{xtype:'textfield',name:'fav',hidden:true,height:0},{xtype:'textfield',name:'fnew',hidden:true,height:0},{xtype:'textfield',name:'label_lat',hidden:true,height:0},{xtype:'textfield',name:'label_lng',hidden:true,height:0},{xtype:'textfield',name:'bounds',hidden:true,height:0}]}];FTrailUi.superclass.initComponent.call(this);this.addEvents('getTrackProperties');}});FWarning=Ext.extend(FProjectUi,{initComponent:function(){Ext.apply(this,{width:400,autoScroll:true,frame:true,title:'Datenblatt',collapsible:true,collapsedTitle:true,collapsed:false,disabled:true,method:'POST',url:'/queries/warningstore/create.php'});FWarning.superclass.initComponent.call(this);}});
