Fix checkbox toggling, add nav tabs, fix broken domain quota when adding a new domain

This commit is contained in:
andryyy 2017-04-27 08:44:21 +02:00
parent 5586bd2bb5
commit e26304f6d0
5 changed files with 120 additions and 97 deletions

View File

@ -18,15 +18,17 @@ table.footable>tbody>tr.footable-empty>td {
padding: 10px; padding: 10px;
} }
.mass-each-action { .mass-each-action {
font-style: italic;
padding: 0 3px 0 3px; padding: 0 3px 0 3px;
user-select: none; user-select: none;
} }
.mass-actions { .mass-actions {
user-select: none; user-select: none;
padding:10px; margin-top:-5px;
} }
.mass-select-all { .mass-select-all {
cursor:pointer; cursor:pointer;
color:grey; color:grey;
} }
#alias_table {
cursor:pointer;
}

View File

@ -2,7 +2,7 @@ $(document).ready(function() {
// add.php // add.php
// Get max. possible quota for a domain when domain field changes // Get max. possible quota for a domain when domain field changes
$('#addSelectDomain').on('change', function() { $('#addSelectDomain').on('change', function() {
$.get("/api/v1/domain/" + this.value, function(data){ $.get("/api/v1/get/domain/" + this.value, function(data){
var result = jQuery.parseJSON( data ); var result = jQuery.parseJSON( data );
max_new_mailbox_quota = ( result.max_new_mailbox_quota / 1048576); max_new_mailbox_quota = ( result.max_new_mailbox_quota / 1048576);
if (max_new_mailbox_quota != '0') { if (max_new_mailbox_quota != '0') {

File diff suppressed because one or more lines are too long

View File

@ -329,9 +329,14 @@ $(document).ready(function() {
}); });
} }
}); });
$("tr").on('click',function(event) { $("tr").on('click',function(e) {
var checkbox = $(this).find(':checkbox'); if (e.target.type == "checkbox") {
checkbox.trigger('click'); e.stopPropagation();
} else {
var $checkbox = $(this).find(':checkbox');
var checkbox = $(this).find(':checkbox');
checkbox.trigger('click');
}
}); });
}); });
} }

View File

@ -6,102 +6,119 @@ require_once "inc/header.inc.php";
$_SESSION['return_to'] = $_SERVER['REQUEST_URI']; $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
?> ?>
<div class="container"> <div class="container">
<div class="row">
<div class="col-md-12"> <ul class="nav nav-tabs" role="tablist">
<div class="panel panel-default"> <li role="presentation" class="active"><a href="#tab-domains" aria-controls="tab-domains" role="tab" data-toggle="tab"><?=$lang['mailbox']['domains'];?></a></li>
<div class="panel-heading"> <li role="presentation"><a href="#tab-mailboxes" aria-controls="tab-mailboxes" role="tab" data-toggle="tab"><?=$lang['mailbox']['mailboxes'];?></a></li>
<div class="pull-right"> <li role="presentation"><a href="#tab-resources" aria-controls="tab-resources" role="tab" data-toggle="tab"><?=$lang['mailbox']['resources'];?></a></li>
<?php <li class="dropdown">
if ($_SESSION['mailcow_cc_role'] == "admin"): <a class="dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['aliases'];?>
?> <span class="caret"></span></a>
<a href="/add.php?domain"><span class="glyphicon glyphicon-plus"></span></a> <ul class="dropdown-menu">
<?php <li role="presentation"><a href="#tab-mbox-aliases" aria-controls="tab-mbox-aliases" role="tab" data-toggle="tab"><?=$lang['mailbox']['aliases'];?></a></li>
endif; <li role="presentation"><a href="#tab-domain-aliases" aria-controls="tab-domain-aliases" role="tab" data-toggle="tab"><?=$lang['mailbox']['domain_aliases'];?></a></li>
?> </ul>
</div> </li>
<h3 class="panel-title"><?=$lang['mailbox']['domains'];?></h3> </ul>
</div>
<div class="table-responsive">
<table id="domain_table" class="table table-striped"></table>
</div>
<span class="footer-add-item"><a href="/add.php?domain"><?=$lang['mailbox']['add_domain'];?></a></span>
</div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="panel panel-default"> <div class="tab-content" style="padding-top:20px">
<div class="panel-heading"> <div role="tabpanel" class="tab-pane active" id="tab-domains">
<div class="pull-right"> <div class="panel panel-default">
<a href="/add.php?mailbox"><span class="glyphicon glyphicon-plus"></span></a> <div class="panel-heading">
</div> <div class="pull-right">
<h3 class="panel-title"><?=$lang['mailbox']['mailboxes'];?></h3> <?php
</div> if ($_SESSION['mailcow_cc_role'] == "admin"):
<div class="table-responsive"> ?>
<table id="mailbox_table" class="table table-striped"></table> <a href="/add.php?domain"><span class="glyphicon glyphicon-plus"></span></a>
</div> <?php
<span class="footer-add-item"><a href="/add.php?mailbox"><?=$lang['mailbox']['add_mailbox'];?></a></span> endif;
</div> ?>
</div> </div>
</div> <h3 class="panel-title"><?=$lang['mailbox']['domains'];?></h3>
</div>
<div class="row"> <div class="table-responsive">
<div class="col-md-12"> <table id="domain_table" class="table table-striped"></table>
<div class="panel panel-default"> </div>
<div class="panel-heading"> <span class="footer-add-item"><a href="/add.php?domain"><?=$lang['mailbox']['add_domain'];?></a></span>
<div class="pull-right">
<a href="/add.php?resource"><span class="glyphicon glyphicon-plus"></span></a>
</div>
<h3 class="panel-title"><?=$lang['mailbox']['resources'];?></h3>
</div>
<div class="table-responsive">
<table id="resources_table" class="table table-striped"></table>
</div>
<span class="footer-add-item"><a href="/add.php?resource"><?=$lang['mailbox']['add_resource'];?></a></span> </div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right">
<a href="/add.php?aliasdomain"><span class="glyphicon glyphicon-plus"></span></a>
</div>
<h3 class="panel-title"><?=$lang['mailbox']['domain_aliases'];?></h3>
</div>
<div class="table-responsive">
<table id="aliasdomain_table" class="table table-striped"></table>
</div>
<span class="footer-add-item"><a href="/add.php?aliasdomain"><?=$lang['mailbox']['add_domain_alias'];?></a></span> </div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right">
<a href="/add.php?alias"><span class="glyphicon glyphicon-plus"></span></a>
</div>
<h3 class="panel-title"><?=$lang['mailbox']['aliases'];?></h3>
</div>
<div class="table-responsive">
<table id="alias_table" class="table table-striped"></table>
<div class="mass-actions">
<span id="select_all_aliases" class="mass-select-all">Toggle all</span>
<br /><span>(
<a id="delete_selected_alias" href="#" class="mass-each-action">delete</a> |
<a id="activate_selected_alias" href="#" class="mass-each-action">activate</a> |
<a id="deactivate_selected_alias" href="#" class="mass-each-action">deactivate</a>)
</span>
</div> </div>
</div> </div>
<span class="footer-add-item"><a href="/add.php?alias"><?=$lang['mailbox']['add_alias'];?></a></span> </div>
</div> <div role="tabpanel" class="tab-pane" id="tab-mailboxes">
</div> <div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right">
<a href="/add.php?mailbox"><span class="glyphicon glyphicon-plus"></span></a>
</div>
<h3 class="panel-title"><?=$lang['mailbox']['mailboxes'];?></h3>
</div>
<div class="table-responsive">
<table id="mailbox_table" class="table table-striped"></table>
</div>
<span class="footer-add-item"><a href="/add.php?mailbox"><?=$lang['mailbox']['add_mailbox'];?></a></span>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="tab-resources">
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right">
<a href="/add.php?resource"><span class="glyphicon glyphicon-plus"></span></a>
</div>
<h3 class="panel-title"><?=$lang['mailbox']['resources'];?></h3>
</div>
<div class="table-responsive">
<table id="resources_table" class="table table-striped"></table>
</div>
<span class="footer-add-item"><a href="/add.php?resource"><?=$lang['mailbox']['add_resource'];?></a></span>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="tab-domain-aliases">
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right">
<a href="/add.php?aliasdomain"><span class="glyphicon glyphicon-plus"></span></a>
</div>
<h3 class="panel-title"><?=$lang['mailbox']['domain_aliases'];?></h3>
</div>
<div class="table-responsive">
<table id="aliasdomain_table" class="table table-striped"></table>
</div>
<span class="footer-add-item"><a href="/add.php?aliasdomain"><?=$lang['mailbox']['add_domain_alias'];?></a></span>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="tab-mbox-aliases">
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right">
<a href="/add.php?alias"><span class="glyphicon glyphicon-plus"></span></a>
</div>
<h3 class="panel-title"><?=$lang['mailbox']['aliases'];?></h3>
</div>
<div class="table-responsive">
<table id="alias_table" class="table table-striped"></table>
</div>
<span class="footer-add-item"><a href="/add.php?alias"><?=$lang['mailbox']['add_alias'];?></a></span>
</div>
<hr>
<div class="mass-actions">
<span id="select_all_aliases" class="mass-select-all">Toggle all</span>
<span>&ndash; Quick actions:
<a id="delete_selected_alias" href="#" class="mass-each-action">delete</a> |
<a id="activate_selected_alias" href="#" class="mass-each-action">activate</a> |
<a id="deactivate_selected_alias" href="#" class="mass-each-action">deactivate</a>
</span>
</div>
</div>
</div> <!-- /tab-content -->
</div> <!-- /col-md-12 -->
</div> <!-- /row -->
</div> <!-- /container --> </div> <!-- /container -->
<script type='text/javascript'> <script type='text/javascript'>
<?php <?php
$lang_mailbox = json_encode($lang['mailbox']); $lang_mailbox = json_encode($lang['mailbox']);