ZimletJS: Difference between revisions
SvenDowideit (talk | contribs) (AjxRpc or howto access a JSP) |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Rather allot needs to be writtenby those that understand the intents of the JS API | {{warning|1=You are looking at legacy Zimlet documentation. For Zimbra Modern UI Zimlet development go to: https://wiki.zimbra.com/wiki/DevelopersGuide#Zimlet_Development_Guide.}} | ||
{{Archive}}Rather allot needs to be writtenby those that understand the intents of the JS API | |||
Line 14: | Line 15: | ||
== AjxRpc or howto access a JSP == | == AjxRpc or howto access a JSP == | ||
MainHelloView.prototype._updateHTML_JSP = | MainHelloView.prototype._updateHTML_JSP = | ||
function(to, body) { | function(to, body) { | ||
var url = this.helloWorldZimlet.getResource('hello_world.jsp'); | |||
to = AjxStringUtil.urlEncode(to); | |||
body = AjxStringUtil.urlEncode(body); | |||
var reqParam = 'to=' + to + '&body=' + body; | |||
var reqHeader = {"Content-Type":"application/x-www-form-urlencoded"}; | |||
AjxRpc.invoke(reqParam, url, reqHeader, new AjxCallback(this, this._updateHTMLCallback)); | |||
}; | }; | ||
MainHelloView.prototype._updateHTMLCallback= | MainHelloView.prototype._updateHTMLCallback= | ||
function(result) { | function(result) { | ||
var r = result.text; | |||
DBG.println(AjxDebug.DBG2, "result:" + r); | |||
this.getHtmlElement().innerHTML = r; | |||
}; | }; | ||
Latest revision as of 06:17, 17 July 2021
You are looking at legacy Zimlet documentation. For Zimbra Modern UI Zimlet development go to: https://wiki.zimbra.com/wiki/DevelopersGuide#Zimlet_Development_Guide. |
- This is archive documentation, which means it is not supported or valid for recent versions of Zimbra Collaboration.
Rather allot needs to be writtenby those that understand the intents of the JS API
AjxDispatcher
appears to be a way for anyone to register a global function that can then be run 'by name'
ie.
../ZmCalendarApp.js: AjxDispatcher.registerMethod("GetCalController", "CalendarCore", new AjxCallback(this, this.getCalController)); Tasks_all.js: var cc = AjxDispatcher.run("GetCalController");
AjxCallback
AjxRpc or howto access a JSP
MainHelloView.prototype._updateHTML_JSP = function(to, body) { var url = this.helloWorldZimlet.getResource('hello_world.jsp'); to = AjxStringUtil.urlEncode(to); body = AjxStringUtil.urlEncode(body); var reqParam = 'to=' + to + '&body=' + body; var reqHeader = {"Content-Type":"application/x-www-form-urlencoded"}; AjxRpc.invoke(reqParam, url, reqHeader, new AjxCallback(this, this._updateHTMLCallback)); }; MainHelloView.prototype._updateHTMLCallback= function(result) { var r = result.text; DBG.println(AjxDebug.DBG2, "result:" + r); this.getHtmlElement().innerHTML = r; };