/
link_filters.tpl.html
180 lines (174 loc) · 6.48 KB
/
link_filters.tpl.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
{extends "manage/manage.tpl.html"}
{block "manage_content"}
<script type="text/javascript">
function validateForm()
{
if (Validation.isFieldWhitespace('pattern')) {
alert('{t escape=js}Please enter a pattern.{/t}');
Validation.selectField('pattern');
return false;
}
if (Validation.isFieldWhitespace('replacement')) {
alert('{t escape=js}Please enter a replacement value.{/t}');
Validation.selectField('replacement');
return false;
}
if (!Validation.hasOneSelected('projects[]')) {
alert('{t escape=js}Please select projects this link filter should be active for.{/t}');
Validation.selectField('projects[]');
return false;
}
if (!Validation.hasOneSelected('usr_role')) {
alert('{t escape=js}Please select the minimum user role that should be able to see this link filter.{/t}');
Validation.selectField('usr_role');
return false;
}
return true;
}
function checkDelete()
{
if (!Validation.hasOneChecked('items[]')) {
alert('{t escape=js}Please select at least one link filter.{/t}');
return false;
}
if (!confirm('{t escape=js}WARNING: This action will remove the selected link filters permanently.{/t}\n{t}Please click OK to confirm.{/t}')) {
return false;
} else {
return true;
}
}
$().ready(function() {
$('#link_filter_form').submit(validateForm);
$('.select_all').click(function() { Eventum.toggleCheckAll('items[]'); });
$('#delete_form').submit(checkDelete);
});
</script>
<form id="link_filter_form" method="post">
{if $smarty.get.cat|default:'' == 'edit'}
<input type="hidden" name="cat" value="update">
<input type="hidden" name="id" value="{$smarty.get.id|default:''|intval}">
{else}
<input type="hidden" name="cat" value="new">
{/if}
<table class="bordered">
<tr class="title">
<th colspan="2">
{t}Manage Link Filters{/t} {include file="help_link.tpl.html" topic="link_filters"}
</th>
</tr>
<tr>
<th width="120">
{t}Pattern{/t} *
</th>
<td>
<input type="text" name="pattern" size="40" value="{$info.lfi_pattern|default:''|escape:"html"}">
{include file="error_icon.tpl.html" field="pattern"}
</td>
</tr>
<tr>
<th width="120">
{t}Replacement{/t} *
</th>
<td width="80%">
<input type="text" name="replacement" size="40" value="{$info.lfi_replacement|default:''|escape:"html"}">
{include file="error_icon.tpl.html" field="replacement"}
</td>
</tr>
<tr>
<th width="120">
{t}Description{/t}
</th>
<td>
<input type="text" name="description" size="50" value="{$info.lfi_description|default:''|escape:"html"}">
{include file="error_icon.tpl.html" field="description"}
</td>
</tr>
<tr>
<th width="120">
<nobr>{t}Assigned Projects{/t} *</nobr>
</th>
<td>
<select name="projects[]" multiple size="3">
{html_options options=$project_list selected=$info.projects|default:''}
</select>
{include file="error_icon.tpl.html" field="projects[]"}
</td>
</tr>
<tr>
<th width="120">
{t}Minimum User Role{/t}: *
</th>
<td width="80%">
<select name="usr_role">
{html_options options=$user_roles selected=$info.lfi_usr_role|default:''}
</select>
{include file="error_icon.tpl.html" field="usr_role"}
</td>
</tr>
<tr class="buttons">
<td colspan="2">
{if $smarty.get.cat|default:'' == 'edit'}
<input type="submit" value="{t}Update Link Filter{/t}">
{else}
<input type="submit" value="{t}Create Link Filter{/t}">
{/if}
<input type="reset" value="{t}Reset{/t}">
</td>
</tr>
</table>
</form>
<form id="delete_form" method="post">
<table class="bordered grid">
<tr class="title">
<th colspan="6">
{t}Existing Link Filters{/t}
</th>
</tr>
<tr>
<th nowrap><input type="button" value="{t}All{/t}" class="select_all"></th>
<th> {t}Pattern{/t}</th>
<th> {t}Replacement{/t}</th>
<th> {t}Description{/t}</th>
<th> {t}Minimum Role{/t}</th>
<th> {t}Projects{/t}</th>
</tr>
{section name="i" loop=$list}
<tr class="{cycle values='odd,even'}">
<td width="4" nowrap align="center">
<input type="checkbox" name="items[]" value="{$list[i].lfi_id}" {if $smarty.section.i.total == 0}disabled{/if}>
</td>
<td width="20%">
<a href="{$core.rel_url}manage/link_filters.php?cat=edit&id={$list[i].lfi_id}" title="{t}update this entry{/t}">{$list[i].lfi_pattern|escape:"html"}</a>
</td>
<td width="20%">
{$list[i].lfi_replacement|escape:"html"}
</td>
<td width="20%">
{$list[i].lfi_description|escape:"html"}
</td>
<td width="20%">
{$list[i].min_usr_role_name|escape:"html"}
</td>
<td width="20%">
{", "|join:$list[i].project_names|escape:"html"}
</td>
</tr>
{sectionelse}
<tr class="no_results">
<td colspan="6">
{t}No link filters could be found.{/t}
</td>
</tr>
{/section}
<tr class="buttons">
<td width="4" align="center">
<input type="button" value="{t}All{/t}" class="select_all">
<input type="hidden" name="cat" value="delete">
</td>
<td colspan="5">
<input type="submit" value="{t}Delete{/t}">
</td>
</tr>
</table>
</form>
{/block}