From f8616ff819bc8e2bd546ac9e716cc00ba2bd7705 Mon Sep 17 00:00:00 2001 From: James Downie Date: Tue, 1 Jul 2025 23:02:30 +1000 Subject: [PATCH] Got a basic calendar editing page going. --- cal/api.php | 9 +++ cal/events.json | 0 cal/index.css | 7 ++ cal/index.js | 17 +++++ cal/index.php | 73 +++++++++++++++++++ cal/lib.php | 0 {web => dat.live}/events.json | 0 .../events.json | 0 docker-compose.yaml | 14 +++- lib.php | 31 ++++++++ web/index.php | 27 +------ web/lib.php | 0 12 files changed, 148 insertions(+), 30 deletions(-) create mode 100644 cal/api.php create mode 100644 cal/events.json create mode 100644 cal/index.css create mode 100755 cal/index.js create mode 100755 cal/index.php create mode 100644 cal/lib.php rename {web => dat.live}/events.json (100%) rename web/events_testing.json => dat.test/events.json (100%) create mode 100755 lib.php create mode 100644 web/lib.php diff --git a/cal/api.php b/cal/api.php new file mode 100644 index 0000000..a91f318 --- /dev/null +++ b/cal/api.php @@ -0,0 +1,9 @@ + "unknown command" ); +if ( $_GET["cmd"] == "get" ) { + $ret = getEvents(); +} +print(json_encode($ret)); +?> diff --git a/cal/events.json b/cal/events.json new file mode 100644 index 0000000..e69de29 diff --git a/cal/index.css b/cal/index.css new file mode 100644 index 0000000..f85a3f4 --- /dev/null +++ b/cal/index.css @@ -0,0 +1,7 @@ +.tabbody { + border-bottom: solid 1px rgb(222, 226, 230); + border-left: solid 1px rgb(222, 226, 230); + border-right: solid 1px rgb(222, 226, 230); + border-bottom-left-radius: 10px; + border-bottom-right-radius: 10px; +} diff --git a/cal/index.js b/cal/index.js new file mode 100755 index 0000000..39ef450 --- /dev/null +++ b/cal/index.js @@ -0,0 +1,17 @@ +Vue.createApp({ + data: function() { + return { 'events': null + , 'tabs': [ 'Events', 'Create' ] + , 'frm': { 'tab': 0, 'e': null } + } + }, + mounted: function() { + var app = this; + jQuery.get( 'api.php' + , { 'cmd': 'get' } + , function(data) { + app.events = data; + } + ); + } +}).mount('#app') diff --git a/cal/index.php b/cal/index.php new file mode 100755 index 0000000..b05e0dc --- /dev/null +++ b/cal/index.php @@ -0,0 +1,73 @@ + + + + + + + Events + + + + + + +
+ +
+
+
+ + + + + + + +
{{event.start}}{{event.end}}
+
+
+
+ Start + +
+
+ End + +
+
+ Title + +
+
+ Description + +
+
+ Location + +
+
+ Coordinates + +
+
+
+
+
+

Create

+
+
{{events}}
+
+ + + + + + + diff --git a/cal/lib.php b/cal/lib.php new file mode 100644 index 0000000..e69de29 diff --git a/web/events.json b/dat.live/events.json similarity index 100% rename from web/events.json rename to dat.live/events.json diff --git a/web/events_testing.json b/dat.test/events.json similarity index 100% rename from web/events_testing.json rename to dat.test/events.json diff --git a/docker-compose.yaml b/docker-compose.yaml index 24ff66a..05dfa16 100755 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,22 +1,28 @@ services: - web: + app: image: php:8.2-apache - container_name: homepage + container_name: app ports: - "8080:80" volumes: - ./web/:/var/www/html:Z - ./vendor/:/var/www/html/vendor:Z + - ./lib.php:/var/www/html/lib.php:Z + - ./dat.live:/var/www/html/dat:Z networks: - labnet + profiles: + - app cal: image: php:8.2-apache - container_name: calendar + container_name: cal ports: - - "8081:80" + - "8080:80" volumes: - ./cal/:/var/www/html:Z - ./vendor/:/var/www/html/vendor:Z + - ./lib.php:/var/www/html/lib.php:Z + - ./dat.live:/var/www/html/dat:Z networks: - labnet profiles: diff --git a/lib.php b/lib.php new file mode 100755 index 0000000..d750d10 --- /dev/null +++ b/lib.php @@ -0,0 +1,31 @@ + format("YmdHi"); + $entries[$i]["ctl"] = $ctl; + $datestamp = $dt -> format("Ymd"); + $files = array( "agenda" => sprintf("agenda/%d.md", $datestamp) + , "minutes" => sprintf("minutes/%d.md", $datestamp) + ); + foreach ( $files as $key => $file ) { + if ( file_exists( $file ) ) { + $entries[$i][$key] = file_get_contents($file); + } + } + } + usort($entries, function ($a, $b) { + $dateA = new DateTime($a['start']); + $dateB = new DateTime($b['start']); + return $dateA < $dateB ? 1 : -1; + }); + return($entries); +} + +?> diff --git a/web/index.php b/web/index.php index 7cc1247..7b11790 100755 --- a/web/index.php +++ b/web/index.php @@ -1,35 +1,10 @@ format("YmdHi"); - $entries[$i]["ctl"] = $ctl; - $datestamp = $dt -> format("Ymd"); - $files = array( "agenda" => sprintf("agenda/%d.md", $datestamp) - , "minutes" => sprintf("minutes/%d.md", $datestamp) - ); - foreach ( $files as $key => $file ) { - if ( file_exists( $file ) ) { - $entries[$i][$key] = file_get_contents($file); - } - } - } - usort($entries, function ($a, $b) { - $dateA = new DateTime($a['start']); - $dateB = new DateTime($b['start']); - return $dateA < $dateB ? 1 : -1; - }); - return($entries); -} - ?> diff --git a/web/lib.php b/web/lib.php new file mode 100644 index 0000000..e69de29