Source: site.view [edit]
Function name: newPortalCmd
Arguments: title,name,desc
Description: Creates a new portal.
Page type: webl
Render function:  
Module: siteutil

Page source:

var res = nil;
var finfo = (Wub_GetFunctionInfo(name) ? nil);

if (wubinfo.user == nil) then
   res = WubCall("sitemessageref", ["mustlogin", name])
elsif (name== "") then
   res = WubCall("sitemessageref", ["unknowncmdtoedit", name])
elsif finfo != nil then
   res = `Error: a command named "` + name + `" already exists.`
end;

// No errors, continue
if res == nil then

     var fspec = Wub_ParseFunctionIdentifier(name);
     if fspec.module == nil then 
        fspec.module = wubinfo.user
     end;

     var data = [. title=title, description=desc, editable="true", readonly=false,
            entries = [] .];

     var flags;
     flags = "portal";

     finfo = [. module=fspec.module, name=fspec.name, ctype="webl", 
           description=desc,
           render="portalRenderDragableFrames", test="", version="0", tags="", flags=flags, 
           exec= ToSource(data), cacheexpire="", cacherefreshrate="", 
           usecache="", createdby=wubinfo.user, modified="", created="", 
           modifiedby=wubinfo.user,arglist="" .];
 
    res = Wub_SaveFunctionInfo(finfo);
end;
res;