From 71f4cc84c3788c6904ede17cd626a9ca9c349e3b Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Sun, 30 Jan 2005 00:57:53 +0000 Subject: initial commit into repository --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c57e5fe --- a/dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +configure +Makefile.in +config.log +config.status +aux +cache +autom4te.cache +INSTALL +config.sitecing +NEWS +aclocal.m4 +Makefile +fastcgi-bin +logs +run diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..a9fb0c7 --- a/dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +Klever dissected: + Michael 'hacker' Krelin + Leonid Ivanov diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..7c61600 --- a/dev/null +++ b/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 2005 Klever Group (http://www.klever.net/) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/ChangeLog diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..cf1fe6d --- a/dev/null +++ b/Makefile.am @@ -0,0 +1,35 @@ +EXTRA_DIST = \ + $(addprefix htdocs/,.htaccess index.chtml sources.chtml style.css view.chtml) \ + $(addprefix htdocs/ancestry/,.htaccess layout.chtml page.chtml sources.chtml) \ + $(addprefix htdocs/exceptions/,index.chtml preprocess.chtml compile.chtml runtime.chtml) \ + $(addprefix htdocs/exceptions/development/,.htaccess .scrc compile.chtml compile.html preprocess.chtml runtime.chtml erroneous.h) \ + $(addprefix htdocs/exceptions/production/,.htaccess .scrc compile.chtml compile.html preprocess.chtml runtime.chtml erroneous.h) \ + $(addprefix htdocs/handlers/,.htaccess exception_dev exception_prod) \ + autogen.sh \ + NEWS NEWS.xml NEWS.xsl + +DISTCHECK_CONFIGURE_FLAGS=--enable-distcheck + +all-local: NEWS sitecode restart restart-apache +distclean-local: + rm -rf config.sitecing \ + logs fastcgi-bin run cache + +NEWS: NEWS.xsl NEWS.xml + ${XSLTPROC} -o $@ NEWS.xsl NEWS.xml + +sitecode: conf/sitecing.conf include/acconfig.h + ${SHELL} bin/build +restart: conf/sitecing.conf conf/dudki.conf +if !DISTCHECKING +if HAVE_DUDKI + sudo ${SHELL} -c "@DUDKI@ -k @dudki_id@ ; sleep 3 ; @DUDKI@ -r" +else + kill `cat run/sitecing.pid` ; sleep 3 ; ${SHELL} bin/run +endif +endif !DISTCHECKING + +restart-apache: conf/httpd.conf +if !DISTCHECKING + @APACHE_RESTART_CMD@ +endif !DISTCHECKING diff --git a/NEWS.xml b/NEWS.xml new file mode 100644 index 0000000..d1d89f6 --- a/dev/null +++ b/NEWS.xml @@ -0,0 +1,6 @@ + + + + Initial release + + diff --git a/NEWS.xsl b/NEWS.xsl new file mode 100644 index 0000000..7c71307 --- a/dev/null +++ b/NEWS.xsl @@ -0,0 +1,24 @@ + + + + + + + + + + + + + - + + + + + + diff --git a/README b/README new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/README diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..e16972c --- a/dev/null +++ b/acinclude.m4 @@ -0,0 +1,37 @@ +dnl SC_BUILD_CONF(FILE-NAME,DIRECTIVE,CONTENTS) +AC_DEFUN([SC_BUILD_CONF],[ + echo -n "$2" >>"$1" + oc=0 + for o in $3 ; do + oc=`expr ${oc} + 1` + if test ${oc} -ge 16 ; then + (echo ; echo -n "$2") >>"$1" + oc=0; + fi + echo -n " ${o}" >>"$1" + done + echo >>"$1" +]) + +dnl SC_WEB_ROOT(V_SRC,V_RUN) +AC_DEFUN([SC_WEB_ROOT],[ + $2="${PWD}" + X="${PWD}" + cd ${srcdir} + $1="${PWD}" + cd "${X}" + AC_SUBST([$1]) + AC_SUBST([$2]) +]) + +dnl SC_USER(VARIABLE[,DEFAULT]) +AC_DEFUN([SC_USER],[ + $1=ifelse([$2], , ["${USER}"],[$2]) + AC_ARG_WITH([sitecing-user], + AC_HELP_STRING([--with-sitecing-user=user],[set the owner of sitecing process]), + [ + $1="${withval}" + ] + ) + AC_SUBST([$1]) +]) diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..bfd0e8f --- a/dev/null +++ b/autogen.sh @@ -0,0 +1,8 @@ +#!/bin/sh +WANT_AUTOMAKE=1.8 +export WANT_AUTOMAKE +aclocal \ +&& autoheader \ +&& automake -a \ +&& autoconf \ +&& ./configure "$@" diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..266ca8d --- a/dev/null +++ b/bin/.gitignore @@ -0,0 +1,2 @@ +build +run diff --git a/bin/build.in b/bin/build.in new file mode 100755 index 0000000..4ef803c --- a/dev/null +++ b/bin/build.in @@ -0,0 +1,2 @@ +#!/bin/sh +@sitecing_build@ -f @web_run_root@/conf/sitecing.conf / diff --git a/bin/run.in b/bin/run.in new file mode 100755 index 0000000..db88640 --- a/dev/null +++ b/bin/run.in @@ -0,0 +1,2 @@ +#!/bin/sh +exec @sitecing_fastcgi@ -f @web_run_root@/conf/sitecing.conf diff --git a/conf/.gitignore b/conf/.gitignore new file mode 100644 index 0000000..af40a7f --- a/dev/null +++ b/conf/.gitignore @@ -0,0 +1,6 @@ +dudki.conf +httpd.conf +banner_top +sitecing.conf +banner_bottom +banner_side diff --git a/conf/dudki.conf.in b/conf/dudki.conf.in new file mode 100644 index 0000000..df34f8d --- a/dev/null +++ b/conf/dudki.conf.in @@ -0,0 +1,5 @@ + + PidFile @web_run_root@/run/sitecing.pid + RestartCommand "exec sh @web_run_root@/bin/run" + User @sitecing_user@ + diff --git a/conf/httpd.conf.in b/conf/httpd.conf.in new file mode 100644 index 0000000..5910620 --- a/dev/null +++ b/conf/httpd.conf.in @@ -0,0 +1,29 @@ +FastCgiExternalServer @web_run_root@/fastcgi-bin/site-c-ing -socket @web_run_root@/run/sitecing-socket + + ServerName @v_hostname@ + DocumentRoot @web_src_root@/htdocs + + AllowOverride All + allow from all + + + deny from all + + + deny from all + + + deny from all + + CustomLog @web_run_root@/logs/access.log combined + ErrorLog @web_run_root@/logs/error.log + LogLevel error + Alias /fastcgi-bin/ @web_run_root@/fastcgi-bin/ + + allow from all + + DefaultLanguage en + Action site-c-ing /fastcgi-bin/site-c-ing + AddHandler site-c-ing .chtml + DirectoryIndex index + diff --git a/conf/sitecing.conf.in b/conf/sitecing.conf.in new file mode 100644 index 0000000..67d3cd5 --- a/dev/null +++ b/conf/sitecing.conf.in @@ -0,0 +1,25 @@ +MultiProcess on +ListenSocket @web_run_root@/run/sitecing-socket +MinChildren 2 +MinSpareChildren 2 +MaxChildren 4 +MaxSpareChildren 4 +RequestsPerChild 64 +PidFile @web_run_root@/run/sitecing.pid +Daemonize on + +RootSource @web_src_root@/htdocs/ +RootIntermediate @web_run_root@/cache/sitecing/intermediate/ +RootSO @web_run_root@/cache/sitecing/so/ + +@config_sitecing@ + +CPPFLAGS -I. -I@web_run_root@/include/ + +ExceptionHandler @exception_handler@ + +Build @build_on_demand@ +CPPDeps on +IntermediateDeps @sitecing_prefix@/share/sitecing/component.skel + +AutoBuildFiles *.chtml diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..dc1beb3 --- a/dev/null +++ b/configure.ac @@ -0,0 +1,166 @@ +AC_INIT([sitecing-showcase], [0.0], [sitecing-bugs@klever.net]) +AC_CONFIG_SRCDIR([htdocs/index.chtml]) +AC_CONFIG_AUX_DIR([aux]) +AC_CONFIG_HEADER([include/acconfig.h]) +AM_INIT_AUTOMAKE([dist-bzip2]) + +AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) + +PKG_CHECK_MODULES([SITECING],[sitecing],,[ + AC_MSG_ERROR([site-C-ing not found. get it at http://kin.klever.net/sitecing/]) +]) +sitecing_prefix="$(${PKG_CONFIG} --variable=prefix sitecing)" +sitecing_bindir="$(${PKG_CONFIG} --variable=bindir sitecing)" +AC_MSG_CHECKING([for sitecing-fastcgi binary]) +sitecing_fastcgi="${sitecing_bindir}/sitecing-fastcgi" +if test -x "${sitecing_fastcgi}" ; then + AC_MSG_RESULT([found ${sitecing_fastcgi}]) +else + AC_MSG_RESULT([not found]) + AC_MSG_ERROR([broken site-C-ing install detected]) +fi +AC_MSG_CHECKING([for sitecing-build binary]) +sitecing_build="${sitecing_bindir}/sitecing-build" +if test -x "${sitecing_build}" ; then + AC_MSG_RESULT([found ${sitecing_build}]) +else + AC_MSG_RESULT([not found]) + AC_MSG_ERROR([broken site-C-ing install detected]) +fi +AC_SUBST([sitecing_prefix]) +AC_SUBST([sitecing_bindir]) +AC_SUBST([sitecing_fastcgi]) +AC_SUBST([sitecing_build]) + +config_sitecing="config.sitecing" +rm -f "${config_sitecing}" +SC_BUILD_CONF([${config_sitecing}],[CPPFLAGS],[${SITECING_CFLAGS}]) +SC_BUILD_CONF([${config_sitecing}],[LDFLAGS],[${SITECING_LIBS}]) +AC_SUBST_FILE([config_sitecing]) + +SC_WEB_ROOT([web_src_root],[web_run_root]) +SC_USER([sitecing_user]) + +AC_DEFINE_UNQUOTED([WEB_ROOT],["${web_src_root}"],[the site root]) +AC_DEFINE_UNQUOTED([WEB_SRC_ROOT],["${web_src_root}"],[the site root]) +AC_DEFINE_UNQUOTED([WEB_RUN_ROOT],["${web_run_root}"],[the site root]) + +v_hostname="$(hostname)" +AC_MSG_CHECKING([for virtual host name]) +AC_ARG_WITH([vhostname], + AC_HELP_STRING([--with-vhostname=virtual-host-name],[set the apache ServerName of VirtualHost]), + [ + v_hostname="${withval}" + ] +) +AC_MSG_RESULT([${v_hostname}]) +AC_SUBST([v_hostname]) + +HAVE_DUDKI="false" +WANT_DUDKI="true" +AC_ARG_ENABLE([dudki], + AC_HELP_STRING([--disable-dudki],[disable the use of dudki! to restart daemon]), + [ + test "${enableval}" = "no" && WANT_DUDKI="false" + ] +) +if ${WANT_DUDKI} ; then + AC_PATH_PROG([DUDKI],[dudki],[false],[${PATH}:/usr/local/sbin:/usr/sbin]) + test "${DUDKI}" = "false" || HAVE_DUDKI="true" +fi +AM_CONDITIONAL([HAVE_DUDKI],[${HAVE_DUDKI}]) + +dudki_id=sitecing-showcase +AC_ARG_WITH([dudki-id], + AC_HELP_STRING([--with-dudki-id],[specify dudki process id]), + [ + dudki_id="${withval}" + ] +) +AC_SUBST([dudki_id]) + +APACHE_RESTART_CMD="false" +AC_ARG_WITH([apache-restart-cmd], + AC_HELP_STRING([--with-apache-restart-cmd=command],[use the specified command to restart apache]), + [ + test "${withval}" = "no" || APACHE_RESTART_CMD="${withval}" + ] +) +if test "${APACHE_RESTART_CMD}" = "false" ; then + AC_PATH_PROG([APACHECTL],[apachectl],[false],[${PATH}:/usr/sbin:/usr/local/sbin]) + if test "${APACHECTL}" != "false" ; then + APACHE_RESTART_CMD="sudo ${APACHECTL} graceful" + else + AC_PATH_PROG([APACHE2CTL],[apache2ctl],[false],[${PATH}:/usr/sbin:/usr/local/sbin]) + if test "${APACHE2CTL}" != "false" ; then + APACHE_RESTART_CMD="sudo ${APACHE2CTL} graceful" + else + for i_s in /etc/init.d/apache /etc/init.d/apache2 ; do + AC_MSG_CHECKING([for ${i_s}]) + if test -x ${i_s} ; then + AC_MSG_RESULT([found]) + APACHE_RESTART_CMD="sudo ${i_s} restart" + break + fi + AC_MSG_RESULT([not found]) + done + fi + fi +fi +if test "${APACHE_RESTART_CMD}" = "false" ; then + AC_MSG_NOTICE([couldn't figure out how to restart apache. use --with-apache-restart-cmd]) +fi +AC_SUBST([APACHE_RESTART_CMD]) + + +AC_MSG_CHECKING([if we are in the development environment]) +do_devel="false" +AC_ARG_ENABLE([development], + AC_HELP_STRING([--enable-development],[enable build for development environment]), + [ + if test "${enableval}" = "yes" ; then + do_devel="true" + fi + ] +) +build_on_demand="off" +exception_handler="/handlers/exception_prod" +if ${do_devel} ; then + AC_MSG_RESULT([yes]) + build_on_demand="on" + exception_handler="/handlers/exception_dev" + AC_DEFINE([_DEVELOPMENT],,[define if development environment]) +else + AC_MSG_RESULT([no]) +fi +AC_SUBST([build_on_demand]) +AC_SUBST([exception_handler]) + +DISTCHECKING="false" +AC_ARG_ENABLE([distcheck],,[ + DISTCHECKING="true" +]) +AM_CONDITIONAL([DISTCHECKING],[${DISTCHECKING}]) + +AC_CONFIG_FILES([ + Makefile + conf/httpd.conf conf/sitecing.conf conf/dudki.conf + bin/run bin/build +]) +AC_CONFIG_COMMANDS([logs/stamp],[touch logs/stamp]) +AC_CONFIG_COMMANDS([fastcgi-bin/stamp],[touch fastcgi-bin/stamp]) +AC_CONFIG_COMMANDS([run/stamp],[touch run/stamp]) +AC_OUTPUT + +echo +echo === +echo "virtual host name:" "${v_hostname}" +echo "project src root: " "${web_src_root}" +echo "project run root: " "${web_run_root}" +echo "sitecing user: " "${sitecing_user}" +echo "dudki id: " "${dudki_id}" +echo "development: " "${do_devel}" +echo "site-C-ing prefix:" "${sitecing_prefix}" +echo === +echo +dnl vim:set ft=m4: diff --git a/htdocs/.htaccess b/htdocs/.htaccess new file mode 100644 index 0000000..1165068 --- a/dev/null +++ b/htdocs/.htaccess @@ -0,0 +1,2 @@ +Options MultiViews +AddType text/html .chtml diff --git a/htdocs/ancestry/.htaccess b/htdocs/ancestry/.htaccess new file mode 100644 index 0000000..8d2f256 --- a/dev/null +++ b/htdocs/ancestry/.htaccess @@ -0,0 +1 @@ +deny from all diff --git a/htdocs/ancestry/layout.chtml b/htdocs/ancestry/layout.chtml new file mode 100644 index 0000000..11bd74a --- a/dev/null +++ b/htdocs/ancestry/layout.chtml @@ -0,0 +1,35 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive page = "/ancestry/page.chtml"; +%%impl #include "acconfig.h" +<%method void body() %> +
+ <%code> + if(!access(WEB_RUN_ROOT "/conf/banner_top",R_OK)) { + pass_file_through(WEB_RUN_ROOT "/conf/banner_top"); + } + content(); + if(b_strict && !access(WEB_RUN_ROOT "/conf/banner_bottom",R_OK)) { + pass_file_through(WEB_RUN_ROOT "/conf/banner_bottom"); + } + +
+
+% sidepanel(); +
+ +<%method void content() %> + +<%method void sidepanel() %> +

<% PACKAGE_STRING %>

+% /* thank MSIE for this awful formatting */ + + <%code> + if(!access(WEB_RUN_ROOT "/conf/banner_side",R_OK)) { + pass_file_through(WEB_RUN_ROOT "/conf/banner_side"); + } + + + + diff --git a/htdocs/ancestry/page.chtml b/htdocs/ancestry/page.chtml new file mode 100644 index 0000000..28bf7f0 --- a/dev/null +++ b/htdocs/ancestry/page.chtml @@ -0,0 +1,28 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%var bool b_strict = true; +<%decl> + using std::string; + +<%method void html() %> +% if(b_strict){ + +% }else{ + +% } + + +% __SCIF->headers["Content-Type"] = "text/html"; + <% title() %> + + + + +% body(); + + + +<%codemethod string title() %> + return "untitled"; + +<%method void body() %> + diff --git a/htdocs/ancestry/sources.chtml b/htdocs/ancestry/sources.chtml new file mode 100644 index 0000000..eb9c790 --- a/dev/null +++ b/htdocs/ancestry/sources.chtml @@ -0,0 +1,75 @@ +<%decl> + typedef struct { + const char *dir; + const char *name; + const char *desc; + } sourcefile_t; + extern sourcefile_t source_files[]; + extern int source_files_count; + +<%impl> + sourcefile_t source_files[] = { + { "", 0, "the root" }, + { "", "configure.ac", "main configuration file" }, + { "", "acinclude.m4", "autoconf macros" }, + { "", "autogen.sh", "shell script for building out of source repository" }, + { "", "Makefile.am", "automake makefile template" }, + { "", "NEWS.xml", "news since the last release (if any)" }, + { "", "NEWS.xsl", "the styleshhet to make a plaintext version of NEWS.xml" }, + { "", "COPYING", "copyright notice" }, + { "", "AUTHORS", "Klever dissected" }, + { 0, 0, 0 }, + { "bin", 0, "various scripts" }, + { "bin", "build.in", "the template of the script used to precompile the code" }, + { "bin", "run.in", "the template of the script used to start fastcgi server" }, + { 0, 0, 0 }, + { "conf", 0, "configuration files" }, + { "conf", "dudki.conf.in", "the template for the dudki daemon configuration file" }, + { "conf", "httpd.conf.in", "the template for the apache configuration" }, + { "conf", "sitecing.conf.in", "the template for the site-C-ing configuration" }, + { 0, 0, 0 }, + { "htdocs", 0, "the source files" }, + { "htdocs", ".htaccess", "apache access-control file" }, + { "htdocs", "index.chtml", "the introduction" }, + { "htdocs", "sources.chtml", "the source browser" }, + { "htdocs", "style.css", "the CSS style sheet" }, + { "htdocs", "view.chtml", "the source viewer" }, + { "htdocs/exceptions", 0, "exceptions handling overview" }, + { "htdocs/exceptions", "index.chtml", "the overview" }, + { "htdocs/exceptions", "preprocess.chtml", "preprocessor exceptions" }, + { "htdocs/exceptions", "compile.chtml", "compile-time exceptions" }, + { "htdocs/exceptions", "runtime.chtml", "runtime exceptions" }, + { "htdocs/exceptions/development", 0, "development-mode exceptions samples" }, + { "htdocs/exceptions/development", ".htaccess", "apache access control file" }, + { "htdocs/exceptions/development", ".scrc", "site-C-ing local configuration" }, + { "htdocs/exceptions/development", "preprocess.chtml", "the file that can not be preprocessed" }, + { "htdocs/exceptions/development", "runtime.chtml", "exception thrown at runtime" }, + { "htdocs/exceptions/development", "compile.chtml", "the file that can not be compiled" }, + { "htdocs/exceptions/development", "erroneous.h", "the file to include for more errors" }, + { "htdocs/exceptions/development", "compile.html", "compile-time exception handler output" }, + { 0,0,0 }, + { "htdocs/exceptions/production", 0, "production-mode exceptions samples" }, + { "htdocs/exceptions/production", ".htaccess", "apache access control file" }, + { "htdocs/exceptions/production", ".scrc", "site-C-ing local configuration" }, + { "htdocs/exceptions/production", "preprocess.chtml", "the file that can not be preprocessed" }, + { "htdocs/exceptions/production", "runtime.chtml", "exception thrown at runtime" }, + { "htdocs/exceptions/production", "compile.chtml", "the file that can not be compiled" }, + { "htdocs/exceptions/production", "erroneous.h", "the file to include for more errors" }, + { "htdocs/exceptions/production", "compile.html", "compile-time exception handler output" }, + { 0,0,0 }, + { 0,0,0 }, + { "htdocs/handlers", 0, "exception handlers" }, + { "htdocs/handlers", ".htaccess", "apache access-control file" }, + { "htdocs/handlers", "exception_dev", "development mode exception handler" }, + { "htdocs/handlers", "exception_prod", "production mode exception handler" }, + { 0,0,0 }, + { "htdocs/ancestry", 0, "base components to build the rest upon" }, + { "htdocs/ancestry", ".htaccess", "apache access control file" }, + { "htdocs/ancestry", "page.chtml", "the xhtml skeleton" }, + { "htdocs/ancestry", "layout.chtml", "the layout for the most pages" }, + { "htdocs/ancestry", "sources.chtml", "the list of files for source browser" }, + { 0,0,0 }, + { 0,0,0 } + }; + int source_files_count = sizeof(source_files)/sizeof(*source_files); + diff --git a/htdocs/exceptions/compile.chtml b/htdocs/exceptions/compile.chtml new file mode 100644 index 0000000..90ee7d8 --- a/dev/null +++ b/htdocs/exceptions/compile.chtml @@ -0,0 +1,50 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive layout = "/ancestry/layout.chtml"; +<%constructor> + b_strict = false; + +<%codemethod string title() %> + return "compile-time exceptions handling"; + +<%method void content() %> +

site-C-ing compile-time exception handling

+

+ Similar to preprocessing exceptions + there is a wide range of errors you may put into your code which will pass + through preprocessor and will be caught later at the compile-time. +

+

+ Once you complete writing your erroneous code and + site-C-ing is done preprocessing it, it will feed the preprocessed + code into c++ compiler which will refuse to compile the code like this. This + is where the exception handler, + specified in the configuration + file, takes over the process and gives you the report. Like with any handler, you may wish to + set some different handler in your production configuration, which just gives + user a friendly yet lame excuse. +

+

+ Note, that these output pages are fakes -- I do not want to spawn the + compiler each time you want to see the output and put this unnecessary load + on cpu. These static pages are in fact saved output of the real exception + handlers. +

+ +
+ +
+ + diff --git a/htdocs/exceptions/development/.htaccess b/htdocs/exceptions/development/.htaccess new file mode 100644 index 0000000..01cb5ec --- a/dev/null +++ b/htdocs/exceptions/development/.htaccess @@ -0,0 +1,3 @@ + + deny from all + diff --git a/htdocs/exceptions/development/.scrc b/htdocs/exceptions/development/.scrc new file mode 100644 index 0000000..da24ef7 --- a/dev/null +++ b/htdocs/exceptions/development/.scrc @@ -0,0 +1,2 @@ +ExceptionHandler /handlers/exception_dev +AutoBuildFiles -* diff --git a/htdocs/exceptions/development/compile.chtml b/htdocs/exceptions/development/compile.chtml new file mode 100644 index 0000000..3611ca9 --- a/dev/null +++ b/htdocs/exceptions/development/compile.chtml @@ -0,0 +1,12 @@ + + + I'm gonna make a number of mistakes! + + +% ind a = 2; +% #include "erroneous.h" +% unsigned int a = -1; +% int j = k; + + +% /* vim:set ft=sitecing: */ diff --git a/htdocs/exceptions/development/compile.html b/htdocs/exceptions/development/compile.html new file mode 100644 index 0000000..c3384a2 --- a/dev/null +++ b/htdocs/exceptions/development/compile.html @@ -0,0 +1,248 @@ + + + + + failed to compile component + + + + +
+

error compiling component 'exceptions/development/compile.chtml'

+ +
+

exceptions/development/compile.chtml

+
    +
  •     1 <html>
  • + +
  •     2  <head>
  • + +
  •     3   <title>I'm gonna make a number of mistakes!</title>
  • + +
  •     4  </head>
  • + +
  •     5  <body>
  • + +
  •     6 %  ind a = 2;
  • + +
  •     7 %  #include "erroneous.h"
  • + +
  •     8 %  unsigned int a = -1;
  • + +
  •     9 %  int j = k;
  • + +
  •    10  </body>
  • + +
  •    11 </html>
  • +
+
+ exceptions/development/compile.chtml: In member function `virtual void _SCC_exceptions_development_compile_chtml::main(int, char*)':
+exceptions/development/compile.chtml:6: error: `ind' undeclared (first use this function)
+exceptions/development/compile.chtml:6: error: (Each undeclared identifier is reported only once for each function it appears in.)
+exceptions/development/compile.chtml:6: error: expected `;' before "a" +
+
+ +
+

exceptions/development/compile.chtml

+
    +
  •     2  <head>
  • + +
  •     3   <title>I'm gonna make a number of mistakes!</title>
  • + +
  •     4  </head>
  • + +
  •     5  <body>
  • + +
  •     6 %  ind a = 2;
  • + +
  •     7 %  #include "erroneous.h"
  • + +
  •     8 %  unsigned int a = -1;
  • + +
  •     9 %  int j = k;
  • + +
  •    10  </body>
  • + +
  •    11 </html>
  • + +
  •    12 % /* vim:set ft=sitecing: */
  • +
+
+ In file included from exceptions/development/compile.chtml:7: +
+
+ +
+

exceptions/development/erroneous.h

+
    +
  •     1  a+2=5;
  • + +
  •     2 
  • +
+
+ ./erroneous.h:1: error: `a' undeclared (first use this function) +
+
+ +
+

exceptions/development/compile.chtml

+
    +
  •     3   <title>I'm gonna make a number of mistakes!</title>
  • + +
  •     4  </head>
  • + +
  •     5  <body>
  • + +
  •     6 %  ind a = 2;
  • + +
  •     7 %  #include "erroneous.h"
  • + +
  •     8 %  unsigned int a = -1;
  • + +
  •     9 %  int j = k;
  • + +
  •    10  </body>
  • + +
  •    11 </html>
  • + +
  •    12 % /* vim:set ft=sitecing: */
  • + +
  •    13 
  • +
+
+ exceptions/development/compile.chtml:8: warning: converting of negative value `-0x000000001' to `unsigned int' +
+
+ +
+

exceptions/development/compile.chtml

+
    +
  •     4  </head>
  • + +
  •     5  <body>
  • + +
  •     6 %  ind a = 2;
  • + +
  •     7 %  #include "erroneous.h"
  • + +
  •     8 %  unsigned int a = -1;
  • + +
  •     9 %  int j = k;
  • + +
  •    10  </body>
  • + +
  •    11 </html>
  • + +
  •    12 % /* vim:set ft=sitecing: */
  • + +
  •    13 
  • +
+
+ exceptions/development/compile.chtml:9: error: `k' undeclared (first use this function)
+ +
+
+ +
+ +
Powered by site-C-ing.
+ + + + + + + + + diff --git a/htdocs/exceptions/development/erroneous.h b/htdocs/exceptions/development/erroneous.h new file mode 100644 index 0000000..060a57e --- a/dev/null +++ b/htdocs/exceptions/development/erroneous.h @@ -0,0 +1 @@ + a+2=5; diff --git a/htdocs/exceptions/development/preprocess.chtml b/htdocs/exceptions/development/preprocess.chtml new file mode 100644 index 0000000..f7405e7 --- a/dev/null +++ b/htdocs/exceptions/development/preprocess.chtml @@ -0,0 +1,14 @@ + + +

+ I was writing this component in a hurry, having a lot of things to distract + me, so no wonder I made mistake. + <%code> + /* I do not even remember what I was going to put in this code block. And + * of course I didn't mean to forget that this is just a block of code, not + * a constructor... + */ + +

+ + diff --git a/htdocs/exceptions/development/runtime.chtml b/htdocs/exceptions/development/runtime.chtml new file mode 100644 index 0000000..4a494bd --- a/dev/null +++ b/htdocs/exceptions/development/runtime.chtml @@ -0,0 +1,16 @@ +%%decl #include +<%code> + try{ + try{ + try{ + throw konforka::exception(CODEPOINT,"throwing an exception to backtrace a bit"); + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + diff --git a/htdocs/exceptions/index.chtml b/htdocs/exceptions/index.chtml new file mode 100644 index 0000000..cc0ed8a --- a/dev/null +++ b/htdocs/exceptions/index.chtml @@ -0,0 +1,52 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive layout = "/ancestry/layout.chtml"; +<%codemethod string title() %> + return "exceptions handling"; + +<%method void content() %> +

site-C-ing exception handling

+

+ The purpose of this section is to give an overview of the site-C-ing + exception handling mechanism. Before the web visitor can see the page each + site-C-ing component goes through a few stages, namely, preprocessing, + compiling and execution. Having three stages to go through also means the + stages one can fail to go through and three exciting opportunities to handle + different errors. +

+

+ First each component is preprocessed so that you can feed the valid c++ code + to the compiler. Here is where the preprocessor can choke at your broken + source code. Once preprocessor failes to parse your code it will throw an + exception which site-C-ing will catch and pass to the exception handler component. Want to read more about preprocessor exception + handling? +

+

+ After the preprocessing stage is over we have a great opportunity to catch + the compile-time errors. After site-C-ing fails to compile the + component it throws another exception and passes it to the same handler which + may show you some information on what's gone wrong with your source code from + the compiler's perspective. If you've gone this far you definitely want to read more about the compiler error handling. +

+

+ Note, that it is likely that you will want to disable the steps above for the + production environment to save time on unnecessary checking whether the + component is up to date. +

+

+ Finally, we need to execute the component and present its output to the web + site visitor. This is also where things may go wrong and here is where your + component may throw an exception for the engine to catch and pass to the + handler. Feel free to learn more about it + as well. +

+

+ One more thing you will likely want to have differently in production + environment is an exception handler + which will not give out that much unnecessary information to the user. +

+ diff --git a/htdocs/exceptions/preprocess.chtml b/htdocs/exceptions/preprocess.chtml new file mode 100644 index 0000000..8516139 --- a/dev/null +++ b/htdocs/exceptions/preprocess.chtml @@ -0,0 +1,46 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive layout = "/ancestry/layout.chtml"; +<%constructor> + b_strict = false; + +<%codemethod string title() %> + return "preprocessor exceptions handling"; + +<%method void content() %> +

site-C-ing preprocessor exception handling

+

+ It was one of those days when you just can't type right and can't think of + what you're typing. It is not unusual that, under such circumstances, you end + up with a code like this -- by the time you were + about to close your <%code> block you were thinking about + some constructor in some component elsewhere in the universe. +

+

+ site-C-ing parser will see the inconsistency and throw an exception + which will be caught and passed to the handler, specified in the configuration file, which will produce + some nice, human-readable output. Well, + you may not wish to give out all this information in the production + environment, so you just put in your configuration file some different handler, which just gives user a friendly yet lame excuse. +

+ +
+ +
+ + diff --git a/htdocs/exceptions/production/.htaccess b/htdocs/exceptions/production/.htaccess new file mode 100644 index 0000000..01cb5ec --- a/dev/null +++ b/htdocs/exceptions/production/.htaccess @@ -0,0 +1,3 @@ + + deny from all + diff --git a/htdocs/exceptions/production/.scrc b/htdocs/exceptions/production/.scrc new file mode 100644 index 0000000..d97eeb4 --- a/dev/null +++ b/htdocs/exceptions/production/.scrc @@ -0,0 +1,2 @@ +ExceptionHandler /handlers/exception_prod +AutoBuildFiles -* diff --git a/htdocs/exceptions/production/compile.chtml b/htdocs/exceptions/production/compile.chtml new file mode 100644 index 0000000..3611ca9 --- a/dev/null +++ b/htdocs/exceptions/production/compile.chtml @@ -0,0 +1,12 @@ + + + I'm gonna make a number of mistakes! + + +% ind a = 2; +% #include "erroneous.h" +% unsigned int a = -1; +% int j = k; + + +% /* vim:set ft=sitecing: */ diff --git a/htdocs/exceptions/production/compile.html b/htdocs/exceptions/production/compile.html new file mode 100644 index 0000000..faa0ab9 --- a/dev/null +++ b/htdocs/exceptions/production/compile.html @@ -0,0 +1,44 @@ + + + + + Server-side exception + + + +

server-side exception

+

Something has gone really wrong with the server. Feel free to report the + incident to webmaster.

+
Powered by site-C-ing.
+ + diff --git a/htdocs/exceptions/production/erroneous.h b/htdocs/exceptions/production/erroneous.h new file mode 100644 index 0000000..060a57e --- a/dev/null +++ b/htdocs/exceptions/production/erroneous.h @@ -0,0 +1 @@ + a+2=5; diff --git a/htdocs/exceptions/production/preprocess.chtml b/htdocs/exceptions/production/preprocess.chtml new file mode 100644 index 0000000..f7405e7 --- a/dev/null +++ b/htdocs/exceptions/production/preprocess.chtml @@ -0,0 +1,14 @@ + + +

+ I was writing this component in a hurry, having a lot of things to distract + me, so no wonder I made mistake. + <%code> + /* I do not even remember what I was going to put in this code block. And + * of course I didn't mean to forget that this is just a block of code, not + * a constructor... + */ + +

+ + diff --git a/htdocs/exceptions/production/runtime.chtml b/htdocs/exceptions/production/runtime.chtml new file mode 100644 index 0000000..4a494bd --- a/dev/null +++ b/htdocs/exceptions/production/runtime.chtml @@ -0,0 +1,16 @@ +%%decl #include +<%code> + try{ + try{ + try{ + throw konforka::exception(CODEPOINT,"throwing an exception to backtrace a bit"); + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + }catch(konforka::exception& ke){ + ke.see(CODEPOINT); throw; + } + diff --git a/htdocs/exceptions/runtime.chtml b/htdocs/exceptions/runtime.chtml new file mode 100644 index 0000000..d0a8e14 --- a/dev/null +++ b/htdocs/exceptions/runtime.chtml @@ -0,0 +1,47 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive layout = "/ancestry/layout.chtml"; +<%constructor> + b_strict = false; + +<%codemethod string title() %> + return "runtime exceptions handling"; + +<%method void content() %> +

site-C-ing runtime exception handling

+

+ The component may throw an exception while executing and the + site-C-ing will gladly pass it to the handler component which will + give the user appropriate output (unless it throws an exception itself, of + course). Here you will see an example output provided by the handler bundled + with the site-C-ing. +

+ +

+ Suppose you have a component, + which at some point throws an exception. Of course, site-C-ing will + catch the exception and pass it to the handler, specified in the configuration file, which will produce + some nice, human-readable output. Well, + you may not wish to give out all this information in the production + environment, so you just put in your configuration file some different handler, which just gives user a friendly yet lame excuse. +

+ +
+ +
+ + diff --git a/htdocs/handlers/.htaccess b/htdocs/handlers/.htaccess new file mode 100644 index 0000000..8d2f256 --- a/dev/null +++ b/htdocs/handlers/.htaccess @@ -0,0 +1 @@ +deny from all diff --git a/htdocs/handlers/exception_dev b/htdocs/handlers/exception_dev new file mode 100644 index 0000000..d8c84e1 --- a/dev/null +++ b/htdocs/handlers/exception_dev @@ -0,0 +1,346 @@ +%%decl using namespace std; +<%impl> + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + +%%var string message; +%%var string root_source; +%%var string root_intermediate; +%%var string root_so; +%%var string component; +%%var int line_number = -1; +%%var const exception* exception_caught; +<%code> + __SCIF->headers.clear(); + __SCIF->out->seekp(0); + int magic = _magic; + va_list va = _args; + switch(magic) { + case sitecing::__magic_compile_error: + message = va_arg(va,const char*); + root_source = va_arg(va,const char*); + root_intermediate = va_arg(va,const char*); + root_so = va_arg(va,const char*); + component = va_arg(va,const char*); + break; + case sitecing::__magic_preprocess_error: + message = va_arg(va,const char*); + root_source = va_arg(va,const char*); + root_intermediate = va_arg(va,const char*); + root_so = va_arg(va,const char*); + component = va_arg(va,const char*); + line_number = va_arg(va,int); + break; + case sitecing::__magic_generic_exception: + message = va_arg(va,const char*); + root_source = va_arg(va,const char*); + root_intermediate = va_arg(va,const char *); + root_so = va_arg(va,const char *); + component = va_arg(va,const char*); + exception_caught = va_arg(va,const exception*); + break; + default: + break; + } + + + + + <% message %> + +% __SCIF->headers["Content-Type"]="text/html; charset=utf-8"; +% __SCIF->headers["Pragma"]="no-cache"; + + + <%code> + switch(magic) { + case sitecing::__magic_compile_error: + handle_compile_error(); + break; + case sitecing::__magic_preprocess_error: + handle_preprocess_error(); + break; + case sitecing::__magic_generic_exception: + handle_generic_exception(); + break; + default: + handle_unknown_error(); + break; + } + +
Powered by site-C-ing.
+ + +<%method void handle_generic_exception() %> +
+

exception caught while running component '<% component %>'

+
+
typeid(e).name()
+% int destat; +% char *demangled = abi::__cxa_demangle(typeid(*exception_caught).name(),NULL,NULL,&destat); +
<% destat?typeid(*exception_caught).name():demangled %>
+% if(!destat) free(demangled); +
e.what()
+
<% message %>
+% if(typeid(*exception_caught)==typeid(konforka::exception&)) { +% konforka::exception* ke = (konforka::exception*)exception_caught; +
e.where()
+
+% if(ke->_where.line<0) { + <% ke->where() %> +% }else{ + <% strip_roots(ke->_where.file) %>:<% ke->_where.line %> [<% ke->_where.function %>] +% } +
+% } +
+% if(typeid(*exception_caught)==typeid(konforka::exception&)) { +% konforka::exception* ke = (konforka::exception*)exception_caught; +% if(ke->_where.line>=0) { +% report_error(ke->_where.file,ke->_where.line,ke->what()); +% } +% if(!ke->_seen.empty()) { +

seen at:

+
+% for(list::const_iterator i=ke->_seen.begin();i!=ke->_seen.end();++i) { +% if(i->line>=0) { +% report_error(i->file,i->line,i->function); +% } +% } +
+% } +% } +
+ +<%method void handle_preprocess_error() %> +
+

error preprocessing component '<% component %>'

+% report_error(root_source+component,line_number,message); +
+ +<%method void handle_compile_error() %> +
+

error compiling component '<% component %>'

+ <%code> + ifstream err((root_intermediate+component+".stderr").c_str(),ios::in); + if(err.bad()) { + <%output> + Failed to access compiler output + + }else{ + string cumulative; + string error_file; + long error_line = -1; + while(!err.eof()) { + string oef = error_file; + long oel = error_line; + string line; + getline(err,line); + if(line[0]!=' ') { + string::size_type c = line.find(':'); + if(c!=string::npos) { + string fn = line.substr(0,c); + string::size_type c1 = line.find(':',c+1); + if(c1!=string::npos) { + string ln = line.substr(c+1,c1-c-1); + string::size_type nd = ln.find_first_not_of("0123456789"); + if(nd==string::npos) { + try { + error_file = sitecing::strip_prefix(fn,"In file included from "); + }catch(sitecing::utility_no_prefix& unp) { + error_file = fn; + } + error_line = strtol(ln.c_str(),0,10); + } + } + } + if((oel>0 && !oef.empty()) && (oel!=error_line || oef!=error_file)) { + string ef = "/"+sitecing::combine_path(root_source+component,oef); + report_error(ef,oel,remove_roots(cumulative)); + cumulative.clear(); + } + } + if(!cumulative.empty()) + cumulative += '\n'; + cumulative += line; + } + if(!(cumulative.empty() || error_file.empty() || error_line<0)) { + error_file = "/"+sitecing::combine_path(root_source+component,error_file); + report_error(error_file,error_line,remove_roots(cumulative)); + } + } + +
+ +<%method void handle_unknown_error() %> +
+

unknown error

+
+ +<%method void report_error(const string& file,long line,const string& message) %> +
+

<% sitecing::html_escape(strip_roots(file)) %>

+ <%code> + if(line>=0) { + int firstline = line-5, lastline = line+5; + if(firstline<1) + firstline = 1; + ifstream ifs(file.c_str(),ios::in); + if(ifs.bad()) { + // TODO: + }else{ + for(int l=1;l
    + for(int l=firstline;l<=lastline && !ifs.eof();l++) { + string str; + getline(ifs,str); + for(string::size_type t=str.find('\t');t!=string::npos;t=str.find('\t')) { + str.replace(t,1,8-(t%8),' '); + } + char tln[16]; + snprintf(tln,sizeof(tln),"%5d",l); + <%output> +
  • "><% sitecing::html_escape(tln,sitecing::html_escape_nbsp) %> <% sitecing::html_escape(str,sitecing::html_escape_nbsp) %>
  • + + } + <%output>
+ } + } + } + +
+ <% sitecing::html_escape(message,sitecing::html_escape_br) %> +
+
+ +<%codemethod string strip_roots(const string& filename) %> + string np = sitecing::normalize_path(filename); + try{ + return sitecing::strip_prefix(np,root_source); + }catch(sitecing::utility_no_prefix& e){ } + try{ + return sitecing::strip_prefix(np,root_intermediate); + }catch(sitecing::utility_no_prefix& e){ } + +<%codemethod string remove_roots(const string& str) %> + string rv = str; + string::size_type rp; + string::size_type rl = root_source.length(); + while((rp=rv.find(root_source))!=string::npos) { + rv.erase(rp,rl); + } + rl = root_intermediate.length(); + while((rp=rv.find(root_intermediate))!=string::npos) { + rv.erase(rp,rl); + } + rl = root_so.length(); + while((rp=rv.find(root_so))!=string::npos) { + rv.erase(rp,rl); + } + return rv; + +% /* vim:set ft=sitecing: */ diff --git a/htdocs/handlers/exception_prod b/htdocs/handlers/exception_prod new file mode 100644 index 0000000..9768623 --- a/dev/null +++ b/htdocs/handlers/exception_prod @@ -0,0 +1,52 @@ +<%code> + /* vim:set ft=sitecing: */ + __SCIF->headers.clear(); /* reset all headers possibly set by the component throwing an exception. */ + __SCIF->out->seekp(0); /* rollback the output that the exceptional component may have produced. */ + /* set out headers */ + __SCIF->headers["Content-Type"] = "text/html"; + __SCIF->headers["Status"] = "500 server-side exception"; + __SCIF->headers["Pragma"] = "no-cache"; + + + + + Server-side exception + + + +

server-side exception

+

Something has gone really wrong with the server. Feel free to report the + incident to " title="e-mail + server administrator">webmaster.

+
Powered by site-C-ing.
+ + diff --git a/htdocs/index.chtml b/htdocs/index.chtml new file mode 100644 index 0000000..aa0979a --- a/dev/null +++ b/htdocs/index.chtml @@ -0,0 +1,46 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive layout = "/ancestry/layout.chtml"; +<%codemethod string title() %> + return "introduction"; + +<%method void content() %> +

introduction to site-C-ing

+

+ This is a sample site, which is supposed to demonstrate site-C-ing + features. Since the site-C-ing is still at the early stages of + development or rather proof of concept, this site is also far from being + complete. I am planning to add more pages as the time permits, though. +

+

+ Once you download and install site-C-ing you may wish to try + this sample site for yourself. The source is available from the site-C-ing download + page. After you download the source code, you should configure it using + the ever so popular configure script. It is likely that you will + want to pass the --with-vhostname option to configure to name + the apache virtual host. +

+

+ The configure script will generate the apache vhost configuration for you, + which you can Include in the main apache configuration file. +

+

+ Note, that the configuration is tailored for apache 2.x. It is no problem to + get it working with apache 1.3.x, although I haven't tried and so I am not + sure if it will run out of the box (your patches are welcome). Also note that you + will need mod_fastcgi apache module, which + is the only CGI-interface supported by the site-C-ing engine at the + moment. +

+

+ Once you get it all done you will want to restart your apache and start the + site-C-ing fastcgi server by issuing the make restart + command. +

+

+ Before you download it, you may wish to examine the sources to learn more about how it is done. +

+ diff --git a/htdocs/sources.chtml b/htdocs/sources.chtml new file mode 100644 index 0000000..b1eeed3 --- a/dev/null +++ b/htdocs/sources.chtml @@ -0,0 +1,47 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive layout = "/ancestry/layout.chtml"; +%%derive sources = "/ancestry/sources.chtml"; +<%impl> + #include + +<%constructor> + b_strict = false; + +<%codemethod string title() %> + return "runtime exceptions handling"; + +<%method void content() %> +

browse this site sources

+ +
    +% for(int n=0;n<% sf.dir %>/
      +% }else{ /* the end */ +
    +% } +% }else{ +
  • <% sf.name %>
  • +% } +% } +
+ + <%code> + string rfile = sitecing::normalize_path( + sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/sources.chtml"), + sitecing::restrict_dotdot|sitecing::strip_leading_slash ); + if(rfile.empty()) + rfile = "about:blank"; + else + rfile = "/view/"+rfile; + +
+ +
+ + diff --git a/htdocs/style.css b/htdocs/style.css new file mode 100644 index 0000000..01fd43a --- a/dev/null +++ b/htdocs/style.css @@ -0,0 +1,168 @@ +body { + font-family: sans-serif; + font-size: 11pt; +} + +a { + text-decoration: none; +} +a:hover { + text-decoration: underline; +} +p { + margin: 1ex 1em; + text-indent: 2em; + text-align: justify; +} +p.note { + margin-left: 10%; + border-width: 1px 1px 1px 6px; + border-color: gray gray gray #0000a0; + border-style: solid solid solid double; + padding: 1ex 1ex 1ex 2em; + font-size: 80%; + background: #c0c0e0; + color: #202020; +} +code { + color: #d04040; +} +em { + white-space: nowrap; +} + +div.google_ad { + text-align: center; + margin: 1ex; +} +div.google_ad.top { + padding-bottom: 1ex; + border-bottom: 1px gray solid; +} +div.google_ad.bottom { + padding-top: 1ex; + border-top: 1px gray solid; +} + +div#sidepanel { + position: absolute; top: 0px; left: 0px; + margin: 0px; + width: 20%; + font-size: 80%; +} +div#content { + position: absolute; top: 0px; right: -0px; + margin: 0px; + width: 80%; +} + +div#sidepanel h1 { + font-size: 80%; + text-align: center; + font-weight: normal; + color: #004080; + white-space: nowrap; + margin-top: 2ex; margin-bottom: 2ex; +} +div#sidepanel ul { + padding: 1ex 0.5ex 1ex 1ex; + margin: 0.5ex; + border-color: #c0c0c0 #404040 #404040 #c0c0c0; + border-width: 1px 2px 2px 1px; + border-style: solid; + background: #d0d0d0; + list-style-type: none; +} +div#sidepanel ul ul { + margin: 0px; padding: 0px; + border: none 0px; +} +div#sidepanel li { + list-style-type: none; + margin: 0px; padding: 0px; + display: block; +} +div#sidepanel ul a { + display: block; + padding: 1px 1ex; + margin: 0.5ex; + border: 1px solid gray; + text-decoration: none; + background: white; + color: black; +} +div#sidepanel ul a:hover { + background: gray; + color: white; +} +div#sidepanel ul ul a { + padding-left: 2.5ex; + background: #e0e0e0; +} +div#sidepanel div.copyright { + text-align: center; +} + +div#content h1 { + font-size: 140%; + color: gray; + font-weight: bold; + text-align: center; + margin: 1em; +} + +div.insert { + text-align: center; +} +iframe#insert { + border: 1px solid black; +} + +div.source h1 { + background: #e0e0e0; + border: 1px solid #808080; + padding-left: 1em; + margin: 0px; + font-size: 100%; + color: #000060; + overflow: hidden; +} +div.source ul { + background: #80c0c0; + margin: 0px; + padding: 1px 0.5ex; + font-family: monospace; + font-size: 80%; + overflow: hidden; +} +div.source li { + list-style-type: none; + white-space: nowrap; +} + +ul.sourcebrowser { + font-size: 70%; +} +ul.sourcebrowser ul.dir { + padding: 1px 0px 2px 1em; + margin: 1px 0px 1px 0px; +} +ul.sourcebrowser li.dir { + margin: 1px 0px 1px 0px; +} +ul.sourcebrowser li.file { + list-style-type: none; + white-space: nowrap; + display: inline; +} +ul.sourcebrowser li.file a { + border: 1px solid gray; + padding: 1px 0.5ex; + text-decoration: none; + font-family: monospace; +} +ul.sourcebrowser li.file a:hover { + background: gray; + border: 1px solid black; + color: white; +} diff --git a/htdocs/view.chtml b/htdocs/view.chtml new file mode 100644 index 0000000..d885330 --- a/dev/null +++ b/htdocs/view.chtml @@ -0,0 +1,54 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive page = "/ancestry/page.chtml"; +%%derive sources = "/ancestry/sources.chtml"; +<%impl> + #include + #include + using namespace std; + #include + #include + #include + #include "acconfig.h" + +<%codemethod string title() %> + return "introduction"; + +<%method void body() %> + <%code> + string rfile = sitecing::normalize_path( + sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"), + sitecing::restrict_dotdot|sitecing::strip_leading_slash ); + sourcefile_t *sof = 0; + for(int n=0;nname && sof->dir) { + if(sitecing::normalize_path(sitecing::combine_path(sof->dir,sof->name,0),sitecing::strip_leading_slash)==rfile) + break; + } + sof = 0; + } + if(!sof) + throw konforka::exception(CODEPOINT,"no access to the file allowed"); + string afile = sitecing::combine_path(WEB_ROOT,rfile,0); + +
+

<% rfile %>

+
    + <%code> + ifstream sf(afile.c_str()); + if(!sf.good()) + throw konforka::exception(CODEPOINT,"could not open source file"); + while(!sf.eof()) { + string sfl; + getline(sf,sfl); + for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) { + sfl.replace(t,1,8-(t%8),' '); + } + <%output> +
  • <% sfl.empty()?" ":sitecing::html_escape(sfl,sitecing::html_escape_nbsp) %>
  • + + } + +
+
+ diff --git a/include/.gitignore b/include/.gitignore new file mode 100644 index 0000000..c63497a --- a/dev/null +++ b/include/.gitignore @@ -0,0 +1,3 @@ +acconfig.h +acconfig.h.in +stamp-h1 -- cgit v0.9.0.2