-
-
+
+
+
+
+
+
+
diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php
index 18db3fa9..a37f5e78 100644
--- a/data/web/inc/functions.mailbox.inc.php
+++ b/data/web/inc/functions.mailbox.inc.php
@@ -945,8 +945,8 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
$local_part = preg_replace('/[^\da-z]/i', '', preg_quote($description, '/'));
$name = $local_part . '@' . $domain;
$kind = $_data['kind'];
+ $multiple_bookings = intval($_data['multiple_bookings']);
$active = intval($_data['active']);
- $multiple_bookings = intval($_data['multiple_bookings']);
if (!filter_var($name, FILTER_VALIDATE_EMAIL)) {
$_SESSION['return'] = array(
'type' => 'danger',
@@ -961,7 +961,9 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
);
return false;
}
-
+ if (!isset($multiple_bookings) || $multiple_bookings < -1) {
+ $multiple_bookings = -1;
+ }
if ($kind != 'location' && $kind != 'group' && $kind != 'thing') {
$_SESSION['return'] = array(
'type' => 'danger',
@@ -2184,7 +2186,7 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
$is_now = mailbox('get', 'resource_details', $name);
if (!empty($is_now)) {
$active = (isset($_data['active'])) ? intval($_data['active']) : $is_now['active_int'];
- $multiple_bookings = (isset($_data['multiple_bookings'])) ? intval($_data['multiple_bookings']) : $is_now['multiple_bookings_int'];
+ $multiple_bookings = (isset($_data['multiple_bookings'])) ? intval($_data['multiple_bookings']) : $is_now['multiple_bookings'];
$description = (!empty($_data['description'])) ? $_data['description'] : $is_now['description'];
$kind = (!empty($_data['kind'])) ? $_data['kind'] : $is_now['kind'];
}
@@ -2202,6 +2204,9 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
);
return false;
}
+ if (!isset($multiple_bookings) || $multiple_bookings < -1) {
+ $multiple_bookings = -1;
+ }
if (empty($description)) {
$_SESSION['return'] = array(
'type' => 'danger',
@@ -3133,10 +3138,9 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
`username`,
`name`,
`kind`,
- `multiple_bookings` AS `multiple_bookings_int`,
+ `multiple_bookings`,
`local_part`,
`active` AS `active_int`,
- CASE `multiple_bookings` WHEN 1 THEN '".$lang['mailbox']['yes']."' ELSE '".$lang['mailbox']['no']."' END AS `multiple_bookings`,
CASE `active` WHEN 1 THEN '".$lang['mailbox']['yes']."' ELSE '".$lang['mailbox']['no']."' END AS `active`,
`domain`
FROM `mailbox` WHERE `kind` REGEXP 'location|thing|group' AND `username` = :resource");
@@ -3147,7 +3151,6 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
$resourcedata['name'] = $row['username'];
$resourcedata['kind'] = $row['kind'];
$resourcedata['multiple_bookings'] = $row['multiple_bookings'];
- $resourcedata['multiple_bookings_int'] = $row['multiple_bookings_int'];
$resourcedata['description'] = $row['name'];
$resourcedata['active'] = $row['active'];
$resourcedata['active_int'] = $row['active_int'];
diff --git a/data/web/inc/init_db.inc.php b/data/web/inc/init_db.inc.php
index 8ece750c..20f12eb0 100644
--- a/data/web/inc/init_db.inc.php
+++ b/data/web/inc/init_db.inc.php
@@ -3,7 +3,7 @@ function init_db_schema() {
try {
global $pdo;
- $db_version = "06052018_1239";
+ $db_version = "06052018_1839";
$stmt = $pdo->query("SHOW TABLES LIKE 'versions'");
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
@@ -191,7 +191,7 @@ function init_db_schema() {
"domain" => "VARCHAR(255) NOT NULL",
"attributes" => "JSON",
"kind" => "VARCHAR(100) NOT NULL DEFAULT ''",
- "multiple_bookings" => "TINYINT(1) NOT NULL DEFAULT '0'",
+ "multiple_bookings" => "INT NOT NULL DEFAULT -1",
"created" => "DATETIME(0) NOT NULL DEFAULT NOW(0)",
"modified" => "DATETIME ON UPDATE CURRENT_TIMESTAMP",
"active" => "TINYINT(1) NOT NULL DEFAULT '1'"
diff --git a/data/web/js/edit.js b/data/web/js/edit.js
index fbd5deca..8cf0889c 100644
--- a/data/web/js/edit.js
+++ b/data/web/js/edit.js
@@ -12,7 +12,22 @@ $(document).ready(function() {
});
$("#script_data").numberedtextarea({allowTabChar: true});
});
-
+if ($("#multiple_bookings_select").val() == "custom") {
+ $("#multiple_bookings_custom_div").show();
+ $("#multiple_bookings").val($("#multiple_bookings_custom").val());
+}
+$("#multiple_bookings_select").change(function() {
+ $("#multiple_bookings").val($("#multiple_bookings_select").val());
+ if ($("#multiple_bookings").val() == "custom") {
+ $("#multiple_bookings_custom_div").show();
+ }
+ else {
+ $("#multiple_bookings_custom_div").hide();
+ }
+});
+$("#multiple_bookings_custom").bind("change keypress keyup blur", function() {
+ $("#multiple_bookings").val($("#multiple_bookings_custom").val());
+});
jQuery(function($){
// http://stackoverflow.com/questions/46155/validate-email-address-in-javascript
function validateEmail(email) {
diff --git a/data/web/js/mailbox.js b/data/web/js/mailbox.js
index 513f0d95..3bd75262 100644
--- a/data/web/js/mailbox.js
+++ b/data/web/js/mailbox.js
@@ -294,7 +294,7 @@ jQuery(function($){
{"sorted": true,"name":"description","title":lang.description,"style":{"width":"250px"}},
{"name":"kind","title":lang.kind},
{"name":"domain","title":lang.domain,"breakpoints":"xs sm"},
- {"name":"multiple_bookings","filterable": false,"style":{"maxWidth":"120px","width":"120px"},"title":lang.multiple_bookings,"breakpoints":"xs sm"},
+ {"name":"multiple_bookings","filterable": false,"style":{"maxWidth":"150px","width":"140px"},"title":lang.multiple_bookings,"breakpoints":"xs sm"},
{"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active},
{"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
],
@@ -308,6 +308,13 @@ jQuery(function($){
},
success: function (data) {
$.each(data, function (i, item) {
+ if (item.multiple_bookings == '0') {
+ item.multiple_bookings = '
' + lang.booking_0_short + '';
+ } else if (item.multiple_bookings == '-1') {
+ item.multiple_bookings = '
' + lang.booking_lt0_short + '';
+ } else {
+ item.multiple_bookings = '
' + lang.booking_custom_short + ' (' + item.multiple_bookings + ')';
+ }
item.action = '
' +
'
' + lang.edit + '' +
'
' + lang.remove + '' +
diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php
index 2f508e53..efa3310b 100644
--- a/data/web/lang/lang.de.php
+++ b/data/web/lang/lang.de.php
@@ -185,6 +185,12 @@ $lang['header']['mailcow_settings'] = 'Konfiguration';
$lang['header']['administration'] = 'Administration';
$lang['header']['mailboxes'] = 'Mailboxen';
$lang['header']['user_settings'] = 'Benutzereinstellungen';
+$lang['mailbox']['booking_0'] = 'Immer als verfügbar anzeigen';
+$lang['mailbox']['booking_lt0'] = 'Unbegrenzt, jedoch anzeigen, wenn gebucht';
+$lang['mailbox']['booking_custom'] = 'Benutzerdefiniertes Limit';
+$lang['mailbox']['booking_0_short'] = 'Immer verfügbar';
+$lang['mailbox']['booking_lt0_short'] = 'Weiches Limit';
+$lang['mailbox']['booking_custom_short'] = 'Hartes Limit';
$lang['mailbox']['domain'] = 'Domain';
$lang['mailbox']['spam_aliases'] = 'Temp. Alias';
$lang['mailbox']['alias'] = 'Alias';
diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php
index 6a0d7419..01fbca00 100644
--- a/data/web/lang/lang.en.php
+++ b/data/web/lang/lang.en.php
@@ -183,6 +183,12 @@ $lang['header']['mailcow_settings'] = 'Configuration';
$lang['header']['administration'] = 'Administration';
$lang['header']['mailboxes'] = 'Mailboxes';
$lang['header']['user_settings'] = 'User settings';
+$lang['mailbox']['booking_0'] = 'Always show as free';
+$lang['mailbox']['booking_lt0'] = 'Unlimited, but show as busy when booked';
+$lang['mailbox']['booking_custom'] = 'Hard-limit to a custom amount of bookings';
+$lang['mailbox']['booking_0_short'] = 'Always free';
+$lang['mailbox']['booking_lt0_short'] = 'Soft limit';
+$lang['mailbox']['booking_custom_short'] = 'Hard limit';
$lang['mailbox']['domain'] = 'Domain';
$lang['mailbox']['spam_aliases'] = 'Temp. alias';
$lang['mailbox']['multiple_bookings'] = 'Multiple bookings';
diff --git a/data/web/mailbox.php b/data/web/mailbox.php
index 73a628c4..58a569dd 100644
--- a/data/web/mailbox.php
+++ b/data/web/mailbox.php
@@ -100,6 +100,12 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
=$lang['mailbox']['add_resource'];?>
+
=$lang['mailbox']['booking_0_short'];?> - =$lang['mailbox']['booking_0'];?>
+
=$lang['mailbox']['booking_lt0_short'];?> - =$lang['mailbox']['booking_lt0'];?>
+
=$lang['mailbox']['booking_custom_short'];?> - =$lang['mailbox']['booking_custom'];?>
+