Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Merge updates from trunk. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | cleanX |
| Files: | files | file ages | folders |
| SHA1: |
4452f851562c6e96a935b3cadee51315 |
| User & Date: | mistachkin 2013-05-28 21:31:57.892 |
Context
|
2013-10-01
| ||
| 23:01 | Merge updates from trunk. check-in: 8d2f9ab128 user: mistachkin tags: cleanX | |
|
2013-05-29
| ||
| 07:35 | Protect fossil executable better against removal by "fossil clean -x" without getting a dialog for it. check-in: bd86711f84 user: jan.nijtmans tags: cleanX | |
|
2013-05-28
| ||
| 21:31 | Merge updates from trunk. check-in: 4452f85156 user: mistachkin tags: cleanX | |
| 21:23 | Add a robust warning and prompt for the 'extreme' clean operation. check-in: 4af673cc20 user: mistachkin tags: cleanX | |
| 15:17 | Add the Tips and Usage Hints document. check-in: fda5b81880 user: drh tags: trunk | |
Changes
Changes to src/diff.c.
| ︙ | ︙ | |||
2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 |
/*
** Return a color from a gradient.
*/
unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){
unsigned c; /* Result color */
unsigned x1, x2;
x1 = (c1>>16)&0xff;
x2 = (c2>>16)&0xff;
c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000;
x1 = (c1>>8)&0xff;
x2 = (c2>>8)&0xff;
c |= (x1*(n-i) + x2*i)/n<<8 & 0xff00;
x1 = c1&0xff;
| > | 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 |
/*
** Return a color from a gradient.
*/
unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){
unsigned c; /* Result color */
unsigned x1, x2;
if( i==0 || n==0 ) return c1;
x1 = (c1>>16)&0xff;
x2 = (c2>>16)&0xff;
c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000;
x1 = (c1>>8)&0xff;
x2 = (c2>>8)&0xff;
c |= (x1*(n-i) + x2*i)/n<<8 & 0xff00;
x1 = c1&0xff;
|
| ︙ | ︙ |
Changes to src/doc.c.
| ︙ | ︙ | |||
269 270 271 272 273 274 275 |
{ "vcd", 3, "application/x-cdlink" },
{ "vda", 3, "application/vda" },
{ "viv", 3, "video/vnd.vivo" },
{ "vivo", 4, "video/vnd.vivo" },
{ "vrml", 4, "model/vrml" },
{ "wav", 3, "audio/x-wav" },
{ "wax", 3, "audio/x-ms-wax" },
| | | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
{ "vcd", 3, "application/x-cdlink" },
{ "vda", 3, "application/vda" },
{ "viv", 3, "video/vnd.vivo" },
{ "vivo", 4, "video/vnd.vivo" },
{ "vrml", 4, "model/vrml" },
{ "wav", 3, "audio/x-wav" },
{ "wax", 3, "audio/x-ms-wax" },
{ "wiki", 4, "text/x-fossil-wiki" },
{ "wma", 3, "audio/x-ms-wma" },
{ "wmv", 3, "video/x-ms-wmv" },
{ "wmx", 3, "video/x-ms-wmx" },
{ "wrl", 3, "model/vrml" },
{ "wvx", 3, "video/x-ms-wvx" },
{ "xbm", 3, "image/x-xbitmap" },
{ "xlc", 3, "application/vnd.ms-excel" },
|
| ︙ | ︙ | |||
493 494 495 496 497 498 499 |
zMime = mimetype_from_name(zName);
}
Th_Store("doc_name", zName);
Th_Store("doc_version", db_text(0, "SELECT '[' || substr(uuid,1,10) || ']'"
" FROM blob WHERE rid=%d", vid));
Th_Store("doc_date", db_text(0, "SELECT datetime(mtime) FROM event"
" WHERE objid=%d AND type='ci'", vid));
| | | 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
zMime = mimetype_from_name(zName);
}
Th_Store("doc_name", zName);
Th_Store("doc_version", db_text(0, "SELECT '[' || substr(uuid,1,10) || ']'"
" FROM blob WHERE rid=%d", vid));
Th_Store("doc_date", db_text(0, "SELECT datetime(mtime) FROM event"
" WHERE objid=%d AND type='ci'", vid));
if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){
Blob title, tail;
if( wiki_find_title(&filebody, &title, &tail) ){
style_header(blob_str(&title));
wiki_convert(&tail, 0, WIKI_BUTTONS);
}else{
style_header("Documentation");
wiki_convert(&filebody, 0, WIKI_BUTTONS);
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
1609 1610 1611 1612 1613 1614 1615 |
style_submenu_element("Html", "Html",
"%s/artifact/%s", g.zTop, zUuid);
}else{
renderAsHtml = 1;
style_submenu_element("Text", "Text",
"%s/artifact/%s?txt=1", g.zTop, zUuid);
}
| | | 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 |
style_submenu_element("Html", "Html",
"%s/artifact/%s", g.zTop, zUuid);
}else{
renderAsHtml = 1;
style_submenu_element("Text", "Text",
"%s/artifact/%s?txt=1", g.zTop, zUuid);
}
}else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){
if( asText ){
style_submenu_element("Wiki", "Wiki",
"%s/artifact/%s", g.zTop, zUuid);
}else{
renderAsWiki = 1;
style_submenu_element("Text", "Text",
"%s/artifact/%s?txt=1", g.zTop, zUuid);
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
652 653 654 655 656 657 658 659 660 661 662 663 664 665 |
@ n.style.position = "absolute";
@ n.style.overflow = "hidden";
@ n.style.left = x0+"px";
@ n.style.top = y0+"px";
@ n.style.width = w+"px";
@ n.style.height = h+"px";
@ n.style.backgroundColor = color;
@ canvasDiv.appendChild(n);
@ return n;
@ }
@ function absoluteY(id){
@ var obj = gebi(id);
@ if( !obj ) return;
@ var top = 0;
| > | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 |
@ n.style.position = "absolute";
@ n.style.overflow = "hidden";
@ n.style.left = x0+"px";
@ n.style.top = y0+"px";
@ n.style.width = w+"px";
@ n.style.height = h+"px";
@ n.style.backgroundColor = color;
@ n.style.cursor = "pointer";
@ canvasDiv.appendChild(n);
@ return n;
@ }
@ function absoluteY(id){
@ var obj = gebi(id);
@ if( !obj ) return;
@ var top = 0;
|
| ︙ | ︙ |
Changes to src/wiki.c.
| ︙ | ︙ | |||
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 |
/*
** Return true if the given pagename is the name of the sandbox
*/
static int is_sandbox(const char *zPagename){
return fossil_stricmp(zPagename,"sandbox")==0 ||
fossil_stricmp(zPagename,"sand box")==0;
}
/*
** WEBPAGE: wiki
** URL: /wiki?name=PAGENAME
*/
void wiki_page(void){
char *zTag;
int rid = 0;
int isSandbox;
char *zUuid;
Blob wiki;
Manifest *pWiki = 0;
const char *zPageName;
char *zBody = mprintf("%s","<i>Empty Page</i>");
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(); return; }
zPageName = P("name");
if( zPageName==0 ){
style_header("Wiki");
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
/*
** Return true if the given pagename is the name of the sandbox
*/
static int is_sandbox(const char *zPagename){
return fossil_stricmp(zPagename,"sandbox")==0 ||
fossil_stricmp(zPagename,"sand box")==0;
}
/*
** Only allow certain mimetypes through.
** All others become "text/x-fossil-wiki"
*/
const char *wiki_filter_mimetypes(const char *zMimetype){
if( zMimetype!=0 &&
( fossil_strcmp(zMimetype, "text/x-markdown")==0
|| fossil_strcmp(zMimetype, "text/plain")==0 )
){
return zMimetype;
}
return "text/x-fossil-wiki";
}
/*
** Render wiki text according to its mimetype
*/
void wiki_render_by_mimetype(Blob *pWiki, const char *zMimetype){
if( zMimetype==0 || fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){
wiki_convert(pWiki, 0, 0);
}else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){
Blob title = BLOB_INITIALIZER;
Blob tail = BLOB_INITIALIZER;
markdown_to_html(pWiki, &title, &tail);
if( blob_size(&title)>0 ){
@ <h1>%s(blob_str(&title))</h1>
}
@ %s(blob_str(&tail))
blob_reset(&title);
blob_reset(&tail);
}else{
@ <pre>
@ %h(blob_str(pWiki))
@ </pre>
}
}
/*
** WEBPAGE: wiki
** URL: /wiki?name=PAGENAME
*/
void wiki_page(void){
char *zTag;
int rid = 0;
int isSandbox;
char *zUuid;
Blob wiki;
Manifest *pWiki = 0;
const char *zPageName;
const char *zMimetype = 0;
char *zBody = mprintf("%s","<i>Empty Page</i>");
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(); return; }
zPageName = P("name");
if( zPageName==0 ){
style_header("Wiki");
|
| ︙ | ︙ | |||
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
style_footer();
return;
}
if( check_name(zPageName) ) return;
isSandbox = is_sandbox(zPageName);
if( isSandbox ){
zBody = db_get("sandbox",zBody);
rid = 0;
}else{
zTag = mprintf("wiki-%s", zPageName);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
" ORDER BY mtime DESC", zTag
);
free(zTag);
pWiki = manifest_get(rid, CFTYPE_WIKI);
if( pWiki ){
zBody = pWiki->zWiki;
}
}
if( !g.isHome ){
if( rid ){
style_submenu_element("Diff", "Last change",
"%R/wdiff?name=%T&a=%d", zPageName, rid);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
style_submenu_element("Details", "Details",
"%R/info/%S", zUuid);
| > > > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
style_footer();
return;
}
if( check_name(zPageName) ) return;
isSandbox = is_sandbox(zPageName);
if( isSandbox ){
zBody = db_get("sandbox",zBody);
zMimetype = db_get("sandbox-mimetype","text/x-fossil-wiki");
rid = 0;
}else{
zTag = mprintf("wiki-%s", zPageName);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
" ORDER BY mtime DESC", zTag
);
free(zTag);
pWiki = manifest_get(rid, CFTYPE_WIKI);
if( pWiki ){
zBody = pWiki->zWiki;
zMimetype = pWiki->zMimetype;
}
}
zMimetype = wiki_filter_mimetypes(zMimetype);
if( !g.isHome ){
if( rid ){
style_submenu_element("Diff", "Last change",
"%R/wdiff?name=%T&a=%d", zPageName, rid);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
style_submenu_element("Details", "Details",
"%R/info/%S", zUuid);
|
| ︙ | ︙ | |||
210 211 212 213 214 215 216 |
}
if( rid && g.perm.ApndWiki && g.perm.Attach ){
style_submenu_element("Attach", "Add An Attachment",
"%s/attachadd?page=%T&from=%s/wiki%%3fname=%T",
g.zTop, zPageName, g.zTop, zPageName);
}
if( rid && g.perm.ApndWiki ){
| | > | | | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
}
if( rid && g.perm.ApndWiki && g.perm.Attach ){
style_submenu_element("Attach", "Add An Attachment",
"%s/attachadd?page=%T&from=%s/wiki%%3fname=%T",
g.zTop, zPageName, g.zTop, zPageName);
}
if( rid && g.perm.ApndWiki ){
style_submenu_element("Append", "Add A Comment",
"%s/wikiappend?name=%T&mimetype=%s",
g.zTop, zPageName, zMimetype);
}
if( g.perm.Hyperlink ){
style_submenu_element("History", "History", "%s/whistory?name=%T",
g.zTop, zPageName);
}
}
style_set_current_page("%s?name=%T", g.zPath, zPageName);
style_header(zPageName);
blob_init(&wiki, zBody, -1);
wiki_render_by_mimetype(&wiki, zMimetype);
blob_reset(&wiki);
attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>");
manifest_destroy(pWiki);
style_footer();
}
/*
|
| ︙ | ︙ | |||
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
moderation_table_create();
db_multi_exec("INSERT INTO modreq(objid) VALUES(%d)", nrid);
}
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", nrid);
manifest_crosslink(nrid, pWiki);
}
/*
** WEBPAGE: wikiedit
** URL: /wikiedit?name=PAGENAME
*/
void wikiedit_page(void){
char *zTag;
int rid = 0;
int isSandbox;
Blob wiki;
Manifest *pWiki = 0;
const char *zPageName;
int n;
const char *z;
char *zBody = (char*)P("w");
int isWysiwyg = P("wysiwyg")!=0;
int goodCaptcha = 1;
if( P("edit-wysiwyg")!=0 ){ isWysiwyg = 1; zBody = 0; }
if( P("edit-markup")!=0 ){ isWysiwyg = 0; zBody = 0; }
if( zBody ){
if( isWysiwyg ){
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
moderation_table_create();
db_multi_exec("INSERT INTO modreq(objid) VALUES(%d)", nrid);
}
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", nrid);
manifest_crosslink(nrid, pWiki);
}
/*
** Formal names and common names for the various wiki styles.
*/
static const char *azStyles[] = {
"text/x-fossil-wiki", "Fossil Wiki",
"text/x-markdown", "Markdown",
"text/plain", "Plain Text"
};
/*
** Output a selection box from which the user can select the
** wiki mimetype.
*/
static void mimetype_option_menu(const char *zMimetype){
unsigned i;
@ Markup style: <select name="mimetype" size="1">
for(i=0; i<sizeof(azStyles)/sizeof(azStyles[0]); i+=2){
if( fossil_strcmp(zMimetype,azStyles[i])==0 ){
@ <option value="%s(azStyles[i])" selected>%s(azStyles[i+1])</option>
}else{
@ <option value="%s(azStyles[i])">%s(azStyles[i+1])</option>
}
}
@ </select>
}
/*
** Given a mimetype, return its common name.
*/
static const char *mimetype_common_name(const char *zMimetype){
int i;
for(i=4; i>=2; i-=2){
if( zMimetype && fossil_strcmp(zMimetype, azStyles[i])==0 ){
return azStyles[i+1];
}
}
return azStyles[1];
}
/*
** WEBPAGE: wikiedit
** URL: /wikiedit?name=PAGENAME
*/
void wikiedit_page(void){
char *zTag;
int rid = 0;
int isSandbox;
Blob wiki;
Manifest *pWiki = 0;
const char *zPageName;
int n;
const char *z;
char *zBody = (char*)P("w");
const char *zMimetype = wiki_filter_mimetypes(P("mimetype"));
int isWysiwyg = P("wysiwyg")!=0;
int goodCaptcha = 1;
if( P("edit-wysiwyg")!=0 ){ isWysiwyg = 1; zBody = 0; }
if( P("edit-markup")!=0 ){ isWysiwyg = 0; zBody = 0; }
if( zBody ){
if( isWysiwyg ){
|
| ︙ | ︙ | |||
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
if( isSandbox ){
if( !g.perm.WrWiki ){
login_needed();
return;
}
if( zBody==0 ){
zBody = db_get("sandbox","");
}
}else{
zTag = mprintf("wiki-%s", zPageName);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
" ORDER BY mtime DESC", zTag
);
free(zTag);
if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
login_needed();
return;
}
if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
zBody = pWiki->zWiki;
}
}
if( P("submit")!=0 && zBody!=0
&& (goodCaptcha = captcha_is_correct())
){
char *zDate;
Blob cksum;
blob_zero(&wiki);
db_begin_transaction();
if( isSandbox ){
db_set("sandbox",zBody,0);
}else{
login_verify_csrf_secret();
zDate = date_in_standard_format("now");
blob_appendf(&wiki, "D %s\n", zDate);
free(zDate);
blob_appendf(&wiki, "L %F\n", zPageName);
if( rid ){
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
blob_appendf(&wiki, "P %s\n", zUuid);
free(zUuid);
}
if( g.zLogin ){
blob_appendf(&wiki, "U %F\n", g.zLogin);
| > > > > > > | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
if( isSandbox ){
if( !g.perm.WrWiki ){
login_needed();
return;
}
if( zBody==0 ){
zBody = db_get("sandbox","");
zMimetype = db_get("sandbox-mimetype","text/x-fossil-wiki");
}
}else{
zTag = mprintf("wiki-%s", zPageName);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
" ORDER BY mtime DESC", zTag
);
free(zTag);
if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
login_needed();
return;
}
if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
zBody = pWiki->zWiki;
zMimetype = pWiki->zMimetype;
}
}
if( P("submit")!=0 && zBody!=0
&& (goodCaptcha = captcha_is_correct())
){
char *zDate;
Blob cksum;
blob_zero(&wiki);
db_begin_transaction();
if( isSandbox ){
db_set("sandbox",zBody,0);
db_set("sandbox-mimetype",zMimetype,0);
}else{
login_verify_csrf_secret();
zDate = date_in_standard_format("now");
blob_appendf(&wiki, "D %s\n", zDate);
free(zDate);
blob_appendf(&wiki, "L %F\n", zPageName);
if( fossil_strcmp(zMimetype,"text/x-fossil-wiki")!=0 ){
blob_appendf(&wiki, "N %s\n", zMimetype);
}
if( rid ){
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
blob_appendf(&wiki, "P %s\n", zUuid);
free(zUuid);
}
if( g.zLogin ){
blob_appendf(&wiki, "U %F\n", g.zLogin);
|
| ︙ | ︙ | |||
351 352 353 354 355 356 357 |
if( !goodCaptcha ){
@ <p class="generalError">Error: Incorrect security code.</p>
}
blob_zero(&wiki);
blob_append(&wiki, zBody, -1);
if( P("preview")!=0 ){
@ Preview:<hr />
| | > | | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
if( !goodCaptcha ){
@ <p class="generalError">Error: Incorrect security code.</p>
}
blob_zero(&wiki);
blob_append(&wiki, zBody, -1);
if( P("preview")!=0 ){
@ Preview:<hr />
wiki_render_by_mimetype(&wiki, zMimetype);
@ <hr />
blob_reset(&wiki);
}
for(n=2, z=zBody; z[0]; z++){
if( z[0]=='\n' ) n++;
}
if( n<20 ) n = 20;
if( n>30 ) n = 30;
if( !isWysiwyg ){
/* Traditional markup-only editing */
form_begin(0, "%R/wikiedit");
@ <div>
mimetype_option_menu(zMimetype);
@ <br /><textarea name="w" class="wikiedit" cols="80"
@ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
@ <br />
if( db_get_boolean("wysiwyg-wiki", 0) ){
@ <input type="submit" name="edit-wysiwyg" value="Wysiwyg Editor"
@ onclick='return confirm("Switching to WYSIWYG-mode\nwill erase your markup\nedits. Continue?")' />
}
@ <input type="submit" name="preview" value="Preview Your Changes" />
|
| ︙ | ︙ | |||
411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
** URL /wikinew
**
** Prompt the user to enter the name of a new wiki page. Then redirect
** to the wikiedit screen for that new page.
*/
void wikinew_page(void){
const char *zName;
login_check_credentials();
if( !g.perm.NewWiki ){
login_needed();
return;
}
zName = PD("name","");
if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
| > > > | > | | > | | > > > | | | < | > > > > > | | | | > > > > > > | > > | > > > | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 |
** URL /wikinew
**
** Prompt the user to enter the name of a new wiki page. Then redirect
** to the wikiedit screen for that new page.
*/
void wikinew_page(void){
const char *zName;
const char *zMimetype;
login_check_credentials();
if( !g.perm.NewWiki ){
login_needed();
return;
}
zName = PD("name","");
zMimetype = wiki_filter_mimetypes(P("mimetype"));
if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
if( fossil_strcmp(zMimetype,"text/x-fossil-wiki")==0
&& db_get_boolean("wysiwyg-wiki", 0)
){
cgi_redirectf("wikiedit?name=%T&wysiwyg=1", zName);
}else{
cgi_redirectf("wikiedit?name=%T&mimetype=%s", zName, zMimetype);
}
}
style_header("Create A New Wiki Page");
@ <p>Rules for wiki page names:</p>
well_formed_wiki_name_rules();
form_begin(0, "%R/wikinew");
@ <p>Name of new wiki page:
@ <input style="width: 35;" type="text" name="name" value="%h(zName)" /><br />
mimetype_option_menu("text/x-fossil-wiki");
@ <br /><input type="submit" value="Create" />
@ </p></form>
if( zName[0] ){
@ <p><span class="wikiError">
@ "%h(zName)" is not a valid wiki page name!</span></p>
}
style_footer();
}
/*
** Append the wiki text for an remark to the end of the given BLOB.
*/
static void appendRemark(Blob *p, const char *zMimetype){
char *zDate;
const char *zUser;
const char *zRemark;
char *zId;
zDate = db_text(0, "SELECT datetime('now')");
zRemark = PD("r","");
zUser = PD("u",g.zLogin);
if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){
zId = db_text(0, "SELECT lower(hex(randomblob(8)))");
blob_appendf(p, "\n\n<hr><div id=\"%s\"><i>On %s UTC %h",
zId, zDate, g.zLogin);
if( zUser[0] && fossil_strcmp(zUser,g.zLogin) ){
blob_appendf(p, " (claiming to be %h)", zUser);
}
blob_appendf(p, " added:</i><br />\n%s</div id=\"%s\">", zRemark, zId);
}else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){
blob_appendf(p, "\n\n------\n*On %s UTC %h", zDate, g.zLogin);
if( zUser[0] && fossil_strcmp(zUser,g.zLogin) ){
blob_appendf(p, " (claiming to be %h)", zUser);
}
blob_appendf(p, " added:*\n\n%s\n", zRemark);
}else{
blob_appendf(p, "\n\n------------------------------------------------\n"
"On %s UTC %s", zDate, g.zLogin);
if( zUser[0] && fossil_strcmp(zUser,g.zLogin) ){
blob_appendf(p, " (claiming to be %s)", zUser);
}
blob_appendf(p, " added:\n\n%s\n", zRemark);
}
fossil_free(zDate);
}
/*
** WEBPAGE: wikiappend
** URL: /wikiappend?name=PAGENAME&mimetype=MIMETYPE
*/
void wikiappend_page(void){
char *zTag;
int rid = 0;
int isSandbox;
const char *zPageName;
const char *zUser;
const char *zMimetype;
int goodCaptcha = 1;
const char *zFormat;
login_check_credentials();
zPageName = PD("name","");
zMimetype = wiki_filter_mimetypes(P("mimetype"));
if( check_name(zPageName) ) return;
isSandbox = is_sandbox(zPageName);
if( !isSandbox ){
zTag = mprintf("wiki-%s", zPageName);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
|
| ︙ | ︙ | |||
507 508 509 510 511 512 513 |
Blob body;
Blob wiki;
Manifest *pWiki = 0;
blob_zero(&body);
if( isSandbox ){
blob_appendf(&body, db_get("sandbox",""));
| | > > > | | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
Blob body;
Blob wiki;
Manifest *pWiki = 0;
blob_zero(&body);
if( isSandbox ){
blob_appendf(&body, db_get("sandbox",""));
appendRemark(&body, zMimetype);
db_set("sandbox", blob_str(&body), 0);
}else{
login_verify_csrf_secret();
pWiki = manifest_get(rid, CFTYPE_WIKI);
if( pWiki ){
blob_append(&body, pWiki->zWiki, -1);
manifest_destroy(pWiki);
}
blob_zero(&wiki);
db_begin_transaction();
zDate = date_in_standard_format("now");
blob_appendf(&wiki, "D %s\n", zDate);
blob_appendf(&wiki, "L %F\n", zPageName);
if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")!=0 ){
blob_appendf(&wiki, "N %s\n", zMimetype);
}
if( rid ){
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
blob_appendf(&wiki, "P %s\n", zUuid);
free(zUuid);
}
if( g.zLogin ){
blob_appendf(&wiki, "U %F\n", g.zLogin);
}
appendRemark(&body, zMimetype);
blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body));
md5sum_blob(&wiki, &cksum);
blob_appendf(&wiki, "Z %b\n", &cksum);
blob_reset(&cksum);
wiki_put(&wiki, rid);
db_end_transaction(0);
}
|
| ︙ | ︙ | |||
551 552 553 554 555 556 557 |
style_header("Append Comment To: %s", zPageName);
if( !goodCaptcha ){
@ <p class="generalError">Error: Incorrect security code.</p>
}
if( P("preview")!=0 ){
Blob preview;
blob_zero(&preview);
| | | > > | | 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 |
style_header("Append Comment To: %s", zPageName);
if( !goodCaptcha ){
@ <p class="generalError">Error: Incorrect security code.</p>
}
if( P("preview")!=0 ){
Blob preview;
blob_zero(&preview);
appendRemark(&preview, zMimetype);
@ Preview:<hr>
wiki_render_by_mimetype(&preview, zMimetype);
@ <hr>
blob_reset(&preview);
}
zUser = PD("u", g.zLogin);
form_begin(0, "%R/wikiappend");
login_insert_csrf_secret();
@ <input type="hidden" name="name" value="%h(zPageName)" />
@ <input type="hidden" name="mimetype" value="%h(zMimetype)" />
@ Your Name:
@ <input type="text" name="u" size="20" value="%h(zUser)" /><br />
zFormat = mimetype_common_name(zMimetype);
@ Comment to append (formatted as %s(zFormat)):<br />
@ <textarea name="r" class="wikiedit" cols="80"
@ rows="10" wrap="virtual">%h(PD("r",""))</textarea>
@ <br />
@ <input type="submit" name="preview" value="Preview Your Comment" />
@ <input type="submit" name="submit" value="Append Your Changes" />
@ <input type="submit" name="cancel" value="Cancel" />
captcha_generate();
|
| ︙ | ︙ |
Added www/hints.wiki.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
<title>Fossil Tips And Usage Hints</title>
1. Click on nodes of any timeline graph to see diffs between two
selected versions.
2. Add the "--tk" option to "[/help?cmd=diff | fossil diff]" commands
to get a pop-up
window containing a complete side-by-side diff. (NB: The pop-up
window is run as a separate Tcl/Tk process, so you will need to
have Tcl/Tk installed on your machine for this to work. Visit
[http://www.activestate.com/activetcl] to for a quick download of
Tcl/Tk if you do not already have it on your system.)
3. The "[/help?cmd=clean | fossil clean -f]" command makes a great
alternative to "make clean".
4. Use "[/help?cmd=all | fossil all changes]" to look for any uncommitted
edits in any of your Fossil projects. Use
"[/help?cmd=all | fossil all sync]" on your laptop
prior to going off network (for example, on a long plane ride)
to make sure you have all of content local.
5. Sub-menu options on Timelines lets you select either 20 or 200
records. But you can manual edit the "n=" query parameter in the
URL to get any number of records you desire. To see a complete
timeline graph, set n to some ridiculously large value like 10000000.
6. You can manually add a "c=CHECKIN" query parameter to the timeline
URL to get a snapshot of what was going on about the time of some
checkin. The "CHECKIN" can be
[./checkin_names.wiki | any valid check-in or version name], including
tags, branch names, and dates. For example, to see what was going
on in the Fossil repository on 2008-01-01, visit
[http://www.fossil-scm.org/fossil/timeline?c=2008-01-01].
7. Further to the previous two hints, there are lots of query parameters
that you can add to timeline pages. The available query parameters
are tersely documented [/help?cmd=/timeline | here].
8. You can run "[/help?cmd=test-diff | fossil test-diff --tk $file1 $file2]"
to get a pop-up window with side-by-side diffs of two files, even if
neither of the two files is part of any Fossil repository. Note that
this command is "test-diff", not "diff".
9. On web pages showing the content of a file (for example
[http://www.fossil-scm.org/fossil/artifact/c7dd1de9f]) you can manually
add a query parameter of the form "ln=FROM,TO" to the URL that
will cause the range of lines indicated to be highlighted. This
is useful in pointing out a few lines of code using a hyperlink
in a email or text message. Example:
[http://www.fossil-scm.org/fossil/artifact/c7dd1de9f?ln=28,30].
Adding the "ln" query parameter without any argument simply turns
on line numbers. This feature only works right with files with
a mimetype of text/plain, of course.
10. When editing documentation to be checked in as managed files, you can
preview what the documentation will look like by using the special
"ckout" branch name in the "doc" URL while running "fossil ui".
See the [./embeddeddoc.wiki | embedded documentation] for details.
|
Changes to www/index.wiki.
| ︙ | ︙ | |||
20 21 22 23 24 25 26 | <li> [./quickstart.wiki | Quick Start] <li> [./build.wiki | Install] <li> [../COPYRIGHT-BSD2.txt | License] <li> [/timeline | Recent changes] <li> [./faq.wiki | FAQ] <li> [./contribute.wiki | Contributing] <li> [./changes.wiki | Change Log] | > | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
<li> [./quickstart.wiki | Quick Start]
<li> [./build.wiki | Install]
<li> [../COPYRIGHT-BSD2.txt | License]
<li> [/timeline | Recent changes]
<li> [./faq.wiki | FAQ]
<li> [./contribute.wiki | Contributing]
<li> [./changes.wiki | Change Log]
<li> [./hints.wiki | Tip & Hints]
<li> [./permutedindex.wiki#pindex | Documentation Index]
<li> [http://www.fossil-scm.org/schimpf-book/home | Jim Schimpf's book]
<li> Mailing list
<ul>
<li> [http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users | sign-up]
<li> [http://www.mail-archive.com/fossil-users@lists.fossil-scm.org | archives]
<ul>
</ul>
|
| ︙ | ︙ |
Changes to www/mkindex.tcl.
| ︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
event.wiki {Events}
faq.wiki {Frequently Asked Questions}
fileformat.wiki {Fossil File Format}
fiveminutes.wiki {Update and Running in 5 Minutes as a Single User}
foss-cklist.wiki {Checklist For Successful Open-Source Projects}
fossil-from-msvc.wiki {Integrating Fossil in the Microsoft Express 2010 IDE}
fossil-v-git.wiki {Fossil Versus Git}
index.wiki {Home Page}
inout.wiki {Import And Export To And From Git}
makefile.wiki {The Fossil Build Process}
newrepo.wiki {How To Create A New Fossil Repository}
password.wiki {Password Management And Authentication}
pop.wiki {Principles Of Operations}
private.wiki {Creating, Syncing, and Deleting Private Branches}
| > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
event.wiki {Events}
faq.wiki {Frequently Asked Questions}
fileformat.wiki {Fossil File Format}
fiveminutes.wiki {Update and Running in 5 Minutes as a Single User}
foss-cklist.wiki {Checklist For Successful Open-Source Projects}
fossil-from-msvc.wiki {Integrating Fossil in the Microsoft Express 2010 IDE}
fossil-v-git.wiki {Fossil Versus Git}
hints.wiki {Fossil Tips And Usage Hints}
index.wiki {Home Page}
inout.wiki {Import And Export To And From Git}
makefile.wiki {The Fossil Build Process}
newrepo.wiki {How To Create A New Fossil Repository}
password.wiki {Password Management And Authentication}
pop.wiki {Principles Of Operations}
private.wiki {Creating, Syncing, and Deleting Private Branches}
|
| ︙ | ︙ |
Changes to www/permutedindex.wiki.
| ︙ | ︙ | |||
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 | <li><a href="delta_encoder_algorithm.wiki">Fossil Delta Encoding Algorithm</a></li> <li><a href="delta_format.wiki">Fossil Delta Format</a></li> <li><a href="fileformat.wiki">Fossil File Format</a></li> <li><a href="quickstart.wiki">Fossil Quick Start Guide</a></li> <li><a href="selfcheck.wiki">Fossil Repository Integrity Self Checks</a></li> <li><a href="selfhost.wiki">Fossil Self Hosting Repositories</a></li> <li><a href="settings.wiki">Fossil Settings</a></li> <li><a href="fossil-v-git.wiki">Fossil Versus Git</a></li> <li><a href="quotes.wiki">Fossil, Git, and DVCSes in General — Quotes: What People Are Saying About</a></li> <li><a href="faq.wiki">Frequently Asked Questions</a></li> <li><a href="shunning.wiki">From Fossil — Shunning: Deleting Content</a></li> <li><a href="inout.wiki">From Git — Import And Export To And</a></li> <li><a href="quotes.wiki">General — Quotes: What People Are Saying About Fossil, Git, and DVCSes in</a></li> <li><a href="fossil-v-git.wiki">Git — Fossil Versus</a></li> <li><a href="inout.wiki">Git — Import And Export To And From</a></li> <li><a href="quotes.wiki">Git, and DVCSes in General — Quotes: What People Are Saying About Fossil,</a></li> <li><a href="quickstart.wiki">Guide — Fossil Quick Start</a></li> <li><a href="style.wiki">Guidelines — Source Code Style</a></li> <li><a href="index.wiki">Home Page</a></li> <li><a href="selfhost.wiki">Hosting Repositories — Fossil Self</a></li> <li><a href="server.wiki">How To Configure A Fossil Server</a></li> <li><a href="newrepo.wiki">How To Create A New Fossil Repository</a></li> <li><a href="fossil-from-msvc.wiki">IDE — Integrating Fossil in the Microsoft Express 2010</a></li> <li><a href="tech_overview.wiki">Implementation Of Fossil — A Technical Overview Of The Design And</a></li> <li><a href="inout.wiki">Import And Export To And From Git</a></li> | > > | 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 | <li><a href="delta_encoder_algorithm.wiki">Fossil Delta Encoding Algorithm</a></li> <li><a href="delta_format.wiki">Fossil Delta Format</a></li> <li><a href="fileformat.wiki">Fossil File Format</a></li> <li><a href="quickstart.wiki">Fossil Quick Start Guide</a></li> <li><a href="selfcheck.wiki">Fossil Repository Integrity Self Checks</a></li> <li><a href="selfhost.wiki">Fossil Self Hosting Repositories</a></li> <li><a href="settings.wiki">Fossil Settings</a></li> <li><a href="hints.wiki">Fossil Tips And Usage Hints</a></li> <li><a href="fossil-v-git.wiki">Fossil Versus Git</a></li> <li><a href="quotes.wiki">Fossil, Git, and DVCSes in General — Quotes: What People Are Saying About</a></li> <li><a href="faq.wiki">Frequently Asked Questions</a></li> <li><a href="shunning.wiki">From Fossil — Shunning: Deleting Content</a></li> <li><a href="inout.wiki">From Git — Import And Export To And</a></li> <li><a href="quotes.wiki">General — Quotes: What People Are Saying About Fossil, Git, and DVCSes in</a></li> <li><a href="fossil-v-git.wiki">Git — Fossil Versus</a></li> <li><a href="inout.wiki">Git — Import And Export To And From</a></li> <li><a href="quotes.wiki">Git, and DVCSes in General — Quotes: What People Are Saying About Fossil,</a></li> <li><a href="quickstart.wiki">Guide — Fossil Quick Start</a></li> <li><a href="style.wiki">Guidelines — Source Code Style</a></li> <li><a href="hints.wiki">Hints — Fossil Tips And Usage</a></li> <li><a href="index.wiki">Home Page</a></li> <li><a href="selfhost.wiki">Hosting Repositories — Fossil Self</a></li> <li><a href="server.wiki">How To Configure A Fossil Server</a></li> <li><a href="newrepo.wiki">How To Create A New Fossil Repository</a></li> <li><a href="fossil-from-msvc.wiki">IDE — Integrating Fossil in the Microsoft Express 2010</a></li> <li><a href="tech_overview.wiki">Implementation Of Fossil — A Technical Overview Of The Design And</a></li> <li><a href="inout.wiki">Import And Export To And From Git</a></li> |
| ︙ | ︙ | |||
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | <li><a href="makefile.wiki">The Fossil Build Process</a></li> <li><a href="sync.wiki">The Fossil Sync Protocol</a></li> <li><a href="tickets.wiki">The Fossil Ticket System</a></li> <li><a href="webui.wiki">The Fossil Web Interface</a></li> <li><a href="theory1.wiki">Thoughts On The Design Of The Fossil DVCS</a></li> <li><a href="custom_ticket.wiki">Ticket System — Customizing The</a></li> <li><a href="tickets.wiki">Ticket System — The Fossil</a></li> <li><a href="bugtheory.wiki">Tracking In Fossil — Bug</a></li> <li><a href="fiveminutes.wiki">Update and Running in 5 Minutes as a Single User</a></li> <li><a href="fiveminutes.wiki">User — Update and Running in 5 Minutes as a Single</a></li> <li><a href="ssl.wiki">Using SSL with Fossil</a></li> <li><a href="checkin_names.wiki">Version Names — Checkin And</a></li> <li><a href="fossil-v-git.wiki">Versus Git — Fossil</a></li> <li><a href="webui.wiki">Web Interface — The Fossil</a></li> <li><a href="quotes.wiki">What People Are Saying About Fossil, Git, and DVCSes in General — Quotes:</a></li> <li><a href="wikitheory.wiki">Wiki In Fossil</a></li> <li><a href="ssl.wiki">with Fossil — Using SSL</a></li> </ul> | > > | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | <li><a href="makefile.wiki">The Fossil Build Process</a></li> <li><a href="sync.wiki">The Fossil Sync Protocol</a></li> <li><a href="tickets.wiki">The Fossil Ticket System</a></li> <li><a href="webui.wiki">The Fossil Web Interface</a></li> <li><a href="theory1.wiki">Thoughts On The Design Of The Fossil DVCS</a></li> <li><a href="custom_ticket.wiki">Ticket System — Customizing The</a></li> <li><a href="tickets.wiki">Ticket System — The Fossil</a></li> <li><a href="hints.wiki">Tips And Usage Hints — Fossil</a></li> <li><a href="bugtheory.wiki">Tracking In Fossil — Bug</a></li> <li><a href="fiveminutes.wiki">Update and Running in 5 Minutes as a Single User</a></li> <li><a href="hints.wiki">Usage Hints — Fossil Tips And</a></li> <li><a href="fiveminutes.wiki">User — Update and Running in 5 Minutes as a Single</a></li> <li><a href="ssl.wiki">Using SSL with Fossil</a></li> <li><a href="checkin_names.wiki">Version Names — Checkin And</a></li> <li><a href="fossil-v-git.wiki">Versus Git — Fossil</a></li> <li><a href="webui.wiki">Web Interface — The Fossil</a></li> <li><a href="quotes.wiki">What People Are Saying About Fossil, Git, and DVCSes in General — Quotes:</a></li> <li><a href="wikitheory.wiki">Wiki In Fossil</a></li> <li><a href="ssl.wiki">with Fossil — Using SSL</a></li> </ul> |