1{* $Id$ *}
2{title help="Newsletters"}{tr}Admin newsletters{/tr}{/title}
3
4<div class="t_navbar form-group row mb-4">
5	{button href="tiki-admin_newsletters.php?cookietab=2" _icon_name="create" _text="{tr}Create{/tr}"}
6	<a role="link" href="tiki-newsletters.php" class="btn btn-link" title="{tr}List{/tr}">{icon name="list"} {tr}List Newsletters{/tr}</a>
7	<a role="link" href="tiki-send_newsletters.php" class="btn btn-link" title="{tr}Send{/tr}">{icon name="envelope"} {tr}Send Newsletters{/tr}</a>
8{*	{button href="tiki-newsletters.php" _class="btn btn-info" _icon_name="list" _text="{tr}List{/tr}"}
9	{button href="tiki-send_newsletters.php" _class="btn btn-primary" _icon_name="envelope" _text="{tr}Send{/tr}"} *}
10</div>
11
12{tabset}
13
14	{tab name="{tr}Newsletters{/tr}"}
15		<h2>{tr}Newsletters{/tr}</h2>
16
17		{if $channels or ($find ne '')}
18			{include file='find.tpl'}
19		{/if}
20
21		<div class="{if $js}table-responsive{/if}"> {* table-responsive class cuts off css drop-down menus *}
22			<table class="table table-striped table-hover">
23				<tr>
24					<th>{self_link _sort_arg='sort_mode' _sort_field='nlId'}{tr}ID{/tr}{/self_link}</th>
25					<th>{self_link _sort_arg='sort_mode' _sort_field='name'}{tr}Newsletter{/tr}{/self_link}</th>
26					<th>{self_link _sort_arg='sort_mode' _sort_field='author'}{tr}Author{/tr}{/self_link}</th>
27					<th>{self_link _sort_arg='sort_mode' _sort_field='users'}{tr}Users{/tr}{/self_link}</th>
28					<th>{self_link _sort_arg='sort_mode' _sort_field='editions'}{tr}Editions{/tr}{/self_link}</th>
29					<th>{tr}Drafts{/tr}</th>
30					<th>{self_link _sort_arg='sort_mode' _sort_field='lastSent'}{tr}Last Sent{/tr}{/self_link}</th>
31					<th></th>
32				</tr>
33
34				{section name=user loop=$channels}
35					<tr>
36						<td class="id">{self_link cookietab='2' _anchor='anchor2' nlId=$channels[user].nlId _title="{tr}Edit{/tr}"}{$channels[user].nlId}{/self_link}</td>
37						<td class="text">
38							{self_link cookietab='2' _anchor='anchor2' nlId=$channels[user].nlId _title="{tr}Edit{/tr}"}{$channels[user].name|escape}{/self_link}
39							<div class="subcomment">{$channels[user].description|escape|nl2br}</div>
40						</td>
41						<td class="username">{$channels[user].author}</td>
42						<td class="integer">{$channels[user].users} ({$channels[user].confirmed})</td>
43						<td class="integer">{$channels[user].editions}</td>
44						<td class="integer">{$channels[user].drafts}</td>
45						<td class="date">{$channels[user].lastSent|tiki_short_datetime}</td>
46						<td class="action">
47							{actions}
48								{strip}
49									<action>
50										{permission_link mode=text type=newsletter permType=newsletters id=$channels[user].nlId title=$channels[user].name}
51									</action>
52									<action>
53										<a href="tiki-admin_newsletter_subscriptions.php?nlId={$channels[user].nlId}">
54											{icon name='group' _menu_text='y' _menu_icon='y' alt="{tr}Subscriptions{/tr}"}
55										</a>
56									</action>
57									<action>
58										<a href="tiki-send_newsletters.php?nlId={$channels[user].nlId}">
59											{icon name='envelope' _menu_text='y' _menu_icon='y' alt="{tr}Send newsletter{/tr}"}
60										</a>
61									</action>
62									<action>
63										<a href="tiki-newsletter_archives.php?nlId={$channels[user].nlId}">
64											{icon name='file-archive' _menu_text='y' _menu_icon='y' alt="{tr}Archives{/tr}"}
65										</a>
66									</action>
67									<action>
68										{self_link _icon_name='edit' _menu_text='y' _menu_icon='y' cookietab='2' _anchor='anchor2' nlId=$channels[user].nlId}
69											{tr}Edit{/tr}
70										{/self_link}
71									</action>
72									<action>
73										{self_link _icon_name='remove' _menu_text='y' _menu_icon='y' remove=$channels[user].nlId _onclick="confirmSimple(event, '{tr}Remove newsletter?{/tr}', '{ticket mode=get}')"}
74											{tr}Remove{/tr}
75										{/self_link}
76									</action>
77								{/strip}
78							{/actions}
79						</td>
80					</tr>
81				{sectionelse}
82					{norecords _colspan=8}
83				{/section}
84			</table>
85		</div>
86
87		{pagination_links cant=$cant_pages step=$prefs.maxRecords offset=$offset}{/pagination_links}
88	{/tab}
89
90	{tab name="{tr}Create/Edit Newsletters{/tr}"}
91		<h2>{tr}Create/Edit Newsletters{/tr}</h2>
92		{if isset($individual) && $individual eq 'y'}
93			{permission_link mode=link type=newsletter permType=newsletters id=$info.nlId title=$info.name label="{tr}There are individual permissions set for this newsletter{/tr}"}
94		{/if}
95
96		<form action="tiki-admin_newsletters.php" method="post">
97			{ticket}
98			<input type="hidden" name="nlId" value="{$info.nlId|escape}">
99			<input type="hidden" name="author" value="{$user|escape}">
100			<div class="form-group row">
101				<label class="col-sm-3 col-form-label"> {tr}Name:{/tr} </label>
102				<div class="col-sm-9">
103						<input class="form-control" type="text" name="name" value="{$info.name|escape}">
104				</div>
105			</div>
106			<div class="form-group row">
107				<label class="col-sm-3 col-form-label" for="description">{tr}Description:{/tr}</label>
108				<div class="col-sm-9">
109					<textarea class="form-control" name="description" id="description">{$info.description|escape}</textarea>
110				</div>
111			</div>
112			<div class="col-sm-12 offset-sm-3">
113				<div class="form-check">
114					<label>
115						<input type="checkbox" class="form-check-input" name="allowUserSub" {if $info.allowUserSub eq 'y'}checked="checked"{/if}>
116							{tr}Users can subscribe/unsubscribe to this list{/tr}
117					</label>
118				</div>
119			</div>
120			<div class="col-sm-12 offset-sm-3">
121				<div class="form-check">
122					<label>
123						<input type="checkbox" class="form-check-input" name="allowAnySub" {if $info.allowAnySub eq 'y'}checked="checked"{/if}>
124						{tr}Users can subscribe any email address{/tr}
125					</label>
126				</div>
127			</div>
128			<div class="col-sm-12 offset-sm-3">
129				<div class="form-check">
130					<label>
131						<input type="checkbox" class="form-check-input" name="unsubMsg" {if $info.unsubMsg eq 'y'}checked="checked"{/if}>
132						{tr}Add unsubscribe instructions to each newsletter{/tr}
133					</label>
134				</div>
135			</div>
136			<div class="col-sm-12 offset-sm-3">
137				<div class="form-check">
138					<label>
139						<input type="checkbox" class="form-check-input" name="validateAddr" {if $info.validateAddr eq 'y'}checked="checked"{/if}>
140						{tr}Validate email addresses{/tr}
141					</label>
142				</div>
143			</div>
144			<div class="col-sm-12 offset-sm-3">
145				<div class="form-check">
146					<label>
147						<input type="checkbox" class="form-check-input" name="allowTxt" {if $info.allowTxt eq 'y'}checked="checked"{/if}>
148						{tr}Allow customized text message to be sent with the HTML version{/tr}
149					</label>
150				</div>
151			</div>
152			<div class="col-sm-12 offset-sm-3">
153				<div class="form-check">
154					<label>
155						<input type="checkbox" class="form-check-input" name="allowArticleClip" {if $info.allowArticleClip eq 'y'}checked="checked"{/if}>
156						{tr}Allow clipping of articles into newsletter{/tr}
157					</label>
158				</div>
159			</div>
160			<div class="col-sm-12 offset-sm-3">
161				<div class="form-check">
162					<label>
163						<input type="checkbox" class="form-check-input" name="autoArticleClip" {if $info.autoArticleClip eq 'y'}checked="checked"{/if}>
164						{tr}Automatically clip articles into newsletter{/tr}
165					</label>
166				</div>
167			</div>
168			<div class="form-group row">
169				<div class="col-sm-12 offset-sm-3">
170					<div class="form-check">
171						<label>
172							<input type="checkbox" class="form-check-input" name="emptyClipBlocksSend" {if $info.emptyClipBlocksSend eq 'y'}checked="checked"{/if}>
173							{tr}Do not send newsletter if clip is empty{/tr}
174						</label>
175					</div>
176				</div>
177			</div>
178			<div class="form-group row">
179				<label class="col-sm-3 col-form-label" for="articleClipRangeDays">{tr}Clip articles published in the past number of days{/tr}</label>
180				<div class="col-sm-9">
181					<input type="text" class="form-control" name="articleClipRangeDays" id="articleClipRangeDays" value="{$info.articleClipRangeDays|escape}">
182				</div>
183			</div>
184			<div class="form-group row">
185				<label class="col-sm-3 col-form-label" for="articleClipTypes">{tr}Article types to clip{/tr}</label>
186				<div class="col-sm-9">
187					<select id="articleClipTypes" name="articleClipTypes[]" class="form-control" multiple="multiple">
188						{section name=type loop=$articleTypes}
189							<option value="{$articleTypes[type]}" {if in_array($articleTypes[type], $info.articleClipTypes)}selected="selected"{/if}>{$articleTypes[type]|escape}</option>
190						{/section}
191					</select>
192				</div>
193			</div>
194			<div class="text-center">
195				<input type="submit" class="btn btn-primary" name="save" value="{tr}Save{/tr}">
196			</div>
197		</form>
198	{/tab}
199
200{/tabset}
201