diff --git a/README.md b/README.md index 545e3db..f86ecdd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Version Calendar in SVG (1.0.2) +# Version Calendar in SVG (2.0.1) > The original source code was taken from the [PHP supported versions](https://github.com/php/web-php/blob/master/images/supported-versions.php). @@ -8,6 +8,6 @@ + *Author*: [Joomla! Project](mailto:admin@joomla.org) + *Name*: [Version Calendar svg](http://www.joomla.org) + *First Build*: 3rd September, 2022 -+ *Version*: 1.0.2 ++ *Version*: 2.0.1 + *Copyright*: (C) 2022 Open Source Matters, Inc. + *License*: GNU General Public License version 2 or later; see LICENSE.txt \ No newline at end of file diff --git a/helper.php b/helper.php index cb953ba..0bd62ef 100644 --- a/helper.php +++ b/helper.php @@ -39,6 +39,14 @@ class ModVersion_Calendar_svgHelper */ protected $branches; + /** + * The Legend + * + * @var array + * @since 1.0 + */ + protected $legend; + /** * The Width * @@ -132,72 +140,102 @@ class ModVersion_Calendar_svgHelper /** * Get Branches * + * Fetches and processes the branches or versions from the parameters. + * It sanitizes the branch data, calculates their positions, sorts them, and then returns. + * If no valid branches or versions are found, it throws an exception. + * * @return array - * @since 1.0.0 + * + * @since 2.0.1 + * @throws Exception If no valid branches or versions are found. */ public function branches(): array { if (empty($this->branches)) { - $branches = (array) $this->params->get('dates', null); + $branches = (array) $this->params->get('versions'); - if (is_array($branches) && count($branches) > 0) + if (empty($branches)) { - $branch_height = $this->params->get('branch_height', 30); - $header_height = $this->params->get('header_height', 24); - - $i = 0; - - foreach ($branches as $k => &$branch) - { - $branch->top = $header_height + ($branch_height * $i++); - } - - $this->branches = $branches; + throw new Exception("No versions found."); } - else + $this->sanitize($branches); + + if (empty($branches)) { - // we should add exception here + throw new Exception("No versions found."); } + + $this->setTop($branches); + $this->sort($branches); + + $this->branches = $branches; } return $this->branches; } + /** + * Get Legend values (by color) + * + * @return array + * @since 2.0.1 + */ + public function legend(): array + { + if (empty($this->legend)) + { + $branches = $this->branches(); + + foreach ($branches as $version) + { + foreach ($version->dates as $date) + { + $this->legend[$date->color] = $date; + } + } + } + + return $this->legend; + } + /** * Current state of a branch * - * @param stdClass $branch The branch values + * @param array $dates The branch dates * * @return string|null - * @since 1.0.0 + * @since 2.0.1 */ - public function state(stdClass $branch): ?string + public function state(array $dates): ?string { - $initial = new DateTime($branch->start); - $security = new DateTime($branch->security); - $end = new DateTime($branch->end); + // Determine the current state. + $now = new DateTime(); - if ($initial && $security) + // Check if today's date is before the earliest start date. + $earliestDate = DateTime::createFromFormat('d-m-Y', $dates[0]->start); + if ($now < $earliestDate) { - $now = new DateTime; + return 'vcs-future'; + } - if ($now >= $end) + // Check if today's date is after the latest end date. + $latestDate = DateTime::createFromFormat('d-m-Y', end($dates)->end); + if ($now > $latestDate) + { + return 'vcs-eol'; + } + + // Determine which state the current date falls under. + foreach ($dates as $date) + { + $initial = DateTime::createFromFormat('d-m-Y', $date->start); + $end = DateTime::createFromFormat('d-m-Y', $date->end); + + if ($now >= $initial && $now <= $end) { - return 'eol'; + return $date->state; } - - if ($security && $now >= $security) - { - return 'security'; - } - - if ($now >= $initial) - { - return 'stable'; - } - - return 'future'; } return null; @@ -251,5 +289,120 @@ class ModVersion_Calendar_svgHelper (365.24 / $this->params->get('year_width', 120)) ); } - + + /** + * Sort Branches state's by date + * + * @param array $branches The branches + * + * @return void + * @since 2.0.1 + */ + protected function sort(array &$branches): void + { + foreach ($branches as $key => &$branch) + { + usort($branch->dates, function($a, $b) { + $startDateA = DateTime::createFromFormat('d-m-Y', $a->start); + $startDateB = DateTime::createFromFormat('d-m-Y', $b->start); + + if ($startDateA == $startDateB) + { + $endDateA = DateTime::createFromFormat('d-m-Y', $a->end); + $endDateB = DateTime::createFromFormat('d-m-Y', $b->end); + return $endDateA <=> $endDateB; + } + + return $startDateA <=> $startDateB; + }); + } + } + + /** + * Set Top + * + * Calculates the top position for each branch based on parameters for branch height and header height. + * + * @param array $branches Reference to the branches array. + * + * @return void + * @since 2.0.1 + */ + protected function setTop(array &$branches): void + { + $branch_height = $this->params->get('branch_height', 30); + $header_height = $this->params->get('header_height', 24); + + $i = 0; + foreach ($branches as $key => &$branch) + { + $branch->top = $header_height + ($branch_height * $i++); + } + } + + /** + * Sanitize + * + * Sanitizes the branches by checking the existence and type of 'dates' and 'date->state'. + * Also modifies the state of each date entry within a branch. + * + * @param array $branches Reference to the branches array. + * + * @return void + * @since 2.0.1 + */ + protected function sanitize(array &$branches): void + { + foreach ($branches as $key => &$branch) + { + if (empty($branch->dates) || !is_object($branch->dates)) + { + unset($branches[$key]); + continue; + } + + $branch->dates = (array) $branch->dates; + + $remove = false; + foreach ($branch->dates as $k => &$date) + { + if (empty($date->state)) + { + $remove = true; + continue; + } + $date->state = $this->makeSafe($key . '-' . $date->state); + } + + if ($remove) + { + unset($branches[$key]); + } + } + } + + /** + * Get css safe class name + * + * @param string $name The string to make safe + * + * @return string + * @since 2.0.1 + */ + protected function makeSafe(string $name): string + { + // Ensure it doesn't start with a digit + if (preg_match('/^[0-9]/', $name)) + { + $name = 'vcs-' . $name; + } + + // Replace any non-alphanumeric characters with hyphens + $name = preg_replace('/[^a-zA-Z0-9]+/', '-', $name); + + // Convert to lowercase + $name = strtolower($name); + + return $name; + } } diff --git a/language/en-GB/en-GB.mod_version_calendar_svg.ini b/language/en-GB/en-GB.mod_version_calendar_svg.ini index 636cee7..b5aa66d 100644 --- a/language/en-GB/en-GB.mod_version_calendar_svg.ini +++ b/language/en-GB/en-GB.mod_version_calendar_svg.ini @@ -1,33 +1,29 @@ MOD_VERSION_CALENDAR_SVG="Version Calendar Svg" MOD_VERSION_CALENDAR_SVG_DESCRIPTION="Version Calendar in SVG" -MOD_VERSION_CALENDAR_SVG_XML_DESCRIPTION="

Version Calendar Svg (v.1.0.2)

Version Calendar in SVG

Created by Joomla! Project
Development started 3rd September, 2022

" +MOD_VERSION_CALENDAR_SVG_XML_DESCRIPTION="

Version Calendar Svg (v.2.0.1)

Version Calendar in SVG

Created by Joomla! Project
Development started 3rd September, 2022

" +MOD_VERSION_CALENDAR_SVG_TODAY="Today" MOD_VERSION_CALENDAR_SVG_PLANNED_RELEASE_SCHEDULE="Planned release schedule" MOD_VERSION_CALENDAR_SVG_FUTURE_RELEASES="Future Releases" -MOD_VERSION_CALENDAR_SVG_STABLE_RELEASE_SCHEDULE_EXPECT_FULL_SUPPORT_AND_UPDATES="Stable release schedule - expect full support and updates" -MOD_VERSION_CALENDAR_SVG_STABLE_RELEASE="Stable Release" -MOD_VERSION_CALENDAR_SVG_SECURITY_SCHEDULE_EXPECT_ONLY_SECURITY_UPDATES="Security schedule - expect only security updates" -MOD_VERSION_CALENDAR_SVG_SECURITY_RELEASE="Security Release" MOD_VERSION_CALENDAR_SVG_VERSION_END_OF_LIFE_SCHEDULE_EXPECT_NO_MORE_SUPPORT="Version End of Life schedule - expect no more support" MOD_VERSION_CALENDAR_SVG_VERSION_AT_END_OF_LIFE="Version at End of Life" MOD_VERSION_CALENDAR_SVG_DIMENTIONS="Dimentions" MOD_VERSION_CALENDAR_SVG_STYLES="Styles" -MOD_VERSION_CALENDAR_SVG_DATES="Dates" +MOD_VERSION_CALENDAR_SVG_VERSIONS="Versions" MOD_VERSION_CALENDAR_SVG_HEADER_HEIGHT_LABEL="Header Height" MOD_VERSION_CALENDAR_SVG_BRANCH_HEIGHT_LABEL="Branch Height" MOD_VERSION_CALENDAR_SVG_MARGIN_RIGHT_LABEL="Margin Right" MOD_VERSION_CALENDAR_SVG_MARGIN_LEFT_LABEL="Margin Left" MOD_VERSION_CALENDAR_SVG_YEAR_WIDTH_LABEL="Year Width" MOD_VERSION_CALENDAR_SVG_FOOTER_HEIGHT_LABEL="Footer Height" -MOD_VERSION_CALENDAR_SVG_TEXT_COLOR_LABEL="Default Text Color" -MOD_VERSION_CALENDAR_SVG_FUTURE_COLOR_LABEL="Future Background Color" -MOD_VERSION_CALENDAR_SVG_STABLE_COLOR_LABEL="Stable Background Color" -MOD_VERSION_CALENDAR_SVG_SECURITY_COLOR_LABEL="Security Background Color" -MOD_VERSION_CALENDAR_SVG_END_OF_LIFE_COLOR_LABEL="End of Life Background Color" -MOD_VERSION_CALENDAR_SVG_END_OF_LIFE_TEXT_COLOR_LABEL="End of Life Text Color" -MOD_VERSION_CALENDAR_SVG_YEARS_LINE_COLOR_LABEL="Years Line Color" -MOD_VERSION_CALENDAR_SVG_YEARS_TEXT_COLOR_LABEL="Years Text Color" -MOD_VERSION_CALENDAR_SVG_TODAY_LINE_COLOR_LABEL="Today Line Color" -MOD_VERSION_CALENDAR_SVG_TODAY_TEXT_COLOR_LABEL="Today Text Color" +MOD_VERSION_CALENDAR_SVG_TEXT_COLOR_LABEL="Default Text Colour" +MOD_VERSION_CALENDAR_SVG_FUTURE_TEXT_COLOR_LABEL="Future Text Colour" +MOD_VERSION_CALENDAR_SVG_FUTURE_COLOR_LABEL="Future Background Colour" +MOD_VERSION_CALENDAR_SVG_END_OF_LIFE_TEXT_COLOR_LABEL="End of Life Text Colour" +MOD_VERSION_CALENDAR_SVG_END_OF_LIFE_COLOR_LABEL="End of Life Background Colour" +MOD_VERSION_CALENDAR_SVG_YEARS_LINE_COLOR_LABEL="Years Line Colour" +MOD_VERSION_CALENDAR_SVG_YEARS_TEXT_COLOR_LABEL="Years Text Colour" +MOD_VERSION_CALENDAR_SVG_TODAY_LINE_COLOR_LABEL="Today Line Colour" +MOD_VERSION_CALENDAR_SVG_TODAY_TEXT_COLOR_LABEL="Today Text Colour" MOD_VERSION_CALENDAR_SVG_SHOW_LEGEND_LABEL="Show Legend" MOD_VERSION_CALENDAR_SVG_SHOW_LEGEND_DESCRIPTION="Allow the legend to be shown below the calendar." MOD_VERSION_CALENDAR_SVG_YES="Yes" @@ -36,14 +32,21 @@ MOD_VERSION_CALENDAR_SVG_LEGEND_BACKGROUND_COLOR_LABEL="Legend Background Colour MOD_VERSION_CALENDAR_SVG_LEGEND_TEXT_COLOR_LABEL="Legend Text Colour" MOD_VERSION_CALENDAR_SVG_MAX_YEARS_LABEL="Max Years" MOD_VERSION_CALENDAR_SVG_MIN_YEARS_LABEL="Min Years" -MOD_VERSION_CALENDAR_SVG_DATES_LABEL="Dates" +MOD_VERSION_CALENDAR_SVG_VERSIONS_LABEL="Versions" MOD_VERSION_CALENDAR_SVG_VERSION_LABEL="Version" MOD_VERSION_CALENDAR_SVG_VERSION_DESCRIPTION="Name" MOD_VERSION_CALENDAR_SVG_VERSION_MESSAGE="Error! Please add version here." MOD_VERSION_CALENDAR_SVG_VERSION_HINT="1.0.0" +MOD_VERSION_CALENDAR_SVG_DATES_LABEL="Dates" +MOD_VERSION_CALENDAR_SVG_STATE_LABEL="State" +MOD_VERSION_CALENDAR_SVG_STATE_HINT="stable" +MOD_VERSION_CALENDAR_SVG_LABEL_LABEL="Label" +MOD_VERSION_CALENDAR_SVG_LABEL_HINT="State label" +MOD_VERSION_CALENDAR_SVG_DESCRIPTION_LABEL="Description" +MOD_VERSION_CALENDAR_SVG_DESCRIPTION_HINT="Describe the state" +MOD_VERSION_CALENDAR_SVG_COLOR_LABEL="Background" +MOD_VERSION_CALENDAR_SVG_COLOR_DESCRIPTION="Color" MOD_VERSION_CALENDAR_SVG_START_LABEL="Start Date" MOD_VERSION_CALENDAR_SVG_START_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." \ No newline at end of file diff --git a/language/en-GB/en-GB.mod_version_calendar_svg.sys.ini b/language/en-GB/en-GB.mod_version_calendar_svg.sys.ini index 636cee7..b5aa66d 100644 --- a/language/en-GB/en-GB.mod_version_calendar_svg.sys.ini +++ b/language/en-GB/en-GB.mod_version_calendar_svg.sys.ini @@ -1,33 +1,29 @@ MOD_VERSION_CALENDAR_SVG="Version Calendar Svg" MOD_VERSION_CALENDAR_SVG_DESCRIPTION="Version Calendar in SVG" -MOD_VERSION_CALENDAR_SVG_XML_DESCRIPTION="

Version Calendar Svg (v.1.0.2)

Version Calendar in SVG

Created by Joomla! Project
Development started 3rd September, 2022

" +MOD_VERSION_CALENDAR_SVG_XML_DESCRIPTION="

Version Calendar Svg (v.2.0.1)

Version Calendar in SVG

Created by Joomla! Project
Development started 3rd September, 2022

" +MOD_VERSION_CALENDAR_SVG_TODAY="Today" MOD_VERSION_CALENDAR_SVG_PLANNED_RELEASE_SCHEDULE="Planned release schedule" MOD_VERSION_CALENDAR_SVG_FUTURE_RELEASES="Future Releases" -MOD_VERSION_CALENDAR_SVG_STABLE_RELEASE_SCHEDULE_EXPECT_FULL_SUPPORT_AND_UPDATES="Stable release schedule - expect full support and updates" -MOD_VERSION_CALENDAR_SVG_STABLE_RELEASE="Stable Release" -MOD_VERSION_CALENDAR_SVG_SECURITY_SCHEDULE_EXPECT_ONLY_SECURITY_UPDATES="Security schedule - expect only security updates" -MOD_VERSION_CALENDAR_SVG_SECURITY_RELEASE="Security Release" MOD_VERSION_CALENDAR_SVG_VERSION_END_OF_LIFE_SCHEDULE_EXPECT_NO_MORE_SUPPORT="Version End of Life schedule - expect no more support" MOD_VERSION_CALENDAR_SVG_VERSION_AT_END_OF_LIFE="Version at End of Life" MOD_VERSION_CALENDAR_SVG_DIMENTIONS="Dimentions" MOD_VERSION_CALENDAR_SVG_STYLES="Styles" -MOD_VERSION_CALENDAR_SVG_DATES="Dates" +MOD_VERSION_CALENDAR_SVG_VERSIONS="Versions" MOD_VERSION_CALENDAR_SVG_HEADER_HEIGHT_LABEL="Header Height" MOD_VERSION_CALENDAR_SVG_BRANCH_HEIGHT_LABEL="Branch Height" MOD_VERSION_CALENDAR_SVG_MARGIN_RIGHT_LABEL="Margin Right" MOD_VERSION_CALENDAR_SVG_MARGIN_LEFT_LABEL="Margin Left" MOD_VERSION_CALENDAR_SVG_YEAR_WIDTH_LABEL="Year Width" MOD_VERSION_CALENDAR_SVG_FOOTER_HEIGHT_LABEL="Footer Height" -MOD_VERSION_CALENDAR_SVG_TEXT_COLOR_LABEL="Default Text Color" -MOD_VERSION_CALENDAR_SVG_FUTURE_COLOR_LABEL="Future Background Color" -MOD_VERSION_CALENDAR_SVG_STABLE_COLOR_LABEL="Stable Background Color" -MOD_VERSION_CALENDAR_SVG_SECURITY_COLOR_LABEL="Security Background Color" -MOD_VERSION_CALENDAR_SVG_END_OF_LIFE_COLOR_LABEL="End of Life Background Color" -MOD_VERSION_CALENDAR_SVG_END_OF_LIFE_TEXT_COLOR_LABEL="End of Life Text Color" -MOD_VERSION_CALENDAR_SVG_YEARS_LINE_COLOR_LABEL="Years Line Color" -MOD_VERSION_CALENDAR_SVG_YEARS_TEXT_COLOR_LABEL="Years Text Color" -MOD_VERSION_CALENDAR_SVG_TODAY_LINE_COLOR_LABEL="Today Line Color" -MOD_VERSION_CALENDAR_SVG_TODAY_TEXT_COLOR_LABEL="Today Text Color" +MOD_VERSION_CALENDAR_SVG_TEXT_COLOR_LABEL="Default Text Colour" +MOD_VERSION_CALENDAR_SVG_FUTURE_TEXT_COLOR_LABEL="Future Text Colour" +MOD_VERSION_CALENDAR_SVG_FUTURE_COLOR_LABEL="Future Background Colour" +MOD_VERSION_CALENDAR_SVG_END_OF_LIFE_TEXT_COLOR_LABEL="End of Life Text Colour" +MOD_VERSION_CALENDAR_SVG_END_OF_LIFE_COLOR_LABEL="End of Life Background Colour" +MOD_VERSION_CALENDAR_SVG_YEARS_LINE_COLOR_LABEL="Years Line Colour" +MOD_VERSION_CALENDAR_SVG_YEARS_TEXT_COLOR_LABEL="Years Text Colour" +MOD_VERSION_CALENDAR_SVG_TODAY_LINE_COLOR_LABEL="Today Line Colour" +MOD_VERSION_CALENDAR_SVG_TODAY_TEXT_COLOR_LABEL="Today Text Colour" MOD_VERSION_CALENDAR_SVG_SHOW_LEGEND_LABEL="Show Legend" MOD_VERSION_CALENDAR_SVG_SHOW_LEGEND_DESCRIPTION="Allow the legend to be shown below the calendar." MOD_VERSION_CALENDAR_SVG_YES="Yes" @@ -36,14 +32,21 @@ MOD_VERSION_CALENDAR_SVG_LEGEND_BACKGROUND_COLOR_LABEL="Legend Background Colour MOD_VERSION_CALENDAR_SVG_LEGEND_TEXT_COLOR_LABEL="Legend Text Colour" MOD_VERSION_CALENDAR_SVG_MAX_YEARS_LABEL="Max Years" MOD_VERSION_CALENDAR_SVG_MIN_YEARS_LABEL="Min Years" -MOD_VERSION_CALENDAR_SVG_DATES_LABEL="Dates" +MOD_VERSION_CALENDAR_SVG_VERSIONS_LABEL="Versions" MOD_VERSION_CALENDAR_SVG_VERSION_LABEL="Version" MOD_VERSION_CALENDAR_SVG_VERSION_DESCRIPTION="Name" MOD_VERSION_CALENDAR_SVG_VERSION_MESSAGE="Error! Please add version here." MOD_VERSION_CALENDAR_SVG_VERSION_HINT="1.0.0" +MOD_VERSION_CALENDAR_SVG_DATES_LABEL="Dates" +MOD_VERSION_CALENDAR_SVG_STATE_LABEL="State" +MOD_VERSION_CALENDAR_SVG_STATE_HINT="stable" +MOD_VERSION_CALENDAR_SVG_LABEL_LABEL="Label" +MOD_VERSION_CALENDAR_SVG_LABEL_HINT="State label" +MOD_VERSION_CALENDAR_SVG_DESCRIPTION_LABEL="Description" +MOD_VERSION_CALENDAR_SVG_DESCRIPTION_HINT="Describe the state" +MOD_VERSION_CALENDAR_SVG_COLOR_LABEL="Background" +MOD_VERSION_CALENDAR_SVG_COLOR_DESCRIPTION="Color" MOD_VERSION_CALENDAR_SVG_START_LABEL="Start Date" MOD_VERSION_CALENDAR_SVG_START_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." \ No newline at end of file diff --git a/mod_version_calendar_svg.php b/mod_version_calendar_svg.php index df2f96c..b83c5b7 100644 --- a/mod_version_calendar_svg.php +++ b/mod_version_calendar_svg.php @@ -14,17 +14,25 @@ defined('_JEXEC') or die('Restricted access'); // Include the helper functions only once JLoader::register('ModVersion_Calendar_svgHelper', __DIR__ . '/helper.php'); -// Get the Helper class -$helper = new ModVersion_Calendar_svgHelper($params); +try +{ + // Get the Helper class + $helper = new ModVersion_Calendar_svgHelper($params); -// set the branches -$branches = $helper->branches(); + // set the branches + $branches = $helper->branches(); -// set branch qty -$qty = count($branches); + // set branch qty + $qty = count($branches); -// get the module class sfx (local) -$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8'); + // get the module class sfx (local) + $moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8'); -// load the default Tmpl -require JModuleHelper::getLayoutPath('mod_version_calendar_svg', $params->get('layout', 'default')); + // load the default Tmpl + require JModuleHelper::getLayoutPath('mod_version_calendar_svg', $params->get('layout', 'default')); +} +catch (Exception $e) +{ + // Output a warning message along with the exception message + echo "Warning: " . $e->getMessage(); +} diff --git a/mod_version_calendar_svg.xml b/mod_version_calendar_svg.xml index 086354d..51eafa4 100644 --- a/mod_version_calendar_svg.xml +++ b/mod_version_calendar_svg.xml @@ -1,13 +1,13 @@ MOD_VERSION_CALENDAR_SVG - 10th August, 2023 + 11th August, 2023 Joomla! Project admin@joomla.org http://www.joomla.org (C) 2020 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt - 1.0.2 + 2.0.1 MOD_VERSION_CALENDAR_SVG_XML_DESCRIPTION @@ -132,6 +132,14 @@ label="MOD_VERSION_CALENDAR_SVG_TEXT_COLOR_LABEL" required="true" /> + + - + - - @@ -164,14 +164,6 @@ label="MOD_VERSION_CALENDAR_SVG_END_OF_LIFE_COLOR_LABEL" required="true" /> - - - -
+
@@ -266,18 +258,18 @@ step="1" validate="number" /> - + -
diff --git a/tmpl/default.php b/tmpl/default.php index d71bd82..ee4a669 100644 --- a/tmpl/default.php +++ b/tmpl/default.php @@ -21,50 +21,53 @@ defined('_JEXEC') or die('Restricted access'); font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; font-size: get('header_height', 24); ?>px; } - g.future rect, - .branches rect.future { - fill: get('future_color', '#000'); ?>; + g.vcs-future rect, + .vcs-branches rect.vcs-future { + fill: get('future_color', '#5091cd'); ?>; } - g.eol rect, - .branches rect.eol { + g.vcs-future text { + fill: get('future_text_color', '#fff'); ?>; + } + g.vcs-eol rect, + .vcs-branches rect.vcs-eol { fill: get('end_of_life_color', '#f33'); ?>; } - g.eol text { + g.vcs-eol text { fill: get('end_of_life_text_color', '#fff'); ?>; } - g.security rect, - .branches rect.security { - fill: get('security_color', '#f93'); ?>; - } - g.stable rect, - .branches rect.stable { - fill: get('stable_color', '#9c9'); ?>; - } - .branch-labels text { + + dates as $date): ?> + g.state; ?> rect, + .vcs-branches rect.state; ?> { + fill: color; ?>; + } + + + .vcs-branch-labels text { dominant-baseline: central; text-anchor: middle; } - .today line { + .vcs-today line { stroke: get('today_line_color', '#f33'); ?>; stroke-dasharray: 7, 7; stroke-width: 3px; } - .today text { + .vcs-today text { fill: get('today_text_color', '#f33'); ?>; text-anchor: middle; } - .years line { + .vcs-years line { stroke: get('years_line_color', '#000'); ?>; } - .years text { + .vcs-years text { fill: get('years_text_color', '#000'); ?>; text-anchor: middle; } - - - + + $branch): ?> + @@ -74,21 +77,31 @@ defined('_JEXEC') or die('Restricted access'); - - + + $version): ?> coordinates(new DateTime($branch->start)); - $x_eol = $helper->coordinates(new DateTime($branch->end)); - $x_security = (empty($branch->security)) ? $x_eol : $helper->coordinates(new DateTime($branch->security)); + $y = $version->top; + $height = $params->get('branch_height', 30); ?> - - + dates as $date): ?> + coordinates(new DateTime($date->start)); + $x_end = $helper->coordinates(new DateTime($date->end)); + ?> + + + <?php echo htmlspecialchars($date->label); ?> + + + - + years() as $date): ?> - + coordinates($now); @@ -108,96 +121,97 @@ defined('_JEXEC') or die('Restricted access'); y2="get('header_height', 24) + ($qty * $params->get('branch_height', 30)); ?>"/> - format('j M Y'); ?> + format('j M Y'); ?> get('show_legend', 0) == 1): ?> +legend(); +?> -
-
-
-
+
+
+
+
-
+ +
+ label; ?> +
+ +
-
-
- -
-
-