Source: site.view [edit]
Function name: addCmdToPortal
Arguments: portal
Description: Brings up a form that lets you a portlet to a portal.
Page type: webl
Render function:  
Module: site

Page source:

var finfo = (Wub_GetFunctionInfo(portal) ? nil);
var module = (finfo.module ? wubinfo.user);
var res = nil;

if (wubinfo.user == nil) then
   res = WubCall("sitemessageref", ["mustlogin", portal])
elsif (finfo == nil) and (portal != "") then
   res = WubCall("sitemessageref", ["unknowncmdtoedit", portal])
elsif (finfo == "INSUFFICIENT_PERMISSIONS") then
   res = WubCall("sitemessageref", ["insufficientpermissions", portal])
else
   if !(module member Wub_WritableModules()) then
      res = WubCall("sitemessageref", ["insufficientpermissions", portal])
   end
end;

var portalData = (WubEval(finfo.exec) ? nil);
var title = (portalData.title ? nil);
var entries = (portalData.entries ? nil);
var editable = (portalData.editable ? false);

if (portalData== nil) or (title == nil) or (entries == nil) then
   res = `Error: "` + portal + `" does not appear to be a portal.`
elsif (editable != "true") and (editable != true) then
   res = `Error: "` + portal + `" does not appear to be an editable portal.`
end;

// No Error, keep going
if res == nil then

var html = `

<h1>Add Portlet to Portal</h1>
<form>
      <table>
        <tbody>
   <input name="cmdline" value="addCmdToPortalCmd(portal, cmd,title, height)" type="hidden"/>

   <input name="portal" value="` + finfo.module + "." + finfo.name + 
       `" type=hidden>

      <table>
        <tbody>
       <tr><td>Portal:<p> </td>
       <td>` + finfo.module + "." + finfo.name + ` -- "` + title + `"<p></td></tr>
       <tr>

<tr><td>
   Portlet Title:   
 </td><td>
   <input name="title" value="" size="30" title="Title for window."/>
</td></tr>
<tr><td>
   WubHub Cmd:   
 </td><td>
   <input name="cmd" value="" size="30" title="A WubHub command."/>
</td></tr>
<tr><td>
   Fixed Height:
 </td><td>
    <input name="height" value="" size="5" title="Leave empty for adjustable height, else number of pixels (e.g. 300) for fixed height with scroll bar."/>
</td></tr>

<tr><td> <input type="submit" value="Add To Portal"> </td>
<td> <a href="/webl/WubHub_DoIt?cmdline=resetDefaultContent(` +
finfo.module + "." + finfo.name + `)">Reset to Default Content</a>
</tr>
      </tbody>
    </table>
</form>
`;
   res = NewPiece(html, "text/html")
end;

res;