Last modified by Jan Rhebergen on 2021/02/27 22:16
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{include reference="Blog.BlogCode"/}} | ||
| 2 | |||
| 3 | {{include reference="Blog.CategoriesCode"/}} | ||
| 4 | |||
| 5 | {{velocity}} | ||
| 6 | $xwiki.jsx.use('Blog.ManageCategories', {'mode' : 'select'})## | ||
| 7 | $xwiki.ssx.use('Blog.ManageCategories')## | ||
| 8 | #getEntryObject($doc $entryObj) | ||
| 9 | #if("$!entryObj" == '') | ||
| 10 | {{warning}}{{translation key='blog.sheet.notpost'/}}{{/warning}} | ||
| 11 | ## Keep testing the inline action for backward compatibility with older blog posts. | ||
| 12 | #elseif($xcontext.action != 'edit' && $xcontext.action != 'inline') | ||
| 13 | ## View mode | ||
| 14 | #getBlogDocument ($doc.space $blogDoc) | ||
| 15 | #getBlogPostsLayout($blogDoc $postsLayout) | ||
| 16 | #set ($layoutParams="useSummary=false|displayTitle=false") | ||
| 17 | #if ($postsLayout != 'full') | ||
| 18 | #set ($layoutParams="$!{layoutParams}|displayCalendar=false") | ||
| 19 | #end | ||
| 20 | {{blogPostLayoutFull reference="$doc.fullName.replaceAll('~', '~~').replaceAll('"', '~"')" params="$!layoutParams.replaceAll('~', '~~').replaceAll('"', '~"')" /}} | ||
| 21 | #else | ||
| 22 | #if ("$!request.title" != '') | ||
| 23 | ## Use the page title specified on the request, if available, as blog post title. This is needed for instance when | ||
| 24 | ## we create the blog post using the Create Page wizard with the blog post template provider (the user is specifying | ||
| 25 | ## the page title). | ||
| 26 | #set ($discard = $entryObj.set('title', $request.title)) | ||
| 27 | #end | ||
| 28 | #getBlogCategoriesLocation($doc.space $categoriesLocation) | ||
| 29 | #set ($defaultPostCategory = "${categoriesLocation}.WebHome") | ||
| 30 | #if ($categoriesLocation == 'Blog') | ||
| 31 | #set ($defaultPostCategory = "Blog.Categories.WebHome") | ||
| 32 | #end | ||
| 33 | #set($discard = $xwiki.jsx.use('Blog.BlogPostSheet')) | ||
| 34 | #set($discard = $xwiki.ssx.use('Blog.BlogPostSheet')) | ||
| 35 | (% class="xform" %)((( | ||
| 36 | {{html clean="false" wiki="true"}} | ||
| 37 | ; <label>{{translation key='blog.sheet.title'/}}</label> | ||
| 38 | : $doc.display('title', 'edit', $entryObj) | ||
| 39 | ; <label>{{translation key='blog.sheet.content'/}}</label> | ||
| 40 | : $doc.display('content', 'edit', $entryObj) | ||
| 41 | ; <label>{{translation key='blog.sheet.summary'/}}</label> | ||
| 42 | : $doc.display('extract', 'edit', $entryObj) | ||
| 43 | |||
| 44 | <div class="row"> | ||
| 45 | <div class="col-xs-12 col-sm-4 col-lg-3"> | ||
| 46 | <dl> | ||
| 47 | <dt><label>$services.localization.render('blog.sheet.image') <a href="javascript:;" title="${escapetool.xml($services.localization.render('blog.sheet.image.info'))}"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></a> :</label></dt> | ||
| 48 | <dd> | ||
| 49 | {{/html}} | ||
| 50 | |||
| 51 | {{attachmentSelector classname="Blog.BlogPostClass" property="image" filter="png,jpg,gif" displayImage="true" buttontext="$services.localization.render('blog.sheet.choose_image')" width="300" cssClass="blogImageSelector"/}} | ||
| 52 | |||
| 53 | {{html clean="false" wiki="true"}} | ||
| 54 | </dd> | ||
| 55 | </dl> | ||
| 56 | </div> | ||
| 57 | <div class="col-xs-12 col-sm-8 col-lg-9"> | ||
| 58 | <dl> | ||
| 59 | <dt><label>{{translation key='blog.sheet.category'/}}</label></dt> | ||
| 60 | <dd> | ||
| 61 | #displayCategoryManagementTree($categoriesLocation 'selectable') <input type="hidden" name="Blog.BlogPostClass_0_category" id="defaultPostCategory"/><input type="hidden" id="blogCategoriesWebHome" value="${escapetool.xml($defaultPostCategory)}"/> | ||
| 62 | </dd> | ||
| 63 | </dl> | ||
| 64 | </div> | ||
| 65 | </div> | ||
| 66 | {{/html}} | ||
| 67 | ))) | ||
| 68 | #if ($doc.isNew()) | ||
| 69 | ## We're creating a new blog post. We handle this case differently because #isPublished returns true when the | ||
| 70 | ## property is not set (object missing) and thus the new blog post will appear as published. See also the comment | ||
| 71 | ## from the else branch below. | ||
| 72 | #set ($isPublished = false) | ||
| 73 | #else | ||
| 74 | ## We're editing an existing blog post. We need to check the original document because the current one can have | ||
| 75 | ## unsaved changes, which happens for instance after returning from preview. | ||
| 76 | #set ($originalDocument = $xwiki.getDocument($doc.documentReference)) | ||
| 77 | #getEntryObject($originalDocument $originalEntryObj) | ||
| 78 | #isPublished($originalEntryObj $isPublished) | ||
| 79 | #end | ||
| 80 | #if($isPublished) | ||
| 81 | #if($hasEdit) | ||
| 82 | #set($hideArticle = ${doc.display('hidden', 'edit', $entryObj)}) | ||
| 83 | (% class="post-state-blk plainmessage" %)((( | ||
| 84 | (% class="publish-message" %)((($services.icon.render('world') $services.localization.render('blog.sheet.publicationdate', [${doc.display('publishDate', 'view', $entryObj)}])))) | ||
| 85 | (% class="hide-message" %)((($services.icon.render('unlock') $services.localization.render('blog.sheet.hidearticle', [${hideArticle}])))) | ||
| 86 | ))) | ||
| 87 | #end | ||
| 88 | #else | ||
| 89 | #set($defaultDate = $xwiki.getDocument($blogPostTemplate).getObject($blogPostClassname).getProperty('publishDate').value.time) | ||
| 90 | #if($entryObj.getProperty('publishDate').value.time == $defaultDate) | ||
| 91 | ## The publish date was not set, force it to be the creation date | ||
| 92 | $entryObj.set('publishDate', $doc.creationDate) | ||
| 93 | #end | ||
| 94 | {{html clean="false" wiki="true"}} | ||
| 95 | #publishMessageBox("$services.localization.render('blog.sheet.notpublished') <label>**$services.localization.render('blog.sheet.publish') ${doc.display('published', 'edit', $entryObj)}**</label>\\<label>$services.localization.render('blog.sheet.setdate') ${doc.display('publishDate', 'edit', $entryObj)}</label>") | ||
| 96 | {{/html}} | ||
| 97 | #end | ||
| 98 | #end | ||
| 99 | {{/velocity}} |