parent
f0d29ba8ef
commit
b8b6450753
|
@ -273,6 +273,12 @@ if (isset($_SESSION['mailcow_cc_role'])) {
|
||||||
<input type="number" class="form-control" name="mailboxes" value="<?=intval($result['max_num_mboxes_for_domain']);?>">
|
<input type="number" class="form-control" name="mailboxes" value="<?=intval($result['max_num_mboxes_for_domain']);?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-sm-2" for="defquota"><?=$lang['edit']['mailbox_quota_def'];?></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="number" class="form-control" name="defquota" value="<?=intval($result['def_quota_for_mbox'] / 1048576);?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-sm-2" for="maxquota"><?=$lang['edit']['max_quota'];?></label>
|
<label class="control-label col-sm-2" for="maxquota"><?=$lang['edit']['max_quota'];?></label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
|
|
@ -326,9 +326,18 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
$description = $_data['description'];
|
$description = $_data['description'];
|
||||||
$aliases = $_data['aliases'];
|
$aliases = $_data['aliases'];
|
||||||
$mailboxes = $_data['mailboxes'];
|
$mailboxes = $_data['mailboxes'];
|
||||||
|
$defquota = $_data['defquota'];
|
||||||
$maxquota = $_data['maxquota'];
|
$maxquota = $_data['maxquota'];
|
||||||
$restart_sogo = $_data['restart_sogo'];
|
$restart_sogo = $_data['restart_sogo'];
|
||||||
$quota = $_data['quota'];
|
$quota = $_data['quota'];
|
||||||
|
if ($defquota > $maxquota) {
|
||||||
|
$_SESSION['return'][] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
||||||
|
'msg' => 'mailbox_defquota_exceeds_mailbox_maxquota'
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if ($maxquota > $quota) {
|
if ($maxquota > $quota) {
|
||||||
$_SESSION['return'][] = array(
|
$_SESSION['return'][] = array(
|
||||||
'type' => 'danger',
|
'type' => 'danger',
|
||||||
|
@ -337,6 +346,14 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if ($defquota == "0" || empty($defquota)) {
|
||||||
|
$_SESSION['return'][] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
||||||
|
'msg' => 'defquota_empty'
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if ($maxquota == "0" || empty($maxquota)) {
|
if ($maxquota == "0" || empty($maxquota)) {
|
||||||
$_SESSION['return'][] = array(
|
$_SESSION['return'][] = array(
|
||||||
'type' => 'danger',
|
'type' => 'danger',
|
||||||
|
@ -392,13 +409,14 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$stmt = $pdo->prepare("INSERT INTO `domain` (`domain`, `description`, `aliases`, `mailboxes`, `maxquota`, `quota`, `backupmx`, `gal`, `active`, `relay_all_recipients`)
|
$stmt = $pdo->prepare("INSERT INTO `domain` (`domain`, `description`, `aliases`, `mailboxes`, `defquota`, `maxquota`, `quota`, `backupmx`, `gal`, `active`, `relay_all_recipients`)
|
||||||
VALUES (:domain, :description, :aliases, :mailboxes, :maxquota, :quota, :backupmx, :gal, :active, :relay_all_recipients)");
|
VALUES (:domain, :description, :aliases, :mailboxes, :defquota, :maxquota, :quota, :backupmx, :gal, :active, :relay_all_recipients)");
|
||||||
$stmt->execute(array(
|
$stmt->execute(array(
|
||||||
':domain' => $domain,
|
':domain' => $domain,
|
||||||
':description' => $description,
|
':description' => $description,
|
||||||
':aliases' => $aliases,
|
':aliases' => $aliases,
|
||||||
':mailboxes' => $mailboxes,
|
':mailboxes' => $mailboxes,
|
||||||
|
':defquota' => $defquota,
|
||||||
':maxquota' => $maxquota,
|
':maxquota' => $maxquota,
|
||||||
':quota' => $quota,
|
':quota' => $quota,
|
||||||
':backupmx' => $backupmx,
|
':backupmx' => $backupmx,
|
||||||
|
@ -1861,6 +1879,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
$relayhost = (isset($_data['relayhost'])) ? intval($_data['relayhost']) : $is_now['relayhost'];
|
$relayhost = (isset($_data['relayhost'])) ? intval($_data['relayhost']) : $is_now['relayhost'];
|
||||||
$aliases = (!empty($_data['aliases'])) ? $_data['aliases'] : $is_now['max_num_aliases_for_domain'];
|
$aliases = (!empty($_data['aliases'])) ? $_data['aliases'] : $is_now['max_num_aliases_for_domain'];
|
||||||
$mailboxes = (isset($_data['mailboxes']) && $_data['mailboxes'] != '') ? intval($_data['mailboxes']) : $is_now['max_num_mboxes_for_domain'];
|
$mailboxes = (isset($_data['mailboxes']) && $_data['mailboxes'] != '') ? intval($_data['mailboxes']) : $is_now['max_num_mboxes_for_domain'];
|
||||||
|
$defquota = (!empty($_data['defquota'])) ? $_data['defquota'] : ($is_now['def_quota_for_mbox'] / 1048576);
|
||||||
$maxquota = (!empty($_data['maxquota'])) ? $_data['maxquota'] : ($is_now['max_quota_for_mbox'] / 1048576);
|
$maxquota = (!empty($_data['maxquota'])) ? $_data['maxquota'] : ($is_now['max_quota_for_mbox'] / 1048576);
|
||||||
$quota = (!empty($_data['quota'])) ? $_data['quota'] : ($is_now['max_quota_for_domain'] / 1048576);
|
$quota = (!empty($_data['quota'])) ? $_data['quota'] : ($is_now['max_quota_for_domain'] / 1048576);
|
||||||
$description = (!empty($_data['description'])) ? $_data['description'] : $is_now['description'];
|
$description = (!empty($_data['description'])) ? $_data['description'] : $is_now['description'];
|
||||||
|
@ -1892,6 +1911,22 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
)");
|
)");
|
||||||
$stmt->execute(array(':domain' => $domain));
|
$stmt->execute(array(':domain' => $domain));
|
||||||
$AliasData = $stmt->fetch(PDO::FETCH_ASSOC);
|
$AliasData = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
if ($defquota > $maxquota) {
|
||||||
|
$_SESSION['return'][] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
||||||
|
'msg' => 'mailbox_defquota_exceeds_mailbox_maxquota'
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($defquota == "0" || empty($defquota)) {
|
||||||
|
$_SESSION['return'][] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
||||||
|
'msg' => 'defquota_empty'
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ($maxquota > $quota) {
|
if ($maxquota > $quota) {
|
||||||
$_SESSION['return'][] = array(
|
$_SESSION['return'][] = array(
|
||||||
'type' => 'danger',
|
'type' => 'danger',
|
||||||
|
@ -1946,6 +1981,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
`gal` = :gal,
|
`gal` = :gal,
|
||||||
`active` = :active,
|
`active` = :active,
|
||||||
`quota` = :quota,
|
`quota` = :quota,
|
||||||
|
`defquota` = :defquota,
|
||||||
`maxquota` = :maxquota,
|
`maxquota` = :maxquota,
|
||||||
`relayhost` = :relayhost,
|
`relayhost` = :relayhost,
|
||||||
`mailboxes` = :mailboxes,
|
`mailboxes` = :mailboxes,
|
||||||
|
@ -1958,6 +1994,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
':gal' => $gal,
|
':gal' => $gal,
|
||||||
':active' => $active,
|
':active' => $active,
|
||||||
':quota' => $quota,
|
':quota' => $quota,
|
||||||
|
':defquota' => $defquota,
|
||||||
':maxquota' => $maxquota,
|
':maxquota' => $maxquota,
|
||||||
':relayhost' => $relayhost,
|
':relayhost' => $relayhost,
|
||||||
':mailboxes' => $mailboxes,
|
':mailboxes' => $mailboxes,
|
||||||
|
@ -2907,6 +2944,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
`description`,
|
`description`,
|
||||||
`aliases`,
|
`aliases`,
|
||||||
`mailboxes`,
|
`mailboxes`,
|
||||||
|
`defquota`,
|
||||||
`maxquota`,
|
`maxquota`,
|
||||||
`quota`,
|
`quota`,
|
||||||
`relayhost`,
|
`relayhost`,
|
||||||
|
@ -2938,6 +2976,10 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
if ($domaindata['max_new_mailbox_quota'] > ($row['maxquota'] * 1048576)) {
|
if ($domaindata['max_new_mailbox_quota'] > ($row['maxquota'] * 1048576)) {
|
||||||
$domaindata['max_new_mailbox_quota'] = ($row['maxquota'] * 1048576);
|
$domaindata['max_new_mailbox_quota'] = ($row['maxquota'] * 1048576);
|
||||||
}
|
}
|
||||||
|
$domaindata['def_new_mailbox_quota'] = $domaindata['max_new_mailbox_quota'];
|
||||||
|
if ($domaindata['def_new_mailbox_quota'] > ($row['defquota'] * 1048576)) {
|
||||||
|
$domaindata['def_new_mailbox_quota'] = ($row['defquota'] * 1048576);
|
||||||
|
}
|
||||||
$domaindata['quota_used_in_domain'] = $MailboxDataDomain['in_use'];
|
$domaindata['quota_used_in_domain'] = $MailboxDataDomain['in_use'];
|
||||||
$domaindata['mboxes_in_domain'] = $MailboxDataDomain['count'];
|
$domaindata['mboxes_in_domain'] = $MailboxDataDomain['count'];
|
||||||
$domaindata['mboxes_left'] = $row['mailboxes'] - $MailboxDataDomain['count'];
|
$domaindata['mboxes_left'] = $row['mailboxes'] - $MailboxDataDomain['count'];
|
||||||
|
@ -2945,6 +2987,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
$domaindata['description'] = $row['description'];
|
$domaindata['description'] = $row['description'];
|
||||||
$domaindata['max_num_aliases_for_domain'] = $row['aliases'];
|
$domaindata['max_num_aliases_for_domain'] = $row['aliases'];
|
||||||
$domaindata['max_num_mboxes_for_domain'] = $row['mailboxes'];
|
$domaindata['max_num_mboxes_for_domain'] = $row['mailboxes'];
|
||||||
|
$domaindata['def_quota_for_mbox'] = $row['defquota'] * 1048576;
|
||||||
$domaindata['max_quota_for_mbox'] = $row['maxquota'] * 1048576;
|
$domaindata['max_quota_for_mbox'] = $row['maxquota'] * 1048576;
|
||||||
$domaindata['max_quota_for_domain'] = $row['quota'] * 1048576;
|
$domaindata['max_quota_for_domain'] = $row['quota'] * 1048576;
|
||||||
$domaindata['relayhost'] = $row['relayhost'];
|
$domaindata['relayhost'] = $row['relayhost'];
|
||||||
|
|
|
@ -189,7 +189,8 @@ function init_db_schema() {
|
||||||
"description" => "VARCHAR(255)",
|
"description" => "VARCHAR(255)",
|
||||||
"aliases" => "INT(10) NOT NULL DEFAULT '0'",
|
"aliases" => "INT(10) NOT NULL DEFAULT '0'",
|
||||||
"mailboxes" => "INT(10) NOT NULL DEFAULT '0'",
|
"mailboxes" => "INT(10) NOT NULL DEFAULT '0'",
|
||||||
"maxquota" => "BIGINT(20) NOT NULL DEFAULT '0'",
|
"defquota" => "BIGINT(20) NOT NULL DEFAULT '3072'",
|
||||||
|
"maxquota" => "BIGINT(20) NOT NULL DEFAULT '102400'",
|
||||||
"quota" => "BIGINT(20) NOT NULL DEFAULT '102400'",
|
"quota" => "BIGINT(20) NOT NULL DEFAULT '102400'",
|
||||||
"relayhost" => "VARCHAR(255) NOT NULL DEFAULT '0'",
|
"relayhost" => "VARCHAR(255) NOT NULL DEFAULT '0'",
|
||||||
"backupmx" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
"backupmx" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||||
|
|
|
@ -62,11 +62,12 @@ $(document).ready(function() {
|
||||||
auto_fill_quota = function(domain) {
|
auto_fill_quota = function(domain) {
|
||||||
$.get("/api/v1/get/domain/" + domain, function(data){
|
$.get("/api/v1/get/domain/" + domain, function(data){
|
||||||
var result = $.parseJSON(JSON.stringify(data));
|
var result = $.parseJSON(JSON.stringify(data));
|
||||||
|
def_new_mailbox_quota = ( result.def_new_mailbox_quota / 1048576);
|
||||||
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') {
|
||||||
$("#quotaBadge").html('max. ' + max_new_mailbox_quota + ' MiB');
|
$("#quotaBadge").html('max. ' + max_new_mailbox_quota + ' MiB');
|
||||||
$('#addInputQuota').attr({"disabled": false, "value": "", "type": "number", "max": max_new_mailbox_quota});
|
$('#addInputQuota').attr({"disabled": false, "value": "", "type": "number", "max": max_new_mailbox_quota});
|
||||||
$('#addInputQuota').val(max_new_mailbox_quota);
|
$('#addInputQuota').val(def_new_mailbox_quota);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("#quotaBadge").html('max. ' + max_new_mailbox_quota + ' MiB');
|
$("#quotaBadge").html('max. ' + max_new_mailbox_quota + ' MiB');
|
||||||
|
@ -239,6 +240,7 @@ jQuery(function($){
|
||||||
return Number(res[0]);
|
return Number(res[0]);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{"name":"def_quota_for_mbox","title":lang.mailbox_defquota,"breakpoints":"xs sm md","style":{"width":"125px"}},
|
||||||
{"name":"max_quota_for_mbox","title":lang.mailbox_quota,"breakpoints":"xs sm","style":{"width":"125px"}},
|
{"name":"max_quota_for_mbox","title":lang.mailbox_quota,"breakpoints":"xs sm","style":{"width":"125px"}},
|
||||||
{"name":"rl","title":"RL","breakpoints":"xs sm md lg","style":{"maxWidth":"100px","width":"100px"}},
|
{"name":"rl","title":"RL","breakpoints":"xs sm md lg","style":{"maxWidth":"100px","width":"100px"}},
|
||||||
{"name":"backupmx","filterable": false,"style":{"maxWidth":"120px","width":"120px"},"title":lang.backup_mx,"breakpoints":"xs sm md lg"},
|
{"name":"backupmx","filterable": false,"style":{"maxWidth":"120px","width":"120px"},"title":lang.backup_mx,"breakpoints":"xs sm md lg"},
|
||||||
|
@ -264,6 +266,7 @@ jQuery(function($){
|
||||||
return e;
|
return e;
|
||||||
}).join('/1');
|
}).join('/1');
|
||||||
}
|
}
|
||||||
|
item.def_quota_for_mbox = humanFileSize(item.def_quota_for_mbox);
|
||||||
item.max_quota_for_mbox = humanFileSize(item.max_quota_for_mbox);
|
item.max_quota_for_mbox = humanFileSize(item.max_quota_for_mbox);
|
||||||
item.chkbox = '<input type="checkbox" data-id="domain" name="multi_select" value="' + encodeURIComponent(item.domain_name) + '" />';
|
item.chkbox = '<input type="checkbox" data-id="domain" name="multi_select" value="' + encodeURIComponent(item.domain_name) + '" />';
|
||||||
item.action = '<div class="btn-group">';
|
item.action = '<div class="btn-group">';
|
||||||
|
|
|
@ -798,3 +798,9 @@ $lang['warning']['ip_invalid'] = 'Přeskočeno, vadná IP: %s';
|
||||||
$lang['danger']['text_empty'] = 'Text nesmí být prázdný';
|
$lang['danger']['text_empty'] = 'Text nesmí být prázdný';
|
||||||
$lang['danger']['subject_empty'] = 'Předmět nesmí být prázdný';
|
$lang['danger']['subject_empty'] = 'Předmět nesmí být prázdný';
|
||||||
$lang['danger']['from_invalid'] = 'Odesílat nesmí být prázdný';
|
$lang['danger']['from_invalid'] = 'Odesílat nesmí být prázdný';
|
||||||
|
|
||||||
|
$lang['add']['mailbox_quota_def'] = 'Výchozí kvóta schránky';
|
||||||
|
$lang['edit']['mailbox_quota_def'] = 'Výchozí kvóta schránky';
|
||||||
|
$lang['danger']['mailbox_defquota_exceeds_mailbox_maxquota'] = 'Výchozí kvóta překračuje maximální kvótu schránky"';
|
||||||
|
$lang['danger']['defquota_empty'] = 'Výchozí kvóta schránky nesmí být 0.';
|
||||||
|
$lang['mailbox']['mailbox_defquota'] = 'Výchozí velikost schránky';
|
|
@ -859,3 +859,9 @@ $lang['danger']['text_empty'] = 'Text must not be empty';
|
||||||
$lang['danger']['subject_empty'] = 'Subject must not be empty';
|
$lang['danger']['subject_empty'] = 'Subject must not be empty';
|
||||||
$lang['danger']['from_invalid'] = 'Sender must not be empty';
|
$lang['danger']['from_invalid'] = 'Sender must not be empty';
|
||||||
$lang['danger']['network_host_invalid'] = 'Invalid network or host: %s';
|
$lang['danger']['network_host_invalid'] = 'Invalid network or host: %s';
|
||||||
|
|
||||||
|
$lang['add']['mailbox_quota_def'] = 'Default mailbox quota';
|
||||||
|
$lang['edit']['mailbox_quota_def'] = 'Default mailbox quota';
|
||||||
|
$lang['danger']['mailbox_defquota_exceeds_mailbox_maxquota'] = 'Default quota exceeds max quota limit"';
|
||||||
|
$lang['danger']['defquota_empty'] = 'Default quota per mailbox must not be 0.';
|
||||||
|
$lang['mailbox']['mailbox_defquota'] = 'Default mailbox size';
|
||||||
|
|
|
@ -110,10 +110,16 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
|
||||||
<input type="number" class="form-control" name="mailboxes" value="10" required>
|
<input type="number" class="form-control" name="mailboxes" value="10" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-sm-2" for="defquota"><?=$lang['add']['mailbox_quota_def'];?></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="number" class="form-control" name="defquota" value="3072" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-sm-2" for="maxquota"><?=$lang['add']['mailbox_quota_m'];?></label>
|
<label class="control-label col-sm-2" for="maxquota"><?=$lang['add']['mailbox_quota_m'];?></label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<input type="number" class="form-control" name="maxquota" value="3072" required>
|
<input type="number" class="form-control" name="maxquota" value="10240" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
Loading…
Reference in New Issue