Check-in [39f671788e]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Forum: threads with new submissions order on top now. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
39f671788e439c8d9a51f7e4c61b2660 |
User & Date: | mario 2014-12-29 14:08:33 |
Context
2014-12-29
| ||
14:10 | Detect other Twitter URL variations. check-in: 1c0b6ac0e7 user: mario tags: trunk | |
14:08 | Forum: threads with new submissions order on top now. check-in: 39f671788e user: mario tags: trunk | |
2014-12-23
| ||
05:11 | Prevent recollapsing of forum entries when editing within the reply/form fields. check-in: f8bc06e188 user: mario tags: trunk | |
Changes
Changes to lib/forum.php.
1 2 3 4 5 6 | <?php /** * api: php * type: handler * title: Follow The Thread * description: Straightforward threaded discussion forum | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?php /** * api: php * type: handler * title: Follow The Thread * description: Straightforward threaded discussion forum * version: 0.3 * category: discussion * depends: HTMLPurifier, input * config: * <var name="forum_cfg[categories]" type="list" default="discussion,documentation" help="Comma-separated list of thread classifiers"/> * * * Implements a minimalistic web forum. * Primary goals are: * → Threaded discussions in place of bulletin board blabber. |
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | * [excerpt] TEXT, * [author] VARCHAR (0, 80), * [miniature] TEXT, * [t_published] INT NOT NULL, * [edit_token] VARCHAR (16, 64) * * Templating * Behaviour * Configuration * * * */ /** | > > > > > > > > > > > > > > > > > | 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 | * [excerpt] TEXT, * [author] VARCHAR (0, 80), * [miniature] TEXT, * [t_published] INT NOT NULL, * [edit_token] VARCHAR (16, 64) * * Templating * → Requires a template wrapper with <ul class=forum> prepared. * → Index page must provide a quirky switch block, to dispatch depending * on $_GET[name] function (one of post, edit, submit). * → But just $forum->index() for output. * → forum_entry.php for rendering a table entry. * → forum_submit_form.php for post editing. * * Behaviour * → Forum index is grouped by threads. Threads with new additions go on top now. * But within threads the oldest entries come first. * → Editing token is valid for 48 hours. * → Admin settings must be inported manually from main application (->$is_admin). * * Javascript * → AJAX is mainly used for submission to divert spambots. * → Posts are folded to an excerpt, until clicked. * * Configuration * → Basically just the categories are configurable. * * * */ /** |
︙ | ︙ | |||
78 79 80 81 82 83 84 | * Show forum listing * */ function index($page=0) { // Fetch thread groups (attached to root gid=0) $entries = db(" | > | | | < < < < | | > > > > | | > | 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 120 121 122 | * Show forum listing * */ function index($page=0) { // Fetch thread groups (attached to root gid=0) $entries = db(" WITH grouped AS (SELECT gid, (MAX(t_published) + gid/1000) AS gid_group FROM forum GROUP BY gid LIMIT 50 OFFSET ?*50 ) SELECT * FROM forum LEFT JOIN grouped ON forum.gid=grouped.gid ORDER BY gid_group DESC, forum.gid DESC, t_published ASC; ", $page); // Iterate over groups $last = 0; $group = array(); foreach ($entries as $e) { if ($e["gid"] != $last) { $this->show_thread($group); |
︙ | ︙ |