-
+
110.0 Performance
The Templating System must not cause any performance problems to a
Index: openacs-4/packages/acs-templating/www/doc/timing-1.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/timing-1.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/timing-1.adp 17 Sep 2014 19:06:34 -0000 1.1.2.1
@@ -0,0 +1,39 @@
+
+{/doc/acs-templating {Templating}} {Template Timing Results}
+Template Timing Results
+
+
+
+Results
+The measurements were taken on dev0103-001
on 5
+October 2000, probably with acs-4-0-beta-R20001001. Here are the
+graphs for the 14 stages, titled by the log message of their
+beginning.
+Invoking preauth filter rp_filter
No difference; all take about 2.6 ms. The same is the case for
+the few following stages: Short times and apparently independent of
+the kind of page.
Looking for node to match
+/acs-templating/admin/test/chain-frac-0.
Found /acs-templating/.
Performing developer support logging
Checking for changed libraries
Handling authentication
For some reason, this seems to take much longer on the Tcl-only
+page. Maybe because it's the first in a triple of pages that
+e-Tester requests? There may be a little longer time gap between
+chain-frac-2 and the next request of chain-frac-0
Handling authorization
An unexplained but clear distinction here: 0 is faster than 2,
+and 1 is slowest.
Done invoking preauth filter rp_filter (returning
+filter_ok)
Invoking registered procedure rp_handler
Searching for
+/webroot/web/brech/acs/packages/acs-templating/www/admin/test/chain-frac-0.*
Serving
+/webroot/web/brech/acs/packages/acs-templating/www/admin/test/chain-frac-0.tcl
+with rp_handle_tcl_request
Here the actual work supposedly happens. The Tcl-only page is
+clearly fastest. Always reparsing pages expectedly affects the
+templated page, and -2, which compiles two ADP pages, is affected
+more than -1. The benefit of -2, wrapping -1 in another include,
+isn't apparent; on the contrary, -1 is in all cases a bit faster
+than -2. The benefit of cacheing seems more than offset by the
+extra complexity of nesting several templates.
Invoking trace filter ad_issue_deferred_dml
For some reason, the Tcl-only page takes significantly
+longer.
Done invoking trace filter ad_issue_deferred_dml (returning
+filter_ok)
Invoking trace filter ds_trace_filter
That last phase is ended by Done invoking trace filter
+ds_trace_filter (returning filter_ok)
+
Total time
Overall, the templated pages are delivered faster.
+Forcing the template system to always reread all files and to
+recompile the ADP part slows them down, as expected, but overall
+they are still faster than the Tcl-only page.
Christian
+Brechbuehler
+Last modified: Tue Oct 17 20:04:29 EDT 2000
+
Index: openacs-4/packages/acs-templating/www/doc/timing-2.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/timing-2.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/timing-2.adp 17 Sep 2014 19:06:34 -0000 1.1.2.1
@@ -0,0 +1,23 @@
+
+{/doc/acs-templating {Templating}} {Template Timing Results}
+Template Timing Results
+
+
+
+Results
+The measurements were taken on reusia.boston
on 13
+October 2000, with approximately acs-4-0-beta-2-R20001009.
+Here are the graphs for the 15 stages, and the log message of
+their beginning is written in the lower right of the graphs. In
+comparison with the first measurement,
+the steeper slopes indicate much less variation in the
+measurements, which reflects the more reproducible conditions
+(essentially no other activity) on reusia.boston in comparison with
+dev0103-001.
Individual Stages
Total Time (Sum of all Stages)
Overall, the templated pages are delivered markedly
+slower, by about 65ms. Forcing the template system to always
+reread all files and to recompile the ADP part slows them down, as
+expected, but overall they are still faster than the Tcl-only
+page.
Christian
+Brechbuehler
+Last modified: Wed Oct 18 16:45:17 EDT 2000
+
Index: openacs-4/packages/acs-templating/www/doc/timing-3.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/timing-3.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/timing-3.adp 17 Sep 2014 19:06:34 -0000 1.1.2.1
@@ -0,0 +1,25 @@
+
+{/doc/acs-templating {Templating}} {Template Timing Results}
+Template Timing Results
+
+
+
+Results
The measurements were taken on reusia.boston
on 17
+October 2000, with tarball acs-3-4-6-R20001008. Templating under
+3.4 is quite different; instead of a .tcl script, datasources are
+defined in a .data file that has a different XML syntax.
We have graphs for 9 stages only. While Tcl pages generate four
+more entries, these lack from templated pages, and hence I
+suppressed them. The log message that marks the beginning of each
+phase is written in the lower right of the graphs. Each curve curve
+plots 288 page requests. As I didn't back port of the configurable
+cache refreshing stragegy ('never' or 'always'), I show all graphs
+in the 'normal' colors. The label is 'do', though.
Individual Stages
Total Time (Sum of all Stages)
To show off the graphing method, compare the graph above with
+the one below, which only uses the first 32 measurements. The
+curves are less smooth, but the message is the same.
In ACS 3.4.6, Tcl-only pages are sereved faster than in
+4.0 beta-2. The templated pages are delivered much slower.
+The first time the template system reads a templated page, it takes
+about 3 seconds! The result is cached, mitigating the problem a
+lot.
Christian
+Brechbuehler
+Last modified: Tue Oct 17 20:26:14 EDT 2000
+
Index: openacs-4/packages/acs-templating/www/doc/timing.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/timing.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/timing.adp 17 Sep 2014 19:06:34 -0000 1.1.2.1
@@ -0,0 +1,165 @@
+
+{/doc/acs-templating {Templating}} {Timing a Templated Page}
+Timing a Templated Page
+
+
+
+Timing a Templated Page
+by Christian
+BrechbühlerI. Introduction
+One of the requirements for the
+template system asks for efficiency:
+
+This page documents the attempt to verify this requirement.
+II. Methods
I wrote a sample page for this test. It expands four real
+numbers into continued fractions. I created three versions:
+-
+chain-frac-0,
+a Tcl page with inline HTML,
-
+chain-frac-1,
+a templated page, i.e. a Tcl and an HTML file, and
-
+chain-frac-2,
+an ADP page that simply
<include>
s
+chain-frac-1.
+
The reason for creating chain-frac-2.adp
is that in
+this way, the script chain-frac-1.tcl
is handled
+inside the templating system, and hence loaded once and cached.
+There is hope that this might be faster.
Normally, the templating system re-reads a file whenever the
+version on disk is out of date. ADP pages are compiled to TCL, and
+both ADP and Tcl pages are cached as Tcl procs. The parameter
+RefreshCache
in section template
can be
+set to always
or never
to affect the
+cacheing strategy; the latter may be useful for a production site.
+All timing is carried out for the three settings
+always
, normal
, and never
;
+the associated variable is called check
.
I created a script in e-Tester that requests the three pages
+from my development server on dev0103-001. One timing of requesting
+a page isn't very expressive. A lot of factors affect the page load
+time. To offset these and get better results, I repeatedly request
+the pages. For the timing, I have e-Tester iterate this script 200
+times. To compesate for varying load on the machine, i ran the
+iteration twice for each setting of RefreshCache
at
+different times of the day.
The timing information is taken from the error log file entries
+that the request processor produces with parameter
+LogDebugP=1
. For finer granularity I changed rp_debug
+to divide the clock clicks (microsecond) difference by 1000.0
+instead of 1000. Delivering a page gives us 15 log file entries
+with timestamps. I treat the first one (? ms) as 0. There must be
+no other page requests from this AOLserver during the measurement.
+I note the length of the error log before and after one run of the
+script. Afterwards I cut out the error log sections indicated by
+these positions into files never
, normal
,
+and always
.
The following steps extract the relevant information and bring
+it in a form suitable for gnuplot.
+-
+Extract time from log file sections. This is done in
+tcsh.
+
+foreach i ( never normal always )
+ fgrep '] Notice: RP (' $i > $i-0
+ echo > $i-1
+ foreach conn (`cut -d- -f2 always-0 | sort -u`)
+ echo "$i '$conn'"
+ fgrep "[-$conn-]" $i-0 | cut -d: -f5- >> $i-1
+ end
+ cut -d" " -f3 $i-1| cut -c2-| tr \? 0 > $i-2
+end
+
+
+The three resulting files, ending in -2, contain 18000 numbers, for
+2 runs * 200 tries * 3 pages * 15 stages. -
+Group and sort times. The time one stage of processing
+takes is given by the difference of two time adjacent entries. This
+defines stage00 to stage13; I keep the total time in stage14. This
+is done by the Tcl script
+
dev0103-001:/home/brech/prog/tcl/timing.tcl
, which
+generates the directories stage00
to
+stage14
and the ten files
+{0
,1
,2
}-{never
,normal
,always
},
+and t_max
in each of them. Each of the former files
+contains the 2*200 samples, ordered for graphing.
+III. Presentation
Color Codes
The different experiments are color coded as follows.
+
+ | never | normal | always |
+
+chain-frac-0 | | | |
+
+chain-frac-1 | | | |
+
+chain-frac-2 | | | |
+
+
+(They lie in the isoluminant plane in the middle of the RGB color
+space.)
+Presenting Distributions
A number of statistic measures can summarize an ensemble of
+data, in our case, the 400 timings. The average is affected by
+outliers; the median is much more robust. Maybe some dispersion
+measure would be of interest, too. Some people plot histograms, but
+that approach is frought with its own problems. I chose to use all
+the data and plot estimated distribution functions. Our random
+variable being time T, its distribution function is
+defined as
+FT
+(t) =
+P[T <= t]
+ .
+It is sometimes referred to as cumulative density function. Its
+deriviative p(t) =
+F'(t) is the distribution density of the
+random variable T, which histograms approximate.
+The curve always increases monotonically from 0 to 1. In case of
+a normal distribution, you get the erf shape; for a uniform
+distribution it is a ramp. This form of presentation throws away no
+information, and it shows all about the distribution of a single
+variable. I am pretty sure the times that different stages of one
+request take are statistically dependent, but I don't consider that
+for the time being. The median is the abscissa t at
+which the ordinate F(t)=1/2.
The curves for all nine experiments are drawn in the same graph
+for comparison. Note that the abscissa is scaled very differently
+for various stages.
Steps
IV. Results
+-
+graphs from dev0103-001,
+approximately acs-4-0-beta-R20001001.
-
+graphs from reusia.boston,
+approximately acs-4-0-beta-2-R20001009.
-
+graphs from reusia.boston, from ACS
+3.4.6 tarball. This comparison is not completely fair.
+
V. Conclusion
Currently, the template system doesn't meet the performance
+requirement.
Earlier on dev0103-001, templated pages loaded fast enough.
+Although the processing stage seems to a lot be more than 10%
+slower, the overall performance is rather increased than slowed by
+templating.
On reusia.boston, we had a much better performance of the
+request processor. The processing times of the pages proper (stage
+10 before, 11 now) didn't change much; we just got clearer results.
+The total processing time of Tcl-only pages is around 155ms, while
+templated pages take around 220ms, that is 42% longer (or Tcl-only
+pages take 30% less).
Relative times depend on the other components of the pipeline.
+The difference of 65ms is a large percentage of a total serving
+time of 155ms; when other parts of the system (e.g., the request
+processor) were slower, this wasn't that noticeable.
For ACS 3.4, Tcl-only chain-frac-0 pages take 115ms, where the
+templated versisons are much slower, 320ms for chain-frac-1 and 340
+for -2.
VI. Further Work
Tune templating in ACS 4.0.
Christian
+Brechbühler
+Last modified: Tue Oct 17 20:11:49 EDT 2000
+
+
+
Index: openacs-4/packages/acs-templating/www/doc/todo.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/todo.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/todo.adp 17 Sep 2014 19:06:35 -0000 1.1.2.1
@@ -0,0 +1,12 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Data Source API
We need to resolve how onerow and multirow data sources are
+represented internally, and plug in the proper API. I originally
+used ns_sets to represent rows in a data source (and continue to do
+so for the time being). jsalz instead uses arrays and lists to
+represent rows. Task: look at jsalz's data source code.
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/cm_widget.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/cm_widget.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/cm_widget.adp 17 Sep 2014 19:06:35 -0000 1.1.2.1
@@ -0,0 +1,29 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace cm_widget
Procedures associated with custom metadata widgets for
+basic CR content types
Method Summary
+Listing of public methods:
The namespace cm_widget currently contains no public
+methods.
Method Detail
+* indicates required
+Private Methods:
+
+
+cm_widget::validate_description by Michael Pih
+ |
+Make sure that description <= 4000
+bytes -
+Parameters:
+
+value *
+ | The submitted value of the description form
+element |
+
+
+ |
+
+* indicates required
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/cms_rel.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/cms_rel.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/cms_rel.adp 17 Sep 2014 19:06:35 -0000 1.1.2.1
@@ -0,0 +1,44 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace cms_rel
Procedures for managing relation items and child
+items
Method Summary
+Listing of public methods:
+cms_rel::sort_child_item_order
cms_rel::sort_related_item_order
+
Method Detail
+* indicates required
Public Methods:
+
+cms_rel::sort_child_item_order by Michael Pih
+ |
+Resort the child items order for a given content item,
+ensuring that order_n is unique for an item_id. Chooses new order
+based on the old order_n and then rel_id (the order the item was
+related) -
+Parameters:
+
+item_id *
+ | The item for which to resort child items |
+
+
+ |
+
+
+cms_rel::sort_related_item_order by Michael Pih
+ |
+Resort the related items order for a given content
+item, ensuring that order_n is unique for an item_id. Chooses new
+order based on the old order_n and then rel_id (the order the item
+was related) -
+Parameters:
+
+item_id *
+ | The item for which to resort related items |
+
+
+ |
+
+* indicates required
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/content.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/content.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/content.adp 17 Sep 2014 19:06:35 -0000 1.1.2.1
@@ -0,0 +1,649 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace content
Procedures for generating and processing content
+content creation and editing forms..
Method Summary
+Listing of public methods:
+content::add_attribute_element
content::add_attribute_elements
content::add_basic_revision
content::add_child_relation_element
content::add_content
content::add_content_element
content::add_revision
content::add_revision_form
content::copy_content
content::get_attribute_enum_values
content::get_latest_revision
content::get_object_id
content::new_item
content::new_item_form
content::validate_name
+
Method Detail
+* indicates required
Public Methods:
+content::add_attribute_element |
+Add a form element (possibly a compound widget) to an
+ATS form object. for entering or editing an attribute
+value. -
+Parameters:
+
+
+form_name *
+ | The name of the ATS form object to which the
+element should be added. |
+
+
+content_type *
+ | The content type keyword to which this attribute
+belongs. |
+
+
+attribute *
+ | The name of the attribute, as represented in the
+attribute_name column of the acs_attributes table. |
+
+
+attribute_data *
+ | Optional nested list of parameter data for the the
+attribute (generated by get_attribute_params). |
+
+
+
+ |
+
+content::add_attribute_elements |
+Add form elements to an ATS form object for all
+attributes of a content type.
+-
+Parameters:
+
+
+form_name *
+ | The name of the ATS form object to which objects
+should be added. |
+
+
+content_type *
+ | The content type keyword for which attribute
+widgets should be added. |
+
+
+revision_id *
+ | The revision from which default values should be
+queried |
+
+
+ - Returns:
- The list of attributes that were added.
+
+ |
+
+content::add_basic_revision |
+Create a basic new revision using the content_revision
+PL/SQL API.
+-
+Parameters:
+
+
+item_id *
+ | |
+
+
+revision_id *
+ | |
+
+
+title *
+ | |
+
+
+ - Options:
+
+description | |
+
+mime_type | |
+
+text | |
+
+tmpfile | |
+
+
+
+ |
+
+content::add_child_relation_element |
+Add a select box listing all valid child relation tags.
+The form must contain a parent_id element and a content_type
+element. If the elements do not exist, or if there are no valid
+relation tags, this proc does nothing.
+-
+Parameters:
+
+form_name *
+ | The name of the form |
+
+ - Options:
+
+section |
+none If present, creates a new form section
+for the element. |
+
+label | {Child relation tag} The label for the
+element |
+
+
+
+ |
+
+content::add_content |
+Update the BLOB column of a revision with content
+submitted in a form -
+Parameters:
+
+revision_id *
+ | The object ID of the revision to be updated. |
+
+
+ |
+
+content::add_content_element |
+Adds a content input element to an ATS form
+object. -
+Parameters:
+
+
+form_name *
+ | The name of the form to which the object should be
+added. |
+
+
+content_method *
+ | One of no_content, text_entry or file_upload |
+
+
+
+ |
+
+content::add_revision |
+Create a new revision for an existing item based on a
+valid form submission. Queries for attribute names and inserts a
+row into the attribute input view for the appropriate content type.
+Inserts the contents of a file into the content column of the
+cr_revisions table for the revision as well. -
+Parameters:
+
+
+form_name *
+ | Name of the form from which to obtain attribute
+values. The form should include an item_id and revision_id. |
+
+
+tmpfile *
+ | Name of the temporary file containing the content
+to upload. |
+
+
+
+ |
+
+content::add_revision_form |
+Adds elements to an ATS form object for adding a
+revision to an existing item. If the item already exists, element
+values default a previous revision (the latest one by default). If
+the form does not already exist, creates the form object and sets
+its enctype to multipart/form-data to allow for text entries
+greater than 4000 characters.
+- Options:
+
+form_name | The name of the ATS form object. Defaults to {
+new_item} . |
+
+content_type | The content_type of the item. Defaults to {
+content_revision} . |
+
+content_method | The method to use for uploading the content body.
+If the content type is text, defaults to text entry, otherwise
+defaults to file upload. |
+
+item_id | The item ID of the revision. Defaults to null
+(item_id must be set by the calling code). |
+
+revision_id | The revision ID from which to draw default values.
+Defaults to the latest revision |
+
+attributes | A list of attribute names for which to create form
+elements. |
+
+action | The URL to which the form should redirect
+following a successful form submission. |
+
+
+
+ |
+
+content::copy_content |
+Update the BLOB column of one revision with the content
+of another revision -
+Parameters:
+
+
+revision_id_src *
+ | The object ID of the revision with the content to
+be copied. |
+
+
+revision_id_dest *
+ | The object ID of the revision to be updated.
+copied. |
+
+
+
+ |
+
+content::get_attribute_enum_values |
+Returns a list of { pretty_name enum_value } for an
+attribute of datatype enumeration. -
+Parameters:
+
+attribute_id *
+ | The primary key of the attribute as in the
+attribute_id column of the acs_attributes table. |
+
+
+ |
+
+content::get_latest_revision |
+Get the ID of the latest revision for the specified
+content item. -
+Parameters:
+
+item_id *
+ | The ID of the content item. |
+
+
+ |
+
+content::new_item |
+Create a new item, including the initial revision,
+based on a valid form submission.
+-
+Parameters:
+
+
+form_name *
+ | Name of the form from which to obtain item
+attributes, as well as attributes of the initial revision. The form
+should include an item_id, name and revision_id. |
+
+
+tmpfile *
+ | Name of the temporary file containing the content
+to upload for the initial revision. |
+
+
+ - See Also:
- add_revision -
+
+
+ |
+
+content::new_item_form |
+Adds elements to an ATS form object for creating an
+item and its initial revision. If the form does not already exist,
+creates the form object and sets its enctype to multipart/form-data
+to allow for text entries greater than 4000
+characters.
+- Options:
+
+form_name | The name of the ATS form object. Defaults to {
+new_item} . |
+
+content_type | The content_type of the item. Defaults to {
+content_revision} . |
+
+content_method | The method to use for uploading the content body.
+Valid values are { no_content} , { text_entry} , and { file_upload}
+. If the content type allows text, defaults to text entry,
+otherwise defaults to file upload. |
+
+parent_id | The item ID of the parent. Defaults to null
+(Parent is the root folder). |
+
+name | The default name of the item. Default is an empty
+string (User must supply name). |
+
+attributes | A list of attribute names for which to create form
+elements. |
+
+action | The URL to which the form should redirect
+following a successful form submission. |
+
+
+
+ |
+
+content::validate_name |
+Make sure that name is unique for the
+folder
+-
+Parameters:
+
+form_name *
+ | The name of the form (containing name and
+parent_id) |
+
+ - Returns:
- 0 if there are items with the same name, 1 otherwise
+
+ |
+
+Private Methods:
+
+content::add_revision_dml |
+Perform the DML to insert a revision into the
+appropriate input view.
+-
+Parameters:
+
+
+statement *
+ | The DML for the insert statement, specifying a
+bind variable for each column value. |
+
+
+bind_vars *
+ | An ns_set containing the values for all bind
+variables. |
+
+
+tmpfile *
+ | The server-side name of the file containing the
+body of the revision to upload into the content BLOB column of
+cr_revisions. |
+
+
+filename *
+ | The client-side name of the file containing the
+body of the revision to upload into the content BLOB column of
+cr_revisions |
+
+
+ - See Also:
- add_revision -
+
+
+ |
+
+content::attribute_insert_statement |
+Prepare the insert statement into the attribute input
+view for a new revision (see the content repository documentation
+for details about the view). -
+Parameters:
+
+
+content_type *
+ | The content type of the item for which a new
+revision is being prepared. |
+
+
+table_name *
+ | The storage table of the content type. |
+
+
+bind_vars *
+ | The name of an ns_set in which to store the
+attribute values for the revision. (Typically duplicates the
+contents of {[ns_getform].} |
+
+
+form_name *
+ | The name of the ATS form object used to process
+the submission. |
+
+
+
+ |
+
+content::get_attribute_params |
+Query for parameters associated with a particular
+attribute -
+Parameters:
+
+
+content_type *
+ | The content type keyword to which this attribute
+belongs. |
+
+
+attribute_name *
+ | The name of the attribute, as represented in the
+attribute_name column of the acs_attributes table. |
+
+
+
+ |
+
+content::get_attributes |
+Returns columns from the acs_attributes table for all
+attributes associated with a content type. -
+Parameters:
+
+
+content_type *
+ | The name of the content type (ACS Object Type) for
+which to obtain the list of attributes. |
+
+
+args *
+ | Names of columns to query. If no columns are
+specified, returns a simple list of attribute names. |
+
+
+
+ |
+
+content::get_default_content_method |
+Gets the content input method most appropriate for an
+content type, based on the MIME types that are registered for that
+content type. -
+Parameters:
+
+content_type *
+ | The content type for which an input method is
+needed. |
+
+
+ |
+
+content::get_sql_value |
+Return the sql statement for a column value in an
+insert or update statement, using a bind variable for the actual
+value and wrapping it in a conversion function where
+appropriate. -
+Parameters:
+
+
+name *
+ | The name of the column and bind variable (they
+should be the same). |
+
+
+datatype *
+ | The datatype of the column. |
+
+
+
+ |
+
+content::get_type_attribute_params |
+Query for attribute form metadata
+-
+Parameters:
+
+args *
+ | Any number of object types |
+
+ - Returns:
- A list of attribute parameters nested by object_type,
+attribute_name and the is_html flag. For attributes with no
+parameters, there is a single entry with is_html as null.
+
+ |
+
+content::get_type_info |
+Return specified columns from the acs_object_types
+table. -
+Parameters:
+
+
+object_type *
+ | Object type key for which info is required. |
+
+
+ref *
+ | If no further arguments, name of the column value
+to return. If further arguments are specified, name of the array in
+which to store info in the calling |
+
+
+args *
+ | Column names to query. |
+
+
+
+ |
+
+content::get_widget_param_value |
+Utility procedure to return the value of a widget
+parameter -
+Parameters:
+
+
+array_ref *
+ | The name of an array in the calling frame
+containing parameter data selected from the form metadata. |
+
+
+content_type *
+ | The current content {type;} defaults to
+content_revision |
+
+
+
+ |
+
+content::prepare_content_file |
+Looks for an element named { content} in a form and
+prepares a temporarily file in UTF-8 for uploading to the content
+repository. Checks for a query variable named { content.tmpfile} to
+distinguish between file uploads and text entry. If the type of the
+file is text, then ensures that is in UTF-8. Does nothing if the
+uploaded file is in binary format.
+-
+Parameters:
+
+form_name *
+ | The name of the form object in which content was
+submitted. |
+
+ - Returns:
- The path of the temporary file containing the content, or an
+empty string if the form does not include a content element or the
+value of the element is null.
+
+ |
+
+content::set_attribute_values |
+Set the default values for attribute elements in ATS
+form object based on a previous revision -
+Parameters:
+
+
+form_name *
+ | The name of the ATS form object containing the
+attribute elements. |
+
+
+content_type *
+ | The type of item being revised in the form. |
+
+
+revision_id *
+ | The revision ID from where to get the default
+values |
+
+
+attributes *
+ | The list of attributes whose values should be
+set. |
+
+
+
+ |
+
+content::set_content_value |
+Set the default value for the content text area in an
+ATS form object based on a previous revision -
+Parameters:
+
+
+form_name *
+ | The name of the ATS form object containing the
+content element. |
+
+
+revision_id *
+ | The revision ID of the content to revise |
+
+
+
+ |
+
+content::string_to_file |
+Write a string in UTF-8 encoding to of temp file so it
+can be uploaded into a BLOB (which is blind to character
+encodings). Returns the name of the temp file. -
+Parameters:
+
+s *
+ | The string to write to the file. |
+
+
+ |
+
+content::update_content_from_file |
+Update the BLOB column of a revision with the contents
+of a file -
+Parameters:
+
+
+revision_id *
+ | The object ID of the revision to update. |
+
+
+tmpfile *
+ | The name of a temporary file containing the
+content. The file is deleted following the update. |
+
+
+
+ |
+
+content::upload_content |
+Inserts content into the database from an uploaded
+file. Does automatic mime_type updating Parses text/html content
+and removes tags -
+Parameters:
+
+
+db *
+ | A db handle |
+
+
+revision_id *
+ | The revision to which the content belongs |
+
+
+tmpfile *
+ | The server-side name of the file containing the
+body of the revision to upload into the content BLOB column of
+cr_revisions. |
+
+
+filename *
+ | The client-side name of the file containing the
+body of the revision to upload into the content BLOB column of
+cr_revisions |
+
+
+
+ |
+
+* indicates required
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/content_add.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/content_add.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/content_add.adp 17 Sep 2014 19:06:35 -0000 1.1.2.1
@@ -0,0 +1,36 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace content_add
Procedures regarding content methods
Method Summary
+Listing of public methods:
+content_add::content_method_html
+
Method Detail
+* indicates required
Public Methods:
+
+content_add::content_method_html by Michael Pih
+ |
+Generates HTML stub for revision content method choices
+for a content item -
+Parameters:
+
+
+db *
+ | A database handle |
+
+
+content_type *
+ | The content type of the item |
+
+
+item_id *
+ | The item id |
+
+
+
+ |
+
+* indicates required
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/content_method.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/content_method.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/content_method.adp 17 Sep 2014 19:06:36 -0000 1.1.2.1
@@ -0,0 +1,87 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace content_method
Procedures regarding content methods
Method Summary
+Listing of public methods:
+content_method::flush_content_methods_cache
content_method::get_content_methods
+
Method Detail
+* indicates required
Public Methods:
+
+content_method::flush_content_methods_cache by Michael Pih
+ |
+Flushes the cache for content_method_types for a given
+content type. If no content type is specified, the entire
+content_method_types cache is flushed -
+Parameters:
+
+content_type *
+ | The content type, default null |
+
+
+ |
+
+
+content_method::get_content_methods by Michael Pih
+ |
+Returns a list of content_methods that are associated
+with a content type, first checking for a default method, then for
+registered content methods, and then for all content
+methods
+-
+Parameters:
+
+content_type *
+ | The content type |
+
+ - Returns:
- A list of content methods or a list of label-value pairs of
+content methods if the " -get_labels" option is specified
- Options:
+get_labels | Instead of a list of content methods, return a
+list of label-value pairs of associated content methods. |
+
- See Also:
- content_method::get_content_method_options,
+content_method::text_entry_filter_sql -
+
+
+ |
+
+Private Methods:
+
+
+content_method::get_content_method_options by Michael Pih
+ |
+Returns a list of label, content_method pairs that are
+associated with a content type, first checking for a default
+method, then for registered content methods, and then for all
+content methods
+-
+Parameters:
+
+content_type *
+ | The content type |
+
+ - Returns:
- A list of label, value pairs of content methods
- See Also:
- content_method::get_content_methods,
+content_method::text_entry_filter_sql -
+
+
+ |
+
+
+content_method::text_entry_filter_sql by Michael Pih
+ |
+Generate a SQL stub that filters out the text_entry
+content method
+-
+Parameters:
+
- Returns:
- SQL stub that possibly filters out the text_entry content
+method
+
+ |
+
+* indicates required
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/doc.adp 17 Sep 2014 19:06:36 -0000 1.1.2.1
@@ -0,0 +1,81 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace doc
Method Summary
+Listing of public methods:
The namespace doc currently contains no public
+methods.
Method Detail
+* indicates required
+Private Methods:
+
+
+ by simon
+ |
+called by parse_file, this procedure is given the body
+of text between two namespace markers in a tcl library file and
+parses out procedure source and comments -
+Parameters:
+
+text_lines *
+ | namespace text body |
+
+
+ |
+
+ |
Parse API documentation from a Tcl page API
+documentation is parsed as follows: Document is scanned until a
+\@namespace directive is encountered. The remainder of the file is
+scanned for \@private or \@public directives. When one of these
+directives is encountered, the file is scanned up to a proc
+declaration and the text in between is parsed as documentation for
+a single procedure. The text between the initial \@private or
+\@public directive and the next directive is considered a general
+comment on the procedure Valid directives in a procedure doc
+include: - \@author - \@param (for hard parameters) - \@see (should
+have the form namespace::procedure. A reference to an entire
+namespace should be namespace::. By convention the API for each
+namespace should be in a file of the same name, so that a link can
+be generated automatically). - \@option (for switches such as -foo)
+- \@return |
+
+ |
+called by parse_comment_text -
+Parameters:
+
+comment_text *
+ | this should include the source text |
+
+
+ |
+
+ |
+called by parse_namespace -
+Parameters:
+
+
+comment_text *
+ | body of comment text to be parsed through |
+
+
+source_text *
+ | source text of the procedure |
+
+
+
+ |
+
+ |
+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
+listing } {private procedures listing} }
- See Also:
- namespace - util
+ - proc - doc::parse_file
template::util::comment_text_normalize
+
+
+ |
+
+* indicates required
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/doc__util.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/doc__util.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/doc__util.adp 17 Sep 2014 19:06:36 -0000 1.1.2.1
@@ -0,0 +1,95 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace doc::util
Method Summary
+Listing of public methods:
The namespace doc::util currently contains no public
+methods.
Method Detail
+* indicates required
+Private Methods:
+
+ |
+divides a string variable into a list of strings, all
+but the first element beginning with the indicated text {marker;}
+the first element of the created list contains all of the string
+preceding the first occurrence of the text marker
+-
+Parameters:
+
+
+text *
+ | name of string variable (not the string value
+itself) |
+
+
+marker *
+ | the string indicating text division |
+
+
+ - See Also:
- proc - doc::util::find_marker_indices
+
+
+ |
+
+ |
escapes out all square brackets |
+
+ |
+given a body of text and a text marker, returns a list
+of position indices for each occurrence of the text
+marker
+-
+Parameters:
+
+
+text *
+ | body of text to be searched through |
+
+
+marker *
+ | the text-divider mark |
+
+
+ - Returns:
- list of indices of the position immediately preceding each
+occurrence of the text marker; if there are no occurrences of the
+text marker, returns a zero-element list
- See Also:
- namespace - doc
+ - proc - doc::parse_file
doc::parse_namespace doc::util::text_divider
+
+
+ |
+
+ |
puts a space after all closing curly brackets, does not
+add a space when brackets are already followed by a
+space |
+
+ |
+used to sort the see list, which has structure {[name}
+name type type url url \] -
+Parameters:
+
+
+element1 *
+ | the first of the two list elements to be
+compared |
+
+
+element2 *
+ | the second of the two elements to be compared |
+
+
+
+ |
+
+* indicates required
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/form.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/form.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/form.adp 17 Sep 2014 19:06:36 -0000 1.1.2.1
@@ -0,0 +1,282 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace form
Commands for managing dynamic templated
+forms.
Method Summary
+Listing of public methods:
+
+
Method Detail
+* indicates required
Public Methods:
+ |
+Convenience procedure to set individual values of a
+form (useful for simple update forms). Typical usage is to query a
+onerow data source from database and pass the resulting array
+reference to set_values for setting default values in an update
+form. -
+Parameters:
+
+
+id *
+ | The form identifier |
+
+
+array_ref *
+ | The name of a local array variable whose keys
+correspond to element identifiers in the form |
+
+
+
+ |
+
+ |
+Determine whether a form exists by checking for its
+data structures.
+-
+Parameters:
+
+id *
+ | The ID of an ATS form object. |
+
+ - Returns:
- 1 if a form with the specified ID exists. 0 if it does
+not.
+
+ |
+
+ |
+Generates hidden input tags for all values in a form
+submission. Typically used to create a confirmation page following
+an initial submission.
+- Returns:
- A string containing hidden input tags for inclusion in a
+form.
+
+ |
+
+ |
+Initialize the data structures for a form.
+-
+Parameters:
+
+id *
+ | A keyword identifier for the form, such as {
+add_user} or { edit_item} . The ID must be unique in the context of
+a single page. |
+
+ - Options:
+
+method | The standard METHOD attribute to specify in the
+HTML FORM tag at the beginning of the rendered form. Defaults to
+POST. |
+
+html | A list of additional name-value attribute pairs to
+include in the HTML FORM tag at the beginning of the rendered form.
+Common attributes include JavaScript event handlers and multipart
+form encoding. For example, { -html { enctype multipart/form-data
+onSubmit validate() } } |
+
+elements | A block of element specifications. |
+
+
+
+ |
+
+ |
+Return a list which represents the result of getting
+combined values from multiple form elements -
+Parameters:
+
+
+id *
+ | The form identifier |
+
+
+args *
+ | A list of element identifiers. Each identifier may
+be a regexp. For example, form get_combined_values { foo.*} will
+combine the values of all elements starting with { foo} |
+
+
+return *
+ | The combined list of values |
+
+
+
+ |
+
+ |
+Return the number of elements in a form -
+Parameters:
+
+id *
+ | The form identifier |
+
+
+ |
+
+ |
+Return true if a submission in progress. The submission
+may or may not be valid.
+-
+Parameters:
+
+id *
+ | The form identifier |
+
+ - Returns:
- 1 if true or 0 if false
+
+ |
+
+ |
+Return true if preparing a form for an initial request
+(as opposed to repreparing a form that is returned to the user due
+to validation problems). This command is used to conditionally set
+default values for form elements.
+-
+Parameters:
+
+id *
+ | The form identifier |
+
+ - Returns:
- 1 if true or 0 if false
+
+ |
+
+ |
+Return true if submission in progress and submission
+was valid. Typically used to conditionally execute DML and redirect
+to the next page, as opposed to returning the form back to the user
+to report validation errors.
+-
+Parameters:
+
+id *
+ | The form identifier |
+
+ - Returns:
- 1 if true or 0 if false
+
+ |
+
+ |
+Set local variables for form variables (assume they are
+all single values). Typically used when processing the form
+submission to prepare for DML or other type of
+transaction. -
+Parameters:
+
+
+id *
+ | The form identifier |
+
+
+args *
+ | A list of element identifiers. If the list is
+empty, retreive all form elements |
+
+
+
+ |
+
+ |
+Set the name of the current section of the form. A form
+may be divided into any number of sections for layout purposes.
+Elements are tagged with the current section name as they are added
+to the form. A form style template may insert a divider in the form
+whenever the section name changes. -
+Parameters:
+
+
+id *
+ | The form identifier. |
+
+
+section *
+ | The name of the current section. |
+
+
+
+ |
+
+Private Methods:
+
+ |
+Auto-generate the template for a form
+-
+Parameters:
+
+
+id *
+ | The form identifier |
+
+
+style *
+ | The style template to use when generating the
+form. Form style templates must be placed in the forms subdirectory
+of the ATS resources directory. |
+
+
+ - Returns:
- A string containing a template for the body of the form.
+
+ |
+
+ |
Helper procedure used to access the basic data
+structures of a form object. Called by several of the form
+commands. |
+
+ |
+Iterates over all declared elements, checking for
+hidden widgets and rendering those that have not been rendered yet.
+Called after rendering a custom form template as a debugging
+aid. -
+Parameters:
+
+id *
+ | The form identifier |
+
+
+ |
+
+ |
+Render the HTML FORM tag along with a hidden element
+that identifies the form object.
+-
+Parameters:
+
+
+id *
+ | The form identifier |
+
+
+tag_attributes *
+ | A name-value list of special attributes to add to
+the FORM tag, such as JavaScript event handlers. |
+
+
+ - Returns:
- A string containing the rendered tags.
+
+ |
+
+ |
+Render the finished HTML output for a dynamic
+form.
+-
+Parameters:
+
+
+id *
+ | The form identifier |
+
+
+style *
+ | The style template to use when generating the
+form. Form style templates must be placed in the forms subdirectory
+of the ATS resources directory. |
+
+
+ - Returns:
- A string containing the HTML for the body of the form.
+
+ |
+
+* indicates required
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/item.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/item.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/item.adp 17 Sep 2014 19:06:36 -0000 1.1.2.1
@@ -0,0 +1,332 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace item
The item commands allow easy access to properties of
+the content_item object. In the future, a unified API for caching
+item properties will be developed here.
Also see:
+- namespace
- publish
+
Method Summary
+Listing of public methods:
+item::content_is_null
item::content_methods_by_type
item::get_best_revision
item::get_content_type
item::get_extended_url
item::get_id
item::get_item_from_revision
item::get_live_revision
item::get_mime_info
item::get_publish_status
item::get_revision_content
item::get_template_id
item::get_template_url
item::get_title
item::get_url
item::is_publishable
+
Method Detail
+* indicates required
Public Methods:
+item::content_is_null |
+Determines if the content for the revision is null (not
+mereley zero-length)
+-
+Parameters:
+
+revision_id *
+ | The revision id |
+
+ - Returns:
- 1 if the content is null, 0 otherwise
+
+ |
+
+item::content_methods_by_type |
+Determines all the valid content methods for
+instantiating a content type. Possible choices are text_entry,
+file_upload, no_content and xml_import. Currently, this proc merely
+removes the text_entry method if the item does not have a text mime
+type registered to it. In the future, a more sophisticated
+mechanism will be implemented.
+-
+Parameters:
+
+content_type *
+ | The content type |
+
+ - Returns:
- A Tcl list of all possible content methods
- Options:
+get_labels | Return not just a list of types, but a list of
+name-value pairs, as in the -options ATS switch for form
+widgets |
+
+
+ |
+
+item::get_best_revision |
+Attempts to retrieve the live revision for the item. If
+no live revision exists, attempts to retrieve the latest revision.
+If the item has no revisions, returns an empty string.
+-
+Parameters:
+
+item_id *
+ | The item id |
+
+ - Returns:
- The best revision id for the item, or an empty string if no
+revisions exist
- See Also:
- proc - item::get_item_from_revision
item::get_live_revision
+
+
+ |
+
+item::get_content_type |
+Retrieves the content type of tyhe item. If the item
+does not exist, returns an empty string.
+-
+Parameters:
+
+item_id *
+ | The item id |
+
+ - Returns:
- The content type of the item, or an empty string if no such
+item exists
+
+ |
+
+item::get_extended_url |
+Retrieves the relative URL of the item with a file
+extension based on the item's mime_type (Example: {
+/foo/bar/baz.html} ).
+-
+Parameters:
+
+item_id *
+ | The item id |
+
+ - Returns:
- The relative URL of the item with the appropriate file
+extension or an empty string on failure
- Options:
+
+template_extension | Signifies that the file extension should be
+retrieved using the mime_type of the template assigned to the item,
+not from the item itself. The live revision of the template is
+used. If there is no template which could be used to render the
+item, or if the template has no live revision, the extension
+defaults to { .html} |
+
+revision_id |
+default the live revision; Specifies the
+revision_id which will be used to retrieve the item's mime_type.
+This option is ignored if the -template_extension option is
+specified. |
+
+ - See Also:
- proc - item::get_mime_info
item::get_template_id item::get_url
+
+
+ |
+
+item::get_id |
+Looks up the URL and gets the item id at that URL, if
+any.
+-
+Parameters:
+
+
+url *
+ | The URL |
+
+root_folder |
+default The Sitemap; The ID of the root
+folder to use for resolving the URL |
+
+
+ - Returns:
- The item ID of the item at that URL, or the empty string on
+failure
- See Also:
- proc - item::get_url
+
+
+ |
+
+item::get_mime_info |
+Creates a onerow datasource in the calling frame which
+holds the mime_type and file_extension of the specified revision.
+If the revision does not exist, does not create the
+datasource.
+-
+Parameters:
+
+
+revision_id *
+ | The revision id |
+
+datasource_ref |
+default mime_info; The name of the
+datasource to be created. The datasource will have two columns,
+mime_type and file_extension. return 1 (one) if the revision
+exists, 0 (zero) otherwise. |
+
+
+ - See Also:
- proc - item::get_extended_url
+
+
+ |
+
+item::get_publish_status |
+Get the publish status of the item. The publish status
+will be one of the following:
+
+-
+production - The item is still in production. The
+workflow (if any) is not finished, and the item has no live
+revision.
-
+ready - The item is ready for publishing
-
+live - The item has been published
-
+expired - The item has been published in the past, but
+its publication has expired
+
+
+-
+Parameters:
+
+item_id *
+ | The item id |
+
+ - Returns:
- The publish status of the item, or the empty string on
+failure
- See Also:
- proc - item::is_publishable
+
+
+ |
+
+item::get_revision_content |
+Create a onerow datasource called content in the
+calling frame which contains all attributes for the revision
+(including inherited ones).
+The datasource will contain a column called { text} ,
+representing the main content (blob) of the revision, but only if
+the revision has a textual mime-type.
+
+-
+Parameters:
+
+revision_id *
+ | The revision whose attributes are to be
+retrieved |
+
+ - Returns:
- 1 on success (and create a content array in the calling frame),
+0 on failure
- Options:
+item_id |
+defaultauto-generated; The item_id
+of the corresponding item. |
+
- See Also:
- proc - item::get_content_type
item::get_mime_info
+
+
+ |
+
+item::get_template_id |
+Retrieves the template which can be used to render the
+item. If there is a template registered directly to the item,
+returns the id of that template. Otherwise, returns the id of the
+default template registered to the item's content_type. Returns an
+empty string on failure.
+-
+Parameters:
+
+
+item_id *
+ | The item id |
+
+context |
+default 'public'; The context in which the
+template will be used. |
+
+
+ - Returns:
- The template_id of the template which can be used to render the
+item, or an empty string on failure
- See Also:
- proc - item::get_template_url
+
+
+ |
+
+item::get_template_url |
+Retrieves the relative URL of the template which can be
+used to render the item. The URL is relative to the TemplateRoot as
+it is specified in the ini file.
+-
+Parameters:
+
+
+item_id *
+ | The item id |
+
+context |
+default 'public'; The context in which the
+template will be used. |
+
+
+ - Returns:
- The template_id of the template which can be used to render the
+item, or an empty string on failure
- See Also:
- proc - item::get_template_id
+
+
+ |
+
+item::get_title |
+Get the title for the item. If a live revision for the
+item exists, use the live revision. Otherwise, use the latest
+revision.
+-
+Parameters:
+
+item_id *
+ | The item id |
+
+ - Returns:
- The title of the item
- See Also:
- proc - item::get_best_revision
+
+
+ |
+
+item::get_url |
+Retrieves the relative URL stub to th item. The URL is
+relative to the page root, and has no extension (Example: {
+/foo/bar/baz} ).
+-
+Parameters:
+
+item_id *
+ | The item id |
+
+ - Returns:
- The relative URL to the item, or an empty string on
+failure
- See Also:
- proc - item::get_extended_url
+
+
+ |
+
+item::is_publishable |
+Determine if the item is publishable. The item is
+publishable only if:
+
+- All child relations, as well as item relations, are satisfied
+(according to min_n and max_n)
- The workflow (if any) for the item is finished
+
+
+-
+Parameters:
+
+item_id *
+ | The item id |
+
+ - Returns:
- 1 if the item is publishable, 0 otherwise
+
+ |
+
+* indicates required
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/namespace-list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/namespace-list.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/namespace-list.adp 17 Sep 2014 19:06:36 -0000 1.1.2.1
@@ -0,0 +1,17 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+All Namespaces
Regenerate
+these pages.
+If you have not regenerated these pages before, you may have to
+reset permissions on all files to be written as well as your
+/doc/acs-templating/TclDocs directory.
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/namespaces.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/namespaces.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/namespaces.adp 17 Sep 2014 19:06:36 -0000 1.1.2.1
@@ -0,0 +1,24 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+ATS and CMS Tcl Procedure
+Specifications
+Namespaces |
doc |
doc::util |
+formCommands for managing dynamic templated
+forms.
+ |
+requestThe request commands provide a mechanism for managing
+the query parameters to a page. The request is simply a special
+instance of a form object, and is useful for the frequent cases
+when data must be passed from page to page to determine display or
+page flow, rather than perform a transaction based on user input
+via a form.
+See: form element
+
+
+ |
util |
+
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/pagination.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/pagination.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/pagination.adp 17 Sep 2014 19:06:36 -0000 1.1.2.1
@@ -0,0 +1,80 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace pagination
Procedures for paginating a datasource
Method Summary
+Listing of public methods:
+pagination::get_total_pages
pagination::page_number_links
pagination::paginate_query
+
Method Detail
+* indicates required
Public Methods:
+
+ by Michael Pih
+ |
+Gets the number of pages returned by a query PRE:
+requires {$sql} -
+Parameters:
+
+db *
+ | A database handle |
+
+
+ |
+
+
+ by Michael Pih
+ |
+Generate HTML for navigating pages of a
+datasource -
+Parameters:
+
+
+page *
+ | The current page number |
+
+
+total_pages *
+ | The total pages returned by the query |
+
+
+
+ |
+
+
+ by Michael Pih
+ |
+Paginates a query -
+Parameters:
+
+
+sql *
+ | The sql query to paginate |
+
+
+page *
+ | The current page number |
+
+
+
+ |
+
+Private Methods:
+
+ |
Returns the number of rows per page |
+
+
+ by Michael Pih
+ |
+Converts an ns_set into a list of url
+variables -
+Parameters:
+
+ |
+
+* indicates required
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/publish.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/publish.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/publish.adp 17 Sep 2014 19:06:36 -0000 1.1.2.1
@@ -0,0 +1,710 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace publish
+ by Stanislav Freidin The procs in this namespace are
+useful for publishing items, including items inside other items,
+and writing items to the filesystem.Specifically, the content, child and
+relation tags are defined here.
Also see:
+- namespace
- item
+
Method Summary
+Listing of public methods:
+publish::get_html_body
publish::get_mime_handler
publish::get_page_root
publish::get_publish_roots
publish::get_template_root
publish::handle_binary_file
publish::item_include_tag
publish::mkdirs
publish::proc_exists
publish::publish_revision
publish::schedule_status_sweep
publish::set_publish_status
publish::unpublish_item
publish::unschedule_status_sweep
publish::write_content
+
Method Detail
+* indicates required
Public Methods:
+publish::get_html_body |
+Strip the {<body>} tags from the HTML, leaving
+just the body itself. Useful for including templates in each
+other.
+-
+Parameters:
+
+html *
+ | The html to be processed |
+
+ - Returns:
- Everything between the <body> and the </body> tags
+if they exist; the unchanged HTML if they do not
+
+ |
+
+publish::get_mime_handler |
+Return the name of a proc that should be used to render
+items with the given mime-type. The mime type handlers should all
+follow the naming convention
+proc
+publish::handle::mime_prefix::mime_suffix
+
+If the specific mime handler could not be found,
+get_mime_handler looks for a generic procedure with the
+name
+proc
+publish::handle::mime_prefix
+
+If the generic mime handler does not exist either,
+get_mime_handler returns { }
+-
+Parameters:
+
+mime_type *
+ | The full mime type, such as { text/html} or {
+image/jpg} |
+
+ - Returns:
- The name of the proc which should be used to handle the
+mime-type, or an empty string on failure.
- See Also:
- proc - publish::handle_item
+
+
+ |
+
+publish::get_page_root |
+Get the page root. All items will be published to the
+filesystem with their URLs relative to this root. The page root is
+controlled by the PageRoot parameter in CMS. A relative path is
+relative to {[ns_info} pageroot\] The default is {[ns_info}
+pageroot\]
+- Returns:
- The page root
- See Also:
- proc - publish::get_publish_roots
publish::get_template_root
+
+
+ |
+
+publish::get_publish_roots |
+Get a list of all page roots to which files may be
+published. The publish roots are controlled by the PublishRoots
+parameter in CMS, which should be a space-separated list of all the
+roots. Relative paths are relative to publish::get_page_root. The
+default is {[list} {[publish::get_page_root]]}
+- Returns:
- A list of all the publish roots
- See Also:
- proc - publish::get_page_root
publish::get_template_root
+
+
+ |
+
+publish::get_template_root |
+Get the template root. All templates are assumed to
+exist in the filesystem with their URLs relative to this root. The
+page root is controlled by the TemplateRoot parameter in CMS. The
+default is /web/yourserver/templates
+- Returns:
- The template root
- See Also:
- proc - content::get_template_root,
+
+
+ |
+
+publish::handle_binary_file |
+Helper procedure for writing handlers for binary files.
+It will write the blob of the item to the filesystem, but only if
+-embed is specified. Then, it will attempt to merge the image with
+its template.
+This proc accepts exactly the same options a typical
+handler.
+-
+Parameters:
+
+
+item_id *
+ | The id of the item to handle |
+
+
+revision_id_ref *
+ |
+required The name of the variable in the
+calling frame that will recieve the revision_id whose content blob
+was written to the filesystem. |
+
+
+url_ref *
+ | The name of the variable in the calling frame that
+will recieve the relative URL of the file in the file system which
+contains the content blob |
+
+
+error_ref *
+ | The name of the variable in the calling frame that
+will recieve an error message. If no error has ocurred, this
+variable will be set to the empty string { } |
+
+
+ - Returns:
- The HTML resulting from merging the item with its template, or
+" " if no template exists or the -no_merge flag was
+specified
- Options:
+
+embed | Signifies that the content should be embedded
+directly in the parent item. -embed is required for
+this proc, since it makes no sense to handle the binary file in any
+other way. |
+
+revision_id |
+default The live revision for the item; The
+revision whose content is to be used |
+
+no_merge | If present, do NOT merge with the template, in
+order to prevent infinite recursion in the {<content>} tag.
+In this case, the proc will return the empty string { } |
+
+ - See Also:
- proc - publish::handle::image
+
+
+ |
+
+publish::item_include_tag |
+Create an include tag to include an item, in the form
+include src=/foo/bar/baz item_id=item_id
+param=value param=value ...
+
+-
+Parameters:
+
+
+item_id *
+ | The item id |
+
+
+extra_args *
+ | {} A list of extra parameters to be passed to the
+include tag, in form {name value name value ...} |
+
+
+ - Returns:
- The HTML for the include tag
- See Also:
- proc - item::item_url
publish::html_args
+
+
+ |
+
+publish::mkdirs |
+Create all the directories neccessary to save the
+specified file -
+Parameters:
+
+path *
+ | The path to the file that is about to be
+saved |
+
+
+ |
+
+publish::proc_exists |
+Determine if a procedure exists in the given
+namespace
+-
+Parameters:
+
+
+namespace_name *
+ | The fully qualified namespace name, such as {
+template::util} |
+
+
+proc_name *
+ | The proc name, such as { is_nil} |
+
+
+ - Returns:
- 1 if the proc exists in the given namespace, 0 otherwise
+
+ |
+
+publish::schedule_status_sweep |
+Schedule a proc to keep track of the publish status.
+Resets the publish status to { expired} if the expiration date has
+passed. Publishes the item and sets the publish status to { live}
+if the current status is { ready} and the scheduled publication
+time has passed.
+-
+Parameters:
+interval |
+default 3600; The interval, in seconds,
+between the sweeps of all items in the content repository. Lower
+values increase the precision of the publishing/expiration dates
+but decrease performance. If this parameter is not specified, the
+value of the StatusSweepInterval parameter in the server's INI file
+is used (if it exists). |
+
+ - See Also:
- proc - publish::set_publish_status
publish::track_publish_status publish::unschedule_status_sweep
+
+
+ |
+
+publish::set_publish_status |
+Set the publish status of the item. If the status is
+live, publish the live revision of the item to the filesystem.
+Otherwise, unpublish the item from the filesystem.
+-
+Parameters:
+
+
+db *
+ | The database handle |
+
+
+item_id *
+ | The item id |
+
+
+new_status *
+ | The new publish status. Must be { production} , {
+expired} , { ready} or { live} |
+
+revision_id |
+default The live revision; The revision id
+to be used when publishing the item to the filesystem. |
+
+
+ - See Also:
- proc - publish::publish_revision
publish::unpublish_item
+
+
+ |
+
+publish::unpublish_item |
+Delete files which were created by
+publish_revision
+
+-
+Parameters:
+
+item_id *
+ | The item id |
+
+ - Options:
+
+revision_id |
+default The live revision; The revision
+which is to be used for determining the item filename |
+
+root_path |
+default All paths in the PublishPaths
+parameter; Write the content to this path only. |
+
+ - See Also:
- proc - publish::publish_revision
+
+
+ |
+
+publish::write_content |
+Write the content (blob) of a revision into a binary
+file in the filesystem. The file will be published at the relative
+URL under each publish root listed under the PublishRoots parameter
+in the server's INI file (the value returnded by
+publish::get_page_root is used as the default). The file extension
+will be based on the revision's mime-type.
+For example, an revision whose mime-type is { image/jpeg} for an
+item at { Sitemap/foo/bar} may be written as
+/web/your_server_name/www/foo/bar.jpg
+-
+Parameters:
+
+revision_id *
+ | The id of the revision to write |
+
+ - Returns:
- The relative URL of the file that was written, or an empty
+string on failure
- Options:
+
+item_id |
+default The item_id of the revision;
+Specifies the item to which this revision belongs (mereley for
+optimization purposes) |
+
+text | If specified, indicates that the content of the
+revision is readable text (clob), not a binary file |
+
+root_path |
+default All paths in the PublishPaths
+parameter; Write the content to this path only. |
+
+ - See Also:
- proc - content::get_content_value
publish::get_publish_roots
+
+
+ |
+
+Private Methods:
+
+publish::foreach_publish_path |
+Execute some Tcl code for each root path in the
+PublishRoots parameter
+-
+Parameters:
+
+
+url *
+ | Relative URL to append to the roots |
+
+
+code *
+ | Execute this code |
+
+root_path |
+default The empty string; Use this root
+path instead of the paths specified in the INI file |
+
+
+ - See Also:
- proc - publish::get_publish_roots
+
+
+ |
+
+publish::handle_item |
+Render an item either by looking it up in the the
+temporary cache, or by using the appropriate mime handler. Once the
+item is rendered, it is stored in the temporary cache under a key
+which combines the item_id, any extra HTML parameters, and a flag
+which specifies whether the item was merged with its template.
+This proc takes the same arguments as the individual mime
+handlers.
+-
+Parameters:
+
+
+item_id *
+ | The id of the item to be rendered |
+
+
+context *
+ | The context for the item (default public) |
+
+
+ - Returns:
- The rendered HTML for the item, or an empty string on
+failure
- Options:
+
+revision_id |
+default The live revision; The revision
+which is to be used when rendering the item |
+
+no_merge | Indicates that the item should NOT be merged with
+its template. This option is used to avoid infinite recursion. |
+
+refresh | Re-render the item even if it exists in the cache.
+Use with caution - circular dependencies may cause infinite
+recursion if this option is specified |
+
+embed | Signifies that the content should be statically
+embedded directly in the HTML. If this option is not specified, the
+item may be dynamically referenced, f.ex. using the
+{<include>} tag |
+
+html | Extra HTML parameters to be passed to the item
+handler, in format {name value name value ...} |
+
+ - See Also:
- proc - publish::handle::image
publish::handle::text publish::handle_binary_file
+
+
+ |
+
+publish::html_args |
+Concatenate a list of name-value pairs as returned by
+set_to_pairs into a list of { name=value}
+pairs
+-
+Parameters:
+
+argv *
+ | The list of name-value pairs |
+
+ - Returns:
- An HTML string in format " name=value name=value ..."
- See Also:
- proc - publish::set_to_pairs
+
+
+ |
+
+publish::merge_with_template |
+Merge the item with its template and return the
+resulting HTML. This proc is simlar to
+content::init
+
+-
+Parameters:
+
+item_id *
+ | The item id |
+
+ - Returns:
- The rendered HTML, or the empty string on failure
- Options:
+
+revision_id |
+default The live revision; The revision
+which is to be used when rendering the item |
+
+html | Extra HTML parameters to be passed to the ADP
+parser, in format {name value name value ...} |
+
+ - See Also:
- proc - publish::handle_item
+
+
+ |
+
+publish::process_tag |
+Process a child or relation tag. This
+is a helper proc for the tags, which acts as a wrapper for
+render_subitem.
+-
+Parameters:
+
+
+relation_type *
+ | Either child or relation
+ |
+
+
+params *
+ | The ns_set id for extra HTML parameters |
+
+
+ - See Also:
- proc - publish::render_subitem
+
+
+ |
+
+publish::render_subitem |
+Render a child/related item and return the resulting
+HTML, stripping off the headers.
+-
+Parameters:
+
+
+main_item_id *
+ | The id of the parent item |
+
+
+relation_type *
+ | Either child or relation.
+Determines which tables are searched for subitems. |
+
+
+relation_tag *
+ | The relation tag to look for |
+
+
+index *
+ | The relative index of the subitem. The subitem
+with lowest order_n has index 1, the second lowest
+order_n has index 2, and so on. |
+
+
+is_embed *
+ | If { t} , the child item may be embedded directly
+in the HTML. Otherwise, it may be dynamically included. The proc
+does not process this parameter directly, but passes it to
+handle_item
+ |
+
+
+extra_args *
+ | Any additional HTML arguments to be used when
+rendering the item, in form {name value name value ...} |
+
+is_merge |
+default t; If { t} ,
+merge_with_template may be used to render the subitem.
+Otherwise, merge_with_template should not be used, in
+order to prevent infinite recursion. |
+
+context |
+default public; |
+
+
+ - Returns:
- The rendered HTML for the child item
- See Also:
- proc - publish::handle_item
publish::merge_with_template
+
+
+ |
+
+publish::set_to_pairs |
+Convert an ns_set into a list of name-value pairs, in
+form {name value name value ...}
+-
+Parameters:
+
+
+params *
+ | The ns_set id |
+
+
+exclusion_list *
+ | {} A list of keys to be ignored |
+
+
+ - Returns:
- A list of name-value pairs representing the data in the
+ns_set
+
+ |
+
+ |
+Implements the child tag which renders a child
+item. See the Developer Guide for more information.
+The child tag format is
+{<child} tag=tag index=n embed
+{args>}
+ -
+Parameters:
+
+params *
+ | The ns_set id for extra HTML parameters |
+
+
+ |
+
+ |
+Implements the content tag which renders the
+content of the current item. See the Developer Guide for more
+information.
+The content tag format is simply {<content>.} The
+embed and no_merge parameters are implicit to the
+tag. -
+Parameters:
+
+params *
+ | The ns_set id for extra HTML parameters |
+
+
+ |
+
+ |
+Implements the relation tag which renders a
+related item. See the Developer Guide for more information.
+The relation tag format is
+{<relation} tag=tag index=n embed
+{args>}
+ -
+Parameters:
+
+params *
+ | The ns_set id for extra HTML parameters |
+
+
+ |
+
+* indicates required
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/request.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/request.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/request.adp 17 Sep 2014 19:06:37 -0000 1.1.2.1
@@ -0,0 +1,122 @@
+
+{/doc/acs-templating {Templating}} {}
+
+
+
+
+Namespace request
The request commands provide a mechanism for managing
+the query parameters to a page. The request is simply a special
+instance of a form object, and is useful for the frequent cases
+when data must be passed from page to page to determine display or
+page flow, rather than perform a transaction based on user input
+via a form.
Also see:
+- form
- element
+
Method Summary
+Listing of public methods:
+
+
Method Detail
+* indicates required
Public Methods:
+ |
+Checks for any param errors. If errors are found, sets
+the display template to the specified URL (a system-wide request
+error page by default).
+-
+Parameters:
+
+url *
+ | The URL of the template to use to display error
+messages. The special value { self} may be used to indicate that
+the template for the requested page itself will handle reporting
+error conditions. |
+
+ - Returns:
- 1 if no error conditions exist, 0 otherwise.
+
+ |
+
+ |
+Create the request data structure. Typically called at
+the beginning of the code for any page that accepts query
+parameters.
+- Options:
+params | A block of parameter declarations, separated by
+newlines. Equivalent to calling set_param for each parameter, but
+requiring slightly less typing. |
+
+
+ |
+
+ |
+Declares a query parameter as part of the page request.
+Validates the values associated with the parameter, in the same
+fashion as for form elements.
+-
+Parameters:
+
+name *
+ | The name of the parameter to declare. |
+
+ - Options:
+
+name | The name of parameter in the query (may be
+different from the reference name). |
+
+multiple | A flag indicating that multiple values may be
+specified for this parameter. |
+
+datatype | The name of a datatype for the element values.
+Valid datatypes must have a validation procedure defined in the
+template::data::validate namespace. |
+
+optional | A flag indicating that no value is required for
+this element. If a default value is specified, the default is used
+instead. |
+
+validate | A list of custom validation blocks in the form {
+name { expression } { message } \ name { expression } { message }
+...} where name is a unique identifier for the validation step,
+expression is a block to Tcl code that evaluates to 1 or 0, and
+message is to be displayed to the user when the validation step
+fails. |
+
+ - See Also:
- element::create -
+
+
+ |
+
+ |
+Manually report request error(s) by setting error
+messages and then calling is_valid to handle display. Useful for
+conditions not tied to a single query parameter. The arguments to
+the procedure may be any number of name-message
+combinations. -
+Parameters:
+
+
+name *
+ | A unique identifier for the error condition, which
+may be used for layout purposes. |
+
+
+msg *
+ | The message text associated with the
+condition. |
+
+
+
+ |
+
+ |
+Retrieves the value(s) of the specified
+parameter.
+-
+Parameters:
+
+name *
+ | The name of the parameter. |
+
+ - Returns:
- The value of the specified parameter.
+
+ |
+
+* indicates required
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/tcl-procs.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/tcl-procs.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/tcl-procs.adp 17 Sep 2014 19:06:37 -0000 1.1.2.1
@@ -0,0 +1,8 @@
+
+{/doc/acs-templating {Templating}} {ArsDigita Templating System, Content Management Tcl
+Procedure Specifications}
+ArsDigita Templating System, Content Management Tcl
+Procedure Specifications
+
+
+
Index: openacs-4/packages/acs-templating/www/doc/TclDocs/tcl-procs.html
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/TclDocs/tcl-procs.html,v
diff -u -N -r1.1.1.1 -r1.1.1.1.28.1
--- openacs-4/packages/acs-templating/www/doc/TclDocs/tcl-procs.html 13 Mar 2001 22:59:27 -0000 1.1.1.1
+++ openacs-4/packages/acs-templating/www/doc/TclDocs/tcl-procs.html 17 Sep 2014 19:06:37 -0000 1.1.1.1.28.1
@@ -2,10 +2,12 @@
ArsDigita Templating System, Content Management Tcl Procedure Specifications
+
+