Fossil

Check-in [dbd96b2c]
Login

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

Overview
Comment:Improved title on on the /forum page.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: dbd96b2c74520c21d39e31a96c07b287ef4d4e24c17b9b5ce3a4a937932178af
User & Date: drh 2018-08-15 20:50:07.237
Context
2018-08-15
21:28
Do not issue a warning about duplicate branch names when doing a --private check-in. ... (check-in: d7e45aae user: drh tags: trunk)
20:50
Improved title on on the /forum page. ... (check-in: dbd96b2c user: drh tags: trunk)
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)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/forum.c.
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
972
973
974
975
976

977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993

994



995
996
  if( search_screen(SRCH_FORUM, 0) ){
    style_submenu_element("Recent Threads","%R/forum");
    style_footer();
    return;
  }
  iLimit = atoi(PD("n","25"));
  iOfst = atoi(PD("x","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+1, iOfst
    );
    iCnt = 0;
    while( db_step(&q)==SQLITE_ROW ){
      char *zAge = 0;
      char *zDuration = 0;
      int nMsg = db_column_int(&q, 2);
      const char *zUuid = db_column_text(&q, 3);
      const char *zTitle = db_column_text(&q, 4);

      if( iCnt==0 && iOfst>0 ){







        if( iOfst>iLimit ){
          @ <tr><td colspan="3">\
          @ %z(href("%R/forum?x=%d&n=%d",iOfst-iLimit,iLimit))\
          @ &uarr; Newer...</a></td></tr>
        }else{
          @ <tr><td colspan="3">%z(href("%R/forum?n=%d",iLimit))\
          @ &uarr; Newer...</a></td></tr>

        }
      }
      iCnt++;
      if( iCnt>iLimit ){
        @ <tr><td colspan="3">\
        @ %z(href("%R/forum?x=%d&n=%d",iOfst+iLimit,iLimit))\
        @ &darr; Older...</a></td></tr>

        break;
      }
      zAge = human_readable_age(db_column_double(&q,0));
      @ <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{
        zDuration = human_readable_age(db_column_double(&q,1));
        @ <td>%d(nMsg) posts spanning %h(zDuration)</td>
      }
      @ </tr>
      fossil_free(zAge);
      fossil_free(zDuration);
    }
    db_finalize(&q);
  }

  @ </table></div>



  style_footer();
}







|
<

|













<






>
|
>
>
>
>
>
>
>
|
|
|
|
|
|
|
>







>


<














>
|
>
>
>


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
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986

987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
  if( search_screen(SRCH_FORUM, 0) ){
    style_submenu_element("Recent Threads","%R/forum");
    style_footer();
    return;
  }
  iLimit = atoi(PD("n","25"));
  iOfst = atoi(PD("x","0"));
  iCnt = 0;

  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+1, iOfst
    );

    while( db_step(&q)==SQLITE_ROW ){
      char *zAge = 0;
      char *zDuration = 0;
      int nMsg = db_column_int(&q, 2);
      const char *zUuid = db_column_text(&q, 3);
      const char *zTitle = db_column_text(&q, 4);
      zAge = human_readable_age(db_column_double(&q,0));
      if( iCnt==0 ){
        if( iOfst>0 ){
          @ <h1>Threads at least %s(zAge) old</h1>
        }else{
          @ <h1>Most recent threads</h1>
        }
        @ <div class='fileage'><table width="100%%">
        if( iOfst>0 ){
          if( iOfst>iLimit ){
            @ <tr><td colspan="3">\
            @ %z(href("%R/forum?x=%d&n=%d",iOfst-iLimit,iLimit))\
            @ &uarr; Newer...</a></td></tr>
          }else{
            @ <tr><td colspan="3">%z(href("%R/forum?n=%d",iLimit))\
            @ &uarr; Newer...</a></td></tr>
          }
        }
      }
      iCnt++;
      if( iCnt>iLimit ){
        @ <tr><td colspan="3">\
        @ %z(href("%R/forum?x=%d&n=%d",iOfst+iLimit,iLimit))\
        @ &darr; Older...</a></td></tr>
        fossil_free(zAge);
        break;
      }

      @ <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{
        zDuration = human_readable_age(db_column_double(&q,1));
        @ <td>%d(nMsg) posts spanning %h(zDuration)</td>
      }
      @ </tr>
      fossil_free(zAge);
      fossil_free(zDuration);
    }
    db_finalize(&q);
  }
  if( iCnt>0 ){
    @ </table></div>
  }else{
    @ <h1>No forum posts found</h1>
  }
  style_footer();
}