Changeset 842

Show
Ignore:
Timestamp:
01/13/09 13:04:55 (19 months ago)
Author:
sbenthall
Message:

updating Vespucci SFB

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/landgate/script/VespucciSFB.js

    r838 r842  
    170170feature.state=null;}} 
    171171if(destroys.length>0){this.layer.destroyFeatures(destroys);}}},remove:function(){var features=[];for(var i=0;i<this.layer.features.length;i++){if(this.layer.features[i].state==OpenLayers.State.INSERT){features.push(this.layer.features[i]);}} 
    172 this.layer.destroyFeatures(features);},rollback:function(feature,options,onSuccess,onFailure){options.filter=new OpenLayers.Filter.FeatureId({fids:[feature.fid]});onSuccess=onSuccess||function(){};onFailure=onFailure||function(){};var strategy=this;var strategy=this;var callback=function(response){strategy.processStatusCode(response,function(){strategy.refreshFeature(feature,onSuccess);},onFailure,function(){});};options.callback=callback;options.handle="Rolled back feature "+feature.fid+" from r"+options.fromFeatureVersion+" to r"+options.toFeatureVersion;this.layer.protocol.rollback(options);},processStatusCode:function(response,onSuccess,onFailure,onCancel){var strategy=this;switch(response.priv.status){case this.NOT_AUTHORIZED_ERROR_CODE:alert("You are not authorized to make this change.");onFailure(response);break;case this.FORBIDDEN_ERROR_CODE:alert("You are not authorized to make this change.");onFailure(response);break;case this.SUCCESS_CODE:onSuccess(response);break;default:onFailure(response);break;}},CLASS_NAME:"Vespucci.Strategy.Transactions"});Vespucci.Topbar=OpenLayers.Class({application:null,containerDiv:null,backgroundDiv:null,textDiv:null,panelDiv:null,addNoteListItemId:"vespucci-add-note-li",historyListItemId:"vespucci-history-li",loginListItemId:"vespucci-login-li",historyLink:null,loginLink:null,LOGIN_LINK_TEXT:"Login",LOGOUT_LINK_TEXT:"Logout",initialize:function(application){this.application=application;this.createContainer();this.createBackgroundDiv();this.createTextDiv();this.createPanelDiv();this.containerDiv.appendChild(this.backgroundDiv);this.containerDiv.appendChild(this.textDiv);this.containerDiv.appendChild(this.panelDiv);this.application.map.div.appendChild(this.containerDiv);this.adjustMargins();this.registerEvents();this.addBehaviors();this.updateLoginLinkText();},createContainer:function(){this.containerDiv=document.createElement("DIV");this.containerDiv.className=this.application.configuration.topbarContainerCSSClass;},createBackgroundDiv:function(){this.backgroundDiv=document.createElement("DIV");this.backgroundDiv.className=this.application.configuration.topbarBackgroundCSSClass;},createTextDiv:function(){this.textDiv=this.application.templates.topbarTemplate.process();this.textDiv.className=this.application.configuration.topbarTextCSSClass;},createPanelDiv:function(){this.panelDiv=document.createElement("DIV");this.panelDiv.className=this.application.configuration.topbarPanelCSSClass;},addBehaviors:function(){var topbar=this;var addNoteLi=document.getElementById(this.addNoteListItemId);var historyLi=document.getElementById(this.historyListItemId);var loginLi=document.getElementById(this.loginListItemId);this.addNoteLink=addNoteLi.getElementsByTagName("A")[0];this.historyLink=historyLi.getElementsByTagName("A")[0];this.loginLink=loginLi.getElementsByTagName("A")[0];Vespucci.Util.setOnclick(this.addNoteLink,function(){topbar.application.showAddFeature("notes");}) 
    173 Vespucci.Util.setOnclick(this.historyLink,function(){topbar.application.showHistory();});Vespucci.Util.setOnclick(this.loginLink,function(){var onSuccess=function(){topbar.updateLoginLinkText();} 
    174 if(topbar.application.isLoggedIn()){topbar.application.logout();onSuccess();}else{topbar.application.showLoginScreen(onSuccess);}});},updateLoginLinkText:function(){if(this.application.isLoggedIn()){this.loginLink.innerHTML=this.LOGOUT_LINK_TEXT;}else{this.loginLink.innerHTML=this.LOGIN_LINK_TEXT;}},adjustMargins:function(){var topbarBounds=OpenLayers.Util.getDOMElementBounds(this.containerDiv);this.application.configuration.margins.top+=topbarBounds.height;this.application.configuration.popupMargins.top+=topbarBounds.height;this.application.updateMargins();},registerEvents:function(){this.events=new OpenLayers.Events(this,this.containerDiv,null,true);this.events.register("mousedown",this,this.onmousedown);this.events.register("mousemove",this,this.onmousemove);this.events.register("mouseup",this,this.onmouseup);this.events.register("click",this,this.onclick);this.events.register("mouseover",this,this.onmouseover);this.events.register("mouseout",this,this.onmouseout);this.events.register("dblclick",this,this.ondblclick);},onmousedown:function(evt){this.mousedown=true;OpenLayers.Event.stop(evt,true);},onmousemove:function(evt){if(this.mousedown){OpenLayers.Event.stop(evt,true);}},onmouseup:function(evt){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(evt,true);}},onclick:function(evt){OpenLayers.Event.stop(evt,true);},onmouseover:function(evt){},onmouseout:function(evt){this.mousedown=false;},ondblclick:function(evt){OpenLayers.Event.stop(evt,true);},stop:function(evt){OpenLayers.Event.stop(evt,true);}});Vespucci.GeometryType={Point:Vespucci.Handler.Point,Polygon:OpenLayers.Handler.Polygon,getName:function(type){var className=type.prototype.CLASS_NAME;var lastDot=className.lastIndexOf(".");return className.substring(lastDot+1);}} 
     172this.layer.destroyFeatures(features);},rollback:function(feature,options,onSuccess,onFailure){options.filter=new OpenLayers.Filter.FeatureId({fids:[feature.fid]});onSuccess=onSuccess||function(){};onFailure=onFailure||function(){};var strategy=this;var strategy=this;var callback=function(response){strategy.processStatusCode(response,function(){strategy.refreshFeature(feature,onSuccess);},onFailure,function(){});};options.callback=callback;options.handle="Rolled back feature "+feature.fid+" from r"+options.fromFeatureVersion+" to r"+options.toFeatureVersion;this.layer.protocol.rollback(options);},processStatusCode:function(response,onSuccess,onFailure,onCancel){var strategy=this;switch(response.priv.status){case this.NOT_AUTHORIZED_ERROR_CODE:alert("You are not authorized to make this change.");onFailure(response);break;case this.FORBIDDEN_ERROR_CODE:alert("You are not authorized to make this change.");onFailure(response);break;case this.SUCCESS_CODE:onSuccess(response);break;default:onFailure(response);break;}},CLASS_NAME:"Vespucci.Strategy.Transactions"});Vespucci.Topbar=OpenLayers.Class({application:null,containerDiv:null,backgroundDiv:null,textDiv:null,panelDiv:null,addNoteListItemId:"vespucci-add-note-li",historyListItemId:"vespucci-history-li",historyLink:null,initialize:function(application){this.application=application;this.createContainer();this.createBackgroundDiv();this.createTextDiv();this.createPanelDiv();this.containerDiv.appendChild(this.backgroundDiv);this.containerDiv.appendChild(this.textDiv);this.containerDiv.appendChild(this.panelDiv);this.application.map.div.appendChild(this.containerDiv);this.adjustMargins();this.registerEvents();this.addBehaviors();},createContainer:function(){this.containerDiv=document.createElement("DIV");this.containerDiv.className=this.application.configuration.topbarContainerCSSClass;},createBackgroundDiv:function(){this.backgroundDiv=document.createElement("DIV");this.backgroundDiv.className=this.application.configuration.topbarBackgroundCSSClass;},createTextDiv:function(){this.textDiv=this.application.templates.topbarTemplate.process();this.textDiv.className=this.application.configuration.topbarTextCSSClass;},createPanelDiv:function(){this.panelDiv=document.createElement("DIV");this.panelDiv.className=this.application.configuration.topbarPanelCSSClass;},addBehaviors:function(){var topbar=this;var addNoteLi=document.getElementById(this.addNoteListItemId);var historyLi=document.getElementById(this.historyListItemId);this.addNoteLink=addNoteLi.getElementsByTagName("A")[0];this.historyLink=historyLi.getElementsByTagName("A")[0];Vespucci.Util.setOnclick(this.addNoteLink,function(){topbar.application.showAddFeature("notes");}) 
     173Vespucci.Util.setOnclick(this.historyLink,function(){topbar.application.showHistory();});},adjustMargins:function(){var topbarBounds=OpenLayers.Util.getDOMElementBounds(this.containerDiv);this.application.configuration.margins.top+=topbarBounds.height;this.application.configuration.popupMargins.top+=topbarBounds.height;this.application.updateMargins();},registerEvents:function(){this.events=new OpenLayers.Events(this,this.containerDiv,null,true);this.events.register("mousedown",this,this.onmousedown);this.events.register("mousemove",this,this.onmousemove);this.events.register("mouseup",this,this.onmouseup);this.events.register("click",this,this.onclick);this.events.register("mouseover",this,this.onmouseover);this.events.register("mouseout",this,this.onmouseout);this.events.register("dblclick",this,this.ondblclick);},onmousedown:function(evt){this.mousedown=true;OpenLayers.Event.stop(evt,true);},onmousemove:function(evt){if(this.mousedown){OpenLayers.Event.stop(evt,true);}},onmouseup:function(evt){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(evt,true);}},onclick:function(evt){OpenLayers.Event.stop(evt,true);},onmouseover:function(evt){},onmouseout:function(evt){this.mousedown=false;},ondblclick:function(evt){OpenLayers.Event.stop(evt,true);},stop:function(evt){OpenLayers.Event.stop(evt,true);}});Vespucci.GeometryType={Point:Vespucci.Handler.Point,Polygon:OpenLayers.Handler.Polygon,getName:function(type){var className=type.prototype.CLASS_NAME;var lastDot=className.lastIndexOf(".");return className.substring(lastDot+1);}} 
    175174Vespucci.DynamicToolbar=OpenLayers.Class(OpenLayers.Control.Panel,{CSS_CLASS_PART:"DrawFeature",initialize:function(application,options){OpenLayers.Control.Panel.prototype.initialize.apply(this,[options]);var panel=this;var controls=[];for(var name in application.configuration.addControls){var handler=application.configuration.addControls[name];var style=null;if(application.configuration.featureStyles[name]){style=OpenLayers.Util.extend({},application.configuration.featureStyles[name]);} 
    176175var controlOptions={displayClass:this.createControlCSSClass(application,handler),handlerOptions:{layer:application.wfsLayer,style:style},subtype:application.configuration.subtypes["notes"][0]};var control=new Vespucci.DrawSubtypedFeature(application.configuration,application.wfsLayer,handler,controlOptions);control.beforeAdd=function(feature){feature.featureNS=application.configuration.namespaceUri;feature.featureNSName=application.configuration.namespace;feature.type=name;}