Index: openacs-4/contrib/packages/survey/lib/portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/lib/Attic/portlet.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/survey/lib/portlet.adp 31 Jan 2005 22:02:47 -0000 1.1 @@ -0,0 +1,12 @@ + + id="@id@" class="@class@"> +

@package_name@

+None active + + + + \ No newline at end of file Index: openacs-4/contrib/packages/survey/lib/portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/lib/Attic/portlet.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/survey/lib/portlet.tcl 31 Jan 2005 22:02:47 -0000 1.1 @@ -0,0 +1,51 @@ +# include fragment to display the active surveys in a package +# +# @author Tom Ayles (tom@beatniq.net) +# @creation-date 2004-02-17 +# @cvs-id $Id: portlet.tcl,v 1.1 2005/01/31 22:02:47 jeffd Exp $ +# +# parameters: +# package_id - the ID of the surveys package to query +# base_url - the base URL of the package +# display_empty_p - if true, display when empty (default 1) +# class - CSS CLASS attribute value +# id - CSS ID attribute value +# cache - cache period, default 0 meaning no cache + +if { ![exists_and_not_null package_id] + && ![exists_and_not_null base_url] } { + error "must specify package_id and/or base_url" +} + +if { ![exists_and_not_null cache] } { + set cache 0 +} + +if { ![exists_and_not_null display_empty_p] } { + set display_empty_p 1 +} + +if { ![exists_and_not_null base_url] } { + set base_url [lindex [site_node::get_url_from_object_id \ + -object_id $package_id] 0] +} +if { ![exists_and_not_null package_id] } { + set package_id [site_node::get_element \ + -url $base_url -element object_id] +} +set package_name [apm_instance_name_from_id $package_id] + +set script "# /packages/survey/lib/portlet.tcl +db_list_of_lists ls {} -bind { package_id $package_id }" + +multirow create active survey_id name url + +foreach row [util_memoize $script $cache] { + set survey_id [lindex $row 0] + set name [lindex $row 1] + set url "${base_url}respond?survey_id=$survey_id" + + multirow append active $survey_id $name $url +} + +ad_return_template Index: openacs-4/contrib/packages/survey/lib/portlet.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/lib/Attic/portlet.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/survey/lib/portlet.xql 31 Jan 2005 22:02:47 -0000 1.1 @@ -0,0 +1,10 @@ + + + +SELECT survey_id, name +FROM surveys +WHERE package_id = :package_id AND enabled_p = 't' +ORDER BY lower(name), name + + + \ No newline at end of file