Changeset:
b6e5421acc75
https://sourceforge.net/p/mrbs/hg-code/ci/b6e5421acc75bd49078a0da7d89caa48cc887d8d
Author:
Campbell Morrison <[email protected]>
Date:
Tue Apr 11 18:21:59 2017 +0100
Log message:
Added the ability to add and remove period names in an area.
diffstat:
web/areadefaults.inc.php | 27 +++++++++++++++++++++++++++
web/css/mrbs-ielte8.css | 7 ++++++-
web/css/mrbs.css.php | 19 +++++++++++++++++++
web/edit_area_room.php | 11 +++++++++--
web/js/edit_area_room.js.php | 15 +++++++++++++++
web/lang/lang.en | 1 +
web/systemdefaults.inc.php | 22 ----------------------
7 files changed, 77 insertions(+), 25 deletions(-)
diffs (188 lines):
diff -r accc8367b2cd -r b6e5421acc75 web/areadefaults.inc.php
--- a/web/areadefaults.inc.php Tue Apr 11 16:02:59 2017 +0100
+++ b/web/areadefaults.inc.php Tue Apr 11 18:21:59 2017 +0100
@@ -97,6 +97,33 @@
// and resolution = 1800.
+// PERIODS SETTINGS
+// ----------------
+
+// The "Periods" settings are used only in areas where the mode has
+// been set to "Periods".
+
+// Define the name or description for your periods in chronological order
+// For example:
+// $periods[] = "Period 1"
+// $periods[] = "Period 2"
+// ...
+// or
+// $periods[] = "09:15 - 09:50"
+// $periods[] = "09:55 - 10:35"
+// ...
+
+// Period names are encoded in UTF-8
+
+// NOTE: The maximum number of periods is 60. Do not define more than this.
+unset($periods); // Include this line when copying to config.inc.php
+$periods[] = "Period 1";
+$periods[] = "Period 2";
+// NOTE: The maximum number of periods is 60. Do not define more than this.
+
+// NOTE: See INSTALL for information on how to add or remove periods in an
+// existing database.
+
/******************
* Booking policies
diff -r accc8367b2cd -r b6e5421acc75 web/css/mrbs-ielte8.css
--- a/web/css/mrbs-ielte8.css Tue Apr 11 16:02:59 2017 +0100
+++ b/web/css/mrbs-ielte8.css Tue Apr 11 18:21:59 2017 +0100
@@ -38,7 +38,7 @@
color: green;
}
-.notice::after {
+.notice:after {
content: '!';
font-weight: bold;
color: #ff5722;
@@ -49,6 +49,11 @@
color: red;
}
+.delete_period:after {
+ content: '\002718'; /* cross */
+ color: red;
+}
+
/* ------------ PRIVATE BOOKINGS ---------------------------*/
diff -r accc8367b2cd -r b6e5421acc75 web/css/mrbs.css.php
--- a/web/css/mrbs.css.php Tue Apr 11 16:02:59 2017 +0100
+++ b/web/css/mrbs.css.php Tue Apr 11 18:21:59 2017 +0100
@@ -676,6 +676,25 @@
.edit_area_room .form_general textarea {height: 6em; width: 25em}
.edit_area_room div#custom_html {margin-top: 8px}
+.delete_period, #period_settings button {
+ display: none;
+}
+
+.js .delete_period {
+ display: inline-block;
+ margin-left: 1em;
+}
+
+.delete_period::after {
+ content: '\002718'; <?php // cross ?>
+ color: red;
+}
+
+.js #period_settings button {
+ display: inline-block;
+ margin-left: 1em;
+}
+
/* ------------ FORM_GENERAL ------------------------*/
/* */
diff -r accc8367b2cd -r b6e5421acc75 web/edit_area_room.php
--- a/web/edit_area_room.php Tue Apr 11 16:02:59 2017 +0100
+++ b/web/edit_area_room.php Tue Apr 11 18:21:59 2017 +0100
@@ -466,11 +466,18 @@
foreach ($periods as $period)
{
- echo "<div>\n";
+ echo "<div class=\"period_name\">\n";
echo "<label class=\"no_suffix\"></label>";
- echo "<input name=\"area_periods[]\" value=\"" . htmlspecialchars($period)
. "\">\n";
+ echo "<input name=\"area_periods[]\" required value=\"" .
htmlspecialchars($period) . "\">";
+ echo "<span class=\"delete_period\"><span>\n";
echo "</div>\n";
}
+
+ echo "<div>\n";
+ echo "<label class=\"no_suffix\"></label>";
+ echo "<button type=\"button\" id=\"add_period\">" . get_vocab("add_period")
. "</button>\n";
+ echo "</div>\n";
+
}
diff -r accc8367b2cd -r b6e5421acc75 web/js/edit_area_room.js.php
--- a/web/js/edit_area_room.js.php Tue Apr 11 16:02:59 2017 +0100
+++ b/web/js/edit_area_room.js.php Tue Apr 11 18:21:59 2017 +0100
@@ -242,6 +242,21 @@
});
toggleMode(0);
+ <?php
+ // When the Add Period button is clicked, duplicate the last period
+ // name input field, clearing its contents.
+ ?>
+ $('#add_period').click(function() {
+ var lastPeriodName = $('#period_settings .period_name').last(),
+ clone = lastPeriodName.clone(true); <?php // duplicate data and
events ?>
+
+ clone.find('input').val('');
+ clone.insertAfter(lastPeriodName);
+ });
+
+ $('.delete_period').click(function() {
+ $(this).parent().remove();
+ });
<?php
// Where we've got enabling checkboxes, apply a change event to them so that
diff -r accc8367b2cd -r b6e5421acc75 web/lang/lang.en
--- a/web/lang/lang.en Tue Apr 11 16:02:59 2017 +0100
+++ b/web/lang/lang.en Tue Apr 11 18:21:59 2017 +0100
@@ -381,6 +381,7 @@
$vocab["general_settings"] = "General";
$vocab["time_settings"] = "Slot times";
$vocab["period_settings"] = "Period names";
+$vocab["add_period"] = "Add period";
$vocab["confirmation_settings"] = "Confirmation settings";
$vocab["allow_confirmation"] = "Allow tentative bookings";
$vocab["default_settings_conf"] = "Default setting";
diff -r accc8367b2cd -r b6e5421acc75 web/systemdefaults.inc.php
--- a/web/systemdefaults.inc.php Tue Apr 11 16:02:59 2017 +0100
+++ b/web/systemdefaults.inc.php Tue Apr 11 18:21:59 2017 +0100
@@ -197,34 +197,12 @@
// appear in the areadefaults.inc.php file.
-
// PERIODS SETTINGS
// ----------------
// The "Periods" settings are used only in areas where the mode has
// been set to "Periods".
-// Define the name or description for your periods in chronological order
-// For example:
-// $periods[] = "Period 1"
-// $periods[] = "Period 2"
-// ...
-// or
-// $periods[] = "09:15 - 09:50"
-// $periods[] = "09:55 - 10:35"
-// ...
-
-// Period names are encoded in UTF-8
-
-// NOTE: The maximum number of periods is 60. Do not define more than this.
-unset($periods); // Include this line when copying to config.inc.php
-$periods[] = "Period 1";
-$periods[] = "Period 2";
-// NOTE: The maximum number of periods is 60. Do not define more than this.
-
-// NOTE: See INSTALL for information on how to add or remove periods in an
-// existing database.
-
/******************
* Booking policies
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits