Wiki source code of Lexicon
Last modified by Alex Moruz on 2022/12/02 14:12
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{velocity}} | ||
| 2 | |||
| 3 | #if ($xwiki.hasAccessLevel("edit", "Lexicon.WebHome")) | ||
| 4 | |||
| 5 | |||
| 6 | #if("$!request.docName" != '') | ||
| 7 | ## Request for creating a new instance | ||
| 8 | ##set($targetDocReference = $services.model.createDocumentReference('', $!{request.spaceName}, $!{request.docName})) | ||
| 9 | ##Testing creating a document programatically | ||
| 10 | #set($newDoc = $xwiki.getDocument($!{request.spaceName}, $!{request.docName})) | ||
| 11 | |||
| 12 | ##Set a title | ||
| 13 | $newDoc.setTitle($!{request.docName}) | ||
| 14 | |||
| 15 | ##Not necessary but good to know | ||
| 16 | $newDoc.setParent("Lexicon.WebHome") | ||
| 17 | |||
| 18 | ##Use a template | ||
| 19 | $newDoc.setContent('{{include document="Lexicon.LexiconEntryTemplate"/}}') | ||
| 20 | |||
| 21 | ##Create a new object on the document | ||
| 22 | #set($newObj = $newDoc.newObject("Lexicon.LexiconEntryClass")) | ||
| 23 | |||
| 24 | $newDoc.save() | ||
| 25 | $response.sendRedirect($newDoc.getURL('edit')) | ||
| 26 | ##$response.sendRedirect($xwiki.getURL($newDoc, 'inline', "template=${escapetool.url($request.template)}&parent=${escapetool.url($request.parent)}")) | ||
| 27 | ## Stop processing, since we already sent a redirect. | ||
| 28 | #stop | ||
| 29 | #end | ||
| 30 | |||
| 31 | = Add a new entry = | ||
| 32 | |||
| 33 | {{html}} | ||
| 34 | <form action="" id="newdoc" method="post"> | ||
| 35 | <div> | ||
| 36 | <input type="hidden" name="parent" value="${doc.fullName}"/> | ||
| 37 | <input type="hidden" name="template" value="Lexicon.LexiconEntryClass"/> | ||
| 38 | <input type="hidden" name="sheet" value="1"/> | ||
| 39 | <input type="hidden" name="spaceName" value="Lexicon"/> | ||
| 40 | Entry: <input type="text" name="docName" value="Title Word" class="withTip" size="50"/> | ||
| 41 | <span class="buttonwrapper"><input type="submit" value="Create this entry" class="button"/></span> | ||
| 42 | </div> | ||
| 43 | </form> | ||
| 44 | {{/html}} | ||
| 45 | #end | ||
| 46 | {{/velocity}} | ||
| 47 | |||
| 48 | |||
| 49 | {{dashboard/}} |