Dear Wiki user, You have subscribed to a wiki page or wiki category on "Lenya Wiki" for change notification.
The following page has been changed by JörnNettingsmeier: http://wiki.apache.org/lenya/GenericEditorAPI ------------------------------------------------------------------------------ The following objects (defined in {{{src/modules/editors/resources/javascript/org.apache.lenya.Editors.js}}}) are used for data exchange between the editor and the generic usecases: {{{ - - var org.apache.lenya.Editors; // keep the global namespace clean! + var org.apache.lenya.editors; // keep the global namespace clean! - org.apache.lenya.Editors.prototype.LinkData = function() { + org.apache.lenya.editors.prototype.LinkData = function() { - this.href = ""; - this.title = ""; - this.text = ""; + this.setHref = function(href) { this.href = href }; + this.getHref = function() { return this.href }; + this.setTitle = function(title) { this.title = title }; + this.getTitle = function() { return this.title }; + this.setText = function(text) { this.text = text }; + this.getText = function() { return this.text }; } - org.apache.lenya.Editors.prototype.ImageData = function() { + org.apache.lenya.editors.prototype.ImageData = function() { - this.src = ""; - this.title = ""; - this.height = ""; - this.width = ""; - this.mimeType = ""; + this.setSrc = function(src) { this.src = src }; + this.getSrc = function() { return this.src }; + this.setTitle = function(title) { this.title = title }; + this.getTitle = function() { return this.title }; + this.setHeight = function(height) { this.height = height }; + this.getHeight = function() { return this.height }; + this.setWidth = function(width) { this.width = width }; + this.getWidth = function() { return this.width }; + this.setMimeType = function(mimeType) { this.mimeType = mimeType }; + this.getMimeType = function() { return this.mimeType }; } - org.apache.lenya.Editors.prototype.AssetData = function() { + org.apache.lenya.editors.prototype.AssetData = function() { - this.src = ""; - this.title = ""; - this.mimeType = ""; + this.setSrc = function(src) { this.src = src }; + this.getSrc = function() { return this.src }; + this.setTitle = function(title) { this.title = title }; + this.getTitle = function() { return this.title }; + this.setMimeType = function(mimeType) { this.mimeType = mimeType }; + this.getMimeType = function() { return this.mimeType }; } }}} + You can obtain your own object instance by including that file and executing + {{{ + var myLinkData = new org.apache.lenya.editors.LinkData(); + myLinkData.setHref("http://www.example.com"); + }}} - Each editor module that wishes to use the generic usecase implementations '''must''' provide the following callbacks in the context of the opening window: + Each editor module that wishes to use the generic usecase implementations '''must''' provide the respective callbacks in the context of the opening window: {{{ + function org.apache.lenya.editors.callbacks.getLinkData() { + return <some org.apache.lenya.editors.LinkData object>; + }; - /** - * this function is used to read default settings for the usecase view form. - * note: undefined values cause the respective form field to be disabled. - * if you don't want to provide a default, but you still want the user to - * change the field, pass the empty string ("") rather than undefined. - */ - function LenyaGetLinkData() { - return { - 'href': "/some/path/to/a/document.html", - 'text': undefined, - 'title': "This is what pops up if you hover over the <a/>." - }; - }}} - {{{ - function LenyaSetLinkData(linkData) {}; - where - linkData = { - 'href': "/some/path/to/a/document.html", - 'text': "Click here to see the wonders of the world!", - 'title': "This is what pops up if you hover over the <a/>.", - }; + function org.apache.lenya.editors.callbacks.setLinkData(linkData) {}; + + function org.apache.lenya.editors.Callbacks.getImageData() { + return <some org.apache.lenya.editors.ImageData object>; + }; + + function org.apache.lenya.editors.callbacks.setImageData(imageData) {}; + + function org.apache.lenya.editors.Callbacks.getAssetData() { + return <some org.apache.lenya.editors.AssetData object>; + }; + + function org.apache.lenya.editors.callbacks.setAssetData(assetData) {}; }}} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
