Allow inputting time for events
This commit is contained in:
parent
29215173f8
commit
49c3d704bc
@ -48,6 +48,16 @@
|
||||
<xsl:value-of select="@start"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="start_time">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($start) > 10">
|
||||
<xsl:value-of select="substring($start,12,5)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="start_day">
|
||||
<xsl:value-of select="substring($start,9,2)"/>
|
||||
</xsl:variable>
|
||||
@ -63,6 +73,16 @@
|
||||
<xsl:value-of select="@end"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="end_time">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($end) > 10">
|
||||
<xsl:value-of select="substring($end,12,5)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="end_day">
|
||||
<xsl:value-of select="substring($end,9,2)"/>
|
||||
</xsl:variable>
|
||||
@ -81,12 +101,20 @@
|
||||
<!-- Compile the date -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$start != $end">
|
||||
<xsl:value-of select="$start_day"/>
|
||||
<xsl:if test="$start_time != $end_time">
|
||||
<xsl:value-of select="$start_time"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="$start_day != $end_day">
|
||||
<xsl:value-of select="$start_day"/>
|
||||
</xsl:if>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:if test="$start_month != $end_month">
|
||||
<xsl:value-of select="$start_month"/>
|
||||
</xsl:if>
|
||||
<xsl:text> – </xsl:text>
|
||||
<xsl:if test="$start_time != $end_time">
|
||||
<xsl:value-of select="$end_time"/> UTC
|
||||
</xsl:if>
|
||||
<xsl:value-of select="$end_day"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$end_month"/>
|
||||
@ -156,7 +184,7 @@
|
||||
<xsl:element name="ul">
|
||||
<xsl:attribute name="class">event-list</xsl:attribute>
|
||||
<xsl:for-each select="/buildinfo/document/set/event[
|
||||
translate(@end,'-','') >= translate(/buildinfo/@date,'-','')
|
||||
translate(substring(@end,1,10),'-','') >= translate(/buildinfo/@date,'-','')
|
||||
]">
|
||||
<xsl:sort select="@start"/>
|
||||
<xsl:if test="position() <= $count">
|
||||
@ -192,7 +220,7 @@
|
||||
|
||||
<!-- Build list -->
|
||||
<xsl:for-each select="/buildinfo/document/set/event[
|
||||
translate(@end,'-','') >= translate(/buildinfo/@date,'-','')
|
||||
translate(substring(@end,1,10),'-','') >= translate(/buildinfo/@date,'-','')
|
||||
]">
|
||||
<xsl:sort select="@start"/>
|
||||
<xsl:if test="position() <= $count">
|
||||
|
@ -56,11 +56,7 @@ function eval_date($date)
|
||||
{
|
||||
$dt = date_parse($date);
|
||||
return !$dt["errors"] &&
|
||||
$dt["year"] &&
|
||||
preg_match(
|
||||
"#^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$#",
|
||||
$date
|
||||
) === 1;
|
||||
$dt["year"] && $dt["month"] && $dt["day"] && isset($dt["hour"]) && isset($dt["minute"]);
|
||||
}
|
||||
|
||||
function parse_submission()
|
||||
@ -84,8 +80,8 @@ function parse_submission()
|
||||
"title" => isset($_POST["title"]) ? $_POST["title"] : "",
|
||||
"groupname" => isset($_POST["groupname"]) ? $_POST["groupname"] : "",
|
||||
"groupurl" => isset($_POST["groupurl"]) ? $_POST["groupurl"] : "",
|
||||
"startdate" => isset($_POST["startdate"]) ? $_POST["startdate"] : "",
|
||||
"enddate" => isset($_POST["enddate"]) ? $_POST["enddate"] : "",
|
||||
"startdate" => isset($_POST["startdate"]) ? ($_POST["startdate"] . ":00Z") : "",
|
||||
"enddate" => isset($_POST["enddate"]) ? ($_POST["enddate"] . ":00Z") : "",
|
||||
"description" => isset($_POST["description"])
|
||||
? $_POST["description"]
|
||||
: "",
|
||||
@ -117,7 +113,7 @@ function calculate_information($data)
|
||||
0,
|
||||
16
|
||||
);
|
||||
$event_start_date = str_replace("-", "", $data["startdate"]);
|
||||
$event_start_date = str_replace("-", "", strtok($data["startdate"], "T"));
|
||||
$apikey = getenv("GITEA_API_KEY");
|
||||
// Updated in the course of this function
|
||||
$filename = "";
|
||||
@ -444,11 +440,16 @@ function send_event_email(
|
||||
return $response;
|
||||
}
|
||||
|
||||
// Enable for debugging
|
||||
// ini_set('display_errors', '1');
|
||||
// ini_set('display_startup_errors', '1');
|
||||
// error_reporting(E_ALL);
|
||||
|
||||
if (
|
||||
isset($_POST["register_event"]) and
|
||||
empty($_POST["spam"]) and
|
||||
eval_date($_POST["startdate"]) and
|
||||
$_POST["startdate"] > "2023-01-01" and
|
||||
$_POST["startdate"] > date("Y-M-d", strtotime("-1 year", time())) and
|
||||
eval_date($_POST["enddate"]) || empty($_POST["enddate"]) and
|
||||
!stripos($_POST["email"], "example.com")
|
||||
) {
|
||||
|
@ -55,23 +55,23 @@
|
||||
(
|
||||
$group = 'past'
|
||||
and
|
||||
translate(@end,'-','') >= translate(/buildinfo/@date,'-','')
|
||||
translate(substring(@end,1,10),'-','') >= translate(/buildinfo/@date,'-','')
|
||||
)
|
||||
or
|
||||
(
|
||||
$group = 'current'
|
||||
and
|
||||
(
|
||||
translate(@start,'-','') > translate(/buildinfo/@date,'-','')
|
||||
translate(substring(@start,1,10),'-','') > translate(/buildinfo/@date,'-','')
|
||||
or
|
||||
translate(@end,'-','') < translate(/buildinfo/@date,'-','')
|
||||
translate(substring(@end,1,10),'-','') < translate(/buildinfo/@date,'-','')
|
||||
)
|
||||
)
|
||||
or
|
||||
(
|
||||
$group = 'future'
|
||||
and
|
||||
translate(@start,'-','') <= translate(/buildinfo/@date,'-','')
|
||||
translate(substring(@start,1,10),'-','') <= translate(/buildinfo/@date,'-','')
|
||||
)
|
||||
)
|
||||
]">
|
||||
|
@ -16,11 +16,11 @@
|
||||
|
||||
<!-- Create variables -->
|
||||
<xsl:variable name="start">
|
||||
<xsl:value-of select="translate (@start, '-', '')" />
|
||||
<xsl:value-of select="translate(translate(@start, '-', ''),':','')" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="end">
|
||||
<xsl:value-of select="translate (@end, '-', '')" />
|
||||
<xsl:value-of select="translate(translate(@end, '-', ''),':','')" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="link">
|
||||
@ -40,9 +40,9 @@
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="nl" />
|
||||
|
||||
<xsl:text>DTSTART;VALUE=DATE:</xsl:text><xsl:value-of select="$start" /><xsl:call-template name="nl" />
|
||||
<xsl:text>DTSTART;VALUE=DATE-TIME:</xsl:text><xsl:value-of select="$start" /><xsl:call-template name="nl" />
|
||||
<xsl:if test="not($start = $end)">
|
||||
<xsl:text>DTEND;VALUE=DATE:</xsl:text><xsl:value-of select="$end" /><xsl:call-template name="nl" />
|
||||
<xsl:text>DTEND;VALUE=DATE-TIME:</xsl:text><xsl:value-of select="$end" /><xsl:call-template name="nl" />
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text>URL:</xsl:text>
|
||||
@ -72,7 +72,7 @@
|
||||
<xsl:text>PRODID:fsfe.org/events/events.ics.xsl</xsl:text><xsl:call-template name="nl" />
|
||||
<!-- Future events -->
|
||||
<xsl:for-each select="/buildinfo/document/set/event[
|
||||
translate(@start, '-', '') >= translate(/buildinfo/@date, '-', '')
|
||||
translate(substring(@start,1,10), '-', '') >= translate(/buildinfo/@date, '-', '')
|
||||
]">
|
||||
<xsl:sort select="@start" order="descending" />
|
||||
<xsl:call-template name="event"/>
|
||||
|
@ -94,7 +94,7 @@
|
||||
|
||||
<!-- Event items -->
|
||||
<xsl:for-each select="/buildinfo/document/set/event[
|
||||
translate(@end, '-', '') >= translate(/buildinfo/@date, '-', '')
|
||||
translate(substring(@end,1,10), '-', '') >= translate(/buildinfo/@date, '-', '')
|
||||
]">
|
||||
<xsl:sort select="@start" />
|
||||
<xsl:if test="position() < 11">
|
||||
|
@ -119,6 +119,9 @@
|
||||
>Name der Veranstaltung<span class="star">*</span></label
|
||||
>
|
||||
<input name="title" value="" required="required" type="text" />
|
||||
<p class="help-block">
|
||||
Bitte beachte die Eingabezeiten sind in UTC
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
@ -129,8 +132,8 @@
|
||||
name="startdate"
|
||||
value=""
|
||||
required="required"
|
||||
type="date"
|
||||
placeholder="YYYY-MM-DD"
|
||||
type="datetime-local"
|
||||
placeholder="YYYY-MM-DD HH:MM"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
@ -138,8 +141,8 @@
|
||||
<input
|
||||
name="enddate"
|
||||
value=""
|
||||
type="date"
|
||||
placeholder="YYYY-MM-DD"
|
||||
type="datetime-local"
|
||||
placeholder="YYYY-MM-DD HH:MM"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
@ -217,7 +220,7 @@
|
||||
Bitte gib hier die Gruppe an, für die die Veranstaltung bestimmt ist.
|
||||
Wenn die Veranstaltung von keiner Gruppe getragen wird, wähle bitte
|
||||
keine aus. Wenn die lokale Gruppe hier nicht vertreten ist,
|
||||
kontaktiere uns bitte unter contact@fsfe.org. Diese Informationen
|
||||
kontaktiere uns bitte unter <email>contact@fsfe.org</email>. Diese Informationen
|
||||
werden verwendet, um die Veranstaltung automatisch zu den
|
||||
NextCloud-Kalendern der einzelnen Gruppen hinzuzufügen, deren Links
|
||||
auf der Gruppen-Seite zu finden sind.
|
||||
|
@ -110,6 +110,9 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p class="help-block">
|
||||
Please note input times are in UTC.
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
@ -120,8 +123,8 @@
|
||||
name="startdate"
|
||||
value=""
|
||||
required="required"
|
||||
type="date"
|
||||
placeholder="YYYY-MM-DD"
|
||||
type="datetime-local"
|
||||
placeholder="YYYY-MM-DD HH:MM"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
@ -129,8 +132,8 @@
|
||||
<input
|
||||
name="enddate"
|
||||
value=""
|
||||
type="date"
|
||||
placeholder="YYYY-MM-DD"
|
||||
type="datetime-local"
|
||||
placeholder="YYYY-MM-DD HH:MM"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
@ -243,7 +246,7 @@
|
||||
<p class="help-block">
|
||||
Please indicate the group the event is intended for here. If the event
|
||||
is not for a group, then please select none. If the local group is not
|
||||
represented here, please contact us at contact@fsfe.org. This
|
||||
represented here, please contact us at <email>contact@fsfe.org</email>. This
|
||||
information is used to automatically add it to the nextcloud calendars
|
||||
for each group, links to which can be found on the groups page.
|
||||
</p>
|
||||
|
@ -117,6 +117,10 @@
|
||||
>Titolo dell'evento<span class="star">*</span></label
|
||||
>
|
||||
<input name="title" value="" required="required" type="text" />
|
||||
|
||||
<p class="help-block">
|
||||
Si prega di notare che i tempi di entrata sono in UTC.
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
@ -127,8 +131,8 @@
|
||||
name="startdate"
|
||||
value=""
|
||||
required="required"
|
||||
type="date"
|
||||
placeholder="YYYY-MM-DD"
|
||||
type="datetime-local"
|
||||
placeholder="YYYY-MM-DD HH:MM"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
@ -136,8 +140,8 @@
|
||||
<input
|
||||
name="enddate"
|
||||
value=""
|
||||
type="date"
|
||||
placeholder="YYYY-MM-DD"
|
||||
type="datetime-local"
|
||||
placeholder="YYYY-MM-DD HH:MM"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
@ -203,7 +207,7 @@
|
||||
<p class="help-block">
|
||||
Indicare qui il gruppo a cui è destinato l'evento. Se l'evento non è
|
||||
destinato a un gruppo, selezionare nessuno. Se il gruppo locale non è
|
||||
elencato, contattateci all'indirizzo contact@fsfe.org. Queste
|
||||
elencato, contattateci all'indirizzo <email>contact@fsfe.org</email>. Queste
|
||||
informazioni vengono utilizzate per aggiungere automaticamente
|
||||
l'evento ai calendari NextCloud di ciascun gruppo, i cui link si
|
||||
trovano nella pagina dei gruppi.
|
||||
|
@ -104,6 +104,9 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p class="help-block">
|
||||
De invoertijden zijn in UTC.
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
@ -120,8 +123,8 @@
|
||||
name="startdate"
|
||||
value=""
|
||||
required="required"
|
||||
type="date"
|
||||
placeholder="YYYY-MM-DD"
|
||||
type="datetime-local"
|
||||
placeholder="YYYY-MM-DD HH:MM"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
@ -129,8 +132,8 @@
|
||||
<input
|
||||
name="enddate"
|
||||
value=""
|
||||
type="date"
|
||||
placeholder="YYYY-MM-DD"
|
||||
type="datetime-local"
|
||||
placeholder="YYYY-MM-DD HH:MM"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
@ -251,7 +254,7 @@
|
||||
Geef hier alstublieft aan voor welke groep het evenement bedoeld is.
|
||||
Als het evenement niet voor een groep bedoeld is, kies dan geen. Als
|
||||
de lokale groep hier niet vertegenwoordigd is, neem dan contact met
|
||||
ons op via contact@fsfe.org. Deze informatie wordt gebruikt om het
|
||||
ons op via <email>contact@fsfe.org</email>. Deze informatie wordt gebruikt om het
|
||||
automatisch toe te voegen aan de NextCloud-kalenders voor elke groep.
|
||||
De links daarvan zijn te vinden zijn op de groepenpagina.
|
||||
</p>
|
||||
|
@ -138,7 +138,7 @@
|
||||
|
||||
<xsl:template match="dynamic-content-events">
|
||||
<xsl:for-each select="/buildinfo/document/set/event[
|
||||
translate (@end, '-', '') >= translate (/buildinfo/@date, '-', '')
|
||||
translate (substring(@end,1,10), '-', '') >= translate (/buildinfo/@date, '-', '')
|
||||
]">
|
||||
<xsl:sort select="@start"/>
|
||||
<xsl:if test="position() <= 3">
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
<p>You probably shouldn't be here.</p>
|
||||
|
||||
<p>Please check you have correctly filled in the form. In particular, dates have to be in the YYYY-MM-DD format.</p>
|
||||
<p>Please check you have correctly filled in the form. In particular, dates have to be in the YYYY-MM-DD HH:MM format.</p>
|
||||
|
||||
|
||||
</body>
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
<p>U zou hier waarschijnlijk niet moeten zijn.</p>
|
||||
|
||||
<p>Controleer alstublieft uw ingevulde formulier, in het bijzonder dat de data in het JJJJ-MM-DD formaat zijn opgesteld.</p>
|
||||
<p>Controleer alstublieft uw ingevulde formulier, in het bijzonder dat de data in het JJJJ-MM-DD UU:MM formaat zijn opgesteld.</p>
|
||||
|
||||
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user