Prototype Global
ACTIONS | FUNCTIONS | MACROS | SKINS | TYPE.PROPERTIES

Functions
Array.intersection()
retrieve the intersection set of a bunch of arrays
Array.prototype.contains(val)
check if an array passed as argument contains a specific value (start from end of array)
Array.prototype.indexOf(val)
return the first index position of a value contained in an array
Array.prototype.lastIndexOf(val)
return the last index position of a value contained in an array
Array.union()
retrieve the union set of a bunch of arrays
Date.prototype.diff(dateObj)
returns the difference between this and another date object in milliseconds
Date.prototype.equals(date, extend)
checks if a date object equals another date object
Date.prototype.format(format, locale, timezone)
format a Date to a string
Date.prototype.getAge(param)
return the past timespan between this Date object and the current Date or a different Date object
Date.prototype.getExpiry(param)
return the future timespan between this Date object and the current Date or a different Date object
Date.prototype.getTimespan(param)
return the timespan to current date/time or a different Date object
Date.prototype.toLocalTime()
set the date/time to local time by adding the timezone offset
Date.prototype.toUtc()
set the date/time to UTC by subtracting the timezone offset
H1(H, S, L)
H2(H, S, L)
H3(H, S, L)
H4(H, S, L)
H5(H, S, L)
H6(H, S, L)
Number.Sorter(field, order)
factory to create functions for sorting objects in an array
Number.prototype.format(fmt)
format a Number to a String
Number.prototype.toPercent(total, fmt)
return the percentage of a Number according to a given total Number
Object.prototype.clone(clone, recursive)
copy the properties of an object into a new object
Object.prototype.dump(recursive)
print the contents of an object for debugging
Object.prototype.reduce(recursive)
reduce an extended object (ie. a HopObject) to a generic javascript object
SimpleVerifier.verifyServerHostKey(hostname, port, serverHostKeyAlgorithm, serverHostKey)
String.Sorter(field, order)
factory to create functions for sorting objects in an array
String.compose()
create a string from a bunch of substrings
String.join(str1, str2, glue)
append one string onto another and add some "glue" if none of the strings is empty or null.
String.prototype.capitalize(limit)
transforms the first n characters of a string to uppercase
String.prototype.contains(str, fromIndex)
function returns true if a string contains the string passed as argument
String.prototype.count(str)
returns the amount of occurences of one string in another
String.prototype.debase64()
returns the decoded string using the base64 algorithm
String.prototype.diff(mod, separator)
function compares a string with the one passed as argument using diff
String.prototype.embody(limit, clipping, delimiter)
breaks up a string into two parts called head and tail at the given position don't apply this to HTML, i.e. use stripTags() in advance
String.prototype.enbase64()
returns the string encoded using the base64 algorithm
String.prototype.encode()
String.prototype.encodeForm()
String.prototype.encodeXml()
String.prototype.endsWith(str)
function returns true if the string ends with the string passed as argument
String.prototype.entitize()
translates all characters of a string into HTML entities
String.prototype.format()
String.prototype.group(interval, str, ignoreWhiteSpace)
function inserts a string every number of characters
String.prototype.head(limit, clipping, delimiter)
get the head of a string
String.prototype.isAlpha()
function returns true if the string contains only characters a-z
String.prototype.isAlphanumeric()
function returns true if the string contains only a-z and 0-9 (case insensitive!)
String.prototype.isDateFormat()
checks if a date format pattern is correct
String.prototype.isEmail()
returns true if the string looks like an e-mail
String.prototype.isFileName()
function checks if the string passed contains any characters that are forbidden in image- or filenames
String.prototype.isHexColor()
function checks a string for a valid color value in hexadecimal format. it may also contain # as first character
String.prototype.isNumeric()
function returns true if the string contains only 0-9
String.prototype.isUrl()
function checks if the string passed contains any characters that are forbidden in URLs and tries to create a java.net.URL from it FIXME: probably deprecated -> helma.Url
String.prototype.md5()
function calculates the md5 hash of a string
String.prototype.pad(str, len, mode)
fills a string with another string up to a desired length
String.prototype.repeat(multiplier)
function repeats a string passed as argument
String.prototype.startsWith(str, offset)
function returns true if the string starts with the string passed as argument
String.prototype.stripTags()
String.prototype.tail(limit, clipping, delimiter)
get the tail of a string
String.prototype.titleize()
transforms the first n characters of each word in a string to uppercase
String.prototype.toAlphanumeric()
function cleans a string by throwing away all non-alphanumeric characters
String.prototype.toDate(format, timezone)
parse a timestamp into a date object. This is used when users want to set createtime explicitly when creating/editing stories.
String.prototype.toFileName()
function cleans the string passed as argument from any characters that are forbidden or shouldn't be used in filenames
String.prototype.toHexColor()
converts a string into a hexadecimal color representation (e.g. "ffcc33"). also knows how to convert a color string like "rgb (255, 204, 51)".
String.prototype.trim()
remove leading and trailing whitespace
String.prototype.unwrap(removeTags, replacement)
replace all linebreaks and optionally all w/br tags
String.random(len, mode)
creates a random string (numbers and chars)
addFile(zOutStream, f, level, pathPrefix)
private function for adding a single file to the .zip archive
addRecipient(addstr, name, type)
connect()
private method that connects to the remote server
debug(methodName, msg)
debug output method
error(methodName, msg)
error output method
evalFile(f)
private function that constructs an instance of java.io.File based on a JS File or Helma.File object
extractEntry(zFile, entry, destPath)
private function that extracts the data of a file in a .zip archive. If a destination Path is given it writes the extracted data directly to disk using the name of the ZipEntry Object, otherwise it ...
fname()
func(str, p1, p2, p3)
getCellStyle(c)
getFile(arg)
private method for creating an instance of java.io.File based on various argument types
getStatus()
getWriterModifier(what, create)
Tries to create a new IndexWriter or IndexModifier for up to the number of milliseconds defined in helma.Search.Index.LOCK_TIMEOUT.
helma.Aspects()
library for adding Aspects (by roman porotnikov, http://www.jroller.com/page/deep/20030701) Note: Each prototype that uses aspects must implement a method onCodeUpdate() to prevent aspects being lo ...
helma.Aspects.prototype.addAfter(obj, fname, after)
helma.Aspects.prototype.addAround(obj, fname, around)
helma.Aspects.prototype.addBefore(obj, fname, before)
helma.Aspects.prototype.toString()
helma.Aspects.toString()
helma.Chart(fpath, prefix, sheetName)
helma.Chart.example(file)
helma.Chart.render()
helma.Chart.renderAsString()
helma.Chart.toString()
helma.Color(R, G, B)
constructor for a color object
helma.Color.fromHsl(H, S, L)
transform a hsl representation of a color to the equivalent decimal value
helma.Color.fromName(name)
create a helma.Color from trivial name
helma.Color.getName()
return the trivial name of this color
helma.Color.toString()
object containig the color names for specific hex values
helma.Color.valueOf()
return the decimal value of a color object
helma.Database(driver, url, name, user, password)
helma.Database.example()
helma.Database.execute(sql)
helma.Database.getConnection()
helma.Database.getDriverName()
helma.Database.getName()
helma.Database.getObject()
helma.Database.getProductName()
helma.Database.isMySql()
helma.Database.isOracle()
helma.Database.query(sql)
helma.Database.toString()
helma.File(path)
helma.File.canRead()
helma.File.canWrite()
helma.File.clearError()
helma.File.close()
helma.File.eof()
helma.File.error()
helma.File.exists()
helma.File.flush()
helma.File.getAbsolutePath()
helma.File.getLength()
helma.File.getName()
helma.File.getParent()
helma.File.getPath()
helma.File.hardCopy(dest)
function makes a copy of a file over partitions
helma.File.isAbsolute()
helma.File.isDirectory()
helma.File.isFile()
helma.File.isOpened()
helma.File.lastModified()
helma.File.list(pattern)
helma.File.listRecursive(pattern)
recursivly lists all files below a given directory you may pass a RegExp Pattern to return just files matching this pattern
helma.File.makeDirectory()
helma.File.move(dest)
function moves a file to a new destination directory
helma.File.open()
helma.File.readAll()
helma.File.readln()
helma.File.remove()
helma.File.removeDirectory()
helma.File.renameTo(toFile)
helma.File.toByteArray()
returns file as ByteArray useful for passing it to a function instead of an request object
helma.File.toString()
helma.File.write(what)
helma.File.writeln(what)
helma.Ftp(server)
helma.Ftp.active()
helma.Ftp.ascii()
helma.Ftp.binary()
helma.Ftp.cd(path)
helma.Ftp.deleteFile(remoteFile)
helma.Ftp.dir(path)
helma.Ftp.getFile(remoteFile, localFile)
helma.Ftp.getString(remoteFile)
helma.Ftp.lcd(dir)
helma.Ftp.login(username, password)
helma.Ftp.logout()
helma.Ftp.mkdir(dir)
helma.Ftp.passive()
helma.Ftp.putFile(localFile, remoteFile)
helma.Ftp.putString(str, remoteFile, charset)
helma.Ftp.pwd()
helma.Ftp.rmdir(dir)
helma.Ftp.setReadTimeout(timeout)
helma.Ftp.setTimeout(timeout)
helma.Ftp.toString()
helma.Html()
helma.Html.TableWriter(numberOfColumns, attr)
utility object to provide an easy way for programmatically creating an x/html table.
helma.Html.TableWriter.close()
Close all open table tags.
helma.Html.TableWriter.write(text, attr)
Write a table cell.
helma.Html.button(param)
render an x/html button input element
helma.Html.buttonAsString(attr)
return an x/html button input element
helma.Html.checkBox(param)
render an x/html checkbox input element
helma.Html.checkBoxAsString(attr)
return an x/html checkbox input element
helma.Html.closeLink()
render an x/html close link tag
helma.Html.closeLinkAsString()
return an x/html close link tag
helma.Html.closeTag(name)
render the closing tag of an arbitrary x/html element directly to response
helma.Html.closeTagAsString(name)
return the closing tag of an arbitray x/html element
helma.Html.color(c)
render a color string if it contains hex characters only prefix it with "#" otherwise assume that it is a named color (eg. "yellow")
helma.Html.colorAsString(c)
return a color string
helma.Html.dropDown(param, options, selectedValue, firstOption)
render a x/html drop down box
helma.Html.dropDownAsString(attr, options, selectedValue, firstOption)
return an x/html drop down box
helma.Html.element(name, str, attr)
render an arbitrary x/html element
helma.Html.elementAsString(name, str, attr)
return an arbitrary x/html element
helma.Html.file(attr)
render an x/html file input element
helma.Html.fileAsString(attr)
return an x/html file input element
helma.Html.form(attr)
render an x/html open form tag
helma.Html.formAsString(attr)
return an x/html open form tag
helma.Html.hidden(param)
render an x/html hidden input element
helma.Html.hiddenAsString(attr)
return an x/html hidden input element
helma.Html.input(param)
render an x/html text input element
helma.Html.inputAsString(attr)
return an x/html text input element
helma.Html.link(attr, text)
render an x/html link element
helma.Html.linkAsString(attr, text)
return an x/html link element
helma.Html.map(name, param)
Renders an image map from an array each array contains an object describing the parameters for the area of the image map
helma.Html.mapAsString(name, areas)
helma.Html.openLink(attr)
render an x/html open link tag
helma.Html.openLinkAsString(attr)
return an x/html open link tag
helma.Html.openTag(name, attr)
render the opening tag of an arbitrary x/html element
helma.Html.openTagAsString(name, attr)
return the opening tag of an arbitrary x/html element
helma.Html.password(attr)
render an x/html password input element
helma.Html.passwordAsString(attr)
render an x/html password input element
helma.Html.prototype.activateUrls(str)
function parses a string and converts any found URL into a HTML link tag
helma.Html.radioButton(param)
render an x/html radiobutton input element
helma.Html.radioButtonAsString(attr)
return an x/html radiobutton input element
helma.Html.submit(param)
render an x/html submit input element
helma.Html.submitAsString(attr)
return an x/html submit input element
helma.Html.table(headers, data, param)
render a complete x/html table
helma.Html.tableAsString(headers, data, attr)
return a complete x/html table
helma.Html.tag(name, attr)
render an empty arbitrary x/html element ("contentless tag")
helma.Html.tagAsString(name, attr)
return an empty arbitrary x/html element ("contentless tag")
helma.Html.textArea(param)
render an x/html textarea element
helma.Html.textAreaAsString(attr)
return an x/html textarea element
helma.Html.toString()
helma.Http()
helma.Http.evalUrl(url)
removes trailing slash from and evaluates a url
helma.Http.getFollowRedirects()
helma.Http.getHeader(name)
helma.Http.getMethod()
helma.Http.getProxy()
return global proxy settings
helma.Http.getReadTimeout()
helma.Http.getTimeout()
helma.Http.getUrl(url, opt)
executes a http request
helma.Http.getUserAgent()
helma.Http.isAuthorized(name, pwd)
static method to check if a request is authorized or not
helma.Http.setContent(stringOrObject)
helma.Http.setCredentials(username, password)
sets the credentials for basic http authentication
helma.Http.setFollowRedirects(value)
getter/setter for following redirects
helma.Http.setHeader(name, value)
helma.Http.setMethod(m)
getter/setter for method
helma.Http.setProxy(proxyString)
set global http proxy
helma.Http.setReadTimeout(timeout)
helma.Http.setTimeout(timeout)
getter/setter for timeouts
helma.Http.setUserAgent(agent)
getter/setter for user agent string
helma.Http.toString()
helma.Image(arg)
helma.Image.getInfo(arg)
helma.Image.spacer()
helma.Image.toString()
helma.Mail(smtp)
helma.Mail.addBCC(addstr, name)
helma.Mail.addCC(addstr, name)
helma.Mail.addPart(obj, filename)
helma.Mail.addText(text)
helma.Mail.addTo(addstr, name)
helma.Mail.example(smtp, sender, addr, subject, text)
helma.Mail.prototype.toString()
helma.Mail.send()
helma.Mail.setFrom(addstr, name)
helma.Mail.setReplyTo(addstr)
helma.Mail.setSubject(subject)
helma.Mail.setText(text)
helma.Mail.setTo(addstr, name)
helma.Mail.toString()
helma.Search()
Constructs a new instance of Search. This merely checks if the Lucene library is in the application classpath.
helma.Search.BooleanQuery(field, str, clause, analyzer)
Boolean Query constructor
helma.Search.BooleanQuery.prototype.addQuery(q, clause)
Adds an additional query clause to this query.
helma.Search.BooleanQuery.prototype.addTerm(field, str, clause, analyzer)
Adds a term to the wrapped query object. This method can be called with two, three or four arguments, eg.:
addTerm("fieldname", "querystring") 
addTerm("fieldname", "querystring", "and") 
addTe ...
helma.Search.Document(document)
helma.Search.Document.getDocument()
Returns the wrapped Lucene Document object
helma.Search.Document.prototype.addField(name, value, param)
Adds a field to this document.
helma.Search.Document.prototype.getBoost()
Returns the boost factor of a document.
helma.Search.Document.prototype.getDateField(name)
Returns the value of a single document and converts the value to a Date object.
helma.Search.Document.prototype.getField(name)
Returns a single document field.
helma.Search.Document.prototype.getFields()
Returns the fields of a document object.
helma.Search.Document.prototype.setBoost(boost)
Sets the boost factor of a document.
helma.Search.Document.prototype.toString()
helma.Search.FuzzyQuery(field, str)
Constructs a new FuzzyQuery instance
helma.Search.HitCollection(hits)
helma.Search.HitCollection.get(idx)
Silently converts the hit at the given index position into an instance of helma.Search.Document.
helma.Search.HitCollection.length()
Returns the number of hits in this collection.
helma.Search.Index(directory, analyzer)
helma.Search.Index.getAnalyzer()
Returns the analyzer used within this index.
helma.Search.Index.getDirectory()
Returns the directory the underlying Lucene index is located at.
helma.Search.Index.getModifier(create)
Returns an IndexModifier instance for adding or deleting documents to resp. from the underlying index. If the index is currently locked this method will try for the next two seconds to create the I ...
helma.Search.Index.getReader()
Returns an IndexReader instance. Due to locking issues an IndexModifier should be used for deleting documents.
helma.Search.Index.getSearcher()
Returns a searcher for querying this index.
helma.Search.Index.getWriter(create)
Returns an IndexWriter instance that can be used to add documents to the underlying index or to perform various other modifying operations. If the index is currently locked this method will try for ...
helma.Search.Index.prototype.addDocument(doc)
Adds a document to the index.
helma.Search.Index.prototype.addDocuments(docs, mergeFactor)
Adds all documents in the passed collection to this index.
helma.Search.Index.prototype.addIndexes(dir)
Merges the indexes passed as argument into this one.
helma.Search.Index.prototype.close()
Closes the underlying index directory for future operations.
helma.Search.Index.prototype.create()
Creates a new index. This will delete any existing index files in the directory of this index.
helma.Search.Index.prototype.getFieldNames()
Returns an array containing all field names in this index.
helma.Search.Index.prototype.isLocked()
Checks if the index is locked.
helma.Search.Index.prototype.optimize()
Optimizes the underlying index.
helma.Search.Index.prototype.removeDocument(fieldName, fieldValue)
Remove those documents from the index whose field-value with the given name matches the passed value argument.
helma.Search.Index.prototype.removeDocuments(fieldName, values)
Removes all documents whose field with the given name matches the values passed as argument.
helma.Search.Index.prototype.size()
Returns the number of documents in this index.
helma.Search.Index.prototype.unlock()
Unlocks the index. Use this with caution, as it removes any active locks in the Lucene index, which might lead to index corruption.
helma.Search.Index.prototype.updateDocument(docObj, fieldName)
Updates the index with the document passed as argument. In contrast to addDocument() this removes any existing objects whose fieldName matches the one of the document object. Eg. if the document obj ...
helma.Search.Index.toString()
helma.Search.PhraseQuery(field, str)
Constructs a new PhraseQuery instance that wraps a lucene Phrase Query object.
helma.Search.PhraseQuery.addTerm(field, str)
add a term to the end of the phrase query
helma.Search.PrefixQuery(field, str)
Constructs a new PrefixQuery instance.
helma.Search.Query()
helma.Search.Query.prototype.getBoost()
Returns the boost factor of this query.
helma.Search.Query.prototype.getQuery()
Returns the wrapped Lucene Query object.
helma.Search.Query.prototype.setBoost(fact)
Sets the boost factor of this query clause to the given number. Documents matching this query will have their score multiplied with the given factor
helma.Search.Query.prototype.toString(field)
helma.Search.QueryFilter(q)
Constructs a new QueryFilter instance. This class wraps a lucene QueryFilter.
helma.Search.QueryFilter.getFilter()
helma.Search.QueryFilter.toString()
helma.Search.RangeQuery(field, from, to, inclusive)
Constructs a new RangeQuery instance.
helma.Search.Searcher(index)
helma.Search.Searcher.getSearcher()
Returns the wrapped IndexSearcher instance.
helma.Search.Searcher.prototype.close()
Closes the wrapped IndexSearcher instance.
helma.Search.Searcher.prototype.search(query, filter)
Searches an index using the query passed as argument. The resulting collection of hits is stored in the property "hits" of this Searcher instance. Don't forget to close the searcher when finished p ...
helma.Search.Searcher.prototype.sortBy(fieldName)
Sets a field as result sorting field. This method can be called with a different number of arguments: sortBy(fieldName) sortBy(fieldName, type) sortBy(fieldName, reverse) sortBy(fieldName, type, ...
helma.Search.Searcher.prototype.toString()
helma.Search.TermQuery(field, str)
Term Query constructor
helma.Search.WildcardQuery(field, str)
Constructs a new WildcardQuery instance.
helma.Search.getAnalyzer(key)
Returns a new Analyzer instance depending on the key passed as argument. Currently supported arguments are "br" (BrazilianAnalyzer), "cn" (ChineseAnalyzer), "cz" (CzechAnalyzer), "nl" (DutchAnalyze ...
helma.Search.prototype.createIndex(dir, analyzer)
Creates a new Lucene index in the directory passed as argument, using an optional analyzer, and returns an instance of helma.Search.Index. Any already existing index in this directory will be prese ...
helma.Search.prototype.getDirectory(dir, create)
Returns an instance of org.apache.lucene.store.FSDirectory
helma.Search.prototype.getRAMDirectory(dir)
Returns a RAM directory object.
helma.Search.prototype.toString()
helma.Search.toString()
******************** STATIC METHODS * ********************
helma.Skin(source, encFlag)
helma.Skin.containsMacro(name, handler)
helma.Skin.render(param)
helma.Skin.renderAsString(param)
helma.Skin.toString()
helma.Skin.valueOf()
helma.Ssh(server, hosts)
constructor
helma.Ssh.addKnownHosts(file)
reads a known hosts file
helma.Ssh.connect(username, password)
connects to a remote host with username/password authentication
helma.Ssh.connectWithKey(username, key, passphrase)
connects to a remote host using private key and passphrase
helma.Ssh.disconnect()
disconnect a session
helma.Ssh.execCommand(cmd)
executes a command on the remote server (scp must be in PATH on the remote server)
helma.Ssh.get(remoteFile, targetDir)
copies a file from the remote server.
helma.Ssh.isConnected()
returns true if the ssh client is connected
helma.Ssh.isParanoid()
returns true if in paranoid mode
helma.Ssh.put(localFile, remoteDir, mode)
copies a file to the remote server
helma.Ssh.setParanoid(p)
toggle paranoia mode
helma.Ssh.toString()
helma.Url(str)
helma.Zip(file)
constructor function for Zip Objects
helma.Zip.Content()
constructor for Content Objects
helma.Zip.Content.add(entry)
adds a Zip Entry object to the table of contents and the files collection
helma.Zip.Entry(entry)
constructor for Entry objects holding the meta-data of a zip entry: .name (String) name of the entry .size (Int) decompressed size of the entry in bytes .time (Date) last modification timestamp of ...
helma.Zip.add(f, level, pathPrefix)
adds a single file or a whole directory (recursive!) to the .zip archive
helma.Zip.addData(buf, name, level)
adds a new entry to the zip file
helma.Zip.close()
closes the ZipOutputStream
helma.Zip.extract(name, destPath)
extracts a single file from a .zip archive if a destination path is given it directly writes the extracted file to disk
helma.Zip.extractAll(destPath)
extracts all files in a .zip archive if a destination path is given it directly writes the extracted files to disk (preserves directory structure of .zip archive if existing!)
helma.Zip.extractData(zipData)
extract all files in a ByteArray passed as argument and return them as result Array
helma.Zip.getData()
returns the binary data of the zip file
helma.Zip.list()
returns an array containing the entries of a .zip file as objects (see Entry for description)
helma.Zip.save(dest)
saves the archive by closing the output stream
helma.Zip.toString()
isSelected(value, selectedValue)
helper function used in Html.checkBox and Html.dropDown to check if a current value matches against one or more selected values
key.key(a, b)
order(a, b)
renderMarkupPart(name, start, end, attr)
helper function to render an arbitrary markup part
rgb.compose(n, bits)
setError(e)
setStatus(status)
setTimeout(type, value)
 
Macros
Global.HopObject.prototype.href
macro returns the url for any hopobject
Global.HopObject.prototype.id
macro returns the id of a HopObject
Global.HopObject.prototype.loop
generic macro that loops over the childobjects and renders a specified skin for each of them
Global.HopObject.prototype.skin
macro rendering a skin or displaying its source (param.as == "source")
Global.HopObject.prototype.switch
this macro renders a text depending on the value of a given property
Global.now
renders the current datetime
Global.property
write out a property contained in app.properties
Global.skin
renders a global skin
Global.write
wrapper to output a string from within a skin just to be able to use different encodings