WebOffice Script API - WebOffice html

The WebOffice 10.9 R4 Script API enables developers to control specific WebOffice 10.9 R4 functionality using Javascript method calls. Built in help for dynamically loading the Script API is available.

Use the method client.loadScriptAPI() for explicitly loading the WebOffice 10.9 R4 Script API.
Before using methods of the Script API, the following code lines should be executed in the component using the WebOffice 10.9 R4 Script API:
 

if( !parent.scriptAPI ){
parent.client.loadScriptAPI();
}

 

After that the Script API is available via object parent.scriptAPI.

Prerequisites are that the parent is WebOffice 10.9 R4 and that script access to this parent object is granted.

 

icon_cross-reference

Detailed Documentation of the functions and their parameters which are listed below can be found in the Java Script source file itself which is located in the WebOffice 10.9 R4 application directory: <web application>\client_workspace\JSXAPPS\weboffice\js\scriptAPI.js or in <web application>\pub\custom_tools\scriptAPI.txt.

 

Currently implemented functions for the WebOffice 10.9 R4 Script API:

 

Map, map views and layers

scriptAPI.mapByCenterpointScale( fCenterX, fCenterY, iScale )
Request a new map by center point and scale

scriptAPI.mapByExtent( fMinX, fMinY, fMaxX, fMaxY )
Request a new map by extent values

scriptAPI.setMapView ( sViewId )
Switch to a predefined map view

scriptAPI.getMapLayers( sIdType, callbackFct )
Get the layers of the current visible client map and their visibility state

scriptAPI.setTocNodeVisibility( sNodeId, bVisible )
Set the visibility of a TOC node (map service, group layer, layer)

scriptAPI.getActiveRepmodel()
Get information about the active repmodel

 

Tool selection

scriptAPI.getActiveTool()
Get the currently activated tool

scriptAPI.getActiveCustomTool()
Get the currently activated custom tool

scriptAPI.getCustomTool(sToolId)
Get a custom tool

scriptAPI.setTool() = function ( sToolId );
Activates a tool by tool id (works only for some tools: ToolSelect, ToolEdit, geoprocessing tools, custom tools)

client.api.closeActiveTool()
Closes all currently activated tools (also works with simple and advanced custom tools)

 

GUI operations

scriptAPI.addGUIModule( sName, sUrl, iState, sTitle, bCanBeClosed, iWidth, iHeight, sHtmlDivId, unload_callback, bCanBeDocked )
Add a new GUI module to the WebOffice 10.9 R4 GUI

scriptAPI.getGUIModule( oWindow )
Get the WebOffice 10.9 R4 GUI module for a nested iFrame

scriptAPI.getGUIModuleByName(sGUIModuleName)
Get the WebOffice 10.9 R4 GUI module by its name

scriptAPI.unhideGUIModule( oWindow )
Bring a GUI module into user view, independent of type and current state of the GUI module

scriptAPI.removeGUIModule( module )
Remove the added GUI Module of name module

scriptAPI.setDockingState( iState ) or  scriptAPI.setToolFormDockingState( iState )
Set the state of the tool form to undocked/docked

scriptAPI.setGUIModuleDockingStateByName( sGUIModuleName, iState )
Set the state of a GUI module to undocked/docked

scriptAPI.setGUIModuleDockingStateByIFrame( oIFrame, iState )
Set the state of a GUI module to undocked/docked

scriptAPI.setGUIModuleStateByIFrame( oIFrame, sState )
Set the state of a GUI module of type floating minimized/maximized

scriptAPI.setToolFormSize( iWidth, iHeight )
Set the size of the tool form container, if it is in floating state and not docked to any quadrant of the WebOffice 10.9 R4 GUI

scriptAPI.setGUIModuleSizeByName( sGUIModuleName, iWidth, iHeight )
Set the size of a GUI module by name, if it is in floating state and not docked to any quadrant of the WebOffice 10.9 R4 GUI

scriptAPI.setGUIModuleSizeByIFrame( oIFrame, iWidth, iHeight )
Set the size of a GUI module by passing the window of the iFrame, if it is in floating state and not docked to any quadrant of the WebOffice 10.9 R4 GUI

scriptAPI.snapToolFormToMap( bTop, bRight, bBottom, bLeft )
Snap the tool form to the map size

scriptAPI.snapGUIModuleToMapByIFrame( oIFrame, bTop, bRight, bBottom, bLeft )
Snap any WebOffice 10.9 R4 GUI module to the map

scriptAPI.lockGUI( bLockGUI, sInfoText, sImagePath, iWidth, iHeight )
Lock the WebOffice 10.9 R4 GUI, no user interactions are possible until lock is released

 

Print

scriptAPI.printByCenterpointScale( fCenterX, fCenterY, iScale, sPrintTemplateId, sPrintFormat, bHighResolution, fPrintRotation, oDynFields, sDocumentName, bNoDocumentDisplay, sRepmodelId, aMultiPrintIdx, iPageOverlap )
Print a map by center point and scale

scriptAPI.printByExtent( fMinX, fMinY, fMaxX, fMaxY, sPrintTemplateId, sPrintFormat, bHighResolution, fPrintRotation, oDynFields, sDocumentName, bNoDocumentDisplay, sRepmodelId )
Print a map by extent

 

icon_comment

If the variable sDocumentName is defined, the print will be archived irrespective of the Archive Plot Output? parameter settings to C:\Tomcat\webapps\<WebOffice application>\WEB-INF\work\archive. Note also that the variable sDocumentName will only be used for the archived document but not for the link in the response to the client. Already existing documents with the same name in the archive directory will be overwritten without notification.

 

Attributive queries:

scriptAPI.queryAttributive( sQueryname, sKeyname, sKeyvalue, iMode )
Show result grid and selected features on the map, update map by zooming to result features extent

scriptAPI.zoomToAttributive( sQueryname, sKeyname, sKeyvalue )
No result grid, show selected features on the map, update map by zooming to result features extent

scriptAPI.featureZoomAttributive( sQueryname, sKeyname, sKeyvalue )
No result grid, no feature selection on the map, update map by zooming to result features extent

scriptAPI.featurePanAttributive( sQueryname, sKeyname, sKeyvalue )
No result grid, no feature selection on the map, update map by panning to result features extent

scriptAPI.displayResultAttributive( sQueryname, sKeyname, sKeyvalue )
Show result grid, no feature selection on the map, no map update

scriptAPI.locateFeaturesAttributive( sQueryname, sKeyname, sKeyvalue )
No result grid, no feature selection on the map, no map update, show feature position in the current map extent by displaying an image for a few seconds

scriptAPI.queryAttributiveInternal( sQueryname, sKeyname, sKeyvalue )
No results display, no map update; the features get internally selected, so upon a next map request the selection is displayed on the map

scriptAPI.selectAttributive( sQueryname, sKeyname, sKeyvalue )
No results grid display, updates map with the current map extent

scriptAPI.clearSelection(  bMapSelectionOnly  )
Clear current selection

scriptAPI.zoomToSelected( objectIds )
Zoom to selected features

scriptAPI.panToSelected( objectIds )
Pan to selected features

scriptAPI.createResultSet( argResultJson )
Creates a result grid

 

Filter

scriptAPI.filterAttributive( sExtCallLayerId, aKeyname, aKeyvalue )
Perform attributive filtering

scriptAPI.resetFilterAttributive( sExtCallLayerId )
Reset attributive filtering

 

Snap

scriptAPI.getSnapProfiles( callbackfct )
Get the configured snap profiles

scriptAPI.getSnap(sSnapProfileId, callbackfct)
Get the snap vertices of the current map extent and the passed snap profile

 

WebOffice ePaper

scriptAPI.generateEPaper( aObjectIds, sEPaperId, sEPaperFormat, sEPaperName, oDynFields, iDpiCount, bSuppressCopyright, bNoDocumentDisplay)
Generate a WebOffice ePaper report for a single feature or a set of features

 

icon_cross-reference

See also chapter Generate a Weboffice ePaper report via Script API for detailed information about possibilities and restrictions when generating WebOffice ePaper reports by using the WebOffice 10.9 R4 Script API.

 

Other

scriptAPI.userMessage( sMessage, bAlert, bIsNote )
Show a user notification

scriptAPI.Env()
Return a javascript object holding basic properties of the WebOffice 10.9 R4 environment

scriptAPI.log( sLogMessage )
Log to the clientside WebOffice 10.9 R4 logmonitor

scriptAPI.mapInfo()
Return basic information object about the map

scriptAPI.setScriptHookin( sEventId, oMethod )
Register a javascript method in the clientside script hookin

 

Sketch Custom Tools

provide an interface for client side drawing with construction. Tools of this type have a few methods described as follows:

customtool.draw.setContentHeight( iHeight );
Set height for the content of the custom tool

customtool.draw.setSubmitCallback( callback );
Set a javascript function that gets called when the user clicks the commit button in the drawing form

customtool.draw.startDraw( sType, aVertexArray );
Start drawing functionality

customtool.draw.showDrawForm();
Show the drawing form

customtool.draw.hideDrawForm();
Hide the drawing form

customtool.draw.state();
Get the current state of drawing

 

icon_cross-reference

For detailed information about the configuration of custom tools also see chapter Web Integration - Custom Tool.