1{* $Id$ *}
2{if !isset($versioned) or not $versioned}
3	{capture assign=more_section}
4		{if $page|lower ne 'sandbox'}
5			{if $tiki_p_remove eq 'y' && (isset($editable) and $editable)}
6				<a class="dropdown-item btn text-danger btn-link" href="{bootstrap_modal controller=wiki action=remove_pages checked=$page version='last'}">
7					{tr}Remove{/tr}
8				</a>
9			{/if}
10			{if $tiki_p_admin_wiki eq 'y' or $tiki_p_assign_perm_wiki_page eq 'y'}
11				{permission_link mode=link type="wiki page" addclass="dropdown-item" id=$page permType=wiki title=$page}
12			{/if}
13			{if $prefs.feature_page_contribution eq 'y' and $tiki_p_page_contribution_view eq 'y'}
14				{button _keepall='y' href="tiki-page_contribution.php" page=$page _type="link" _class="dropdown-item" _text="{tr}Contributions by author{/tr}"}
15			{/if}
16		{/if}
17		{if $prefs.feature_likePages eq 'y' and $tiki_p_wiki_view_similar eq 'y'}
18			{button _keepall='y' href="tiki-likepages.php" page=$page _type="link" _class="dropdown-item" _text="{tr}Similar{/tr}"}
19		{/if}
20
21		{if $prefs.feature_wiki_undo eq 'y' and $canundo eq 'y'}
22			{button _keepall='y' href="tiki-index.php" page=$page undo="1" _type="link" _class="dropdown-item" _text="{tr}Undo{/tr}"}
23		{/if}
24
25		{if $prefs.feature_wiki_make_structure eq 'y' and $tiki_p_edit_structures eq 'y' and (isset($editable)
26		and $editable) and $structure eq 'n' and count($showstructs) eq 0}
27			{button _keepall='y' href="tiki-index.php" page=$page convertstructure="1" _type="link" _class="dropdown-item" _text="{tr}Make Structure{/tr}"}
28		{/if}
29
30		{if $prefs.feature_slideshow eq 'y' && $prefs.wiki_uses_slides eq 'y'}
31			{if $show_slideshow eq 'y'}
32				{button _keepall='y' href="./tiki-slideshow.php" page=$page _type="link" _class="dropdown-item" _text="{tr}Slideshow{/tr}"}
33			{elseif $structure eq 'y'}
34				{button _keepall='y' href="tiki-slideshow2.php" page_ref_id=$page_info.page_ref_id _type="link" _class="dropdown-item" _text="{tr}Slideshow{/tr}"}
35			{/if}
36		{/if}
37
38		{if $prefs.feature_wiki_export eq 'y' and ( $tiki_p_admin_wiki eq 'y' or $tiki_p_export_wiki eq 'y' )}
39			{button _keepall='y' href="tiki-export_wiki_pages.php" page=$page _type="link" _class="dropdown-item" _text="{tr}Export{/tr}"}
40		{/if}
41
42		{if $prefs.feature_wiki_discuss eq 'y' && $show_page eq 'y' && $tiki_p_forum_post eq 'y' && ( empty($prefs.wiki_discuss_visibility) || $prefs.wiki_discuss_visibility eq 'button')}
43			{capture assign=wiki_discussion_string}
44				{include file='wiki-discussion.tpl'} [tiki-index.php?page={$page|escape:url}|{$page}]
45			{/capture}
46			{button _keepall='y' href="tiki-view_forum.php" forumId=$prefs.wiki_forum_id comments_postComment="post" comments_title=$page comments_data=$wiki_discussion_string comment_topictype="n" _type="link" _class="dropdown-item" _text="{tr}Discuss{/tr}"}
47		{/if}
48		{if $prefs.feature_multilingual eq 'y' and ($tiki_p_edit eq 'y'
49		or (!$user and $prefs.wiki_encourage_contribution eq 'y')) and !$lock}
50			{button _keepall='y' href="tiki-edit_translation.php" page=$page _type="link" _class="dropdown-item" _text="{tr}Translate{/tr}"}
51		{/if}
52
53		{if $tiki_p_admin_wiki eq 'y' && $prefs.wiki_keywords eq 'y'}
54			{button _keepall='y' href="tiki-admin_keywords.php" page=$page _type="link" _class="dropdown-item" _text="{tr}Keywords{/tr}"}
55		{/if}
56		{if $user and (isset($tiki_p_create_bookmarks) and $tiki_p_create_bookmarks eq 'y') and $prefs.feature_user_bookmarks eq 'y'}
57			{assign var=urlurl value="{$page|sefurl}{$smarty.server.REQUEST_URI|regex_replace:'/^[^\?\&]*/':''|regex_replace:'/(\?page=[^\&]+)/':''}"}{button _script="tiki-user_bookmarks.php" urlname=$page urlurl=$urlurl addurl="Add" _type="link" _class="dropdown-item" _text="{tr}Bookmark{/tr}" _auto_args="urlname,urlurl,addurl"}
58		{/if}
59
60		{* Use `$smarty->append('tiki_page_bar_more_items', $item);` to put your item here *}
61		{if ! empty($tiki_page_bar_more_items)}
62			{foreach from=$tiki_page_bar_more_items item=item }
63				{$item}
64			{/foreach}
65		{/if}
66	{/capture}
67	{capture assign=page_bar}
68		{if $edit_page neq 'y'}
69			{* Check that page is not locked and edit permission granted. SandBox can be edited w/o perm *}
70			{if ((isset($editable) and $editable) and ($tiki_p_edit eq 'y' or $page|lower eq 'sandbox')
71				or (!$user and $prefs.wiki_encourage_contribution eq 'y')) or $tiki_p_admin_wiki eq 'y'}
72				{if isset($beingEdited) and $beingEdited eq 'y'}
73					{assign var=thisPageClass value='+highlight'}
74				{else}
75					{assign var=thisPageClass value=''}
76				{/if}
77				{if $prefs.flaggedrev_approval neq 'y' or ! $revision_approval or $lastVersion eq $revision_displayed}
78					{if isset($page_ref_id)}
79						{button _keepall='y' href="tiki-editpage.php" page=$page page_ref_id=$page_ref_id _class="$thisPageClass mb-2" _text="{tr}Edit{/tr}" _title="{tr}Edit this page{/tr}"}
80					{else}
81						{button _keepall='y' href="tiki-editpage.php" page=$page _class="$thisPageClass mb-2" _text="{tr}Edit{/tr}" _title="{tr}Edit this page{/tr}"}
82					{/if}
83				{elseif $tiki_p_wiki_view_latest eq 'y'}
84					{self_link latest=1 _class="btn btn-warning"}
85						{tr}View latest version before editing{/tr}
86					{/self_link}
87				{/if}
88			{/if}
89
90			{if $page|lower ne 'sandbox'}
91				{if $tiki_p_rename eq 'y' && (isset($editable) and $editable)}
92					{button _keepall='y' _class="mb-2" href="tiki-rename_page.php" page=$page _text="{tr}Rename{/tr}"}
93				{/if}
94				{if $prefs.feature_wiki_usrlock eq 'y' and $user and $tiki_p_lock eq 'y'}
95					{if !$lock}
96						<a class="btn btn-primary mb-2" href="{bootstrap_modal controller=wiki action=lock_pages checked=$page}">
97							{tr}Lock{/tr}
98						</a>
99					{elseif $tiki_p_admin_wiki eq 'y' or $user eq $page_user}
100						<a class="btn btn-primary mb-2" href="{bootstrap_modal controller=wiki action=unlock_pages checked=$page}">
101							{tr}Unlock{/tr}
102						</a>
103					{/if}
104				{/if}
105				{if $prefs.feature_history eq 'y' and $tiki_p_wiki_view_history eq 'y'}
106					{button _keepall='y' _type="info mb-2" href="tiki-pagehistory.php" page=$page _text="{tr}History{/tr}"}
107				{/if}
108			{/if}
109
110			{if $prefs.feature_source eq 'y' and $tiki_p_wiki_view_source eq 'y'}
111				{button _keepall='y' _type="info mb-2" href="tiki-pagehistory.php" page=$page source="0" _text="{tr}Source{/tr}"}
112			{/if}
113
114			{if $prefs.feature_wiki_comments eq 'y'
115				&& ($prefs.wiki_comments_allow_per_page eq 'n' or $info.comments_enabled eq 'y')
116				&& $tiki_p_wiki_view_comments eq 'y'
117				&& $tiki_p_read_comments eq 'y'}
118
119						{* Auto display comments if display by default preference is set *}
120						{if $prefs.wiki_comments_displayed_default eq 'y'}
121						{jq}{literal}
122							var id = '#comment-container';
123							$(id).comment_load('tiki-ajax_services.php?controller=comment&action=list&type=wiki+page&objectId={/literal}{$page|escape:url}{literal}#comment-container');
124							$(document).ajaxComplete(function(){$(id).tiki_popover();});
125							{/literal}
126						{/jq}
127						{/if}
128
129						<a class="btn btn-secondary mb-2" id="comment-toggle" href="{service controller=comment action=list type="wiki page" objectId=$page}#comment-container">
130							{tr}Comments{/tr}
131							{if $count_comments}
132								&nbsp;<span class="count_comments badge badge-secondary">{$count_comments}</span>
133							{/if}
134						</a>
135						{jq}
136							$('#comment-toggle').comment_toggle();
137						{/jq}
138			{/if}
139
140
141			{if isset($show_page) and $show_page eq 'y'}
142				{* don't show attachments button if feature disabled or no corresponding rights or no attached files and r/o*}
143
144				{if $prefs.feature_wiki_attachments == 'y'
145					&& (
146						$tiki_p_wiki_view_attachments == 'y'
147						&& (isset($atts) && $atts|@count gt 0)
148						|| $tiki_p_wiki_attach_files == 'y'
149						|| $tiki_p_wiki_admin_attachments == 'y')}
150
151					{capture assign=thistext}
152						{strip}
153							{if (!isset($atts) or $atts|@count == 0) || $tiki_p_wiki_attach_files == 'y'
154								&& $tiki_p_wiki_view_attachments == 'n' && $tiki_p_wiki_admin_attachments == 'n'}
155								{tr}Files{/tr}
156							{else}
157								{tr}Files{/tr}
158								&nbsp;<span class="atts_count badge badge-info">{$atts|@count}</span>
159							{/if}
160						{/strip}
161					{/capture}
162
163					{if (isset($atts) and $atts|@count gt 0) || $editable}
164						{button href="#attachments" _flip_id="attzone{if isset($pagemd5)}{$pagemd5}{/if}" _type="secondary mb-2" _text=$thistext _flip_default_open=$prefs.w_displayed_default _flip_hide_text="n"}
165					{/if}
166				{/if}{* attachments *}
167
168			{/if}
169			{if $more_section|trim neq ''}
170				<div class="btn-group dropup mb-2">
171					<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">{tr}More{/tr}</button>
172					<div class="dropdown-menu" role="menu">
173						{$more_section}
174					</div>
175				</div>
176			{/if}
177		{/if}
178	{/capture}
179
180	{if $prefs.feature_wiki_discuss eq 'y' && $show_page eq 'y' && $tiki_p_forum_post eq 'y' && $prefs.wiki_discuss_visibility eq 'above' }
181			{include file='discussinforum.tpl'}
182	{/if}
183
184	{if $page_bar|trim neq ''}
185		<div class="form-group row mx-0 my-3" id="page-bar">
186			<div class="btn-bar">
187				{$page_bar}
188			</div>
189		</div>
190	{/if}
191
192	{strip}
193
194		{if $wiki_extras eq 'y' && $prefs.feature_wiki_attachments eq 'y' and $tiki_p_wiki_view_attachments eq 'y'}
195			{if $prefs.feature_use_fgal_for_wiki_attachments eq 'y'}
196				{attachments _id=$page _type='wiki page'}
197			{else}
198				{include file='attachments.tpl'}
199			{/if}
200		{/if}
201
202		{if $prefs.feature_wiki_comments eq 'y' and $tiki_p_wiki_view_comments == 'y' and $edit_page ne 'y'}
203			<div id="comment-container"></div>
204		{/if}
205
206	{/strip}
207{/if}
208{* don't show comments if feature disabled or not enough rights *}
209