This repository is a compilation of scripts and resources for OL related stuff.
Workflow:
- jscript.js is a stdlib for the workflow (list of functions below)
- array.js is a polyfill for Array#methods in the workflow, and working-with-arrays explains why you would use a such thing
- rest.js is a wrapper around the Rest API
- repository.js is a wrapper around the workflow data repository
- examples/users_cotg_ie.js is a script to retrieve the user list from a COTG repository as JSON
COTG:
- cotg.polyfill.js allows you to test COTG's Photo, Signature and
Annotations widgets directly form the browser. It also emulates
savestate
andrestorestate
using localStorage. - cotg.extension.js contains a number of useful functions documented below
- cotg.onerror.js is a script to display javascript errors as alert in COTG
- cotg.bundle.js contains all of the above in a single file. Drop it in your template and reap the benefits without more effort.
OL-template files:
- generate-ol-template contains a script to turn an HTML file into a OL-template file.
The examples folder also contains a number of other resources.
Usage:
var api = new RestAPI(
'user', /* required */
'password', /* required */
'http://localhost:9340' /* optionnal */
)
The API is synchronous in the workflow:
var version = api.files.serviceVersion()
And is Promised based in the browser:
api.files.serviceVersion()
.then(function(version) { /* ... */ })
Advanced examples can be found here:
The functions provided by this file are Promise
based.
cotg.getSignature(width, height)
triggers the signature widget and resolves to
a SVG signature data. E.g.
cotg.getSignature(500, 200)
.then(function(svg) {
document.querySelector('img').src = 'data:image/xml+svg,' + svg })
cotg.getPicture(options)
triggers the camera widget and resolves to
an image URI. E.g.
cotg.getPicture({ width: 100, height: 100, quality: 50 })
.then(function(uri) { document.querySelector('img').src = uri })
cotg.getDate(date)
triggers the date widget and resolves to a date. E.g.
cotg.getDate({ width: 100, height: 100, quality: 50 })
.then(function(date) { /* ... */ })
cotg.readFile(path)
reads a file on the device and resolves to the file content.
cotg.writeFile(path, content)
writes a file on the device and resolves when
done.
- Workflow variables/logging
- file manipulation
- readFile(path)
- writeFile(path, content)
- writeFileWithEncoding(path, content, encoding)
- readBinaryFile(path)
- writeBinaryFile(path, content)
- writeBinaryTextToFile(path, content)
- appendFile(path, content)
- deleteFile(path)
- moveFile(source, destination)
- copyFile(source, destination, overwrite)
- listFolders(path)
- listFiles(path)
- fileExists(path)
- folderExists(path)
- createFolder(path)
- join()
- sanitizeFilename(filename)
- XML manipulation
- base64 encoding/decoding
- Metadata API
- Sending emails
- Making HTTP requests
- Making SQL queries
- String manipulation
- Running shell commands
- Reading Excel files
- & others