Fossil SCM

Move check for g.localOpen inside db_get_do_versionable(), because all callers will need this. Add "disabled" parameter to onoff_attribute(), entry_attribute() and textarea_attribute().

jan.nijtmans 2013-05-07 07:52 trunk
Commit 10d8abcd0c20acafe159630d282fa752733dce11
3 files changed +2 -1 +59 -47 +5 -3
+2 -1
--- src/db.c
+++ src/db.c
@@ -1690,10 +1690,11 @@
16901690
struct _cacheEntry *next;
16911691
const char *zName, *zValue;
16921692
} *cacheEntry = 0;
16931693
static struct _cacheEntry *cache = 0;
16941694
1695
+ if( !g.localOpen) return zNonVersionedSetting;
16951696
/* Look up name in cache */
16961697
cacheEntry = cache;
16971698
while( cacheEntry!=0 ){
16981699
if( fossil_strcmp(cacheEntry->zName, zName)==0 ){
16991700
zVersionedSetting = fossil_strdup(cacheEntry->zValue);
@@ -1775,11 +1776,11 @@
17751776
if( z==0 && g.zConfigDbName ){
17761777
db_swap_connections();
17771778
z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
17781779
db_swap_connections();
17791780
}
1780
- if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){
1781
+ if( ctrlSetting!=0 && ctrlSetting->versionable ){
17811782
/* This is a versionable setting, try and get the info from a
17821783
** checked out file */
17831784
z = db_get_do_versionable(zName, z);
17841785
}
17851786
if( z==0 ){
17861787
--- src/db.c
+++ src/db.c
@@ -1690,10 +1690,11 @@
1690 struct _cacheEntry *next;
1691 const char *zName, *zValue;
1692 } *cacheEntry = 0;
1693 static struct _cacheEntry *cache = 0;
1694
 
1695 /* Look up name in cache */
1696 cacheEntry = cache;
1697 while( cacheEntry!=0 ){
1698 if( fossil_strcmp(cacheEntry->zName, zName)==0 ){
1699 zVersionedSetting = fossil_strdup(cacheEntry->zValue);
@@ -1775,11 +1776,11 @@
1775 if( z==0 && g.zConfigDbName ){
1776 db_swap_connections();
1777 z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
1778 db_swap_connections();
1779 }
1780 if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){
1781 /* This is a versionable setting, try and get the info from a
1782 ** checked out file */
1783 z = db_get_do_versionable(zName, z);
1784 }
1785 if( z==0 ){
1786
--- src/db.c
+++ src/db.c
@@ -1690,10 +1690,11 @@
1690 struct _cacheEntry *next;
1691 const char *zName, *zValue;
1692 } *cacheEntry = 0;
1693 static struct _cacheEntry *cache = 0;
1694
1695 if( !g.localOpen) return zNonVersionedSetting;
1696 /* Look up name in cache */
1697 cacheEntry = cache;
1698 while( cacheEntry!=0 ){
1699 if( fossil_strcmp(cacheEntry->zName, zName)==0 ){
1700 zVersionedSetting = fossil_strdup(cacheEntry->zValue);
@@ -1775,11 +1776,11 @@
1776 if( z==0 && g.zConfigDbName ){
1777 db_swap_connections();
1778 z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
1779 db_swap_connections();
1780 }
1781 if( ctrlSetting!=0 && ctrlSetting->versionable ){
1782 /* This is a versionable setting, try and get the info from a
1783 ** checked out file */
1784 z = db_get_do_versionable(zName, z);
1785 }
1786 if( z==0 ){
1787
+59 -47
--- src/setup.c
+++ src/setup.c
@@ -768,11 +768,12 @@
768768
*/
769769
static void onoff_attribute(
770770
const char *zLabel, /* The text label on the checkbox */
771771
const char *zVar, /* The corresponding row in the VAR table */
772772
const char *zQParm, /* The query parameter */
773
- int dfltVal /* Default value if VAR table entry does not exist */
773
+ int dfltVal, /* Default value if VAR table entry does not exist */
774
+ int disabled /* 1 if disabled */
774775
){
775776
const char *zQ = P(zQParm);
776777
int iVal = db_get_boolean(zVar, dfltVal);
777778
if( zQ==0 && P("submit") ){
778779
zQ = "off";
@@ -783,16 +784,18 @@
783784
login_verify_csrf_secret();
784785
db_set(zVar, iQ ? "1" : "0", 0);
785786
iVal = iQ;
786787
}
787788
}
789
+ @ <input type="checkbox" name="%s(zQParm)"
788790
if( iVal ){
789
- @ <input type="checkbox" name="%s(zQParm)" checked="checked" />
790
- @ <b>%s(zLabel)</b>
791
- }else{
792
- @ <input type="checkbox" name="%s(zQParm)" /> <b>%s(zLabel)</b>
791
+ @ checked="checked"
792
+ }
793
+ if( disabled ){
794
+ @ disabled="disabled"
793795
}
796
+ @ /> <b>%s(zLabel)</b>
794797
}
795798
796799
/*
797800
** Generate an entry box for an attribute.
798801
*/
@@ -799,21 +802,25 @@
799802
void entry_attribute(
800803
const char *zLabel, /* The text label on the entry box */
801804
int width, /* Width of the entry box */
802805
const char *zVar, /* The corresponding row in the VAR table */
803806
const char *zQParm, /* The query parameter */
804
- char *zDflt /* Default value if VAR table entry does not exist */
807
+ char *zDflt, /* Default value if VAR table entry does not exist */
808
+ int disabled /* 1 if disabled */
805809
){
806810
const char *zVal = db_get(zVar, zDflt);
807811
const char *zQ = P(zQParm);
808812
if( zQ && fossil_strcmp(zQ,zVal)!=0 ){
809813
login_verify_csrf_secret();
810814
db_set(zVar, zQ, 0);
811815
zVal = zQ;
812816
}
813
- @ <input type="text" name="%s(zQParm)" value="%h(zVal)" size="%d(width)" />
814
- @ <b>%s(zLabel)</b>
817
+ @ <input type="text" name="%s(zQParm)" value="%h(zVal)" size="%d(width)"
818
+ if( disabled ){
819
+ @ disabled="disabled"
820
+ }
821
+ @ /> <b>%s(zLabel)</b>
815822
}
816823
817824
/*
818825
** Generate a text box for an attribute.
819826
*/
@@ -821,11 +828,12 @@
821828
const char *zLabel, /* The text label on the textarea */
822829
int rows, /* Rows in the textarea */
823830
int cols, /* Columns in the textarea */
824831
const char *zVar, /* The corresponding row in the VAR table */
825832
const char *zQP, /* The query parameter */
826
- const char *zDflt /* Default value if VAR table entry does not exist */
833
+ const char *zDflt, /* Default value if VAR table entry does not exist */
834
+ int disabled /* 1 if the textarea should not be editable */
827835
){
828836
const char *z = db_get(zVar, (char*)zDflt);
829837
const char *zQ = P(zQP);
830838
if( zQ && fossil_strcmp(zQ,z)!=0 ){
831839
login_verify_csrf_secret();
@@ -832,10 +840,13 @@
832840
db_set(zVar, zQ, 0);
833841
z = zQ;
834842
}
835843
if( rows>0 && cols>0 ){
836844
@ <textarea id="id%s(zQP)" name="%s(zQP)" rows="%d(rows)"
845
+ if( disabled ){
846
+ @ disabled="disabled"
847
+ }
837848
@ cols="%d(cols)">%h(z)</textarea>
838849
if( zLabel && *zLabel ){
839850
@ <span class="textareaLabel">%s(zLabel)</span>
840851
}
841852
}
@@ -855,11 +866,11 @@
855866
db_begin_transaction();
856867
@ <form action="%s(g.zTop)/setup_access" method="post"><div>
857868
login_insert_csrf_secret();
858869
@ <hr />
859870
onoff_attribute("Require password for local access",
860
- "localauth", "localauth", 0);
871
+ "localauth", "localauth", 0, 0);
861872
@ <p>When enabled, the password sign-in is always required for
862873
@ web access. When disabled, unrestricted web access from 127.0.0.1
863874
@ is allowed for the <a href="%s(g.zTop)/help/ui">fossil ui</a> command or
864875
@ from the <a href="%s(g.zTop)/help/server">fossil server</a>,
865876
@ <a href="%s(g.zTop)/help/http">fossil http</a> commands when the
@@ -880,60 +891,61 @@
880891
@ in the CGI script.
881892
@ </ol>
882893
@
883894
@ <hr />
884895
onoff_attribute("Enable /test_env",
885
- "test_env_enable", "test_env_enable", 0);
896
+ "test_env_enable", "test_env_enable", 0, 0);
886897
@ <p>When enabled, the %h(g.zBaseURL)/test_env URL is available to all
887898
@ users. When disabled (the default) only users Admin and Setup can visit
888899
@ the /test_env page.
889900
@ </p>
890901
@
891902
@ <hr />
892903
onoff_attribute("Allow REMOTE_USER authentication",
893
- "remote_user_ok", "remote_user_ok", 0);
904
+ "remote_user_ok", "remote_user_ok", 0, 0);
894905
@ <p>When enabled, if the REMOTE_USER environment variable is set to the
895906
@ login name of a valid user and no other login credentials are available,
896907
@ then the REMOTE_USER is accepted as an authenticated user.
897908
@ </p>
898909
@
899910
@ <hr />
900911
entry_attribute("IP address terms used in login cookie", 3,
901
- "ip-prefix-terms", "ipt", "2");
912
+ "ip-prefix-terms", "ipt", "2", 0);
902913
@ <p>The number of octets of of the IP address used in the login cookie.
903914
@ Set to zero to omit the IP address from the login cookie. A value of
904915
@ 2 is recommended.
905916
@ </p>
906917
@
907918
@ <hr />
908
- entry_attribute("Login expiration time", 6, "cookie-expire", "cex", "8766");
919
+ entry_attribute("Login expiration time", 6, "cookie-expire", "cex",
920
+ "8766", 0);
909921
@ <p>The number of hours for which a login is valid. This must be a
910922
@ positive number. The default is 8766 hours which is approximately equal
911923
@ to a year.</p>
912924
913925
@ <hr />
914926
entry_attribute("Download packet limit", 10, "max-download", "mxdwn",
915
- "5000000");
927
+ "5000000", 0);
916928
@ <p>Fossil tries to limit out-bound sync, clone, and pull packets
917929
@ to this many bytes, uncompressed. If the client requires more data
918930
@ than this, then the client will issue multiple HTTP requests.
919931
@ Values below 1 million are not recommended. 5 million is a
920932
@ reasonable number.</p>
921933
922934
@ <hr />
923935
entry_attribute("Download time limit", 11, "max-download-time", "mxdwnt",
924
- "30");
936
+ "30", 0);
925937
926938
@ <p>Fossil tries to spend less than this many seconds gathering
927939
@ the out-bound data of sync, clone, and pull packets.
928940
@ If the client request takes longer, a partial reply is given similar
929941
@ to the download packet limit. 30s is a reasonable default.</p>
930942
931943
@ <hr />
932944
onoff_attribute(
933945
"Enable hyperlinks for \"nobody\" based on User-Agent and Javascript",
934
- "auto-hyperlink", "autohyperlink", 1);
946
+ "auto-hyperlink", "autohyperlink", 1, 0);
935947
@ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users
936948
@ including user "nobody", as long as (1) the User-Agent string in the
937949
@ HTTP header indicates that the request is coming from an actual human
938950
@ being and not a a robot or spider and (2) the user agent is able to
939951
@ run Javascript in order to set the href= attribute of hyperlinks. Bots
@@ -948,30 +960,30 @@
948960
@ even for relatively small projects.</p>
949961
@
950962
@ <p>Additional parameters that control this behavior:</p>
951963
@ <blockquote>
952964
onoff_attribute("Require mouse movement before enabling hyperlinks",
953
- "auto-hyperlink-mouseover", "ahmo", 0);
965
+ "auto-hyperlink-mouseover", "ahmo", 0, 0);
954966
@ <br>
955967
entry_attribute("Delay before enabling hyperlinks (milliseconds)", 5,
956
- "auto-hyperlink-delay", "ah-delay", "10");
968
+ "auto-hyperlink-delay", "ah-delay", "10", 0);
957969
@ </blockquote>
958970
@ <p>Hyperlinks for user "nobody" are normally enabled as soon as the page
959971
@ finishes loading. But the first check-box below can be set to require mouse
960972
@ movement before enabling the links. One can also set a delay prior to enabling
961973
@ links by enter a positive number of milliseconds in the entry box above.</p>
962974
963975
@ <hr />
964976
onoff_attribute("Require a CAPTCHA if not logged in",
965
- "require-captcha", "reqcapt", 1);
977
+ "require-captcha", "reqcapt", 1, 0);
966978
@ <p>Require a CAPTCHA for edit operations (appending, creating, or
967979
@ editing wiki or tickets or adding attachments to wiki or tickets)
968980
@ for users who are not logged in.</p>
969981
970982
@ <hr />
971983
entry_attribute("Public pages", 30, "public-pages",
972
- "pubpage", "");
984
+ "pubpage", "", 0);
973985
@ <p>A comma-separated list of glob patterns for pages that are accessible
974986
@ without needing a login and using the privileges given by the
975987
@ "Default privileges" setting below. Example use case: Set this field
976988
@ to "/doc/trunk/www/*" to give anonymous users read-only permission to the
977989
@ latest version of the embedded documentation in the www/ folder without
@@ -978,30 +990,30 @@
978990
@ allowing them to see the rest of the source code.
979991
@ </p>
980992
981993
@ <hr />
982994
onoff_attribute("Allow users to register themselves",
983
- "self-register", "selfregister", 0);
995
+ "self-register", "selfregister", 0, 0);
984996
@ <p>Allow users to register themselves through the HTTP UI.
985997
@ The registration form always requires filling in a CAPTCHA
986998
@ (<em>auto-captcha</em> setting is ignored). Still, bear in mind that anyone
987999
@ can register under any user name. This option is useful for public projects
9881000
@ where you do not want everyone in any ticket discussion to be named
9891001
@ "Anonymous".</p>
9901002
9911003
@ <hr />
9921004
entry_attribute("Default privileges", 10, "default-perms",
993
- "defaultperms", "u");
1005
+ "defaultperms", "u", 0);
9941006
@ <p>Permissions given to users that... <ul><li>register themselves using
9951007
@ the self-registration procedure (if enabled), or <li>access "public"
9961008
@ pages identified by the public-pages glob pattern above, or <li>
9971009
@ are users newly created by the administrator.</ul>
9981010
@ </p>
9991011
10001012
@ <hr />
10011013
onoff_attribute("Show javascript button to fill in CAPTCHA",
1002
- "auto-captcha", "autocaptcha", 0);
1014
+ "auto-captcha", "autocaptcha", 0, 0);
10031015
@ <p>When enabled, a button appears on the login screen for user
10041016
@ "anonymous" that will automatically fill in the CAPTCHA password.
10051017
@ This is less secure than forcing the user to do it manually, but is
10061018
@ probably secure enough and it is certainly more convenient for
10071019
@ anonymous users.</p>
@@ -1124,23 +1136,23 @@
11241136
@ <form action="%s(g.zTop)/setup_timeline" method="post"><div>
11251137
login_insert_csrf_secret();
11261138
11271139
@ <hr />
11281140
onoff_attribute("Allow block-markup in timeline",
1129
- "timeline-block-markup", "tbm", 0);
1141
+ "timeline-block-markup", "tbm", 0, 0);
11301142
@ <p>In timeline displays, check-in comments can be displayed with or
11311143
@ without block markup (paragraphs, tables, etc.)</p>
11321144
11331145
@ <hr />
11341146
onoff_attribute("Plaintext comments on timelines",
1135
- "timeline-plaintext", "tpt", 0);
1147
+ "timeline-plaintext", "tpt", 0, 0);
11361148
@ <p>In timeline displays, check-in comments are displayed literally,
11371149
@ without any wiki or HTML interpretation.</p>
11381150
11391151
@ <hr />
11401152
onoff_attribute("Use Universal Coordinated Time (UTC)",
1141
- "timeline-utc", "utc", 1);
1153
+ "timeline-utc", "utc", 1, 0);
11421154
@ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
11431155
@ Zulu) instead of in local time. On this server, local time is currently
11441156
g.fTimeFormat = 2;
11451157
tmDiff = db_double(0.0, "SELECT julianday('now')");
11461158
tmDiff = db_double(0.0,
@@ -1157,19 +1169,19 @@
11571169
@ %s(zTmDiff) hours ahead of UTC.</p>
11581170
}
11591171
11601172
@ <hr />
11611173
onoff_attribute("Show version differences by default",
1162
- "show-version-diffs", "vdiff", 0);
1174
+ "show-version-diffs", "vdiff", 0, 0);
11631175
@ <p>On the version-information pages linked from the timeline can either
11641176
@ show complete diffs of all file changes, or can just list the names of
11651177
@ the files that have changed. Users can get to either page by
11661178
@ clicking. This setting selects the default.</p>
11671179
11681180
@ <hr />
11691181
entry_attribute("Max timeline comment length", 6,
1170
- "timeline-max-comment", "tmc", "0");
1182
+ "timeline-max-comment", "tmc", "0", 0);
11711183
@ <p>The maximum length of a comment to be displayed in a timeline.
11721184
@ "0" there is no length limit.</p>
11731185
11741186
@ <hr />
11751187
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1200,11 +1212,11 @@
12001212
login_insert_csrf_secret();
12011213
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
12021214
if( pSet->width==0 ){
12031215
onoff_attribute(pSet->name, pSet->name,
12041216
pSet->var!=0 ? pSet->var : pSet->name,
1205
- is_truth(pSet->def));
1217
+ is_truth(pSet->def), 0);
12061218
if( pSet->versionable ){
12071219
@ (v)<br />
12081220
} else {
12091221
@ <br />
12101222
}
@@ -1213,21 +1225,21 @@
12131225
@ </td><td style="width:50px;"></td><td valign="top">
12141226
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
12151227
if( pSet->width!=0 && !pSet->versionable){
12161228
entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name,
12171229
pSet->var!=0 ? pSet->var : pSet->name,
1218
- (char*)pSet->def);
1230
+ (char*)pSet->def, 0);
12191231
@ <br />
12201232
}
12211233
}
12221234
@ </td><td style="width:50px;"></td><td valign="top">
12231235
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
12241236
if( pSet->width!=0 && pSet->versionable){
12251237
@<b>%s(pSet->name)</b> (v)<br />
12261238
textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name,
12271239
pSet->var!=0 ? pSet->var : pSet->name,
1228
- (char*)pSet->def);
1240
+ (char*)pSet->def, 0);
12291241
@<br />
12301242
}
12311243
}
12321244
@ </td></tr></table>
12331245
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1254,26 +1266,26 @@
12541266
style_header("WWW Configuration");
12551267
db_begin_transaction();
12561268
@ <form action="%s(g.zTop)/setup_config" method="post"><div>
12571269
login_insert_csrf_secret();
12581270
@ <hr />
1259
- entry_attribute("Project Name", 60, "project-name", "pn", "");
1271
+ entry_attribute("Project Name", 60, "project-name", "pn", "", 0);
12601272
@ <p>Give your project a name so visitors know what this site is about.
12611273
@ The project name will also be used as the RSS feed title.</p>
12621274
@ <hr />
12631275
textarea_attribute("Project Description", 3, 80,
1264
- "project-description", "pd", "");
1276
+ "project-description", "pd", "", 0);
12651277
@ <p>Describe your project. This will be used in page headers for search
12661278
@ engines as well as a short RSS description.</p>
12671279
@ <hr />
12681280
onoff_attribute("Enable WYSIWYG Wiki Editing",
1269
- "wysiwyg-wiki", "wysiwyg-wiki", 0);
1281
+ "wysiwyg-wiki", "wysiwyg-wiki", 0, 0);
12701282
@ <p>Enable what-you-see-is-what-you-get (WYSIWYG) editing of wiki pages.
12711283
@ The WYSIWYG editor generates HTML instead of markup, which makes
12721284
@ subsequent manual editing more difficult.</p>
12731285
@ <hr />
1274
- entry_attribute("Index Page", 60, "index-page", "idxpg", "/home");
1286
+ entry_attribute("Index Page", 60, "index-page", "idxpg", "/home", 0);
12751287
@ <p>Enter the pathname of the page to display when the "Home" menu
12761288
@ option is selected and when no pathname is
12771289
@ specified in the URL. For example, if you visit the url:</p>
12781290
@
12791291
@ <blockquote><p>%h(g.zBaseURL)</p></blockquote>
@@ -1291,11 +1303,11 @@
12911303
@ begin with "/" and it must specify a valid page. For example,
12921304
@ "<b>/home</b>" will work but "<b>home</b>" will not, since it omits the
12931305
@ leading "/".</p>
12941306
@ <hr />
12951307
onoff_attribute("Use HTML as wiki markup language",
1296
- "wiki-use-html", "wiki-use-html", 0);
1308
+ "wiki-use-html", "wiki-use-html", 0, 0);
12971309
@ <p>Use HTML as the wiki markup language. Wiki links will still be parsed
12981310
@ but all other wiki formatting will be ignored. This option is helpful
12991311
@ if you have chosen to use a rich HTML editor for wiki markup such as
13001312
@ TinyMCE.</p>
13011313
@ <p><strong>CAUTION:</strong> when
@@ -1326,19 +1338,19 @@
13261338
cgi_replace_parameter("css", zDefaultCSS);
13271339
db_end_transaction(0);
13281340
cgi_redirect("setup_editcss");
13291341
}
13301342
if( P("submit")!=0 ){
1331
- textarea_attribute(0, 0, 0, "css", "css", zDefaultCSS);
1343
+ textarea_attribute(0, 0, 0, "css", "css", zDefaultCSS, 0);
13321344
db_end_transaction(0);
13331345
cgi_redirect("setup_editcss");
13341346
}
13351347
style_header("Edit CSS");
13361348
@ <form action="%s(g.zTop)/setup_editcss" method="post"><div>
13371349
login_insert_csrf_secret();
13381350
@ Edit the CSS below:<br />
1339
- textarea_attribute("", 35, 80, "css", "css", zDefaultCSS);
1351
+ textarea_attribute("", 35, 80, "css", "css", zDefaultCSS, 0);
13401352
@ <br />
13411353
@ <input type="submit" name="submit" value="Apply Changes" />
13421354
@ <input type="submit" name="clear" value="Revert To Default" />
13431355
@ </div></form>
13441356
@ <p><span class="note">Note:</span> Press your browser Reload button after
@@ -1366,11 +1378,11 @@
13661378
db_begin_transaction();
13671379
if( P("clear")!=0 ){
13681380
db_multi_exec("DELETE FROM config WHERE name='header'");
13691381
cgi_replace_parameter("header", zDefaultHeader);
13701382
}else if( P("submit")!=0 ){
1371
- textarea_attribute(0, 0, 0, "header", "header", zDefaultHeader);
1383
+ textarea_attribute(0, 0, 0, "header", "header", zDefaultHeader, 0);
13721384
}else if( P("fixbase")!=0 ){
13731385
const char *z = db_get("header", (char*)zDefaultHeader);
13741386
char *zHead = strstr(z, "<head>");
13751387
if( strstr(z, "<base href=")==0 && zHead!=0 ){
13761388
char *zNew;
@@ -1397,11 +1409,11 @@
13971409
13981410
login_insert_csrf_secret();
13991411
@ <p>Edit HTML text with embedded TH1 (a TCL dialect) that will be used to
14001412
@ generate the beginning of every page through start of the main
14011413
@ menu.</p>
1402
- textarea_attribute("", 35, 80, "header", "header", zDefaultHeader);
1414
+ textarea_attribute("", 35, 80, "header", "header", zDefaultHeader, 0);
14031415
@ <br />
14041416
@ <input type="submit" name="submit" value="Apply Changes" />
14051417
@ <input type="submit" name="clear" value="Revert To Default" />
14061418
@ </div></form>
14071419
@ <hr />
@@ -1433,11 +1445,11 @@
14331445
style_header("Edit Page Footer");
14341446
@ <form action="%s(g.zTop)/setup_footer" method="post"><div>
14351447
login_insert_csrf_secret();
14361448
@ <p>Edit HTML text with embedded TH1 (a TCL dialect) that will be used to
14371449
@ generate the end of every page.</p>
1438
- textarea_attribute("", 20, 80, "footer", "footer", zDefaultFooter);
1450
+ textarea_attribute("", 20, 80, "footer", "footer", zDefaultFooter, 0);
14391451
@ <br />
14401452
@ <input type="submit" name="submit" value="Apply Changes" />
14411453
@ <input type="submit" name="clear" value="Revert To Default" />
14421454
@ </div></form>
14431455
@ <hr />
@@ -1465,11 +1477,11 @@
14651477
db_begin_transaction();
14661478
@ <form action="%R/setup_modreq" method="post"><div>
14671479
login_insert_csrf_secret();
14681480
@ <hr />
14691481
onoff_attribute("Moderate ticket changes",
1470
- "modreq-tkt", "modreq-tkt", 0);
1482
+ "modreq-tkt", "modreq-tkt", 0, 0);
14711483
@ <p>When enabled, any change to tickets is subject to the approval
14721484
@ a ticket moderator - a user with the "q" or Mod-Tkt privilege.
14731485
@ Ticket changes enter the system and are shown locally, but are not
14741486
@ synced until they are approved. The moderator has the option to
14751487
@ delete the change rather than approve it. Ticket changes made by
@@ -1476,11 +1488,11 @@
14761488
@ a user who hwas the Mod-Tkt privilege are never subject to
14771489
@ moderation.
14781490
@
14791491
@ <hr />
14801492
onoff_attribute("Moderate wiki changes",
1481
- "modreq-wiki", "modreq-wiki", 0);
1493
+ "modreq-wiki", "modreq-wiki", 0, 0);
14821494
@ <p>When enabled, any change to wiki is subject to the approval
14831495
@ a ticket moderator - a user with the "l" or Mod-Wiki privilege.
14841496
@ Wiki changes enter the system and are shown locally, but are not
14851497
@ synced until they are approved. The moderator has the option to
14861498
@ delete the change rather than approve it. Wiki changes made by
@@ -1513,17 +1525,17 @@
15131525
style_header("Edit Ad Unit");
15141526
@ <form action="%s(g.zTop)/setup_adunit" method="post"><div>
15151527
login_insert_csrf_secret();
15161528
@ <p>Edit HTML text for an ad unit that will be inserted after the
15171529
@ menu bar and above the content of every page.</p>
1518
- textarea_attribute("", 20, 80, "adunit", "adunit", "");
1530
+ textarea_attribute("", 20, 80, "adunit", "adunit", "", 0);
15191531
@ <br />
15201532
onoff_attribute("Omit ads to administrator",
1521
- "adunit-omit-if-admin", "oia", 0);
1533
+ "adunit-omit-if-admin", "oia", 0, 0);
15221534
@ <br />
15231535
onoff_attribute("Omit ads to logged-in users",
1524
- "adunit-omit-if-user", "oiu", 0);
1536
+ "adunit-omit-if-user", "oiu", 0, 0);
15251537
@ <br />
15261538
@ <input type="submit" name="submit" value="Apply Changes" />
15271539
@ <input type="submit" name="clear" value="Delete Ad-Unit" />
15281540
@ </div></form>
15291541
style_footer();
15301542
--- src/setup.c
+++ src/setup.c
@@ -768,11 +768,12 @@
768 */
769 static void onoff_attribute(
770 const char *zLabel, /* The text label on the checkbox */
771 const char *zVar, /* The corresponding row in the VAR table */
772 const char *zQParm, /* The query parameter */
773 int dfltVal /* Default value if VAR table entry does not exist */
 
774 ){
775 const char *zQ = P(zQParm);
776 int iVal = db_get_boolean(zVar, dfltVal);
777 if( zQ==0 && P("submit") ){
778 zQ = "off";
@@ -783,16 +784,18 @@
783 login_verify_csrf_secret();
784 db_set(zVar, iQ ? "1" : "0", 0);
785 iVal = iQ;
786 }
787 }
 
788 if( iVal ){
789 @ <input type="checkbox" name="%s(zQParm)" checked="checked" />
790 @ <b>%s(zLabel)</b>
791 }else{
792 @ <input type="checkbox" name="%s(zQParm)" /> <b>%s(zLabel)</b>
793 }
 
794 }
795
796 /*
797 ** Generate an entry box for an attribute.
798 */
@@ -799,21 +802,25 @@
799 void entry_attribute(
800 const char *zLabel, /* The text label on the entry box */
801 int width, /* Width of the entry box */
802 const char *zVar, /* The corresponding row in the VAR table */
803 const char *zQParm, /* The query parameter */
804 char *zDflt /* Default value if VAR table entry does not exist */
 
805 ){
806 const char *zVal = db_get(zVar, zDflt);
807 const char *zQ = P(zQParm);
808 if( zQ && fossil_strcmp(zQ,zVal)!=0 ){
809 login_verify_csrf_secret();
810 db_set(zVar, zQ, 0);
811 zVal = zQ;
812 }
813 @ <input type="text" name="%s(zQParm)" value="%h(zVal)" size="%d(width)" />
814 @ <b>%s(zLabel)</b>
 
 
 
815 }
816
817 /*
818 ** Generate a text box for an attribute.
819 */
@@ -821,11 +828,12 @@
821 const char *zLabel, /* The text label on the textarea */
822 int rows, /* Rows in the textarea */
823 int cols, /* Columns in the textarea */
824 const char *zVar, /* The corresponding row in the VAR table */
825 const char *zQP, /* The query parameter */
826 const char *zDflt /* Default value if VAR table entry does not exist */
 
827 ){
828 const char *z = db_get(zVar, (char*)zDflt);
829 const char *zQ = P(zQP);
830 if( zQ && fossil_strcmp(zQ,z)!=0 ){
831 login_verify_csrf_secret();
@@ -832,10 +840,13 @@
832 db_set(zVar, zQ, 0);
833 z = zQ;
834 }
835 if( rows>0 && cols>0 ){
836 @ <textarea id="id%s(zQP)" name="%s(zQP)" rows="%d(rows)"
 
 
 
837 @ cols="%d(cols)">%h(z)</textarea>
838 if( zLabel && *zLabel ){
839 @ <span class="textareaLabel">%s(zLabel)</span>
840 }
841 }
@@ -855,11 +866,11 @@
855 db_begin_transaction();
856 @ <form action="%s(g.zTop)/setup_access" method="post"><div>
857 login_insert_csrf_secret();
858 @ <hr />
859 onoff_attribute("Require password for local access",
860 "localauth", "localauth", 0);
861 @ <p>When enabled, the password sign-in is always required for
862 @ web access. When disabled, unrestricted web access from 127.0.0.1
863 @ is allowed for the <a href="%s(g.zTop)/help/ui">fossil ui</a> command or
864 @ from the <a href="%s(g.zTop)/help/server">fossil server</a>,
865 @ <a href="%s(g.zTop)/help/http">fossil http</a> commands when the
@@ -880,60 +891,61 @@
880 @ in the CGI script.
881 @ </ol>
882 @
883 @ <hr />
884 onoff_attribute("Enable /test_env",
885 "test_env_enable", "test_env_enable", 0);
886 @ <p>When enabled, the %h(g.zBaseURL)/test_env URL is available to all
887 @ users. When disabled (the default) only users Admin and Setup can visit
888 @ the /test_env page.
889 @ </p>
890 @
891 @ <hr />
892 onoff_attribute("Allow REMOTE_USER authentication",
893 "remote_user_ok", "remote_user_ok", 0);
894 @ <p>When enabled, if the REMOTE_USER environment variable is set to the
895 @ login name of a valid user and no other login credentials are available,
896 @ then the REMOTE_USER is accepted as an authenticated user.
897 @ </p>
898 @
899 @ <hr />
900 entry_attribute("IP address terms used in login cookie", 3,
901 "ip-prefix-terms", "ipt", "2");
902 @ <p>The number of octets of of the IP address used in the login cookie.
903 @ Set to zero to omit the IP address from the login cookie. A value of
904 @ 2 is recommended.
905 @ </p>
906 @
907 @ <hr />
908 entry_attribute("Login expiration time", 6, "cookie-expire", "cex", "8766");
 
909 @ <p>The number of hours for which a login is valid. This must be a
910 @ positive number. The default is 8766 hours which is approximately equal
911 @ to a year.</p>
912
913 @ <hr />
914 entry_attribute("Download packet limit", 10, "max-download", "mxdwn",
915 "5000000");
916 @ <p>Fossil tries to limit out-bound sync, clone, and pull packets
917 @ to this many bytes, uncompressed. If the client requires more data
918 @ than this, then the client will issue multiple HTTP requests.
919 @ Values below 1 million are not recommended. 5 million is a
920 @ reasonable number.</p>
921
922 @ <hr />
923 entry_attribute("Download time limit", 11, "max-download-time", "mxdwnt",
924 "30");
925
926 @ <p>Fossil tries to spend less than this many seconds gathering
927 @ the out-bound data of sync, clone, and pull packets.
928 @ If the client request takes longer, a partial reply is given similar
929 @ to the download packet limit. 30s is a reasonable default.</p>
930
931 @ <hr />
932 onoff_attribute(
933 "Enable hyperlinks for \"nobody\" based on User-Agent and Javascript",
934 "auto-hyperlink", "autohyperlink", 1);
935 @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users
936 @ including user "nobody", as long as (1) the User-Agent string in the
937 @ HTTP header indicates that the request is coming from an actual human
938 @ being and not a a robot or spider and (2) the user agent is able to
939 @ run Javascript in order to set the href= attribute of hyperlinks. Bots
@@ -948,30 +960,30 @@
948 @ even for relatively small projects.</p>
949 @
950 @ <p>Additional parameters that control this behavior:</p>
951 @ <blockquote>
952 onoff_attribute("Require mouse movement before enabling hyperlinks",
953 "auto-hyperlink-mouseover", "ahmo", 0);
954 @ <br>
955 entry_attribute("Delay before enabling hyperlinks (milliseconds)", 5,
956 "auto-hyperlink-delay", "ah-delay", "10");
957 @ </blockquote>
958 @ <p>Hyperlinks for user "nobody" are normally enabled as soon as the page
959 @ finishes loading. But the first check-box below can be set to require mouse
960 @ movement before enabling the links. One can also set a delay prior to enabling
961 @ links by enter a positive number of milliseconds in the entry box above.</p>
962
963 @ <hr />
964 onoff_attribute("Require a CAPTCHA if not logged in",
965 "require-captcha", "reqcapt", 1);
966 @ <p>Require a CAPTCHA for edit operations (appending, creating, or
967 @ editing wiki or tickets or adding attachments to wiki or tickets)
968 @ for users who are not logged in.</p>
969
970 @ <hr />
971 entry_attribute("Public pages", 30, "public-pages",
972 "pubpage", "");
973 @ <p>A comma-separated list of glob patterns for pages that are accessible
974 @ without needing a login and using the privileges given by the
975 @ "Default privileges" setting below. Example use case: Set this field
976 @ to "/doc/trunk/www/*" to give anonymous users read-only permission to the
977 @ latest version of the embedded documentation in the www/ folder without
@@ -978,30 +990,30 @@
978 @ allowing them to see the rest of the source code.
979 @ </p>
980
981 @ <hr />
982 onoff_attribute("Allow users to register themselves",
983 "self-register", "selfregister", 0);
984 @ <p>Allow users to register themselves through the HTTP UI.
985 @ The registration form always requires filling in a CAPTCHA
986 @ (<em>auto-captcha</em> setting is ignored). Still, bear in mind that anyone
987 @ can register under any user name. This option is useful for public projects
988 @ where you do not want everyone in any ticket discussion to be named
989 @ "Anonymous".</p>
990
991 @ <hr />
992 entry_attribute("Default privileges", 10, "default-perms",
993 "defaultperms", "u");
994 @ <p>Permissions given to users that... <ul><li>register themselves using
995 @ the self-registration procedure (if enabled), or <li>access "public"
996 @ pages identified by the public-pages glob pattern above, or <li>
997 @ are users newly created by the administrator.</ul>
998 @ </p>
999
1000 @ <hr />
1001 onoff_attribute("Show javascript button to fill in CAPTCHA",
1002 "auto-captcha", "autocaptcha", 0);
1003 @ <p>When enabled, a button appears on the login screen for user
1004 @ "anonymous" that will automatically fill in the CAPTCHA password.
1005 @ This is less secure than forcing the user to do it manually, but is
1006 @ probably secure enough and it is certainly more convenient for
1007 @ anonymous users.</p>
@@ -1124,23 +1136,23 @@
1124 @ <form action="%s(g.zTop)/setup_timeline" method="post"><div>
1125 login_insert_csrf_secret();
1126
1127 @ <hr />
1128 onoff_attribute("Allow block-markup in timeline",
1129 "timeline-block-markup", "tbm", 0);
1130 @ <p>In timeline displays, check-in comments can be displayed with or
1131 @ without block markup (paragraphs, tables, etc.)</p>
1132
1133 @ <hr />
1134 onoff_attribute("Plaintext comments on timelines",
1135 "timeline-plaintext", "tpt", 0);
1136 @ <p>In timeline displays, check-in comments are displayed literally,
1137 @ without any wiki or HTML interpretation.</p>
1138
1139 @ <hr />
1140 onoff_attribute("Use Universal Coordinated Time (UTC)",
1141 "timeline-utc", "utc", 1);
1142 @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
1143 @ Zulu) instead of in local time. On this server, local time is currently
1144 g.fTimeFormat = 2;
1145 tmDiff = db_double(0.0, "SELECT julianday('now')");
1146 tmDiff = db_double(0.0,
@@ -1157,19 +1169,19 @@
1157 @ %s(zTmDiff) hours ahead of UTC.</p>
1158 }
1159
1160 @ <hr />
1161 onoff_attribute("Show version differences by default",
1162 "show-version-diffs", "vdiff", 0);
1163 @ <p>On the version-information pages linked from the timeline can either
1164 @ show complete diffs of all file changes, or can just list the names of
1165 @ the files that have changed. Users can get to either page by
1166 @ clicking. This setting selects the default.</p>
1167
1168 @ <hr />
1169 entry_attribute("Max timeline comment length", 6,
1170 "timeline-max-comment", "tmc", "0");
1171 @ <p>The maximum length of a comment to be displayed in a timeline.
1172 @ "0" there is no length limit.</p>
1173
1174 @ <hr />
1175 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1200,11 +1212,11 @@
1200 login_insert_csrf_secret();
1201 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1202 if( pSet->width==0 ){
1203 onoff_attribute(pSet->name, pSet->name,
1204 pSet->var!=0 ? pSet->var : pSet->name,
1205 is_truth(pSet->def));
1206 if( pSet->versionable ){
1207 @ (v)<br />
1208 } else {
1209 @ <br />
1210 }
@@ -1213,21 +1225,21 @@
1213 @ </td><td style="width:50px;"></td><td valign="top">
1214 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1215 if( pSet->width!=0 && !pSet->versionable){
1216 entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name,
1217 pSet->var!=0 ? pSet->var : pSet->name,
1218 (char*)pSet->def);
1219 @ <br />
1220 }
1221 }
1222 @ </td><td style="width:50px;"></td><td valign="top">
1223 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1224 if( pSet->width!=0 && pSet->versionable){
1225 @<b>%s(pSet->name)</b> (v)<br />
1226 textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name,
1227 pSet->var!=0 ? pSet->var : pSet->name,
1228 (char*)pSet->def);
1229 @<br />
1230 }
1231 }
1232 @ </td></tr></table>
1233 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1254,26 +1266,26 @@
1254 style_header("WWW Configuration");
1255 db_begin_transaction();
1256 @ <form action="%s(g.zTop)/setup_config" method="post"><div>
1257 login_insert_csrf_secret();
1258 @ <hr />
1259 entry_attribute("Project Name", 60, "project-name", "pn", "");
1260 @ <p>Give your project a name so visitors know what this site is about.
1261 @ The project name will also be used as the RSS feed title.</p>
1262 @ <hr />
1263 textarea_attribute("Project Description", 3, 80,
1264 "project-description", "pd", "");
1265 @ <p>Describe your project. This will be used in page headers for search
1266 @ engines as well as a short RSS description.</p>
1267 @ <hr />
1268 onoff_attribute("Enable WYSIWYG Wiki Editing",
1269 "wysiwyg-wiki", "wysiwyg-wiki", 0);
1270 @ <p>Enable what-you-see-is-what-you-get (WYSIWYG) editing of wiki pages.
1271 @ The WYSIWYG editor generates HTML instead of markup, which makes
1272 @ subsequent manual editing more difficult.</p>
1273 @ <hr />
1274 entry_attribute("Index Page", 60, "index-page", "idxpg", "/home");
1275 @ <p>Enter the pathname of the page to display when the "Home" menu
1276 @ option is selected and when no pathname is
1277 @ specified in the URL. For example, if you visit the url:</p>
1278 @
1279 @ <blockquote><p>%h(g.zBaseURL)</p></blockquote>
@@ -1291,11 +1303,11 @@
1291 @ begin with "/" and it must specify a valid page. For example,
1292 @ "<b>/home</b>" will work but "<b>home</b>" will not, since it omits the
1293 @ leading "/".</p>
1294 @ <hr />
1295 onoff_attribute("Use HTML as wiki markup language",
1296 "wiki-use-html", "wiki-use-html", 0);
1297 @ <p>Use HTML as the wiki markup language. Wiki links will still be parsed
1298 @ but all other wiki formatting will be ignored. This option is helpful
1299 @ if you have chosen to use a rich HTML editor for wiki markup such as
1300 @ TinyMCE.</p>
1301 @ <p><strong>CAUTION:</strong> when
@@ -1326,19 +1338,19 @@
1326 cgi_replace_parameter("css", zDefaultCSS);
1327 db_end_transaction(0);
1328 cgi_redirect("setup_editcss");
1329 }
1330 if( P("submit")!=0 ){
1331 textarea_attribute(0, 0, 0, "css", "css", zDefaultCSS);
1332 db_end_transaction(0);
1333 cgi_redirect("setup_editcss");
1334 }
1335 style_header("Edit CSS");
1336 @ <form action="%s(g.zTop)/setup_editcss" method="post"><div>
1337 login_insert_csrf_secret();
1338 @ Edit the CSS below:<br />
1339 textarea_attribute("", 35, 80, "css", "css", zDefaultCSS);
1340 @ <br />
1341 @ <input type="submit" name="submit" value="Apply Changes" />
1342 @ <input type="submit" name="clear" value="Revert To Default" />
1343 @ </div></form>
1344 @ <p><span class="note">Note:</span> Press your browser Reload button after
@@ -1366,11 +1378,11 @@
1366 db_begin_transaction();
1367 if( P("clear")!=0 ){
1368 db_multi_exec("DELETE FROM config WHERE name='header'");
1369 cgi_replace_parameter("header", zDefaultHeader);
1370 }else if( P("submit")!=0 ){
1371 textarea_attribute(0, 0, 0, "header", "header", zDefaultHeader);
1372 }else if( P("fixbase")!=0 ){
1373 const char *z = db_get("header", (char*)zDefaultHeader);
1374 char *zHead = strstr(z, "<head>");
1375 if( strstr(z, "<base href=")==0 && zHead!=0 ){
1376 char *zNew;
@@ -1397,11 +1409,11 @@
1397
1398 login_insert_csrf_secret();
1399 @ <p>Edit HTML text with embedded TH1 (a TCL dialect) that will be used to
1400 @ generate the beginning of every page through start of the main
1401 @ menu.</p>
1402 textarea_attribute("", 35, 80, "header", "header", zDefaultHeader);
1403 @ <br />
1404 @ <input type="submit" name="submit" value="Apply Changes" />
1405 @ <input type="submit" name="clear" value="Revert To Default" />
1406 @ </div></form>
1407 @ <hr />
@@ -1433,11 +1445,11 @@
1433 style_header("Edit Page Footer");
1434 @ <form action="%s(g.zTop)/setup_footer" method="post"><div>
1435 login_insert_csrf_secret();
1436 @ <p>Edit HTML text with embedded TH1 (a TCL dialect) that will be used to
1437 @ generate the end of every page.</p>
1438 textarea_attribute("", 20, 80, "footer", "footer", zDefaultFooter);
1439 @ <br />
1440 @ <input type="submit" name="submit" value="Apply Changes" />
1441 @ <input type="submit" name="clear" value="Revert To Default" />
1442 @ </div></form>
1443 @ <hr />
@@ -1465,11 +1477,11 @@
1465 db_begin_transaction();
1466 @ <form action="%R/setup_modreq" method="post"><div>
1467 login_insert_csrf_secret();
1468 @ <hr />
1469 onoff_attribute("Moderate ticket changes",
1470 "modreq-tkt", "modreq-tkt", 0);
1471 @ <p>When enabled, any change to tickets is subject to the approval
1472 @ a ticket moderator - a user with the "q" or Mod-Tkt privilege.
1473 @ Ticket changes enter the system and are shown locally, but are not
1474 @ synced until they are approved. The moderator has the option to
1475 @ delete the change rather than approve it. Ticket changes made by
@@ -1476,11 +1488,11 @@
1476 @ a user who hwas the Mod-Tkt privilege are never subject to
1477 @ moderation.
1478 @
1479 @ <hr />
1480 onoff_attribute("Moderate wiki changes",
1481 "modreq-wiki", "modreq-wiki", 0);
1482 @ <p>When enabled, any change to wiki is subject to the approval
1483 @ a ticket moderator - a user with the "l" or Mod-Wiki privilege.
1484 @ Wiki changes enter the system and are shown locally, but are not
1485 @ synced until they are approved. The moderator has the option to
1486 @ delete the change rather than approve it. Wiki changes made by
@@ -1513,17 +1525,17 @@
1513 style_header("Edit Ad Unit");
1514 @ <form action="%s(g.zTop)/setup_adunit" method="post"><div>
1515 login_insert_csrf_secret();
1516 @ <p>Edit HTML text for an ad unit that will be inserted after the
1517 @ menu bar and above the content of every page.</p>
1518 textarea_attribute("", 20, 80, "adunit", "adunit", "");
1519 @ <br />
1520 onoff_attribute("Omit ads to administrator",
1521 "adunit-omit-if-admin", "oia", 0);
1522 @ <br />
1523 onoff_attribute("Omit ads to logged-in users",
1524 "adunit-omit-if-user", "oiu", 0);
1525 @ <br />
1526 @ <input type="submit" name="submit" value="Apply Changes" />
1527 @ <input type="submit" name="clear" value="Delete Ad-Unit" />
1528 @ </div></form>
1529 style_footer();
1530
--- src/setup.c
+++ src/setup.c
@@ -768,11 +768,12 @@
768 */
769 static void onoff_attribute(
770 const char *zLabel, /* The text label on the checkbox */
771 const char *zVar, /* The corresponding row in the VAR table */
772 const char *zQParm, /* The query parameter */
773 int dfltVal, /* Default value if VAR table entry does not exist */
774 int disabled /* 1 if disabled */
775 ){
776 const char *zQ = P(zQParm);
777 int iVal = db_get_boolean(zVar, dfltVal);
778 if( zQ==0 && P("submit") ){
779 zQ = "off";
@@ -783,16 +784,18 @@
784 login_verify_csrf_secret();
785 db_set(zVar, iQ ? "1" : "0", 0);
786 iVal = iQ;
787 }
788 }
789 @ <input type="checkbox" name="%s(zQParm)"
790 if( iVal ){
791 @ checked="checked"
792 }
793 if( disabled ){
794 @ disabled="disabled"
795 }
796 @ /> <b>%s(zLabel)</b>
797 }
798
799 /*
800 ** Generate an entry box for an attribute.
801 */
@@ -799,21 +802,25 @@
802 void entry_attribute(
803 const char *zLabel, /* The text label on the entry box */
804 int width, /* Width of the entry box */
805 const char *zVar, /* The corresponding row in the VAR table */
806 const char *zQParm, /* The query parameter */
807 char *zDflt, /* Default value if VAR table entry does not exist */
808 int disabled /* 1 if disabled */
809 ){
810 const char *zVal = db_get(zVar, zDflt);
811 const char *zQ = P(zQParm);
812 if( zQ && fossil_strcmp(zQ,zVal)!=0 ){
813 login_verify_csrf_secret();
814 db_set(zVar, zQ, 0);
815 zVal = zQ;
816 }
817 @ <input type="text" name="%s(zQParm)" value="%h(zVal)" size="%d(width)"
818 if( disabled ){
819 @ disabled="disabled"
820 }
821 @ /> <b>%s(zLabel)</b>
822 }
823
824 /*
825 ** Generate a text box for an attribute.
826 */
@@ -821,11 +828,12 @@
828 const char *zLabel, /* The text label on the textarea */
829 int rows, /* Rows in the textarea */
830 int cols, /* Columns in the textarea */
831 const char *zVar, /* The corresponding row in the VAR table */
832 const char *zQP, /* The query parameter */
833 const char *zDflt, /* Default value if VAR table entry does not exist */
834 int disabled /* 1 if the textarea should not be editable */
835 ){
836 const char *z = db_get(zVar, (char*)zDflt);
837 const char *zQ = P(zQP);
838 if( zQ && fossil_strcmp(zQ,z)!=0 ){
839 login_verify_csrf_secret();
@@ -832,10 +840,13 @@
840 db_set(zVar, zQ, 0);
841 z = zQ;
842 }
843 if( rows>0 && cols>0 ){
844 @ <textarea id="id%s(zQP)" name="%s(zQP)" rows="%d(rows)"
845 if( disabled ){
846 @ disabled="disabled"
847 }
848 @ cols="%d(cols)">%h(z)</textarea>
849 if( zLabel && *zLabel ){
850 @ <span class="textareaLabel">%s(zLabel)</span>
851 }
852 }
@@ -855,11 +866,11 @@
866 db_begin_transaction();
867 @ <form action="%s(g.zTop)/setup_access" method="post"><div>
868 login_insert_csrf_secret();
869 @ <hr />
870 onoff_attribute("Require password for local access",
871 "localauth", "localauth", 0, 0);
872 @ <p>When enabled, the password sign-in is always required for
873 @ web access. When disabled, unrestricted web access from 127.0.0.1
874 @ is allowed for the <a href="%s(g.zTop)/help/ui">fossil ui</a> command or
875 @ from the <a href="%s(g.zTop)/help/server">fossil server</a>,
876 @ <a href="%s(g.zTop)/help/http">fossil http</a> commands when the
@@ -880,60 +891,61 @@
891 @ in the CGI script.
892 @ </ol>
893 @
894 @ <hr />
895 onoff_attribute("Enable /test_env",
896 "test_env_enable", "test_env_enable", 0, 0);
897 @ <p>When enabled, the %h(g.zBaseURL)/test_env URL is available to all
898 @ users. When disabled (the default) only users Admin and Setup can visit
899 @ the /test_env page.
900 @ </p>
901 @
902 @ <hr />
903 onoff_attribute("Allow REMOTE_USER authentication",
904 "remote_user_ok", "remote_user_ok", 0, 0);
905 @ <p>When enabled, if the REMOTE_USER environment variable is set to the
906 @ login name of a valid user and no other login credentials are available,
907 @ then the REMOTE_USER is accepted as an authenticated user.
908 @ </p>
909 @
910 @ <hr />
911 entry_attribute("IP address terms used in login cookie", 3,
912 "ip-prefix-terms", "ipt", "2", 0);
913 @ <p>The number of octets of of the IP address used in the login cookie.
914 @ Set to zero to omit the IP address from the login cookie. A value of
915 @ 2 is recommended.
916 @ </p>
917 @
918 @ <hr />
919 entry_attribute("Login expiration time", 6, "cookie-expire", "cex",
920 "8766", 0);
921 @ <p>The number of hours for which a login is valid. This must be a
922 @ positive number. The default is 8766 hours which is approximately equal
923 @ to a year.</p>
924
925 @ <hr />
926 entry_attribute("Download packet limit", 10, "max-download", "mxdwn",
927 "5000000", 0);
928 @ <p>Fossil tries to limit out-bound sync, clone, and pull packets
929 @ to this many bytes, uncompressed. If the client requires more data
930 @ than this, then the client will issue multiple HTTP requests.
931 @ Values below 1 million are not recommended. 5 million is a
932 @ reasonable number.</p>
933
934 @ <hr />
935 entry_attribute("Download time limit", 11, "max-download-time", "mxdwnt",
936 "30", 0);
937
938 @ <p>Fossil tries to spend less than this many seconds gathering
939 @ the out-bound data of sync, clone, and pull packets.
940 @ If the client request takes longer, a partial reply is given similar
941 @ to the download packet limit. 30s is a reasonable default.</p>
942
943 @ <hr />
944 onoff_attribute(
945 "Enable hyperlinks for \"nobody\" based on User-Agent and Javascript",
946 "auto-hyperlink", "autohyperlink", 1, 0);
947 @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users
948 @ including user "nobody", as long as (1) the User-Agent string in the
949 @ HTTP header indicates that the request is coming from an actual human
950 @ being and not a a robot or spider and (2) the user agent is able to
951 @ run Javascript in order to set the href= attribute of hyperlinks. Bots
@@ -948,30 +960,30 @@
960 @ even for relatively small projects.</p>
961 @
962 @ <p>Additional parameters that control this behavior:</p>
963 @ <blockquote>
964 onoff_attribute("Require mouse movement before enabling hyperlinks",
965 "auto-hyperlink-mouseover", "ahmo", 0, 0);
966 @ <br>
967 entry_attribute("Delay before enabling hyperlinks (milliseconds)", 5,
968 "auto-hyperlink-delay", "ah-delay", "10", 0);
969 @ </blockquote>
970 @ <p>Hyperlinks for user "nobody" are normally enabled as soon as the page
971 @ finishes loading. But the first check-box below can be set to require mouse
972 @ movement before enabling the links. One can also set a delay prior to enabling
973 @ links by enter a positive number of milliseconds in the entry box above.</p>
974
975 @ <hr />
976 onoff_attribute("Require a CAPTCHA if not logged in",
977 "require-captcha", "reqcapt", 1, 0);
978 @ <p>Require a CAPTCHA for edit operations (appending, creating, or
979 @ editing wiki or tickets or adding attachments to wiki or tickets)
980 @ for users who are not logged in.</p>
981
982 @ <hr />
983 entry_attribute("Public pages", 30, "public-pages",
984 "pubpage", "", 0);
985 @ <p>A comma-separated list of glob patterns for pages that are accessible
986 @ without needing a login and using the privileges given by the
987 @ "Default privileges" setting below. Example use case: Set this field
988 @ to "/doc/trunk/www/*" to give anonymous users read-only permission to the
989 @ latest version of the embedded documentation in the www/ folder without
@@ -978,30 +990,30 @@
990 @ allowing them to see the rest of the source code.
991 @ </p>
992
993 @ <hr />
994 onoff_attribute("Allow users to register themselves",
995 "self-register", "selfregister", 0, 0);
996 @ <p>Allow users to register themselves through the HTTP UI.
997 @ The registration form always requires filling in a CAPTCHA
998 @ (<em>auto-captcha</em> setting is ignored). Still, bear in mind that anyone
999 @ can register under any user name. This option is useful for public projects
1000 @ where you do not want everyone in any ticket discussion to be named
1001 @ "Anonymous".</p>
1002
1003 @ <hr />
1004 entry_attribute("Default privileges", 10, "default-perms",
1005 "defaultperms", "u", 0);
1006 @ <p>Permissions given to users that... <ul><li>register themselves using
1007 @ the self-registration procedure (if enabled), or <li>access "public"
1008 @ pages identified by the public-pages glob pattern above, or <li>
1009 @ are users newly created by the administrator.</ul>
1010 @ </p>
1011
1012 @ <hr />
1013 onoff_attribute("Show javascript button to fill in CAPTCHA",
1014 "auto-captcha", "autocaptcha", 0, 0);
1015 @ <p>When enabled, a button appears on the login screen for user
1016 @ "anonymous" that will automatically fill in the CAPTCHA password.
1017 @ This is less secure than forcing the user to do it manually, but is
1018 @ probably secure enough and it is certainly more convenient for
1019 @ anonymous users.</p>
@@ -1124,23 +1136,23 @@
1136 @ <form action="%s(g.zTop)/setup_timeline" method="post"><div>
1137 login_insert_csrf_secret();
1138
1139 @ <hr />
1140 onoff_attribute("Allow block-markup in timeline",
1141 "timeline-block-markup", "tbm", 0, 0);
1142 @ <p>In timeline displays, check-in comments can be displayed with or
1143 @ without block markup (paragraphs, tables, etc.)</p>
1144
1145 @ <hr />
1146 onoff_attribute("Plaintext comments on timelines",
1147 "timeline-plaintext", "tpt", 0, 0);
1148 @ <p>In timeline displays, check-in comments are displayed literally,
1149 @ without any wiki or HTML interpretation.</p>
1150
1151 @ <hr />
1152 onoff_attribute("Use Universal Coordinated Time (UTC)",
1153 "timeline-utc", "utc", 1, 0);
1154 @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
1155 @ Zulu) instead of in local time. On this server, local time is currently
1156 g.fTimeFormat = 2;
1157 tmDiff = db_double(0.0, "SELECT julianday('now')");
1158 tmDiff = db_double(0.0,
@@ -1157,19 +1169,19 @@
1169 @ %s(zTmDiff) hours ahead of UTC.</p>
1170 }
1171
1172 @ <hr />
1173 onoff_attribute("Show version differences by default",
1174 "show-version-diffs", "vdiff", 0, 0);
1175 @ <p>On the version-information pages linked from the timeline can either
1176 @ show complete diffs of all file changes, or can just list the names of
1177 @ the files that have changed. Users can get to either page by
1178 @ clicking. This setting selects the default.</p>
1179
1180 @ <hr />
1181 entry_attribute("Max timeline comment length", 6,
1182 "timeline-max-comment", "tmc", "0", 0);
1183 @ <p>The maximum length of a comment to be displayed in a timeline.
1184 @ "0" there is no length limit.</p>
1185
1186 @ <hr />
1187 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1200,11 +1212,11 @@
1212 login_insert_csrf_secret();
1213 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1214 if( pSet->width==0 ){
1215 onoff_attribute(pSet->name, pSet->name,
1216 pSet->var!=0 ? pSet->var : pSet->name,
1217 is_truth(pSet->def), 0);
1218 if( pSet->versionable ){
1219 @ (v)<br />
1220 } else {
1221 @ <br />
1222 }
@@ -1213,21 +1225,21 @@
1225 @ </td><td style="width:50px;"></td><td valign="top">
1226 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1227 if( pSet->width!=0 && !pSet->versionable){
1228 entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name,
1229 pSet->var!=0 ? pSet->var : pSet->name,
1230 (char*)pSet->def, 0);
1231 @ <br />
1232 }
1233 }
1234 @ </td><td style="width:50px;"></td><td valign="top">
1235 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1236 if( pSet->width!=0 && pSet->versionable){
1237 @<b>%s(pSet->name)</b> (v)<br />
1238 textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name,
1239 pSet->var!=0 ? pSet->var : pSet->name,
1240 (char*)pSet->def, 0);
1241 @<br />
1242 }
1243 }
1244 @ </td></tr></table>
1245 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@@ -1254,26 +1266,26 @@
1266 style_header("WWW Configuration");
1267 db_begin_transaction();
1268 @ <form action="%s(g.zTop)/setup_config" method="post"><div>
1269 login_insert_csrf_secret();
1270 @ <hr />
1271 entry_attribute("Project Name", 60, "project-name", "pn", "", 0);
1272 @ <p>Give your project a name so visitors know what this site is about.
1273 @ The project name will also be used as the RSS feed title.</p>
1274 @ <hr />
1275 textarea_attribute("Project Description", 3, 80,
1276 "project-description", "pd", "", 0);
1277 @ <p>Describe your project. This will be used in page headers for search
1278 @ engines as well as a short RSS description.</p>
1279 @ <hr />
1280 onoff_attribute("Enable WYSIWYG Wiki Editing",
1281 "wysiwyg-wiki", "wysiwyg-wiki", 0, 0);
1282 @ <p>Enable what-you-see-is-what-you-get (WYSIWYG) editing of wiki pages.
1283 @ The WYSIWYG editor generates HTML instead of markup, which makes
1284 @ subsequent manual editing more difficult.</p>
1285 @ <hr />
1286 entry_attribute("Index Page", 60, "index-page", "idxpg", "/home", 0);
1287 @ <p>Enter the pathname of the page to display when the "Home" menu
1288 @ option is selected and when no pathname is
1289 @ specified in the URL. For example, if you visit the url:</p>
1290 @
1291 @ <blockquote><p>%h(g.zBaseURL)</p></blockquote>
@@ -1291,11 +1303,11 @@
1303 @ begin with "/" and it must specify a valid page. For example,
1304 @ "<b>/home</b>" will work but "<b>home</b>" will not, since it omits the
1305 @ leading "/".</p>
1306 @ <hr />
1307 onoff_attribute("Use HTML as wiki markup language",
1308 "wiki-use-html", "wiki-use-html", 0, 0);
1309 @ <p>Use HTML as the wiki markup language. Wiki links will still be parsed
1310 @ but all other wiki formatting will be ignored. This option is helpful
1311 @ if you have chosen to use a rich HTML editor for wiki markup such as
1312 @ TinyMCE.</p>
1313 @ <p><strong>CAUTION:</strong> when
@@ -1326,19 +1338,19 @@
1338 cgi_replace_parameter("css", zDefaultCSS);
1339 db_end_transaction(0);
1340 cgi_redirect("setup_editcss");
1341 }
1342 if( P("submit")!=0 ){
1343 textarea_attribute(0, 0, 0, "css", "css", zDefaultCSS, 0);
1344 db_end_transaction(0);
1345 cgi_redirect("setup_editcss");
1346 }
1347 style_header("Edit CSS");
1348 @ <form action="%s(g.zTop)/setup_editcss" method="post"><div>
1349 login_insert_csrf_secret();
1350 @ Edit the CSS below:<br />
1351 textarea_attribute("", 35, 80, "css", "css", zDefaultCSS, 0);
1352 @ <br />
1353 @ <input type="submit" name="submit" value="Apply Changes" />
1354 @ <input type="submit" name="clear" value="Revert To Default" />
1355 @ </div></form>
1356 @ <p><span class="note">Note:</span> Press your browser Reload button after
@@ -1366,11 +1378,11 @@
1378 db_begin_transaction();
1379 if( P("clear")!=0 ){
1380 db_multi_exec("DELETE FROM config WHERE name='header'");
1381 cgi_replace_parameter("header", zDefaultHeader);
1382 }else if( P("submit")!=0 ){
1383 textarea_attribute(0, 0, 0, "header", "header", zDefaultHeader, 0);
1384 }else if( P("fixbase")!=0 ){
1385 const char *z = db_get("header", (char*)zDefaultHeader);
1386 char *zHead = strstr(z, "<head>");
1387 if( strstr(z, "<base href=")==0 && zHead!=0 ){
1388 char *zNew;
@@ -1397,11 +1409,11 @@
1409
1410 login_insert_csrf_secret();
1411 @ <p>Edit HTML text with embedded TH1 (a TCL dialect) that will be used to
1412 @ generate the beginning of every page through start of the main
1413 @ menu.</p>
1414 textarea_attribute("", 35, 80, "header", "header", zDefaultHeader, 0);
1415 @ <br />
1416 @ <input type="submit" name="submit" value="Apply Changes" />
1417 @ <input type="submit" name="clear" value="Revert To Default" />
1418 @ </div></form>
1419 @ <hr />
@@ -1433,11 +1445,11 @@
1445 style_header("Edit Page Footer");
1446 @ <form action="%s(g.zTop)/setup_footer" method="post"><div>
1447 login_insert_csrf_secret();
1448 @ <p>Edit HTML text with embedded TH1 (a TCL dialect) that will be used to
1449 @ generate the end of every page.</p>
1450 textarea_attribute("", 20, 80, "footer", "footer", zDefaultFooter, 0);
1451 @ <br />
1452 @ <input type="submit" name="submit" value="Apply Changes" />
1453 @ <input type="submit" name="clear" value="Revert To Default" />
1454 @ </div></form>
1455 @ <hr />
@@ -1465,11 +1477,11 @@
1477 db_begin_transaction();
1478 @ <form action="%R/setup_modreq" method="post"><div>
1479 login_insert_csrf_secret();
1480 @ <hr />
1481 onoff_attribute("Moderate ticket changes",
1482 "modreq-tkt", "modreq-tkt", 0, 0);
1483 @ <p>When enabled, any change to tickets is subject to the approval
1484 @ a ticket moderator - a user with the "q" or Mod-Tkt privilege.
1485 @ Ticket changes enter the system and are shown locally, but are not
1486 @ synced until they are approved. The moderator has the option to
1487 @ delete the change rather than approve it. Ticket changes made by
@@ -1476,11 +1488,11 @@
1488 @ a user who hwas the Mod-Tkt privilege are never subject to
1489 @ moderation.
1490 @
1491 @ <hr />
1492 onoff_attribute("Moderate wiki changes",
1493 "modreq-wiki", "modreq-wiki", 0, 0);
1494 @ <p>When enabled, any change to wiki is subject to the approval
1495 @ a ticket moderator - a user with the "l" or Mod-Wiki privilege.
1496 @ Wiki changes enter the system and are shown locally, but are not
1497 @ synced until they are approved. The moderator has the option to
1498 @ delete the change rather than approve it. Wiki changes made by
@@ -1513,17 +1525,17 @@
1525 style_header("Edit Ad Unit");
1526 @ <form action="%s(g.zTop)/setup_adunit" method="post"><div>
1527 login_insert_csrf_secret();
1528 @ <p>Edit HTML text for an ad unit that will be inserted after the
1529 @ menu bar and above the content of every page.</p>
1530 textarea_attribute("", 20, 80, "adunit", "adunit", "", 0);
1531 @ <br />
1532 onoff_attribute("Omit ads to administrator",
1533 "adunit-omit-if-admin", "oia", 0, 0);
1534 @ <br />
1535 onoff_attribute("Omit ads to logged-in users",
1536 "adunit-omit-if-user", "oiu", 0, 0);
1537 @ <br />
1538 @ <input type="submit" name="submit" value="Apply Changes" />
1539 @ <input type="submit" name="clear" value="Delete Ad-Unit" />
1540 @ </div></form>
1541 style_footer();
1542
+5 -3
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -855,22 +855,24 @@
855855
db_begin_transaction();
856856
@ <form action="%s(g.zTop)/tktsetup_timeline" method="post"><div>
857857
login_insert_csrf_secret();
858858
859859
@ <hr />
860
- entry_attribute("Ticket Title", 40, "ticket-title-expr", "t", "title");
860
+ entry_attribute("Ticket Title", 40, "ticket-title-expr", "t",
861
+ "title", 0);
861862
@ <p>An SQL expression in a query against the TICKET table that will
862863
@ return the title of the ticket for display purposes.</p>
863864
864865
@ <hr />
865
- entry_attribute("Ticket Status", 40, "ticket-status-column", "s", "status");
866
+ entry_attribute("Ticket Status", 40, "ticket-status-column", "s",
867
+ "status", 0);
866868
@ <p>The name of the column in the TICKET table that contains the ticket
867869
@ status in human-readable form. Case sensitive.</p>
868870
869871
@ <hr />
870872
entry_attribute("Ticket Closed", 40, "ticket-closed-expr", "c",
871
- "status='Closed'");
873
+ "status='Closed'", 0);
872874
@ <p>An SQL expression that evaluates to true in a TICKET table query if
873875
@ the ticket is closed.</p>
874876
875877
@ <hr />
876878
@ <p>
877879
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -855,22 +855,24 @@
855 db_begin_transaction();
856 @ <form action="%s(g.zTop)/tktsetup_timeline" method="post"><div>
857 login_insert_csrf_secret();
858
859 @ <hr />
860 entry_attribute("Ticket Title", 40, "ticket-title-expr", "t", "title");
 
861 @ <p>An SQL expression in a query against the TICKET table that will
862 @ return the title of the ticket for display purposes.</p>
863
864 @ <hr />
865 entry_attribute("Ticket Status", 40, "ticket-status-column", "s", "status");
 
866 @ <p>The name of the column in the TICKET table that contains the ticket
867 @ status in human-readable form. Case sensitive.</p>
868
869 @ <hr />
870 entry_attribute("Ticket Closed", 40, "ticket-closed-expr", "c",
871 "status='Closed'");
872 @ <p>An SQL expression that evaluates to true in a TICKET table query if
873 @ the ticket is closed.</p>
874
875 @ <hr />
876 @ <p>
877
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -855,22 +855,24 @@
855 db_begin_transaction();
856 @ <form action="%s(g.zTop)/tktsetup_timeline" method="post"><div>
857 login_insert_csrf_secret();
858
859 @ <hr />
860 entry_attribute("Ticket Title", 40, "ticket-title-expr", "t",
861 "title", 0);
862 @ <p>An SQL expression in a query against the TICKET table that will
863 @ return the title of the ticket for display purposes.</p>
864
865 @ <hr />
866 entry_attribute("Ticket Status", 40, "ticket-status-column", "s",
867 "status", 0);
868 @ <p>The name of the column in the TICKET table that contains the ticket
869 @ status in human-readable form. Case sensitive.</p>
870
871 @ <hr />
872 entry_attribute("Ticket Closed", 40, "ticket-closed-expr", "c",
873 "status='Closed'", 0);
874 @ <p>An SQL expression that evaluates to true in a TICKET table query if
875 @ the ticket is closed.</p>
876
877 @ <hr />
878 @ <p>
879

Keyboard Shortcuts

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