Fossil SCM
Merge forum enhancements to trunk: (1) The new thread= query parameter on /timeline, with a "Timeline" link in the submenu of the thread display, (2) related tags show up in the artifacts page for a forum thread, (3) related tags show up in the /timeline?y=f timeline for the forum.
Commit
0d2ceb89e1ef8d938e840ef53268259c0308f203eaff51237f6161b1b45dee3d
Parent
a6b17d2a7e68cc1…
2 files changed
+163
-8
+70
-4
+163
-8
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -826,26 +826,150 @@ | ||
| 826 | 826 | } |
| 827 | 827 | fossil_print("\n"); |
| 828 | 828 | } |
| 829 | 829 | forumthread_delete(pThread); |
| 830 | 830 | } |
| 831 | + | |
| 832 | +/* | |
| 833 | +** Fill the TEMP table zTab with the RID of every artifact associated | |
| 834 | +** with the forum thread whose root post is froot. That is the forum | |
| 835 | +** posts themselves, plus any control artifacts that tag those posts, | |
| 836 | +** such as to close or reopen a post or to change the status of the | |
| 837 | +** thread. The table is created if it does not already exist, with | |
| 838 | +** this schema: | |
| 839 | +** | |
| 840 | +** CREATE TEMP TABLE zTab(rid INTEGER PRIMARY KEY, | |
| 841 | +** isCtrl BOOLEAN, zDesc TEXT); | |
| 842 | +** | |
| 843 | +** isCtrl is true for control artifacts. If bDesc is true, then zDesc | |
| 844 | +** is set to an HTML description of the tags that each control artifact | |
| 845 | +** applies to posts in the thread. Otherwise zDesc is left NULL. zDesc | |
| 846 | +** is always NULL for the forum posts themselves. | |
| 847 | +** | |
| 848 | +** If bClear is true, any prior content of zTab is deleted first. | |
| 849 | +** Otherwise, new rows are added to whatever zTab already contains, | |
| 850 | +** and RIDs that are already present are left unchanged. | |
| 851 | +** | |
| 852 | +** Candidate control artifacts come from tagxref.srcid, which only | |
| 853 | +** remembers the most recent tag of each name on each post, and from | |
| 854 | +** the event.comment that manifest_crosslink() generates for each | |
| 855 | +** control artifact, which also finds tags that have since been | |
| 856 | +** superseded. That comment includes a hash prefix of at least 12 | |
| 857 | +** characters for each tagged artifact. Each candidate is then | |
| 858 | +** parsed to verify that it really does tag a post in this thread. | |
| 859 | +** | |
| 860 | +** zTab is inserted into the SQL as-is, so it must be a trusted | |
| 861 | +** identifier, not user input. | |
| 862 | +*/ | |
| 863 | +void forum_thread_artifacts( | |
| 864 | + const char *zTab, /* Name of the TEMP table to fill */ | |
| 865 | + int froot, /* RID of the root post of the thread */ | |
| 866 | + int bClear, /* True to delete prior content of zTab first */ | |
| 867 | + int bDesc /* True to fill in zDesc for control artifacts */ | |
| 868 | +){ | |
| 869 | + Stmt q; | |
| 870 | + db_multi_exec( | |
| 871 | + "CREATE TEMP TABLE IF NOT EXISTS \"%w\"(" | |
| 872 | + " rid INTEGER PRIMARY KEY, isCtrl BOOLEAN, zDesc TEXT);", | |
| 873 | + zTab | |
| 874 | + ); | |
| 875 | + if( bClear ){ | |
| 876 | + db_multi_exec("DELETE FROM \"%w\";", zTab); | |
| 877 | + } | |
| 878 | + db_multi_exec( | |
| 879 | + "INSERT OR IGNORE INTO \"%w\"(rid,isCtrl)" | |
| 880 | + " SELECT fpid, 0 FROM forumpost WHERE froot=%d;", | |
| 881 | + zTab, froot | |
| 882 | + ); | |
| 883 | + | |
| 884 | + /* Find candidate control artifacts. Each one is verified before | |
| 885 | + ** being added, and candidates already in zTab are skipped, so that | |
| 886 | + ** when bClear is false, rows that were already in zTab are not | |
| 887 | + ** disturbed. */ | |
| 888 | + db_prepare(&q, | |
| 889 | + "SELECT srcid FROM tagxref" | |
| 890 | + " WHERE rid IN (SELECT fpid FROM forumpost WHERE froot=%d)" | |
| 891 | + " AND srcid>0 AND srcid!=rid" | |
| 892 | + " UNION " | |
| 893 | + "SELECT event.objid FROM event, forumpost, blob" | |
| 894 | + " WHERE forumpost.froot=%d" | |
| 895 | + " AND blob.rid=forumpost.fpid" | |
| 896 | + " AND event.type='g'" | |
| 897 | + " AND instr(event.comment, '['||substr(blob.uuid,1,12))>0" | |
| 898 | + " AND event.mtime >= forumpost.fmtime-0.01" | |
| 899 | + " AND event.mtime <= (SELECT max(mtime) FROM tagxref" | |
| 900 | + " WHERE rid=%d)", | |
| 901 | + froot, froot, froot | |
| 902 | + ); | |
| 903 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 904 | + int rid = db_column_int(&q, 0); | |
| 905 | + Manifest *pCtrl; | |
| 906 | + Blob desc = BLOB_INITIALIZER; | |
| 907 | + int nMatch = 0; | |
| 908 | + int i; | |
| 909 | + if( db_exists("SELECT 1 FROM \"%w\" WHERE rid=%d", zTab, rid) ){ | |
| 910 | + continue; | |
| 911 | + } | |
| 912 | + pCtrl = manifest_get(rid, CFTYPE_CONTROL, 0); | |
| 913 | + for(i=0; pCtrl && i<pCtrl->nTag; i++){ | |
| 914 | + const char *zTag = pCtrl->aTag[i].zName; | |
| 915 | + const char *zVal = pCtrl->aTag[i].zValue; | |
| 916 | + const char *zTarget = pCtrl->aTag[i].zUuid; | |
| 917 | + int isCancel = zTag[0]=='-'; | |
| 918 | + if( zTarget==0 | |
| 919 | + || !db_exists("SELECT 1 FROM forumpost, blob" | |
| 920 | + " WHERE forumpost.froot=%d AND blob.rid=forumpost.fpid" | |
| 921 | + " AND blob.uuid=%Q", froot, zTarget) | |
| 922 | + ){ | |
| 923 | + continue; | |
| 924 | + } | |
| 925 | + nMatch++; | |
| 926 | + if( !bDesc ) break; | |
| 927 | + if( blob_size(&desc) ) blob_append(&desc, "; ", 2); | |
| 928 | + if( fossil_strcmp(&zTag[1], "closed")==0 ){ | |
| 929 | + blob_append(&desc, isCancel ? "reopen" : "close", -1); | |
| 930 | + }else if( fossil_strcmp(&zTag[1], "status")==0 ){ | |
| 931 | + if( isCancel || zVal==0 || zVal[0]==0 ){ | |
| 932 | + blob_append(&desc, "clear status of", -1); | |
| 933 | + }else{ | |
| 934 | + blob_appendf(&desc, "set status \"%h\" on", zVal); | |
| 935 | + } | |
| 936 | + }else if( zVal && zVal[0] ){ | |
| 937 | + blob_appendf(&desc, "tag %h=\"%h\" on", zTag, zVal); | |
| 938 | + }else{ | |
| 939 | + blob_appendf(&desc, "tag %h on", zTag); | |
| 940 | + } | |
| 941 | + blob_appendf(&desc, " post %z%S</a>", | |
| 942 | + href("%R/forumpost/%!S", zTarget), zTarget); | |
| 943 | + } | |
| 944 | + manifest_destroy(pCtrl); | |
| 945 | + if( nMatch ){ | |
| 946 | + db_multi_exec( | |
| 947 | + "INSERT INTO \"%w\"(rid,isCtrl,zDesc) VALUES(%d,1,%Q)", | |
| 948 | + zTab, rid, bDesc ? blob_str(&desc) : 0 | |
| 949 | + ); | |
| 950 | + } | |
| 951 | + blob_reset(&desc); | |
| 952 | + } | |
| 953 | + db_finalize(&q); | |
| 954 | +} | |
| 831 | 955 | |
| 832 | 956 | /* |
| 833 | 957 | ** WEBPAGE: forumthreadhashlist |
| 834 | 958 | ** |
| 835 | 959 | ** Usage: /forumthreadhashlist/HASH-OF-ROOT |
| 836 | 960 | ** |
| 837 | 961 | ** This page (accessibly only to admins) shows a list of all artifacts |
| 838 | -** associated with a single forum thread. An admin might copy/paste this | |
| 839 | -** list into the /shun page in order to shun an entire thread. | |
| 962 | +** associated with a single forum thread, including control artifacts | |
| 963 | +** that close or reopen posts or change the status of the thread. | |
| 964 | +** An admin might copy/paste the list of hashes into the /shun page in | |
| 965 | +** order to shun an entire thread. | |
| 840 | 966 | */ |
| 841 | 967 | void forumthreadhashlist(void){ |
| 842 | 968 | int fpid; |
| 843 | 969 | int froot; |
| 844 | 970 | const char *zName = P("name"); |
| 845 | - ForumThread *pThread; | |
| 846 | - ForumPost *p; | |
| 847 | 971 | char *fuuid; |
| 848 | 972 | Stmt q; |
| 849 | 973 | |
| 850 | 974 | login_check_credentials(); |
| 851 | 975 | if( !g.perm.Admin ){ |
| @@ -868,19 +992,49 @@ | ||
| 868 | 992 | webpage_notfound_error("Not a forum post: \"%s\"", zName); |
| 869 | 993 | } |
| 870 | 994 | fuuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", froot); |
| 871 | 995 | style_set_current_feature("forum"); |
| 872 | 996 | style_header("Artifacts Of Forum Thread"); |
| 997 | + | |
| 998 | + forum_thread_artifacts("fthread", froot, 1, 1); | |
| 999 | + describe_artifacts("IN (SELECT rid FROM fthread)"); | |
| 1000 | + | |
| 873 | 1001 | @ <h2> |
| 874 | 1002 | @ Artifacts associated with the forum thread |
| 875 | 1003 | @ <a href="%R/forumthread/%S(fuuid)">%S(fuuid)</a>:</h2> |
| 1004 | + @ <table border="1" cellpadding="4" cellspacing="0"> | |
| 1005 | + @ <tr><th>Date<th>Hash<th>User<th>Description | |
| 1006 | + db_prepare(&q, | |
| 1007 | + "SELECT description.uuid," | |
| 1008 | + " datetime(coalesce(event.mtime,description.ctime))," | |
| 1009 | + " coalesce(event.euser,event.user)," | |
| 1010 | + " description.summary, fthread.zDesc" | |
| 1011 | + " FROM fthread JOIN description USING(rid)" | |
| 1012 | + " LEFT JOIN event ON event.objid=fthread.rid" | |
| 1013 | + " ORDER BY coalesce(event.mtime,description.ctime), fthread.rid" | |
| 1014 | + ); | |
| 1015 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 1016 | + const char *zUuid = db_column_text(&q, 0); | |
| 1017 | + const char *zCtrlDesc = db_column_text(&q, 4); | |
| 1018 | + @ <tr><td>%h(db_column_text(&q,1))\ | |
| 1019 | + @ <td>%z(href("%R/artifact/%!S",zUuid))%S(zUuid)</a>\ | |
| 1020 | + @ <td>%h(db_column_text(&q,2))\ | |
| 1021 | + if( zCtrlDesc ){ | |
| 1022 | + @ <td>forum-tag: %s(zCtrlDesc)</tr> | |
| 1023 | + }else{ | |
| 1024 | + @ <td>%h(db_column_text(&q,3))</tr> | |
| 1025 | + } | |
| 1026 | + } | |
| 1027 | + @ </table> | |
| 1028 | + @ <h2>Artifact hashes, suitable for pasting into | |
| 1029 | + @ %z(href("%R/shun"))/shun</a>:</h2> | |
| 876 | 1030 | @ <pre> |
| 877 | - pThread = forumthread_create(froot, 1); | |
| 878 | - for(p=pThread->pFirst; p; p=p->pNext){ | |
| 879 | - @ %h(p->zUuid) | |
| 1031 | + db_reset(&q); | |
| 1032 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 1033 | + @ %h(db_column_text(&q,0)) | |
| 880 | 1034 | } |
| 881 | - forumthread_delete(pThread); | |
| 1035 | + db_finalize(&q); | |
| 882 | 1036 | @ </pre> |
| 883 | 1037 | @ <hr> |
| 884 | 1038 | @ <h2>Related FORUMPOST Table Content</h2> |
| 885 | 1039 | @ <table border="1" cellpadding="4" cellspacing="0"> |
| 886 | 1040 | @ <tr><th>fpid<th>froot<th>fprev<th>firt<th>fmtime |
| @@ -1678,10 +1832,11 @@ | ||
| 1678 | 1832 | style_submenu_element("Hierarchical", "%R/%s/%s?t=h%s%s", g.zPath, zName, |
| 1679 | 1833 | bUnf ? "&unf" : "", bHist ? "&hist" : ""); |
| 1680 | 1834 | } |
| 1681 | 1835 | style_submenu_checkbox("unf", "Unformatted", 0, 0); |
| 1682 | 1836 | style_submenu_checkbox("hist", "History", 0, 0); |
| 1837 | + style_submenu_element("Timeline", "%R/timeline?thread=%t", zName); | |
| 1683 | 1838 | if( g.perm.Admin ){ |
| 1684 | 1839 | style_submenu_element("Artifacts", "%R/forumthreadhashlist/%t", zName); |
| 1685 | 1840 | } |
| 1686 | 1841 | |
| 1687 | 1842 | /* Display the thread. */ |
| 1688 | 1843 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -826,26 +826,150 @@ | |
| 826 | } |
| 827 | fossil_print("\n"); |
| 828 | } |
| 829 | forumthread_delete(pThread); |
| 830 | } |
| 831 | |
| 832 | /* |
| 833 | ** WEBPAGE: forumthreadhashlist |
| 834 | ** |
| 835 | ** Usage: /forumthreadhashlist/HASH-OF-ROOT |
| 836 | ** |
| 837 | ** This page (accessibly only to admins) shows a list of all artifacts |
| 838 | ** associated with a single forum thread. An admin might copy/paste this |
| 839 | ** list into the /shun page in order to shun an entire thread. |
| 840 | */ |
| 841 | void forumthreadhashlist(void){ |
| 842 | int fpid; |
| 843 | int froot; |
| 844 | const char *zName = P("name"); |
| 845 | ForumThread *pThread; |
| 846 | ForumPost *p; |
| 847 | char *fuuid; |
| 848 | Stmt q; |
| 849 | |
| 850 | login_check_credentials(); |
| 851 | if( !g.perm.Admin ){ |
| @@ -868,19 +992,49 @@ | |
| 868 | webpage_notfound_error("Not a forum post: \"%s\"", zName); |
| 869 | } |
| 870 | fuuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", froot); |
| 871 | style_set_current_feature("forum"); |
| 872 | style_header("Artifacts Of Forum Thread"); |
| 873 | @ <h2> |
| 874 | @ Artifacts associated with the forum thread |
| 875 | @ <a href="%R/forumthread/%S(fuuid)">%S(fuuid)</a>:</h2> |
| 876 | @ <pre> |
| 877 | pThread = forumthread_create(froot, 1); |
| 878 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 879 | @ %h(p->zUuid) |
| 880 | } |
| 881 | forumthread_delete(pThread); |
| 882 | @ </pre> |
| 883 | @ <hr> |
| 884 | @ <h2>Related FORUMPOST Table Content</h2> |
| 885 | @ <table border="1" cellpadding="4" cellspacing="0"> |
| 886 | @ <tr><th>fpid<th>froot<th>fprev<th>firt<th>fmtime |
| @@ -1678,10 +1832,11 @@ | |
| 1678 | style_submenu_element("Hierarchical", "%R/%s/%s?t=h%s%s", g.zPath, zName, |
| 1679 | bUnf ? "&unf" : "", bHist ? "&hist" : ""); |
| 1680 | } |
| 1681 | style_submenu_checkbox("unf", "Unformatted", 0, 0); |
| 1682 | style_submenu_checkbox("hist", "History", 0, 0); |
| 1683 | if( g.perm.Admin ){ |
| 1684 | style_submenu_element("Artifacts", "%R/forumthreadhashlist/%t", zName); |
| 1685 | } |
| 1686 | |
| 1687 | /* Display the thread. */ |
| 1688 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -826,26 +826,150 @@ | |
| 826 | } |
| 827 | fossil_print("\n"); |
| 828 | } |
| 829 | forumthread_delete(pThread); |
| 830 | } |
| 831 | |
| 832 | /* |
| 833 | ** Fill the TEMP table zTab with the RID of every artifact associated |
| 834 | ** with the forum thread whose root post is froot. That is the forum |
| 835 | ** posts themselves, plus any control artifacts that tag those posts, |
| 836 | ** such as to close or reopen a post or to change the status of the |
| 837 | ** thread. The table is created if it does not already exist, with |
| 838 | ** this schema: |
| 839 | ** |
| 840 | ** CREATE TEMP TABLE zTab(rid INTEGER PRIMARY KEY, |
| 841 | ** isCtrl BOOLEAN, zDesc TEXT); |
| 842 | ** |
| 843 | ** isCtrl is true for control artifacts. If bDesc is true, then zDesc |
| 844 | ** is set to an HTML description of the tags that each control artifact |
| 845 | ** applies to posts in the thread. Otherwise zDesc is left NULL. zDesc |
| 846 | ** is always NULL for the forum posts themselves. |
| 847 | ** |
| 848 | ** If bClear is true, any prior content of zTab is deleted first. |
| 849 | ** Otherwise, new rows are added to whatever zTab already contains, |
| 850 | ** and RIDs that are already present are left unchanged. |
| 851 | ** |
| 852 | ** Candidate control artifacts come from tagxref.srcid, which only |
| 853 | ** remembers the most recent tag of each name on each post, and from |
| 854 | ** the event.comment that manifest_crosslink() generates for each |
| 855 | ** control artifact, which also finds tags that have since been |
| 856 | ** superseded. That comment includes a hash prefix of at least 12 |
| 857 | ** characters for each tagged artifact. Each candidate is then |
| 858 | ** parsed to verify that it really does tag a post in this thread. |
| 859 | ** |
| 860 | ** zTab is inserted into the SQL as-is, so it must be a trusted |
| 861 | ** identifier, not user input. |
| 862 | */ |
| 863 | void forum_thread_artifacts( |
| 864 | const char *zTab, /* Name of the TEMP table to fill */ |
| 865 | int froot, /* RID of the root post of the thread */ |
| 866 | int bClear, /* True to delete prior content of zTab first */ |
| 867 | int bDesc /* True to fill in zDesc for control artifacts */ |
| 868 | ){ |
| 869 | Stmt q; |
| 870 | db_multi_exec( |
| 871 | "CREATE TEMP TABLE IF NOT EXISTS \"%w\"(" |
| 872 | " rid INTEGER PRIMARY KEY, isCtrl BOOLEAN, zDesc TEXT);", |
| 873 | zTab |
| 874 | ); |
| 875 | if( bClear ){ |
| 876 | db_multi_exec("DELETE FROM \"%w\";", zTab); |
| 877 | } |
| 878 | db_multi_exec( |
| 879 | "INSERT OR IGNORE INTO \"%w\"(rid,isCtrl)" |
| 880 | " SELECT fpid, 0 FROM forumpost WHERE froot=%d;", |
| 881 | zTab, froot |
| 882 | ); |
| 883 | |
| 884 | /* Find candidate control artifacts. Each one is verified before |
| 885 | ** being added, and candidates already in zTab are skipped, so that |
| 886 | ** when bClear is false, rows that were already in zTab are not |
| 887 | ** disturbed. */ |
| 888 | db_prepare(&q, |
| 889 | "SELECT srcid FROM tagxref" |
| 890 | " WHERE rid IN (SELECT fpid FROM forumpost WHERE froot=%d)" |
| 891 | " AND srcid>0 AND srcid!=rid" |
| 892 | " UNION " |
| 893 | "SELECT event.objid FROM event, forumpost, blob" |
| 894 | " WHERE forumpost.froot=%d" |
| 895 | " AND blob.rid=forumpost.fpid" |
| 896 | " AND event.type='g'" |
| 897 | " AND instr(event.comment, '['||substr(blob.uuid,1,12))>0" |
| 898 | " AND event.mtime >= forumpost.fmtime-0.01" |
| 899 | " AND event.mtime <= (SELECT max(mtime) FROM tagxref" |
| 900 | " WHERE rid=%d)", |
| 901 | froot, froot, froot |
| 902 | ); |
| 903 | while( db_step(&q)==SQLITE_ROW ){ |
| 904 | int rid = db_column_int(&q, 0); |
| 905 | Manifest *pCtrl; |
| 906 | Blob desc = BLOB_INITIALIZER; |
| 907 | int nMatch = 0; |
| 908 | int i; |
| 909 | if( db_exists("SELECT 1 FROM \"%w\" WHERE rid=%d", zTab, rid) ){ |
| 910 | continue; |
| 911 | } |
| 912 | pCtrl = manifest_get(rid, CFTYPE_CONTROL, 0); |
| 913 | for(i=0; pCtrl && i<pCtrl->nTag; i++){ |
| 914 | const char *zTag = pCtrl->aTag[i].zName; |
| 915 | const char *zVal = pCtrl->aTag[i].zValue; |
| 916 | const char *zTarget = pCtrl->aTag[i].zUuid; |
| 917 | int isCancel = zTag[0]=='-'; |
| 918 | if( zTarget==0 |
| 919 | || !db_exists("SELECT 1 FROM forumpost, blob" |
| 920 | " WHERE forumpost.froot=%d AND blob.rid=forumpost.fpid" |
| 921 | " AND blob.uuid=%Q", froot, zTarget) |
| 922 | ){ |
| 923 | continue; |
| 924 | } |
| 925 | nMatch++; |
| 926 | if( !bDesc ) break; |
| 927 | if( blob_size(&desc) ) blob_append(&desc, "; ", 2); |
| 928 | if( fossil_strcmp(&zTag[1], "closed")==0 ){ |
| 929 | blob_append(&desc, isCancel ? "reopen" : "close", -1); |
| 930 | }else if( fossil_strcmp(&zTag[1], "status")==0 ){ |
| 931 | if( isCancel || zVal==0 || zVal[0]==0 ){ |
| 932 | blob_append(&desc, "clear status of", -1); |
| 933 | }else{ |
| 934 | blob_appendf(&desc, "set status \"%h\" on", zVal); |
| 935 | } |
| 936 | }else if( zVal && zVal[0] ){ |
| 937 | blob_appendf(&desc, "tag %h=\"%h\" on", zTag, zVal); |
| 938 | }else{ |
| 939 | blob_appendf(&desc, "tag %h on", zTag); |
| 940 | } |
| 941 | blob_appendf(&desc, " post %z%S</a>", |
| 942 | href("%R/forumpost/%!S", zTarget), zTarget); |
| 943 | } |
| 944 | manifest_destroy(pCtrl); |
| 945 | if( nMatch ){ |
| 946 | db_multi_exec( |
| 947 | "INSERT INTO \"%w\"(rid,isCtrl,zDesc) VALUES(%d,1,%Q)", |
| 948 | zTab, rid, bDesc ? blob_str(&desc) : 0 |
| 949 | ); |
| 950 | } |
| 951 | blob_reset(&desc); |
| 952 | } |
| 953 | db_finalize(&q); |
| 954 | } |
| 955 | |
| 956 | /* |
| 957 | ** WEBPAGE: forumthreadhashlist |
| 958 | ** |
| 959 | ** Usage: /forumthreadhashlist/HASH-OF-ROOT |
| 960 | ** |
| 961 | ** This page (accessibly only to admins) shows a list of all artifacts |
| 962 | ** associated with a single forum thread, including control artifacts |
| 963 | ** that close or reopen posts or change the status of the thread. |
| 964 | ** An admin might copy/paste the list of hashes into the /shun page in |
| 965 | ** order to shun an entire thread. |
| 966 | */ |
| 967 | void forumthreadhashlist(void){ |
| 968 | int fpid; |
| 969 | int froot; |
| 970 | const char *zName = P("name"); |
| 971 | char *fuuid; |
| 972 | Stmt q; |
| 973 | |
| 974 | login_check_credentials(); |
| 975 | if( !g.perm.Admin ){ |
| @@ -868,19 +992,49 @@ | |
| 992 | webpage_notfound_error("Not a forum post: \"%s\"", zName); |
| 993 | } |
| 994 | fuuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", froot); |
| 995 | style_set_current_feature("forum"); |
| 996 | style_header("Artifacts Of Forum Thread"); |
| 997 | |
| 998 | forum_thread_artifacts("fthread", froot, 1, 1); |
| 999 | describe_artifacts("IN (SELECT rid FROM fthread)"); |
| 1000 | |
| 1001 | @ <h2> |
| 1002 | @ Artifacts associated with the forum thread |
| 1003 | @ <a href="%R/forumthread/%S(fuuid)">%S(fuuid)</a>:</h2> |
| 1004 | @ <table border="1" cellpadding="4" cellspacing="0"> |
| 1005 | @ <tr><th>Date<th>Hash<th>User<th>Description |
| 1006 | db_prepare(&q, |
| 1007 | "SELECT description.uuid," |
| 1008 | " datetime(coalesce(event.mtime,description.ctime))," |
| 1009 | " coalesce(event.euser,event.user)," |
| 1010 | " description.summary, fthread.zDesc" |
| 1011 | " FROM fthread JOIN description USING(rid)" |
| 1012 | " LEFT JOIN event ON event.objid=fthread.rid" |
| 1013 | " ORDER BY coalesce(event.mtime,description.ctime), fthread.rid" |
| 1014 | ); |
| 1015 | while( db_step(&q)==SQLITE_ROW ){ |
| 1016 | const char *zUuid = db_column_text(&q, 0); |
| 1017 | const char *zCtrlDesc = db_column_text(&q, 4); |
| 1018 | @ <tr><td>%h(db_column_text(&q,1))\ |
| 1019 | @ <td>%z(href("%R/artifact/%!S",zUuid))%S(zUuid)</a>\ |
| 1020 | @ <td>%h(db_column_text(&q,2))\ |
| 1021 | if( zCtrlDesc ){ |
| 1022 | @ <td>forum-tag: %s(zCtrlDesc)</tr> |
| 1023 | }else{ |
| 1024 | @ <td>%h(db_column_text(&q,3))</tr> |
| 1025 | } |
| 1026 | } |
| 1027 | @ </table> |
| 1028 | @ <h2>Artifact hashes, suitable for pasting into |
| 1029 | @ %z(href("%R/shun"))/shun</a>:</h2> |
| 1030 | @ <pre> |
| 1031 | db_reset(&q); |
| 1032 | while( db_step(&q)==SQLITE_ROW ){ |
| 1033 | @ %h(db_column_text(&q,0)) |
| 1034 | } |
| 1035 | db_finalize(&q); |
| 1036 | @ </pre> |
| 1037 | @ <hr> |
| 1038 | @ <h2>Related FORUMPOST Table Content</h2> |
| 1039 | @ <table border="1" cellpadding="4" cellspacing="0"> |
| 1040 | @ <tr><th>fpid<th>froot<th>fprev<th>firt<th>fmtime |
| @@ -1678,10 +1832,11 @@ | |
| 1832 | style_submenu_element("Hierarchical", "%R/%s/%s?t=h%s%s", g.zPath, zName, |
| 1833 | bUnf ? "&unf" : "", bHist ? "&hist" : ""); |
| 1834 | } |
| 1835 | style_submenu_checkbox("unf", "Unformatted", 0, 0); |
| 1836 | style_submenu_checkbox("hist", "History", 0, 0); |
| 1837 | style_submenu_element("Timeline", "%R/timeline?thread=%t", zName); |
| 1838 | if( g.perm.Admin ){ |
| 1839 | style_submenu_element("Artifacts", "%R/forumthreadhashlist/%t", zName); |
| 1840 | } |
| 1841 | |
| 1842 | /* Display the thread. */ |
| 1843 |
+70
-4
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1416,10 +1416,30 @@ | ||
| 1416 | 1416 | "SELECT mlink.mid FROM mlink, filename\n" |
| 1417 | 1417 | " WHERE mlink.fnid=filename.fnid\n" |
| 1418 | 1418 | " AND %s)", |
| 1419 | 1419 | glob_expr("filename.name", mprintf("\"%s\"", zChng))); |
| 1420 | 1420 | } |
| 1421 | +/* | |
| 1422 | +** An SQL expression that is the FPID of the forum post that is tagged | |
| 1423 | +** by the tag event (event.type='g') of the current row of the event | |
| 1424 | +** table, or NULL if that tag event does not tag a forum post. | |
| 1425 | +** | |
| 1426 | +** The target is found from the first "Edit [HASH|" in the event.comment | |
| 1427 | +** that manifest_crosslink() generates for each control artifact. HASH | |
| 1428 | +** is at least 12 characters, so a range lookup on the first 12 | |
| 1429 | +** characters, which can use the index on blob.uuid, is used to find | |
| 1430 | +** the tagged artifact. Only the first artifact tagged by each control | |
| 1431 | +** artifact is considered. | |
| 1432 | +*/ | |
| 1433 | +#define FORUM_TAG_TARGET_SQL \ | |
| 1434 | + "(SELECT ftb.rid FROM blob AS ftb" \ | |
| 1435 | + " WHERE instr(event.comment,'Edit [')>0" \ | |
| 1436 | + " AND ftb.uuid>=substr(event.comment,instr(event.comment,'Edit [')+6,12)" \ | |
| 1437 | + " AND ftb.uuid<substr(event.comment," \ | |
| 1438 | + "instr(event.comment,'Edit [')+6,12)||'g'" \ | |
| 1439 | + " AND EXISTS(SELECT 1 FROM forumpost WHERE fpid=ftb.rid))" | |
| 1440 | + | |
| 1421 | 1441 | static void addFileGlobDescription( |
| 1422 | 1442 | const char *zChng, /* The filename GLOB list */ |
| 1423 | 1443 | Blob *pDescription /* Result description */ |
| 1424 | 1444 | ){ |
| 1425 | 1445 | if( zChng==0 ) return; |
| @@ -1758,10 +1778,14 @@ | ||
| 1758 | 1778 | ** nowiki Do not show wiki associated with branch or tag |
| 1759 | 1779 | ** ms=MATCHSTYLE Set tag name match algorithm. One of "exact", "glob", |
| 1760 | 1780 | ** "like", or "regexp". |
| 1761 | 1781 | ** u=USER Only show items associated with USER |
| 1762 | 1782 | ** y=TYPE 'ci', 'w', 't', 'n', 'e', 'f', 'h', or 'all'. |
| 1783 | +** thread=POST Show the complete history of the forum thread that | |
| 1784 | +** contains POST, including all edits, replies, and | |
| 1785 | +** tags. POST is a hash prefix or timestamp for any | |
| 1786 | +** post, reply, or edit within the thread. | |
| 1763 | 1787 | ** status=NAME With y=f or y=h, show only forum posts or threads |
| 1764 | 1788 | ** whose thread has status NAME. See the |
| 1765 | 1789 | ** forum-statuses setting. |
| 1766 | 1790 | ** ss=VIEWSTYLE c: "Compact", v: "Verbose", m: "Modern", j: "Columnar", |
| 1767 | 1791 | ** x: "Classic". |
| @@ -1856,10 +1880,11 @@ | ||
| 1856 | 1880 | const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */ |
| 1857 | 1881 | const char *zYear = P("year"); /* Events for the year YYYY */ |
| 1858 | 1882 | const char *zNDays = P("days"); /* Show events over the previous N days */ |
| 1859 | 1883 | int nDays = 0; /* Numeric value for zNDays */ |
| 1860 | 1884 | const char *zChng = P("chng"); /* List of GLOBs for files that changed */ |
| 1885 | + const char *zThread = P("thread"); /* Show the forum thread holding this */ | |
| 1861 | 1886 | int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */ |
| 1862 | 1887 | int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */ |
| 1863 | 1888 | int forkOnly = PB("forks"); /* Show only forks and their children */ |
| 1864 | 1889 | int bisectLocal = PB("bisect"); /* Show the check-ins of the bisect */ |
| 1865 | 1890 | const char *zBisect = P("bid"); /* Bisect description */ |
| @@ -2257,10 +2282,37 @@ | ||
| 2257 | 2282 | to_rid = from_rid; |
| 2258 | 2283 | blob_appendf(&desc, "There is no path from %h %s to %h.<br>Instead: ", |
| 2259 | 2284 | P("from"), from_to_mode==1 ? "forward" : "back", zTo); |
| 2260 | 2285 | } |
| 2261 | 2286 | } |
| 2287 | + if( zThread && g.perm.RdForum ){ | |
| 2288 | + /* If thread= is present, show every post, edit, reply, and tag | |
| 2289 | + ** associated with the forum thread that contains the post identified | |
| 2290 | + ** by thread=. Other parameters except vfx= are ignored. */ | |
| 2291 | + int fpid = symbolic_name_to_rid(zThread, "f"); | |
| 2292 | + int froot = 0; | |
| 2293 | + if( fpid>0 ){ | |
| 2294 | + froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); | |
| 2295 | + } | |
| 2296 | + if( froot==0 ){ | |
| 2297 | + blob_appendf(&desc, "No such forum post: \"%h\"", zThread); | |
| 2298 | + }else{ | |
| 2299 | + char *zUuid; | |
| 2300 | + int n; | |
| 2301 | + forum_thread_artifacts("fthread", froot, 1, 0); | |
| 2302 | + blob_append_sql(&sql, " AND event.objid IN (SELECT rid FROM fthread)"); | |
| 2303 | + db_multi_exec("%s", blob_sql_text(&sql)); | |
| 2304 | + if( useDividers && !selectedRid ) selectedRid = fpid; | |
| 2305 | + n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div'"); | |
| 2306 | + zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", froot); | |
| 2307 | + blob_appendf(&desc, "%d event%s in the history of forum thread %z%S</a>", | |
| 2308 | + n, n==1 ? "" : "s", | |
| 2309 | + href("%R/forumthread/%!S", zUuid), zUuid); | |
| 2310 | + fossil_free(zUuid); | |
| 2311 | + } | |
| 2312 | + style_submenu_checkbox("vfx", "Content", 0, 0); | |
| 2313 | + }else | |
| 2262 | 2314 | if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){ |
| 2263 | 2315 | /* If from= and to= are present, display all nodes on a path connecting |
| 2264 | 2316 | ** the two */ |
| 2265 | 2317 | PathNode *p = 0; |
| 2266 | 2318 | const char *zFrom = 0; |
| @@ -3040,10 +3092,15 @@ | ||
| 3040 | 3092 | blob_append_sql(&cond, |
| 3041 | 3093 | " AND event.type='t' AND event.comment GLOB 'New ticket*'"); |
| 3042 | 3094 | }else if( zType[0]=='h' ){ |
| 3043 | 3095 | blob_append_sql(&cond, |
| 3044 | 3096 | " AND event.type='f' AND event.comment GLOB 'Post:*'"); |
| 3097 | + }else if( zType[0]=='f' ){ | |
| 3098 | + /* Forum posts plus tag events that tag forum posts */ | |
| 3099 | + blob_append_sql(&cond, | |
| 3100 | + " AND (event.type='f' OR (event.type='g'" | |
| 3101 | + " AND " FORUM_TAG_TARGET_SQL " IS NOT NULL))"); | |
| 3045 | 3102 | }else{ |
| 3046 | 3103 | blob_append_sql(&cond, " AND event.type=%Q", zType); |
| 3047 | 3104 | } |
| 3048 | 3105 | if( zType[0]=='c' ){ |
| 3049 | 3106 | zEType = "check-in"; |
| @@ -3056,22 +3113,31 @@ | ||
| 3056 | 3113 | }else if( zType[0]=='e' ){ |
| 3057 | 3114 | zEType = "technical note"; |
| 3058 | 3115 | }else if( zType[0]=='g' ){ |
| 3059 | 3116 | zEType = "tag"; |
| 3060 | 3117 | }else if( zType[0]=='f' ){ |
| 3061 | - zEType = "forum post"; | |
| 3118 | + zEType = "forum event"; | |
| 3062 | 3119 | }else if( zType[0]=='h' ){ |
| 3063 | 3120 | zEType = "new forum thread"; |
| 3064 | 3121 | tmFlags |= TIMELINE_NOPOST; |
| 3065 | 3122 | } |
| 3066 | 3123 | if( (zType[0]=='f' || zType[0]=='h') |
| 3067 | 3124 | && forum_status_match_setup(P("status")) |
| 3068 | 3125 | ){ |
| 3069 | 3126 | zStatus = P("status"); |
| 3070 | - blob_append_sql(&cond, | |
| 3071 | - " AND status_match((SELECT froot FROM forumpost" | |
| 3072 | - " WHERE fpid=event.objid))"); | |
| 3127 | + if( zType[0]=='f' ){ | |
| 3128 | + /* A tag event matches the status of the thread it tags */ | |
| 3129 | + blob_append_sql(&cond, | |
| 3130 | + " AND status_match((SELECT froot FROM forumpost" | |
| 3131 | + " WHERE fpid=CASE WHEN event.type='g'" | |
| 3132 | + " THEN " FORUM_TAG_TARGET_SQL | |
| 3133 | + " ELSE event.objid END))"); | |
| 3134 | + }else{ | |
| 3135 | + blob_append_sql(&cond, | |
| 3136 | + " AND status_match((SELECT froot FROM forumpost" | |
| 3137 | + " WHERE fpid=event.objid))"); | |
| 3138 | + } | |
| 3073 | 3139 | } |
| 3074 | 3140 | } |
| 3075 | 3141 | if( zUser ){ |
| 3076 | 3142 | int n = db_int(0,"SELECT count(*) FROM event" |
| 3077 | 3143 | " WHERE user=%Q OR euser=%Q", zUser, zUser); |
| 3078 | 3144 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1416,10 +1416,30 @@ | |
| 1416 | "SELECT mlink.mid FROM mlink, filename\n" |
| 1417 | " WHERE mlink.fnid=filename.fnid\n" |
| 1418 | " AND %s)", |
| 1419 | glob_expr("filename.name", mprintf("\"%s\"", zChng))); |
| 1420 | } |
| 1421 | static void addFileGlobDescription( |
| 1422 | const char *zChng, /* The filename GLOB list */ |
| 1423 | Blob *pDescription /* Result description */ |
| 1424 | ){ |
| 1425 | if( zChng==0 ) return; |
| @@ -1758,10 +1778,14 @@ | |
| 1758 | ** nowiki Do not show wiki associated with branch or tag |
| 1759 | ** ms=MATCHSTYLE Set tag name match algorithm. One of "exact", "glob", |
| 1760 | ** "like", or "regexp". |
| 1761 | ** u=USER Only show items associated with USER |
| 1762 | ** y=TYPE 'ci', 'w', 't', 'n', 'e', 'f', 'h', or 'all'. |
| 1763 | ** status=NAME With y=f or y=h, show only forum posts or threads |
| 1764 | ** whose thread has status NAME. See the |
| 1765 | ** forum-statuses setting. |
| 1766 | ** ss=VIEWSTYLE c: "Compact", v: "Verbose", m: "Modern", j: "Columnar", |
| 1767 | ** x: "Classic". |
| @@ -1856,10 +1880,11 @@ | |
| 1856 | const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */ |
| 1857 | const char *zYear = P("year"); /* Events for the year YYYY */ |
| 1858 | const char *zNDays = P("days"); /* Show events over the previous N days */ |
| 1859 | int nDays = 0; /* Numeric value for zNDays */ |
| 1860 | const char *zChng = P("chng"); /* List of GLOBs for files that changed */ |
| 1861 | int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */ |
| 1862 | int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */ |
| 1863 | int forkOnly = PB("forks"); /* Show only forks and their children */ |
| 1864 | int bisectLocal = PB("bisect"); /* Show the check-ins of the bisect */ |
| 1865 | const char *zBisect = P("bid"); /* Bisect description */ |
| @@ -2257,10 +2282,37 @@ | |
| 2257 | to_rid = from_rid; |
| 2258 | blob_appendf(&desc, "There is no path from %h %s to %h.<br>Instead: ", |
| 2259 | P("from"), from_to_mode==1 ? "forward" : "back", zTo); |
| 2260 | } |
| 2261 | } |
| 2262 | if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){ |
| 2263 | /* If from= and to= are present, display all nodes on a path connecting |
| 2264 | ** the two */ |
| 2265 | PathNode *p = 0; |
| 2266 | const char *zFrom = 0; |
| @@ -3040,10 +3092,15 @@ | |
| 3040 | blob_append_sql(&cond, |
| 3041 | " AND event.type='t' AND event.comment GLOB 'New ticket*'"); |
| 3042 | }else if( zType[0]=='h' ){ |
| 3043 | blob_append_sql(&cond, |
| 3044 | " AND event.type='f' AND event.comment GLOB 'Post:*'"); |
| 3045 | }else{ |
| 3046 | blob_append_sql(&cond, " AND event.type=%Q", zType); |
| 3047 | } |
| 3048 | if( zType[0]=='c' ){ |
| 3049 | zEType = "check-in"; |
| @@ -3056,22 +3113,31 @@ | |
| 3056 | }else if( zType[0]=='e' ){ |
| 3057 | zEType = "technical note"; |
| 3058 | }else if( zType[0]=='g' ){ |
| 3059 | zEType = "tag"; |
| 3060 | }else if( zType[0]=='f' ){ |
| 3061 | zEType = "forum post"; |
| 3062 | }else if( zType[0]=='h' ){ |
| 3063 | zEType = "new forum thread"; |
| 3064 | tmFlags |= TIMELINE_NOPOST; |
| 3065 | } |
| 3066 | if( (zType[0]=='f' || zType[0]=='h') |
| 3067 | && forum_status_match_setup(P("status")) |
| 3068 | ){ |
| 3069 | zStatus = P("status"); |
| 3070 | blob_append_sql(&cond, |
| 3071 | " AND status_match((SELECT froot FROM forumpost" |
| 3072 | " WHERE fpid=event.objid))"); |
| 3073 | } |
| 3074 | } |
| 3075 | if( zUser ){ |
| 3076 | int n = db_int(0,"SELECT count(*) FROM event" |
| 3077 | " WHERE user=%Q OR euser=%Q", zUser, zUser); |
| 3078 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1416,10 +1416,30 @@ | |
| 1416 | "SELECT mlink.mid FROM mlink, filename\n" |
| 1417 | " WHERE mlink.fnid=filename.fnid\n" |
| 1418 | " AND %s)", |
| 1419 | glob_expr("filename.name", mprintf("\"%s\"", zChng))); |
| 1420 | } |
| 1421 | /* |
| 1422 | ** An SQL expression that is the FPID of the forum post that is tagged |
| 1423 | ** by the tag event (event.type='g') of the current row of the event |
| 1424 | ** table, or NULL if that tag event does not tag a forum post. |
| 1425 | ** |
| 1426 | ** The target is found from the first "Edit [HASH|" in the event.comment |
| 1427 | ** that manifest_crosslink() generates for each control artifact. HASH |
| 1428 | ** is at least 12 characters, so a range lookup on the first 12 |
| 1429 | ** characters, which can use the index on blob.uuid, is used to find |
| 1430 | ** the tagged artifact. Only the first artifact tagged by each control |
| 1431 | ** artifact is considered. |
| 1432 | */ |
| 1433 | #define FORUM_TAG_TARGET_SQL \ |
| 1434 | "(SELECT ftb.rid FROM blob AS ftb" \ |
| 1435 | " WHERE instr(event.comment,'Edit [')>0" \ |
| 1436 | " AND ftb.uuid>=substr(event.comment,instr(event.comment,'Edit [')+6,12)" \ |
| 1437 | " AND ftb.uuid<substr(event.comment," \ |
| 1438 | "instr(event.comment,'Edit [')+6,12)||'g'" \ |
| 1439 | " AND EXISTS(SELECT 1 FROM forumpost WHERE fpid=ftb.rid))" |
| 1440 | |
| 1441 | static void addFileGlobDescription( |
| 1442 | const char *zChng, /* The filename GLOB list */ |
| 1443 | Blob *pDescription /* Result description */ |
| 1444 | ){ |
| 1445 | if( zChng==0 ) return; |
| @@ -1758,10 +1778,14 @@ | |
| 1778 | ** nowiki Do not show wiki associated with branch or tag |
| 1779 | ** ms=MATCHSTYLE Set tag name match algorithm. One of "exact", "glob", |
| 1780 | ** "like", or "regexp". |
| 1781 | ** u=USER Only show items associated with USER |
| 1782 | ** y=TYPE 'ci', 'w', 't', 'n', 'e', 'f', 'h', or 'all'. |
| 1783 | ** thread=POST Show the complete history of the forum thread that |
| 1784 | ** contains POST, including all edits, replies, and |
| 1785 | ** tags. POST is a hash prefix or timestamp for any |
| 1786 | ** post, reply, or edit within the thread. |
| 1787 | ** status=NAME With y=f or y=h, show only forum posts or threads |
| 1788 | ** whose thread has status NAME. See the |
| 1789 | ** forum-statuses setting. |
| 1790 | ** ss=VIEWSTYLE c: "Compact", v: "Verbose", m: "Modern", j: "Columnar", |
| 1791 | ** x: "Classic". |
| @@ -1856,10 +1880,11 @@ | |
| 1880 | const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */ |
| 1881 | const char *zYear = P("year"); /* Events for the year YYYY */ |
| 1882 | const char *zNDays = P("days"); /* Show events over the previous N days */ |
| 1883 | int nDays = 0; /* Numeric value for zNDays */ |
| 1884 | const char *zChng = P("chng"); /* List of GLOBs for files that changed */ |
| 1885 | const char *zThread = P("thread"); /* Show the forum thread holding this */ |
| 1886 | int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */ |
| 1887 | int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */ |
| 1888 | int forkOnly = PB("forks"); /* Show only forks and their children */ |
| 1889 | int bisectLocal = PB("bisect"); /* Show the check-ins of the bisect */ |
| 1890 | const char *zBisect = P("bid"); /* Bisect description */ |
| @@ -2257,10 +2282,37 @@ | |
| 2282 | to_rid = from_rid; |
| 2283 | blob_appendf(&desc, "There is no path from %h %s to %h.<br>Instead: ", |
| 2284 | P("from"), from_to_mode==1 ? "forward" : "back", zTo); |
| 2285 | } |
| 2286 | } |
| 2287 | if( zThread && g.perm.RdForum ){ |
| 2288 | /* If thread= is present, show every post, edit, reply, and tag |
| 2289 | ** associated with the forum thread that contains the post identified |
| 2290 | ** by thread=. Other parameters except vfx= are ignored. */ |
| 2291 | int fpid = symbolic_name_to_rid(zThread, "f"); |
| 2292 | int froot = 0; |
| 2293 | if( fpid>0 ){ |
| 2294 | froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); |
| 2295 | } |
| 2296 | if( froot==0 ){ |
| 2297 | blob_appendf(&desc, "No such forum post: \"%h\"", zThread); |
| 2298 | }else{ |
| 2299 | char *zUuid; |
| 2300 | int n; |
| 2301 | forum_thread_artifacts("fthread", froot, 1, 0); |
| 2302 | blob_append_sql(&sql, " AND event.objid IN (SELECT rid FROM fthread)"); |
| 2303 | db_multi_exec("%s", blob_sql_text(&sql)); |
| 2304 | if( useDividers && !selectedRid ) selectedRid = fpid; |
| 2305 | n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div'"); |
| 2306 | zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", froot); |
| 2307 | blob_appendf(&desc, "%d event%s in the history of forum thread %z%S</a>", |
| 2308 | n, n==1 ? "" : "s", |
| 2309 | href("%R/forumthread/%!S", zUuid), zUuid); |
| 2310 | fossil_free(zUuid); |
| 2311 | } |
| 2312 | style_submenu_checkbox("vfx", "Content", 0, 0); |
| 2313 | }else |
| 2314 | if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){ |
| 2315 | /* If from= and to= are present, display all nodes on a path connecting |
| 2316 | ** the two */ |
| 2317 | PathNode *p = 0; |
| 2318 | const char *zFrom = 0; |
| @@ -3040,10 +3092,15 @@ | |
| 3092 | blob_append_sql(&cond, |
| 3093 | " AND event.type='t' AND event.comment GLOB 'New ticket*'"); |
| 3094 | }else if( zType[0]=='h' ){ |
| 3095 | blob_append_sql(&cond, |
| 3096 | " AND event.type='f' AND event.comment GLOB 'Post:*'"); |
| 3097 | }else if( zType[0]=='f' ){ |
| 3098 | /* Forum posts plus tag events that tag forum posts */ |
| 3099 | blob_append_sql(&cond, |
| 3100 | " AND (event.type='f' OR (event.type='g'" |
| 3101 | " AND " FORUM_TAG_TARGET_SQL " IS NOT NULL))"); |
| 3102 | }else{ |
| 3103 | blob_append_sql(&cond, " AND event.type=%Q", zType); |
| 3104 | } |
| 3105 | if( zType[0]=='c' ){ |
| 3106 | zEType = "check-in"; |
| @@ -3056,22 +3113,31 @@ | |
| 3113 | }else if( zType[0]=='e' ){ |
| 3114 | zEType = "technical note"; |
| 3115 | }else if( zType[0]=='g' ){ |
| 3116 | zEType = "tag"; |
| 3117 | }else if( zType[0]=='f' ){ |
| 3118 | zEType = "forum event"; |
| 3119 | }else if( zType[0]=='h' ){ |
| 3120 | zEType = "new forum thread"; |
| 3121 | tmFlags |= TIMELINE_NOPOST; |
| 3122 | } |
| 3123 | if( (zType[0]=='f' || zType[0]=='h') |
| 3124 | && forum_status_match_setup(P("status")) |
| 3125 | ){ |
| 3126 | zStatus = P("status"); |
| 3127 | if( zType[0]=='f' ){ |
| 3128 | /* A tag event matches the status of the thread it tags */ |
| 3129 | blob_append_sql(&cond, |
| 3130 | " AND status_match((SELECT froot FROM forumpost" |
| 3131 | " WHERE fpid=CASE WHEN event.type='g'" |
| 3132 | " THEN " FORUM_TAG_TARGET_SQL |
| 3133 | " ELSE event.objid END))"); |
| 3134 | }else{ |
| 3135 | blob_append_sql(&cond, |
| 3136 | " AND status_match((SELECT froot FROM forumpost" |
| 3137 | " WHERE fpid=event.objid))"); |
| 3138 | } |
| 3139 | } |
| 3140 | } |
| 3141 | if( zUser ){ |
| 3142 | int n = db_int(0,"SELECT count(*) FROM event" |
| 3143 | " WHERE user=%Q OR euser=%Q", zUser, zUser); |
| 3144 |