文档更改Home

Yang Sheng 于 2025-02-42,18:57 最后修改

从版本 103.1
Yang Sheng编辑
在2025-02-42,00:07上
修改评论: 该版本没有评论
到版本
Yang Sheng编辑
在2025-02-41,23:58上
修改评论: 该版本没有评论

摘要

细节

页面属性
内容
... ... @@ -17,7 +17,6 @@
17 17  === 近期更新 ===
18 18  
19 19  {{velocity}}
20 -## 获取最近的文档
21 21  #set($query = $services.query.hql("select doc.fullName from XWikiDocument doc order by doc.date desc"))
22 22  #set($query = $query.setLimit(5))
23 23  #set($recentDocs = $query.execute())
... ... @@ -25,27 +25,28 @@
25 25  #if($recentDocs.isEmpty())
26 26   No recent documents found.
27 27  #else
28 - ## 循环显示最近的文档标题
29 29   #foreach($docFullName in $recentDocs)
30 - #set($document = $xwiki.getDocument($docFullName))
31 - ## 获取文档标题
32 - #set($docTitle = $document.getDisplayTitle())
28 + #set($doc = $xwiki.getDocument($docFullName))
29 + #set($docTitle = $doc.getTitle())
30 +
31 + #if($docTitle == '')
32 + #set($docTitle = 'Untitled Document')
33 + #end
33 33  
34 - ## 显示标题或权限不足消息
35 - #if($xwiki.hasAccessLevel('view', 'XWikiGuest', $document.getFullName()))
36 - #if($docTitle == '')
37 - * Untitled Document
38 - #else
39 - * $docTitle
40 - #end
35 + #if($xcontext.user == 'XWikiGuest')
36 + ## 如果用户是访客,则只显示标题而不添加链接
37 + * $docTitle
41 41   #else
42 - * 您的权限不够,请登录查看
39 + ## 如果用户是已登录会员,则显示链接
40 + * [[${docTitle}>>${doc.getExternalURL('view')}]]
43 43   #end
44 44   #end
45 45  #end
46 46  {{/velocity}}
47 47  
48 -
46 +
47 +
48 +
49 49  )))
50 50  
51 51  (% class="col-xs-12 col-sm-6" %)