Modifications pour le document

Modifié par Vincent Massol le 2019/05/24 09:16

Depuis la version 2.1
modifié par Vincent Massol
sur 2011/03/18 14:59
Commentaire de modification : Importé depuis un le XAR
À la version 3.1
modifié par Thomas Mortagne
sur 2017/09/22 09:13
Commentaire de modification : Install extension [org.xwiki.contrib.blog:application-blog-ui/9.5]

Résumé

Détails

Propriétés de la Page
Titre
... ... @@ -1,1 +1,1 @@
1 -Sheet for displaying blog entries
1 +$!doc.getValue("title")
Auteur du document
... ... @@ -1,1 +1,1 @@
1 -XWiki.VincentMassol
1 +xwiki:XWiki.ThomasMortagne
Langue par defaut
... ... @@ -1,1 +1,0 @@
1 -en
Syntaxe
... ... @@ -1,1 +1,1 @@
1 -XWiki 2.0
1 +XWiki 2.1
Contenu
... ... @@ -1,41 +1,89 @@
1 -{{include document="Blog.BlogCode"/}}
1 +{{include reference="Blog.BlogCode"/}}
2 2  
3 -{{include document="Blog.CategoriesCode"/}}
3 +{{include reference="Blog.CategoriesCode"/}}
4 4  
5 -{{velocity filter="none"}}
6 -{{html clean="false" wiki="true"}}
5 +{{velocity}}
7 7  $xwiki.jsx.use('Blog.ManageCategories', {'mode' : 'select'})##
8 8  $xwiki.ssx.use('Blog.ManageCategories')##
9 9  #getEntryObject($doc $entryObj)
10 10  #if("$!entryObj" == '')
11 - #warning($msg.get('xe.blog.sheet.notpost'))
12 -#elseif($xcontext.action != 'inline')
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 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 - <dl>
20 - <dt>$msg.get('xe.blog.sheet.title')</dt>
21 - <dd>$doc.display('title', 'edit', $entryObj)</dd>
22 - <dt>$msg.get('xe.blog.sheet.content')</dt>
23 - <dd>$doc.display('content', 'edit', $entryObj)</dd>
24 - <dt>$msg.get('xe.blog.sheet.summary')</dt>
25 - <dd>$doc.display('extract', 'edit', $entryObj)</dd>
26 - <dt>$msg.get('xe.blog.sheet.category')</dt>
27 - <dd>
28 - #displayCategoryManagementTree('' 'selectable')
29 - <div class="clearfloats"></div>
30 - </dd>
31 - </dl>
32 - #template('tagedit.vm')
33 - #isPublished($entryObj $isPublished)
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
34 34   #if($isPublished)
35 - #if($doc.creator == $xcontext.user)
36 - #publishMessageBox($msg.get('xe.blog.sheet.publicationdate', [${doc.display('publishDate', 'view', $entryObj)}]))
81 + #if($hasEdit)
37 37   #set($hideArticle = ${doc.display('hidden', 'edit', $entryObj)})
38 - #hideMessageBox($msg.get('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 + )))
39 39   #end
40 40   #else
41 41   #set($defaultDate = $xwiki.getDocument($blogPostTemplate).getObject($blogPostClassname).getProperty('publishDate').value.time)
... ... @@ -43,8 +43,9 @@
43 43   ## The publish date was not set, force it to be the creation date
44 44   $entryObj.set('publishDate', $doc.creationDate)
45 45   #end
46 - #publishMessageBox("$msg.get('xe.blog.sheet.notpublished') <label>**$msg.get('xe.blog.sheet.publish') ${doc.display('published', 'edit', $entryObj)}**</label>\\<label>$msg.get('xe.blog.sheet.setdate') ${doc.display('publishDate', 'edit', $entryObj)}</label>")
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}}
47 47   #end
48 48  #end
49 -{{/html}}
50 50  {{/velocity}}
XWiki.SheetClass[0]
XWiki.JavaScriptExtension[0]
Mode de mise en cache
... ... @@ -1,0 +1,1 @@
1 +long
Code
... ... @@ -1,0 +1,23 @@
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 +});
Utiliser cette extension
... ... @@ -1,0 +1,1 @@
1 +onDemand
XWiki.StyleSheetExtension[0]
Mode de mise en cache
... ... @@ -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
Utiliser cette extension
... ... @@ -1,0 +1,1 @@
1 +onDemand