From: Roland Hieber Date: Sat, 21 Feb 2009 22:46:33 +0000 (+0100) Subject: dos2unix on all files X-Git-Tag: REL_9.02.25~5 X-Git-Url: https://git.rohieb.name/iserv-mod-room-reservation.git/commitdiff_plain/e72f55ac765a05586d565c67f79dce57d9c1ad76?room=%22.qu%28stripslashes%28%24room%29%29.%22;start=%24nFirstWeek dos2unix on all files --- diff --git a/Makefile b/Makefile index b847b0d..6026304 100644 --- a/Makefile +++ b/Makefile @@ -1,129 +1,129 @@ -# @file Makefile -# Makefile for installing, creating documentation etc. -# @author: Roland Hieber (roland.hieber@wilhelm-gym.net) -# @date: 12.11.2007 -# -# Copyright © 2007 Roland Hieber -# -# Permission is hereby granted, free of charge, to any person obtaining -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# - -DESTDIR?= -LN=ln -f -RM=rm -rf -MKDIR=mkdir -p - -# hardlink the files to their destinations -links: sourcedoc - # documentation - $(MKDIR) $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/source/ - if [ ! -d $(DESTDIR)/usr/share/doc/iserv/mod/ ]; then $(MKDIR) $(DESTDIR)/usr/share/doc/iserv/mod/; fi - $(LN) doc/{TODO,changelog.old.html} $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/ - $(LN) doc/source/* $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/source/ - $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation - $(LN) -s ../../iserv-mod-room-reservation $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation - - # images - if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/16/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/16/; fi - $(LN) img/16/*.png $(DESTDIR)/usr/share/iserv/www/img/default/16/ - if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/24/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/24/; fi - $(LN) img/24/*.png $(DESTDIR)/usr/share/iserv/www/img/default/24/ - if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/32/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/32/; fi - $(LN) img/32/*.png $(DESTDIR)/usr/share/iserv/www/img/default/32/ - - # includes - $(MKDIR) $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation - $(LN) inc/*.inc $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/ - if [ ! -e $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc ] ; then touch $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc; fi -ifeq ($(USER),root) - chmod u+rw $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc - chown www-data $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc -endif - - # i18n - if [ ! -d $(DESTDIR)/usr/share/iserv/locale/de/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/locale/de/; fi - $(LN) lang/*.po $(DESTDIR)/usr/share/iserv/locale/de/ - - # navigation - if [ ! -d $(DESTDIR)/usr/share/iserv/www/nav/admin ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/nav/admin; fi - $(LN) nav/*.mod $(DESTDIR)/usr/share/iserv/www/nav/ - $(LN) nav/admin/*.mod $(DESTDIR)/usr/share/iserv/www/nav/admin/ - - # privileges - if [ ! -d $(DESTDIR)/usr/share/iserv/priv/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/priv/; fi - $(LN) priv/* $(DESTDIR)/usr/share/iserv/priv/ - - # SQL tables - if [ ! -d $(DESTDIR)/usr/share/iserv/db/log_module ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/db/log_module; fi - $(LN) sql/*.sql $(DESTDIR)/usr/share/iserv/db/ - $(LN) sql/log_module/* $(DESTDIR)/usr/share/iserv/db/log_module - - # web pages - $(MKDIR) $(DESTDIR)/usr/share/iserv/www/mod_room-reservation - $(LN) src/{config,index}.php $(DESTDIR)/usr/share/iserv/www/mod_room-reservation/ - - # additional files - $(MKDIR) $(DESTDIR)/usr/share/iserv/modules/room-reservation - $(LN) maint/update-iserv1-iserv2.pl $(DESTDIR)/usr/share/iserv/modules/room-reservation - chmod +x $(DESTDIR)/usr/share/iserv/modules/room-reservation/update-iserv1-iserv2.pl - -# build doxygen documentation from source -sourcedoc: - doxygen - mv doc/source/html/* doc/source/ && rm -rf doc/source/html - -# install everything -install: links -ifeq ($(USER),root) - chkdb -r - chkpriv - chklocale -endif - -# uninstalling -uninstall: - $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation - $(RM) $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation - $(RM) $(DESTDIR)/usr/share/iserv/locale/de/mod_room-reservation.po - $(RM) $(DESTDIR)/usr/share/iserv/db/mod_room-reservation.sql - $(RM) $(DESTDIR)/usr/share/iserv/db/log_module/mod_room-reservation - $(RM) $(DESTDIR)/usr/share/iserv/www/nav/79mod_room-reservation.mod - $(RM) $(DESTDIR)/usr/share/iserv/priv/mod_room-reservation - $(RM) $(DESTDIR)/usr/share/iserv/www/nav/admin/99mod_room-reservation.mod - $(RM) $(DESTDIR)/usr/share/iserv/www/img/default/{16,24,32}/mod_room-reservation_{timeslice,index,config}.png - $(RM) $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation - $(RM) $(DESTDIR)/usr/share/iserv/www/mod_room-reservation - $(RM) $(DESTDIR)/usr/share/iserv/modules/room-reservation - - psql -c "DELETE FROM log_module WHERE module='Room Reservation Schedule';" - chklocale - - @echo - @echo If you do not need the SQL tables anymore, remove them by running - @echo ' psql -c "DROP TABLE mod_roomreservation_bookings;"' - @echo After that, all bookings are unrecoverably deleted! - @echo - -# clean up -clean: distclean - -distclean: - $(RM) doc/source - -.PHONY: clean distclean install +# @file Makefile +# Makefile for installing, creating documentation etc. +# @author: Roland Hieber (roland.hieber@wilhelm-gym.net) +# @date: 12.11.2007 +# +# Copyright © 2007 Roland Hieber +# +# Permission is hereby granted, free of charge, to any person obtaining +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + +DESTDIR?= +LN=ln -f +RM=rm -rf +MKDIR=mkdir -p + +# hardlink the files to their destinations +links: sourcedoc + # documentation + $(MKDIR) $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/source/ + if [ ! -d $(DESTDIR)/usr/share/doc/iserv/mod/ ]; then $(MKDIR) $(DESTDIR)/usr/share/doc/iserv/mod/; fi + $(LN) doc/{TODO,changelog.old.html} $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/ + $(LN) doc/source/* $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/source/ + $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation + $(LN) -s ../../iserv-mod-room-reservation $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation + + # images + if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/16/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/16/; fi + $(LN) img/16/*.png $(DESTDIR)/usr/share/iserv/www/img/default/16/ + if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/24/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/24/; fi + $(LN) img/24/*.png $(DESTDIR)/usr/share/iserv/www/img/default/24/ + if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/32/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/32/; fi + $(LN) img/32/*.png $(DESTDIR)/usr/share/iserv/www/img/default/32/ + + # includes + $(MKDIR) $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation + $(LN) inc/*.inc $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/ + if [ ! -e $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc ] ; then touch $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc; fi +ifeq ($(USER),root) + chmod u+rw $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc + chown www-data $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc +endif + + # i18n + if [ ! -d $(DESTDIR)/usr/share/iserv/locale/de/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/locale/de/; fi + $(LN) lang/*.po $(DESTDIR)/usr/share/iserv/locale/de/ + + # navigation + if [ ! -d $(DESTDIR)/usr/share/iserv/www/nav/admin ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/nav/admin; fi + $(LN) nav/*.mod $(DESTDIR)/usr/share/iserv/www/nav/ + $(LN) nav/admin/*.mod $(DESTDIR)/usr/share/iserv/www/nav/admin/ + + # privileges + if [ ! -d $(DESTDIR)/usr/share/iserv/priv/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/priv/; fi + $(LN) priv/* $(DESTDIR)/usr/share/iserv/priv/ + + # SQL tables + if [ ! -d $(DESTDIR)/usr/share/iserv/db/log_module ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/db/log_module; fi + $(LN) sql/*.sql $(DESTDIR)/usr/share/iserv/db/ + $(LN) sql/log_module/* $(DESTDIR)/usr/share/iserv/db/log_module + + # web pages + $(MKDIR) $(DESTDIR)/usr/share/iserv/www/mod_room-reservation + $(LN) src/{config,index}.php $(DESTDIR)/usr/share/iserv/www/mod_room-reservation/ + + # additional files + $(MKDIR) $(DESTDIR)/usr/share/iserv/modules/room-reservation + $(LN) maint/update-iserv1-iserv2.pl $(DESTDIR)/usr/share/iserv/modules/room-reservation + chmod +x $(DESTDIR)/usr/share/iserv/modules/room-reservation/update-iserv1-iserv2.pl + +# build doxygen documentation from source +sourcedoc: + doxygen + mv doc/source/html/* doc/source/ && rm -rf doc/source/html + +# install everything +install: links +ifeq ($(USER),root) + chkdb -r + chkpriv + chklocale +endif + +# uninstalling +uninstall: + $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation + $(RM) $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation + $(RM) $(DESTDIR)/usr/share/iserv/locale/de/mod_room-reservation.po + $(RM) $(DESTDIR)/usr/share/iserv/db/mod_room-reservation.sql + $(RM) $(DESTDIR)/usr/share/iserv/db/log_module/mod_room-reservation + $(RM) $(DESTDIR)/usr/share/iserv/www/nav/79mod_room-reservation.mod + $(RM) $(DESTDIR)/usr/share/iserv/priv/mod_room-reservation + $(RM) $(DESTDIR)/usr/share/iserv/www/nav/admin/99mod_room-reservation.mod + $(RM) $(DESTDIR)/usr/share/iserv/www/img/default/{16,24,32}/mod_room-reservation_{timeslice,index,config}.png + $(RM) $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation + $(RM) $(DESTDIR)/usr/share/iserv/www/mod_room-reservation + $(RM) $(DESTDIR)/usr/share/iserv/modules/room-reservation + + psql -c "DELETE FROM log_module WHERE module='Room Reservation Schedule';" + chklocale + + @echo + @echo If you do not need the SQL tables anymore, remove them by running + @echo ' psql -c "DROP TABLE mod_roomreservation_bookings;"' + @echo After that, all bookings are unrecoverably deleted! + @echo + +# clean up +clean: distclean + +distclean: + $(RM) doc/source + +.PHONY: clean distclean install diff --git a/debian/copyright b/debian/copyright index 385c289..d5e760c 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,47 +1,47 @@ -== License == - -The module has been released under the terms of the MIT License, as printed -following in its original version. Some images which have been used have been -released under the terms of the GNU Lesser General Public License (see -http://www.fsf.org/licensing/licenses/lgpl.html). These are in particular: - * /usr/share/iserv/www/img/default/16/mod_room-reservation_config.png - * /usr/share/iserv/www/img/default/16/mod_room-reservation_index.png - * /usr/share/iserv/www/img/default/24/mod_room-reservation_timeslice.png - * /usr/share/iserv/www/img/default/32/mod_room-reservation_config.png - * /usr/share/iserv/www/img/default/32/mod_room-reservation_index.png - -If you enjoy this software, you are free to support his author with a small -donation: - - Roland Hieber - IBAN: DE98 250 500 000 150 2141 79 - BIC: NOLADE2HXXX (Braunschweigische Landessparkasse) - -You can also send material donations to - Roland Hieber - 21944471 - Packstation 103 - 38106 Braunschweig - GERMANY - - -=== License terms === -Copyright (c) 2007 Roland Hieber - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +== License == + +The module has been released under the terms of the MIT License, as printed +following in its original version. Some images which have been used have been +released under the terms of the GNU Lesser General Public License (see +http://www.fsf.org/licensing/licenses/lgpl.html). These are in particular: + * /usr/share/iserv/www/img/default/16/mod_room-reservation_config.png + * /usr/share/iserv/www/img/default/16/mod_room-reservation_index.png + * /usr/share/iserv/www/img/default/24/mod_room-reservation_timeslice.png + * /usr/share/iserv/www/img/default/32/mod_room-reservation_config.png + * /usr/share/iserv/www/img/default/32/mod_room-reservation_index.png + +If you enjoy this software, you are free to support his author with a small +donation: + + Roland Hieber + IBAN: DE98 250 500 000 150 2141 79 + BIC: NOLADE2HXXX (Braunschweigische Landessparkasse) + +You can also send material donations to + Roland Hieber + 21944471 + Packstation 103 + 38106 Braunschweig + GERMANY + + +=== License terms === +Copyright (c) 2007 Roland Hieber + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/doc/TODO b/doc/TODO index ee202e7..5be711d 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,16 +1,16 @@ -== TO DO == - -=== Bugs: === -- Wenn eine einmalige Buchung erstellt wird, kann an diesem Termin keine feste Buchung mehr erstellt werden. - Feste Buchungen sind aber vorrangig! - => am besten bei fester Buchung Abfrage, ob der Benutzer mit lockerer Buchung per Mail benachrichtigt werden soll - -=== Features === -- ordentliche Statistik? -- bei sich wiederholenden Buchungen einzelne Buchungen ausblenden, für entfallene Lehrer - => eigene SQL-Tabelle mit solchen buchungen - -== Erstmal unwichtig == -- Ferientermine mit einbauen => keine Buchungen dann möglich bzw. Warnung - Vielleicht als ICS-Import oder gleich aus dem Kalender übernehmen? +== TO DO == + +=== Bugs: === +- Wenn eine einmalige Buchung erstellt wird, kann an diesem Termin keine feste Buchung mehr erstellt werden. + Feste Buchungen sind aber vorrangig! + => am besten bei fester Buchung Abfrage, ob der Benutzer mit lockerer Buchung per Mail benachrichtigt werden soll + +=== Features === +- ordentliche Statistik? +- bei sich wiederholenden Buchungen einzelne Buchungen ausblenden, für entfallene Lehrer + => eigene SQL-Tabelle mit solchen buchungen + +== Erstmal unwichtig == +- Ferientermine mit einbauen => keine Buchungen dann möglich bzw. Warnung + Vielleicht als ICS-Import oder gleich aus dem Kalender übernehmen? - Dokumentation der SQL-Tabelle und der Konfigurationsoptionen \ No newline at end of file diff --git a/doc/changelog.old.html b/doc/changelog.old.html index 3907ad6..4400dd6 100644 --- a/doc/changelog.old.html +++ b/doc/changelog.old.html @@ -1,11 +1,11 @@ - - - IServ – Raumbelegungsplan – Changelog - - - - - + + + IServ – Raumbelegungsplan – Changelog + + + + +

Changelog

Änderungen für neuere Versionen befinden sich im Debian-Changelog.

iserv-room-reservation-3.0

@@ -37,64 +37,64 @@
  • Räume können auch „+” enthalten
  • - -

    iserv-rooms-2.3

    -Release: 2. Juni 2007 - - -

    iserv-rooms-2.2

    -Release: 1. Mai 2007 - - -

    iserv-rooms-2.1

    -Release: 25. Februar 2007 - - -

    iserv-rooms-2.0-2

    -Release: 28. August 2006 - - -

    iserv-rooms-2.0-1

    -Release: 28. August 2006 - - - - + +

    iserv-rooms-2.3

    +Release: 2. Juni 2007 + + +

    iserv-rooms-2.2

    +Release: 1. Mai 2007 + + +

    iserv-rooms-2.1

    +Release: 25. Februar 2007 + + +

    iserv-rooms-2.0-2

    +Release: 28. August 2006 + + +

    iserv-rooms-2.0-1

    +Release: 28. August 2006 + + + + diff --git a/inc/exceptions.inc b/inc/exceptions.inc index 8d7c688..3907686 100644 --- a/inc/exceptions.inc +++ b/inc/exceptions.inc @@ -1,30 +1,30 @@ userCanView()) { +userCanView()) { TreeNode(_c("room-reservation:Book rooms"), "/idesk/mod_room-reservation/", "mod_room-reservation_index"); -} -?> +} +?> diff --git a/nav/admin/99mod_room-reservation.mod b/nav/admin/99mod_room-reservation.mod index 45a227a..e3ee418 100644 --- a/nav/admin/99mod_room-reservation.mod +++ b/nav/admin/99mod_room-reservation.mod @@ -1,4 +1,4 @@ +?> diff --git a/sql/mod_room-reservation.sql b/sql/mod_room-reservation.sql index b6bfd65..436512a 100644 --- a/sql/mod_room-reservation.sql +++ b/sql/mod_room-reservation.sql @@ -1,38 +1,38 @@ --- --- Table with rooms allowed for booking --- -CREATE TABLE mod_roomreservation_roomswhitelist ( - rrr_name TEXT UNIQUE REFERENCES rooms(name) - ON DELETE CASCADE - ON UPDATE CASCADE -); - --- --- Table with bookings --- -CREATE TABLE mod_roomreservation_bookings ( - rrb_uid SERIAL NOT NULL PRIMARY KEY, -- Unique ID - rrb_room TEXT NOT NULL -- Name of the room - REFERENCES rooms(name) - ON DELETE CASCADE - ON UPDATE CASCADE, - rrb_date DATE NOT NULL, -- Date of the booking - rrb_tsfirst SMALLINT NOT NULL, -- Number of the first timeslice - rrb_tslast SMALLINT NOT NULL -- Number of the last timeslice - CHECK(rrb_tsfirst <= rrb_tslast), - rrb_act TEXT NOT NULL -- Owner of the booking - REFERENCES users(Act) - ON DELETE CASCADE - ON UPDATE CASCADE, - rrb_reason TEXT NOT NULL, -- Reason - rrb_interval SMALLINT NOT NULL -- Interval in weeks for recurring bookings - DEFAULT 0 -); - --- --- Permissions --- -GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_bookings, mod_roomreservation_bookings_rrb_uid_seq TO webusr; -GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_bookings, mod_roomreservation_bookings_rrb_uid_seq TO webadm; -GRANT SELECT ON mod_roomreservation_roomswhitelist TO webusr; -GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_roomswhitelist TO webadm; +-- +-- Table with rooms allowed for booking +-- +CREATE TABLE mod_roomreservation_roomswhitelist ( + rrr_name TEXT UNIQUE REFERENCES rooms(name) + ON DELETE CASCADE + ON UPDATE CASCADE +); + +-- +-- Table with bookings +-- +CREATE TABLE mod_roomreservation_bookings ( + rrb_uid SERIAL NOT NULL PRIMARY KEY, -- Unique ID + rrb_room TEXT NOT NULL -- Name of the room + REFERENCES rooms(name) + ON DELETE CASCADE + ON UPDATE CASCADE, + rrb_date DATE NOT NULL, -- Date of the booking + rrb_tsfirst SMALLINT NOT NULL, -- Number of the first timeslice + rrb_tslast SMALLINT NOT NULL -- Number of the last timeslice + CHECK(rrb_tsfirst <= rrb_tslast), + rrb_act TEXT NOT NULL -- Owner of the booking + REFERENCES users(Act) + ON DELETE CASCADE + ON UPDATE CASCADE, + rrb_reason TEXT NOT NULL, -- Reason + rrb_interval SMALLINT NOT NULL -- Interval in weeks for recurring bookings + DEFAULT 0 +); + +-- +-- Permissions +-- +GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_bookings, mod_roomreservation_bookings_rrb_uid_seq TO webusr; +GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_bookings, mod_roomreservation_bookings_rrb_uid_seq TO webadm; +GRANT SELECT ON mod_roomreservation_roomswhitelist TO webusr; +GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_roomswhitelist TO webadm; diff --git a/src/config.php b/src/config.php index e53b70a..e884df2 100644 --- a/src/config.php +++ b/src/config.php @@ -1,37 +1,37 @@ show(); -?> +?> diff --git a/src/index.php b/src/index.php index 8b48d53..0e1de6e 100644 --- a/src/index.php +++ b/src/index.php @@ -1,247 +1,247 @@ -setTitle(_c("room-reservation:Schedule of room bookings")); $page->show(); -/** -require_once("sec/secure.inc"); -require_once("mod_rooms.inc"); -TestConfig(); - -// Ist der User berechtigt? -$bAllowAccess = false; -foreach($user[groups] as $group) -{ - foreach($cfgRooms["AllowedGroups"] as $allowed) - { - $bAllowAccess |= (($group == $allowed) == true); - } -} -if(!$bAllowAccess and $cfgRooms["RestrictAccess"] == true) - die_nice("Fehler: Sie sind nicht berechtigt, diese Seite zu benutzen. Wenden Sie sich an einen Administrator."); - -$bookings = new AllBookings(false); - -// Zeitstunden in Schulstunden umrechnen -$lessons_begin = array_flip($cfgRooms["TimeslicesBegin"]); -$lessons_end = array_flip($cfgRooms["TimeslicesEnd"]); - -$action = $_GET["action"]; -$room = isset($_GET["room"]) ? $_GET["room"] : $cfgRooms["Rooms"][0]; -$start = isset($_GET["start"]) ? $_GET["start"] : Monday(); -$act = $user[act]; -$id = isset($_POST["id"]) ? $_POST["id"] : $_GET["id"]; -$class = isset($_POST["class"]) ? $_POST["class"] : $_GET["class"]; -$room_form = isset($_POST["room_form"]) ? $_POST["room_form"] : $_GET["room"]; -$date = isset($_POST["date"]) ? $_POST["date"] : $_GET["date"]; -$timebegin = isset($_POST["timebegin"]) ? $_POST["timebegin"] : $_GET["timebegin"]; -$timeend = isset($_POST["timeend"]) ? $_POST["timeend"] : (isset($_GET["timeend"]) ? $_GET["timeend"] : $cfgRooms["TimeslicesEnd"][$lessons_begin[$timebegin]]); // Standardmäßig auf einen Zeitraum später als Anfangszeit -$reason = isset($_POST["reason"]) ? $_POST["reason"] : $_GET["reason"]; -$submit = $_POST["submit"]; -$cancel = $_POST["cancel"]; - -PageBlue("Raumbelegungsplan", "rooms_index"); - -// Formular anzeigen -function ShowForm() -{ - global $cfgRooms; - global $act, $class, $room_form, $date, $timebegin, $timeend, $reason, $user; - - Title("Einen Raum buchen"); - $form = "

    Füllen Sie das Formular aus und klicken Sie dann auf die Schaltfläche „Raum buchen“.

    -
    - - - -"; - - // Klasse nur anzeigen, wenn angeschaltet - if($cfgRooms["ShowClassEdit"]) - $form .= "\n \n"; - - $form .= "\n \n\n"; - $form .= " \n\n"; - $form .= " \n\n"; - $form .= " \n\n"; - $form .= " \n
    Ihr Name:{$user[name]}
    ".q(stripslashes($cfgRooms["ClassEditText"])).":
    Raum:
    Datum:
    Zeit:vonbis
    Grund für die Belegung:
      
    "; - - echo $form; -} - - -if($action == "book") -{ - ShowForm(); -} -// ...oder Buchung löschen? -else if($action == "delete") -{ - // Rausfinden, wo unsere gewünschte ID im Array steht - for($n = 0; isset($bookings->objBookings[$n]->sqlData->id) and ($id != $bookings->objBookings[$n]->sqlData->id); $n++); - - // Auf Besitz oder Admin prüfen - $bAdminMode = FALSE; - $bAdminMode |= ($bookings->objBookings[$n]->UserIsOwner() and !$bookings->objBookings[$n]->rawData->fixed); // Benutzer dürfen keine festen Buchungen löschen - $bAdminMode |= $bookings->UserIsAdmin(); - - if(!$bAdminMode) - echo "
    Sie sind nicht berechtigt, diese Buchung zu löschen!
    \n"; - else - { - if($_POST["surely_delete"] == "Löschen" && $_POST["surely_delete_fixed"] == "true") - { - $bookings->Delete($id); - echo "
    Ihre Buchung wurde gelöscht.
    \n"; - } - else - { - echo "

    Eine Buchung löschen

    \n"; - if($bookings->objBookings[$n]->rawData->fixed and $_POST["surely_delete_fixed"] == "false") - echo "

    Sie müssen bestätigen, dass Sie die Warnung über das Löschen von festen Buchungen zur Kenntnis genommen haben.

    \n"; - // Formular zur Bestätigung anzeigen - echo "

    Wollen Sie diese Buchung löschen?

    \n"; - $bookings->PrintBooking($id); - echo "
    \n"; - echo "

    \n"; - if($bookings->objBookings[$n]->rawData->fixed) - // Bestätigungsfeld für feste Buchungen - echo "

    ".icona("dlg-warn", 16)."Achtung: Diese Buchung ist eine feste Buchung. Wenn sie gelöscht wird, wird der Zeitraum nicht in dieser Woche, sondern in allen Wochen wieder freigegeben.

    \n

    <$smlchk name='surely_delete_fixed' value='true' />

    \n"; - else - echo "\n"; - echo "<$stdbtn name='surely_delete' value='Löschen' />
    \n"; - } - } - - // Zurück-Link anzeigen - Option(_("Back"), "", "href='?room=$room&start=$start'", "back"); -} - -// ... oder alle Buchungen anzeigen / Buchung eintragen? -else -{ - if($action == "insert" and $submit == "Raum buchen") - { - $err = $bookings->Insert(null, $room_form, $date, $timebegin, $timeend, $act, $class, $reason, false); - if(!$err) - { - switch($bookings->lastError) - { - case ALLBOOKINGS_SQL_ERROR: - ReportError("\$booking->Insert", $booking->lastError, __FILE__, __LINE__); - default: - } - ShowForm(); - die_nice(); - } - else - { - // Log-Eintrag, wenn erwünscht - if($cfgRooms["LogOnInsert"]) - InsertLog("Raum $room_form am $date von $timebegin bis $timeend gebucht. Begründung: $reason"); - - // Passenderweise gleich die Woche mit der eingetragenen Buchung anzeigen - $tmp = explode(".", $date); - $start = Monday(strtotime($tmp[2]."-".$tmp[1]."-".$tmp[0])); - $room = $room_form; - Title("Raumbelegungen für den Raum $room in Woche ".date("W", $start)); - echo "

    ".icona("dlg-info", 16, "bl")."Ihre Buchung wurde eingetragen.

    \n"; - } - } - else - { - Title("Raumbelegungen für den Raum $room in Woche ".date("W", $start)); - } - - $nPrevWeek = strtotime("last monday", Monday($start)); // der Montag vor dem Montag in der Startwoche - $nFirstWeek = Monday(); // der Montag in der aktuellen Woche - $nLastWeek = strtotime("last monday", Monday($bookings->GetLastBookingDate())); - $nNextWeek = strtotime("next monday", Monday($start)); // der Montag nach dem Montag der Startwoche - - echo "
    -Raum:

    "; - - // Navigation für die Wochen ausgeben - echo "

    Vorherige Woche | Aktuelle Woche | "; - // Fünf Wochen zur direkten Anwahl anbieten - for($i = 1; $i <= 5; $i++) - { - $nCurWeek = Monday(strtotime("$i week", $start)); - echo "Woche ".date("W", $nCurWeek)." | "; - } - echo "Letzte Buchung | Nächste Woche

    "; - echo "

    \n"; - - $bookings->PrintTimeTable($start, $room); - - echo "
    "; -} - -_PageBlue(); -*/ -?> +/** +require_once("sec/secure.inc"); +require_once("mod_rooms.inc"); +TestConfig(); + +// Ist der User berechtigt? +$bAllowAccess = false; +foreach($user[groups] as $group) +{ + foreach($cfgRooms["AllowedGroups"] as $allowed) + { + $bAllowAccess |= (($group == $allowed) == true); + } +} +if(!$bAllowAccess and $cfgRooms["RestrictAccess"] == true) + die_nice("Fehler: Sie sind nicht berechtigt, diese Seite zu benutzen. Wenden Sie sich an einen Administrator."); + +$bookings = new AllBookings(false); + +// Zeitstunden in Schulstunden umrechnen +$lessons_begin = array_flip($cfgRooms["TimeslicesBegin"]); +$lessons_end = array_flip($cfgRooms["TimeslicesEnd"]); + +$action = $_GET["action"]; +$room = isset($_GET["room"]) ? $_GET["room"] : $cfgRooms["Rooms"][0]; +$start = isset($_GET["start"]) ? $_GET["start"] : Monday(); +$act = $user[act]; +$id = isset($_POST["id"]) ? $_POST["id"] : $_GET["id"]; +$class = isset($_POST["class"]) ? $_POST["class"] : $_GET["class"]; +$room_form = isset($_POST["room_form"]) ? $_POST["room_form"] : $_GET["room"]; +$date = isset($_POST["date"]) ? $_POST["date"] : $_GET["date"]; +$timebegin = isset($_POST["timebegin"]) ? $_POST["timebegin"] : $_GET["timebegin"]; +$timeend = isset($_POST["timeend"]) ? $_POST["timeend"] : (isset($_GET["timeend"]) ? $_GET["timeend"] : $cfgRooms["TimeslicesEnd"][$lessons_begin[$timebegin]]); // Standardmäßig auf einen Zeitraum später als Anfangszeit +$reason = isset($_POST["reason"]) ? $_POST["reason"] : $_GET["reason"]; +$submit = $_POST["submit"]; +$cancel = $_POST["cancel"]; + +PageBlue("Raumbelegungsplan", "rooms_index"); + +// Formular anzeigen +function ShowForm() +{ + global $cfgRooms; + global $act, $class, $room_form, $date, $timebegin, $timeend, $reason, $user; + + Title("Einen Raum buchen"); + $form = "

    Füllen Sie das Formular aus und klicken Sie dann auf die Schaltfläche „Raum buchen“.

    +
    + + + +"; + + // Klasse nur anzeigen, wenn angeschaltet + if($cfgRooms["ShowClassEdit"]) + $form .= "\n \n"; + + $form .= "\n \n\n"; + $form .= " \n\n"; + $form .= " \n\n"; + $form .= " \n\n"; + $form .= " \n
    Ihr Name:{$user[name]}
    ".q(stripslashes($cfgRooms["ClassEditText"])).":
    Raum:
    Datum:
    Zeit:vonbis
    Grund für die Belegung:
      
    "; + + echo $form; +} + + +if($action == "book") +{ + ShowForm(); +} +// ...oder Buchung löschen? +else if($action == "delete") +{ + // Rausfinden, wo unsere gewünschte ID im Array steht + for($n = 0; isset($bookings->objBookings[$n]->sqlData->id) and ($id != $bookings->objBookings[$n]->sqlData->id); $n++); + + // Auf Besitz oder Admin prüfen + $bAdminMode = FALSE; + $bAdminMode |= ($bookings->objBookings[$n]->UserIsOwner() and !$bookings->objBookings[$n]->rawData->fixed); // Benutzer dürfen keine festen Buchungen löschen + $bAdminMode |= $bookings->UserIsAdmin(); + + if(!$bAdminMode) + echo "
    Sie sind nicht berechtigt, diese Buchung zu löschen!
    \n"; + else + { + if($_POST["surely_delete"] == "Löschen" && $_POST["surely_delete_fixed"] == "true") + { + $bookings->Delete($id); + echo "
    Ihre Buchung wurde gelöscht.
    \n"; + } + else + { + echo "

    Eine Buchung löschen

    \n"; + if($bookings->objBookings[$n]->rawData->fixed and $_POST["surely_delete_fixed"] == "false") + echo "

    Sie müssen bestätigen, dass Sie die Warnung über das Löschen von festen Buchungen zur Kenntnis genommen haben.

    \n"; + // Formular zur Bestätigung anzeigen + echo "

    Wollen Sie diese Buchung löschen?

    \n"; + $bookings->PrintBooking($id); + echo "
    \n"; + echo "

    \n"; + if($bookings->objBookings[$n]->rawData->fixed) + // Bestätigungsfeld für feste Buchungen + echo "

    ".icona("dlg-warn", 16)."Achtung: Diese Buchung ist eine feste Buchung. Wenn sie gelöscht wird, wird der Zeitraum nicht in dieser Woche, sondern in allen Wochen wieder freigegeben.

    \n

    <$smlchk name='surely_delete_fixed' value='true' />

    \n"; + else + echo "\n"; + echo "<$stdbtn name='surely_delete' value='Löschen' />
    \n"; + } + } + + // Zurück-Link anzeigen + Option(_("Back"), "", "href='?room=$room&start=$start'", "back"); +} + +// ... oder alle Buchungen anzeigen / Buchung eintragen? +else +{ + if($action == "insert" and $submit == "Raum buchen") + { + $err = $bookings->Insert(null, $room_form, $date, $timebegin, $timeend, $act, $class, $reason, false); + if(!$err) + { + switch($bookings->lastError) + { + case ALLBOOKINGS_SQL_ERROR: + ReportError("\$booking->Insert", $booking->lastError, __FILE__, __LINE__); + default: + } + ShowForm(); + die_nice(); + } + else + { + // Log-Eintrag, wenn erwünscht + if($cfgRooms["LogOnInsert"]) + InsertLog("Raum $room_form am $date von $timebegin bis $timeend gebucht. Begründung: $reason"); + + // Passenderweise gleich die Woche mit der eingetragenen Buchung anzeigen + $tmp = explode(".", $date); + $start = Monday(strtotime($tmp[2]."-".$tmp[1]."-".$tmp[0])); + $room = $room_form; + Title("Raumbelegungen für den Raum $room in Woche ".date("W", $start)); + echo "

    ".icona("dlg-info", 16, "bl")."Ihre Buchung wurde eingetragen.

    \n"; + } + } + else + { + Title("Raumbelegungen für den Raum $room in Woche ".date("W", $start)); + } + + $nPrevWeek = strtotime("last monday", Monday($start)); // der Montag vor dem Montag in der Startwoche + $nFirstWeek = Monday(); // der Montag in der aktuellen Woche + $nLastWeek = strtotime("last monday", Monday($bookings->GetLastBookingDate())); + $nNextWeek = strtotime("next monday", Monday($start)); // der Montag nach dem Montag der Startwoche + + echo "
    +Raum:

    "; + + // Navigation für die Wochen ausgeben + echo "

    Vorherige Woche | Aktuelle Woche | "; + // Fünf Wochen zur direkten Anwahl anbieten + for($i = 1; $i <= 5; $i++) + { + $nCurWeek = Monday(strtotime("$i week", $start)); + echo "Woche ".date("W", $nCurWeek)." | "; + } + echo "Letzte Buchung | Nächste Woche

    "; + echo "

    \n"; + + $bookings->PrintTimeTable($start, $room); + + echo "
    "; +} + +_PageBlue(); +*/ +?>