Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ IMPORTANT NOTE: This version only works on CACTI 1.x++!

--- develop ---

* feature: Present map previews as larger responsive titled cards

* refactor: Relocate the plugin's database schema provisioning (`weathermap_setup_table()`) out of `setup.php` into a dedicated `includes/database.php` module (function move only, no behaviour change)
* feature: Add a root `manifest.json` file manifest plus an upgrade-time `weathermap_prune_files()` that removes tombstoned and dev-only paths while protecting whitelisted user data (`configs/`, `output/`) and `.git*`, backed by a `tests/bin/validate-manifest.php` CI gate that fails on manifest drift
* dev: Add xdebug coverage reporting to CI and enforce patch coverage of changed lines
Expand Down
3 changes: 3 additions & 0 deletions css/weathermap.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@ body#wm_fullscreen { font-family: sans-serif; margin: 0; border: 0; padding: 0;
.inplace .weathermapholder { display: none; }

#wm_cyclecontrols a img { width: 16px; height: 16px; border: 0; }

.wm-gallery-cards { padding: 12px; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.wm-map-card { margin: 0; width: 480px; max-width: 100%; box-sizing: border-box; border: 1px solid var(--border-color, #999); border-radius: 5px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,.12); }
12 changes: 4 additions & 8 deletions weathermap-cacti-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,33 +553,29 @@ function weathermap_thumbview($limit_to_group = -1) {
$imageformat = strtolower(read_config_option('weathermap_output_format'));

print '<table class="cactiTable">';
print '<tr><td class="wm_gallery">';
print '<tr><td class="wm_gallery wm-gallery-cards">';

foreach ($maplist as $map) {
$i++;

$imgsize = '';

// $thumbfile = $outdir."weathermap_thumb_".$map['id'].".".$imageformat;
// $thumburl = "output/weathermap_thumb_".$map['id'].".".$imageformat."?time=".time();

$thumbfile = $outdir . $map['filehash'] . '.thumb.' . $imageformat;
$thumburl = $config['url_path'] . 'plugins/weathermap/weathermap-cacti-plugin.php?action=viewthumb&id=' . $map['filehash'] . '&time=' . time();
$thumburl = $config['url_path'] . 'plugins/weathermap/weathermap-cacti-plugin.php?action=viewimage&id=' . $map['filehash'] . '&time=' . time();

if ($map['thumb_width'] > 0) {
$imgsize = ' WIDTH="' . $map['thumb_width'] . '" HEIGHT="' . $map['thumb_height'] . '" ';
}

$maptitle = $map['titlecache'];

if ($maptitle == '') {
$maptitle = __esc('Map for config file: %s', $map['configfile'], 'weathermap');
}

print '<div class="cactiTable" style="margin-right:2px;float:left;max-width:' . $map['thumb_width'] . 'px">';
print '<div class="cactiTable wm-map-card">';

if (file_exists($thumbfile)) {
print '<div class="tableHeader"><div class="textSubHeaderDark" style="padding:3px 0px 0px 5px">' . html_escape($maptitle) . '</div></div><div><a href=' . $config['url_path'] . 'plugins/weathermap/weathermap-cacti-plugin.php?action=viewmap&id=' . $map['filehash'] . '><img class="wm_thumb" ' . $imgsize . 'src="' . $thumburl . '" alt="" hspace="5" vspace="5" style="margin:0px" title="' . html_escape($maptitle) . '"/></a></div>';
print '<div class="tableHeader"><div class="textSubHeaderDark" style="padding:10px 12px;font-size:14px;font-weight:bold;text-align:center">' . html_escape($maptitle) . '</div></div><div><a href=' . $config['url_path'] . 'plugins/weathermap/weathermap-cacti-plugin.php?action=viewmap&id=' . $map['filehash'] . '><img class="wm_thumb" ' . 'src="' . $thumburl . '" alt="" hspace="5" vspace="5" style="display:block;width:100%;height:auto;margin:0;box-sizing:border-box;padding:10px" title="' . html_escape($maptitle) . '"/></a></div>';
} else {
print __('(thumbnail for map not created yet)', 'weathermap');
}
Expand Down