<
From version < 11.1 >
edited by Vincent Massol
on 2014/10/21
To version < 13.1
edited by Thomas Mortagne
on 2020/01/28
Change comment: Install extension [org.xwiki.contrib.blog:application-blog-ui/9.10.4]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.VincentMassol
1 +XWiki.ThomasMortagne
Content
... ... @@ -7,23 +7,64 @@
7 7  $xwiki.ssx.use('Blog.ManageCategories')##
8 8  #getEntryObject($doc $entryObj)
9 9  #if("$!entryObj" == '')
10 - {{warning}}{{translation key='xe.blog.sheet.notpost'/}}{{/warning}}
10 + {{warning}}{{translation key='blog.sheet.notpost'/}}{{/warning}}
11 11  ## Keep testing the inline action for backward compatibility with older blog posts.
12 12  #elseif($xcontext.action != 'edit' && $xcontext.action != 'inline')
13 13   ## View mode
14 - #isPublished($entryObj $isPublished)
15 - #isHidden($entryObj $isHidden)
16 - ## displayBlog requires a list of documents, and whether to display only an extract or the full entry.
17 - #displayBlog([$tdoc] 'single' false false)
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('"', '~"')" /}}
18 18  #else
19 - ; {{translation key='xe.blog.sheet.title'/}}
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>
20 20   : $doc.display('title', 'edit', $entryObj)
21 - ; {{translation key='xe.blog.sheet.content'/}}
39 + ; <label>{{translation key='blog.sheet.content'/}}</label>
22 22   : $doc.display('content', 'edit', $entryObj)
23 - ; {{translation key='xe.blog.sheet.summary'/}}
41 + ; <label>{{translation key='blog.sheet.summary'/}}</label>
24 24   : $doc.display('extract', 'edit', $entryObj)
25 - ; {{translation key='xe.blog.sheet.category'/}}
26 - : ((({{html clean="false" wiki="true"}}#displayCategoryManagementTree('' 'selectable'){{/html}} (% class="clearfloats" %)((())))))
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 +)))
27 27   #if ($doc.isNew())
28 28   ## We're creating a new blog post. We handle this case differently because #isPublished returns true when the
29 29   ## property is not set (object missing) and thus the new blog post will appear as published. See also the comment
... ... @@ -37,10 +37,12 @@
37 37   #isPublished($originalEntryObj $isPublished)
38 38   #end
39 39   #if($isPublished)
40 - #if($doc.creator == $xcontext.user)
41 - #publishMessageBox($services.localization.render('xe.blog.sheet.publicationdate', [${doc.display('publishDate', 'view', $entryObj)}]))
81 + #if($hasEdit)
42 42   #set($hideArticle = ${doc.display('hidden', 'edit', $entryObj)})
43 - #hideMessageBox($services.localization.render('xe.blog.sheet.hidearticle', [${hideArticle}]))
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 + )))
44 44   #end
45 45   #else
46 46   #set($defaultDate = $xwiki.getDocument($blogPostTemplate).getObject($blogPostClassname).getProperty('publishDate').value.time)
... ... @@ -49,7 +49,7 @@
49 49   $entryObj.set('publishDate', $doc.creationDate)
50 50   #end
51 51   {{html clean="false" wiki="true"}}
52 - #publishMessageBox("$services.localization.render('xe.blog.sheet.notpublished') <label>**$services.localization.render('xe.blog.sheet.publish') ${doc.display('published', 'edit', $entryObj)}**</label>\\<label>$services.localization.render('xe.blog.sheet.setdate') ${doc.display('publishDate', 'edit', $entryObj)}</label>")
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>")
53 53   {{/html}}
54 54   #end
55 55  #end
XWiki.JavaScriptExtension[0]
Caching policy
... ... @@ -1,0 +1,1 @@
1 +long
Code
... ... @@ -1,0 +1,36 @@
1 +require(['jquery'], function($){
2 + function hasCategories () {
3 + return $('div.blog-categories-list input:checkbox:checked').length > 0 ? true: false;
4 + }
5 +
6 + function setDefaultCategory () {
7 + $("input[type='hidden']#defaultPostCategory").val($("input[type='hidden']#blogCategoriesWebHome").val());
8 + }
9 +
10 + if (!hasCategories()) {
11 + setDefaultCategory();
12 + }
13 +
14 + $( "body" ).on( "click", "div.blog-categories-list input:checkbox", function() {
15 + if(!hasCategories()){
16 + setDefaultCategory();
17 + }
18 + else
19 + {
20 + $("input[type='hidden']#defaultPostCategory").val('');
21 + }
22 + });
23 + // Reset the "dirty state" of the CKEDITOR editors
24 + $("body").on("click", "form#uploadAttachment input[name='action_upload']", function(event){
25 + if( typeof(CKEDITOR) !== "undefined" ) {
26 + var contentEditor = CKEDITOR.instances['Blog.BlogPostClass_0_content'];
27 + var extractEditor = CKEDITOR.instances['Blog.BlogPostClass_0_extract'];
28 + if (contentEditor) {
29 + contentEditor.resetDirty();
30 + }
31 + if (extractEditor) {
32 + extractEditor.resetDirty();
33 + }
34 + }
35 + });
36 +});
Use this extension
... ... @@ -1,0 +1,1 @@
1 +onDemand
XWiki.StyleSheetExtension[0]
Caching policy
... ... @@ -1,0 +1,1 @@
1 +long
Code
... ... @@ -1,0 +1,4 @@
1 +.thumbnail-col {
2 + margin-bottom: 10px;
3 + margin-left: -15px;
4 +}
Content Type
... ... @@ -1,0 +1,1 @@
1 +CSS
Use this extension
... ... @@ -1,0 +1,1 @@
1 +onDemand

Get Connected