Index: openacs-4/packages/acs-templating/www/doc/demo/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/index.html,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-templating/www/doc/demo/index.html 6 Feb 2006 13:06:29 -0000 1.6 +++ openacs-4/packages/acs-templating/www/doc/demo/index.html 9 Feb 2006 02:40:05 -0000 1.7 @@ -359,6 +359,24 @@ View + + Link the title to a one-note detail page + + + index
+ detail + + + index
+ detail + + + index
+ detail + + View + +

Forms

Index: openacs-4/packages/acs-templating/www/doc/demo/list4/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/list4/index-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/doc/demo/list4/index-oracle.xql 9 Feb 2006 02:40:10 -0000 1.1 @@ -0,0 +1,42 @@ + + + oracle8.1.6 + + + + select n.template_demo_note_id, + n.title, + n.body, + n.color, + to_char(o.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date, + p.first_names || ' ' || p.last_name as creation_user_name, + decode(acs_permission.permission_p(n.template_demo_note_id, + :user_id, + 'write'), + 't', 1, + 'f', 0) as write_p, + decode(acs_permission.permission_p(n.template_demo_note_id, + :user_id, + 'admin'), + 't', 1, + 'f', 0) as admin_p, + decode(acs_permission.permission_p(n.template_demo_note_id, + :user_id, + 'delete'), + 't', 1, + 'f', 0) as delete_p + from template_demo_notes n, + acs_objects o, + persons p + where n.template_demo_note_id = o.object_id + and o.creation_user = p.person_id + and exists (select 1 + from acs_object_party_privilege_map + where object_id = template_demo_note_id + and party_id = :user_id + and privilege = 'read') + order by creation_date + + + + Index: openacs-4/packages/acs-templating/www/doc/demo/list4/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/list4/index-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/doc/demo/list4/index-postgresql.xql 9 Feb 2006 02:40:10 -0000 1.1 @@ -0,0 +1,29 @@ + + + postgresql7.1 + + + + + select + n.template_demo_note_id, + n.title, + n.color, + to_char(o.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date, + p.first_names || ' ' || p.last_name as creation_user_name + from + template_demo_notes n, + acs_objects o, + persons p + where n.template_demo_note_id = o.object_id + and o.creation_user = p.person_id + and exists (select 1 + from acs_object_party_privilege_map + where object_id = template_demo_note_id + and party_id = :user_id + and privilege = 'read') + [template::list::orderby_clause -orderby -name notes] + + + + Index: openacs-4/packages/acs-templating/www/doc/demo/list4/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/list4/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/doc/demo/list4/index.adp 9 Feb 2006 02:40:10 -0000 1.1 @@ -0,0 +1,6 @@ + +Notes +@context;noquote@ + + + Index: openacs-4/packages/acs-templating/www/doc/demo/list4/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/list4/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/doc/demo/list4/index.tcl 9 Feb 2006 02:40:10 -0000 1.1 @@ -0,0 +1,83 @@ +# main index page for notes. + +ad_page_contract { + + @author rhs@mit.edu + @creation-date 2000-10-23 + @cvs-id $Id: index.tcl,v 1.1 2006/02/09 02:40:10 jiml Exp $ +} -query { + orderby:optional +} -properties { + notes:multirow + context:onevalue + create_p:onevalue +} + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +set context [list] +set create_p [ad_permission_p $package_id create] + +# Here, we are adding a link for every row. The title of the note +# will become a link to a page that will view the note in its entirety. +# +# Notice in the title element of this, where we add "link_url_col view_url" + +template::list::create -name notes \ + -multirow template_demo_notes \ + -elements { + title { + label "Title of Note" + link_url_col view_url + } + creation_user_name { + label "Owner of Note" + } + creation_date { + label "When Note Created" + } + color { + label "Color" + } + } \ + -orderby { + default_value title,asc + title { + label "Title of Note" + orderby n.title + } + creation_user_name { + label "User" + orderby creation_user_name + } + creation_date { + label "Date" + orderby o.creation_date + } + color { + label "Color" + orderby n.color + } + } + +# how to get the variable per row, which will be the link target? +# +# first, we extend the multirow so that it contains an additional +# column (other than the columns in the select list from the query). +# +# The name of that column is view_url, and we're using export_vars +# to actually form the value. This invocation of db_multirow has an +# extra parameter at the end, which is a block of code to execute. +# In this block, we set the extra column variable we told it about +# with the -extend {} parameter. +# +# This variable will then be available to anything that reads the +# multirow, which for this case is the template::list::create call +# above. + +db_multirow -extend { view_url } template_demo_notes template_demo_notes {} { + set view_url [export_vars -base view-one { template_demo_note_id }] +} + +ad_return_template Index: openacs-4/packages/acs-templating/www/doc/demo/list4/view-one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/list4/view-one.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/doc/demo/list4/view-one.adp 9 Feb 2006 02:40:10 -0000 1.1 @@ -0,0 +1,6 @@ + +@title;noquote@ +@context;noquote@ + +@body;noquote@
+@color@ \ No newline at end of file Index: openacs-4/packages/acs-templating/www/doc/demo/list4/view-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/list4/view-one.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/doc/demo/list4/view-one.tcl 9 Feb 2006 02:40:10 -0000 1.1 @@ -0,0 +1,22 @@ +ad_page_contract { + @author Neophytos Demetriou + @creation-date 2001-09-02 +} { + template_demo_note_id:integer,notnull +} -properties { + context:onevalue + title:onevalue + body:onevalue +} + +set context [list "One note"] + +db_1row note_select { + select title, body, color + from template_demo_notes + where template_demo_note_id = :template_demo_note_id +} + +set body [ad_text_to_html -- $body] + +ad_return_template