Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Separately show original and edited user/date |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
39a550c8d56c67baf8a7f51352f3c5c6 |
User & Date: | andygoth 2020-08-25 13:47:29 |
Context
2020-08-25
| ||
13:53 | Tiniest style tweak for consistency ... (check-in: 7ea82586 user: andygoth tags: trunk) | |
13:47 | Separately show original and edited user/date ... (check-in: 39a550c8 user: andygoth tags: trunk) | |
07:07 | Removed some hard tabs in CSS injected by copy/paste from the browser dev tools. ... (check-in: 1bfa3686 user: stephan tags: trunk) | |
Changes
Changes to src/forum.c.
︙ | ︙ | |||
401 402 403 404 405 406 407 | int bHist, /* True if showing edit history */ int bSelect, /* True if this is the selected post */ char *zQuery /* Common query string */ ){ char *zDisplayName; /* The display name */ char *zDate; /* The time/date string */ char *zHist; /* History query string */ | | > > | > > | > > > | | | | | > > > > > > < < < < < < | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 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 469 470 471 472 473 474 475 | int bHist, /* True if showing edit history */ int bSelect, /* True if this is the selected post */ char *zQuery /* Common query string */ ){ char *zDisplayName; /* The display name */ char *zDate; /* The time/date string */ char *zHist; /* History query string */ Manifest *pOriginal; /* Original post artifact */ Manifest *pRevised; /* Revised post artifact (may be same as pOriginal) */ int bPrivate; /* True for posts awaiting moderation */ int bSameUser; /* True if author is also the reader */ int iIndent; /* Indent level */ const char *zMimetype;/* Formatting MIME type */ /* Get the original and revised artifacts for the post. Abort if either is * not found (e.g. shunned). */ if( p->pEditHead ){ pOriginal = manifest_get(p->pEditHead->fpid, CFTYPE_FORUM, 0); pRevised = manifest_get(p->fpid, CFTYPE_FORUM, 0); }else{ pOriginal = pRevised = manifest_get(p->fpid, CFTYPE_FORUM, 0); } if( !pOriginal || !pRevised ) return; /* When not in raw mode, create the border around the post. */ if( !bRaw ){ /* Open the <div> enclosing the post. Set the class string to mark the post ** as selected and/or obsolete. */ iIndent = (p->pEditHead ? p->pEditHead->nIndent : p->nIndent)-1; @ <div id='forum%d(p->fpid)' class='forumTime\ @ %s(bSelect ? " forumSel" : "")\ @ %s(p->pEditTail ? " forumObs" : "")'\ if( iIndent && iIndentScale ){ @ style='margin-left: %d(iIndent*iIndentScale)ex' } @ > /* If this is the first post (or an edit thereof), emit the thread title. */ if( pRevised->zThreadTitle ){ @ <h1>%h(pRevised->zThreadTitle)</h1> } /* Emit the serial number, revision number, author, and date. */ zDisplayName = display_name_from_login(pOriginal->zUser); zDate = db_text(0, "SELECT datetime(%.17g)", pOriginal->rDate); @ <h3 class='forumPostHdr'>(%d(p->sid)\ if( p->nEdit ){ @ .%.*d(fossil_num_digits(p->nEdit))(p->rev)\ } @ ) By %h(zDisplayName) on %h(zDate) fossil_free(zDisplayName); fossil_free(zDate); /* If debugging is enabled, link to the artifact page. */ if( g.perm.Debug ){ @ <span class="debug">\ @ <a href="%R/artifact/%h(p->zUuid)">(artifact-%d(p->fpid))</a></span> } /* If this is an edit, refer back to the old version. Be sure "hist" is in ** the query string so the old version will actually be shown. */ if( p->pEditPrev ){ zHist = bHist ? "" : "&hist"; @ edit of \ @ %z(href("%R/forumpost/%S?%s%s",p->pEditPrev->zUuid,zQuery,zHist))\ @ %d(p->sid).%.*d(fossil_num_digits(p->nEdit))(p->pEditPrev->rev)</a> } /* If this is a reply, refer back to the parent post. */ if( p->pIrt ){ @ in reply to %z(href("%R/forumpost/%S?%s",p->pIrt->zUuid,zQuery))\ @ %d(p->pIrt->sid)\ if( p->pIrt->nEdit ){ @ .%.*d(fossil_num_digits(p->pIrt->nEdit))(p->pIrt->rev)\ } |
︙ | ︙ | |||
481 482 483 484 485 486 487 488 489 490 491 492 493 | @ %z(href("%R/forumpost/%S?%s",p->zUuid,zQuery))[link]</a> } /* Provide a link to the raw source code. */ if( !bUnf ){ @ %z(href("%R/forumpost/%S?raw",p->zUuid))[source]</a> } @ </h3> } /* Check if this post is approved, also if it's by the current user. */ bPrivate = content_is_private(p->fpid); bSameUser = login_is_individual() | > > > > > > > > > | | | | 488 489 490 491 492 493 494 495 496 497 498 499 500 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 | @ %z(href("%R/forumpost/%S?%s",p->zUuid,zQuery))[link]</a> } /* Provide a link to the raw source code. */ if( !bUnf ){ @ %z(href("%R/forumpost/%S?raw",p->zUuid))[source]</a> } /* If this is an edit, identify the editor and date. */ if( p->pEditPrev ){ zDisplayName = display_name_from_login(pRevised->zUser); zDate = db_text(0, "SELECT datetime(%.17g)", pRevised->rDate); @ <br>Edited by %h(zDisplayName) on %h(zDate) fossil_free(zDisplayName); fossil_free(zDate); } @ </h3> } /* Check if this post is approved, also if it's by the current user. */ bPrivate = content_is_private(p->fpid); bSameUser = login_is_individual() && fossil_strcmp(pOriginal->zUser, g.zLogin)==0; /* Render the post if the user is able to see it. */ if( bPrivate && !g.perm.ModForum && !bSameUser ){ @ <p><span class="modpending">Awaiting Moderator Approval</span></p> }else{ if( bRaw || bUnf || p->pEditTail ){ zMimetype = "text/plain"; }else{ zMimetype = pRevised->zMimetype; } forum_render(0, zMimetype, pRevised->zWiki, 0, !bRaw); } /* When not in raw mode, finish creating the border around the post. */ if( !bRaw ){ /* If the user is able to write to the forum and if this post has not been ** edited, create a form with various interaction buttons. */ if( g.perm.WrForum && !p->pEditTail ){ |
︙ | ︙ | |||
521 522 523 524 525 526 527 | } }else if( g.perm.ModForum ){ /* Allow moderators to approve or reject pending posts. Also allow ** forum supervisors to mark non-special users as trusted and therefore ** able to post unmoderated. */ @ <input type="submit" name="approve" value="Approve"> @ <input type="submit" name="reject" value="Reject"> | | | | | > | | 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 | } }else if( g.perm.ModForum ){ /* Allow moderators to approve or reject pending posts. Also allow ** forum supervisors to mark non-special users as trusted and therefore ** able to post unmoderated. */ @ <input type="submit" name="approve" value="Approve"> @ <input type="submit" name="reject" value="Reject"> if( g.perm.AdminForum && !login_is_special(pOriginal->zUser) ){ @ <br><label><input type="checkbox" name="trust"> @ Trust user "%h(pOriginal->zUser)" so that future posts by \ @ "%h(pOriginal->zUser)" do not require moderation. @ </label> @ <input type="hidden" name="trustuser" value="%h(pOriginal->zUser)"> } }else if( bSameUser ){ /* Allow users to delete (reject) their own pending posts. */ @ <input type="submit" name="reject" value="Delete"> } @ </form></div> } @ </div> } /* Clean up. */ if( pRevised!=pOriginal ) manifest_destroy(pRevised); manifest_destroy(pOriginal); } /* ** Possible display modes for forum_display_thread(). */ enum { FD_RAW, /* Like FD_SINGLE, but additionally omit the border, force |
︙ | ︙ |