|
From: <jh...@us...> - 2008-10-06 22:34:03
|
Update of /cvsroot/aolserver/havardblog/tcl In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv4271/tcl Modified Files: init.tcl Log Message: Corrected serious problem with referencing templates... i.e. it calls [ns_info pageroot] rather than assuming the base is always pageroot. This was breaking the do_post.adp script's call to regenerate the index page since it was trying to reference templates based in the /admin/ directory! Index: init.tcl =================================================================== RCS file: /cvsroot/aolserver/havardblog/tcl/init.tcl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** init.tcl 15 Sep 2008 20:06:20 -0000 1.1 --- init.tcl 6 Oct 2008 22:33:55 -0000 1.2 *************** *** 14,20 **** ! set mainStuff [ns_adp_parse -file template/article.adp] ! set rPole [ns_adp_parse -file template/rpole.adp] ! ns_return 200 "text/html" [ns_adp_parse -file template/template.adp] } else { ns_returnnotfound --- 14,20 ---- ! set mainStuff [ns_adp_parse -file [ns_info pageroot]/template/article.adp] ! set rPole [ns_adp_parse -file [ns_info pageroot]/template/rpole.adp] ! ns_return 200 "text/html" [ns_adp_parse -file [ns_info pageroot]/template/template.adp] } else { ns_returnnotfound *************** *** 23,26 **** --- 23,27 ---- proc init_entries_nsv {} { + set pageroot [ns_config -exact ns/server/jhdotcom pageroot] set qry "SELECT ARTICLE.*,AUTHOR.PERSONAL_NAME FROM ARTICLE,AUTHOR WHERE AUTHOR.ID=ARTICLE.AUTHOR ORDER BY PUBDATE DESC, UPDATED DESC" catch { *************** *** 38,42 **** set pubdate [string map {- /} $pubdate] nsv_set entries "/article/${pubdate}/${slug}/article.html" [list $slug $pubdate $updated $author $title $lead $body] - #set mainStuff "$mainStuff [ns_adp_parse -file template/entry.adp]" } ns_db releasehandle $hdl --- 39,42 ---- *************** *** 45,48 **** --- 45,49 ---- proc most_recent_articles {n} { + set pageroot [ns_config -exact ns/server/jhdotcom pageroot] set mainStuff "" set qry "SELECT ARTICLE.*,AUTHOR.PERSONAL_NAME FROM ARTICLE,AUTHOR WHERE AUTHOR.ID=ARTICLE.AUTHOR ORDER BY PUBDATE DESC, UPDATED DESC LIMIT ${n}" *************** *** 59,68 **** set body [subst [ns_set get $res body ]] set pubdate [string map {- /} $pubdate] ! set mainStuff "$mainStuff [ns_adp_parse -file template/entry.adp]" } ns_db releasehandle $hdl } ! set rPole [ns_adp_parse -file template/rpole.adp] ! nsv_set cache homepage [ns_adp_parse -file template/template.adp] } --- 60,69 ---- set body [subst [ns_set get $res body ]] set pubdate [string map {- /} $pubdate] ! set mainStuff "$mainStuff [ns_adp_parse -file [ns_info pageroot]/template/entry.adp]" } ns_db releasehandle $hdl } ! set rPole [ns_adp_parse -file [ns_info pageroot]/template/rpole.adp] ! nsv_set cache homepage [ns_adp_parse -file [ns_info pageroot]/template/template.adp] } *************** *** 71,77 **** --- 72,83 ---- } + proc do_cal {} { + ns_return 404 "text/html" [ns_adp_parse -file [ns_info pageroot]/global/file-not-found.adp] + } + ns_register_proc GET /article do_article ns_register_proc -noinherit GET / do_home_page ns_register_proc -noinherit GET /index.html do_home_page + ns_register_proc GET /cal do_cal init_entries_nsv |