Collection of themes/skins for the Fossil SCM

⌈⌋ ⎇ branch:  Fossil Skins Extra


Check-in [b4437b01f5]

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

Overview
Comment:Add some more adminstrative links
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b4437b01f588721caeaa12cb3c57fd581e184013
User & Date: mario 2021-10-12 15:14:53
Context
2021-10-12
15:18
safeguard empty FOSSIL_USER check-in: 3fe53cc698 user: mario tags: trunk
15:14
Add some more adminstrative links check-in: b4437b01f5 user: mario tags: trunk
13:11
fix paths // for twitter:image:src check-in: e6f2bdd76e user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to extroot/skin.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<div class='fossil-doc' data-title='skin editor'>
<?php
# encoding: utf-8
# api: cgi
# type: config
# category: admin
# title: Skin editor
# description: Edit current skin parts all at once
# version: 0.5
# state: beta
# depends: php:sqlite
# config: -
#
# Combines header/footer/css/script editing,
# updates current=draft1 directly, backs up into draft9.
#

<







|







1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/php-cgi -dcgi.force_redirect=0

<?php
# encoding: utf-8
# api: cgi
# type: config
# category: admin
# title: Skin editor
# description: Edit current skin parts all at once
# version: 0.6
# state: beta
# depends: php:sqlite
# config: -
#
# Combines header/footer/css/script editing,
# updates current=draft1 directly, backs up into draft9.
#
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
    foreach (db("SELECT * FROM config WHERE name IN ('header', 'footer', 'css', 'js', 'details')") as $r) {
        $s .= "REPLACE INTO config (name,mtime,value) VALUES ('$r[name]', $r[mtime], {$db->quote($r['value'])});\n";
    }
    return $s;
}








#-- update
if (isset($_POST["save"])) {

    # insert skin:Backup*
    if ($_POST["save_bk"]) {
        db("INSERT INTO config (name,mtime,value) VALUES (?, ?, ?)", ["skin:Backup on ".strftime("%Y-%m-%d %H:%M:%S"), time(), sql_backup()]);
    }
    
    # update individual config skin parts
    foreach ($FIELDS AS $field) {
        $old = db("SELECT value FROM config WHERE name=?", [$field])[0]["value"];
        if ($_POST["save_d9"]) {
            db("REPLACE INTO config (name,mtime,value) VALUES (?, ?, ?)", ["draft9-$field", time(), $old]);
        }

        db("REPLACE INTO config (name,mtime,value) VALUES (?, ?, ?)", ["draft1-$field", time(), $_POST[$field]]);


        db("REPLACE INTO config (name,mtime,value) VALUES (?, ?, ?)", ["$field", time(), $_POST[$field]]);
    }


    print "🟩 Saved.";
}
#-- display form
else {

    ?>

    <style>
     .skin-editor { display: block; width: 1000pt; }
     .skin-editor input[type=submit] { margin: 10pt; }
     .skin-block { display: inline-block; background: #eee; border-radius: 10pt; padding: 5pt; }
     .skin-block b { display: block; }
    </style>
    <form method=POST enctype="multipart/form-data" class=skin-editor>

    <input type=submit name=save value='save &amp; apply'>
    <br>
    <?php

    foreach ($FIELDS as $field) {
        $value = db("SELECT name,value FROM config WHERE name = ?", [$field])[0]["value"];
        print <<<EOF
        <label class=skin-block>
           <b>{$field}</b>
           <textarea cols=55 rows=20 name={$field}>{$h($value)}</textarea>
        </label>   
EOF;
    }

    ?>
    <br><input type=submit name=save value='save &amp; apply'><br>
    This will update <b>current</b> and <b>draft1</b> directly.<br>

    <input name=save_d9 value=1 type=checkbox checked> And save the last version to <a href='/draft9/home'>draft9</a><br>
    <input name=save_bk value=1 type=checkbox checked> As well as a skin:Backup entry<br>
    </form>








    <?php
}

?>
</div>







>
>
>
>
>
>

|












>
|
>
>
|
|
>
>
|





>







>
















|
>
|
|

>
>
>
>
>
>
>
>





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
137
138
139
140
141
142
143
144
145
146
    foreach (db("SELECT * FROM config WHERE name IN ('header', 'footer', 'css', 'js', 'details')") as $r) {
        $s .= "REPLACE INTO config (name,mtime,value) VALUES ('$r[name]', $r[mtime], {$db->quote($r['value'])});\n";
    }
    return $s;
}


#-- backup download
if (isset($_GET["backup"])) {
    header("Content-Type: text/sql");
    header("Content-Disposition: attachment; filename=fossil-skin-backup-current.txt");
    die(sql_backup());
}
#-- update
elseif (isset($_POST["save"])) {

    # insert skin:Backup*
    if ($_POST["save_bk"]) {
        db("INSERT INTO config (name,mtime,value) VALUES (?, ?, ?)", ["skin:Backup on ".strftime("%Y-%m-%d %H:%M:%S"), time(), sql_backup()]);
    }
    
    # update individual config skin parts
    foreach ($FIELDS AS $field) {
        $old = db("SELECT value FROM config WHERE name=?", [$field])[0]["value"];
        if ($_POST["save_d9"]) {
            db("REPLACE INTO config (name,mtime,value) VALUES (?, ?, ?)", ["draft9-$field", time(), $old]);
        }
        if ($_POST["save_d1"]) {
            db("REPLACE INTO config (name,mtime,value) VALUES (?, ?, ?)", ["draft1-$field", time(), $_POST[$field]]);
        }
        if (TRUE) {
            db("REPLACE INTO config (name,mtime,value) VALUES (?, ?, ?)", ["$field", time(), $_POST[$field]]);
        }
    }
    print "<div class='fossil-doc' data-title='skin saved'> 🟩 Saved.";

}
#-- display form
else {

    ?>
    <div class='fossil-doc' data-title='skin editor'>
    <style>
     .skin-editor { display: block; width: 1000pt; }
     .skin-editor input[type=submit] { margin: 10pt; }
     .skin-block { display: inline-block; background: #eee; border-radius: 10pt; padding: 5pt; }
     .skin-block b { display: block; }
    </style>
    <form method=POST enctype="multipart/form-data" class=skin-editor>
    <h3>Skin Editor</h3>
    <input type=submit name=save value='save &amp; apply'>
    <br>
    <?php

    foreach ($FIELDS as $field) {
        $value = db("SELECT name,value FROM config WHERE name = ?", [$field])[0]["value"];
        print <<<EOF
        <label class=skin-block>
           <b>{$field}</b>
           <textarea cols=55 rows=20 name={$field}>{$h($value)}</textarea>
        </label>   
EOF;
    }

    ?>
    <br><input type=submit name=save value='save &amp; apply'><br>
    This will update <b>current</b> skin parts (= directly published).<br>
    <input name=save_d1 value=1 type=checkbox checked> Overwrite <b>draft1</b> with current parts too.<br>
    <input name=save_d9 value=1 type=checkbox checked> Save the previous version to <a href="<?=$_SERVER["FOSSIL_URI"]?>/draft9/home">draft9</a><br>
    <input name=save_bk value=1 type=checkbox checked> But also create a skin:Backup entry<br>
    </form>
    <br><b>Other options</b>
    <ul>
    <li> <a href="<?=$_SERVER["PHP_SELF"]?>?backup=current.txt">backup.sql</a> of current skin
    <li> <a href="<?=$_SERVER["FOSSIL_URI"]?>/setup_skin_admin">skin archive/admin</a>
    <li> <a href="<?=$_SERVER["FOSSIL_URI"]?>/setup_skin">setup_skin</a>
    <li> <a href="<?=$_SERVER["FOSSIL_URI"]?>/setup_skinedit?w=2&sk=1">edit draft1</a>
    <li> Publish to remote repo: <code>fossil config push skin</code>
    </ul>
    <?php
}

?>
</div>