1{* $Id$ *}
2
3{title help="User Watches"}{tr}User Watches and preferences{/tr}{/title}
4{include file='tiki-mytiki_bar.tpl'}
5
6{if $email_ok eq 'n'}
7	{remarksbox type="warning" title="{tr}Warning{/tr}"}
8	{tr}You need to set your email to receive email notifications.{/tr}
9		<a href="tiki-user_preferences.php" class="tips alert-link" title=":{tr}User preferences{/tr}">{icon name="next"}</a>
10	{/remarksbox}
11{/if}
12
13
14{tabset name="user_watches"}
15
16{if $prefs.feature_daily_report_watches eq 'y'}
17	{tab name="{tr}Report Preferences{/tr}"}
18		<h2>{tr}Report Preferences{/tr}</h2>
19		{remarksbox type="tip" title="{tr}Tip{/tr}"}{tr}Use reports to summarise notifications about objects you are watching.{/tr}{/remarksbox}
20		<form action="tiki-user_reports.php" method="post">
21			{ticket}
22			<input type="hidden" name="report_preferences" value="true">
23
24			<div class="form-group row">
25				<label class="col-sm-3" for="use_daily_reports">{tr}Use reports{/tr}</label>
26				<div class="col-sm-9">
27                    <div class="form-check">
28					    <input type="checkbox" class="form-check-input" name="use_daily_reports" value="true" {if $report_preferences != false}checked{/if}>
29				    </div>
30                </div>
31			</div>
32			<div class="form-group row">
33				<label class="col-sm-3" for="interval">{tr}Reporting interval{/tr}</label>
34				<div class="col-sm-9">
35					<select name="interval" class="form-control" >
36						<option value="minute"
37								{if $report_preferences.interval eq "minute"}selected{/if}>{tr}Every minute{/tr}</option>
38						<option value="hourly"
39								{if $report_preferences.interval eq "hourly"}selected{/if}>{tr}Hourly{/tr}</option>
40						<option value="daily"
41								{if $report_preferences.interval eq "daily" or !isset($report_preferences.interval)}selected{/if}>{tr}Daily{/tr}</option>
42						<option value="weekly"
43								{if $report_preferences.interval eq "weekly"}selected{/if}>{tr}Weekly{/tr}</option>
44						<option value="monthly"
45								{if $report_preferences.interval eq "monthly"}selected{/if}>{tr}Monthly{/tr}</option>
46					</select>
47				</div>
48			</div>
49			<div class="form-group row">
50				<label class="col-sm-3" for="view">{tr}Report length{/tr}</label>
51				<div class="col-sm-9">
52					<input type="radio" name="view" value="short"{if $report_preferences.view eq "short"} checked="checked"{/if}>
53					{tr}Short report{/tr}
54					<br>
55					<input type="radio" name="view" value="detailed"{if $report_preferences.view eq "detailed" OR $report_preferences eq false} checked="checked"{/if}>
56					{tr}Detailed report{/tr}
57					<br>
58				</div>
59			</div>
60			<div class="form-group row">
61				<label class="col-sm-3" for="type">{tr}Report format{/tr}</label>
62				<div class="col-sm-9">
63					<input type="radio" name="type" value="html"{if $report_preferences.type eq "html" OR $report_preferences eq false} checked="checked"{/if}>
64					{tr}HTML{/tr}
65					<br>
66					<input type="radio" name="type" value="plain"{if $report_preferences.type eq "plain"} checked="checked"{/if}>
67					{tr}Plain text{/tr}
68					<br>
69				</div>
70			</div>
71			<div class="form-group row">
72				<label class="col-sm-3" for="always_email">{tr}Send report even if no activity{/tr}</label>
73				<div class="col-sm-9">
74                    <div class="form-check">
75    					<input type="checkbox" class="form-check-input" name="always_email" value="1"{if $report_preferences.always_email eq 1 OR $report_preferences eq false} checked="checked"{/if}>
76	    			</div>
77                </div>
78			</div>
79			<div class="form-group text-center">
80				<input type="submit" name="submit" class="btn btn-primary" title="{tr}Apply Changes{/tr}" value="{tr}Apply{/tr}">
81			</div>
82		</form>
83	{/tab}
84{/if}
85
86{tab name="{tr}My watches{/tr}"}
87	<h2>{tr}My watches{/tr}</h2>
88{remarksbox type="tip" title="{tr}Tip{/tr}"}{tr}Use "watches" to monitor wiki pages or other objects.{/tr} {tr}Watch new items by clicking the {icon name='watch'} button on specific pages.{/tr}{/remarksbox}
89
90{if $add_options|@count > 0}
91	<h3>{tr}Add Watch{/tr}</h3>
92	<form action="tiki-user_watches.php" method="post">
93		{ticket}
94		<div class="form-group row">
95			<label class="col-sm-3 col-form-label" for="type_selector">{tr}Event{/tr}</label>
96
97			<div class="col-sm-9">
98				<select name="event" id="type_selector" class="form-control">
99					<option>{tr}Select event type{/tr}</option>
100					{foreach key=event item=type from=$add_options}
101						<option value="{$event|escape}">{$type.label|escape}</option>
102					{/foreach}
103				</select>
104			</div>
105		</div>
106		{if $prefs.feature_categories eq 'y'}
107			<div class="form-group row" id="categ_list">
108				<label class="col-sm-3 col-form-label" for="langwatch_categ">{tr}Category{/tr}</label>
109
110				<div class="col-sm-9">
111					<select class="categwatch-select form-control" name="categwatch" id="langwatch_categ">
112						{foreach item=c from=$categories}
113							<option value="{$c.categId|escape}">{$c.name|escape}</option>
114						{/foreach}
115					</select>
116				</div>
117			</div>
118		{/if}
119		{if $prefs.feature_multilingual eq 'y'}
120			<div class="form-group row" id="lang_list">
121				<label class="col-sm-3 col-form-label">{tr}Language{/tr}</label>
122
123				<div class="col-sm-9">
124					<select name="langwatch" class="form-control">
125						{foreach item=l from=$languages}
126							<option value="{$l.value|escape}">{$l.name|escape}</option>
127						{/foreach}
128					</select>
129				</div>
130			</div>
131		{/if}
132		<div class="form-group text-center">
133			<input type="submit" class="btn btn-primary" name="add" value="{tr}Add{/tr}">
134		</div>
135	</form>
136	{jq}
137		$('#type_selector').change( function() {
138		var type = $(this).val();
139
140		$('#lang_list').hide();
141		$('#categ_list').hide();
142
143		if( type == 'wiki_page_in_lang_created' ) {
144		$('#lang_list').show();
145		}
146
147		if( type == 'category_changed_in_lang' ) {
148		$('#lang_list').show();
149		$('#categ_list').show();
150		}
151		} ).trigger('change');
152	{/jq}
153{/if}
154	<h3>{tr}Watches{/tr}</h3>
155	<form class="mb-4" action="tiki-user_watches.php" method="post" id='formi'>
156		<div class="form-group row">
157			<label class="col-sm-3 col-form-label" for="event">{tr}Show{/tr}</label>
158
159			<div class="col-sm-9">
160				<select class="form-control" name="event"
161						onchange="javascript:document.getElementById('formi').submit();">
162					<option value=""{if $smarty.request.event eq ''} selected="selected"{/if}>{tr}All watched events{/tr}</option>
163					{foreach from=$events key=name item=description}
164						<option value="{$name|escape}"{if $name eq $smarty.request.event} selected="selected"{/if}>
165							{if $name eq 'blog_post'}
166								{tr}A user submits a blog post{/tr}
167							{elseif $name eq 'forum_post_thread'}
168								{tr}A user posts a forum thread{/tr}
169							{elseif $name eq 'forum_post_topic'}
170								{tr}A user posts a forum topic{/tr}
171							{elseif $name eq 'wiki_page_changed'}
172								{if $prefs.wiki_watch_comments eq 'y'}
173									{tr}A user edited or commented on a wiki page{/tr}
174								{else}
175									{tr}A user edited a wiki page{/tr}
176								{/if}
177							{else}
178								{$description}
179							{/if}
180						</option>
181					{/foreach}
182				</select>
183			</div>
184		</div>
185	</form>
186	<form action="tiki-user_watches.php" method="post">
187		{ticket}
188		<div class="table-responsive">
189			<table class="table table-striped table-hover">
190				<tr>
191					{if $watches}
192						<th id="checkbox">
193							{select_all checkbox_names='checked[]'}
194						</th>
195					{/if}
196					<th>{tr}Event{/tr}</th>
197					<th>{tr}Object{/tr}</th>
198				</tr>
199
200				{foreach item=w from=$watches}
201					<tr>
202						{if $watches}
203							<td class="checkbox-cell">
204								<div class="form-check">
205									<input type="checkbox" name="checked[]" value="{$w.watchId}">
206								</div>
207							</td>
208						{/if}
209						<td class="text">
210							{if $w.event eq 'blog_post'}
211								{tr}A user submits a blog post{/tr}
212							{elseif $w.event eq 'forum_post_thread'}
213								{tr}A user posts a forum thread{/tr}
214							{elseif $w.event eq 'forum_post_topic'}
215								{tr}A user posts a forum topic{/tr}
216							{elseif $w.event eq 'wiki_page_changed'}
217								{if $prefs.wiki_watch_comments eq 'y'}
218									{tr}A user edited or commented on a wiki page{/tr}
219								{else}
220									{tr}A user edited a wiki page{/tr}
221								{/if}
222							{elseif isset($w.label)}
223								{$w.label}
224							{/if}
225							({$w.event})
226						</td>
227						<td class="text"><a class="link" href="{$w.url}">{tr}{$w.type}:{/tr} {$w.title|escape}</a></td>
228					</tr>
229					{foreachelse}
230					{norecords _colspan=2}
231				{/foreach}
232			</table>
233		</div>
234		{if $watches}
235			<div class="form-group text-center">
236				{tr}Perform action with checked:{/tr}
237				<input type="submit" class="btn btn-danger btn-sm" name="delete" value="{tr}Delete{/tr}">
238			</div>
239		{/if}
240	</form>
241{/tab}
242
243{tab name="{tr}Notification Preferences{/tr}"}
244	<h2>{tr}Notification Preferences{/tr}</h2>
245{remarksbox type="tip" title="{tr}Tip{/tr}"}{tr}Use this form to control notifications about objects you are watching.{/tr}{/remarksbox}
246	<form action="tiki-user_notifications.php" method="post">
247		{ticket}
248		<input type="hidden" name="notification_preferences" value="true">
249
250		<h4>{tr}Send notification when I am the editor{/tr}</h4>
251		{if $prefs.feature_wiki eq 'y'}
252			<div class="form-group row">
253				<label class="col-sm-3" for="user_wiki_watch_editor">{tr}Wiki{/tr}</label>
254				<div class="col-sm-9">
255                    <div class="form-check">
256    					<input class="form-check-input" type="checkbox" name="user_wiki_watch_editor" value="true" {if $user_wiki_watch_editor eq 'y'}checked{/if}>
257				    </div>
258                </div>
259			</div>
260		{/if}
261		{if $prefs.feature_articles eq 'y'}
262			<div class="form-group row">
263				<label class="col-sm-3" for="user_article_watch_editor">{tr}Article{/tr}</label>
264				<div class="col-sm-9">
265                  <div class="form-check">
266                      <input class="form-check-input" type="checkbox" name="user_article_watch_editor" value="true" {if $user_article_watch_editor eq 'y'}checked{/if}>
267                  </div>
268                </div>
269			</div>
270		{/if}
271		{if $prefs.feature_blogs eq 'y'}
272			<div class="form-group row">
273				<label class="col-sm-3" for="user_blog_watch_editor">{tr}Blog{/tr}</label>
274				<div class="col-sm-9">
275                    <div class="form-check">
276    					<input class="form-check-input" type="checkbox" name="user_blog_watch_editor" value="true" {if $user_blog_watch_editor eq 'y'}checked{/if}>
277				    </div>
278                </div>
279			</div>
280		{/if}
281		{if $prefs.feature_trackers eq 'y'}
282			<div class="form-group row">
283				<label class="col-sm-3" for="user_tracker_watch_editor">{tr}Tracker{/tr}</label>
284				<div class="col-sm-9">
285                    <div class="form-check">
286					    <input class="form-check-input" type="checkbox" name="user_tracker_watch_editor" value="true" {if $user_tracker_watch_editor eq 'y'}checked{/if}>
287				    </div>
288                </div>
289			</div>
290		{/if}
291		{if $prefs.feature_calendar eq 'y'}
292			<div class="form-group row">
293				<label class="col-sm-3" for="user_calendar_watch_editor">{tr}Calendar{/tr}</label>
294				<div class="col-sm-9">
295                    <div class="form-check">
296					    <input class="form-check-input" type="checkbox" name="user_calendar_watch_editor" value="true" {if $user_calendar_watch_editor eq 'y'}checked{/if}>
297				    </div>
298                </div>
299			</div>
300		{/if}
301		<div class="form-group row">
302			<label class="col-sm-3" for="user_comment_watch_editor">{tr}Comment{/tr}</label>
303			<div class="col-sm-9">
304                <div class="form-check">
305				    <input class="form-check-input" type="checkbox" name="user_comment_watch_editor" value="true" {if $user_comment_watch_editor eq 'y'}checked{/if}>
306			    </div>
307            </div>
308		</div>
309		{if $prefs.feature_categories eq 'y'}
310			<div class="form-group row">
311				<label class="col-sm-3" for="user_category_watch_editor">{tr}Category{/tr}</label>
312				<div class="col-sm-9">
313                    <div class="form-check">
314    					<input class="form-check-input" type="checkbox" name="user_category_watch_editor" value="true" {if $user_category_watch_editor eq 'y'}checked{/if}>
315	    			</div>
316                </div>
317			</div>
318		{/if}
319		<div class="form-group row">
320			<label class="col-sm-3" for="user_plugin_approval_watch_editor">{tr}Plugin approval{/tr}</label>
321			<div class="col-sm-9">
322                <div class="form-check">
323    				<input class="form-check-input" type="checkbox" name="user_plugin_approval_watch_editor" value="true" {if $user_plugin_approval_watch_editor eq 'y'}checked{/if}>
324	    		</div>
325            </div>
326		</div>
327		<div class="form-group text-center">
328			<input type="submit" class="btn btn-primary" name="submit" title="{tr}Apply Changes{/tr}" value="{tr}Apply{/tr}">
329		</div>
330	</form>
331{/tab}
332
333{/tabset}
334