00001
00002
00003
00004
00005
00006
00007
00008 #include "openLogger.h"
00009 #include "connectstring"
00010 #include "cgiClass.h"
00011 #include "page.hpp"
00012 #include "w3intranet.h"
00013 #include "show_control.hpp"
00014
00015 using namespace std;
00016
00017 string buildSlideMatchString( string & control )
00018 {
00019 string matches;
00020
00021 xmlParser ctrlParse(control);
00022 ctrlParse.parse();
00023 string detail="detail",slide="slides";
00024 node_vector & xnodes = ctrlParse.nodeList();
00025 node_map & nodekeys = ctrlParse.states.nodemap;
00026 node_map::iterator mnx = nodekeys.lower_bound(detail);
00027 while( mnx!=nodekeys.upper_bound(detail) )
00028 {
00029 size_t key = mnx->second;
00030 xmlNode & dtlNode = xnodes[key];
00031 node_attr::iterator x = dtlNode.attr.find("item");
00032
00033 if( x==dtlNode.attr.end() ) x = dtlNode.attr.find("items");
00034 if( x!=dtlNode.attr.end() )
00035 {
00036 matches=x->second;
00037 }
00038 ++mnx;
00039 }
00040 mnx = nodekeys.lower_bound(slide);
00041 while( mnx!=nodekeys.upper_bound(slide) )
00042 {
00043 size_t key = mnx->second;
00044 xmlNode & sldNode = xnodes[key];
00045 node_attr::iterator x = sldNode.attr.find("items");
00046 if( x!=sldNode.attr.end() )
00047 {
00048 matches+=",";
00049 matches+=x->second;
00050 }
00051 ++mnx;
00052 }
00053 return matches;
00054 }
00055
00056 int main(int argc, char ** argv)
00057 {
00058 baseUrl = "show.meta";
00059 cgiScript script("text/html",false);
00060 isSignedOn = check(script);
00061 script.closeHeader();
00062 show_page pg(script);
00063
00064 if( pg.load() )
00065 {
00066 page_control ctrl(pg);
00067 ctrl.addOp ( "detail", new detail_functor(pg,script) );
00068 ctrl.addOp ( "slides", new slides_functor(pg,script) );
00069
00070 string control = pg.loaded_control_string();
00071
00072 string matches = buildSlideMatchString(control);
00073
00074 pg.loadSlides( matches );
00075 ctrl.emit ();
00076 }
00077 else if( script.ClientArguments().count("DBG") )
00078 {
00079 script << "<html><head><title>Error</title></head>" << endl
00080 << "<body><h1>Error</h1><p>Unable to load the requested page<br>" << endl;
00081
00082 script << "</p></body></html>";
00083 }
00084 else
00085 {
00086 script << "<html><head><title>Page Unavailable</title></head>" << endl
00087 << "<body><h1>Sorry</h1>" << endl
00088 << "<p>The page you requested is not available</p></body></html>";
00089 }
00090
00091 return 0;
00092 }
00093 #include "read_write_base.cpp"