summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2005-04-03 11:49:01 (UTC)
committer Michael Krelin <hacker@klever.net>2005-04-03 11:49:01 (UTC)
commitd3e8a3f68b62668af9bc992e94dfb3c822d270dc (patch) (unidiff)
tree87a5f43f5075dcfc0c0033a4ca50eb990d498e70
parent85471d7c2c74035399ba7047f409fe6248e1d6f0 (diff)
downloadsitecing-d3e8a3f68b62668af9bc992e94dfb3c822d270dc.zip
sitecing-d3e8a3f68b62668af9bc992e94dfb3c822d270dc.tar.gz
sitecing-d3e8a3f68b62668af9bc992e94dfb3c822d270dc.tar.bz2
made use of pragma main
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--htdocs/ancestry/layout.chtml4
-rw-r--r--htdocs/exceptions/compile.chtml3
-rw-r--r--htdocs/exceptions/index.chtml3
-rw-r--r--htdocs/exceptions/preprocess.chtml3
-rw-r--r--htdocs/exceptions/runtime.chtml3
-rw-r--r--htdocs/index.chtml4
-rw-r--r--htdocs/quickref/index.chtml3
-rw-r--r--htdocs/quickref/metasyntax.chtml3
-rw-r--r--htdocs/simple.chtml3
-rw-r--r--htdocs/sources.chtml3
-rw-r--r--htdocs/view.chtml3
11 files changed, 22 insertions, 13 deletions
diff --git a/htdocs/ancestry/layout.chtml b/htdocs/ancestry/layout.chtml
index 4551d04..64d1cd2 100644
--- a/htdocs/ancestry/layout.chtml
+++ b/htdocs/ancestry/layout.chtml
@@ -1,66 +1,66 @@
1% html(); return; /* vim:set ft=sitecing: */ 1%%derive page = "/ancestry/page.chtml"; /* vim:set ft=sitecing: */
2%%derive page = "/ancestry/page.chtml"; 2%%pragma main=page
3<%decl> 3<%decl>
4 #define PN_PREV(h,d,t) urlPrev=h; descPrev=d; titlePrev=t; 4 #define PN_PREV(h,d,t) urlPrev=h; descPrev=d; titlePrev=t;
5 #define PN_NEXT(h,d,t) urlNext=h; descNext=d; titleNext=t; 5 #define PN_NEXT(h,d,t) urlNext=h; descNext=d; titleNext=t;
6</%decl> 6</%decl>
7%%impl #include <sitecing/util.h> 7%%impl #include <sitecing/util.h>
8%%impl #include "acconfig.h" 8%%impl #include "acconfig.h"
9%%var bool b_svn = false; 9%%var bool b_svn = false;
10%%var std::string urlPrev; 10%%var std::string urlPrev;
11%%var std::string descPrev; 11%%var std::string descPrev;
12%%var std::string titlePrev; 12%%var std::string titlePrev;
13%%var std::string urlNext; 13%%var std::string urlNext;
14%%var std::string descNext; 14%%var std::string descNext;
15%%var std::string titleNext; 15%%var std::string titleNext;
16<%constructor> 16<%constructor>
17 if(strstr(PACKAGE_STRING,"svn")) 17 if(strstr(PACKAGE_STRING,"svn"))
18 b_svn = true; 18 b_svn = true;
19</%constructor> 19</%constructor>
20<%method void prevnext() %> 20<%method void prevnext() %>
21% if(urlPrev.empty() && urlNext.empty()) return; 21% if(urlPrev.empty() && urlNext.empty()) return;
22% if(descPrev.empty() && descNext.empty()) return; 22% if(descPrev.empty() && descNext.empty()) return;
23 <div class="prevnext"> 23 <div class="prevnext">
24% if(!(urlPrev.empty() || descPrev.empty())) { 24% if(!(urlPrev.empty() || descPrev.empty())) {
25 <a class="prevnext-prev" href="<% urlPrev %>" title="<% sitecing::html_escape(titlePrev.empty()?descPrev:titlePrev) %>">&#9668;&nbsp;&nbsp;<% sitecing::html_escape(descPrev) %></a> 25 <a class="prevnext-prev" href="<% urlPrev %>" title="<% sitecing::html_escape(titlePrev.empty()?descPrev:titlePrev) %>">&#9668;&nbsp;&nbsp;<% sitecing::html_escape(descPrev) %></a>
26% } 26% }
27% if(!(urlNext.empty() || descNext.empty())) { 27% if(!(urlNext.empty() || descNext.empty())) {
28 <a class="prevnext-next" href="<% urlNext %>" title="<% sitecing::html_escape(titleNext.empty()?descNext:titleNext) %>"><% sitecing::html_escape(descNext) %>&nbsp;&nbsp;&#9658;</a> 28 <a class="prevnext-next" href="<% urlNext %>" title="<% sitecing::html_escape(titleNext.empty()?descNext:titleNext) %>"><% sitecing::html_escape(descNext) %>&nbsp;&nbsp;&#9658;</a>
29% } 29% }
30 </div> 30 </div>
31</%method> 31</%method>
32<%method void body() %> 32<%method void body() %>
33 <div id="content"> 33 <div id="content">
34 <%code> 34 <%code>
35 if(!access(WEB_RUN_ROOT "/conf/banner_top",R_OK)) { 35 if(!access(WEB_RUN_ROOT "/conf/banner_top",R_OK)) {
36 pass_file_through(WEB_RUN_ROOT "/conf/banner_top"); 36 pass_file_through(WEB_RUN_ROOT "/conf/banner_top");
37 } 37 }
38 prevnext(); 38 prevnext();
39 content(); 39 content();
40 if(b_strict && !access(WEB_RUN_ROOT "/conf/banner_bottom",R_OK)) { 40 if(b_strict && !access(WEB_RUN_ROOT "/conf/banner_bottom",R_OK)) {
41 pass_file_through(WEB_RUN_ROOT "/conf/banner_bottom"); 41 pass_file_through(WEB_RUN_ROOT "/conf/banner_bottom");
42 } 42 }
43 </%code> 43 </%code>
44 </div> 44 </div>
45 <div id="sidepanel"> 45 <div id="sidepanel">
46% sidepanel(); 46% sidepanel();
47 </div> 47 </div>
48</%method> 48</%method>
49<%method void content() %> 49<%method void content() %>
50</%method> 50</%method>
51<%method void sidepanel() %> 51<%method void sidepanel() %>
52 <h1><% PACKAGE_STRING %></h1> 52 <h1><% PACKAGE_STRING %></h1>
53% if(b_svn) { 53% if(b_svn) {
54 <h2>The site is running source from the source repository which may differ 54 <h2>The site is running source from the source repository which may differ
55 from the one available for download. You can check it out from the <a 55 from the one available for download. You can check it out from the <a
56 href="http://kin.klever.net/sitecing/repository">source repository</a>.</h2> 56 href="http://kin.klever.net/sitecing/repository">source repository</a>.</h2>
57% } 57% }
58% /* thank MSIE for this awful formatting */ 58% /* thank MSIE for this awful formatting */
59 <ul><li><a href="/" title="introduction to site-C-ing">overview</a><ul><li><a href="/simple" title="building a really simple page">simple page</a></li></ul></li><li><a href="/exceptions/" title="exceptions handling">exceptions</a><ul><li><a href="/exceptions/preprocess" title="preprocessor errors">preprocess</a></li><li><a href="/exceptions/compile" title="compiler errors">compile-time</a></li><li><a href="/exceptions/runtime" title="runtime exceptions">runtime</a></li></ul></li><li><a href="/quickref/" title="quick reference">reference</a><ul><li><a href="/quickref/metasyntax" title="meta syntax">syntax</a></li></ul></li><li><a href="/sources" title="browse this site source files">sources</a></li></ul> 59 <ul><li><a href="/" title="introduction to site-C-ing">overview</a><ul><li><a href="/simple" title="building a really simple page">simple page</a></li></ul></li><li><a href="/exceptions/" title="exceptions handling">exceptions</a><ul><li><a href="/exceptions/preprocess" title="preprocessor errors">preprocess</a></li><li><a href="/exceptions/compile" title="compiler errors">compile-time</a></li><li><a href="/exceptions/runtime" title="runtime exceptions">runtime</a></li></ul></li><li><a href="/quickref/" title="quick reference">reference</a><ul><li><a href="/quickref/metasyntax" title="meta syntax">syntax</a></li></ul></li><li><a href="/sources" title="browse this site source files">sources</a></li></ul>
60 <%code> 60 <%code>
61 if(!access(WEB_RUN_ROOT "/conf/banner_side",R_OK)) { 61 if(!access(WEB_RUN_ROOT "/conf/banner_side",R_OK)) {
62 pass_file_through(WEB_RUN_ROOT "/conf/banner_side"); 62 pass_file_through(WEB_RUN_ROOT "/conf/banner_side");
63 } 63 }
64 </%code> 64 </%code>
65 <ul><li><a href="http://kin.klever.net/sitecing/" title="main site-C-ing page">site-C-ing</a></li><li><a href="http://kin.klever.net/sitecing/sources" title="site-C-ing download page">downloads</a></li></ul> 65 <ul><li><a href="http://kin.klever.net/sitecing/" title="main site-C-ing page">site-C-ing</a></li><li><a href="http://kin.klever.net/sitecing/sources" title="site-C-ing download page">downloads</a></li></ul>
66 <div class="copyright"> 66 <div class="copyright">
diff --git a/htdocs/exceptions/compile.chtml b/htdocs/exceptions/compile.chtml
index 68dd034..94bd2e1 100644
--- a/htdocs/exceptions/compile.chtml
+++ b/htdocs/exceptions/compile.chtml
@@ -1,52 +1,53 @@
1% html(); return; /* vim:set ft=sitecing: */ 1% /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml"; 2%%derive layout = "/ancestry/layout.chtml";
3%%pragma main=page
3<%constructor> 4<%constructor>
4 b_strict = false; 5 b_strict = false;
5 PN_PREV("/exceptions/preprocess","preprocess","preprocessing errors"); 6 PN_PREV("/exceptions/preprocess","preprocess","preprocessing errors");
6 PN_NEXT("/exceptions/runtime","runtime","runtime exceptions"); 7 PN_NEXT("/exceptions/runtime","runtime","runtime exceptions");
7</%constructor> 8</%constructor>
8<%codemethod string title() %> 9<%codemethod string title() %>
9 return "compile-time exceptions handling"; 10 return "compile-time exceptions handling";
10</%codemethod> 11</%codemethod>
11<%method void content() %> 12<%method void content() %>
12 <h1>site-C-ing compile-time exception handling</h1> 13 <h1>site-C-ing compile-time exception handling</h1>
13 <p> 14 <p>
14 Similar to <a href="/exceptions/preprocess">preprocessing exceptions</a> 15 Similar to <a href="/exceptions/preprocess">preprocessing exceptions</a>
15 there is a wide range of errors you may put into your code which will pass 16 there is a wide range of errors you may put into your code which will pass
16 through preprocessor and will be caught later at the compile-time. 17 through preprocessor and will be caught later at the compile-time.
17 </p> 18 </p>
18 <p> 19 <p>
19 Once you complete writing your <a 20 Once you complete writing your <a
20 href="/view/htdocs/exceptions/development/compile.chtml" target="insert" 21 href="/view/htdocs/exceptions/development/compile.chtml" target="insert"
21 title="the link opens in the frame below">erroneous code</a> and 22 title="the link opens in the frame below">erroneous code</a> and
22 <em>site-C-ing</em> is done preprocessing it, it will feed the preprocessed 23 <em>site-C-ing</em> is done preprocessing it, it will feed the preprocessed
23 code into c++ compiler which will refuse to compile the code like this. This 24 code into c++ compiler which will refuse to compile the code like this. This
24 is where <a href="/view/htdocs/handlers/exception_dev" target="insert" 25 is where <a href="/view/htdocs/handlers/exception_dev" target="insert"
25 title="the link opens in the frame below">the exception handler</a>, 26 title="the link opens in the frame below">the exception handler</a>,
26 specified in <a href="/view/htdocs/exceptions/development/.scrc" 27 specified in <a href="/view/htdocs/exceptions/development/.scrc"
27 target="insert" title="the link opens in the frame below">the configuration 28 target="insert" title="the link opens in the frame below">the configuration
28 file</a>, takes over the process and gives you <a 29 file</a>, takes over the process and gives you <a
29 href="/exceptions/development/compile" target="insert" title="the link opens 30 href="/exceptions/development/compile" target="insert" title="the link opens
30 in the frame below">the report</a>. Like with any handler, you may wish to 31 in the frame below">the report</a>. Like with any handler, you may wish to
31 set some <a href="/view/htdocs/handlers/exception_prod" target="insert" 32 set some <a href="/view/htdocs/handlers/exception_prod" target="insert"
32 title="the link opens in the frame below">different handler</a> in your <a 33 title="the link opens in the frame below">different handler</a> in your <a
33 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the 34 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
34 link opens in the frame below">production configuration</a>, which just gives 35 link opens in the frame below">production configuration</a>, which just gives
35 user <a href="/exceptions/production/preprocess" target="insert" title="the 36 user <a href="/exceptions/production/preprocess" target="insert" title="the
36 link opens in the frame below">a friendly yet lame excuse</a>. 37 link opens in the frame below">a friendly yet lame excuse</a>.
37 </p> 38 </p>
38 <p class="note"> 39 <p class="note">
39 Note, that these output pages are fakes -- I do not want to spawn the 40 Note, that these output pages are fakes -- I do not want to spawn the
40 compiler each time you want to see the output and put this unnecessary load 41 compiler each time you want to see the output and put this unnecessary load
41 on cpu. These static pages are in fact saved output of the real exception 42 on cpu. These static pages are in fact saved output of the real exception
42 handlers. 43 handlers.
43 </p> 44 </p>
44 45
45 <div class="insert"> 46 <div class="insert">
46 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300"> 47 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
47 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to 48 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
48 support it. That is okay, it still will open links somehow.</p> 49 support it. That is okay, it still will open links somehow.</p>
49 </iframe> 50 </iframe>
50 </div> 51 </div>
51 52
52</%method> 53</%method>
diff --git a/htdocs/exceptions/index.chtml b/htdocs/exceptions/index.chtml
index 6bb2a3c..c700e42 100644
--- a/htdocs/exceptions/index.chtml
+++ b/htdocs/exceptions/index.chtml
@@ -1,56 +1,57 @@
1% html(); return; /* vim:set ft=sitecing: */ 1% /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml"; 2%%derive layout = "/ancestry/layout.chtml";
3%%pragma main=page
3<%constructor> 4<%constructor>
4 PN_PREV("/simple","simple page","building a really simple page"); 5 PN_PREV("/simple","simple page","building a really simple page");
5 PN_NEXT("/exceptions/preprocess","preprocess","preprocessing errors"); 6 PN_NEXT("/exceptions/preprocess","preprocess","preprocessing errors");
6</%constructor> 7</%constructor>
7<%codemethod string title() %> 8<%codemethod string title() %>
8 return "exceptions handling"; 9 return "exceptions handling";
9</%codemethod> 10</%codemethod>
10<%method void content() %> 11<%method void content() %>
11 <h1>site-C-ing exception handling</h1> 12 <h1>site-C-ing exception handling</h1>
12 <p> 13 <p>
13 The purpose of this section is to give an overview of the <em>site-C-ing</em> 14 The purpose of this section is to give an overview of the <em>site-C-ing</em>
14 exception handling mechanism. Before the web visitor can see the page each 15 exception handling mechanism. Before the web visitor can see the page each
15 site-C-ing component goes through a few stages, namely, preprocessing, 16 site-C-ing component goes through a few stages, namely, preprocessing,
16 compiling and execution. Having three stages to go through also means three 17 compiling and execution. Having three stages to go through also means three
17 stages one can fail to go through and three exciting opportunities to handle 18 stages one can fail to go through and three exciting opportunities to handle
18 different errors. 19 different errors.
19 </p> 20 </p>
20 <p> 21 <p>
21 First each component is preprocessed so that you can feed the valid c++ code 22 First each component is preprocessed so that you can feed the valid c++ code
22 to the compiler. Here is where the preprocessor can choke at your broken 23 to the compiler. Here is where the preprocessor can choke at your broken
23 source code. Once preprocessor failes to parse your code it will throw an 24 source code. Once preprocessor failes to parse your code it will throw an
24 exception which <em>site-C-ing</em> will catch and pass to <a 25 exception which <em>site-C-ing</em> will catch and pass to <a
25 href="/sources/htdocs/handlers/exception_dev" title="development mode 26 href="/sources/htdocs/handlers/exception_dev" title="development mode
26 exception handler source">the exception handler component</a>. Want to <a 27 exception handler source">the exception handler component</a>. Want to <a
27 href="/exceptions/preprocess">read more</a> about preprocessor exception 28 href="/exceptions/preprocess">read more</a> about preprocessor exception
28 handling? 29 handling?
29 </p> 30 </p>
30 <p> 31 <p>
31 After the preprocessing stage is over we have a great opportunity to catch 32 After the preprocessing stage is over we have a great opportunity to catch
32 the compile-time errors. After <em>site-C-ing</em> fails to compile the 33 the compile-time errors. After <em>site-C-ing</em> fails to compile the
33 component it throws another exception and passes it to the same handler which 34 component it throws another exception and passes it to the same handler which
34 may show you some information on what's gone wrong with your source code from 35 may show you some information on what's gone wrong with your source code from
35 the compiler's perspective. If you've gone this far you definitely want to <a 36 the compiler's perspective. If you've gone this far you definitely want to <a
36 href="/exceptions/compile">read more</a> about the compiler error handling. 37 href="/exceptions/compile">read more</a> about the compiler error handling.
37 </p> 38 </p>
38 <p class="note"> 39 <p class="note">
39 Note, that it is likely that you will want to disable the steps above for the 40 Note, that it is likely that you will want to disable the steps above for the
40 production environment to save time on unnecessary checking whether the 41 production environment to save time on unnecessary checking whether the
41 component is up to date. 42 component is up to date.
42 </p> 43 </p>
43 <p> 44 <p>
44 Finally, we need to execute the component and present its output to the web 45 Finally, we need to execute the component and present its output to the web
45 site visitor. This is also where things may go wrong and here is where your 46 site visitor. This is also where things may go wrong and here is where your
46 component may throw an exception for the engine to catch and pass to the 47 component may throw an exception for the engine to catch and pass to the
47 handler. Feel free to <a href="/exceptions/runtime">learn more</a> about it 48 handler. Feel free to <a href="/exceptions/runtime">learn more</a> about it
48 as well. 49 as well.
49 </p> 50 </p>
50 <p class="note"> 51 <p class="note">
51 One more thing you will likely want to have differently in production 52 One more thing you will likely want to have differently in production
52 environment is <a href="/sources/htdocs/handlers/exception_prod" 53 environment is <a href="/sources/htdocs/handlers/exception_prod"
53 title="production mode exception handler source">an exception handler</a> 54 title="production mode exception handler source">an exception handler</a>
54 which will not give out that much unnecessary information to the user. 55 which will not give out that much unnecessary information to the user.
55 </p> 56 </p>
56</%method> 57</%method>
diff --git a/htdocs/exceptions/preprocess.chtml b/htdocs/exceptions/preprocess.chtml
index 88b8741..e42b102 100644
--- a/htdocs/exceptions/preprocess.chtml
+++ b/htdocs/exceptions/preprocess.chtml
@@ -1,48 +1,49 @@
1% html(); return; /* vim:set ft=sitecing: */ 1% /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml"; 2%%derive layout = "/ancestry/layout.chtml";
3%%pragma main=page
3<%constructor> 4<%constructor>
4 b_strict = false; 5 b_strict = false;
5 PN_PREV("/exceptions","exceptions","exception handling overview"); 6 PN_PREV("/exceptions","exceptions","exception handling overview");
6 PN_NEXT("/exceptions/compile","compile-time","compile-time errors"); 7 PN_NEXT("/exceptions/compile","compile-time","compile-time errors");
7</%constructor> 8</%constructor>
8<%codemethod string title() %> 9<%codemethod string title() %>
9 return "preprocessor exceptions handling"; 10 return "preprocessor exceptions handling";
10</%codemethod> 11</%codemethod>
11<%method void content() %> 12<%method void content() %>
12 <h1>site-C-ing preprocessor exception handling</h1> 13 <h1>site-C-ing preprocessor exception handling</h1>
13 <p> 14 <p>
14 It was one of those days when you just can't type right and can't think of 15 It was one of those days when you just can't type right and can't think of
15 what you're typing. It is not unusual that, under such circumstances, you end 16 what you're typing. It is not unusual that, under such circumstances, you end
16 up with a code like <a 17 up with a code like <a
17 href="/view/htdocs/exceptions/development/preprocess.chtml" target="insert" 18 href="/view/htdocs/exceptions/development/preprocess.chtml" target="insert"
18 title="the link opens in the frame below">this</a> -- by the time you were 19 title="the link opens in the frame below">this</a> -- by the time you were
19 about to close your <code>&lt;%code&gt;</code> block you were thinking about 20 about to close your <code>&lt;%code&gt;</code> block you were thinking about
20 some constructor in some component elsewhere in the universe. 21 some constructor in some component elsewhere in the universe.
21 </p> 22 </p>
22 <p> 23 <p>
23 <em>site-C-ing</em> parser will see the inconsistency and throw an exception 24 <em>site-C-ing</em> parser will see the inconsistency and throw an exception
24 which will be caught and passed to <a 25 which will be caught and passed to <a
25 href="/view/htdocs/handlers/exception_dev" target="insert" title="the link 26 href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
26 opens in the frame below">the handler</a>, specified in <a 27 opens in the frame below">the handler</a>, specified in <a
27 href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the 28 href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
28 link opens in the frame below">the configuration file</a>, which will produce 29 link opens in the frame below">the configuration file</a>, which will produce
29 some nice, human-readable <a href="/exceptions/development/preprocess" 30 some nice, human-readable <a href="/exceptions/development/preprocess"
30 target="insert" title="the link opens in the frame below">output</a>. Well, 31 target="insert" title="the link opens in the frame below">output</a>. Well,
31 you may not wish to give out all this information in the production 32 you may not wish to give out all this information in the production
32 environment, so you just put in your <a 33 environment, so you just put in your <a
33 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the 34 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
34 link opens in the frame below">configuration file</a> some <a 35 link opens in the frame below">configuration file</a> some <a
35 href="/view/htdocs/handlers/exception_prod" target="insert" title="the link 36 href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
36 opens in the frame below">different handler</a>, which just gives user <a 37 opens in the frame below">different handler</a>, which just gives user <a
37 href="/exceptions/production/preprocess" target="insert" title="the link 38 href="/exceptions/production/preprocess" target="insert" title="the link
38 opens in the frame below">a friendly yet lame excuse</a>. 39 opens in the frame below">a friendly yet lame excuse</a>.
39 </p> 40 </p>
40 41
41 <div class="insert"> 42 <div class="insert">
42 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300"> 43 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
43 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to 44 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
44 support it. That is okay, it still will open links somehow.</p> 45 support it. That is okay, it still will open links somehow.</p>
45 </iframe> 46 </iframe>
46 </div> 47 </div>
47 48
48</%method> 49</%method>
diff --git a/htdocs/exceptions/runtime.chtml b/htdocs/exceptions/runtime.chtml
index 1fcd80f..989e89f 100644
--- a/htdocs/exceptions/runtime.chtml
+++ b/htdocs/exceptions/runtime.chtml
@@ -1,49 +1,50 @@
1% html(); return; /* vim:set ft=sitecing: */ 1% /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml"; 2%%derive layout = "/ancestry/layout.chtml";
3%%pragma main=page
3<%constructor> 4<%constructor>
4 b_strict = false; 5 b_strict = false;
5 PN_PREV("/exceptions/compile","compile-time","compile-time errors"); 6 PN_PREV("/exceptions/compile","compile-time","compile-time errors");
6 PN_NEXT("/quickref/","quick reference","quick reference"); 7 PN_NEXT("/quickref/","quick reference","quick reference");
7</%constructor> 8</%constructor>
8<%codemethod string title() %> 9<%codemethod string title() %>
9 return "runtime exceptions handling"; 10 return "runtime exceptions handling";
10</%codemethod> 11</%codemethod>
11<%method void content() %> 12<%method void content() %>
12 <h1>site-C-ing runtime exception handling</h1> 13 <h1>site-C-ing runtime exception handling</h1>
13 <p> 14 <p>
14 The component may throw an exception while executing and the 15 The component may throw an exception while executing and the
15 <em>site-C-ing</em> will gladly pass it to the handler component which will 16 <em>site-C-ing</em> will gladly pass it to the handler component which will
16 give the user appropriate output (unless it throws an exception itself, of 17 give the user appropriate output (unless it throws an exception itself, of
17 course). Here you will see an example output provided by the handler bundled 18 course). Here you will see an example output provided by the handler bundled
18 with the <em>site-C-ing</em>. 19 with the <em>site-C-ing</em>.
19 </p> 20 </p>
20 21
21 <p> 22 <p>
22 Suppose you have <a href="/view/htdocs/exceptions/development/runtime.chtml" 23 Suppose you have <a href="/view/htdocs/exceptions/development/runtime.chtml"
23 target="insert" title="the link opens in the frame below">a component</a>, 24 target="insert" title="the link opens in the frame below">a component</a>,
24 which at some point throws an exception. Of course, <em>site-C-ing</em> will 25 which at some point throws an exception. Of course, <em>site-C-ing</em> will
25 catch the exception and pass it to <a 26 catch the exception and pass it to <a
26 href="/view/htdocs/handlers/exception_dev" target="insert" title="the link 27 href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
27 opens in the frame below">the handler</a>, specified in <a 28 opens in the frame below">the handler</a>, specified in <a
28 href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the 29 href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
29 link opens in the frame below">the configuration file</a>, which will produce 30 link opens in the frame below">the configuration file</a>, which will produce
30 some nice, human-readable <a href="/exceptions/development/runtime" 31 some nice, human-readable <a href="/exceptions/development/runtime"
31 target="insert" title="the link opens in the frame below">output</a>. Well, 32 target="insert" title="the link opens in the frame below">output</a>. Well,
32 you may not wish to give out all this information in the production 33 you may not wish to give out all this information in the production
33 environment, so you just put in your <a 34 environment, so you just put in your <a
34 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the 35 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
35 link opens in the frame below">configuration file</a> some <a 36 link opens in the frame below">configuration file</a> some <a
36 href="/view/htdocs/handlers/exception_prod" target="insert" title="the link 37 href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
37 opens in the frame below">different handler</a>, which just gives user <a 38 opens in the frame below">different handler</a>, which just gives user <a
38 href="/exceptions/production/runtime" target="insert" title="the link opens 39 href="/exceptions/production/runtime" target="insert" title="the link opens
39 in the frame below">a friendly yet lame excuse</a>. 40 in the frame below">a friendly yet lame excuse</a>.
40 </p> 41 </p>
41 42
42 <div class="insert"> 43 <div class="insert">
43 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300"> 44 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
44 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to 45 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
45 support it. That is okay, it still will open links somehow.</p> 46 support it. That is okay, it still will open links somehow.</p>
46 </iframe> 47 </iframe>
47 </div> 48 </div>
48 49
49</%method> 50</%method>
diff --git a/htdocs/index.chtml b/htdocs/index.chtml
index 20d34c2..76d6d7e 100644
--- a/htdocs/index.chtml
+++ b/htdocs/index.chtml
@@ -1,51 +1,51 @@
1% html(); return; /* vim:set ft=sitecing: */ 1%%derive layout = "/ancestry/layout.chtml"; /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml"; 2%%pragma main=page
3<%constructor> 3<%constructor>
4 PN_NEXT("/simple","simple page","building a really simple page"); 4 PN_NEXT("/simple","simple page","building a really simple page");
5</%constructor> 5</%constructor>
6<%codemethod string title() %> 6<%codemethod string title() %>
7 return "introduction"; 7 return "introduction";
8</%codemethod> 8</%codemethod>
9<%method void content() %> 9<%method void content() %>
10 <h1>introduction to site-C-ing</h1> 10 <h1>introduction to site-C-ing</h1>
11 <p> 11 <p>
12 This is a sample site, which is supposed to demonstrate <em>site-C-ing</em> 12 This is a sample site, which is supposed to demonstrate <em>site-C-ing</em>
13 features. Since the <em>site-C-ing</em> is still at the early stages of 13 features. Since the <em>site-C-ing</em> is still at the early stages of
14 development or rather proof of concept, this site is also far from being 14 development or rather proof of concept, this site is also far from being
15 complete. I am planning to add more pages as the time permits, though. 15 complete. I am planning to add more pages as the time permits, though.
16 </p> 16 </p>
17 <p> 17 <p>
18 Once you download and install <a 18 Once you download and install <a
19 href="http://kin.klever.net/sitecing/">site-C-ing</a> you may wish to try 19 href="http://kin.klever.net/sitecing/">site-C-ing</a> you may wish to try
20 this sample site for yourself. The source is available from <a 20 this sample site for yourself. The source is available from <a
21 href="http://kin.klever.net/sitecing/sources">the site-C-ing download 21 href="http://kin.klever.net/sitecing/sources">the site-C-ing download
22 page</a>. After you download the source code, you should configure it using 22 page</a>. After you download the source code, you should configure it using
23 the ever so popular <code>configure</code> script. It is likely that you will 23 the ever so popular <code>configure</code> script. It is likely that you will
24 want to pass the <code>--with-vhostname</code> option to configure to name 24 want to pass the <code>--with-vhostname</code> option to configure to name
25 the apache virtual host. 25 the apache virtual host.
26 </p> 26 </p>
27 <p> 27 <p>
28 The configure script will generate the apache vhost configuration for you, 28 The configure script will generate the apache vhost configuration for you,
29 which you can <code>Include</code> in the main apache configuration file. 29 which you can <code>Include</code> in the main apache configuration file.
30 </p> 30 </p>
31 <p class="note"> 31 <p class="note">
32 Note, that the configuration is tailored for apache 2.x. It is no problem to 32 Note, that the configuration is tailored for apache 2.x. It is no problem to
33 get it working with apache 1.3.x, although I haven't tried and so I am not 33 get it working with apache 1.3.x, although I haven't tried and so I am not
34 sure if it will run out of the box (your patches are <a 34 sure if it will run out of the box (your patches are <a
35 href="mailto:sitecing-patches@klever.net">welcome</a>). Also note that you 35 href="mailto:sitecing-patches@klever.net">welcome</a>). Also note that you
36 may need <a href="http://fastcgi.com/">mod_fastcgi</a> apache module, 36 may need <a href="http://fastcgi.com/">mod_fastcgi</a> apache module,
37 although now that fastcgi is not the only supported interface you may get the 37 although now that fastcgi is not the only supported interface you may get the
38 thing running with 'plain' CGI with a bit of tweaking. Again, if you got it 38 thing running with 'plain' CGI with a bit of tweaking. Again, if you got it
39 working without breaking the fastcgi part your patches are <a 39 working without breaking the fastcgi part your patches are <a
40 href="mailto:sitecing-patches@klever.net">welcome</a>. 40 href="mailto:sitecing-patches@klever.net">welcome</a>.
41 </p> 41 </p>
42 <p> 42 <p>
43 Once you get it all done you will want to restart your apache and start the 43 Once you get it all done you will want to restart your apache and start the
44 <em>site-C-ing</em> fastcgi server by issuing the <code>make restart</code> 44 <em>site-C-ing</em> fastcgi server by issuing the <code>make restart</code>
45 command. 45 command.
46 </p> 46 </p>
47 <p> 47 <p>
48 Before you download it, you may wish to <a href="/sources" title="source 48 Before you download it, you may wish to <a href="/sources" title="source
49 browser">examine the sources</a> to learn more about how it is done. 49 browser">examine the sources</a> to learn more about how it is done.
50 </p> 50 </p>
51</%method> 51</%method>
diff --git a/htdocs/quickref/index.chtml b/htdocs/quickref/index.chtml
index d139190..5119723 100644
--- a/htdocs/quickref/index.chtml
+++ b/htdocs/quickref/index.chtml
@@ -1,17 +1,18 @@
1% html(); return; /* vim:set ft=sitecing: */ 1% /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml"; 2%%derive layout = "/ancestry/layout.chtml";
3%%pragma main=page
3<%constructor> 4<%constructor>
4 PN_PREV("/exceptions/runtime","runtime","runtime exceptions"); 5 PN_PREV("/exceptions/runtime","runtime","runtime exceptions");
5 PN_NEXT("/quickref/metasyntax","syntax","meta syntax"); 6 PN_NEXT("/quickref/metasyntax","syntax","meta syntax");
6</%constructor> 7</%constructor>
7<%codemethod string title() %> 8<%codemethod string title() %>
8 return "quick reference"; 9 return "quick reference";
9</%codemethod> 10</%codemethod>
10<%method void content() %> 11<%method void content() %>
11 <h1>site-C-ing quick reference</h1> 12 <h1>site-C-ing quick reference</h1>
12 <p> 13 <p>
13 I am hoping to put together some quick reference documentation here. For now, 14 I am hoping to put together some quick reference documentation here. For now,
14 I am adding the <a href="/quickref/metasyntax">component meta-syntax quick 15 I am adding the <a href="/quickref/metasyntax">component meta-syntax quick
15 reference</a>. 16 reference</a>.
16 </p> 17 </p>
17</%method> 18</%method>
diff --git a/htdocs/quickref/metasyntax.chtml b/htdocs/quickref/metasyntax.chtml
index 4efc37c..67186f9 100644
--- a/htdocs/quickref/metasyntax.chtml
+++ b/htdocs/quickref/metasyntax.chtml
@@ -1,66 +1,67 @@
1% html(); return; /* vim:set ft=sitecing: */ 1% /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml"; 2%%derive layout = "/ancestry/layout.chtml";
3%%pragma main=page
3<%constructor> 4<%constructor>
4 PN_PREV("/quickref/","quick reference","quick reference"); 5 PN_PREV("/quickref/","quick reference","quick reference");
5 PN_NEXT("/sources","sources","source browser"); 6 PN_NEXT("/sources","sources","source browser");
6</%constructor> 7</%constructor>
7<%codemethod string title() %> 8<%codemethod string title() %>
8 return "meta syntax quick reference"; 9 return "meta syntax quick reference";
9</%codemethod> 10</%codemethod>
10<%method void content() %> 11<%method void content() %>
11 <h1>site-C-ing meta syntax quick reference</h1> 12 <h1>site-C-ing meta syntax quick reference</h1>
12 13
13 <h2>Table of Contents</h2> 14 <h2>Table of Contents</h2>
14 15
15 <ul class="quickref toc"> 16 <ul class="quickref toc">
16 <li><a href="#qr__line">% ...</a></li> 17 <li><a href="#qr__line">% ...</a></li>
17 <li><a href="#qr__inline">&lt;% ... %&gt;</a></li> 18 <li><a href="#qr__inline">&lt;% ... %&gt;</a></li>
18 <li><a href="#qr__code">&lt;%code&gt;</a></li> 19 <li><a href="#qr__code">&lt;%code&gt;</a></li>
19 <li><a href="#qr__codemethod">&lt;%codemethod ... &gt;</a></li> 20 <li><a href="#qr__codemethod">&lt;%codemethod ... &gt;</a></li>
20 <li><a href="#qr__constructor">&lt;%constructor&gt;</a></li> 21 <li><a href="#qr__constructor">&lt;%constructor&gt;</a></li>
21 <li><a href="#qr__decl">&lt;%decl&gt;</a></li> 22 <li><a href="#qr__decl">&lt;%decl&gt;</a></li>
22 <li><a href="#qr___decl">%%decl</a></li> 23 <li><a href="#qr___decl">%%decl</a></li>
23 <li><a href="#qr___derive">%%derive</a></li> 24 <li><a href="#qr___derive">%%derive</a></li>
24 <li><a href="#qr__destructor">&lt;%destructor&gt;</a></li> 25 <li><a href="#qr__destructor">&lt;%destructor&gt;</a></li>
25 <li><a href="#qr__impl">&lt;%impl&gt;</a></li> 26 <li><a href="#qr__impl">&lt;%impl&gt;</a></li>
26 <li><a href="#qr___impl">%%impl</a></li> 27 <li><a href="#qr___impl">%%impl</a></li>
27 <li><a href="#qr__method">&lt;%method ... &gt;</a></li> 28 <li><a href="#qr__method">&lt;%method ... &gt;</a></li>
28 <li><a href="#qr__output">&lt;%output&gt;</a></li> 29 <li><a href="#qr__output">&lt;%output&gt;</a></li>
29 <li><a href="#qr___pragma">%%pragma</a></li> 30 <li><a href="#qr___pragma">%%pragma</a></li>
30 <li><a href="#qr___var">%%var</a></li> 31 <li><a href="#qr___var">%%var</a></li>
31 </ul> 32 </ul>
32 33
33 <dl class="metasyntax quickref"> 34 <dl class="metasyntax quickref">
34 35
35% /* % */ 36% /* % */
36 <dt> 37 <dt>
37 <a id="qr__line" name="qr__line" title="line of code"> 38 <a id="qr__line" name="qr__line" title="line of code">
38 <code>% <kbd>line of code</kbd></code> 39 <code>% <kbd>line of code</kbd></code>
39 </a> 40 </a>
40 </dt> 41 </dt>
41 <dd> 42 <dd>
42 <p> 43 <p>
43 Break out into the code mode for just one line. 44 Break out into the code mode for just one line.
44 </p> 45 </p>
45 <blockquote class="qr_sample"> 46 <blockquote class="qr_sample">
46 <div> 47 <div>
47 &nbsp;&lt;body&gt;<br/> 48 &nbsp;&lt;body&gt;<br/>
48 &nbsp;&nbsp;Here is the way we count.&lt;br/&gt;<br/> 49 &nbsp;&nbsp;Here is the way we count.&lt;br/&gt;<br/>
49 <em><a href="#qr__line" title="% description">%</a> for(int t=0;t&lt;10;t++) {<br/></em> 50 <em><a href="#qr__line" title="% description">%</a> for(int t=0;t&lt;10;t++) {<br/></em>
50 &nbsp;&nbsp;&nbsp;Just saying out loud: <a href="#qr__inline" title="&lt;% ... %&gt; description">&lt;%</a> t <a href="#qr__inline" title="&lt;% ... %&gt; description">%&gt;</a>&lt;br/&gt;<br/> 51 &nbsp;&nbsp;&nbsp;Just saying out loud: <a href="#qr__inline" title="&lt;% ... %&gt; description">&lt;%</a> t <a href="#qr__inline" title="&lt;% ... %&gt; description">%&gt;</a>&lt;br/&gt;<br/>
51 <em><a href="#qr__line" title="% description">%</a> }<br/></em> 52 <em><a href="#qr__line" title="% description">%</a> }<br/></em>
52 &nbsp;&lt;/body&gt; 53 &nbsp;&lt;/body&gt;
53 </div> 54 </div>
54 </blockquote> 55 </blockquote>
55 </dd> 56 </dd>
56 57
57% /* <% %> */ 58% /* <% %> */
58 <dt> 59 <dt>
59 <a id="qr__inline" name="qr__inline" title="output expression"> 60 <a id="qr__inline" name="qr__inline" title="output expression">
60 <code>&lt;% <kbd>expression</kbd> %&gt;</code> 61 <code>&lt;% <kbd>expression</kbd> %&gt;</code>
61 </a> 62 </a>
62 </dt> 63 </dt>
63 <dd> 64 <dd>
64 <p> 65 <p>
65 &lt;&lt; <kbd>expression</kbd> into output stream (think c++). 66 &lt;&lt; <kbd>expression</kbd> into output stream (think c++).
66 </p> 67 </p>
diff --git a/htdocs/simple.chtml b/htdocs/simple.chtml
index 845b840..d538b01 100644
--- a/htdocs/simple.chtml
+++ b/htdocs/simple.chtml
@@ -1,33 +1,34 @@
1% html(); return; /* vim:set ft=sitecing: */ 1% /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml"; 2%%derive layout = "/ancestry/layout.chtml";
3%%pragma main=page
3<%constructor> 4<%constructor>
4 b_strict = false; 5 b_strict = false;
5 PN_PREV("/","overview","introduction to site-C-ing"); 6 PN_PREV("/","overview","introduction to site-C-ing");
6 PN_NEXT("/exceptions","exceptions","exception handling overview"); 7 PN_NEXT("/exceptions","exceptions","exception handling overview");
7</%constructor> 8</%constructor>
8<%codemethod string title() %> 9<%codemethod string title() %>
9 return "simple page"; 10 return "simple page";
10</%codemethod> 11</%codemethod>
11<%method void content() %> 12<%method void content() %>
12 <h1>building a really simple page</h1> 13 <h1>building a really simple page</h1>
13 <p> 14 <p>
14 Building a really simple page is really simple. I will not go into much detail 15 Building a really simple page is really simple. I will not go into much detail
15 here. The example provided should speak for itself. 16 here. The example provided should speak for itself.
16 </p> 17 </p>
17 <p> 18 <p>
18 The component being written doesn't do much but show you the calendar for the 19 The component being written doesn't do much but show you the calendar for the
19 current month. First, take a look at <a 20 current month. First, take a look at <a
20 href="/view/htdocs/examples/calendar.chtml" title="the link opens in the frame 21 href="/view/htdocs/examples/calendar.chtml" title="the link opens in the frame
21 below" target="insert">the code</a> and, after you examined it, feel free to check out 22 below" target="insert">the code</a> and, after you examined it, feel free to check out
22 <a href="/examples/calendar" title="the link opens in the frame below" 23 <a href="/examples/calendar" title="the link opens in the frame below"
23 target="insert">the output</a>. 24 target="insert">the output</a>.
24 </p> 25 </p>
25 26
26 <div class="insert"> 27 <div class="insert">
27 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300"> 28 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
28 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to 29 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
29 support it. That is okay, it still will open links somehow.</p> 30 support it. That is okay, it still will open links somehow.</p>
30 </iframe> 31 </iframe>
31 </div> 32 </div>
32 33
33</%method> 34</%method>
diff --git a/htdocs/sources.chtml b/htdocs/sources.chtml
index 8c0c701..268b0e0 100644
--- a/htdocs/sources.chtml
+++ b/htdocs/sources.chtml
@@ -1,48 +1,49 @@
1% html(); return; /* vim:set ft=sitecing: */ 1% /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml"; 2%%derive layout = "/ancestry/layout.chtml";
3%%derive sources = "/ancestry/sources.chtml"; 3%%derive sources = "/ancestry/sources.chtml";
4%%pragma main=page
4<%impl> 5<%impl>
5 #include <sitecing/sitecing_util.h> 6 #include <sitecing/sitecing_util.h>
6</%impl> 7</%impl>
7<%constructor> 8<%constructor>
8 b_strict = false; 9 b_strict = false;
9 PN_PREV("/quickref/metasyntax","syntax","meta syntax"); 10 PN_PREV("/quickref/metasyntax","syntax","meta syntax");
10</%constructor> 11</%constructor>
11<%codemethod string title() %> 12<%codemethod string title() %>
12 return "runtime exceptions handling"; 13 return "runtime exceptions handling";
13</%codemethod> 14</%codemethod>
14<%method void content() %> 15<%method void content() %>
15 <h1>browse this site sources</h1> 16 <h1>browse this site sources</h1>
16 17
17 <ul class="sourcebrowser"> 18 <ul class="sourcebrowser">
18% for(int n=0;n<source_files_count;n++) { 19% for(int n=0;n<source_files_count;n++) {
19% sourcefile_t& sf = source_files[n]; 20% sourcefile_t& sf = source_files[n];
20% if(!sf.name) { /* the beginning or the end of the directory */ 21% if(!sf.name) { /* the beginning or the end of the directory */
21% if(sf.dir) { /* the beginning */ 22% if(sf.dir) { /* the beginning */
22 <li class="dir"><% sf.dir %>/<ul class="dir"> 23 <li class="dir"><% sf.dir %>/<ul class="dir">
23% }else{ /* the end */ 24% }else{ /* the end */
24 </ul></li> 25 </ul></li>
25% } 26% }
26% }else{ 27% }else{
27 <li class="file"><a href="/view/<% sf.dir %>/<% sf.name %>" title="<% sf.desc %>" target="insert"><% sf.name %></a></li> 28 <li class="file"><a href="/view/<% sf.dir %>/<% sf.name %>" title="<% sf.desc %>" target="insert"><% sf.name %></a></li>
28% } 29% }
29% } 30% }
30 </ul> 31 </ul>
31 32
32 <%code> 33 <%code>
33 string rfile = sitecing::normalize_path( 34 string rfile = sitecing::normalize_path(
34 sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/sources.chtml"), 35 sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/sources.chtml"),
35 sitecing::restrict_dotdot|sitecing::strip_leading_slash ); 36 sitecing::restrict_dotdot|sitecing::strip_leading_slash );
36 if(rfile.empty()) 37 if(rfile.empty())
37 rfile = "about:blank"; 38 rfile = "about:blank";
38 else 39 else
39 rfile = "/view/"+rfile; 40 rfile = "/view/"+rfile;
40 </%code> 41 </%code>
41 <div class="insert"> 42 <div class="insert">
42 <iframe id="insert" name="insert" src="<% rfile %>" width="95%" height="300"> 43 <iframe id="insert" name="insert" src="<% rfile %>" width="95%" height="300">
43 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to 44 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
44 support it. That is okay, it still will open links somehow.</p> 45 support it. That is okay, it still will open links somehow.</p>
45 </iframe> 46 </iframe>
46 </div> 47 </div>
47 48
48</%method> 49</%method>
diff --git a/htdocs/view.chtml b/htdocs/view.chtml
index d885330..f729465 100644
--- a/htdocs/view.chtml
+++ b/htdocs/view.chtml
@@ -1,54 +1,55 @@
1% html(); return; /* vim:set ft=sitecing: */ 1% /* vim:set ft=sitecing: */
2%%derive page = "/ancestry/page.chtml"; 2%%derive page = "/ancestry/page.chtml";
3%%derive sources = "/ancestry/sources.chtml"; 3%%derive sources = "/ancestry/sources.chtml";
4%%pragma main=page
4<%impl> 5<%impl>
5 #include <iostream> 6 #include <iostream>
6 #include <fstream> 7 #include <fstream>
7 using namespace std; 8 using namespace std;
8 #include <sitecing/util.h> 9 #include <sitecing/util.h>
9 #include <sitecing/sitecing_util.h> 10 #include <sitecing/sitecing_util.h>
10 #include <konforka/exception.h> 11 #include <konforka/exception.h>
11 #include "acconfig.h" 12 #include "acconfig.h"
12</%impl> 13</%impl>
13<%codemethod string title() %> 14<%codemethod string title() %>
14 return "introduction"; 15 return "introduction";
15</%codemethod> 16</%codemethod>
16<%method void body() %> 17<%method void body() %>
17 <%code> 18 <%code>
18 string rfile = sitecing::normalize_path( 19 string rfile = sitecing::normalize_path(
19 sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"), 20 sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"),
20 sitecing::restrict_dotdot|sitecing::strip_leading_slash ); 21 sitecing::restrict_dotdot|sitecing::strip_leading_slash );
21 sourcefile_t *sof = 0; 22 sourcefile_t *sof = 0;
22 for(int n=0;n<source_files_count;n++) { 23 for(int n=0;n<source_files_count;n++) {
23 sof = &source_files[n]; 24 sof = &source_files[n];
24 if(sof->name && sof->dir) { 25 if(sof->name && sof->dir) {
25 if(sitecing::normalize_path(sitecing::combine_path(sof->dir,sof->name,0),sitecing::strip_leading_slash)==rfile) 26 if(sitecing::normalize_path(sitecing::combine_path(sof->dir,sof->name,0),sitecing::strip_leading_slash)==rfile)
26 break; 27 break;
27 } 28 }
28 sof = 0; 29 sof = 0;
29 } 30 }
30 if(!sof) 31 if(!sof)
31 throw konforka::exception(CODEPOINT,"no access to the file allowed"); 32 throw konforka::exception(CODEPOINT,"no access to the file allowed");
32 string afile = sitecing::combine_path(WEB_ROOT,rfile,0); 33 string afile = sitecing::combine_path(WEB_ROOT,rfile,0);
33 </%code> 34 </%code>
34 <div class="source"> 35 <div class="source">
35 <h1><% rfile %></h1> 36 <h1><% rfile %></h1>
36 <ul> 37 <ul>
37 <%code> 38 <%code>
38 ifstream sf(afile.c_str()); 39 ifstream sf(afile.c_str());
39 if(!sf.good()) 40 if(!sf.good())
40 throw konforka::exception(CODEPOINT,"could not open source file"); 41 throw konforka::exception(CODEPOINT,"could not open source file");
41 while(!sf.eof()) { 42 while(!sf.eof()) {
42 string sfl; 43 string sfl;
43 getline(sf,sfl); 44 getline(sf,sfl);
44 for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) { 45 for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) {
45 sfl.replace(t,1,8-(t%8),' '); 46 sfl.replace(t,1,8-(t%8),' ');
46 } 47 }
47 <%output> 48 <%output>
48 <li><% sfl.empty()?"&nbsp;":sitecing::html_escape(sfl,sitecing::html_escape_nbsp) %></li> 49 <li><% sfl.empty()?"&nbsp;":sitecing::html_escape(sfl,sitecing::html_escape_nbsp) %></li>
49 </%output> 50 </%output>
50 } 51 }
51 </%code> 52 </%code>
52 </ul> 53 </ul>
53 </div> 54 </div>
54</%method> 55</%method>