summaryrefslogtreecommitdiff
path: root/server/src/transactionhandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/transactionhandler.cc')
-rw-r--r--server/src/transactionhandler.cc31
1 files changed, 25 insertions, 6 deletions
diff --git a/server/src/transactionhandler.cc b/server/src/transactionhandler.cc
index f549192..86f7853 100644
--- a/server/src/transactionhandler.cc
+++ b/server/src/transactionhandler.cc
@@ -66,11 +66,11 @@ static std::string handleCommits(Transaction &transaction, Environment &env,
mp.parse();
Macro *macro = mp.getMacro();
- std::string resume = resume_parser(macro->resume, commit);
+ std::string resume = resume_parser(*macro, commit);
commit.fields["journal.resume"] = resume;
db->commitTransaction(transaction.user, transaction.cpr, *macro,
commit.fields);
-
+
if(resume != "") {
TemplateParser tp(env.templatelist.getLatestVersion(commit.templ));
@@ -199,12 +199,31 @@ static std::string handleRequest(Transaction &transaction, Environment &env,
std::vector< Script >::iterator spi = m->scripts.begin();
while(spi != m->scripts.end()) {
answer += " <script language=\"" +
- spi->attributes["language"]
- + "\" name=\"" + spi->attributes["name"] + "\">\n";
- answer += xml_encode(spi->attributes["code"]);
- answer += "\n </script>\n";
+ spi->attributes["language"] + "\">";
+
+ if(spi->attributes.find("src") != spi->attributes.end()) {
+ std::string file =
+ Conf::xml_basedir + "/include/" + spi->attributes["src"];
+ FILE *fp = fopen(file.c_str(), "r");
+ if(fp) {
+ char buf[64];
+ size_t sz;
+ std::string inc;
+ while((sz = fread(buf, 1, sizeof(buf), fp)) != 0) {
+ inc.append(buf, sz);
+ }
+ fclose(fp);
+ answer += "\n-- BEGIN INCLUDE: '" + spi->attributes["src"] + "'\n";
+ answer += xml_encode(inc);
+ answer += "\n-- END INCLUDE: '" + spi->attributes["src"] + "'\n";
+ }
+ } else {
+ answer += xml_encode(spi->attributes["code"]);
+ }
+ answer += "</script>\n";
spi++;
}
+
answer += " </scripts>\n";
}