-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | htdocs/handlers/exception_dev | 7 | ||||
-rw-r--r-- | htdocs/sources.chtml | 5 | ||||
-rw-r--r-- | htdocs/view.chtml | 9 |
4 files changed, 13 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac index e60f519..80f6321 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,13 +1,13 @@ | |||
1 | AC_INIT([sitecing-showcase], [0.0.1], [sitecing-bugs@klever.net]) | 1 | AC_INIT([sitecing-showcase], [0.0.1-svn], [sitecing-bugs@klever.net]) |
2 | AC_CONFIG_SRCDIR([htdocs/index.chtml]) | 2 | AC_CONFIG_SRCDIR([htdocs/index.chtml]) |
3 | AC_CONFIG_AUX_DIR([aux]) | 3 | AC_CONFIG_AUX_DIR([aux]) |
4 | AC_CONFIG_HEADER([include/acconfig.h]) | 4 | AC_CONFIG_HEADER([include/acconfig.h]) |
5 | AM_INIT_AUTOMAKE([dist-bzip2]) | 5 | AM_INIT_AUTOMAKE([dist-bzip2]) |
6 | 6 | ||
7 | AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) | 7 | AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) |
8 | 8 | ||
9 | PKG_CHECK_MODULES([SITECING],[sitecing >= 0.0.1],,[ | 9 | PKG_CHECK_MODULES([SITECING],[sitecing >= 0.0.1],,[ |
10 | AC_MSG_ERROR([site-C-ing not found. get it at http://kin.klever.net/sitecing/]) | 10 | AC_MSG_ERROR([site-C-ing not found. get it at http://kin.klever.net/sitecing/]) |
11 | ]) | 11 | ]) |
12 | sitecing_prefix="$(${PKG_CONFIG} --variable=prefix sitecing)" | 12 | sitecing_prefix="$(${PKG_CONFIG} --variable=prefix sitecing)" |
13 | sitecing_bindir="$(${PKG_CONFIG} --variable=bindir sitecing)" | 13 | sitecing_bindir="$(${PKG_CONFIG} --variable=bindir sitecing)" |
diff --git a/htdocs/handlers/exception_dev b/htdocs/handlers/exception_dev index d8c84e1..d62f462 100644 --- a/htdocs/handlers/exception_dev +++ b/htdocs/handlers/exception_dev | |||
@@ -1,24 +1,25 @@ | |||
1 | %%decl using namespace std; | 1 | %%decl using namespace std; |
2 | <%impl> | 2 | <%impl> |
3 | #include <iostream> | 3 | #include <iostream> |
4 | #include <fstream> | 4 | #include <fstream> |
5 | #include <sstream> | 5 | #include <sstream> |
6 | #include <cassert> | 6 | #include <cassert> |
7 | #include <cstdarg> | 7 | #include <cstdarg> |
8 | #include <stdexcept> | 8 | #include <stdexcept> |
9 | #include <cxxabi.h> | 9 | #include <cxxabi.h> |
10 | #include <sitecing/sitecing_util.h> | 10 | #include <sitecing/sitecing_util.h> |
11 | #include <sitecing/util.h> | 11 | #include <sitecing/util.h> |
12 | #include <sitecing/magic.h> | 12 | #include <sitecing/magic.h> |
13 | #include <konforka/util.h> | ||
13 | #include <konforka/exception.h> | 14 | #include <konforka/exception.h> |
14 | </%impl> | 15 | </%impl> |
15 | %%var string message; | 16 | %%var string message; |
16 | %%var string root_source; | 17 | %%var string root_source; |
17 | %%var string root_intermediate; | 18 | %%var string root_intermediate; |
18 | %%var string root_so; | 19 | %%var string root_so; |
19 | %%var string component; | 20 | %%var string component; |
20 | %%var int line_number = -1; | 21 | %%var int line_number = -1; |
21 | %%var const exception* exception_caught; | 22 | %%var const exception* exception_caught; |
22 | <%code> | 23 | <%code> |
23 | __SCIF->headers.clear(); | 24 | __SCIF->headers.clear(); |
24 | __SCIF->out->seekp(0); | 25 | __SCIF->out->seekp(0); |
@@ -245,35 +246,35 @@ | |||
245 | string::size_type nd = ln.find_first_not_of("0123456789"); | 246 | string::size_type nd = ln.find_first_not_of("0123456789"); |
246 | if(nd==string::npos) { | 247 | if(nd==string::npos) { |
247 | try { | 248 | try { |
248 | error_file = sitecing::strip_prefix(fn,"In file included from "); | 249 | error_file = sitecing::strip_prefix(fn,"In file included from "); |
249 | }catch(sitecing::utility_no_prefix& unp) { | 250 | }catch(sitecing::utility_no_prefix& unp) { |
250 | error_file = fn; | 251 | error_file = fn; |
251 | } | 252 | } |
252 | error_line = strtol(ln.c_str(),0,10); | 253 | error_line = strtol(ln.c_str(),0,10); |
253 | } | 254 | } |
254 | } | 255 | } |
255 | } | 256 | } |
256 | if((oel>0 && !oef.empty()) && (oel!=error_line || oef!=error_file)) { | 257 | if((oel>0 && !oef.empty()) && (oel!=error_line || oef!=error_file)) { |
257 | string ef = "/"+sitecing::combine_path(root_source+component,oef); | 258 | string ef = "/"+konforka::combine_path(root_source+component,oef); |
258 | report_error(ef,oel,remove_roots(cumulative)); | 259 | report_error(ef,oel,remove_roots(cumulative)); |
259 | cumulative.clear(); | 260 | cumulative.clear(); |
260 | } | 261 | } |
261 | } | 262 | } |
262 | if(!cumulative.empty()) | 263 | if(!cumulative.empty()) |
263 | cumulative += '\n'; | 264 | cumulative += '\n'; |
264 | cumulative += line; | 265 | cumulative += line; |
265 | } | 266 | } |
266 | if(!(cumulative.empty() || error_file.empty() || error_line<0)) { | 267 | if(!(cumulative.empty() || error_file.empty() || error_line<0)) { |
267 | error_file = "/"+sitecing::combine_path(root_source+component,error_file); | 268 | error_file = "/"+konforka::combine_path(root_source+component,error_file); |
268 | report_error(error_file,error_line,remove_roots(cumulative)); | 269 | report_error(error_file,error_line,remove_roots(cumulative)); |
269 | } | 270 | } |
270 | } | 271 | } |
271 | </%code> | 272 | </%code> |
272 | </div> | 273 | </div> |
273 | </%method> | 274 | </%method> |
274 | <%method void handle_unknown_error() %> | 275 | <%method void handle_unknown_error() %> |
275 | <div class="exception-unknown"> | 276 | <div class="exception-unknown"> |
276 | <h1>unknown error</h1> | 277 | <h1>unknown error</h1> |
277 | </div> | 278 | </div> |
278 | </%method> | 279 | </%method> |
279 | <%method void report_error(const string& file,long line,const string& message) %> | 280 | <%method void report_error(const string& file,long line,const string& message) %> |
@@ -309,25 +310,25 @@ | |||
309 | } | 310 | } |
310 | <%output></ul></%output> | 311 | <%output></ul></%output> |
311 | } | 312 | } |
312 | } | 313 | } |
313 | } | 314 | } |
314 | </%code> | 315 | </%code> |
315 | <div class="what"> | 316 | <div class="what"> |
316 | <% sitecing::html_escape(message,sitecing::html_escape_br) %> | 317 | <% sitecing::html_escape(message,sitecing::html_escape_br) %> |
317 | </div> | 318 | </div> |
318 | </div> | 319 | </div> |
319 | </%method> | 320 | </%method> |
320 | <%codemethod string strip_roots(const string& filename) %> | 321 | <%codemethod string strip_roots(const string& filename) %> |
321 | string np = sitecing::normalize_path(filename); | 322 | string np = konforka::normalize_path(filename); |
322 | try{ | 323 | try{ |
323 | return sitecing::strip_prefix(np,root_source); | 324 | return sitecing::strip_prefix(np,root_source); |
324 | }catch(sitecing::utility_no_prefix& e){ } | 325 | }catch(sitecing::utility_no_prefix& e){ } |
325 | try{ | 326 | try{ |
326 | return sitecing::strip_prefix(np,root_intermediate); | 327 | return sitecing::strip_prefix(np,root_intermediate); |
327 | }catch(sitecing::utility_no_prefix& e){ } | 328 | }catch(sitecing::utility_no_prefix& e){ } |
328 | </%codemethod> | 329 | </%codemethod> |
329 | <%codemethod string remove_roots(const string& str) %> | 330 | <%codemethod string remove_roots(const string& str) %> |
330 | string rv = str; | 331 | string rv = str; |
331 | string::size_type rp; | 332 | string::size_type rp; |
332 | string::size_type rl = root_source.length(); | 333 | string::size_type rl = root_source.length(); |
333 | while((rp=rv.find(root_source))!=string::npos) { | 334 | while((rp=rv.find(root_source))!=string::npos) { |
diff --git a/htdocs/sources.chtml b/htdocs/sources.chtml index 268b0e0..57a03e9 100644 --- a/htdocs/sources.chtml +++ b/htdocs/sources.chtml | |||
@@ -1,18 +1,19 @@ | |||
1 | % /* 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 | %%pragma main=page |
5 | <%impl> | 5 | <%impl> |
6 | #include <sitecing/sitecing_util.h> | 6 | #include <sitecing/sitecing_util.h> |
7 | #include <konforka/util.h> | ||
7 | </%impl> | 8 | </%impl> |
8 | <%constructor> | 9 | <%constructor> |
9 | b_strict = false; | 10 | b_strict = false; |
10 | PN_PREV("/quickref/metasyntax","syntax","meta syntax"); | 11 | PN_PREV("/quickref/metasyntax","syntax","meta syntax"); |
11 | </%constructor> | 12 | </%constructor> |
12 | <%codemethod string title() %> | 13 | <%codemethod string title() %> |
13 | return "runtime exceptions handling"; | 14 | return "runtime exceptions handling"; |
14 | </%codemethod> | 15 | </%codemethod> |
15 | <%method void content() %> | 16 | <%method void content() %> |
16 | <h1>browse this site sources</h1> | 17 | <h1>browse this site sources</h1> |
17 | 18 | ||
18 | <ul class="sourcebrowser"> | 19 | <ul class="sourcebrowser"> |
@@ -22,27 +23,27 @@ | |||
22 | % if(sf.dir) { /* the beginning */ | 23 | % if(sf.dir) { /* the beginning */ |
23 | <li class="dir"><% sf.dir %>/<ul class="dir"> | 24 | <li class="dir"><% sf.dir %>/<ul class="dir"> |
24 | % }else{ /* the end */ | 25 | % }else{ /* the end */ |
25 | </ul></li> | 26 | </ul></li> |
26 | % } | 27 | % } |
27 | % }else{ | 28 | % }else{ |
28 | <li class="file"><a href="/view/<% sf.dir %>/<% sf.name %>" title="<% sf.desc %>" target="insert"><% sf.name %></a></li> | 29 | <li class="file"><a href="/view/<% sf.dir %>/<% sf.name %>" title="<% sf.desc %>" target="insert"><% sf.name %></a></li> |
29 | % } | 30 | % } |
30 | % } | 31 | % } |
31 | </ul> | 32 | </ul> |
32 | 33 | ||
33 | <%code> | 34 | <%code> |
34 | string rfile = sitecing::normalize_path( | 35 | string rfile = konforka::normalize_path( |
35 | sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/sources.chtml"), | 36 | sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/sources.chtml"), |
36 | sitecing::restrict_dotdot|sitecing::strip_leading_slash ); | 37 | konforka::restrict_dotdot|konforka::strip_leading_slash ); |
37 | if(rfile.empty()) | 38 | if(rfile.empty()) |
38 | rfile = "about:blank"; | 39 | rfile = "about:blank"; |
39 | else | 40 | else |
40 | rfile = "/view/"+rfile; | 41 | rfile = "/view/"+rfile; |
41 | </%code> | 42 | </%code> |
42 | <div class="insert"> | 43 | <div class="insert"> |
43 | <iframe id="insert" name="insert" src="<% rfile %>" width="95%" height="300"> | 44 | <iframe id="insert" name="insert" src="<% rfile %>" width="95%" height="300"> |
44 | <p>I wanted to put an <iframe> here, but your browser does not seem to | 45 | <p>I wanted to put an <iframe> 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 | ||
diff --git a/htdocs/view.chtml b/htdocs/view.chtml index f729465..809c54f 100644 --- a/htdocs/view.chtml +++ b/htdocs/view.chtml | |||
@@ -1,45 +1,46 @@ | |||
1 | % /* 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 | %%pragma main=page |
5 | <%impl> | 5 | <%impl> |
6 | #include <iostream> | 6 | #include <iostream> |
7 | #include <fstream> | 7 | #include <fstream> |
8 | using namespace std; | 8 | using namespace std; |
9 | #include <sitecing/util.h> | 9 | #include <sitecing/util.h> |
10 | #include <sitecing/sitecing_util.h> | 10 | #include <sitecing/sitecing_util.h> |
11 | #include <konforka/util.h> | ||
11 | #include <konforka/exception.h> | 12 | #include <konforka/exception.h> |
12 | #include "acconfig.h" | 13 | #include "acconfig.h" |
13 | </%impl> | 14 | </%impl> |
14 | <%codemethod string title() %> | 15 | <%codemethod string title() %> |
15 | return "introduction"; | 16 | return "introduction"; |
16 | </%codemethod> | 17 | </%codemethod> |
17 | <%method void body() %> | 18 | <%method void body() %> |
18 | <%code> | 19 | <%code> |
19 | string rfile = sitecing::normalize_path( | 20 | string rfile = konforka::normalize_path( |
20 | sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"), | 21 | sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"), |
21 | sitecing::restrict_dotdot|sitecing::strip_leading_slash ); | 22 | konforka::restrict_dotdot|konforka::strip_leading_slash ); |
22 | sourcefile_t *sof = 0; | 23 | sourcefile_t *sof = 0; |
23 | for(int n=0;n<source_files_count;n++) { | 24 | for(int n=0;n<source_files_count;n++) { |
24 | sof = &source_files[n]; | 25 | sof = &source_files[n]; |
25 | if(sof->name && sof->dir) { | 26 | if(sof->name && sof->dir) { |
26 | if(sitecing::normalize_path(sitecing::combine_path(sof->dir,sof->name,0),sitecing::strip_leading_slash)==rfile) | 27 | if(konforka::normalize_path(konforka::combine_path(sof->dir,sof->name,0),konforka::strip_leading_slash)==rfile) |
27 | break; | 28 | break; |
28 | } | 29 | } |
29 | sof = 0; | 30 | sof = 0; |
30 | } | 31 | } |
31 | if(!sof) | 32 | if(!sof) |
32 | throw konforka::exception(CODEPOINT,"no access to the file allowed"); | 33 | throw konforka::exception(CODEPOINT,"no access to the file allowed"); |
33 | string afile = sitecing::combine_path(WEB_ROOT,rfile,0); | 34 | string afile = konforka::combine_path(WEB_ROOT,rfile,0); |
34 | </%code> | 35 | </%code> |
35 | <div class="source"> | 36 | <div class="source"> |
36 | <h1><% rfile %></h1> | 37 | <h1><% rfile %></h1> |
37 | <ul> | 38 | <ul> |
38 | <%code> | 39 | <%code> |
39 | ifstream sf(afile.c_str()); | 40 | ifstream sf(afile.c_str()); |
40 | if(!sf.good()) | 41 | if(!sf.good()) |
41 | throw konforka::exception(CODEPOINT,"could not open source file"); | 42 | throw konforka::exception(CODEPOINT,"could not open source file"); |
42 | while(!sf.eof()) { | 43 | while(!sf.eof()) { |
43 | string sfl; | 44 | string sfl; |
44 | getline(sf,sfl); | 45 | getline(sf,sfl); |
45 | for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) { | 46 | for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) { |