Add the Widget macro. This enables assets to be widgetized (easily embedded in
another page). Usage as such: ^Widget(assetId, width, height, templateId); assetId is the ID of the asset to widgetize, width and height are the size of the iframe, templateId is the template ID of the template to use for the widget itself. This will pop up an icon that shows you some markup to put on another page to embed the asset in widget form. If no template given, will use the ajaxInlineView of the asset.
This commit is contained in:
parent
36b622622e
commit
81736fb322
6 changed files with 242 additions and 0 deletions
BIN
www/extras/gear.png
Executable file
BIN
www/extras/gear.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 657 B |
40
www/extras/wgwidget.js
Executable file
40
www/extras/wgwidget.js
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
var WebGUI = {
|
||||
|
||||
widgetBox : {
|
||||
|
||||
parentNodeId : null,
|
||||
url : null,
|
||||
|
||||
|
||||
widget : function( url, parentId, width, height, templateId ) {
|
||||
if(url == "") {
|
||||
return "<iframe scrolling='no'><body>No content available from "+url+"</body></iframe>";
|
||||
}
|
||||
|
||||
if(width == undefined) {
|
||||
width = 600;
|
||||
}
|
||||
if(height == undefined) {
|
||||
height = 400;
|
||||
}
|
||||
|
||||
this.url = url + "?func=widgetView&templateId=" + templateId;
|
||||
|
||||
this.parentNodeId = parentId;
|
||||
|
||||
this.markup = "";
|
||||
this.markup += "<iframe scrolling='no' frameborder='0' id = '";
|
||||
this.markup += this.parentNodeId;
|
||||
this.markup += "' src='";
|
||||
this.markup += this.url;
|
||||
this.markup += "' width='";
|
||||
this.markup += width;
|
||||
this.markup += "' height='";
|
||||
this.markup += height;
|
||||
this.markup += "'>";
|
||||
this.markup += "</iframe>";
|
||||
|
||||
return this.markup;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
www/extras/widgetLinkTargets.js
Executable file
19
www/extras/widgetLinkTargets.js
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
var WebGUI = {
|
||||
widgetBox : {
|
||||
function retargetLinksAndForms() {
|
||||
|
||||
// get all the <a> elements, change their target appropriately
|
||||
var allLinks = document.getElementsByTagName('a');
|
||||
for(var i = 0; i < allLinks.length; i++) {
|
||||
allLinks[i].target = '_blank';
|
||||
}
|
||||
|
||||
// same for <form>s
|
||||
var allForms = document.getElementsByTagName('form');
|
||||
for(var i = 0; i < allForms.length; i++) {
|
||||
allForms[i].target = '_blank';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
YAHOO.util.Event.addListener(window, "load", WebGUI.widget.retargetLinksAndForms);
|
||||
Loading…
Add table
Add a link
Reference in a new issue