00001 #include "cgiExtend.h"
00002 #include "cgiCookie.h"
00003 #include "cgiTemplates.h"
00004
00005 using namespace std;
00006 #define standard_cgi
00007
00008
00009 bool templateTests(cgiScript & script);
00010 bool cgiTests(cgiScript & script);
00011 bool cookieTesting ( void );
00012
00013
00014 int main(int argc, char ** argv)
00015 {
00016 cgiScript script("text/html",true,"uploads");
00017 templateTests( script );
00018
00019
00020 return 0;
00021 }
00022
00023 bool cgiTests(cgiScript & script)
00024 {
00025
00026 cgiHtml html;
00027 {
00028
00029 cgiHead head;
00030 {
00031 cgiCan title("title");
00032 title << "testHarness";
00033 }
00034 {
00035 cgiCan style("style");
00036 style << ".odd{ color: darkblue; background: linen;}\n"
00037 << ".even{ color: linen; background: darkblue;}\n"
00038 << ".cookie{ color: green; background: tan; }\n";
00039 }
00040
00041 }
00042 {
00043
00044 cgiBody body;
00045 script << "<br><br><h1 style=\"color:red;\">EnVIRONMENT DEBUGGING============</h1>" << endl;
00046 script.DebugString();
00047 }
00048 return true;
00049 }
00050 bool templateTests(cgiScript & script)
00051 {
00052 cgiTemplates content;
00053 string path=script.ClientArguments()["template"].c_str();
00054 if( content.load( path.c_str() ) != true )
00055 {
00056 script << "Failed to load content! " << path << endl;
00057 return false;
00058 }
00059 paragraphMap & tmap = content.getParagraphs();
00060 paragraphMap::iterator pos;
00061 for ( pos=tmap.begin(); pos != tmap.end(); ++pos )
00062 {
00063 script << "<br><br><h1 style=\"color:red;\">" << pos->first << "</h1>" << pos->second << "<br>" << endl;
00064 }
00065 script.DebugString();
00066 return true;
00067 }
00068
00069
00070 bool cookieTesting ( void )
00071 {
00072
00073
00074 cgiCookie cookie;
00075 cookie.setTimeout( 12, 31, 2002, 12, 0 );
00076 cookie.setPath( "/" );
00077 cookie.set("Oid","1234");
00078 return true;
00079 }
00080