Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: contentCmd Arguments: cmd,pos Description: Edits published content Page type: webl Render function: Module: jw Page source: var fi = Wub_GetFunctionInfo("jw.publishedContent"); var content = WubEval(fi.exec); pos = ToInt(pos); cmd = Str_Trim(cmd); var newC = content; // content = [0,1,2,3,4]; if (cmd == "del") then newC = Select(content, 0, pos) + Select(content, pos+1, Size(content)); elsif (cmd == "new") then newC = content + [ [. `pos`=`lr`, `type`=`subheading`, `title`= `New Item` .] ] elsif (cmd == "top") then if (pos >= 1) then newC = [content[pos]] + Select(content, 0, pos) + Select(content, pos+1, Size(content)) end elsif (cmd == "up") then if (pos >= 1) then newC = Select(content, 0, pos-1) + [content[pos]] + [content[pos-1]] + Select(content, pos+1, Size(content)) end elsif (cmd == "down") then if (pos < Size(content)-1) then newC = Select(content, 0, pos) + [content[pos+1]] + [content[pos]] + Select(content, pos+2, Size(content)); end end; fi.exec := ToString(newC); Wub_SaveFunctionInfo(fi); WubCall("editContent", []);