summaryrefslogtreecommitdiff
path: root/project2/envproc.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2010-06-18 23:41:55 +0000
committerrandomdan <randomdan@localhost>2010-06-18 23:41:55 +0000
commit83a6081b5773abd18db2c9bfa9d0398fbdefde2c (patch)
tree4b92b5fa946c04db4824c1f85303411192931133 /project2/envproc.cpp
parentAdd support for composing Glib::ustrings from columns (diff)
downloadproject2-83a6081b5773abd18db2c9bfa9d0398fbdefde2c.tar.bz2
project2-83a6081b5773abd18db2c9bfa9d0398fbdefde2c.tar.xz
project2-83a6081b5773abd18db2c9bfa9d0398fbdefde2c.zip
Use cgicc, add checks, tasks, dynamic loader, atom feed, login page
Diffstat (limited to 'project2/envproc.cpp')
-rw-r--r--project2/envproc.cpp89
1 files changed, 0 insertions, 89 deletions
diff --git a/project2/envproc.cpp b/project2/envproc.cpp
deleted file mode 100644
index feb5ad1..0000000
--- a/project2/envproc.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "xmlObjectLoader.h"
-#include "envproc.h"
-#include "rdbmsDataSource.h"
-#include "sqlView.h"
-#include <map>
-#include <libxml++/parsers/domparser.h>
-#include <libxml/xinclude.h>
-#include <boost/shared_ptr.hpp>
-#include <boost/any.hpp>
-#include <boost/foreach.hpp>
-
-void
-EnvironmentProcessor::init()
-{
- elems = regexExtractSet("/([^/?]+)", request_uri.c_str());
- params = regexExtractMulti("&?([^=]+)=?([^&]*)", query_string.c_str(), 2);
- page = elems.size() > 0 ? elems[0] : "index";
-}
-
-void
-EnvironmentProcessor::Initialise()
-{
- xmlpp::DomParser present("present/" + page + ".xml");
- while (xmlXIncludeProcessFlags(present.get_document()->cobj(), XML_PARSE_NOXINCNODE) > 0);
- xmlpp::Element * presentRoot = present.get_document()->get_root_node();
- responseRootNodeName = presentRoot->get_attribute_value("root");
- responseStyle = presentRoot->get_attribute_value("style");
- // Collect datasources
- collectAll<_RdbmsDataSource>(datasources, presentRoot, "rdbmsdatasource", &_Project2SourceObject::name, true, true);
- // Collect views
- collectAll<_SqlView>(views, presentRoot, "sqlview", &_SqlView::name, true, true);
-}
-
-boost::shared_ptr<xmlpp::Document>
-EnvironmentProcessor::process() const
-{
- boost::shared_ptr<xmlpp::Document> responseDoc = boost::shared_ptr<xmlpp::Document>(new xmlpp::Document("1.0"));
- xmlpp::Element * responseRoot = responseDoc->create_root_node(responseRootNodeName);
- try {
- BOOST_FOREACH(Views::value_type s, views) {
- s.second->execute(responseRoot, this);
- }
- }
- catch (...) {
- }
- // These were for debug... but why not pass them on?
- xmlNewNs(responseRoot->cobj(), BAD_CAST "http://project2.randomdan.homeip.net/", BAD_CAST "project2");
- responseRoot->add_child("fqdn", "project2")->set_child_text(http_host);
- responseRoot->add_child("requesturi", "project2")->set_child_text(request_uri);
- // URL elements
- xmlpp::Element * uriElems = responseRoot->add_child("uriElems", "project2");
- BOOST_FOREACH(std::string s, elems) {
- uriElems->add_child("uriElem", "project2")->set_child_text(s);
- }
- // Parameters
- xmlpp::Element * paramsXml = responseRoot->add_child("params", "project2");
- BOOST_FOREACH(RegMultiMatch::value_type u, params) {
- xmlpp::Element * param = paramsXml->add_child("param", "project2");
- param->add_child_text(u[1]);
- param->set_attribute("name", u[0]);
- }
- // XSLT Style
- char * buf;
- if (asprintf(&buf, "type=\"text/xsl\" href=\"%s\"",
- responseStyle.c_str()) > 0) {
- xmlAddPrevSibling(responseRoot->cobj(),
- xmlNewDocPI(responseDoc->cobj(), BAD_CAST "xml-stylesheet", BAD_CAST buf));
- }
- free(buf);
- return responseDoc;
-}
-
-Glib::ustring
-EnvironmentProcessor::getParamUri(const std::string & p) const
-{
- return elems[atoi(p.c_str())];
-}
-
-Glib::ustring
-EnvironmentProcessor::getParamQuery(const std::string & p) const
-{
- BOOST_FOREACH(RegMultiMatch::value_type u, params) {
- if (u[0] == p) {
- return u[1];
- }
- }
- return Glib::ustring();
-}
-