Fossil SCM

Allow TH1 commands in Ad-Units

Torsten 2026-07-01 13:06 UTC trunk
Commit 6ac7935a71ef9d726ecb8078eeb0e94fd8181a3cf027080e7b0f719f882f1c89
3 files changed +13 -2 +2 -2 +3 -1
+13 -2
--- src/setup.c
+++ src/setup.c
@@ -153,11 +153,11 @@
153153
"Select and/or modify the web interface \"skins\"");
154154
setup_menu_entry("Moderation", "setup_modreq",
155155
"Enable/Disable requiring moderator approval of Wiki and/or Ticket"
156156
" changes and attachments.");
157157
setup_menu_entry("Ad-Unit", "setup_adunit",
158
- "Edit HTML text for an ad unit inserted after the menu bar");
158
+ "Edit HTML/TH1 for an ad unit inserted after the menu bar");
159159
setup_menu_entry("URLs & Checkouts", "urllist",
160160
"Show URLs used to access this repo and known check-outs");
161161
if( setup_user ){
162162
setup_menu_entry("Web-Cache", "cachestat",
163163
"View the status of the expensive-page cache");
@@ -1784,10 +1784,12 @@
17841784
@ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content.
17851785
@ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is
17861786
@ used on all pages.
17871787
@ <li>Properties: "adunit", "adunit-right", "adunit-omit-if-admin", and
17881788
@ "adunit-omit-if-user".
1789
+ @ <li>Ad-Units can contain TH1 commands, the following TH1 variables are most
1790
+ @ useful: $current_feature, $current_page, $requested_page, $login
17891791
@ <li>Suggested <a href="setup_skinedit?w=0">CSS</a> changes:
17901792
@ <blockquote><pre>
17911793
@ div.adunit_banner {
17921794
@ margin: auto;
17931795
@ width: 100%%;
@@ -1808,11 +1810,20 @@
18081810
@ height: 90px;
18091811
@ border: 1px solid #f11;
18101812
@ background-color: #fcc;
18111813
@ '&gt;Demo Ad&lt;/div&gt;
18121814
@ </pre></blockquote>
1813
- @ </li>
1815
+ @ <li>Example of a page-specific Ad-Unit:
1816
+ @ <blockquote><pre>
1817
+ @ &lt;th1&gt;
1818
+ @ if {$current_page eq "forum"} {
1819
+ @ # only show Ad-Unit on Forum start page:
1820
+ @ html {&lt;strong&gt;Notice:&lt;/strong&gt; Search the forum for an answer before asking in a new post!}
1821
+ @ }
1822
+ @ &lt;/th1&gt;
1823
+ @ </pre></blockquote>
1824
+ @ </ul>
18141825
style_finish_page();
18151826
db_end_transaction(0);
18161827
}
18171828
18181829
/*
18191830
--- src/setup.c
+++ src/setup.c
@@ -153,11 +153,11 @@
153 "Select and/or modify the web interface \"skins\"");
154 setup_menu_entry("Moderation", "setup_modreq",
155 "Enable/Disable requiring moderator approval of Wiki and/or Ticket"
156 " changes and attachments.");
157 setup_menu_entry("Ad-Unit", "setup_adunit",
158 "Edit HTML text for an ad unit inserted after the menu bar");
159 setup_menu_entry("URLs & Checkouts", "urllist",
160 "Show URLs used to access this repo and known check-outs");
161 if( setup_user ){
162 setup_menu_entry("Web-Cache", "cachestat",
163 "View the status of the expensive-page cache");
@@ -1784,10 +1784,12 @@
1784 @ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content.
1785 @ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is
1786 @ used on all pages.
1787 @ <li>Properties: "adunit", "adunit-right", "adunit-omit-if-admin", and
1788 @ "adunit-omit-if-user".
 
 
1789 @ <li>Suggested <a href="setup_skinedit?w=0">CSS</a> changes:
1790 @ <blockquote><pre>
1791 @ div.adunit_banner {
1792 @ margin: auto;
1793 @ width: 100%%;
@@ -1808,11 +1810,20 @@
1808 @ height: 90px;
1809 @ border: 1px solid #f11;
1810 @ background-color: #fcc;
1811 @ '&gt;Demo Ad&lt;/div&gt;
1812 @ </pre></blockquote>
1813 @ </li>
 
 
 
 
 
 
 
 
 
1814 style_finish_page();
1815 db_end_transaction(0);
1816 }
1817
1818 /*
1819
--- src/setup.c
+++ src/setup.c
@@ -153,11 +153,11 @@
153 "Select and/or modify the web interface \"skins\"");
154 setup_menu_entry("Moderation", "setup_modreq",
155 "Enable/Disable requiring moderator approval of Wiki and/or Ticket"
156 " changes and attachments.");
157 setup_menu_entry("Ad-Unit", "setup_adunit",
158 "Edit HTML/TH1 for an ad unit inserted after the menu bar");
159 setup_menu_entry("URLs & Checkouts", "urllist",
160 "Show URLs used to access this repo and known check-outs");
161 if( setup_user ){
162 setup_menu_entry("Web-Cache", "cachestat",
163 "View the status of the expensive-page cache");
@@ -1784,10 +1784,12 @@
1784 @ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content.
1785 @ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is
1786 @ used on all pages.
1787 @ <li>Properties: "adunit", "adunit-right", "adunit-omit-if-admin", and
1788 @ "adunit-omit-if-user".
1789 @ <li>Ad-Units can contain TH1 commands, the following TH1 variables are most
1790 @ useful: $current_feature, $current_page, $requested_page, $login
1791 @ <li>Suggested <a href="setup_skinedit?w=0">CSS</a> changes:
1792 @ <blockquote><pre>
1793 @ div.adunit_banner {
1794 @ margin: auto;
1795 @ width: 100%%;
@@ -1808,11 +1810,20 @@
1810 @ height: 90px;
1811 @ border: 1px solid #f11;
1812 @ background-color: #fcc;
1813 @ '&gt;Demo Ad&lt;/div&gt;
1814 @ </pre></blockquote>
1815 @ <li>Example of a page-specific Ad-Unit:
1816 @ <blockquote><pre>
1817 @ &lt;th1&gt;
1818 @ if {$current_page eq "forum"} {
1819 @ # only show Ad-Unit on Forum start page:
1820 @ html {&lt;strong&gt;Notice:&lt;/strong&gt; Search the forum for an answer before asking in a new post!}
1821 @ }
1822 @ &lt;/th1&gt;
1823 @ </pre></blockquote>
1824 @ </ul>
1825 style_finish_page();
1826 db_end_transaction(0);
1827 }
1828
1829 /*
1830
+2 -2
--- src/style.c
+++ src/style.c
@@ -1124,15 +1124,15 @@
11241124
11251125
zAd = style_adunit_text(&mAdFlags);
11261126
if( (mAdFlags & ADUNIT_RIGHT_OK)!=0 ){
11271127
@ <div class="content adunit_right_container">
11281128
@ <div class="adunit_right">
1129
- cgi_append_content(zAd, -1);
1129
+ Th_RenderToBlob(zAd, NULL, TH_R2B_NO_VARS);
11301130
@ </div>
11311131
}else if( zAd ){
11321132
@ <div class="adunit_banner">
1133
- cgi_append_content(zAd, -1);
1133
+ Th_RenderToBlob(zAd, NULL, TH_R2B_NO_VARS);
11341134
@ </div>
11351135
}
11361136
11371137
@ <div class="content"><span id="debugMsg"></span>
11381138
cgi_destination(CGI_BODY);
11391139
--- src/style.c
+++ src/style.c
@@ -1124,15 +1124,15 @@
1124
1125 zAd = style_adunit_text(&mAdFlags);
1126 if( (mAdFlags & ADUNIT_RIGHT_OK)!=0 ){
1127 @ <div class="content adunit_right_container">
1128 @ <div class="adunit_right">
1129 cgi_append_content(zAd, -1);
1130 @ </div>
1131 }else if( zAd ){
1132 @ <div class="adunit_banner">
1133 cgi_append_content(zAd, -1);
1134 @ </div>
1135 }
1136
1137 @ <div class="content"><span id="debugMsg"></span>
1138 cgi_destination(CGI_BODY);
1139
--- src/style.c
+++ src/style.c
@@ -1124,15 +1124,15 @@
1124
1125 zAd = style_adunit_text(&mAdFlags);
1126 if( (mAdFlags & ADUNIT_RIGHT_OK)!=0 ){
1127 @ <div class="content adunit_right_container">
1128 @ <div class="adunit_right">
1129 Th_RenderToBlob(zAd, NULL, TH_R2B_NO_VARS);
1130 @ </div>
1131 }else if( zAd ){
1132 @ <div class="adunit_banner">
1133 Th_RenderToBlob(zAd, NULL, TH_R2B_NO_VARS);
1134 @ </div>
1135 }
1136
1137 @ <div class="content"><span id="debugMsg"></span>
1138 cgi_destination(CGI_BODY);
1139
+3 -1
--- www/th1.md
+++ www/th1.md
@@ -29,12 +29,14 @@
2929
---------------------------
3030
3131
* In the header and footer for [skins](./customskin.md)
3232
text within `<th1>...</th1>` is run as a TH1 script.
3333
([example](/builtin/skins/default/header.txt))
34
+
35
+ * In the Ad-Units
3436
35
- * This display of [tickets](./bugtheory.wiki) is controlled by TH1
37
+ * The display of [tickets](./bugtheory.wiki) is controlled by TH1
3638
scripts, so that the ticket format can be customized for each
3739
project. Administrators can visit the <b>/tktsetup</b> page in
3840
their repositories to view and customize these scripts.
3941
([example usage](./custom_ticket.wiki))
4042
4143
--- www/th1.md
+++ www/th1.md
@@ -29,12 +29,14 @@
29 ---------------------------
30
31 * In the header and footer for [skins](./customskin.md)
32 text within `<th1>...</th1>` is run as a TH1 script.
33 ([example](/builtin/skins/default/header.txt))
 
 
34
35 * This display of [tickets](./bugtheory.wiki) is controlled by TH1
36 scripts, so that the ticket format can be customized for each
37 project. Administrators can visit the <b>/tktsetup</b> page in
38 their repositories to view and customize these scripts.
39 ([example usage](./custom_ticket.wiki))
40
41
--- www/th1.md
+++ www/th1.md
@@ -29,12 +29,14 @@
29 ---------------------------
30
31 * In the header and footer for [skins](./customskin.md)
32 text within `<th1>...</th1>` is run as a TH1 script.
33 ([example](/builtin/skins/default/header.txt))
34
35 * In the Ad-Units
36
37 * The display of [tickets](./bugtheory.wiki) is controlled by TH1
38 scripts, so that the ticket format can be customized for each
39 project. Administrators can visit the <b>/tktsetup</b> page in
40 their repositories to view and customize these scripts.
41 ([example usage](./custom_ticket.wiki))
42
43

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button