Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Begin reimplementing the forum webpages. This is a non-functional incremental check-in. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | forum-v2 |
Files: | files | file ages | folders |
SHA3-256: |
2b8b189418148caa42e32f760e2d1b57 |
User & Date: | drh 2018-07-22 18:14:47.932 |
Context
2018-07-22
| ||
18:16 | Updates to the artifact identifier logic to support Forum. ... (check-in: ffe8db57 user: drh tags: forum-v2) | |
18:14 | Begin reimplementing the forum webpages. This is a non-functional incremental check-in. ... (check-in: 2b8b1894 user: drh tags: forum-v2) | |
2018-07-21
| ||
16:53 | Merge enhancements from trunk. ... (check-in: 5544931c user: drh tags: forum-v2) | |
Changes
Changes to src/forum.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 | ** This file contains code used to generate the user forum. */ #include "config.h" #include <assert.h> #include "forum.h" /* | | < | > | | | | | < < < < < < | < < < < < < < < | < | < < < < < < | | | < | | > > < | | | < | | | < | < < | < < < < < | < < < < < < < < < < | < < < | > | < > > | < < < < < < | | | < < < > | > > | | < < > > > | | < > | < < < < < < < | < < > > > | | < < < | < < < < < | < < < < < < < | < < < < < < < < < < < | < | < | < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < | < < < < < < < < < < < < | | < < > < < < | < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 60 61 62 63 64 65 66 67 68 69 70 71 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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | ** This file contains code used to generate the user forum. */ #include "config.h" #include <assert.h> #include "forum.h" /* ** Display all posts in a forum thread in chronological order */ static void forum_thread_chronological(int froot){ Stmt q; db_prepare(&q, "SELECT fpid FROM forumpost WHERE froot=%d" " ORDER BY fmtime", froot); while( db_step(&q)==SQLITE_ROW ){ int fpid = db_column_int(&q, 0); Manifest *pPost = manifest_get(fpid, CFTYPE_FORUM, 0); if( pPost==0 ) continue; manifest_destroy(pPost); } db_finalize(&q); } /* ** WEBPAGE: forumthread ** ** Show all forum messages associated with a particular message thread. ** ** Query parameters: ** ** name=X The hash of the first post of the thread. REQUIRED */ void forumthread_page(void){ int fpid; int froot; const char *zName = P("name"); login_check_credentials(); if( !g.perm.RdForum ){ login_needed(g.anon.RdForum); return; } style_header("Forum"); if( zName==0 ){ @ <p class='generalError'>Missing name= query parameter</p> style_footer(); return; } fpid = symbolic_name_to_rid(zName, "f"); if( fpid<=0 ){ @ <p class='generalError'>Unknown or ambiguous forum id in the "name=" @ query parameter</p> style_footer(); return; } froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); if( froot==0 ){ @ <p class='generalError'>Invalid forum id in the "name=" @ query parameter</p> style_footer(); return; } forum_thread_chronological(froot); style_footer(); } /* ** WEBPAGE: forumnew ** ** Start a new forum thread. */ void forumnew_page(void){ style_header("Pending"); @ TBD... style_footer(); } /* ** WEBPAGE: forumreply ** ** Reply to a forum message. ** Query parameters: ** ** name=X Hash of the post to reply to. REQUIRED */ void forumreply_page(void){ style_header("Pending"); @ TBD... style_footer(); } /* ** WEBPAGE: forumedit ** ** Edit an existing forum message. ** Query parameters: ** ** name=X Hash of the post to be editted. REQUIRED */ void forumedit_page(void){ style_header("Pending"); @ TBD... style_footer(); } |
Changes to src/schema.c.
︙ | ︙ | |||
288 289 290 291 292 293 294 | @ -- between the plink and tagxref tables, but it is a slower join for @ -- very large repositories (repositories with 100,000 or more check-ins) @ -- and so it makes sense to precompute the set of leaves. There is @ -- one entry in the following table for each leaf. @ -- @ CREATE TABLE leaf(rid INTEGER PRIMARY KEY); @ | | > > > > > > | | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | @ -- between the plink and tagxref tables, but it is a slower join for @ -- very large repositories (repositories with 100,000 or more check-ins) @ -- and so it makes sense to precompute the set of leaves. There is @ -- one entry in the following table for each leaf. @ -- @ CREATE TABLE leaf(rid INTEGER PRIMARY KEY); @ @ -- Events used to generate a timeline. Type meanings: @ -- ci Check-ins @ -- e Technotes @ -- f Forum posts @ -- g Tags @ -- t Ticket changes @ -- w Wiki page edit @ -- @ CREATE TABLE event( @ type TEXT, -- Type of event: ci, e, f, g, t, w @ mtime DATETIME, -- Time of occurrence. Julian day. @ objid INTEGER PRIMARY KEY, -- Associated record ID @ tagid INTEGER, -- Associated ticket or wiki name tag @ uid INTEGER REFERENCES user, -- User who caused the event @ bgcolor TEXT, -- Color set by 'bgcolor' property @ euser TEXT, -- User set by 'user' property @ user TEXT, -- Name of the user |
︙ | ︙ |
Changes to src/timeline.c.
︙ | ︙ | |||
572 573 574 575 576 577 578 | cgi_printf("check-in: %z%S</a> ",href("%R/info/%!S",zUuid),zUuid); }else if( zType[0]=='e' && tagid ){ cgi_printf("technote: "); hyperlink_to_event_tagid(tagid<0?-tagid:tagid); }else{ cgi_printf("artifact: %z%S</a> ",href("%R/info/%!S",zUuid),zUuid); } | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | cgi_printf("check-in: %z%S</a> ",href("%R/info/%!S",zUuid),zUuid); }else if( zType[0]=='e' && tagid ){ cgi_printf("technote: "); hyperlink_to_event_tagid(tagid<0?-tagid:tagid); }else{ cgi_printf("artifact: %z%S</a> ",href("%R/info/%!S",zUuid),zUuid); } }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t' || zType[0]=='f'){ cgi_printf("artifact: %z%S</a> ",href("%R/info/%!S",zUuid),zUuid); } if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){ char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd&n=200", zDispUser, zDate); cgi_printf("user: %z%h</a>", href("%z",zLink), zDispUser); }else{ |
︙ | ︙ | |||
1029 1030 1031 1032 1033 1034 1035 | /* ** Add the select/option box to the timeline submenu that is used to ** set the y= parameter that determines which elements to display ** on the timeline. */ static void timeline_y_submenu(int isDisabled){ static int i = 0; | | | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 | /* ** Add the select/option box to the timeline submenu that is used to ** set the y= parameter that determines which elements to display ** on the timeline. */ static void timeline_y_submenu(int isDisabled){ static int i = 0; static const char *az[14]; if( i==0 ){ az[0] = "all"; az[1] = "Any Type"; i = 2; if( g.perm.Read ){ az[i++] = "ci"; az[i++] = "Check-ins"; |
︙ | ︙ | |||
1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | if( g.perm.RdTkt ){ az[i++] = "t"; az[i++] = "Tickets"; } if( g.perm.RdWiki ){ az[i++] = "w"; az[i++] = "Wiki"; } assert( i<=count(az) ); } if( i>2 ){ style_submenu_multichoice("y", i/2, az, isDisabled); } } | > > > > | 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 | if( g.perm.RdTkt ){ az[i++] = "t"; az[i++] = "Tickets"; } if( g.perm.RdWiki ){ az[i++] = "w"; az[i++] = "Wiki"; } if( g.perm.RdForum ){ az[i++] = "f"; az[i++] = "Forum"; } assert( i<=count(az) ); } if( i>2 ){ style_submenu_multichoice("y", i/2, az, isDisabled); } } |
︙ | ︙ | |||
1355 1356 1357 1358 1359 1360 1361 | ** dp=CHECKIN The same as d=CHECKIN&p=CHECKIN ** t=TAG Show only check-ins with the given TAG ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel ** rel Show related check-ins as well as those matching t=TAG ** mionly Limit rel to show ancestors but not descendants ** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP ** u=USER Only show items associated with USER | | | 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 | ** dp=CHECKIN The same as d=CHECKIN&p=CHECKIN ** t=TAG Show only check-ins with the given TAG ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel ** rel Show related check-ins as well as those matching t=TAG ** mionly Limit rel to show ancestors but not descendants ** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP ** u=USER Only show items associated with USER ** y=TYPE 'ci', 'w', 't', 'e', 'f', or 'all'. ** ss=VIEWSTYLE c: "Compact" v: "Verbose" m: "Modern" j: "Columnar" ** advm Use the "Advanced" or "Busy" menu design. ** ng No Graph. ** nd Do not highlight the focus check-in ** v Show details of files changed ** f=CHECKIN Show family (immediate parents and children) of CHECKIN ** from=CHECKIN Path from... |
︙ | ︙ | |||
1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 | blob_append_sql(&cond, ")"); } if( (zType[0]=='w' && !g.perm.RdWiki) || (zType[0]=='t' && !g.perm.RdTkt) || (zType[0]=='e' && !g.perm.RdWiki) || (zType[0]=='c' && !g.perm.Read) || (zType[0]=='g' && !g.perm.Read) ){ zType = "all"; } if( zType[0]=='a' ){ if( !g.perm.Read || !g.perm.RdWiki || !g.perm.RdTkt ){ char cSep = '('; blob_append_sql(&cond, " AND event.type IN "); if( g.perm.Read ){ blob_append_sql(&cond, "%c'ci','g'", cSep); cSep = ','; } if( g.perm.RdWiki ){ blob_append_sql(&cond, "%c'w','e'", cSep); cSep = ','; } if( g.perm.RdTkt ){ blob_append_sql(&cond, "%c't'", cSep); cSep = ','; } blob_append_sql(&cond, ")"); } }else{ /* zType!="all" */ blob_append_sql(&cond, " AND event.type=%Q", zType); if( zType[0]=='c' ){ zEType = "check-in"; }else if( zType[0]=='w' ){ zEType = "wiki"; }else if( zType[0]=='t' ){ zEType = "ticket change"; }else if( zType[0]=='e' ){ zEType = "technical note"; }else if( zType[0]=='g' ){ zEType = "tag"; } } if( zUser ){ int n = db_int(0,"SELECT count(*) FROM event" " WHERE user=%Q OR euser=%Q", zUser, zUser); if( n<=nEntry ){ zCirca = zBefore = zAfter = 0; | > > > > > > > | 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 | blob_append_sql(&cond, ")"); } if( (zType[0]=='w' && !g.perm.RdWiki) || (zType[0]=='t' && !g.perm.RdTkt) || (zType[0]=='e' && !g.perm.RdWiki) || (zType[0]=='c' && !g.perm.Read) || (zType[0]=='g' && !g.perm.Read) || (zType[0]=='f' && !g.perm.RdForum) ){ zType = "all"; } if( zType[0]=='a' ){ if( !g.perm.Read || !g.perm.RdWiki || !g.perm.RdTkt ){ char cSep = '('; blob_append_sql(&cond, " AND event.type IN "); if( g.perm.Read ){ blob_append_sql(&cond, "%c'ci','g'", cSep); cSep = ','; } if( g.perm.RdWiki ){ blob_append_sql(&cond, "%c'w','e'", cSep); cSep = ','; } if( g.perm.RdTkt ){ blob_append_sql(&cond, "%c't'", cSep); cSep = ','; } if( g.perm.RdForum ){ blob_append_sql(&cond, "%c'f'", cSep); cSep = ','; } blob_append_sql(&cond, ")"); } }else{ /* zType!="all" */ blob_append_sql(&cond, " AND event.type=%Q", zType); if( zType[0]=='c' ){ zEType = "check-in"; }else if( zType[0]=='w' ){ zEType = "wiki"; }else if( zType[0]=='t' ){ zEType = "ticket change"; }else if( zType[0]=='e' ){ zEType = "technical note"; }else if( zType[0]=='g' ){ zEType = "tag"; }else if( zType[0]=='f' ){ zEType = "forum post"; } } if( zUser ){ int n = db_int(0,"SELECT count(*) FROM event" " WHERE user=%Q OR euser=%Q", zUser, zUser); if( n<=nEntry ){ zCirca = zBefore = zAfter = 0; |
︙ | ︙ |