Transaction System API

ClientPal

List of Classes

ClientPal

Method Summary
void getGeoLocation(NonTyped successFunction,NonTyped failFunction)

Calls the specified function(s) passing the result of navigator.geolocation HTML5 API. This is asynchronous.

void reloadDocument()

Reloads a ContractPal document contained within a <c:document/> tag. Use this in conjunction with Ajax calls that alter the document server-side.

YUI Panel getPanel()

Returns a pointer to the Panel. see c:panel tag.

void sendPageForm(String action)

Submits the page to the server.

int getDocumentWidth()

Returns width of the DOM document.

int getHorizontalScroll()

Returns the position of the horizontal scrollbar.

void scrollToDocumentAnchor(name)

Scrolls the HTML ContractPal document to the specified anchor with the given name or element with id of name.

String getPageFormName()

Returns the name of the page form.

void launchFileEditor(String fileId)

Launches the appropriate desktop editor for the given file.

int getVerticalScroll()

Returns the position of the vertical scrollbar.

void loadResource(String id, String resource, String source, String version)

Loads the specified resource into the page if it does not already exist

void enableFullAjax(boolean enabled)

Enables or disables full AJAX support. Use cautiously.

void sendRemoteAjaxRequest(String url, String handler, NonTyped params)

Posts an ajax request to a remote server. url and handler are required. params can be a querystring, a form object, or nothing (don's pass a param). The success of this call depends on the browser and its security settings. Your handler will receive three arguments: text of response, content type, and http status code.

void setInterceptHandler(NonTyped function)

Registers a function to handle certain server calls. The function should return true or false to allow the call to continue. Pass null to remove it.

Window openWindow(String url, String name, String params)

Creates, opens, and returns a handle to a window.

void getDocumentQueryString()

If an html-based ContractPal document is visible, this method bundles the form input parameters as a querystring usable for ajax posts.

void scrollToDocumentSignature()

Scrolls the HTML ContractPal document to the signature to be signed.

Form Object getPageForm()

Returns the page form object.

void resizeDocument()

Resizes the ContractPal document frame to eliminate scrolling.

int getViewportHeight()

Return the height of the browser viewport area.

int getViewportWidth()

Return the width of the browser viewport area.

void launchAttachmentEditor(String attachmentId)

Launches the appropriate desktop editor for the given attachment.

void delayExec(String scriptToExecute)

Runs the specified script after the library is loaded. See loadResource.

int getDocumentHeight()

Returns height of the DOM document.

void runJavascript(String js)

Executes the given javascript. Use this in place of eval.

void registerAjaxErrorHandler(NonTyped handler)

Registers a function to handle server error messages generated during ajax calls.

int getAdHocPageCount()

Returns the number of pages in the ad-hoc document.

void showAdHocPage(String id,int page)

Displays the specified page of the ad-hoc document.

void sendAjaxRequest(String action, NonTyped handler, NonTyped params, NonTyped json, String workflow)

Posts an ajax request. action and handler are required. handler can be a function name (string) or an actual function. params can be a querystring, a form object, or nothing (don's pass a param).

int getWindowX()

Return the X position of the window on the screen.

int getWindowY()

Return the Y position of the window on the screen.

Method Detail


void getGeoLocation(NonTyped successFunction,NonTyped failFunction)

Calls the specified function(s) passing the result of navigator.geolocation HTML5 API. This is asynchronous.

Parameters:

  • NonTyped successFunction
  • NonTyped failFunction

Since: 12-14-2016

top

void reloadDocument()

Reloads a ContractPal document contained within a <c:document/> tag. Use this in conjunction with Ajax calls that alter the document server-side.

Since: 11-24-08

top

YUI Panel getPanel()

Returns a pointer to the Panel. see c:panel tag.

Returns:  YUI Panel

Since: 11-11-09

top

void sendPageForm(String action)

Submits the page to the server.

Parameters:

  • String action

Since: 11-20-09

top

int getDocumentWidth()

Returns width of the DOM document.

Returns:  int

Since: 11-07-08

top

int getHorizontalScroll()

Returns the position of the horizontal scrollbar.

Returns:  int

Since: 11-07-08

top

void scrollToDocumentAnchor(name)

Scrolls the HTML ContractPal document to the specified anchor with the given name or element with id of name.

Parameters:

  • name

Since: 02-17-09

top

String getPageFormName()

Returns the name of the page form.

Returns:  String

Since: 09-27-08

top

void launchFileEditor(String fileId)

Launches the appropriate desktop editor for the given file.

Parameters:

  • String fileId

Since: 10-22-2010

top

int getVerticalScroll()

Returns the position of the vertical scrollbar.

Returns:  int

Since: 11-07-08

top

void loadResource(String id, String resource, String source, String version)

Loads the specified resource into the page if it does not already exist

Parameters:

  • String id
  • String resource
  • String source
  • String version

Since: 06-20-2019

Sample:

// load current version of bootstrap-min.css from platform
ClientPal.loadResource("bs","bootstrap-min.css","bootstrap");

// load specified version of bootstrap-min.css from platform
ClientPal.loadResource("bs","bootstrap-min.css","bootstrap","3.3.7");

// load bootstrap-min.css from the pal
ClientPal.loadResource("bs","bootstrap-min.css");

//load myStuff.js, a custom script, from the pal
ClientPal.loadResource("myStuff","myStuff.js");

ClientPal.delayExec("showSomethingThatDependsOnResourceLoaded()");
top

void enableFullAjax(boolean enabled)

Enables or disables full AJAX support. Use cautiously.

Parameters:

  • boolean enabled

Since: 06-23-2011

top

void sendRemoteAjaxRequest(String url, String handler, NonTyped params)

Posts an ajax request to a remote server. url and handler are required. params can be a querystring, a form object, or nothing (don's pass a param). The success of this call depends on the browser and its security settings. Your handler will receive three arguments: text of response, content type, and http status code.

Parameters:

  • String url
  • String handler
  • NonTyped params

Since: 12-03-2009

Sample:

// Note- as of 12/3/2009 this feature only works with IE in the trusted sites zone with low security
// Future support might include Firefox 3.5 and other browsers supporting resource sharing
// See "http://www.w3.org/TR/access-control/
// client-side javascript
function sendAjax()
{
    ClientPal.sendRemoteAjaxRequest("https://yoursite.com/yourhandler.php","resultHandler",ClientPal.getPageForm());
}


function resultHandler(result,contentType,statusCode)
{
    if (result!=null)
    {
        // or var obj = JSON.parse(result);
        document.getElementById("result").innerHTML=html;
    }
}

top

void setInterceptHandler(NonTyped function)

Registers a function to handle certain server calls. The function should return true or false to allow the call to continue. Pass null to remove it.

Parameters:

  • NonTyped function

Since: 06-23-2016

top

Window openWindow(String url, String name, String params)

Creates, opens, and returns a handle to a window.

Parameters:

  • String url
  • String name
  • String params

Returns:  Window

Since: 11-07-08

Sample:

function openThisWindow()
{
    var url = "http://www.someothersite.com";
    var name="myWIndow";
    var params="toolbar=yes,width=300,height=300,resizable=yes,scrollbars=yes,location=yes,status=yes,directories=yes,menubar=yes,copyhistory=no";
    var win = ClientPal.openWindow(url,name,params);
}
top

void getDocumentQueryString()

If an html-based ContractPal document is visible, this method bundles the form input parameters as a querystring usable for ajax posts.

Since: 02-03-2010

Sample:

// Note- as of 12/3/2009 this feature only works with IE in the trusted sites zone with low security
// Future support might include Firefox 3.5 and other browsers supporting resource sharing
// See "http://www.w3.org/TR/access-control/
// client-side javascript
function sendAjax()
{
    ClientPal.sendRemoteAjaxRequest("https://yoursite.com/yourhandler.php","resultHandler",ClientPal.getPageForm());
}


function resultHandler(result,contentType,statusCode)
{
    if (result!=null)
    {
        // or var obj = JSON.parse(result);
        document.getElementById("result").innerHTML=html;
    }
}

top

void scrollToDocumentSignature()

Scrolls the HTML ContractPal document to the signature to be signed.

Since: 02-17-09

top

Form Object getPageForm()

Returns the page form object.

Returns:  Form Object

Since: 09-27-08

top

void resizeDocument()

Resizes the ContractPal document frame to eliminate scrolling.

Since: 02-17-09

top

int getViewportHeight()

Return the height of the browser viewport area.

Returns:  int

Since: 11-07-08

top

int getViewportWidth()

Return the width of the browser viewport area.

Returns:  int

Since: 11-07-08

top

void launchAttachmentEditor(String attachmentId)

Launches the appropriate desktop editor for the given attachment.

Parameters:

  • String attachmentId

Since: 09-16-09

top

void delayExec(String scriptToExecute)

Runs the specified script after the library is loaded. See loadResource.

Parameters:

  • String scriptToExecute

Since: 06-20-2019

Sample:

// load current version of bootstrap-min.css from platform
ClientPal.loadResource("bs","bootstrap-min.css","bootstrap");

// load specified version of bootstrap-min.css from platform
ClientPal.loadResource("bs","bootstrap-min.css","bootstrap","3.3.7");

// load bootstrap-min.css from the pal
ClientPal.loadResource("bs","bootstrap-min.css");

//load myStuff.js, a custom script, from the pal
ClientPal.loadResource("myStuff","myStuff.js");

ClientPal.delayExec("showSomethingThatDependsOnResourceLoaded()");
top

int getDocumentHeight()

Returns height of the DOM document.

Returns:  int

Since: 11-07-08

top

void runJavascript(String js)

Executes the given javascript. Use this in place of eval.

Parameters:

  • String js

Since: 09-27-08

Sample:

var x = 3;
ClientPal.runJavascript("a=x*9");
top

void registerAjaxErrorHandler(NonTyped handler)

Registers a function to handle server error messages generated during ajax calls.

Parameters:

  • NonTyped handler

Since: 05-23-2012

top

int getAdHocPageCount()

Returns the number of pages in the ad-hoc document.

Returns:  int

Since: 11-09-09

top

void showAdHocPage(String id,int page)

Displays the specified page of the ad-hoc document.

Parameters:

  • String id
  • int page

Since: 11-09-09

top

void sendAjaxRequest(String action, NonTyped handler, NonTyped params, NonTyped json, String workflow)

Posts an ajax request. action and handler are required. handler can be a function name (string) or an actual function. params can be a querystring, a form object, or nothing (don's pass a param).

Parameters:

  • String action
  • NonTyped handler
  • NonTyped params
  • NonTyped json
  • String workflow

Since: 09-27-08

Sample:

// client-side javascript
function sendAjax()
{
    ClientPal.sendAjaxRequest("saveThis","resultHandler",ClientPal.getPageForm());
    // alternately ClientPal.sendAjaxRequest("saveThis","resultHandler","choice=1&item=2");
}

function resultHandler(html,js)
{
    if (html!=null)
    {
        document.getElementById("result").innerHTML=html;
    }
    if (js!=null)
    {
        ClientPal.runJavascript(js);
    }
}

// server-side workflow
if (c.isAction("saveThis"))
{
    var frag = c.createFragment("frag","<p>OK</p>",false);
    var response = c.createAjaxResponse(frag,false);
    response.addJavascript("alert('we saved your info')");
    return response;
}
top

int getWindowX()

Return the X position of the window on the screen.

Returns:  int

Since: 11-07-08

top

int getWindowY()

Return the Y position of the window on the screen.

Returns:  int

Since: 11-07-08

top
Copyright © 2006 - 2024, ContractPal, Inc. All rights reserved. API Date: Dec 30, 2024 11:45 AM