diff --git a/website/assets/css/style.css b/website/assets/css/style.css index e2896528..8ab26fde 100644 --- a/website/assets/css/style.css +++ b/website/assets/css/style.css @@ -3,3 +3,7 @@ body { background: url('../img/bg.jpg'); } + +table tr.category_header { + background: #ddd; +} diff --git a/website/page/code/desktop-download.php b/website/page/code/desktop-download.php index 9845d07e..dcf18e94 100644 --- a/website/page/code/desktop-download.php +++ b/website/page/code/desktop-download.php @@ -16,8 +16,37 @@ function iitcDesktopDownload ( $build ) function iitcDesktopPluginDownloadTable ( $build ) { + $categories = Array ( + 'Info' => "", + 'Keys' => "Key management", + 'Controls' => "Map controls", + 'Highlighter' => "Portal highliters", + 'Layer' => "Additional map layers", + 'Map Tiles' => "Alternative map layers", + 'Tweaks' => "Adjust IITC settings", + 'Misc' => "Unclassified plugins", + ); + + $plugins = Array(); + + foreach ( glob ( "$build/plugins/*.user.js" ) as $path ) + { + $basename = basename ( $path, ".user.js" ); + $details = loadUserScriptHeader ( $path ); + + $plugins[$basename] = $details; + + $category = array_key_exists('@category',$details) ? $details['@category'] : 'Misc'; + + if ( !array_key_exists($category,$categories) ) + { + # add missing categories + $categories[$category] = ''; + } + } + ?> - +
@@ -29,30 +58,41 @@ function iitcDesktopPluginDownloadTable ( $build ) $category_desc ) + { + print "\n"; - $details = loadUserScriptHeader ( $path ); + $empty = True; + foreach ( $plugins as $basename => $details ) + { + $this_category = array_key_exists('@category',$details) ? $details['@category'] : 'Misc'; - print "\n"; + if ( $category != $this_category ) + continue; - # remove 'IITC Plugin: ' prefix if it's there, for neatness - $name = preg_replace ( '/^IITC plugin: /i', '', $details['@name'] ); + $empty = False; - # format extended version info in less prominant font - $version = preg_replace ( '/^(\d+\.\d+\.\d+)\.(\d{8}\.\d{6})/', '\1.\2', $details['@version'] ); + print "\n"; - # remove unneeded prefix from description - $description = preg_replace ( '/^\[[^]]*\] */', '', $details['@description'] ); + # remove 'IITC Plugin: ' prefix if it's there, for neatness + $name = preg_replace ( '/^IITC plugin: /i', '', $details['@name'] ); - print ""; - print ""; - print ""; - print ""; - print "\n"; -} + # format extended version info in less prominant font + $version = preg_replace ( '/^(\d+\.\d+\.\d+)\.(\d{8}\.\d{6})/', '\1.\2', $details['@version'] ); + # remove unneeded prefix from description + $description = preg_replace ( '/^\[[^]]*\] */', '', $details['@description'] ); + + print ""; + print ""; + print ""; + print ""; + print "\n"; + } + if ( $empty ) + print "\n"; + + } ?>
Name
Category: $category$category_desc
$name$basename
$version
$descriptionDownload
$name$basename
$version
$descriptionDownload
(no plugins in this category)