Project

General

Profile

patch3-src_mod_dirlisting.c.patch

fjo, 2017-10-02 12:18

Download (2.79 KB)

View differences:

src/mod_dirlisting.c
602 602
" if (a.cells[sort_column].className == 'int') {\n" \
603 603
"  cmp = parseInt(at)-parseInt(bt);\n" \
604 604
" } else if (sort_column == date_column) {\n" \
605
"  cmp = Date.parse(at.replace(/-/g, '/'))\n" \
606
"      - Date.parse(bt.replace(/-/g, '/'));\n" \
607
"  var ad = isdigit(at.substr(0,1));\n" \
608
"  var bd = isdigit(bt.substr(0,1));\n" \
609
"  if (ad != bd) return (!ad ? -1 : 1);\n" \
605
"  var as = a.cells[sort_column].getAttribute(\"data-time\");\n" \
606
"  var bs = b.cells[sort_column].getAttribute(\"data-time\");\n" \
607
"  if (as && bs) {\n" \
608
"   cmp = parseInt(as) - parseInt(bs);\n" \
609
"  } else {\n" \
610
"   cmp = Date.parse(at.replace(/-/g, '/'))\n" \
611
"       - Date.parse(bt.replace(/-/g, '/'));\n" \
612
"   var ad = isdigit(at.substr(0,1));\n" \
613
"   var bd = isdigit(bt.substr(0,1));\n" \
614
"   if (ad != bd) return (!ad ? -1 : 1);\n" \
615
"  }\n" \
610 616
" } else if (sort_column == size_column) {\n" \
611 617
"  var ai = parseInt(at, 10) * unit_multiplier(at.substr(-1,1));\n" \
612 618
"  var bi = parseInt(bt, 10) * unit_multiplier(bt.substr(-1,1));\n" \
......
1050 1056
		buffer_append_string_encoded(out, DIRLIST_ENT_NAME(tmp), tmp->namelen, ENCODING_REL_URI_PART);
1051 1057
		buffer_append_string_len(out, CONST_STR_LEN("/\">"));
1052 1058
		buffer_append_string_encoded(out, DIRLIST_ENT_NAME(tmp), tmp->namelen, ENCODING_MINIMAL_XML);
1053
		buffer_append_string_len(out, CONST_STR_LEN("</a>/</td><td class=\"m\">"));
1059
		buffer_append_string_len(out, CONST_STR_LEN("</a>/</td><td class=\"m\" data-time=\""));
1060
		buffer_append_int(out, tmp->mtime);
1061
		buffer_append_string_len(out, CONST_STR_LEN("\">"));
1054 1062
		buffer_append_string_len(out, datebuf, sizeof(datebuf) - 1);
1055 1063
		buffer_append_string_len(out, CONST_STR_LEN("</td><td class=\"s\">- &nbsp;</td><td class=\"t\">Directory</td></tr>\n"));
1056 1064

  
......
1098 1106
		buffer_append_string_encoded(out, DIRLIST_ENT_NAME(tmp), tmp->namelen, ENCODING_REL_URI_PART);
1099 1107
		buffer_append_string_len(out, CONST_STR_LEN("\">"));
1100 1108
		buffer_append_string_encoded(out, DIRLIST_ENT_NAME(tmp), tmp->namelen, ENCODING_MINIMAL_XML);
1101
		buffer_append_string_len(out, CONST_STR_LEN("</a></td><td class=\"m\">"));
1109
		buffer_append_string_len(out, CONST_STR_LEN("</a></td><td class=\"m\" data-time=\""));
1110
		buffer_append_int(out, tmp->mtime);
1111
		buffer_append_string_len(out, CONST_STR_LEN("\">"));
1102 1112
		buffer_append_string_len(out, datebuf, sizeof(datebuf) - 1);
1103 1113
		buffer_append_string_len(out, CONST_STR_LEN("</td><td class=\"s\">"));
1104 1114
		buffer_append_string(out, sizebuf);