Index: openacs-4/packages/acs-templating/www/doc/design.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/design.adp,v diff -u -N -r1.2.2.7 -r1.2.2.8 --- openacs-4/packages/acs-templating/www/doc/design.adp 21 Apr 2017 16:50:30 -0000 1.2.2.7 +++ openacs-4/packages/acs-templating/www/doc/design.adp 22 Apr 2017 18:33:51 -0000 1.2.2.8 @@ -100,7 +100,7 @@ "Styles" by Philip Greenspun. An extended and improved version was named "Dynamic Publishing System". It wasn't part of the ACS yet, but client projects like iluvCAMP -used it successfuly. Newcomers were consistently puzzled by the +used it successfully. Newcomers were consistently puzzled by the .data files, which specified the datasources in an apparently unfamiliar XML syntax. (The .form files specified elements in an HTML form similarly.) To mitigate this @@ -191,7 +191,7 @@ .adp or .tcl file. As both invoke the same handler, it doesn't matter that adp take precendence.
  • If a .tcl file is present, its ad_page_contract in the -properties block indicates a set of data -sources that will be made available to the template.
  • The rest of the tcl script executes, defining these data +sources that will be made available to the template.
  • The rest of the Tcl script executes, defining these data sources. It may change the name of the page being served by calling template::set_file directly or through the wrapper ad_return_template.
  • The corresponding template (file stub.adp) is @@ -246,11 +246,11 @@ next level will appear as #6, due to the repeated upleveling.

    Caching and Template Compilation

    -

    To improve performance, adp pages are compiled into a tcl proc, +

    To improve performance, adp pages are compiled into a Tcl proc, and thus cached for future use. Tcl pages are also cached in a proc; this saves the trouble of reading and parsing the file the next time. The template system remembers the modification times of -the adp and tcl sources, and re-processes any requested file if the +the adp and Tcl sources, and re-processes any requested file if the cached version is no longer current. Consequently, this cacheing is transparent in normal use.

    To emphasize that "normal" use essentially always Index: openacs-4/packages/acs-templating/www/doc/developer-guide.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/developer-guide.adp,v diff -u -N -r1.2.2.5 -r1.2.2.6 --- openacs-4/packages/acs-templating/www/doc/developer-guide.adp 7 Nov 2016 19:23:16 -0000 1.2.2.5 +++ openacs-4/packages/acs-templating/www/doc/developer-guide.adp 22 Apr 2017 18:33:51 -0000 1.2.2.6 @@ -11,14 +11,14 @@ . Be sure to pass a -properties block; this signals the use -of templating. The tcl page should fill the data sources you +of templating. The Tcl page should fill the data sources you promised in the contract, and not write to the connection. At the -end of your tcl page, call ad_return_template +end of your Tcl page, call ad_return_template . The template system will look for an adp page with the file name stub -you indicate (defaulting to the same stub as the tcl page), process +you indicate (defaulting to the same stub as the Tcl page), process that, and deliver it to the client. The adp page can use the -datasources defined in the tcl page. +datasources defined in the Tcl page.

    Guide

    1. User Guide
      • @@ -78,7 +78,7 @@ template::set_file, to change the name of the page being served currently. If it starts with a "/", it is taken to be a path relative to the server root; otherwise it is a -filename relative to the directory of the tcl script.

        +filename relative to the directory of the Tcl script.

        ad_page_contract
        Normally, complaints about incorrect parameters are written Index: openacs-4/packages/acs-templating/www/doc/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/index.adp,v diff -u -N -r1.2.2.9 -r1.2.2.10 --- openacs-4/packages/acs-templating/www/doc/index.adp 1 Dec 2016 19:24:14 -0000 1.2.2.9 +++ openacs-4/packages/acs-templating/www/doc/index.adp 22 Apr 2017 18:33:51 -0000 1.2.2.10 @@ -31,7 +31,7 @@ APIAPI Reference -MigrationBringing legacy tcl pages to use the template system. +MigrationBringing legacy Tcl pages to use the template system. DemonstrationSamples of the various mechanisms, with both Tcl and ADP parts. Index: openacs-4/packages/acs-templating/www/doc/migration.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/migration.adp,v diff -u -N -r1.3.2.12 -r1.3.2.13 --- openacs-4/packages/acs-templating/www/doc/migration.adp 7 Nov 2016 19:23:16 -0000 1.3.2.12 +++ openacs-4/packages/acs-templating/www/doc/migration.adp 22 Apr 2017 18:33:51 -0000 1.3.2.13 @@ -7,7 +7,7 @@ : Migration

        In a Nutshell

        -When templatizing a legacy tcl page, your task is to +When templatizing a legacy Tcl page, your task is to separate code and graphical presentation. The latter goes into an ADP file; it contains essentially HTML, @@ -27,7 +27,7 @@ queries needed to define these data sources. There are special mechanisms for handling multirow data sources; see below.

        At the end of the Tcl script, you should call -ad_return_template. The template runs after the tcl +ad_return_template. The template runs after the Tcl script, and can use these data sources.

        Make sure that the fancy adp parser is enabled in your AOL ini file.

        @@ -40,11 +40,11 @@
      • Do not write to the connection directly. Avoid ns_puts, ns_write etc., which don't wait till the headers are written or the page is completed; they -may act differently than you expect.
      • If you can, put code in the tcl file, not between <% -%> in the adp page.
      • Put HTML in the adp page, not int the tcl program. Put reusable +may act differently than you expect.
      • If you can, put code in the Tcl file, not between <% +%> in the adp page.
      • Put HTML in the adp page, not int the Tcl program. Put reusable HTML fragments in a separate adp file (think of it as a widget) that will be <include>d from several pages. -Prefer this to writing a tcl proc that returns HTML.
      • Remember to remove backslashes where you had to escape special +Prefer this to writing a Tcl proc that returns HTML.
      • Remember to remove backslashes where you had to escape special characters, as in
         Nuts  \$2.70 \[<a href="\"shoppe\">buy</a>\]
        @@ -65,7 +65,7 @@
         panes fit next to each other and to line up corresponding code.

        - + @@ -215,7 +215,7 @@ module that uses the mechanism, not a whole page.
        old tcl codenewold Tcl codenew
        packages/news/www/item-view.tclpackages/news/www/item-view.adp
        - + @@ -353,11 +353,11 @@ own multirow variable. In the excert below, taken from /pvt/alerts.tcl and /pvt/alerts.adp, the foreach logic made it hard to use the db_multirow because it needed a combination of the -output from sql and also the output of tcl procedures using that +output from sql and also the output of Tcl procedures using that value.

        old tcl codenewold Tcl codenew
        packages/news/www/index.tclpackages/news/www/index.adp
        - + Index: openacs-4/packages/acs-templating/www/doc/noquote.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/noquote.adp,v diff -u -N -r1.3.2.6 -r1.3.2.7 --- openacs-4/packages/acs-templating/www/doc/noquote.adp 21 Apr 2017 16:50:30 -0000 1.3.2.6 +++ openacs-4/packages/acs-templating/www/doc/noquote.adp 22 Apr 2017 18:33:51 -0000 1.3.2.7 @@ -181,7 +181,7 @@ a broken page from time to time, typically by spotting the obviously visible HTML markup. Such a page would get fixed it in a matter of seconds by appending ;noquote to the name of the -offending variable.

        We launched successfuly within schedule.

        +offending variable.

        We launched successfully within schedule.

        Porting the quoting Index: openacs-4/packages/acs-templating/www/doc/TclDocs/doc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/doc.adp,v diff -u -N -r1.2.2.3 -r1.2.2.4 --- openacs-4/packages/acs-templating/www/doc/TclDocs/doc.adp 7 Nov 2016 19:23:16 -0000 1.2.2.3 +++ openacs-4/packages/acs-templating/www/doc/TclDocs/doc.adp 22 Apr 2017 18:33:51 -0000 1.2.2.4 @@ -19,7 +19,7 @@
          by simon

        old tcl codenewold Tcl codenew
        packages/acs-core-ui/www/pvt/alerts.tclpackages/acs-core-ui/www/pvt/alerts.adp
        called by parse_file, this procedure is given the body -of text between two namespace markers in a tcl library file and +of text between two namespace markers in a Tcl library file and parses out procedure source and comments
        Parameters:
        @@ -76,7 +76,7 @@
        -
        takes the absolute path of the tcl library directory +
        takes the absolute path of the Tcl library directory and parses through it
        Returns:
        a long lists of lists of lists, each list element contains a three-element list of the format { {info} {public procedures Index: openacs-4/packages/acs-templating/www/doc/TclDocs/util.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/util.adp,v diff -u -N -r1.2.2.4 -r1.2.2.5 --- openacs-4/packages/acs-templating/www/doc/TclDocs/util.adp 7 Nov 2016 19:23:16 -0000 1.2.2.4 +++ openacs-4/packages/acs-templating/www/doc/TclDocs/util.adp 22 Apr 2017 18:33:51 -0000 1.2.2.5 @@ -103,7 +103,7 @@
        uses ns_library to find the server root, may not always -be accurate because it essentially asks for the tcl library path +be accurate because it essentially asks for the Tcl library path and strips off the last /tcl directory
        Index: openacs-4/packages/acs-templating/www/doc/demo/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/index.adp,v diff -u -N -r1.3.2.8 -r1.3.2.9 --- openacs-4/packages/acs-templating/www/doc/demo/index.adp 1 Dec 2016 20:43:45 -0000 1.3.2.8 +++ openacs-4/packages/acs-templating/www/doc/demo/index.adp 22 Apr 2017 18:33:51 -0000 1.3.2.9 @@ -11,7 +11,7 @@ and the "Template" files have .adp . If you want to see a little behind the scenes, -you can look at the tcl code into which we compile the template. +you can look at the Tcl code into which we compile the template. The last column will deliver the resulting page to your browser.

        Mechanisms underlaid in red are known to not work.

        General

        Index: openacs-4/packages/acs-templating/www/doc/guide/composite.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/guide/composite.adp,v diff -u -N -r1.2.2.6 -r1.2.2.7 --- openacs-4/packages/acs-templating/www/doc/guide/composite.adp 1 Dec 2016 20:43:45 -0000 1.2.2.6 +++ openacs-4/packages/acs-templating/www/doc/guide/composite.adp 22 Apr 2017 18:33:51 -0000 1.2.2.7 @@ -102,7 +102,7 @@

        Here we assume the ACS/Tcl situation, where the "code" -is a tcl script in a .tcl file. The template is a .adp file.

        +is a Tcl script in a .tcl file. The template is a .adp file.

        Variants of Page Nodes

        The graph of the overall structure has five nodes, shown as a code/template pair. This is the standard situation, where the Index: openacs-4/packages/acs-templating/www/doc/guide/form-widgets.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/guide/form-widgets.adp,v diff -u -N -r1.2.2.3 -r1.2.2.4 --- openacs-4/packages/acs-templating/www/doc/guide/form-widgets.adp 7 Nov 2016 19:23:16 -0000 1.2.2.3 +++ openacs-4/packages/acs-templating/www/doc/guide/form-widgets.adp 22 Apr 2017 18:33:51 -0000 1.2.2.4 @@ -6,14 +6,14 @@ Templating System : Developer Guide : User Guide -

        Form widgets are implemented as tcl procs that output the html -to generate the form element. The tcl proc must be in the +

        Form widgets are implemented as Tcl procs that output the html +to generate the form element. The Tcl proc must be in the template::widget namespace. So the proc for the search widget is called template::widget::search. The code that generates the built in widgets is in packages/acs-templating/tcl/widget-procs.tcl.

        If the data from the form widget needs to be formatted or -processed a tcl proc is created in the template::data::transform +processed a Tcl proc is created in the template::data::transform namespace. For example, templatete::data::transform::search. This takes the input from the user and processes it to be returned to -the tcl code handling the form.

        +the Tcl code handling the form.


        Index: openacs-4/packages/acs-templating/www/doc/guide/tcl.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/guide/tcl.adp,v diff -u -N -r1.2.2.5 -r1.2.2.6 --- openacs-4/packages/acs-templating/www/doc/guide/tcl.adp 1 Dec 2016 20:43:45 -0000 1.2.2.5 +++ openacs-4/packages/acs-templating/www/doc/guide/tcl.adp 22 Apr 2017 18:33:51 -0000 1.2.2.6 @@ -14,7 +14,7 @@ AOLserver. For examples, see the section "embedded tcl" on the demonstration page.

        Generally, avoid putting escaped Tcl code in adp files, or -generating HTML fragments in tcl procedures. It subverts the +generating HTML fragments in Tcl procedures. It subverts the separation of code and layout, one of the benefits of templating. Embedded Tcl makes templates non-portable to ACS/Java.


        Index: openacs-4/packages/acs-templating/www/doc/guide/wizard-procs-doc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/guide/wizard-procs-doc.adp,v diff -u -N -r1.2.2.3 -r1.2.2.4 --- openacs-4/packages/acs-templating/www/doc/guide/wizard-procs-doc.adp 7 Nov 2016 19:23:16 -0000 1.2.2.3 +++ openacs-4/packages/acs-templating/www/doc/guide/wizard-procs-doc.adp 22 Apr 2017 18:33:51 -0000 1.2.2.4 @@ -21,7 +21,7 @@ its the same as your current wizard file. Has no effect for subwizards.
      • name - use to distinguish between the different wizards, since you can have 1 or more subwizard. name must be no spaces, -alpanumeric similar to normal tcl variable naming convention
      • params - are used to keep values that you would like to pass on +alpanumeric similar to normal Tcl variable naming convention
      • params - are used to keep values that you would like to pass on to the other steps
      • steps - are use to define what includes to use for each step of the wizard
      • @@ -40,7 +40,7 @@ <include src="\@wizard:current_url\@"> -
      • Create the individual steps, these are just normal tcl and/or +
      • Create the individual steps, these are just normal Tcl and/or adp files. So make a step1.tcl, step1.adp, step2.tcl, step2.adp, step3.tcl and step3.adp. Normally this files are self submitting forms
      • Add "template:wizard forward" on each step (eg. @@ -126,9 +126,9 @@ set by "template::wizard set_param", while ad_page_contract will not pick that up since it will get what is the request http var value. This is because "template::wizard -get_param" gets the value from the tcl var while +get_param" gets the value from the Tcl var while ad_page_contract gets the value from the http var. So while -processing in tcl that value may change.
      • +processing in Tcl that value may change.
      • How can you get the url of a wizard that is not your current step?

        You can use the following on your wizard.adp Index: openacs-4/packages/acs-templating/www/doc/tagref/include.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/tagref/include.adp,v diff -u -N -r1.2.2.6 -r1.2.2.7 --- openacs-4/packages/acs-templating/www/doc/tagref/include.adp 7 Nov 2016 19:23:16 -0000 1.2.2.6 +++ openacs-4/packages/acs-templating/www/doc/tagref/include.adp 22 Apr 2017 18:33:51 -0000 1.2.2.7 @@ -65,7 +65,7 @@ package.

      • If the src attribute begins with a slash, the path is assumed to be relative to the server root, the parent directory -of the tcl library. If not, the path is assumed to be relative to +of the Tcl library. If not, the path is assumed to be relative to the current template, not the URL of the page request.
      • If the page layout is sensitive to additional whitespace surrounding the subtemplate, then care must be taken that the