Index: openacs-4/packages/acs-tcl/acs-tcl.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v diff -u -N -r1.42.2.2 -r1.42.2.3 --- openacs-4/packages/acs-tcl/acs-tcl.info 26 Aug 2005 00:02:33 -0000 1.42.2.2 +++ openacs-4/packages/acs-tcl/acs-tcl.info 8 Sep 2005 14:54:39 -0000 1.42.2.3 @@ -7,7 +7,7 @@ t t - + OpenACS The Kernel Tcl API library. 2005-08-25 @@ -16,19 +16,15 @@ OpenACS Contains all the core Tcl API, including the request processor, security and session management, permissions, site-nodes, package management infrastructure, etc. - + - + - - - - Index: openacs-4/packages/acs-tcl/catalog/acs-tcl.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/catalog/acs-tcl.de_DE.ISO-8859-1.xml,v diff -u -N -r1.13.2.1 -r1.13.2.2 --- openacs-4/packages/acs-tcl/catalog/acs-tcl.de_DE.ISO-8859-1.xml 27 Jul 2005 15:29:53 -0000 1.13.2.1 +++ openacs-4/packages/acs-tcl/catalog/acs-tcl.de_DE.ISO-8859-1.xml 8 Sep 2005 14:54:39 -0000 1.13.2.2 @@ -1,5 +1,5 @@ - + Freischalten E-Mail-Adresse best�tigen Index: openacs-4/packages/acs-tcl/catalog/acs-tcl.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/catalog/acs-tcl.en_US.ISO-8859-1.xml,v diff -u -N -r1.17.2.1 -r1.17.2.2 --- openacs-4/packages/acs-tcl/catalog/acs-tcl.en_US.ISO-8859-1.xml 27 Jul 2005 15:29:53 -0000 1.17.2.1 +++ openacs-4/packages/acs-tcl/catalog/acs-tcl.en_US.ISO-8859-1.xml 8 Sep 2005 14:54:39 -0000 1.17.2.2 @@ -1,5 +1,5 @@ - + a problem approve Index: openacs-4/packages/acs-tcl/tcl/pdf-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/pdf-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/pdf-procs.tcl 8 Sep 2005 14:55:18 -0000 1.1.2.1 @@ -0,0 +1,126 @@ +# packages/acs-tcl/tcl/pdf-procs.tcl + +ad_library { + + Functions for handling Template-documents + + @author Christian Langmann (C_Langmann@gmx.de) + @creation-date 2005-07-07 +} + +namespace eval text_templates {} + +ad_proc -public text_templates::create_pdf_content { + {-template_id:required} + {-set_var_call:required} +} { + + Create the pdf content from a template + + @author Christian Langmann (C_Langmann@gmx.de) + @creation-date 2005-07-07 + + @param template_id The template to use for the preview. It is \ + assumed that the template_id is the same as the revision_id to \ + be used for the template. + + @param set_var_call procedure-name which sets the variables used + + @return the pdf-file-name +} { + + set tmp_filename [ns_tmpnam] + # create html.file + set html_content [create_html_content -template_id $template_id -set_var_call $set_var_call] + set tmp_html_filename "${tmp_filename}.html" + set fp [open $tmp_html_filename w] + puts $fp $html_content + close $fp + + # create pdf-file + set tmp_pdf_filename "${tmp_filename}.pdf" + set htmldoc_bin [parameter::get -parameter "HtmlDocBin" -default "/usr/bin/htmldoc"] + if {[catch {exec $htmldoc_bin --webpage --quiet -t pdf -f $tmp_pdf_filename $tmp_html_filename} err]} { + ns_log Notice "Error during conversion from html to pdf: $err" + } + file delete $tmp_html_filename + + return $tmp_pdf_filename +} + + +ad_proc -public text_templates::create_pdf_from_html { + {-html_content:required} +} { + The HTML Content is transformed into a PDF file + + @param html_content HTML Content that is transformed into PDF + @return filename of the pdf file +} { + set tmp_filename [ns_tmpnam] + set tmp_html_filename "${tmp_filename}.html" + set fp [open $tmp_html_filename w] + puts $fp $html_content + close $fp + + # create pdf-file + set tmp_pdf_filename "${tmp_filename}.pdf" + set htmldoc_bin [parameter::get -parameter "HtmlDocBin" -default "/usr/bin/htmldoc"] + if {[catch {exec $htmldoc_bin --webpage --quiet -t pdf -f $tmp_pdf_filename $tmp_html_filename} err]} { + ns_log Notice "Error during conversion from html to pdf: $err" + } + return $tmp_pdf_filename +} + +ad_proc -public text_templates::store_final_document { + {-pdf_file:required} + {-folder_id:required} + {-title:required} + {-description:required} +} { + The document is stored in the given folder. + + @author Christian Langmann (C_Langmann@gmx.de) + @creation-date 2005-07-07 + @param pdf_file the pdf-file to save + @param folder_id the folder the document is stored in + @title Title or name of the document + @description Description of the document + @return + + @error +} { + set file_size [file size $pdf_file] + set item_id [cr_import_content -title $title -description $description $folder_id $pdf_file $file_size application/pdf $title] + return item_id +} + +ad_proc -private text_templates::create_html_content { + {-template_id ""} + {-set_var_call:required} + {-filename:required} +} { + + Create the filled out template as html + + @author Christian Langmann (C_Langmann@gmx.de) + @creation-date 2005-07-07 + + @param template_id The template to use for the preview. It is assumed that the template_id is the same as the revision_id to be used for the template. + @param set_var_call procedure-name which sets the variables used +} { + + eval $set_var_call + + # retrieve template and write to tmpfile + # set content [content::get_content_value $template_id] + set file [open $filename] + fconfigure $file -translation binary + set content [read $file] + + # parse template and replace placeholders + eval [template::adp_compile -string $content] + set final_content $__adp_output + + return $final_content +}