blob: d8be689270ba243c41eed168e24e54c96fb4ea26 (
plain) (
tree)
|
|
<h2>{{lang_editTransport}} {{#title}}–{{/title}} {{title}}</h2>
<form method="post" action="?do=eventlog&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&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>
|