Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: siteeditform Arguments: ctype,module,usecache Description: Template form for edit page Page type: snippet Render function: Module: siteutil Page source: <form action="/webl/WubHub_SaveFunction" method="post"> <table> <tbody> <tr> <td>Function name: </td> <td><input name="name" value="%name%" size="45" title="Name of the function"/></td> </tr> <tr> <td>Arguments: </td> <td><input name="arglist" value="%arglist%" size="45" title="Comma-separated list of arguments"/></td> </tr> <tr> <td>Description: </td> <td><textarea name="description" cols="85" rows="3" title="Brief synopsis of function">%description%</textarea></td> </tr> <tr> <td>Page type: </td> <td> <webl> if !(ctype member ["alias", "url", "webl", "snippet", "javascript","html", "text"]) then ctype = "snippet"; end; var cattr = fun(b) if b then `checked="checked"` else "" end; end; var c1 = cattr(ctype=="url"); var c2 = cattr(ctype=="webl"); var c3 = cattr(ctype=="snippet"); var c4 = cattr(ctype=="html"); var c5 = cattr(ctype=="text"); var c6 = cattr(ctype=="alias"); var c7 = cattr(ctype=="javascript"); `<input type="radio" name="ctype" value="alias"` + c6 + `>Alias</input> <input type="radio" name="ctype" value="url"` + c1 + `>URL</input> <input type="radio" name="ctype" value="webl"` + c2 + `>WebL script</input> <input type="radio" name="ctype" value="javascript"` + c7 + `>Javascript</input> <input type="radio" name="ctype" value="snippet"` + c3 + `>HTML snippet</input> <input type="radio" name="ctype" value="html"` + c4 + `>HTML page</input> <input type="radio" name="ctype" value="text"` + c5 + `>Text/data</input> ` </webl> </td> </tr> <tr> <td valign="top">Page content: </td> <td><textarea cols="130" rows="25" name="exec" title="Text, data, or source code">%exec%</textarea></td> </tr> <tr> <td>Render function: </td> <td><input name="render" value="%render%" size="25" title="Specify function to render result, or leave blank for default behavior."/> Test function: <input name="test" value="%test%" size="25" title="Specify optional unit test function that returns a boolean. May be left blank."/></td> </tr> <tr> <td>Tags:</td> <td><input name="tags" value="%tags%" size="45" title="Specify a comma-separated list of tags. Tags are user-defined, searchable mechanisms for classifying functions. May be left blank."/></td> </tr> <tr> <td>Flags:</td> <td><input name="flags" value="%flags%" size="45" title="Specify a comma-separated list of flags. Flags are special tags used in some way by other WubHub functions (e.g. 'test' is used to indicate a unit test function). May be left blank."/></td> </tr> <tr> <td>Cache:</td> <td> <webl> var cattr = fun(b) if b then `checked="checked"` else "" end; end; var c1 = cattr(usecache=="usecache"); `<input type="checkbox" name="usecache" value="usecache" ` + c1 + `title="If selected, will save results for each arg combo to a cache and return results from cache before executing function. This is GLOBAL across all users, so only use this as appropriate."> Cache results </input>`; </webl> Expiration date: <input name="cacheexpire" value="%cacheexpire%" size="30" title="Cache expiration date: use format '11/02/07 4:12 pm'"/> Refresh rate: <input name="cacherefreshrate" value="%cacherefreshrate%" size="20" title="Cache refresh rate: use values such as '1W' (week), '1D' (day), or '1H' (hour) or combinations of these, such as '3D 2H'. Note: refreshing will run in a background thread as the ANONYMOUS user, so only use for publicly-accessible functions."/> </td> </tr> <tr> <td>Module: </td> <td> <select name="module"> <webl> var SelectedOption = fun(item, desired) if (item == desired) then return ` selected="true"` else return " " end end; // ------------------------------------------------------------------------- // Returns HTML listing leagal module options for a user // ------------------------------------------------------------------------- export var LegalModuleOptions = fun(module) var s = ""; every m in Wub_WritableModules() do s = s + "<option" + SelectedOption(m,module) + ` value="` + m + `">` + m + "</option>\n" end; return s; end; LegalModuleOptions(module); </webl> </select> </td> </tr> <tr> <td> </td> <td> <input name="version" value="%version%" type="hidden" size="30"/> <input name="created" value="%created%" type="hidden" size="30"/> <input name="createdby" value="%createdby%" type="hidden" size="30"/> <input name="modified" value="%modified%" type="hidden" size="30"/> <input name="modifiedby" value="%modifiedby%" type="hidden" size="30"/> <input name="oldtags" value="<webl>`%old` + `tags%`</webl>" type="hidden" size="30"/> <input name="oldflags" value="<webl>`%old` + `flags%`</webl>" type="hidden" size="30"/> <input name="oldspecialtags" value="<webl>`%old` + `specialtags%`</webl>" type="hidden" size="30"/> <input type="submit" value="Save"> </td> <td> [<a href="/webl/WubHub_DoIt?cmdline=site.terms">Terms</a>] </td> </tr> </tbody> </table> </form>