Fossil SCM
Refinements to the timeline for giving better information about wiki pages.
Commit
dfea940da850d6844c2b13f2b4515e4463773230
Parent
a21806dcf394d6b…
2 files changed
+107
-16
+47
-12
+107
-16
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -373,10 +373,70 @@ | ||
| 373 | 373 | showDescendents(rid, 2, "Descendents"); |
| 374 | 374 | showLeaves(); |
| 375 | 375 | showAncestors(rid, 2, "Ancestors"); |
| 376 | 376 | style_footer(); |
| 377 | 377 | } |
| 378 | + | |
| 379 | +/* | |
| 380 | +** WEBPAGE: winfo | |
| 381 | +** | |
| 382 | +** Return information about a wiki page. The version number is contained | |
| 383 | +** in g.zExtra. | |
| 384 | +*/ | |
| 385 | +void winfo_page(void){ | |
| 386 | + Stmt q; | |
| 387 | + int rid; | |
| 388 | + | |
| 389 | + login_check_credentials(); | |
| 390 | + if( !g.okHistory ){ login_needed(); return; } | |
| 391 | + rid = name_to_rid(g.zExtra); | |
| 392 | + if( rid==0 ){ | |
| 393 | + style_header("Wiki Page Information Error"); | |
| 394 | + @ No such object: %h(g.argv[2]) | |
| 395 | + style_footer(); | |
| 396 | + return; | |
| 397 | + } | |
| 398 | + db_prepare(&q, | |
| 399 | + "SELECT substr(tagname, 6, 1000), uuid," | |
| 400 | + " datetime(event.mtime, 'localtime'), user" | |
| 401 | + " FROM tagxref, tag, blob, event" | |
| 402 | + " WHERE tagxref.rid=%d" | |
| 403 | + " AND tag.tagid=tagxref.tagid" | |
| 404 | + " AND tag.tagname LIKE 'wiki-%%'" | |
| 405 | + " AND blob.rid=%d" | |
| 406 | + " AND event.objid=%d", | |
| 407 | + rid, rid, rid | |
| 408 | + ); | |
| 409 | + if( db_step(&q)==SQLITE_ROW ){ | |
| 410 | + const char *zName = db_column_text(&q, 0); | |
| 411 | + const char *zUuid = db_column_text(&q, 1); | |
| 412 | + char *zTitle = mprintf("Wiki Page %s", zName); | |
| 413 | + style_header(zTitle); | |
| 414 | + free(zTitle); | |
| 415 | + @ <div class="section-title">Overview</div> | |
| 416 | + @ <p><table class="label-value"> | |
| 417 | + @ <tr><th>Version:</th><td>%s(zUuid)</td></tr> | |
| 418 | + @ <tr><th>Date:</th><td>%s(db_column_text(&q, 2))</td></tr> | |
| 419 | + if( g.okSetup ){ | |
| 420 | + @ <tr><th>Record ID:</th><td>%d(rid)</td></tr> | |
| 421 | + } | |
| 422 | + @ <tr><th>Original User:</th><td>%s(db_column_text(&q, 3))</td></tr> | |
| 423 | + @ <tr><th>Commands:</th> | |
| 424 | + @ <td> | |
| 425 | +/* @ <a href="%s(g.zBaseURL)/wdiff/%d(rid)">diff</a> | */ | |
| 426 | + @ <a href="%s(g.zBaseURL)/wlist/%t(zName)">history</a> | |
| 427 | + @ | <a href="%s(g.zBaseURL)/fview/%d(rid)">raw-text</a> | |
| 428 | + @ </td> | |
| 429 | + @ </tr> | |
| 430 | + @ </table></p> | |
| 431 | + }else{ | |
| 432 | + style_header("Wiki Information"); | |
| 433 | + } | |
| 434 | + db_finalize(&q); | |
| 435 | + showTags(rid); | |
| 436 | + style_footer(); | |
| 437 | +} | |
| 378 | 438 | |
| 379 | 439 | /* |
| 380 | 440 | ** WEBPAGE: finfo |
| 381 | 441 | ** |
| 382 | 442 | ** Show the complete change history for a single file. The name |
| @@ -515,10 +575,11 @@ | ||
| 515 | 575 | ** * Comment & user |
| 516 | 576 | */ |
| 517 | 577 | static void object_description(int rid, int linkToView){ |
| 518 | 578 | Stmt q; |
| 519 | 579 | int cnt = 0; |
| 580 | + int nWiki = 0; | |
| 520 | 581 | db_prepare(&q, |
| 521 | 582 | "SELECT filename.name, datetime(event.mtime), substr(a.uuid,1,10)," |
| 522 | 583 | " coalesce(event.comment,event.ecomment)," |
| 523 | 584 | " coalesce(event.euser,event.user)," |
| 524 | 585 | " b.uuid" |
| @@ -542,28 +603,52 @@ | ||
| 542 | 603 | hyperlink_to_uuid(zVers); |
| 543 | 604 | @ %s(zCom) by %s(zUser) on %s(zDate). |
| 544 | 605 | cnt++; |
| 545 | 606 | } |
| 546 | 607 | db_finalize(&q); |
| 547 | - db_prepare(&q, | |
| 548 | - "SELECT datetime(mtime), user, comment, uuid" | |
| 549 | - " FROM event, blob" | |
| 550 | - " WHERE event.objid=%d" | |
| 551 | - " AND blob.rid=%d", | |
| 552 | - rid, rid | |
| 608 | + db_prepare(&q, | |
| 609 | + "SELECT substr(tagname, 6, 10000), datetime(event.mtime)," | |
| 610 | + " coalesce(event.euser, event.user), uuid" | |
| 611 | + " FROM tagxref, tag, event, blob" | |
| 612 | + " WHERE tagxref.rid=%d" | |
| 613 | + " AND tag.tagid=tagxref.tagid" | |
| 614 | + " AND tag.tagname LIKE 'wiki-%%'" | |
| 615 | + " AND event.objid=tagxref.rid" | |
| 616 | + " AND blob.rid=tagxref.rid", | |
| 617 | + rid | |
| 553 | 618 | ); |
| 554 | 619 | while( db_step(&q)==SQLITE_ROW ){ |
| 555 | - const char *zDate = db_column_text(&q, 0); | |
| 620 | + const char *zPagename = db_column_text(&q, 0); | |
| 621 | + const char *zDate = db_column_text(&q, 1); | |
| 622 | + const char *zUser = db_column_text(&q, 2); | |
| 556 | 623 | const char *zUuid = db_column_text(&q, 3); |
| 557 | - const char *zCom = db_column_text(&q, 2); | |
| 558 | - const char *zUser = db_column_text(&q, 1); | |
| 559 | - @ Manifest of version | |
| 560 | - hyperlink_to_uuid(zUuid); | |
| 561 | - @ %s(zCom) by %s(zUser) on %s(zDate). | |
| 624 | + @ Wiki page [<a href="%s(g.zBaseURL)/wiki/%t(zPagename)">%h(zPagename)</a>] | |
| 625 | + @ uuid %s(zUuid) by %h(zUser) on %s(zDate) | |
| 626 | + nWiki++; | |
| 562 | 627 | cnt++; |
| 563 | 628 | } |
| 564 | 629 | db_finalize(&q); |
| 630 | + if( nWiki==0 ){ | |
| 631 | + db_prepare(&q, | |
| 632 | + "SELECT datetime(mtime), user, comment, uuid" | |
| 633 | + " FROM event, blob" | |
| 634 | + " WHERE event.objid=%d" | |
| 635 | + " AND blob.rid=%d", | |
| 636 | + rid, rid | |
| 637 | + ); | |
| 638 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 639 | + const char *zDate = db_column_text(&q, 0); | |
| 640 | + const char *zUuid = db_column_text(&q, 3); | |
| 641 | + const char *zCom = db_column_text(&q, 2); | |
| 642 | + const char *zUser = db_column_text(&q, 1); | |
| 643 | + @ Manifest of version | |
| 644 | + hyperlink_to_uuid(zUuid); | |
| 645 | + @ %s(zCom) by %s(zUser) on %s(zDate). | |
| 646 | + cnt++; | |
| 647 | + } | |
| 648 | + db_finalize(&q); | |
| 649 | + } | |
| 565 | 650 | if( cnt==0 ){ |
| 566 | 651 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 567 | 652 | @ Control file %s(zUuid). |
| 568 | 653 | }else if( linkToView ){ |
| 569 | 654 | @ <a href="%s(g.zBaseURL)/fview/%d(rid)">[view]</a> |
| @@ -619,14 +704,20 @@ | ||
| 619 | 704 | Blob content; |
| 620 | 705 | |
| 621 | 706 | rid = name_to_rid(g.zExtra); |
| 622 | 707 | login_check_credentials(); |
| 623 | 708 | if( !g.okHistory ){ login_needed(); return; } |
| 624 | - if( g.zPath[0]=='i' && | |
| 625 | - db_exists("SELECT 1 FROM plink WHERE cid=%d", rid) ){ | |
| 626 | - vinfo_page(); | |
| 627 | - return; | |
| 709 | + if( g.zPath[0]=='i' ){ | |
| 710 | + if( db_exists("SELECT 1 FROM tagxref JOIN tag USING(tagid)" | |
| 711 | + " WHERE rid=%d AND tagname LIKE 'wiki-%%'", rid) ){ | |
| 712 | + winfo_page(); | |
| 713 | + return; | |
| 714 | + } | |
| 715 | + if( db_exists("SELECT 1 FROM plink WHERE cid=%d", rid) ){ | |
| 716 | + vinfo_page(); | |
| 717 | + return; | |
| 718 | + } | |
| 628 | 719 | } |
| 629 | 720 | style_header("File Content"); |
| 630 | 721 | @ <h2>Content Of:</h2> |
| 631 | 722 | @ <blockquote> |
| 632 | 723 | object_description(rid, 0); |
| 633 | 724 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -373,10 +373,70 @@ | |
| 373 | showDescendents(rid, 2, "Descendents"); |
| 374 | showLeaves(); |
| 375 | showAncestors(rid, 2, "Ancestors"); |
| 376 | style_footer(); |
| 377 | } |
| 378 | |
| 379 | /* |
| 380 | ** WEBPAGE: finfo |
| 381 | ** |
| 382 | ** Show the complete change history for a single file. The name |
| @@ -515,10 +575,11 @@ | |
| 515 | ** * Comment & user |
| 516 | */ |
| 517 | static void object_description(int rid, int linkToView){ |
| 518 | Stmt q; |
| 519 | int cnt = 0; |
| 520 | db_prepare(&q, |
| 521 | "SELECT filename.name, datetime(event.mtime), substr(a.uuid,1,10)," |
| 522 | " coalesce(event.comment,event.ecomment)," |
| 523 | " coalesce(event.euser,event.user)," |
| 524 | " b.uuid" |
| @@ -542,28 +603,52 @@ | |
| 542 | hyperlink_to_uuid(zVers); |
| 543 | @ %s(zCom) by %s(zUser) on %s(zDate). |
| 544 | cnt++; |
| 545 | } |
| 546 | db_finalize(&q); |
| 547 | db_prepare(&q, |
| 548 | "SELECT datetime(mtime), user, comment, uuid" |
| 549 | " FROM event, blob" |
| 550 | " WHERE event.objid=%d" |
| 551 | " AND blob.rid=%d", |
| 552 | rid, rid |
| 553 | ); |
| 554 | while( db_step(&q)==SQLITE_ROW ){ |
| 555 | const char *zDate = db_column_text(&q, 0); |
| 556 | const char *zUuid = db_column_text(&q, 3); |
| 557 | const char *zCom = db_column_text(&q, 2); |
| 558 | const char *zUser = db_column_text(&q, 1); |
| 559 | @ Manifest of version |
| 560 | hyperlink_to_uuid(zUuid); |
| 561 | @ %s(zCom) by %s(zUser) on %s(zDate). |
| 562 | cnt++; |
| 563 | } |
| 564 | db_finalize(&q); |
| 565 | if( cnt==0 ){ |
| 566 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 567 | @ Control file %s(zUuid). |
| 568 | }else if( linkToView ){ |
| 569 | @ <a href="%s(g.zBaseURL)/fview/%d(rid)">[view]</a> |
| @@ -619,14 +704,20 @@ | |
| 619 | Blob content; |
| 620 | |
| 621 | rid = name_to_rid(g.zExtra); |
| 622 | login_check_credentials(); |
| 623 | if( !g.okHistory ){ login_needed(); return; } |
| 624 | if( g.zPath[0]=='i' && |
| 625 | db_exists("SELECT 1 FROM plink WHERE cid=%d", rid) ){ |
| 626 | vinfo_page(); |
| 627 | return; |
| 628 | } |
| 629 | style_header("File Content"); |
| 630 | @ <h2>Content Of:</h2> |
| 631 | @ <blockquote> |
| 632 | object_description(rid, 0); |
| 633 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -373,10 +373,70 @@ | |
| 373 | showDescendents(rid, 2, "Descendents"); |
| 374 | showLeaves(); |
| 375 | showAncestors(rid, 2, "Ancestors"); |
| 376 | style_footer(); |
| 377 | } |
| 378 | |
| 379 | /* |
| 380 | ** WEBPAGE: winfo |
| 381 | ** |
| 382 | ** Return information about a wiki page. The version number is contained |
| 383 | ** in g.zExtra. |
| 384 | */ |
| 385 | void winfo_page(void){ |
| 386 | Stmt q; |
| 387 | int rid; |
| 388 | |
| 389 | login_check_credentials(); |
| 390 | if( !g.okHistory ){ login_needed(); return; } |
| 391 | rid = name_to_rid(g.zExtra); |
| 392 | if( rid==0 ){ |
| 393 | style_header("Wiki Page Information Error"); |
| 394 | @ No such object: %h(g.argv[2]) |
| 395 | style_footer(); |
| 396 | return; |
| 397 | } |
| 398 | db_prepare(&q, |
| 399 | "SELECT substr(tagname, 6, 1000), uuid," |
| 400 | " datetime(event.mtime, 'localtime'), user" |
| 401 | " FROM tagxref, tag, blob, event" |
| 402 | " WHERE tagxref.rid=%d" |
| 403 | " AND tag.tagid=tagxref.tagid" |
| 404 | " AND tag.tagname LIKE 'wiki-%%'" |
| 405 | " AND blob.rid=%d" |
| 406 | " AND event.objid=%d", |
| 407 | rid, rid, rid |
| 408 | ); |
| 409 | if( db_step(&q)==SQLITE_ROW ){ |
| 410 | const char *zName = db_column_text(&q, 0); |
| 411 | const char *zUuid = db_column_text(&q, 1); |
| 412 | char *zTitle = mprintf("Wiki Page %s", zName); |
| 413 | style_header(zTitle); |
| 414 | free(zTitle); |
| 415 | @ <div class="section-title">Overview</div> |
| 416 | @ <p><table class="label-value"> |
| 417 | @ <tr><th>Version:</th><td>%s(zUuid)</td></tr> |
| 418 | @ <tr><th>Date:</th><td>%s(db_column_text(&q, 2))</td></tr> |
| 419 | if( g.okSetup ){ |
| 420 | @ <tr><th>Record ID:</th><td>%d(rid)</td></tr> |
| 421 | } |
| 422 | @ <tr><th>Original User:</th><td>%s(db_column_text(&q, 3))</td></tr> |
| 423 | @ <tr><th>Commands:</th> |
| 424 | @ <td> |
| 425 | /* @ <a href="%s(g.zBaseURL)/wdiff/%d(rid)">diff</a> | */ |
| 426 | @ <a href="%s(g.zBaseURL)/wlist/%t(zName)">history</a> |
| 427 | @ | <a href="%s(g.zBaseURL)/fview/%d(rid)">raw-text</a> |
| 428 | @ </td> |
| 429 | @ </tr> |
| 430 | @ </table></p> |
| 431 | }else{ |
| 432 | style_header("Wiki Information"); |
| 433 | } |
| 434 | db_finalize(&q); |
| 435 | showTags(rid); |
| 436 | style_footer(); |
| 437 | } |
| 438 | |
| 439 | /* |
| 440 | ** WEBPAGE: finfo |
| 441 | ** |
| 442 | ** Show the complete change history for a single file. The name |
| @@ -515,10 +575,11 @@ | |
| 575 | ** * Comment & user |
| 576 | */ |
| 577 | static void object_description(int rid, int linkToView){ |
| 578 | Stmt q; |
| 579 | int cnt = 0; |
| 580 | int nWiki = 0; |
| 581 | db_prepare(&q, |
| 582 | "SELECT filename.name, datetime(event.mtime), substr(a.uuid,1,10)," |
| 583 | " coalesce(event.comment,event.ecomment)," |
| 584 | " coalesce(event.euser,event.user)," |
| 585 | " b.uuid" |
| @@ -542,28 +603,52 @@ | |
| 603 | hyperlink_to_uuid(zVers); |
| 604 | @ %s(zCom) by %s(zUser) on %s(zDate). |
| 605 | cnt++; |
| 606 | } |
| 607 | db_finalize(&q); |
| 608 | db_prepare(&q, |
| 609 | "SELECT substr(tagname, 6, 10000), datetime(event.mtime)," |
| 610 | " coalesce(event.euser, event.user), uuid" |
| 611 | " FROM tagxref, tag, event, blob" |
| 612 | " WHERE tagxref.rid=%d" |
| 613 | " AND tag.tagid=tagxref.tagid" |
| 614 | " AND tag.tagname LIKE 'wiki-%%'" |
| 615 | " AND event.objid=tagxref.rid" |
| 616 | " AND blob.rid=tagxref.rid", |
| 617 | rid |
| 618 | ); |
| 619 | while( db_step(&q)==SQLITE_ROW ){ |
| 620 | const char *zPagename = db_column_text(&q, 0); |
| 621 | const char *zDate = db_column_text(&q, 1); |
| 622 | const char *zUser = db_column_text(&q, 2); |
| 623 | const char *zUuid = db_column_text(&q, 3); |
| 624 | @ Wiki page [<a href="%s(g.zBaseURL)/wiki/%t(zPagename)">%h(zPagename)</a>] |
| 625 | @ uuid %s(zUuid) by %h(zUser) on %s(zDate) |
| 626 | nWiki++; |
| 627 | cnt++; |
| 628 | } |
| 629 | db_finalize(&q); |
| 630 | if( nWiki==0 ){ |
| 631 | db_prepare(&q, |
| 632 | "SELECT datetime(mtime), user, comment, uuid" |
| 633 | " FROM event, blob" |
| 634 | " WHERE event.objid=%d" |
| 635 | " AND blob.rid=%d", |
| 636 | rid, rid |
| 637 | ); |
| 638 | while( db_step(&q)==SQLITE_ROW ){ |
| 639 | const char *zDate = db_column_text(&q, 0); |
| 640 | const char *zUuid = db_column_text(&q, 3); |
| 641 | const char *zCom = db_column_text(&q, 2); |
| 642 | const char *zUser = db_column_text(&q, 1); |
| 643 | @ Manifest of version |
| 644 | hyperlink_to_uuid(zUuid); |
| 645 | @ %s(zCom) by %s(zUser) on %s(zDate). |
| 646 | cnt++; |
| 647 | } |
| 648 | db_finalize(&q); |
| 649 | } |
| 650 | if( cnt==0 ){ |
| 651 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 652 | @ Control file %s(zUuid). |
| 653 | }else if( linkToView ){ |
| 654 | @ <a href="%s(g.zBaseURL)/fview/%d(rid)">[view]</a> |
| @@ -619,14 +704,20 @@ | |
| 704 | Blob content; |
| 705 | |
| 706 | rid = name_to_rid(g.zExtra); |
| 707 | login_check_credentials(); |
| 708 | if( !g.okHistory ){ login_needed(); return; } |
| 709 | if( g.zPath[0]=='i' ){ |
| 710 | if( db_exists("SELECT 1 FROM tagxref JOIN tag USING(tagid)" |
| 711 | " WHERE rid=%d AND tagname LIKE 'wiki-%%'", rid) ){ |
| 712 | winfo_page(); |
| 713 | return; |
| 714 | } |
| 715 | if( db_exists("SELECT 1 FROM plink WHERE cid=%d", rid) ){ |
| 716 | vinfo_page(); |
| 717 | return; |
| 718 | } |
| 719 | } |
| 720 | style_header("File Content"); |
| 721 | @ <h2>Content Of:</h2> |
| 722 | @ <blockquote> |
| 723 | object_description(rid, 0); |
| 724 |
+47
-12
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -86,10 +86,11 @@ | ||
| 86 | 86 | ** 4. User |
| 87 | 87 | ** 5. Number of non-merge children |
| 88 | 88 | ** 6. Number of parents |
| 89 | 89 | ** 7. True if is a leaf |
| 90 | 90 | ** 8. background color |
| 91 | +** 9. type ("ci", "w") | |
| 91 | 92 | */ |
| 92 | 93 | void www_print_timeline( |
| 93 | 94 | Stmt *pQuery, |
| 94 | 95 | int *pFirstEvent, |
| 95 | 96 | int *pLastEvent, |
| @@ -113,10 +114,12 @@ | ||
| 113 | 114 | int nPChild = db_column_int(pQuery, 5); |
| 114 | 115 | int nParent = db_column_int(pQuery, 6); |
| 115 | 116 | int isLeaf = db_column_int(pQuery, 7); |
| 116 | 117 | const char *zBgClr = db_column_text(pQuery, 8); |
| 117 | 118 | const char *zDate = db_column_text(pQuery, 2); |
| 119 | + const char *zType = db_column_text(pQuery, 9); | |
| 120 | + const char *zUser = db_column_text(pQuery, 4); | |
| 118 | 121 | if( cnt==0 && pFirstEvent ){ |
| 119 | 122 | *pFirstEvent = rid; |
| 120 | 123 | } |
| 121 | 124 | if( pLastEvent ){ |
| 122 | 125 | *pLastEvent = rid; |
| @@ -143,24 +146,28 @@ | ||
| 143 | 146 | if( zBgClr && zBgClr[0] ){ |
| 144 | 147 | @ <td valign="top" align="left" bgcolor="%h(zBgClr)"> |
| 145 | 148 | }else{ |
| 146 | 149 | @ <td valign="top" align="left"> |
| 147 | 150 | } |
| 148 | - hyperlink_to_uuid_with_mouseover(zUuid, "xin", "xout", rid); | |
| 149 | - if( nParent>1 ){ | |
| 150 | - @ <b>Merge</b> | |
| 151 | - } | |
| 152 | - if( nPChild>1 ){ | |
| 153 | - @ <b>Fork</b> | |
| 154 | - } | |
| 155 | - if( isLeaf ){ | |
| 156 | - @ <b>Leaf</b> | |
| 151 | + if( zType[0]=='c' ){ | |
| 152 | + hyperlink_to_uuid_with_mouseover(zUuid, "xin", "xout", rid); | |
| 153 | + if( nParent>1 ){ | |
| 154 | + @ <b>Merge</b> | |
| 155 | + } | |
| 156 | + if( nPChild>1 ){ | |
| 157 | + @ <b>Fork</b> | |
| 158 | + } | |
| 159 | + if( isLeaf ){ | |
| 160 | + @ <b>Leaf</b> | |
| 161 | + } | |
| 162 | + }else{ | |
| 163 | + hyperlink_to_uuid(zUuid); | |
| 157 | 164 | } |
| 158 | 165 | db_column_blob(pQuery, 3, &comment); |
| 159 | 166 | wiki_convert(&comment, 0); |
| 160 | 167 | blob_reset(&comment); |
| 161 | - @ (by %h(db_column_text(pQuery,4)))</td></tr> | |
| 168 | + @ (by %h(zUser))</td></tr> | |
| 162 | 169 | } |
| 163 | 170 | @ </table> |
| 164 | 171 | } |
| 165 | 172 | |
| 166 | 173 | /* |
| @@ -207,11 +214,12 @@ | ||
| 207 | 214 | @ coalesce(ecomment, comment), |
| 208 | 215 | @ coalesce(euser, user), |
| 209 | 216 | @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim=1), |
| 210 | 217 | @ (SELECT count(*) FROM plink WHERE cid=blob.rid), |
| 211 | 218 | @ NOT EXISTS (SELECT 1 FROM plink WHERE pid=blob.rid), |
| 212 | - @ coalesce(bgcolor, brbgcolor) | |
| 219 | + @ coalesce(bgcolor, brbgcolor), | |
| 220 | + @ event.type | |
| 213 | 221 | @ FROM event JOIN blob |
| 214 | 222 | @ WHERE blob.rid=event.objid |
| 215 | 223 | ; |
| 216 | 224 | return zBaseSql; |
| 217 | 225 | } |
| @@ -381,10 +389,38 @@ | ||
| 381 | 389 | @ <input type="submit" value="Previous %d(nEntry) Rows"> |
| 382 | 390 | @ </form> |
| 383 | 391 | style_footer(); |
| 384 | 392 | } |
| 385 | 393 | |
| 394 | + | |
| 395 | +/* | |
| 396 | +** WEBPAGE: wlist | |
| 397 | +** | |
| 398 | +** Show the complete change history for a single wiki page. The name | |
| 399 | +** of the wiki is in g.zExtra | |
| 400 | +*/ | |
| 401 | +void wlist_page(void){ | |
| 402 | + Stmt q; | |
| 403 | + char *zTitle; | |
| 404 | + char *zSQL; | |
| 405 | + login_check_credentials(); | |
| 406 | + if( !g.okHistory ){ login_needed(); return; } | |
| 407 | + zTitle = mprintf("History Of %h", g.zExtra); | |
| 408 | + style_header(zTitle); | |
| 409 | + free(zTitle); | |
| 410 | + | |
| 411 | + zSQL = mprintf("%s AND event.objid IN " | |
| 412 | + " (SELECT rid FROM tagxref WHERE tagid=" | |
| 413 | + "(SELECT tagid FROM tag WHERE tagname='wiki-%q'))", | |
| 414 | + timeline_query_for_www(), g.zExtra); | |
| 415 | + db_prepare(&q, zSQL); | |
| 416 | + free(zSQL); | |
| 417 | + www_print_timeline(&q, 0, 0, 0, 0); | |
| 418 | + db_finalize(&q); | |
| 419 | + style_footer(); | |
| 420 | +} | |
| 421 | + | |
| 386 | 422 | /* |
| 387 | 423 | ** The input query q selects various records. Print a human-readable |
| 388 | 424 | ** summary of those records. |
| 389 | 425 | ** |
| 390 | 426 | ** Limit the number of entries printed to nLine. |
| @@ -469,11 +505,10 @@ | ||
| 469 | 505 | @ FROM event, blob |
| 470 | 506 | @ WHERE blob.rid=event.objid |
| 471 | 507 | ; |
| 472 | 508 | return zBaseSql; |
| 473 | 509 | } |
| 474 | - | |
| 475 | 510 | |
| 476 | 511 | /* |
| 477 | 512 | ** COMMAND: timeline |
| 478 | 513 | ** |
| 479 | 514 | ** Usage: %fossil timeline ?WHEN? ?UUID|DATETIME? ?-n|--count N? |
| 480 | 515 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -86,10 +86,11 @@ | |
| 86 | ** 4. User |
| 87 | ** 5. Number of non-merge children |
| 88 | ** 6. Number of parents |
| 89 | ** 7. True if is a leaf |
| 90 | ** 8. background color |
| 91 | */ |
| 92 | void www_print_timeline( |
| 93 | Stmt *pQuery, |
| 94 | int *pFirstEvent, |
| 95 | int *pLastEvent, |
| @@ -113,10 +114,12 @@ | |
| 113 | int nPChild = db_column_int(pQuery, 5); |
| 114 | int nParent = db_column_int(pQuery, 6); |
| 115 | int isLeaf = db_column_int(pQuery, 7); |
| 116 | const char *zBgClr = db_column_text(pQuery, 8); |
| 117 | const char *zDate = db_column_text(pQuery, 2); |
| 118 | if( cnt==0 && pFirstEvent ){ |
| 119 | *pFirstEvent = rid; |
| 120 | } |
| 121 | if( pLastEvent ){ |
| 122 | *pLastEvent = rid; |
| @@ -143,24 +146,28 @@ | |
| 143 | if( zBgClr && zBgClr[0] ){ |
| 144 | @ <td valign="top" align="left" bgcolor="%h(zBgClr)"> |
| 145 | }else{ |
| 146 | @ <td valign="top" align="left"> |
| 147 | } |
| 148 | hyperlink_to_uuid_with_mouseover(zUuid, "xin", "xout", rid); |
| 149 | if( nParent>1 ){ |
| 150 | @ <b>Merge</b> |
| 151 | } |
| 152 | if( nPChild>1 ){ |
| 153 | @ <b>Fork</b> |
| 154 | } |
| 155 | if( isLeaf ){ |
| 156 | @ <b>Leaf</b> |
| 157 | } |
| 158 | db_column_blob(pQuery, 3, &comment); |
| 159 | wiki_convert(&comment, 0); |
| 160 | blob_reset(&comment); |
| 161 | @ (by %h(db_column_text(pQuery,4)))</td></tr> |
| 162 | } |
| 163 | @ </table> |
| 164 | } |
| 165 | |
| 166 | /* |
| @@ -207,11 +214,12 @@ | |
| 207 | @ coalesce(ecomment, comment), |
| 208 | @ coalesce(euser, user), |
| 209 | @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim=1), |
| 210 | @ (SELECT count(*) FROM plink WHERE cid=blob.rid), |
| 211 | @ NOT EXISTS (SELECT 1 FROM plink WHERE pid=blob.rid), |
| 212 | @ coalesce(bgcolor, brbgcolor) |
| 213 | @ FROM event JOIN blob |
| 214 | @ WHERE blob.rid=event.objid |
| 215 | ; |
| 216 | return zBaseSql; |
| 217 | } |
| @@ -381,10 +389,38 @@ | |
| 381 | @ <input type="submit" value="Previous %d(nEntry) Rows"> |
| 382 | @ </form> |
| 383 | style_footer(); |
| 384 | } |
| 385 | |
| 386 | /* |
| 387 | ** The input query q selects various records. Print a human-readable |
| 388 | ** summary of those records. |
| 389 | ** |
| 390 | ** Limit the number of entries printed to nLine. |
| @@ -469,11 +505,10 @@ | |
| 469 | @ FROM event, blob |
| 470 | @ WHERE blob.rid=event.objid |
| 471 | ; |
| 472 | return zBaseSql; |
| 473 | } |
| 474 | |
| 475 | |
| 476 | /* |
| 477 | ** COMMAND: timeline |
| 478 | ** |
| 479 | ** Usage: %fossil timeline ?WHEN? ?UUID|DATETIME? ?-n|--count N? |
| 480 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -86,10 +86,11 @@ | |
| 86 | ** 4. User |
| 87 | ** 5. Number of non-merge children |
| 88 | ** 6. Number of parents |
| 89 | ** 7. True if is a leaf |
| 90 | ** 8. background color |
| 91 | ** 9. type ("ci", "w") |
| 92 | */ |
| 93 | void www_print_timeline( |
| 94 | Stmt *pQuery, |
| 95 | int *pFirstEvent, |
| 96 | int *pLastEvent, |
| @@ -113,10 +114,12 @@ | |
| 114 | int nPChild = db_column_int(pQuery, 5); |
| 115 | int nParent = db_column_int(pQuery, 6); |
| 116 | int isLeaf = db_column_int(pQuery, 7); |
| 117 | const char *zBgClr = db_column_text(pQuery, 8); |
| 118 | const char *zDate = db_column_text(pQuery, 2); |
| 119 | const char *zType = db_column_text(pQuery, 9); |
| 120 | const char *zUser = db_column_text(pQuery, 4); |
| 121 | if( cnt==0 && pFirstEvent ){ |
| 122 | *pFirstEvent = rid; |
| 123 | } |
| 124 | if( pLastEvent ){ |
| 125 | *pLastEvent = rid; |
| @@ -143,24 +146,28 @@ | |
| 146 | if( zBgClr && zBgClr[0] ){ |
| 147 | @ <td valign="top" align="left" bgcolor="%h(zBgClr)"> |
| 148 | }else{ |
| 149 | @ <td valign="top" align="left"> |
| 150 | } |
| 151 | if( zType[0]=='c' ){ |
| 152 | hyperlink_to_uuid_with_mouseover(zUuid, "xin", "xout", rid); |
| 153 | if( nParent>1 ){ |
| 154 | @ <b>Merge</b> |
| 155 | } |
| 156 | if( nPChild>1 ){ |
| 157 | @ <b>Fork</b> |
| 158 | } |
| 159 | if( isLeaf ){ |
| 160 | @ <b>Leaf</b> |
| 161 | } |
| 162 | }else{ |
| 163 | hyperlink_to_uuid(zUuid); |
| 164 | } |
| 165 | db_column_blob(pQuery, 3, &comment); |
| 166 | wiki_convert(&comment, 0); |
| 167 | blob_reset(&comment); |
| 168 | @ (by %h(zUser))</td></tr> |
| 169 | } |
| 170 | @ </table> |
| 171 | } |
| 172 | |
| 173 | /* |
| @@ -207,11 +214,12 @@ | |
| 214 | @ coalesce(ecomment, comment), |
| 215 | @ coalesce(euser, user), |
| 216 | @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim=1), |
| 217 | @ (SELECT count(*) FROM plink WHERE cid=blob.rid), |
| 218 | @ NOT EXISTS (SELECT 1 FROM plink WHERE pid=blob.rid), |
| 219 | @ coalesce(bgcolor, brbgcolor), |
| 220 | @ event.type |
| 221 | @ FROM event JOIN blob |
| 222 | @ WHERE blob.rid=event.objid |
| 223 | ; |
| 224 | return zBaseSql; |
| 225 | } |
| @@ -381,10 +389,38 @@ | |
| 389 | @ <input type="submit" value="Previous %d(nEntry) Rows"> |
| 390 | @ </form> |
| 391 | style_footer(); |
| 392 | } |
| 393 | |
| 394 | |
| 395 | /* |
| 396 | ** WEBPAGE: wlist |
| 397 | ** |
| 398 | ** Show the complete change history for a single wiki page. The name |
| 399 | ** of the wiki is in g.zExtra |
| 400 | */ |
| 401 | void wlist_page(void){ |
| 402 | Stmt q; |
| 403 | char *zTitle; |
| 404 | char *zSQL; |
| 405 | login_check_credentials(); |
| 406 | if( !g.okHistory ){ login_needed(); return; } |
| 407 | zTitle = mprintf("History Of %h", g.zExtra); |
| 408 | style_header(zTitle); |
| 409 | free(zTitle); |
| 410 | |
| 411 | zSQL = mprintf("%s AND event.objid IN " |
| 412 | " (SELECT rid FROM tagxref WHERE tagid=" |
| 413 | "(SELECT tagid FROM tag WHERE tagname='wiki-%q'))", |
| 414 | timeline_query_for_www(), g.zExtra); |
| 415 | db_prepare(&q, zSQL); |
| 416 | free(zSQL); |
| 417 | www_print_timeline(&q, 0, 0, 0, 0); |
| 418 | db_finalize(&q); |
| 419 | style_footer(); |
| 420 | } |
| 421 | |
| 422 | /* |
| 423 | ** The input query q selects various records. Print a human-readable |
| 424 | ** summary of those records. |
| 425 | ** |
| 426 | ** Limit the number of entries printed to nLine. |
| @@ -469,11 +505,10 @@ | |
| 505 | @ FROM event, blob |
| 506 | @ WHERE blob.rid=event.objid |
| 507 | ; |
| 508 | return zBaseSql; |
| 509 | } |
| 510 | |
| 511 | /* |
| 512 | ** COMMAND: timeline |
| 513 | ** |
| 514 | ** Usage: %fossil timeline ?WHEN? ?UUID|DATETIME? ?-n|--count N? |
| 515 |