Source: site.view [edit]
Function name: addCmdToPortalCmd
Arguments: portal,cmd,title,height
Description: Function to add a new WubHub command portlet to a Portal
Page type: webl
Render function:  
Module: siteutil

Page source:

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

var portletData = (WubEval(finfo.exec) ? nil);

// No errors, continue
if res == nil and portletData != nil then

   var id = ToString(Size(portletData.entries));
   var parse = Wub_ParseCommandLine(cmd);
   if parse != nil then
      var newEntry = [.  id = id, title=title, cmd=parse.cmd,
          args=parse.args .];
      if (Str_Trim(height) != "") then
         newEntry.height := height
      end;

      portletData.entries := [newEntry] + portletData.entries;
      finfo.exec := ToSource(portletData);
      // res = finfo;
      res = Wub_SaveFunctionInfo(finfo)
   else
      res = "Error parsing command: " + cmd
   end;
   // res = finfo
end;
res;