You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zncstrap/modules/webadmin/tmpl/add_edit_network.tmpl

357 lines
17 KiB

<? I18N znc-webadmin ?>
<? AddRow JSLoop HREF=/modfiles/global/webadmin/webadmin.js ?>
<? REM ?><? AddRow CSSLoop HREF=/modfiles/global/webadmin/webadmin.css ?><? ENDREM ?>
<? INC Header.tmpl ?>
<form class="form-horizontal" role="form" action="<? IF Edit ?>editnetwork<? ELSE ?>addnetwork<? ENDIF ?>" method="post">
<? INC _csrf_check.tmpl ?>
<div class="section">
<input type="hidden" name="submitted" value="1" />
<input type="hidden" name="user" value="<? VAR Username ?>" />
<input type="hidden" name="network" value="<? VAR Name ?>" />
<div class="container col-md-10 col-md-offset-1">
<div class="panel with-nav-tabs panel-default">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li class="active"><a href="#netinfotab" data-toggle="tab"><? FORMAT "Network Info" ?></a></li>
<li><a href="#floodprotab" data-toggle="tab"><? FORMAT "Flood protection:" ?></a></li>
<li><a href="#charencodetab" data-toggle="tab">Character Encoding</a></li>
<li><a href="#channelstab" data-toggle="tab"><? FORMAT "Channels" ?></a></li>
<li><a href="#modulestab" data-toggle="tab"><? FORMAT "Modules" ?></a></li>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<!-- Network Info -->
<div class="tab-pane fade in active" id="netinfotab">
<? IF Edit ?>
<? SETBLOCK ClientConnectHint_Password ?><? VAR Username ?>/<? VAR Name ?>:<? FORMAT "&lt;password&gt;" ?><? ENDSETBLOCK ?>
<? SETBLOCK ClientConnectHint_Username ?><? VAR Username ?>/<? VAR Name ?><? ENDSETBLOCK ?>
<? ELSE ?>
<? SETBLOCK ClientConnectHint_Password ?><? VAR Username ?>/<? FORMAT "&lt;network&gt;" ?>:<? FORMAT "&lt;password&gt;" ?><? ENDSETBLOCK ?>
<? SETBLOCK ClientConnectHint_Username ?><? VAR Username ?>/<? FORMAT "&lt;network&gt;" ?><? ENDSETBLOCK ?>
<? ENDIF ?>
<div class="alert alert-warning"><? FORMAT "To connect to this network from your IRC client, you can set the server password field as <code>{1}</code> or username field as <code>{2}</code>" "ClientConnectHint_Password ESC=" "ClientConnectHint_Username ESC=" ?></div>
<div class="alert alert-info"><? FORMAT "Nick, AltNick, Ident, RealName, BindHost can be left empty to use the value from the user." ?></div>
<div class="form-group">
<label for="inputNetworkName" class="col-sm-2 control-label"><? FORMAT "Network Name:" ?></label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputNetworkName" name="name" value="<? VAR Name ?>" maxlength="20" placeholder="<? FORMAT "The name of the IRC network." ?>">
</div>
</div>
<div class="form-group">
<label for="inputNickname" class="col-sm-2 control-label"><? FORMAT "Nickname:" ?></label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputNickname" name="nick" value="<? VAR Nick ?>" maxlength="30" placeholder="<? FORMAT "Your nickname on IRC." ?>">
</div>
</div>
<div class="form-group">
<label for="inputAltNickname" class="col-sm-2 control-label"><? FORMAT "Alt. Nickname:" ?></label>
<div class="col-sm-10">
<input type="text" class="form-control" id="AltNickname" name="altnick" value="<? VAR AltNick ?>" maxlength="30" placeholder="<? FORMAT "Your secondary nickname, if the first is not available on IRC." ?>">
</div>
</div>
<div class="form-group">
<label for="inputIdent" class="col-sm-2 control-label"><? FORMAT "Ident:" ?></label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputIdent" name="ident" value="<? VAR Ident ?>" maxlength="30" placeholder="<? FORMAT "Your ident." ?>">
</div>
</div>
<div class="form-group">
<label for="inputRealname" class="col-sm-2 control-label"><? FORMAT "Realname:" ?></label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputRealname" name="realname" value="<? VAR RealName ?>" maxlength="128" placeholder="<? FORMAT "Your real name." ?>">
</div>
</div>
<? IF BindHostEdit ?>
<div class="form-group">
<label for="inputBindHost" class="col-sm-2 control-label"><? FORMAT "BindHost:" ?></label>
<div class="col-sm-10">
<? IF BindHostLoop ?>
<select class="form-control" name="bindhost">
<option value="">Default</option>
<? LOOP BindHostLoop ?>
<option value="<? VAR BindHost ?>"<? IF Checked ?> selected="selected"<? ENDIF ?>><? VAR BindHost ?></option>
<? ENDLOOP ?>
</select>
<? ELSE ?>
<input class="form-control" type="text" name="bindhost" value="<? VAR BindHost ?>"/>
<? ENDIF ?>
</div>
</div>
<? ENDIF ?>
<div class="form-group">
<label for="inputQuit" class="col-sm-2 control-label"><? FORMAT "Quit Message:" ?></label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputQuit" name="quitmsg" value="<? VAR QuitMsg ?>" maxlength="256" placeholder="<? FORMAT "You may define a Message shown, when you quit IRC." ?>">
</div>
</div>
<div class="form-group">
<label for="inputActive" class="col-sm-2 control-label"><? FORMAT "Active:" ?></label>
<div class="col-sm-10">
<div class="switch">
<input type="checkbox" value="1" name="doconnect" class="cmn-toggle cmn-toggle-round-flat" id="doconnect_checkbox"<? IF IRCConnectEnabled ?> checked="checked"<? ENDIF ?> />
<label for="doconnect_checkbox"></label>
<span class="help-block"><? FORMAT "Connect to IRC &amp; automatically re-connect" ?></span>
</div>
</div>
</div>
<div class="form-group">
<label for="inputTrustAll" class="col-sm-2 control-label"><? FORMAT "Trust all certs:" ?></label>
<div class="col-sm-10">
<div class="switch">
<input type="checkbox" value="1" name="trustallcerts" class="cmn-toggle cmn-toggle-round-flat" id="trustallcerts_checkbox"<? IF TrustAllCerts ?> checked="checked"<? ENDIF ?> />
<label for="trustallcerts_checkbox"></label>
<span class="help-block"><? FORMAT "Disable certificate validation (takes precedence over TrustPKI). INSECURE!" ?></span>
</div>
</div>
</div>
<div class="form-group">
<label for="inputTrustPKI" class="col-sm-2 control-label"><? FORMAT "Automatically detect trusted certificates (Trust the PKI):" ?></label>
<div class="col-sm-10">
<div class="switch">
<input type="checkbox" value="1" name="trustpki" class="cmn-toggle cmn-toggle-round-flat" id="trustpki_checkbox"<? IF TrustPKI ?> checked="checked"<? ENDIF ?> />
<label for="trustpki_checkbox"></label>
<span class="help-block"><? FORMAT "When disabled, manually whitelist all server fingerprints, even if the certificate is valid" ?></span>
</div>
</div>
</div>
<div class="form-group" id="servers_plain">
<label for="inputServers" class="col-sm-2 control-label"><? FORMAT "Servers of this IRC network:" ?></label>
<div class="col-sm-10">
<textarea class="form-control" name="servers" cols="70" rows="5" id="servers_text"><? LOOP ServerLoop ?><? VAR Server ?>
<? ENDLOOP ?></textarea>
<span class="help-block"><? FORMAT "One server per line, “host [[+]port] [password]”, + means SSL" ?></span>
<br/>
</div>
</div>
<div class="form-group" id="servers_js" style="display:none">
<label for="inputServers" class="col-sm-2 control-label"><? FORMAT "Servers of this IRC network:" ?></label>
<div class="col-sm-10">
<table class="table table-hover">
<thead>
<tr>
<th><? FORMAT "Hostname" ?></th>
<th><? FORMAT "Port" ?></th>
<th><? FORMAT "SSL" ?></th>
<th><? FORMAT "Password" ?></th>
<th/>
</tr>
</thead>
<tbody id="servers_tbody">
<tr>
</tr>
</tbody>
</table>
<button type="button" class="btn btn-default" value="Add" id="servers_add">Add New Server</button>
</div>
</div>
<script type="text/javascript">serverlist_init(jQuery);</script>
<div class="form-group">
<label for="inputTrustedSSL" class="col-sm-2 control-label"><? FORMAT "SHA-256 fingerprints of trusted SSL certificates of this IRC network:" ?></label>
<div class="col-sm-10">
<textarea class="form-control" name="fingerprints" rows="3"><? LOOP TrustedFingerprints ?><? VAR FP ?>
<? ENDLOOP ?></textarea>
<span class="help-block"><? FORMAT "When these certificates are encountered, checks for hostname, expiration date, CA are skipped" ?></span>
</div>
</div>
</div> <!-- Network Info -->
<!-- Flood Protection -->
<div class="tab-pane fade" id="floodprotab">
<div class="form-group">
<label for="floodprotection" class="col-sm-2 control-label"><? FORMAT "Flood protection:" ?></label>
<div class="col-sm-10">
<div class="switch">
<input type="checkbox" name="floodprotection" id="floodprotection_checkbox" class="cmn-toggle cmn-toggle-round-flat" onchange="floodprotection_change();" <? IF FloodProtection ?>checked="checked"<? ENDIF ?> />
<label for="floodprotection_checkbox"></label>
<span class="help-block"><? FORMAT "You might enable the flood protection. This prevents “excess flood” errors, which occur, when your IRC bot is command flooded or spammed. After changing this, reconnect ZNC to server." ?></span>
</div>
</div>
</div>
<div class="form-group">
<label for="floodprorate" class="col-sm-2 control-label"><? FORMAT "Flood protection rate:" ?></label>
<div class="col-sm-10">
<input class="form-control" type="number" name="floodrate" min="0.3" step="0.05" id="floodrate" placeholder="<? FORMAT "The number of seconds per line. After changing this, reconnect ZNC to server." ?>" <? IF FloodProtection ?> value="<? VAR FloodRate ?>" <? ELSE ?> value="1.00" disabled="disabled" <? ENDIF ?> />
<? FORMAT "{1} seconds per line" "FloodInputField_Rate ESC=" ?>
<span class="help-block"><? FORMAT "The number of seconds per line. After changing this, reconnect ZNC to server." ?></span>
</div>
</div>
<div class="form-group">
<label for="floodproburst" class="col-sm-2 control-label"><? FORMAT "Flood protection burst:" ?></label>
<div class="col-sm-10">
<input type="number" class="form-control" name="floodburst" min="1" id="floodburst" <? IF FloodProtection ?> value="<? VAR FloodBurst ?>" <? ELSE ?> value="4" disabled="disabled" <? ENDIF ?> />
<? FORMAT "{1} lines can be sent immediately" "FloodInputField_Burst ESC=" ?>
<span class="help-block"><? FORMAT "Defines the number of lines, which can be sent immediately. After changing this, reconnect ZNC to server." ?></span>
</div>
</div>
<div class="form-group">
<label for="joindelay" class="col-sm-2 control-label"><? FORMAT "Channel join delay:" ?></label>
<div class="col-sm-10">
<input type="number" class="form-control" name="joindelay" min="0" id="joindelay" value="<? VAR JoinDelay ?>" />
<? FORMAT "{1} seconds" "ChannelJoinDelayInputField ESC=" ?>
<span class="help-block"><? FORMAT "Defines the delay in seconds, until channels are joined after getting connected." ?></span>
</div>
</div>
<script type="text/javascript">floodprotection_change();</script>
</div> <!-- Flood Protection -->
<!-- Server Encoding -->
<div class="tab-pane fade" id="charencodetab">
<div class="form-group">
<label for="inputChanencode" class="col-sm-2 control-label"><? FORMAT "Server encoding:" ?></label>
<div class="col-sm-10">
<? INC encoding_settings.tmpl ?>
<span class="help-block"><? FORMAT "Character encoding used between ZNC and IRC server." ?></span>
</div>
</div>
</div> <!-- Server Encoding -->
<!-- Channels -->
<div class="tab-pane fade" id="channelstab">
<? IF !Edit ?>
<span class="info"><? FORMAT "You will be able to add + modify channels here after you created the network." ?></span><br />
<? ELSE ?>
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<td><a href="<? VAR ModPath TOP ?>addchan?user=<? VAR Username ESC=URL ?>&amp;network=<? VAR Name ESC=URL ?>" class="btn btn-primary btn-xs"><? FORMAT "Add" ?></a></td>
<? IF ChannelLoop ?>
<th><? FORMAT "Save" ?></th>
<th><? FORMAT "Name" ?></th>
<th><? FORMAT "CurModes" ?></th>
<th><? FORMAT "DefModes" ?></th>
<th><? FORMAT "BufferSize" ?></th>
<th><? FORMAT "Options" ?></th>
<? ELSE ?>
<td><? FORMAT "← Add a channel (opens in same page)" ?></td>
<? ENDIF ?>
</tr>
</thead>
<tbody>
<? LOOP ChannelLoop SORTASC=Name ?>
<tr>
<td>
<input type="hidden" name="channel" value="<? VAR Name ?>" />
<a href="<? VAR ModPath TOP ?>editchan?user=<? VAR Username ESC=URL ?>&amp;network=<? VAR Network ESC=URL ?>&amp;name=<? VAR Name ESC=URL ?>" class="btn btn-warning btn-xs"><? FORMAT "Edit" ?></a>
<a href="<? VAR ModPath TOP ?>delchan?user=<? VAR Username ESC=URL ?>&amp;network=<? VAR Network ESC=URL ?>&amp;name=<? VAR Name ESC=URL ?>" class="btn btn-danger btn-xs"><? FORMAT "Del" ?></a>
</td>
<td class="text-center">
<div class="switch">
<input type="checkbox" name="save_<? VAR Name ?>" class="cmn-toggle cmn-toggle-round-flat"<? IF InConfig ?> checked="checked"<? ENDIF ?> />
<label for="save_<? VAR Name ?>"></label>
</div>
</td>
<td><? VAR Name ?></td>
<td><? VAR CurModes ?></td>
<td><? VAR DefModes ?></td>
<td><? VAR BufferCount ?></td>
<td><? VAR Options ?></td>
</tr>
<? ENDLOOP ?>
</tbody>
</table>
<? ENDIF ?>
</div> <!-- Channels -->
<!-- Modules -->
<div class="tab-pane fade" id="modulestab">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th><? FORMAT "Status" ?></th>
<th><? FORMAT "Name" ?></th>
<th><? FORMAT "Arguments" ?></th>
<th><? FORMAT "Description" ?></th>
<th><? FORMAT "Loaded globally" ?></th>
<th><? FORMAT "Loaded by user" ?></th>
</tr>
</thead>
<tbody>
<? LOOP ModuleLoop ?>
<tr>
<td>
<div class="switch">
<input type="checkbox" name="loadmod" id="lm_<? VAR Name ?>" class="cmn-toggle cmn-toggle-round-flat" value="<? VAR Name ?>"<? IF Checked ?> checked="checked"<? ENDIF ?><? IF Disabled ?> disabled="disabled"<? ENDIF ?> />
<label for="lm_<? VAR Name ?>"></label>
</div>
</td>
<td>
<label for="lm_<? VAR Name ?>"> <? IF Wiki ?><a href="http://wiki.znc.in/<? VAR Wiki ?>" target="_blank"><? VAR Name ?></a> <? ELSE ?> <? VAR Name ?> <? ENDIF ?></label>
</td>
<td>
<? IF Disabled ?>
<? VAR Args ?>
<? ELSE ?>
<input class="form-control" class="third" type="text" name="modargs_<? VAR Name ?>" value="<? VAR Args ?>"
<? IF !HasArgs ?> disabled="disabled"<? ENDIF ?>
<? IF ArgsHelpText ?> data-toggle="tooltip" data-placement="top" data-original-title="<? VAR ArgsHelpText ?>"<? ENDIF ?> autocomplete="off"/>
<? ENDIF ?>
</td>
<td><? VAR Description ?></td>
<td>
<? IF CanBeLoadedGlobally ?>
<div class="checkboxSwitchMini">
<input type="checkbox" name="loaded_globally" id="loaded_globally_<? VAR Name ?>" value="<? VAR Name ?>"<? IF LoadedGloabally?> checked="checked" <? ENDIF ?> class="sr-only" disabled="disabled" /> <? ENDIF ?>
<label for="loaded_globally_<? VAR Name ?>"></label>
</div>
<? ENDIF ?>
</td>
<td>
<? IF CanBeLoadedByUser ?>
<div class="checkboxSwitchMini">
<input type="checkbox" name="loaded_by_user" id="loaded_by_user_<? VAR Name ?>" value="<? VAR Name ?>"<? IF LoadedByUser ?> checked="checked" <? ENDIF ?> class="sr-only" disabled="disabled" /> <? ENDIF ?>
<label for="loaded_by_user_<? VAR Name ?>"></label>
</div>
<? ENDIF ?>
</td>
</tr>
<? ENDLOOP ?>
</tbody>
</table>
</div> <!-- Modules -->
<!-- Other Modules -->
<div class="tab-pane fade" id="othermods">
<? LOOP EmbeddedModuleLoop ?>
<? IF Embed ?>
<h3><? FORMAT "Module {1}" ModName ?></h3>
<? INC *Embed ?>
<? ENDIF ?>
<? ENDLOOP ?>
</div> <!-- Other Modules -->
</div>
</div>
<div class="panel-footer text-right">
<input class="btn btn-danger" type="reset" value="Reset">
<input class="btn btn-success" type="submit" name="submit_return" value="<? IF Edit ?><? FORMAT "Save and return" ?><? ELSE ?><? FORMAT "Add Network and return" ?><? ENDIF ?>" />
<input class="btn btn-default" type="submit" name="submit_continue" value="<? IF Edit ?><? FORMAT "Save and continue" ?><? ELSE ?><? FORMAT "Add Network and continue" ?><? ENDIF ?>" />
</div>
</div>
</div>
</form>
<? INC Footer.tmpl ?>