Fossil

Check-in [a50dfe6f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:On the "Recent Threads" page (/forum) show the number of messages and the duration of each thread.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:a50dfe6fae55b58aa93982a92a037c734f70a5cdb84fd554a9329cb533ac2196
User & Date: drh 2018-08-15 20:17:24
Context
2018-08-15
20:41
On the main /forum screen, provide the new n= and x= query parameters to enable access to older threads. check-in: aff20904 user: drh tags: trunk
20:17
On the "Recent Threads" page (/forum) show the number of messages and the duration of each thread. check-in: a50dfe6f user: drh tags: trunk
18:14
Improvements to self-register (the /register page) so that it works correctly for users how are already subscribers and enter the subscriber email. check-in: 4c43f2cd user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/forum.c.

930
931
932
933
934
935
936

937
938



939
940


941
942
943
944
945
946


947
948
949
950





951
952

953
954
955
956
957
958
  }
  iLimit = 50;
  iOfst = 0;
  @ <h1>Recent Threads</h1>
  @ <div class='fileage'><table width="100%%">
  if( db_table_exists("repository","forumpost") ){
    db_prepare(&q,

       "SELECT julianday('now') - max(fmtime),"
       "       (SELECT uuid FROM blob WHERE rid=fpid),"



       "       (SELECT substr(comment,instr(comment,':')+2)"
       "          FROM event WHERE objid=fpid)"


       "  FROM forumpost"
       " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d",
       iLimit, iOfst
    );
    while( db_step(&q)==SQLITE_ROW ){
      char *zAge = human_readable_age(db_column_double(&q,0));


      const char *zUuid = db_column_text(&q, 1);
      const char *zTitle = db_column_text(&q, 2);
      @ <tr><td>%h(zAge) ago</td>
      @ <td>%z(href("%R/forumpost/%S",zUuid))%h(zTitle)</a>





      @ </tr>
      fossil_free(zAge);

    }
    db_finalize(&q);
  }
  @ </table></div>
  style_footer();
}







>
|
<
>
>
>
|
|
>
>
|
|
|



>
>
|
|

|
>
>
>
>
>


>






930
931
932
933
934
935
936
937
938

939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
  }
  iLimit = 50;
  iOfst = 0;
  @ <h1>Recent Threads</h1>
  @ <div class='fileage'><table width="100%%">
  if( db_table_exists("repository","forumpost") ){
    db_prepare(&q,
      "SELECT"
      "  julianday('now') - max(fmtime) AS a,"                       /* 0 */

      "  max(fmtime) - min(fmtime) AS b,"                            /* 1 */
      "  sum(fprev IS NULL) AS c,"                                   /* 2 */
      "  (SELECT substr(uuid,1,10) FROM blob WHERE rid=froot),"      /* 3 */
      "  (SELECT substr(comment,instr(comment,':')+2)"               /* 4 */
      "     FROM event WHERE objid=(SELECT fpid FROM forumpost AS y"
      "                              WHERE y.froot=x.froot"
      "                              ORDER BY fmtime DESC LIMIT 1))"
      " FROM forumpost AS x"
      " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d;",
      iLimit, iOfst
    );
    while( db_step(&q)==SQLITE_ROW ){
      char *zAge = human_readable_age(db_column_double(&q,0));
      char *zDuration = human_readable_age(db_column_double(&q,1));
      int nMsg = db_column_int(&q, 2);
      const char *zUuid = db_column_text(&q, 3);
      const char *zTitle = db_column_text(&q, 4);
      @ <tr><td>%h(zAge) ago</td>
      @ <td>%z(href("%R/forumpost/%S",zUuid))%h(zTitle)</a></td>
      if( nMsg<2 ){
        @ <td>no replies</td>
      }else{
        @ <td>%d(nMsg) posts spanning %h(zDuration)</td>
      }
      @ </tr>
      fossil_free(zAge);
      fossil_free(zDuration);
    }
    db_finalize(&q);
  }
  @ </table></div>
  style_footer();
}