Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: addEntryToBlog Arguments: blogName Description: Adds an enty to a blog. Page type: webl Render function: Module: site Page source: var finfo = (Wub_GetFunctionInfo(blogName) ? nil); var module = (finfo.module ? wubinfo.user); var res = nil; if (wubinfo.user == nil) then res = WubCall("sitemessageref", ["mustlogin", blogName]) elsif (finfo == nil) and (blogName != "") then res = WubCall("sitemessageref", ["unknowncmdtoedit", blogName]) elsif (finfo == "INSUFFICIENT_PERMISSIONS") then res = WubCall("sitemessageref", ["insufficientpermissions", blogName]) else if !(module member Wub_WritableModules()) then res = WubCall("sitemessageref", ["insufficientpermissions", blogName]) end end; var blogData = (WubEval(finfo.exec) ? nil); var title = (blogData.title ? nil); var entries = (blogData.entries ? nil); var editname = (blogData.editname? nil); var editable = (blogData.editable ? "false"); if (blogData == nil) or (title == nil) or (entries == nil) then res = `Error: "` + blogName + `" does not appear to be a blog.` elsif (editname == nil) and (editable == "false") then res = `Error: "` + blogName + `" does not appear to be an editable blog.` end; // No Error, keep going if res == nil then var html = ` <H1>Add New Entry To Blog</H1> <form action="/webl/WubHub_DoIt" method="post"> <input name="cmdline" value="addEntryToBlogCmd(title,blogName,entry,img)" type="hidden"/> <input name="blogName" value="` + finfo.module + "." + finfo.name + `" type=hidden> <table> <tbody> <tr><td>Blog:<p> </td> <td>` + finfo.module + "." + finfo.name + ` -- "` + title + `"<p></td></tr> <tr> <td>Blog Entry Title: </td> <td><input name="title" value="" size="85" title="Title of blog entry"/> </td> </tr> <tr valign=top> <td>Entry Content: </td> <td><textarea name="entry" cols="85" rows="20" title="Blog entry content."></textarea></td> </tr> <tr> <td>Image URL (optional): </td> <td><input name="img" value="" size="85" title="Optional URL to image entry"/></td> </tr> <tr><td> </td><td> <input type="submit" value="Add to blog"> </td> </tr> </tbody> </table> </form> `; res = NewPiece(html, "text/html"); end; res;