include(config.m4)dnl #!__CMD_AWK__ -f # __CGIPATH__/listsort # # Change list sort order include(src/config.awk) incl(src/cgi.awk) incl(src/util.awk) function main( acct, i, lbl, list_id, opt, out, sel) { out = "" lbl[1] = "Relevance" opt[1] = "" lbl[2] = "Weekly views [^]" opt[2] = "week asc" lbl[3] = "Weekly views [v]" opt[3] = "week desc" lbl[4] = "Title [^]" opt[4] = "title asc" lbl[5] = "Title [v]" opt[5] = "title desc" lbl[6] = "Date published [^]" opt[6] = "date asc" lbl[7] = "Date published [v]" opt[7] = "date desc" lbl[8] = "Creator [^]" opt[8] = "creator asc" lbl[9] = "Creator [v]" opt[9] = "creator desc" split(search, parts, "/") acct = parts[1] list_id = parts[2] info(out, "# Sort by") for (i = 1; i < 10; i++) { if (length(opt[i]) == 0) { sel = sprintf("%s/list?%s/%d", cgipath, acct, list_id) item(out, "1", lbl[i], sel, server, port) } else { sel = sprintf("%s/list?%s/%d/sort%s", cgipath, acct, list_id, opt[i]) item(out, "1", lbl[i], sel, server, port) } } exit 0 } BEGIN { config_init() cgi_init() main() }