Collection of themes/skins for the Fossil SCM

⌈⌋ ⎇ branch:  Fossil Skins Extra


Check-in [3fd7f87ed2]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:restructure form field output
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3fd7f87ed231421bca4c13c4dda1648336091a9a
User & Date: mario 2021-10-20 05:58:34
Context
2021-10-20
05:59
support for #access: flag check-in: 0e67fdb36b user: mario tags: trunk
05:58
restructure form field output check-in: 3fd7f87ed2 user: mario tags: trunk
05:58
Add doc/trunk|tip/pages.md preparation check-in: 5f6f721040 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to extroot/config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: config
# category: admin
# title: Extra config
# description: Additional list of options to configure, read from ext/* PMD
# version: 0.3
# state: beta
# config:
#    { name: project-license, type: select, select: "0BSD|AAL|ADSL|AFL-3.0|AGPL-1.0|AGPL-3.0|AGPL-3.0-or-later|Apache-2.0|APSL-2.0|Artistic-1.0|Artistic-2.0|BSD-1-Clause|BSD-2-Clause|BSD-2-Clause-FreeBSD|BSD-2-Clause-NetBSD|BSD-2-Clause-Patent|BSD-3-Clause|BSD-3-Clause-Attribution|BSD-3-Clause-Clear|BSD-3-Clause-Modification|BSD-4-Clause|BSD-4-Clause-Shortened|BSL-1.0|CAL-1.0|CC0-1.0|CC-BY-2.0|CC-BY-3.0|CC-BY-4.0|CC-BY-NC-2.0|CC-BY-NC-4.0|CC-BY-NC-ND-2.0|CC-BY-NC-ND-3.0|CC-BY-NC-ND-4.0|CC-BY-NC-SA-2.0|CC-BY-NC-SA-3.0|CC-BY-NC-SA-4.0|CC-BY-ND-4.0|CC-BY-SA-2.0|CC-BY-SA-4.0|CDDL-1.1|CPL-1.0|ECL-2.0|EFL-2.0|EPL-2.0|EUPL-1.2|GFDL-1.1|GFDL-1.3-only|GFDL-1.3-or-later|GPL-1.0|GPL-1.0+|GPL-2.0|GPL-2.0+|GPL-2.0-only|GPL-3.0|GPL-3.0+|IPL-1.0|ISC|LGPL-2.0|LGPL-2.1|LGPL-2.1+|LGPL-3.0|LGPL-3.0+|MIT|MIT-0|MIT-Modern-Variant|MPL-1.0|MPL-1.1|MPL-2.0|MS-PL|MS-RL|NPL-1.1|OFL-1.0|OSL-2.0|OSL-3.0|PSF-2.0|Python-2.0|SPL-1.0|TCL|Unlicense|W3C|WTFPL|X11|Zend-2.0|ZPL-2.1", value: "", description: "Source code license (SPDX identifier)" }
#    { name: project-tags,    type: str, value: "", description: Additional tags for project.json listing, comma-separated list }
#    { name: project-homepage, type: str, value: "", description: Alternative project homepage, help: If the repository is not the primary/user homepage. }
#    { name: project-description, type: text, value: "", description: "Fossil repository and project description" }
#    [ name: timeline-plaintext, type: bool, value: 1, description: "No markup in timeline displays", help: Check-in comments are displayed literally - without any wiki or HTML interpretation. ]

#
# Reads the #config:{} fields, and updates fossils’ config table.
# Allows extroot scripts to provide additional options, or just
# an alternative to the builtin settings.
#

#-- init








|







>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: config
# category: admin
# title: Extra config
# description: Additional list of options to configure, read from ext/* PMD
# version: 0.4
# state: beta
# config:
#    { name: project-license, type: select, select: "0BSD|AAL|ADSL|AFL-3.0|AGPL-1.0|AGPL-3.0|AGPL-3.0-or-later|Apache-2.0|APSL-2.0|Artistic-1.0|Artistic-2.0|BSD-1-Clause|BSD-2-Clause|BSD-2-Clause-FreeBSD|BSD-2-Clause-NetBSD|BSD-2-Clause-Patent|BSD-3-Clause|BSD-3-Clause-Attribution|BSD-3-Clause-Clear|BSD-3-Clause-Modification|BSD-4-Clause|BSD-4-Clause-Shortened|BSL-1.0|CAL-1.0|CC0-1.0|CC-BY-2.0|CC-BY-3.0|CC-BY-4.0|CC-BY-NC-2.0|CC-BY-NC-4.0|CC-BY-NC-ND-2.0|CC-BY-NC-ND-3.0|CC-BY-NC-ND-4.0|CC-BY-NC-SA-2.0|CC-BY-NC-SA-3.0|CC-BY-NC-SA-4.0|CC-BY-ND-4.0|CC-BY-SA-2.0|CC-BY-SA-4.0|CDDL-1.1|CPL-1.0|ECL-2.0|EFL-2.0|EPL-2.0|EUPL-1.2|GFDL-1.1|GFDL-1.3-only|GFDL-1.3-or-later|GPL-1.0|GPL-1.0+|GPL-2.0|GPL-2.0+|GPL-2.0-only|GPL-3.0|GPL-3.0+|IPL-1.0|ISC|LGPL-2.0|LGPL-2.1|LGPL-2.1+|LGPL-3.0|LGPL-3.0+|MIT|MIT-0|MIT-Modern-Variant|MPL-1.0|MPL-1.1|MPL-2.0|MS-PL|MS-RL|NPL-1.1|OFL-1.0|OSL-2.0|OSL-3.0|PSF-2.0|Python-2.0|SPL-1.0|TCL|Unlicense|W3C|WTFPL|X11|Zend-2.0|ZPL-2.1", value: "", description: "Source code license (SPDX identifier)" }
#    { name: project-tags,    type: str, value: "", description: Additional tags for project.json listing, comma-separated list }
#    { name: project-homepage, type: str, value: "", description: Alternative project homepage, help: If the repository is not the primary/user homepage. }
#    { name: project-description, type: text, value: "", description: "Fossil repository and project description" }
#    [ name: timeline-plaintext, type: bool, value: 1, description: "No markup in timeline displays", help: Check-in comments are displayed literally - without any wiki or HTML interpretation. ]
# access: admin
#
# Reads the #config:{} fields, and updates fossils’ config table.
# Allows extroot scripts to provide additional options, or just
# an alternative to the builtin settings.
#

#-- init
61
62
63
64
65
66
67



















































68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
if (count($_POST)) {
    foreach ($_POST as $key=>$value) {
        if (get_config($key, "") != $value) {
            db("REPLACE INTO config (name,mtime,value) VALUES (?,?,?)", [$key, time(), $value]);
        }
    }
}




















































#-- iterate over scripts for display
page_md("<div class=config-list>\n<form method=POST enctype='multipart/form-data'>");
foreach (ls(__DIR__) as $fn) {
    $meta = meta($fn);
    $h = "h";
    # look for config: options
    if ($config = config($meta)) {
        $title = $meta["title"] ?: $fn;
        print "<h3>$title</h3>\n";  # title='{$h($meta['__doc__'])}'
        foreach ($config as $opt) {
            if (empty($opt["name"])) {
                continue;
            }
            $name = $opt["name"];
            $help = empty($opt["help"]) ? "" : $opt["help"];
            $value = get_config($name, empty($opt["value"]) ? "" : $opt["value"]);
            
            print "<label title=\"{$h($help)}\">\n";
            # handle only str, text or select fields
            switch ($opt["type"]) {
                case "long":
                case "text":
                    print "<b>{$h($name)}</b><br>\n";
                    print "<textarea name={$h($name)} rows=4 cols=70>{$h($value)}</textarea>";
                    break;
                case "boolean":
                case "bool":
                    $checked = $value ? " checked" : "";
                    print "<input type=hidden name={$h($name)} value=0>";
                    print "<input type=checkbox name={$h($name)} value=1$checked>";
                    print "<b>{$h($name)}</b>\n";
                    break;
                case "choose":
                case "select":
                    print "<b>{$h($name)}</b><br>\n";
                    print "<select name={$h($name)}>\n";
                    $opts = preg_split("~[|;,]~", $opt["select"]);
                    if (!in_array($value, $opts)) {
                        $opts[-1] = $value;
                    }
                    foreach ($opts as $o) {
                        $selected = $o == $value ? " selected" : "";
                        print "<option value=\"{$h($o)}\"$selected>{$h($o)}</option>\n";
                    }
                    print "</select>";
                    break;
                default:
                    print "<b>{$h($name)}</b><br>\n";
                    print "<input type=\"$opt[type]\" name={$h($name)} value=\"{$h($value)}\" size=60>";
            }
            print "<br>\n<small>{$h($opt['description'])}</small></label>\n\n";
        }
    }
}
?>
<input type=submit value="Save">
</form>
</div>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129







130



































131
132
133
134
135
136
if (count($_POST)) {
    foreach ($_POST as $key=>$value) {
        if (get_config($key, "") != $value) {
            db("REPLACE INTO config (name,mtime,value) VALUES (?,?,?)", [$key, time(), $value]);
        }
    }
}

#-- print option blocks
function option($opt, $h="h") {
    if (empty($opt["name"])) {
        return;
    }
    $name = $opt["name"];
    $type = $opt["type"] ?: "str";
    $value = get_config($name, empty($opt["value"]) ? "" : $opt["value"]);
    $help = empty($opt["help"]) ? "" : $opt["help"];
    # output
    print "<label title=\"{$h($help)}\">\n";
    field($name, $type, $value, $opt);
    print "<br>\n<small>{$h($opt['description'])}</small></label>\n\n";
}

#-- output <input> depending on type
function field($name, $type, $value, $opt, $h="h") {
    # handle only str, text or select fields
    switch ($type) {
        case "long":
        case "text":
            print "<b>{$h($name)}</b><br>\n";
            print "<textarea name={$h($name)} rows=4 cols=70>{$h($value)}</textarea>";
            break;
        case "boolean":
        case "bool":
            $checked = $value ? " checked" : "";
            print "<input type=hidden name={$h($name)} value=0>";
            print "<input type=checkbox name={$h($name)} value=1$checked>";
            print "<b>{$h($name)}</b>\n";
            break;
        case "choose":
        case "select":
            print "<b>{$h($name)}</b><br>\n";
            print "<select name={$h($name)}>\n";
            $opts = preg_split("~[|;,]~", $opt["select"]);
            if (!in_array($value, $opts)) {
                $opts[-1] = $value;
            }
            foreach ($opts as $o) {
                $selected = $o == $value ? " selected" : "";
                print "<option value=\"{$h($o)}\"$selected>{$h($o)}</option>\n";
            }
            print "</select>";
            break;
        default:
            print "<b>{$h($name)}</b><br>\n";
            print "<input type=\"{$h($type)}\" name={$h($name)} value=\"{$h($value)}\" size=60>";
    }
}

#-- iterate over scripts for display
page_md("<div class=config-list>\n<form method=POST enctype='multipart/form-data'>");
foreach (ls(__DIR__) as $fn) {
    $meta = meta($fn);
    $h = "h";
    # look for config: options
    if ($config = config($meta)) {
        $title = $meta["title"] ?: $fn;
        print "<h3>$title</h3>\n";  # title='{$h($meta['__doc__'])}'







        array_map("option", $config);



































    }
}
?>
<input type=submit value="Save">
</form>
</div>