Wiki source code of Sheet for displaying blog entries
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | #includeMacros("Blog.BlogCode") | ||
| 2 | #includeMacros("Blog.CategoriesCode") | ||
| 3 | #getEntryObject($doc $entryObj) | ||
| 4 | #if("$!entryObj" == '') | ||
| 5 | #warning("This is not a blog post!") | ||
| 6 | #elseif($context.action != 'inline') | ||
| 7 | ## View mode | ||
| 8 | #isPublished($entryObj $isPublished) | ||
| 9 | #isHidden($entryObj $isHidden) | ||
| 10 | ## displayBlog requires a list of documents, and whether to display only an extract or the full entry. | ||
| 11 | #displayBlog([$doc.fullName] 'single' false) | ||
| 12 | #else | ||
| 13 | <dl> | ||
| 14 | <dt>Title:</dt> | ||
| 15 | <dd>$doc.display("title", "edit", $entryObj)</dd> | ||
| 16 | <dt>Content:</dt> | ||
| 17 | <dd>$doc.display("content", "edit", $entryObj)</dd> | ||
| 18 | <dt>Summary (optional):</dt> | ||
| 19 | <dd>$doc.display("extract", "edit", $entryObj)</dd> | ||
| 20 | <dt>Category:</dt> | ||
| 21 | <dd> | ||
| 22 | #getCategoriesHierarchy('' $tree) | ||
| 23 | <div id="blog_category_container"> | ||
| 24 | #displayCategoriesHierarchy($tree 'selectable')</div> | ||
| 25 | #showCreateCategoryBox($tree) | ||
| 26 | </dd> | ||
| 27 | </dl> | ||
| 28 | #template('tagedit.vm') | ||
| 29 | #isPublished($entryObj $isPublished) | ||
| 30 | #if($isPublished) | ||
| 31 | #if($doc.creator == $context.user) | ||
| 32 | #publishMessageBox("This article was published on ${doc.display('publishDate', 'view', $entryObj)}") | ||
| 33 | #hideMessageBox("Hide article $doc.display('hidden', 'edit', $entryObj)") | ||
| 34 | #end | ||
| 35 | #else | ||
| 36 | #set($defaultDate = $xwiki.getDocument($blogPostTemplate).getObject($blogPostClassname).getProperty('publishDate').value.time) | ||
| 37 | #if($entryObj.getProperty('publishDate').value.time == $defaultDate) | ||
| 38 | ## The publish date was not set, force it to be the creation date | ||
| 39 | $entryObj.set('publishDate', $doc.creationDate) | ||
| 40 | #end | ||
| 41 | #publishMessageBox("This article is not published yet. <label>*Publish ${doc.display('published', 'edit', $entryObj)}*</label>\\<label>Set the publication date to: ${doc.display('publishDate', 'edit', $entryObj)}</label>") | ||
| 42 | #end | ||
| 43 | #set($newtitle = $request.title) | ||
| 44 | #if($newtitle) | ||
| 45 | #set($newtitle = $newtitle.replaceAll('"',"'")) | ||
| 46 | <script type="text/javascript"> | ||
| 47 | {pre} | ||
| 48 | ## TODO: Set the correct date. This does not work since the current form buttons break onsumbit events. | ||
| 49 | ## Event.observe(document.getElementById('${formname}'), 'submit', function(evt) {alert(this); alert(evt); return false;}, true); | ||
| 50 | var title = "${newtitle}"; | ||
| 51 | document.forms.inline["${entryObj.getxWikiClass().getName()}_${entryObj.number}_title"].value = title; | ||
| 52 | {/pre} | ||
| 53 | </script> | ||
| 54 | #end | ||
| 55 | #end |