diff --git a/adm/api.php b/adm/api.php index a11bbfa..807e3ca 100644 --- a/adm/api.php +++ b/adm/api.php @@ -6,6 +6,13 @@ if ( in_array("cmd", array_keys($_GET)) and $_GET["cmd"] == "get" ) { $ret = getEvents(); } elseif ( $_POST["cmd"] == "put" ) { $json = base64_decode($_POST["payload"]); + $events = json_decode($json, true); + for ( $i = 0; $i < count($events); $i++ ) { + foreach ( array( "hours", "agenda", "minutes" ) as $field ) { + unset($events[$i][$field]); + } + } + $json = json_encode($events, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); file_put_contents("dat/events.json", $json); $ret = getEvents(); } diff --git a/adm/index.js b/adm/index.js index 0929519..a0483c2 100755 --- a/adm/index.js +++ b/adm/index.js @@ -35,7 +35,8 @@ Vue.createApp({ if (now.isSameOrAfter(next7pm)) { next7pm.add(1, 'day'); } - const twoHoursLater = moment(next7pm).add(2, 'hours'); + event.hours = 2.5; + const twoHoursLater = moment(next7pm).add(event.hours, 'hours'); event.start = next7pm.format('YYYY-MM-DDTHH:mm'); event.end = twoHoursLater.format('YYYY-MM-DDTHH:mm'); this.events.unshift(event); @@ -63,6 +64,9 @@ Vue.createApp({ validateEvents: function() { var faults = []; for ( var e in this.events ) { + var start = moment(this.events[e].start); + var end = start.add(this.events[e].hours, 'hours'); + this.events[e].end = end.format('YYYY-MM-DDTHH:mm'); for ( var k in this.fields ) { var value = this.events[e][k]; value = ( value == undefined ? '' : value ); @@ -117,7 +121,7 @@ Vue.createApp({ this.validateEvents(); }, modalCancel: function() { - frm.modal = null; + this.frm.modal = null; } }, mounted: function() { diff --git a/adm/index.php b/adm/index.php index 9cd2327..e779956 100755 --- a/adm/index.php +++ b/adm/index.php @@ -62,10 +62,14 @@ +
+ Duration + + hrs +
End -
Location diff --git a/dat/live/events.json b/dat/live/events.json index c5e1e6d..6d01778 100755 --- a/dat/live/events.json +++ b/dat/live/events.json @@ -1 +1,44 @@ -[{"start":"2025-07-24T18:30:00","end":"2025-07-24T21:00:00","title":"July 2025 In Person Catch Up","description":"Monthly In Person Get Together","location":"Chermside Library","coordinates":"-27.38621539644283,153.0351689206467","ctl":"202507241830","agenda":"- 6.30 pm - Welcome\n- 6.35 pm - Agreement on Agenda Items\n- 6.40 pm - Administrivia (if any)\n- 6.45 pm - Presentation 1: James: Git\n- 7.15 pm - Presentation 2: Terry?: Fossil?\n- 7.45 pm - Loose (Discourse) Threads\n"},{"start":"2025-07-08T19:00:00","end":"2025-07-08T21:00:00","title":"July 2025 Online Catch Up","description":"Monthly Online Jitsi Get Together","location":"Jitsi","ctl":"202507081900","agenda":"- 7.30 pm - Welcome\n- 7.35 pm - Agreement on Agenda Items\n- 7.40 pm - Administrivia (if any)\n- 7.45 pm - Presentation 1 - James: Git\n- 8.15 pm - Presentation 2 - Terry?: Fossil?\n- 8.45 pm - Loose (Discourse) Threads\n"},{"start":"2025-06-19T18:30:00","end":"2025-06-19T21:00:00","title":"June 2025 In Person Catch Up","description":"Social get-together. Discussion about large language models and meshtastic experiments. Clumsy attempt at adhering to an agenda and taking minutes.","location":"Chermside Library","coordinates":"-27.38621539644283,153.0351689206467","ctl":"202506191830","minutes":"- Admin\n\t- ToS and Privacy Policy doesn't need to be hosted on the main page. It's already got a publicly accessible presence in Discourse.\n\t- James to formalise agenda procedure\n\t- James to render cal.php on main page\n\t- James to publish \"subscribe\" link for calendar\n- Recap from Last Month\n\t- Hardware Donations for Education\n\t\t- Substation 33, in Kingston or Logan?\n\t\t- Dirk has a carload of stuff to offload\n- Discourse Themes\n\t- LLMs\n\t- Hardware for LLMs\n\t- Tiny11\n- Agenda\n\t- Motioneye\n\t- Meshtastic\n- Next Month\n\t- Location Requests\n"},{"start":"2025-06-10T19:00:00","end":"2025-06-10T21:00:00","title":"June 2025 Online Catch Up","description":"Getting started with meshtastic","location":"Jitsi","ctl":"202506101900"}] \ No newline at end of file +[ + { + "coordinates": "-27.38621539644283,153.0351689206467", + "start": "2025-06-15T09:00", + "end": "2025-06-15T11:30", + "title": "Event Title", + "description": "Event Description", + "location": "Event Location" + }, + { + "start": "2025-07-24T18:30:00", + "end": "2025-07-24T21:00", + "title": "July 2025 In Person Catch Up", + "description": "Monthly In Person Get Together", + "location": "Chermside Library", + "coordinates": "-27.38621539644283,153.0351689206467", + "ctl": "202507241830" + }, + { + "start": "2025-07-08T19:00:00", + "end": "2025-07-08T21:00", + "title": "July 2025 Online Catch Up", + "description": "Monthly Online Jitsi Get Together", + "location": "Jitsi", + "ctl": "202507081900" + }, + { + "start": "2025-06-19T18:30:00", + "end": "2025-06-19T21:00", + "title": "June 2025 In Person Catch Up", + "description": "Social get-together. Discussion about large language models and meshtastic experiments. Clumsy attempt at adhering to an agenda and taking minutes.", + "location": "Chermside Library", + "coordinates": "-27.38621539644283,153.0351689206467", + "ctl": "202506191830" + }, + { + "start": "2025-06-10T19:00:00", + "end": "2025-06-10T21:00", + "title": "June 2025 Online Catch Up", + "description": "Getting started with meshtastic", + "location": "Jitsi", + "ctl": "202506101900" + } +] \ No newline at end of file diff --git a/lib/main.php b/lib/main.php index 9c91e6d..92e4059 100755 --- a/lib/main.php +++ b/lib/main.php @@ -10,6 +10,11 @@ function getEvents() { $dt = new DateTime( $entry["start"] ); $ctl = $dt -> format("YmdHi"); $entries[$i]["ctl"] = $ctl; + $start = new DateTime($entries[$i]["start"]); + $end = new DateTime($entries[$i]["end"]); + $delta = $start->diff($end); + $hours = $delta -> days * 24 + $delta -> h + $delta -> i / 60 + $delta -> s / 3600; + $entries[$i]["hours"] = $hours; $datestamp = $dt -> format("Ymd"); $files = array( "agenda" => sprintf("dat/agenda/%d.md", $datestamp) , "minutes" => sprintf("dat/minutes/%d.md", $datestamp)