Namespace Package
Package level functions.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
Package.executeHook(path)
Execute and retrieve a single hook by path, relative to the packages root
See http://salsacommons.org/o/8001/p/salsa/commons/dev/docs/lang/hooks/ for more details.
|
<static> |
Package.executeHooks(name, filter)
Execute and retrieve an array of currenly installed hooks by name
The executeHooks method differs from the getHooks method by returning the executed content of the hooks, rather than relying on the browser or programmer to GET the contents.
|
<static> |
Package.getAllowedChapters(cmKey)
National organization campaign managers have access to all the supporters in the organization.
|
<static> |
Package.getCurrent()
Get a list of all the currently installed packages for this organization.
|
<static> |
Package.getHooks(name)
Gets an array of currenly installed hooks by name
See http://salsacommons.org/o/8001/p/salsa/commons/dev/docs/lang/hooks/ for more details.
|
<static> |
Package.id()
Get the id of the current package
|
<static> |
Package.isAvailable(packageId)
Determine whether a given package is currently available.
|
<static> |
Package.schedule(path, minutes)
Schedule a page to be hit periodically.
|
Method Detail
<static>
Package.executeHook(path)
Execute and retrieve a single hook by path, relative to the packages root
See http://salsacommons.org/o/8001/p/salsa/commons/dev/docs/lang/hooks/ for more details.
- Parameters:
- {String} path
- The path of the hook to execute, like /salsa/event/common/public/_hooks/myhook.sjs
- Returns:
- A string of the content of the hook
<static>
{Array}
Package.executeHooks(name, filter)
Execute and retrieve an array of currenly installed hooks by name
The executeHooks method differs from the getHooks method by returning the executed content of the hooks, rather than relying on the browser or programmer to GET the contents.
See http://salsacommons.org/o/8001/p/salsa/commons/dev/docs/lang/hooks/ for more details.
- Parameters:
- {String} name
- The name of the hooks to look for
- {Array} filter
- Optional The name of the hooks to look for
- Returns:
- An
Array
of objects, each with the following properties:- {String}
name
- {String}
packageId
- {String}
path
- {String}
content
- {String}
<static>
{String}
Package.getAllowedChapters(cmKey)
National organization campaign managers have access to all the supporters in the organization. Chapter leaders
can only see supporters in their chapter or sub-chapter.
Returns the chapter and sub-chapter KEYS, if there are any, that a campaign manager can see.
Returns
null
if campaign manager is a national level.
- Parameters:
- cmKey
- {Integer} Campaign manager KEY
- Returns:
- A comma-separated list of chapter KEYS that a campaign manager is able to access
<static>
Package.getCurrent()
Get a list of all the currently installed packages for this organization.
- Returns:
- A Java array of package IDs that the organization represented
by
salsa.organization_KEY
has installed.
<static>
{Array}
Package.getHooks(name)
Gets an array of currenly installed hooks by name
See http://salsacommons.org/o/8001/p/salsa/commons/dev/docs/lang/hooks/ for more details.
<? var hooks = Package.getHooks("supporter/"); for(var i=0, hook; hook = hooks[i]; ++i){ ?< <li>The hook for package <?=hook.packageId?> is available at <?= "/salsa/hq/p/" + hook.path?><? } ?>
- Parameters:
- {String} name
- The name of the hooks to look for
- Returns:
- An
Array
of objects, each with the following properties:- {String}
name
- {String}
packageId
- {String}
path
- {String}
<static>
{String}
Package.id()
Get the id of the current package
- Returns:
- The package Id
<static>
{Boolean}
Package.isAvailable(packageId)
Determine whether a given package is currently available.
- Parameters:
- {String} packageId
- The package ID you'd like to check for
- Returns:
- Returns
true
if the given package is available, otherwisefalse
.
<static>
Package.schedule(path, minutes)
Schedule a page to be hit periodically. Similar to a cron job in Linux, or scheduled tasks. Duplicates will be ignored, so calling the schedule function frequently will not change the behavior. This makes it reasonable to put on a package homepage, etc.
- Parameters:
- {String} path
- Path to the SalsaScript file, including any parameters. E.g. "salsa/template/common/public/generate?show&object=template"
- {Number} minutes
- The number of minutes to wait between successive calls to the URI