gocron/templates/manage/mail.html

201 lines
7.0 KiB
Go

{{{ template "common/header" . }}}
<div class="ui grid">
{{{template "manage/menu" .}}}
<div class="twelve wide column">
<div class="pageHeader">
<div class="segment">
<h3 class="ui dividing header">
<div class="content">
{{{.Title}}}
</div>
</h3>
</div>
</div>
<form class="ui form fluid vertical segment mail-server">
<div class="content"></div><br>
<div class="four fields">
<div class="field">
<label>
SMTP
</label>
<div class="ui small input">
<input type="text" name="host" value="{{{.Mail.Host}}}">
</div>
</div>
<div class="field">
<label>
</label>
<div class="ui small input">
<input type="text" name="port" value="{{{if gt .Mail.Port 0}}}{{{.Mail.Port}}}{{{end}}}">
</div>
</div>
<div class="field">
<label>
</label>
<div class="ui small input">
<input type="text" name="user" value="{{{.Mail.User}}}">
</div>
</div>
<div class="field">
<label>
</label>
<div class="ui small input">
<input type="text" name="password" value="{{{.Mail.Password}}}">
</div>
</div>
</div>
<button class="ui primary button"></button>
{{{if .Mail.Host}}}
<a class="ui green button" onclick="clearMailServer()"></a>
{{{end}}}
<br><br><br>
<div>
<div class="content"></div><p></p>
<div class="fields">
{{{range $i, $v := .Mail.MailUsers}}}
<div class="field">
<div class="ui segment">
{{{.Username}}}-{{{.Email}}}&nbsp;&nbsp;&nbsp;<div class="ui blue button" onclick="removeMailUser({{{.Id}}})"></div>
</div>
</div>
{{{end}}}
</div>
</div>
</form>
<div class="ui facebook button" onclick="createMailUser();"></div>
</div>
</div>
<div class="ui small modal">
<div class="header"></div>
<div class="content">
<form class="ui form mail-user">
<div class="two fields">
<div class="field">
<label>
</label>
<div class="ui small input">
<input type="text" name="username">
</div>
</div>
<div class="field">
<label>
</label>
<div class="ui small input">
<input type="text" name="email">
</div>
</div>
</div>
<button class="ui primary button"></button>
</form>
</div>
</div>
<script type="text/javascript">
$('.mail-server').form(
{
onSuccess: function(event, fields) {
util.post('/manage/mail/server',
fields,
function(code, message) {
location.reload();
}
);
return false;
},
fields: {
host: {
identifier : 'host',
rules: [
{
type : 'empty',
prompt : ''
}
]
},
port: {
identifier : 'port',
rules: [
{
type : 'integer[1..65535]',
prompt : ''
}
]
},
user: {
identifier : 'user',
rules: [
{
type : 'email',
prompt : ''
}
]
},
password: {
identifier : 'password',
rules: [
{
type : 'empty',
prompt : ''
}
]
}
},
inline : true
});
$('.mail-user').form(
{
onSuccess: function(event, fields) {
util.post('/manage/mail/user',
fields,
function(code, message) {
util.alertSuccess();
location.reload();
}
);
return false;
},
fields: {
username: {
identifier : 'username',
rules: [
{
type : 'empty',
prompt : ''
}
]
},
email: {
identifier : 'email',
rules: [
{
type : 'email',
prompt : ''
}
]
}
},
inline : true
});
function createMailUser() {
$('.ui.modal').modal('show');
}
function removeMailUser(id) {
util.post('/manage/mail/user/remove/' + id, {}, function(code, message) {
location.reload();
});
}
function clearMailServer() {
util.post('/manage/mail/server/clear', {}, function(code, message) {
location.reload();
});
}
</script>
{{{ template "common/footer" . }}}