Follow these steps to install this script on your wiki.
http://scripts.mindtouch.com/pagebus.xmlRelated Links: DekiScript service, Extension Overview, DekiScript Overview, Extension Demos.
This extension contains functions for interacting with the PageBus. This script requires MindTouch Deki 1.8.3 or later.
Functions:
Show messages on a channel in an alert window.
Parameters:
| Name | Type | Description |
| subscribe | str | (optional) Subscribe to channel. (default: "*") |
| title | str | (optional) Dialog title. (default: nil) |
Filter messages before copying them to another channel.
Parameters:
| Name | Type | Description |
| subscribe | str | Subscribe to channel. |
| publish | str | Publish on channel. |
| field | str | Field to test. |
| pattern | str | Regular expression pattern to use for test. |
Publish a message on a channel.
Parameters:
| Name | Type | Description |
| channel | str | Channel to publish mesage on. |
| message | map | Message to send. |
Republish messages to another channel.
Parameters:
| Name | Type | Description |
| subscribe | str | Subscribe to channel. |
| publish | str | Publish on channel. |
| copy | map | (optional) Fields to copy. (default: all) |
| add | map | (optional) Fields to add. (default: none) |
<extension>
<title>MindTouch PageBus Extension</title>
<copyright>Copyright (c) 2008 MindTouch, Inc.</copyright>
<uri.help>http://wiki.developer.mindtouch.com/MindTouch_Deki/Extensions/PageBus</uri.help>
<label>PageBus</label>
<namespace>pagebus</namespace>
<description>This extension contains functions for interacting with the PageBus.</description>
<function>
<name>alert</name>
<description>Show messages on a channel in an alert window.</description>
<param name="subscribe" type="str" optional="true">Subscribe to channel. (default: "*")</param>
<param name="title" type="str" optional="true">Dialog title. (default: nil)</param>
<return>
<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
<head>
<script type="text/javascript">
DekiWiki.subscribe(<eval:js>args.subscribe ?? '*'</eval:js>, null, function(c, m, d) { var s = ''; for(var f in m) s += f + ': ' + m[f] + '\n'; alert(<eval:js>args.title ?? 'Alert Box'</eval:js> + '\nchannel: [' + c + ']\n' + s); });
</script>
</head>
</html>
</return>
</function>
<function>
<name>republish</name>
<description>Republish messages to another channel.</description>
<param name="subscribe" type="str">Subscribe to channel.</param>
<param name="publish" type="str">Publish on channel.</param>
<param name="copy" type="map" optional="true">Fields to copy. (default: all)</param>
<param name="add" type="map" optional="true">Fields to add. (default: none)</param>
<return>
<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
<head>
<script type="text/javascript">
DekiWiki.subscribe(<eval:js>args.subscribe</eval:js>, null, function(c, m, d) {
var result = m;
if(d.copy) {
result = { };
for(var key in d.copy) result[key] = m[d.copy[key]];
}
if(d.add) for(var key in d.add) result[key] = d.add[key];
DekiWiki.publish(<eval:js>args.publish</eval:js>, result);
}, { copy: <eval:js>args.copy</eval:js>, add: <eval:js>args.add</eval:js> });
</script>
</head>
</html>
</return>
</function>
<function>
<name>filter</name>
<description>Filter messages before copying them to another channel.</description>
<param name="subscribe" type="str">Subscribe to channel.</param>
<param name="publish" type="str">Publish on channel.</param>
<param name="field" type="str">Field to test.</param>
<param name="pattern" type="str">Regular expression pattern to use for test.</param>
<return>
<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
<head>
<script type="text/javascript">
DekiWiki.subscribe(<eval:js>args.subscribe</eval:js>, null, function(c, m, d) {
if(DekiWiki.hasValue(m[<eval:js>args.field</eval:js>]) && d.regex.test(m[<eval:js>args.field</eval:js>])) {
DekiWiki.publish(<eval:js>args.publish</eval:js>, m);
}
}, { regex: new RegExp(<eval:js>args.pattern</eval:js>) });
</script>
</head>
</html>
</return>
</function>
<function>
<name>publish</name>
<description>Publish a message on a channel.</description>
<param name="channel" type="str">Channel to publish mesage on.</param>
<param name="message" type="map">Message to send.</param>
<return>
<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
<tail>
<script type="text/javascript">
DekiWiki.publish(<eval:js>args.channel</eval:js>, <eval:js>args.message</eval:js>);
</script>
</tail>
</html>
</return>
</function>
</extension>
http://wiki.developer.mindtouch.com/MindTouch_Deki/Extensions/DHtml