diff --git a/html/advanced.html b/html/advanced.html index 356bb23cd..e132aee78 100644 --- a/html/advanced.html +++ b/html/advanced.html @@ -225,6 +225,17 @@ Year Month Added Completed Deleted Net number decreased as more task were completed than added.

+ % task ghistory +

+ The ghistory report is a "graphical" version of the history + report. It shows a colored bar graph and legend. +

+ + % task timesheet +

+ ??? +

+ % task calendar

This report shows a calendar of the current month, with any task diff --git a/html/config.html b/html/config.html index 6ad919b81..96b0c4a15 100644 --- a/html/config.html +++ b/html/config.html @@ -185,6 +185,12 @@ only show as many that will fit. +

weekstart
+
+ The day of the week that represents the first day of the week. + Defaults to "Monday". +
+
defaultwidth
The width of tables used when ncurses support is not available. diff --git a/src/parse.cpp b/src/parse.cpp index 6bb7e224b..bb5dbdc45 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -116,6 +116,7 @@ static const char* attributes[] = "", }; +// Alphabetical please. static const char* commands[] = { "active", @@ -142,6 +143,7 @@ static const char* commands[] = "stop", "summary", "tags", + "timesheet", "undelete", "undo", "version", diff --git a/src/report.cpp b/src/report.cpp index 858075a3b..ba42bd27b 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -1299,6 +1299,63 @@ std::string handleReportGHistory (TDB& tdb, T& task, Config& conf) return out.str (); } +//////////////////////////////////////////////////////////////////////////////// +std::string handleReportTimesheet (TDB& tdb, T& task, Config& conf) +{ + std::stringstream out; + + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", (int) 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + // Get all the tasks. + std::vector tasks; + tdb.allT (tasks); + filter (tasks, task); + + // TODO Was a duration argument specified? + // by default, duration = 1week + // TODO Determine start date + // by default, start = prior Monday + // otherwise, start = prior Monday - ((duration - 1) * 7 * 86,400) + // TODO end date = next Sunday + + Table table; + + // TODO Render report +/* + % task timesheet [filter] 2w + + 4/19/2009 - 4/26/2009 + ... + + 4/27/2009 - 5/3/2009 + Tasks Completed (5) + + ... + + Tasks Started (2) + + ... +*/ + + if (table.rowCount ()) + out << optionalBlankLine (conf) + << table.render () + << std::endl; + else + out << "No tasks." << std::endl; + + return out.str (); +} + //////////////////////////////////////////////////////////////////////////////// std::string renderMonths ( int firstMonth, diff --git a/src/task.cpp b/src/task.cpp index 82138d4be..ef8794efa 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -152,6 +152,10 @@ static std::string shortUsage (Config& conf) table.addCell (row, 1, "task summary"); table.addCell (row, 2, "Shows a report of task status by project"); + row = table.addRow (); + table.addCell (row, 1, "task timesheet [duration]"); + table.addCell (row, 2, "Shows a weekly report of tasks completed and started"); + row = table.addRow (); table.addCell (row, 1, "task history"); table.addCell (row, 2, "Shows a report of task history, by month"); @@ -861,18 +865,19 @@ std::string runTaskCommand ( std::string out; // Read-only commands with no side effects. - if (command == "export") { out = handleExport (tdb, task, conf); } - else if (command == "projects") { out = handleProjects (tdb, task, conf); } - else if (command == "tags") { out = handleTags (tdb, task, conf); } - else if (command == "info") { out = handleInfo (tdb, task, conf); } - else if (command == "stats") { out = handleReportStats (tdb, task, conf); } - else if (command == "history") { out = handleReportHistory (tdb, task, conf); } - else if (command == "ghistory") { out = handleReportGHistory (tdb, task, conf); } - else if (command == "calendar") { out = handleReportCalendar (tdb, task, conf); } - else if (command == "summary") { out = handleReportSummary (tdb, task, conf); } - else if (command == "colors") { out = handleColor ( conf); } - else if (command == "version") { out = handleVersion ( conf); } - else if (command == "help") { out = longUsage ( conf); } + if (command == "export") { out = handleExport (tdb, task, conf); } + else if (command == "projects") { out = handleProjects (tdb, task, conf); } + else if (command == "tags") { out = handleTags (tdb, task, conf); } + else if (command == "info") { out = handleInfo (tdb, task, conf); } + else if (command == "stats") { out = handleReportStats (tdb, task, conf); } + else if (command == "history") { out = handleReportHistory (tdb, task, conf); } + else if (command == "ghistory") { out = handleReportGHistory (tdb, task, conf); } + else if (command == "calendar") { out = handleReportCalendar (tdb, task, conf); } + else if (command == "summary") { out = handleReportSummary (tdb, task, conf); } + else if (command == "timesheet") { out = handleReportTimesheet (tdb, task, conf); } + else if (command == "colors") { out = handleColor ( conf); } + else if (command == "version") { out = handleVersion ( conf); } + else if (command == "help") { out = longUsage ( conf); } // Commands that cause updates. else if (command == "" && task.getId ()) { cmdMod = true; out = handleModify (tdb, task, conf); } diff --git a/src/task.h b/src/task.h index bdb9e6090..a2b60c69d 100644 --- a/src/task.h +++ b/src/task.h @@ -110,6 +110,7 @@ std::string handleReportCalendar (TDB&, T&, Config&); std::string handleReportActive (TDB&, T&, Config&); std::string handleReportOverdue (TDB&, T&, Config&); std::string handleReportStats (TDB&, T&, Config&); +std::string handleReportTimesheet (TDB&, T&, Config&); std::string handleCustomReport (TDB&, T&, Config&, const std::string&); void validReportColumns (const std::vector &);