summaryrefslogtreecommitdiff
path: root/server/src/journal_commit.cc
diff options
context:
space:
mode:
authordeva <deva>2009-08-05 11:42:01 +0000
committerdeva <deva>2009-08-05 11:42:01 +0000
commit44425239943e93df047a829b4af770bf9acf848e (patch)
tree9b202408694e14767ecd0839ff30e0726d688bc0 /server/src/journal_commit.cc
parent1b222bbd5779a371b7c857b5a90becf7ad20db74 (diff)
Made JournalWriter use the new TemplateList class.
Diffstat (limited to 'server/src/journal_commit.cc')
-rw-r--r--server/src/journal_commit.cc14
1 files changed, 5 insertions, 9 deletions
diff --git a/server/src/journal_commit.cc b/server/src/journal_commit.cc
index e0db705..414fa20 100644
--- a/server/src/journal_commit.cc
+++ b/server/src/journal_commit.cc
@@ -207,12 +207,8 @@ JournalWriter::JournalWriter(std::string host, unsigned short int port)
}
void JournalWriter::addEntry(Transaction &transaction, Commit &commit,
- std::string resume, std::string templname)
+ std::string resume, Template *templ)
{
- TemplateParser tp(templname);
- tp.parse();
- Template *templ = tp.getTemplate();
-
size_t index = 0;
std::vector< Macro >::iterator i = templ->macros.begin();
while(i != templ->macros.end()) {
@@ -224,21 +220,21 @@ void JournalWriter::addEntry(Transaction &transaction, Commit &commit,
if(index >= templ->macros.size()) {
PRACRO_ERR(journal, "Could not find macro %s in template %s\n",
- commit.macro.c_str(), templname.c_str());
+ commit.macro.c_str(), templ->attributes["name"].c_str());
// return;
} else {
PRACRO_DEBUG(journal, "Found macro %s as index %u in template %s\n",
- commit.macro.c_str(), index, templname.c_str());
+ commit.macro.c_str(), index, templ->attributes["name"].c_str());
}
// First run - initialize username and cpr.
if(currentuser == "" && entrylist.size() == 0) currentuser = transaction.user;
if(currentcpr == "" && entrylist.size() == 0) currentcpr = transaction.cpr;
- PRACRO_DEBUG(journal, "addEntry: template(%s)\n", templname.c_str());
+ PRACRO_DEBUG(journal, "addEntry: template(%s)\n", templ->attributes["name"].c_str());
// Add the template resume as the header (ie. first entry) of the journal entry.
- if(entrylist.size() == 0 && templname != "") {
+ if(entrylist.size() == 0 && templ->attributes["name"] != "") {
std::string template_resume = templ->attributes["resume"];
PRACRO_DEBUG(journal, "TemplateResume: %s\n", template_resume.c_str());