Custom Reports - oldest, newest

- Added support for the "report.X.limit" configuration variable, to
  restrict the number of rows a report generates.
- Added support for Table::render (limit) to limit the number of rows
  that are rendered.
- Removed "oldest" and "newest" report code.
- Added "oldest" and "newest" custom report details to Config.cpp
- Updated various documentation.
This commit is contained in:
Paul Beckingham 2009-03-12 22:34:45 -04:00
parent 8c95e82a63
commit c35a764019
14 changed files with 101 additions and 369 deletions

View file

@ -39,17 +39,32 @@
// These are default (but overridable) reports. These entries are necessary
// because these three reports were converted from hard-coded reports to custom
// reports, and therefore need these config file entries. However, users are
// already used to seeing these three reports, but do not have these entries.
// already used to seeing these five reports, but do not have these entries.
// The choice was a) make users edit their .taskrc files, b) write a .taskrc
// upgrade program to make the change, or c) this.
Config::Config ()
{
(*this)["report.long.columns"] = "id,project,priority,entry,start,due,age,tags,description";
(*this)["report.long.sort"] = "due+,priority-,project+";
(*this)["report.list.columns"] = "id,project,priority,due,active,age,description";
(*this)["report.list.sort"] = "due+,priority-,project+";
(*this)["report.ls.columns"] = "id,project,priority,description";
(*this)["report.ls.sort"] = "priority-,project+";
(*this)["report.long.description"] = "Lists all task, all data, matching the specified criteria";
(*this)["report.long.columns"] = "id,project,priority,entry,start,due,recur,age,tags,description";
(*this)["report.long.sort"] = "due+,priority-,project+";
(*this)["report.list.description"] = "Lists all tasks matching the specified criteria";
(*this)["report.list.columns"] = "id,project,priority,due,active,age,description";
(*this)["report.list.sort"] = "due+,priority-,project+";
(*this)["report.ls.description"] = "Minimal listing of all tasks matching the specified criteria";
(*this)["report.ls.columns"] = "id,project,priority,description";
(*this)["report.ls.sort"] = "priority-,project+";
(*this)["report.newest.description"] = "Shows the newest tasks";
(*this)["report.newest.columns"] = "id,project,priority,due,active,age,description";
(*this)["report.newest.sort"] = "id-";
(*this)["report.newest.limit"] = "10";
(*this)["report.oldest.description"] = "Shows the oldest tasks";
(*this)["report.oldest.columns"] = "id,project,priority,due,active,age,description";
(*this)["report.oldest.sort"] = "id+";
(*this)["report.oldest.limit"] = "10";
}
////////////////////////////////////////////////////////////////////////////////
@ -59,9 +74,9 @@ Config::Config (const std::string& file)
}
////////////////////////////////////////////////////////////////////////////////
// Read the Configuration filee and populate the *this map. The file format
// is simply lines with name=value pairs. Whitespace between name, = and value
// is not tolerated, but blank lines and comments starting with # are allowed.
// Read the Configuration file and populate the *this map. The file format is
// simply lines with name=value pairs. Whitespace between name, = and value is
// not tolerated, but blank lines and comments starting with # are allowed.
bool Config::load (const std::string& file)
{
std::ifstream in;
@ -154,17 +169,33 @@ void Config::createDefault (const std::string& home)
fprintf (out, "default.command=list\n");
// Custom reports.
fprintf (out, "# Fields: id,uuid,project,priority,entry,start,due,age,active,tags,description\n");
fprintf (out, "# Sort: due+,priority-,project+\n");
fprintf (out, "# Filter: pro:x pri:H +bug\n");
fprintf (out, "report.large.columns=id,uuid,project,priority,entry,start,due,age,active,tags,description\n");
fprintf (out, "report.large.sort=due+,priority-,project+\n");
fprintf (out, "report.long.columns=id,project,priority,entry,start,due,age,tags,description\n");
fprintf (out, "report.long.sort=due+,priority-,project+\n");
fprintf (out, "report.list.columns=id,project,priority,due,active,age,description\n");
fprintf (out, "report.list.sort=due+,priority-,project+\n");
fprintf (out, "report.ls.columns=id,project,priority,description\n");
fprintf (out, "report.ls.sort=priority-,project+\n");
fprintf (out, "# Fields: id,uuid,project,priority,entry,start,due,recur,age,active,tags,description\n");
fprintf (out, "# Description: This report is ...\n");
fprintf (out, "# Sort: due+,priority-,project+\n");
fprintf (out, "# Filter: pro:x pri:H +bug\n");
fprintf (out, "# Limit: 10\n");
fprintf (out, "report.long.description=Lists all task, all data, matching the specified criteria");
fprintf (out, "report.long.columns=id,project,priority,entry,start,due,recur,age,tags,description");
fprintf (out, "report.long.sort=due+,priority-,project+");
fprintf (out, "report.list.description=Lists all tasks matching the specified criteria");
fprintf (out, "report.list.columns=id,project,priority,due,active,age,description");
fprintf (out, "report.list.sort=due+,priority-,project+");
fprintf (out, "report.ls.description=Minimal listing of all tasks matching the specified criteria");
fprintf (out, "report.ls.columns=id,project,priority,description");
fprintf (out, "report.ls.sort=priority-,project+");
fprintf (out, "report.newest.description=Shows the newest tasks");
fprintf (out, "report.newest.columns=id,project,priority,due,active,age,description");
fprintf (out, "report.newest.sort=id-");
fprintf (out, "report.newest.limit=10");
fprintf (out, "report.oldest.description=Shows the oldest tasks");
fprintf (out, "report.oldest.columns=id,project,priority,due,active,age,description");
fprintf (out, "report.oldest.sort=id+");
fprintf (out, "report.oldest.limit=10");
fclose (out);