summaryrefslogtreecommitdiffstats
path: root/modules-available/dozmod/templates/mailconfig.html
blob: d5d4db293bc02d487991f85d0a678a574e58903a (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
<h1>{{lang_bwlehrpoolsuite}}</h1>

<div class="panel panel-default">
	<div class="panel-heading">
		{{lang_mailConfig}}
	</div>
	<div class="panel-body">

		<p>{{lang_mailDescription}}</p>
		<form action="?do=DozMod" method="post" id="mailconf">
			<input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="position:absolute;top:-2000px" tabindex="-1">
			<input type="password" name="password_fake" id="password_fake" value="" style="position:absolute;top:-2000px" tabindex="-1">
			<div class="input-group">
				<label class="input-group-addon" for="host-id">{{lang_host}} *</label>
				<input type="text" name="host" id ="host-id" class="form-control" placeholder="smtp.example.com" value="{{host}}">
			</div>
			<div class="input-group">
				<label class="input-group-addon" for="port-id">{{lang_port}} *</label>
				<input type="text" name="port" id ="port-id" class="form-control" placeholder="465" value="{{port}}">
			</div>
			<div class="input-group">
				<label class="input-group-addon" for="ssl-id">{{lang_ssl}} *</label>
				<select class="form-control" name="ssl" id="ssl-id">
					<option value="NONE" {{set_NONE}}>{{lang_sslNone}}</option>
					<option value="IMPLICIT" {{set_IMPLICIT}}>{{lang_sslImplicit}}</option>
					<option value="EXPLICIT" {{set_EXPLICIT}}>{{lang_sslExplicit}}</option>
				</select>
			</div>
			<div class="input-group">
				<label class="input-group-addon" for="senderAddress-id">{{lang_senderAddress}} *</label>
				<input type="text" name="senderAddress" id ="senderAddress-id" class="form-control" placeholder="smtp-username@hs-example.com" value="{{senderAddress}}">
			</div>
			<div class="input-group">
				<label class="input-group-addon" for="serverName-id">{{lang_senderName}}</label>
				<input type="text" name="serverName" id ="serverName-id" class="form-control" placeholder="bwLehrpool HS Example" value="{{serverName}}">
			</div>
			<div class="input-group">
				<label class="input-group-addon" for="replyTo-id">{{lang_replyTo}}</label>
				<input type="text" name="replyTo" id ="replyTo-id" class="form-control" placeholder="helpdesk@hs-example.com" value="{{replyTo}}">
			</div>
			<div class="input-group">
				<label class="input-group-addon" for="username-id">{{lang_username}}</label>
				<input type="text" name="username" id ="username-id" class="form-control" placeholder="{{lang_usernameplaceholder}}" value="{{username}}">
			</div>
			<div class="input-group">
				<label class="input-group-addon" for="password-id">{{lang_password}}</label>
				<input type="{{password_type}}" name="password" id ="password-id" class="form-control" placeholder="{{lang_passwordplaceholder}}" value="{{password}}">
			</div>
			<p>{{lang_asteriskRequired}}</p>
			<br>
			<p>{{lang_testConfiguration}}</p>
			<div class="input-group">
				<label class="input-group-addon" for="test-id">{{lang_testRecipient}}</label>
				<input type="text" name="recipient" id ="test-id" class="form-control" placeholder="test@example.com" value="">
			</div>
			<br>
			<div class="text-right">
				<button {{^allowedTest}}disabled{{/allowedTest}} class="btn btn-warning" type="button" id="test-button" name="button" value="test" onclick="slxTestConfig()"><span class="glyphicon glyphicon-envelope"></span> {{lang_test}}</button>
				<span id="test-spin" style="display:none"><span class="glyphicon glyphicon-refresh slx-rotation"></span></span>
				<pre id="test-output" style="display:none"></pre>
				<button {{^allowedSave}}disabled{{/allowedSave}} class="btn btn-primary" type="submit" name="button" value="save"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button>
				<br>
				<input type="hidden" name="token" value="{{token}}">
				<input type="hidden" name="action" value="mail">
			</div>
		</form>
	</div>
</div>

<script type="text/javascript"><!--
function slxTestConfig() {
		$('#test-button').prop('disabled', true);
		$('#test-spin').css('display', '');
		var str = $('#mailconf').serialize();
		str += '&button=test';
		console.log(str);
		$.post('?do=DozMod', str).done(function(data) {
			console.log('Success');
			console.log(data);
			checkRes(data);
		}).fail(function() {
			checkRes('DozMod refused the connection');
		}).always(function() {
			$('#test-button').prop('disabled', false);
			$('#test-spin').css('display', 'none');
		});
	}

	function checkRes(text) {
		$('#test-output').css('display', '').text(text);
	}
// --> </script>