summaryrefslogtreecommitdiffstats
path: root/modules-available/eventlog/templates/page-filters-edit-transport.html
blob: d8be689270ba243c41eed168e24e54c96fb4ea26 (plain) (blame)
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
181
182
183
184
185
186
187
188
189
190
<h2>{{lang_editTransport}} {{#title}}–{{/title}} {{title}}</h2>

<form method="post" action="?do=eventlog&amp;show=transports">
	<input type="hidden" name="token" value="{{token}}">
	<input type="hidden" name="id" value="{{transportid}}">

	<div class="form-group row">
		<div class="col-sm-6">
			<label for="title">{{lang_title}}</label>
			<input id="title" name="title" class="form-control" value="{{title}}" required>
		</div>
		<div class="col-sm-6">
			<label for="transport-select">
				{{lang_type}}
			</label>
			<select id="transport-select" class="form-control" name="type">
				<option value="mail" {{mail_selected}}>{{lang_mail}}</option>
				<option value="irc" {{irc_selected}}>{{lang_irc}}</option>
				<option value="http" {{http_selected}}>{{lang_http}}</option>
				<option value="group" {{group_selected}}>{{lang_transportGroup}}</option>
			</select>
		</div>
	</div>
	<hr>

	<div class="transport-list">
		<div id="transport-mail">
			<div class="form-group row">
				<div class="col-md-6">
					<label for="mail-config">{{lang_mailConfig}}</label>
					<select class="form-control" name="mail-config-id" id="mail-config">
						{{^mailconfigs}}
						<option value="0" disabled>{{lang_noMailConfig}}</option>
						{{/mailconfigs}}
						{{#mailconfigs}}
						<option value="{{configid}}" {{selected}}>{{senderaddress}} @ {{host}}:{{port}}</option>
						{{/mailconfigs}}
					</select>
				</div>
				<div class="col-md-6">
					<label for="mail-users">{{lang_mailUsers}}</label>
					<select class="form-control multilist" name="mail-users[]" multiple id="mail-users">
						{{#users}}
						<option value="{{userid}}" {{selected}} {{disabled}}>{{login}} - {{fullname}} - {{email}}</option>
						{{/users}}
					</select>
				</div>
			</div>
			<div class="form-group row">
				<div class="col-md-12">
					<label for="mail-extra-mails">{{lang_additionalMailAddresses}}</label>
					<textarea class="form-control" name="mail-extra-mails" id="mail-extra-mails">{{data.mail-extra-mails}}</textarea>
				</div>
			</div>
		</div>

		<div id="transport-irc">
			<div class="form-group row">
				<div class="col-md-4 col-sm-6">
					<label for="irc-server">{{lang_ircServer}}</label>
					<input id="irc-server" name="irc-server" class="form-control" value="{{data.irc-server}}"
							 placeholder="irc.example.com">
				</div>
				<div class="col-md-4 col-sm-6">
					<label for="irc-target">{{lang_ircTarget}}</label>
					<input id="irc-target" name="irc-target" class="form-control" value="{{data.irc-target}}" placeholder="#foo">
				</div>
				<div class="col-md-4 col-sm-6">
					<label for="irc-server-passwd">{{lang_ircServerPassword}}</label>
					<input id="irc-server-passwd" name="irc-server-passwd" class="form-control"
							 value="{{data.irc-server-passwd}}">
				</div>
			</div>
			<div class="form-group row">
				<div class="col-md-4 col-sm-6">
					<label for="irc-nickname">{{lang_ircNickname}}</label>
					<input id="irc-nickname" name="irc-nickname" class="form-control" value="{{data.irc-nickname}}"
							 placeholder="Brunhilde">
				</div>
			</div>
		</div>

		<div id="transport-http">
			<div class="form-group row">
				<div class="col-md-10">
					<label for="http-uri">{{lang_httpUri}}</label>
					<input id="http-uri" name="http-uri" class="form-control" value="{{data.http-uri}}"
							 placeholder="https://example.com/bwlp">
					<p>{{lang_uriUseSUBJECTandTEXThint}}</p>
				</div>
				<div class="col-md-2">
					<label for="http-method">{{lang_httpMethod}}</label>
					<select id="http-method" name="http-method" class="form-control">
						<option {{POST_selected}}>POST</option>
						<option {{GET_selected}}>GET</option>
					</select>
				</div>
			</div>
			<div id="post-options" class="form-group row">
				<div class="col-md-7">
					<label for="http-post-field">{{lang_httpPostField}}</label>
					<input id="http-post-field" name="http-post-field" class="form-control" value="{{data.http-post-field}}"
							 placeholder="key=1234&message=%TEXT%">
					<p>{{lang_postUseSUBJECTandTEXThint}}</p>
				</div>
				<div class="col-md-5">
					<label for="http-post-format">{{lang_httpPostFormat}}</label>
					<select id="http-post-format" name="http-post-format" class="form-control">
						<option value="FORM" {{FORM_selected}} aria-describedby="d-fd">FORM-data (urlencode)</option>
						<option value="JSON" {{JSON_selected}} aria-describedby="d-js">json string</option>
						<option value="JSON_AUTO" {{JSON_AUTO_selected}} aria-describedby="d-aj">{{lang_autoJson}}</option>
					</select>
					<div id="d-fd"><b>FORM-data</b>: {{lang_formDataHelp}}</div>
					<div id="d-js"><b>json string</b>: {{lang_jsonStringHelp}}</div>
					<div id="d-aj"><b>{{lang_autoJson}}</b>: {{lang_autoJsonHelp}}</div>
				</div>templates
			</div>
			<div class="form-group">
				<label for="http-method"></label>
			</div>
		</div>

		<div id="transport-group">
			<div class="form-group">
				<label for="group-list">{{lang_selectTransports}}</label>
				<select class="form-control multilist" name="group-list[]" multiple id="group-list">
					{{#backends}}
					<option value="{{transportid}}" {{selected}}>{{title}}</option>
					{{/backends}}
				</select>
			</div>
		</div>
	</div>
	<hr>

	<div class="form-group">
		<label for="i-rules">{{lang_rules}}</label>
		<select multiple name="rules[]" id="i-rules" class="form-control multilist">
			{{#rules}}
			<option value="{{ruleid}}" {{selected}}>{{title}}</option>
			{{/rules}}
		</select>
	</div>

	<div class="form-group">
		<label for="description-box">{{lang_optionalDescription}}</label>
		<textarea id="description-box" name="description" class="form-control" rows="10">{{description}}</textarea>
	</div>

	<div class="buttonbar text-right">
		<a class="btn btn-default" href="?do=eventlog&amp;show=transports">
			{{lang_cancel}}
		</a>
		<button class="btn btn-primary" type="submit" name="action" value="save-transport">
			<span class="glyphicon glyphicon-floppy-disk"></span>
			{{lang_save}}
		</button>
	</div>
</form>

<script>
	document.addEventListener('DOMContentLoaded', function () {
		// Show proper transport options
		$('#transport-select').change(function () {
			$('.transport-list > div').hide();
			$('#transport-' + $('#transport-select').val()).show();
		}).change();
		// Init multilist of available
		var $multilists = $("select.multilist");
		if ($multilists.multiselect) {
			$multilists.multiselect({
				includeSelectAllOption: true,
				buttonWidth: '100%',
				buttonClass: 'form-control'
			});
		}
		// Hide POST options for GET
		$('#http-method').change(function () {
			if ($(this).val() === 'POST') {
				$('#post-options').show();
			} else {
				$('#post-options').hide();
			}
		}).change();
		// Disable POST input for JSON_AUTO
		$('#http-post-format').change(function () {
			$('#http-post-field').prop('disabled', $(this).val() === 'JSON_AUTO');
		}).change();
	});
</script>