Update on v1.0.1 (beta for next version)

Here's an update on the current version, which includes changes towards the next release still in beta.
This commit is contained in:
Robot 2023-08-10 06:49:04 +02:00
parent 1bc02180e3
commit 7419e920bc
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
6 changed files with 27 additions and 82 deletions

View File

@ -175,19 +175,19 @@ class ModVersion_Calendar_svgHelper
public function state(stdClass $branch): ?string
{
$initial = new DateTime($branch->start);
$bug = new DateTime($branch->bug);
$security = new DateTime($branch->end);
$security = new DateTime($branch->security);
$end = new DateTime($branch->end);
if ($initial && $bug && $security)
if ($initial && $security)
{
$now = new DateTime;
if ($now >= $security)
if ($now >= $end)
{
return 'eol';
}
if ($now >= $bug)
if ($security && $now >= $security)
{
return 'security';
}

View File

@ -29,7 +29,7 @@ MOD_VERSION_CALENDAR_SVG_VERSION_MESSAGE="Error! Please add version here."
MOD_VERSION_CALENDAR_SVG_VERSION_HINT="1.0.0"
MOD_VERSION_CALENDAR_SVG_START_LABEL="Start Date"
MOD_VERSION_CALENDAR_SVG_START_MESSAGE="Error! Please add date here."
MOD_VERSION_CALENDAR_SVG_BUG_LABEL="Bug Date"
MOD_VERSION_CALENDAR_SVG_BUG_MESSAGE="Error! Please add date here."
MOD_VERSION_CALENDAR_SVG_SECURITY_LABEL="Security Support Date"
MOD_VERSION_CALENDAR_SVG_SECURITY_MESSAGE="Error! Please add date here."
MOD_VERSION_CALENDAR_SVG_END_LABEL="End Date"
MOD_VERSION_CALENDAR_SVG_END_MESSAGE="Error! Please add date here."

View File

@ -29,7 +29,7 @@ MOD_VERSION_CALENDAR_SVG_VERSION_MESSAGE="Error! Please add version here."
MOD_VERSION_CALENDAR_SVG_VERSION_HINT="1.0.0"
MOD_VERSION_CALENDAR_SVG_START_LABEL="Start Date"
MOD_VERSION_CALENDAR_SVG_START_MESSAGE="Error! Please add date here."
MOD_VERSION_CALENDAR_SVG_BUG_LABEL="Bug Date"
MOD_VERSION_CALENDAR_SVG_BUG_MESSAGE="Error! Please add date here."
MOD_VERSION_CALENDAR_SVG_SECURITY_LABEL="Security Support Date"
MOD_VERSION_CALENDAR_SVG_SECURITY_MESSAGE="Error! Please add date here."
MOD_VERSION_CALENDAR_SVG_END_LABEL="End Date"
MOD_VERSION_CALENDAR_SVG_END_MESSAGE="Error! Please add date here."

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="4" client="site" method="upgrade">
<name>MOD_VERSION_CALENDAR_SVG</name>
<creationDate>21st September, 2022</creationDate>
<creationDate>10th August, 2023</creationDate>
<author>Joomla! Project</author>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>http://www.joomla.org</authorUrl>
@ -51,7 +51,7 @@
min="10"
max="80"
step="1"
validate="int"
validate="number"
/>
<!-- Branch_height Field. Type: Number. (joomla) -->
<field
@ -64,7 +64,7 @@
min="20"
max="100"
step="5"
validate="int"
validate="number"
/>
<!-- Margin_right Field. Type: Number. (joomla) -->
<field
@ -77,7 +77,7 @@
min="20"
max="100"
step="5"
validate="int"
validate="number"
/>
<!-- Margin_left Field. Type: Number. (joomla) -->
<field
@ -90,7 +90,7 @@
min="40"
max="140"
step="5"
validate="int"
validate="number"
/>
<!-- Year_width Field. Type: Number. (joomla) -->
<field
@ -103,7 +103,7 @@
min="50"
max="300"
step="5"
validate="int"
validate="number"
/>
<!-- Footer_height Field. Type: Number. (joomla) -->
<field
@ -116,7 +116,7 @@
min="10"
max="80"
step="1"
validate="int"
validate="number"
/>
</fieldset>
<!-- default paths of style fieldset points to the module -->
@ -221,7 +221,7 @@
min="1"
max="20"
step="1"
validate="int"
validate="number"
/>
<!-- Min_years Field. Type: Number. (joomla) -->
<field
@ -234,7 +234,7 @@
min="1"
max="10"
step="1"
validate="int"
validate="number"
/>
<!-- Dates Field. Type: Subform. (joomla) -->
<field
@ -274,16 +274,16 @@
size="40"
required="true"
/>
<!-- Bug Field. Type: Calendar. (joomla) -->
<!-- Security Field. Type: Calendar. (joomla) -->
<field
type="calendar"
name="bug"
label="MOD_VERSION_CALENDAR_SVG_BUG_LABEL"
name="security"
label="MOD_VERSION_CALENDAR_SVG_SECURITY_LABEL"
format="%d-%m-%Y"
filter="CMD"
message="MOD_VERSION_CALENDAR_SVG_BUG_MESSAGE"
message="MOD_VERSION_CALENDAR_SVG_SECURITY_MESSAGE"
size="40"
required="true"
required="false"
/>
<!-- End Field. Type: Calendar. (joomla) -->
<field

View File

@ -1,55 +0,0 @@
<?php
/**
* @package Joomla.CMS
* @maintainer Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
*
* @created 29th July, 2020
* @copyright (C) 2020 Open Source Matters, Inc. <http://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormRule;
use Joomla\Registry\Registry;
/**
* Form Rule (Int) class for the Joomla Platform.
*/
class JFormRuleInt extends FormRule
{
/**
* Method to test that an integer value was added.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
* @param Form $form The form object for which the field is being tested.
*
* @return boolean True if the value is valid integer, false otherwise.
*
*/
public function test(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null)
{
// Check if the field is required.
$required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required');
// If the value is empty and the field is not required return True.
if (($value === '' || $value === null) && ! $required)
{
return true;
}
// now validate the value to be an integer
// we need to validate a string with the integer in it
// since this is how Joomla passes the value to the test method
// so we use type coercion along with is_numeric
return is_numeric($value) && is_int(+$value);
// if you have a better idea... lets hear it.
}
}

View File

@ -90,13 +90,13 @@ defined('_JEXEC') or die('Restricted access');
<?php foreach ($branches as $branch): ?>
<?php
$x_release = $helper->coordinates(new DateTime($branch->start));
$x_bug = $helper->coordinates(new DateTime($branch->bug));
$x_eol = $helper->coordinates(new DateTime($branch->end));
$x_security = (empty($branch->security)) ? $x_eol : $helper->coordinates(new DateTime($branch->security));
?>
<rect class="stable" x="<?php echo $x_release; ?>" y="<?php echo $branch->top; ?>"
width="<?php echo $x_bug - $x_release; ?>" height="<?php echo $params->get('branch_height', 30); ?>"/>
<rect class="security" x="<?php echo $x_bug; ?>" y="<?php echo $branch->top; ?>"
width="<?php echo $x_eol - $x_bug; ?>" height="<?php echo $params->get('branch_height', 30); ?>"/>
width="<?php echo $x_security - $x_release; ?>" height="<?php echo $params->get('branch_height', 30); ?>"/>
<rect class="security" x="<?php echo $x_security; ?>" y="<?php echo $branch->top; ?>"
width="<?php echo $x_eol - $x_security; ?>" height="<?php echo $params->get('branch_height', 30); ?>"/>
<?php endforeach; ?>
</g>