Collection of themes/skins for the Fossil SCM

⌈⌋ branch:  Fossil Skins Extra


Artifact [22f463c798]

Artifact 22f463c798ef88ad515ed6b43adc1e2dd63654d0:

  • Executable file extroot/index — part of check-in [7573908dd3] at 2021-10-24 06:20:10 on branch trunk — standardize PMD type: further (user: mario size: 2770)

#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: output
# category: list
# title: Ext/ index
# description: Lists all CGI extensions in the extroot: folder
# version: 0.3
# state: stable
# config: -
# access: public
#
# Just a glob() and some crude plugin meta extraction.
#

include("./fossil_common.php");
error_reporting(0);

#-- fossil HTML output
function page_md($text) {
    header("Content-Type: text/html; charset=utf-8");
    print <<<EOF
<div class="fossil-doc" data-title='Extensions'>
<style>
 .extensions-index {
    columns: 2;
 }
 .fsl-ext {
    width: 100%;
    display: inline-block;
    background: #1b1b1b;
    border-radius: 5pt;
    box-shadow: 2pt 2pt 3pt #666;
    padding: 10pt 15pt;
    margin: 5pt 2pt;
    color: #ddd;
 }
 .fsl-ext a {
    color: #fe9;
    font-weight: 900;
    font-size: 115%;
 }
 .fsl-ext .version {
    background: #542;
    color: black;
    padding: 2pt 10pt;
    margin-left: 4pt;
    border-radius: 4pt;
 }
 .fsl-ext .access {
    background: #232;
    color: yellow;
    padding: 1pt 4pt;
    margin-left: 4pt;
    border-radius: 2pt;
 }
 .fsl-ext .right {
    break: both;
    float: right;
    display: block;
    position: relative;
    right: -15pt;
 }
 .fsl-ext .right div {
    padding: 2pt 10pt;
    border-radius: 5pt 0 0 5pt;
    background: #114;
    color: #777;
    margin-bottom: 4pt;
 }
 .fsl-ext .right div.category {
    color: #aaa;
    background: #225;
 }
</style>
$text
EOF;
}

#-- filtered file list
function ls($dir) {
    $ls = [];
    foreach (glob("$dir/*") as $fn) {
        if (is_file($fn) and is_executable($fn) and is_readable($fn)) {
            $ls[] = basename($fn);
        }
    }
    return $ls;
}


#-- run
page_md("<div class=extensions-index>\n");
$map_access = ["public"=>"🔎", "private"=>"🕵", "admin"=>"🔑", "auth"=>"💁"];
foreach (ls(__DIR__) as $fn) {
    $meta = meta($fn);
    $h = "h";
    $title = $meta["title"] ?: $fn;
    $version = $meta["version"] ?: "-";
    $state = $meta["state"] ?: "-";
    $desc = $meta["description"] ?: $fn;
    $type = $meta["type"] ?: "extension";
    $cat = $meta["category"] ?: "-";
    $access = "";
    if (!empty($meta["access"])) {
        $access = "<span class=access title='$meta[access]'>" . ($map_access[$meta["access"]] ?: "🔒") . "</span>";
    }
    print <<<EOF

    <div class="fsl-ext $cat" title="{$h($meta['__doc__'], ENT_QUOTES)}">
        <a href="$_SERVER[FOSSIL_URI]/ext/$fn">$title</a>
        <span class=version title="$state">$version</span> $access
        <span class=right>
          <div class=type>$type</div>
          <div class=category>$cat</div>
        </span>
        <div class=description>{$h($desc)}</div>
    </div>

EOF;
}
    print "</div>";

?>