https://redmine.lighttpd.net/https://redmine.lighttpd.net/favicon.ico?13667327412007-12-05T09:22:39Zlighty labsLighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=15012007-12-05T09:22:39ZAnonymous
<ul></ul><p>I second that!</p>
<p>-- nixin</p> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=15022007-12-30T14:35:13Zmcosby
<ul></ul><p>I've created a patch against lighttpd 1.4.18 for this</p> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=15032007-12-31T09:13:54ZAnonymous
<ul></ul><p>The patch seems to work perfectly. Thanks a lot !</p>
<p>Please consider including it as default for the future versions of lighty.</p>
<p>-- wolfy</p> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=50322008-10-26T17:28:05Zicy
<ul><li><strong>Priority</strong> changed from <i>High</i> to <i>Normal</i></li><li><strong>Patch available</strong> set to <i>No</i></li></ul> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=50372008-10-26T19:17:39Zicy
<ul><li><strong>Patch available</strong> changed from <i>No</i> to <i>Yes</i></li></ul> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=68622010-04-05T06:59:02Zmcosby
<ul><li><strong>File</strong> <a href="/attachments/1121">dirlisting-1.4.26.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/1121/dirlisting-1.4.26.patch">dirlisting-1.4.26.patch</a> added</li></ul><p>Patch updated for 1.4.26</p> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=68672010-04-06T11:18:55Zstbuehler
<ul><li><strong>Assignee</strong> deleted (<del><i>jan</i></del>)</li><li><strong>Missing in 1.5.x</strong> set to <i>No</i></li></ul><p>I'd prefer client side sorting via javascript; see our dirlist module for 2.0 (<a class="external" href="http://cgit.lighttpd.net/lighttpd/sandbox/plain/src/modules/mod_dirlist.c">http://cgit.lighttpd.net/lighttpd/sandbox/plain/src/modules/mod_dirlist.c</a>, demo here: <a class="external" href="http://download.lighttpd.net/lighttpd/">http://download.lighttpd.net/lighttpd/</a>).</p> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=76622011-11-16T17:33:21Zghost_1987
<ul></ul><p>stbuehler wrote:</p>
<blockquote>
<p>I'd prefer client side sorting via javascript; see our dirlist module for 2.0 (<a class="external" href="http://cgit.lighttpd.net/lighttpd/sandbox/plain/src/modules/mod_dirlist.c">http://cgit.lighttpd.net/lighttpd/sandbox/plain/src/modules/mod_dirlist.c</a>, demo here: <a class="external" href="http://download.lighttpd.net/lighttpd/">http://download.lighttpd.net/lighttpd/</a>).</p>
</blockquote>
<p>this does not work on IE8 and older</p>
<p>please consider adding sorting feature as provided by the patch</p> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=94482016-04-22T05:34:35Zgstrauss
<ul></ul><p>FYI: IE 8 is no longer supported on mainstream OS, so a client-side sort in javascript is now a more reasonable solution.<br /><a class="external" href="https://support.microsoft.com/en-us/lifecycle/search?sort=PN&alpha=internet%20explorer">https://support.microsoft.com/en-us/lifecycle/search?sort=PN&alpha=internet%20explorer</a><br /><a class="external" href="https://support.microsoft.com/en-us/lifecycle#gp/Microsoft-Internet-Explorer">https://support.microsoft.com/en-us/lifecycle#gp/Microsoft-Internet-Explorer</a></p> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=94502016-04-22T05:36:48Zgstrauss
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/2315">Feature #2315</a>: dir-listing.external-js</i> added</li></ul> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=104032016-08-11T04:25:21Zgstrauss
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Patch Pending</i></li><li><strong>Target version</strong> set to <i>1.4.42</i></li></ul> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=104042016-08-11T04:30:05Zgstrauss
<ul><li><strong>Status</strong> changed from <i>Patch Pending</i> to <i>Fixed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Applied in changeset <a class="changeset" title="[mod_dirlisting] js column sort for dirlist table (fixes #613, fixes #2315) copied javascript fr..." href="https://redmine.lighttpd.net/projects/lighttpd/repository/14/revisions/cfa3d27fc3f6c62350ea12f52a95e1c54ee547b7">cfa3d27fc3f6c62350ea12f52a95e1c54ee547b7</a>.</p> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=132322022-05-17T18:56:34Zdennisn
<ul><li><strong>File</strong> <a href="/attachments/2189">dirlisting-1.4.64_den1.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/2189/dirlisting-1.4.64_den1.patch">dirlisting-1.4.64_den1.patch</a> added</li></ul><p>Please reopen. Javascript-only sorting is unacceptable. (I'm hoping for the javascript-cancer that has infected websites to be cured (eradicated) soon.) At the moment, many great non-javascript browsers are unable to sort.</p>
<p>I've attached a (probably clumsily and recklessly) updated version of this original patch, that compiles against 1.4.64. It seems to work great so far.</p> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=132352022-05-18T04:17:23Zgstrauss
<ul><li><strong>ASK QUESTIONS IN Forums</strong> set to <i>No</i></li></ul><blockquote>
<p>I've attached a (probably clumsily and recklessly) updated version of this original patch, that compiles against 1.4.64. It seems to work great so far.</p>
</blockquote>
<p>Reckless is an apt description for your patch. You modified the structure in plugin.h which affects <strong>ALL</strong> lighttpd plugins. That is completely unnecessary even for what you think you want to do, and there is no way that your patch will be accepted as-is since it requires updating all lighttpd plugins. I am surprised that other plugins are not crashing with your change. They almost certainly should be generating worrisome compiler warnings, if not errors. Also, I don't see where the <code>sort</code> and <code>sort_dir</code> arguments are assigned to be passed in the patch that requires modifying plugin.h or subrequest or subrequest_start. <strong>Any proposed changes to mod_dirlisting.c should be self-contained in mod_dirlisting.c.</strong></p>
<p>All that said, why should (a cleaned up version of) your patch be accepted into lighttpd? If lighttpd mod_dirlisting does not meet your needs, why don't you write your own CGI script to do so, e.g. <code>/index.py</code> run by <a class="wiki-page" href="https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModIndexfile">mod_indexfile</a> and <a class="wiki-page" href="https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModCGI">mod_cgi</a>. Alternatively, write you own "mod_dirlisting" by extending <a class="wiki-page" href="https://redmine.lighttpd.net/projects/lighttpd/wiki/ModMagnetExamples#lua-mod_dirlisting">lua mod_dirlisting</a> run from <a class="wiki-page" href="https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModMagnet">mod_magnet</a>.</p> Lighttpd - Feature #613: client-selectable directory list sorting, patch includedhttps://redmine.lighttpd.net/issues/613?journal_id=132362022-05-18T05:10:39Zgstrauss
<ul></ul><p>I think you want to move the parsing of the query-string from <code>http_list_directory</code> to <code>mod_dirlisting_response</code>, and then pass <code>sort</code> and <code>sort_dir</code> into <code>http_list_directory_header</code> and <code>http_list_directory</code>.</p>
<p>Do your changes to <code>http_list_directory_header</code> to create hrefs break javascript sorting?</p>
<p>Your changes to <code>http_list_directory_header</code> hard-code magic numbers. I think you want to use preprocessor directive <code>##</code> to paste token stringification (<code>#</code>) strings instead of hard-coding the magic numbers.</p>
<p>While it might be cleaner to pass to <code>http_dirls_sort</code> a function pointer to a comparator function, it will probably be faster without too much extra code to specialize <code>http_dirls_sort</code> for each of the 6 combinations. (And possibly more clever to sort as 3 combinations ascending, and to read the list backwards if descending sorting was desired.) Then again, the existing patch could reduce code duplication with something like (<strong>untested</strong>)<br /><pre>
off_t res =
type == SORT_ALPHA
? strcmp(DIRLIST_ENT_NAME(ent[i]), DIRLIST_ENT_NAME(ent[j]))
: type == SORT_MODIFIED ? ent[i]->mtime - ent[j]->mtime
: /*(type == SORT_SIZE)*/ ent[i]->size - ent[j]->size;
if ((dir == SORT_DIR_ASC ? res : -res) > 0) {
tmp = ent[i];
ent[i] = ent[j];
ent[j] = tmp;
swapped = 1;
}
</pre></p>