Index: openacs-4/packages/tasks-portlet/tasks-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks-portlet/tasks-portlet.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks-portlet/tasks-portlet.info 28 Sep 2005 19:25:45 -0000 1.1 @@ -0,0 +1,26 @@ + + + + + Tasks Portlet + Tasks Portlet + f + t + + + Miguel Marin + Viaro Networks + 0 + + + + + + + + + + + + + Index: openacs-4/packages/tasks-portlet/catalog/tasks-portlet.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks-portlet/catalog/tasks-portlet.en_US.ISO-8859-1.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks-portlet/catalog/tasks-portlet.en_US.ISO-8859-1.xml 28 Sep 2005 19:25:45 -0000 1.1 @@ -0,0 +1,6 @@ + + + + Tasks Portlet + + Index: openacs-4/packages/tasks-portlet/lib/tasks-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks-portlet/lib/tasks-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks-portlet/lib/tasks-postgresql.xql 28 Sep 2005 19:25:45 -0000 1.1 @@ -0,0 +1,44 @@ + + + + + + + select + t.task_id, + t.title, + t.description, + t.mime_type, + t.priority, + t.party_id, + p.title as process_title, + p.process_id, + tasks__relative_date(t.due_date) as due_date, + tasks__relative_date(t.completed_date) as completed_date, + ao.creation_user, + t.status_id, + t.process_instance_id, + contact__name(ao.creation_user) as creation_name, + CASE WHEN t.due_date < now() THEN 't' ELSE 'f' END as due_date_passed_p, + s.title as status, + t.object_id, + ao.package_id + from + t_task_status s, + acs_objects ao, + t_tasks t + left outer join t_process_instances pi + on (pi.process_instance_id = t.process_instance_id) + left outer join t_processes p + on (p.process_id = pi.process_id) + where + s.status_id = t.status_id + and ao.object_id = t.task_id + and t.party_id = :contact_id + and t.start_date < now() + $package_where_clause + [template::list::orderby_clause -orderby -name tasks] + + + + \ No newline at end of file Index: openacs-4/packages/tasks-portlet/lib/tasks.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks-portlet/lib/tasks.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks-portlet/lib/tasks.adp 28 Sep 2005 19:25:45 -0000 1.1 @@ -0,0 +1,6 @@ +

+#tasks.Add_Task# +#tasks.Assign_Process# +

+ + Index: openacs-4/packages/tasks-portlet/lib/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks-portlet/lib/tasks.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks-portlet/lib/tasks.tcl 28 Sep 2005 19:25:45 -0000 1.1 @@ -0,0 +1,187 @@ +set user_id [ad_conn user_id] + +if { ![exists_and_not_null orderby] } { + set orderby "priority,desc" +} +if { ![exists_and_not_null status_id] } { + set status_id "1" +} + +set community_id [dotlrn_community::get_community_id] + +set user_space_p 1 + +if { ![empty_string_p $community_id] } { + set package_id [dotlrn_community::get_package_id_from_package_key \ + -package_key "tasks" \ + -community_id $community_id] + set user_space_p 0 +} + +if { [exists_and_not_null package_id] } { + set package_where_clause " and ao.package_id = :package_id" +} else { + set package_where_clause " and ao.creation_user = :user_id" +} + +if { ![contact::exists_p -party_id $contact_id] } { + set contact_id $user_id +} + +set party_id $contact_id +set tasks_url "tasks/" + + +set done_url [export_vars -url -base "${tasks_url}contact" {orderby {status_id 2} party_id}] +set not_done_url [export_vars -url -base "${tasks_url}contact" {orderby {status_id 1} party_id}] +set return_url "[ad_conn url]?[ad_conn query]" +set add_url [export_vars -base "${tasks_url}task" {return_url orderby status_id party_id}] + + +template::list::create \ + -name tasks \ + -multirow tasks \ + -key task_id \ + -elements { + deleted_p { + label {[_ tasks.Not_Done]} + display_template { + + [_ tasks.Done] + + + + [_ tasks.Not_Done] + + + } + } + priority { + label "[_ tasks.Priority]" + display_template { + @tasks.priority@@tasks.priority@ + } + } + title { + label "[_ tasks.Task]" + display_template { + class="done">@tasks.title@ + +
+

+ @tasks.description_html;noquote@ +

+
+
+ } + } + process_title { + label "[_ tasks.Process]" + display_template { + @tasks.process_title@ + + @tasks.process_title@ + + } + } + date { + label "[_ tasks.Date]" + display_template { + @tasks.completed_date;noquote@ + + + «  + + @tasks.due_date;noquote@ +   + » + + + } + } + creation_user { + label "[_ tasks.Created_By]" + display_template { + class="done">@tasks.creation_name@ + } + } + } \ + -sub_class { + narrow + } \ + -filters { + party_id { + } + } -orderby { + default_value "priority,desc" + date { + label "[_ tasks.Due]" + orderby_desc "CASE WHEN t.status_id = 1 THEN t.due_date ELSE t.completed_date END desc, + t.priority, + lower(t.title)" + orderby_asc "CASE WHEN t.status_id = 1 THEN t.due_date ELSE t.completed_date END asc, + t.priority, + lower(t.title)" + default_direction desc + } + priority { + label "[_ tasks.Priority]" + orderby_desc "t.status_id, + t.priority desc, + CASE WHEN t.status_id = 1 THEN t.due_date ELSE t.completed_date END desc, + lower(t.title)" + orderby_asc "t.status_id, + t.priority asc, + CASE WHEN t.status_id = 1 THEN t.due_date ELSE t.completed_date END asc, + lower(t.title)" + default_direction desc + } + title { + label "[_ tasks.Task]" + orderby_desc "lower(t.title) desc, t.priority desc, t.due_date asc" + orderby_asc "lower(t.title) asc, t.priority desc, t.due_date asc" + default_direction asc + } + process_title { + label "[_ tasks.Process]" + orderby_desc "lower(p.title) desc, t.priority desc, t.due_date asc" + orderby_asc "lower(p.title) asc, t.priority desc, t.due_date asc" + default_direction asc + } + creation_user { + label "[_ tasks.Created_By]" + orderby_desc "lower(contact__name(ao.creation_user)) desc, t.due_date asc, t.priority, lower(t.title)" + orderby_asc "lower(contact__name(ao.creation_user)) asc, t.due_date asc, t.priority, lower(t.title)" + default_direction asc + } + } + + +db_multirow -extend { creation_user_url contact_url complete_url done_p task_plus_url task_minus_url description_html task_url } -unclobber tasks get_tasks " " { + set creation_user_url [contact::url -party_id $creation_user] + regsub -all "tasks/" $creation_user_url "contacts/" creation_user_url + set complete_url [export_vars -base "${tasks_url}mark-completed" -url {task_id orderby {party_id $contact_id} return_url}] + if { $status_id == "2" } { + set done_p 1 + } else { + set done_p 0 + } + set task_url [export_vars -base "${tasks_url}task" -url {{party_id $contact_id} orderby status_id task_id}] + set task_plus_url [export_vars -base "${tasks_url}task-interval" -url {{action plus} {days 7} {party_id $contact_id} task_id status_id orderby return_url}] + set task_minus_url [export_vars -base "${tasks_url}task-interval" -url {{action minus} {days 7} {party_id $contact_id} task_id status_id orderby return_url}] + + regsub -all "\r|\n" $description {LiNeBrEaK} description + + set description_html [ad_html_text_convert \ + -from $mime_type \ + -to "text/html" \ + -truncate_len "400" \ + -more "[_ tasks.more]" \ + -- $description] + regsub -all {LiNeBrEaKLiNeBrEaK} $description_html {LiNeBrEaK} description_html + regsub -all {LiNeBrEaK} $description_html {\ \ \¶\ } description_html + + regsub -all " " $due_date {\ } due_date + regsub -all " " $completed_date {\ } completed_date +} + \ No newline at end of file Index: openacs-4/packages/tasks-portlet/sql/postgresql/tasks-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks-portlet/sql/postgresql/tasks-portlet-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks-portlet/sql/postgresql/tasks-portlet-create.sql 28 Sep 2005 19:25:45 -0000 1.1 @@ -0,0 +1,207 @@ +-- +-- Copyright (C) 2001, 2002 MIT +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- Creates Tasks portlet + +-- This is free software distributed under the terms of the GNU Public +-- License version 2 or higher. Full text of the license is available +-- from the GNU Project: http://www.fsf.org/copyleft/gpl.html + +create function inline_0() +returns integer as ' +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + ds_id := portal_datasource__new( + ''tasks_portlet'', + ''Displays Tasks'' + ); + + + -- the standard 4 params + + -- shadeable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shadeable_p'', + ''t'' +); + + + -- hideable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''hideable_p'', + ''t'' +); + + -- user_editable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''user_editable_p'', + ''t'' +); + + -- shaded_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shaded_p'', + ''f'' +); + + -- link_hideable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''link_hideable_p'', + ''t'' +); + + + perform portal_datasource__set_def_param( + ds_id, + ''t'', + ''f'', + ''scoped_p'', + ''t'' + ); + + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + -- create the implementation + foo := acs_sc_impl__new ( + ''portal_datasource'', + ''tasks_portlet'', + ''tasks_portlet'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- add all the hooks + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''tasks_portlet'', + ''GetMyName'', + ''tasks_portlet::get_my_name'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''tasks_portlet'', + ''GetPrettyName'', + ''tasks_portlet::get_pretty_name'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''tasks_portlet'', + ''Link'', + ''tasks_portlet::link'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''tasks_portlet'', + ''AddSelfToPage'', + ''tasks_portlet::add_self_to_page'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''tasks_portlet'', + ''Show'', + ''tasks_portlet::show'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''tasks_portlet'', + ''Edit'', + ''tasks_portlet::edit'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''tasks_portlet'', + ''RemoveSelfFromPage'', + ''tasks_portlet::remove_self_from_page'', + ''TCL'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- Add the binding + perform acs_sc_binding__new ( + ''portal_datasource'', + ''tasks_portlet'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + Index: openacs-4/packages/tasks-portlet/tcl/tasks-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks-portlet/tcl/tasks-portlet-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks-portlet/tcl/tasks-portlet-procs.tcl 28 Sep 2005 19:25:46 -0000 1.1 @@ -0,0 +1,116 @@ +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +ad_library { + + Procedures to support the Tasks Package + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + +} + +namespace eval tasks_portlet { + + ad_proc -private my_package_key { + } { + return "tasks-portlet" + } + + ad_proc -private get_my_name { + } { + return "tasks_portlet" + } + + ad_proc -public get_pretty_name { + } { + return "#tasks-portlet.pretty_name#" + } + + ad_proc -public link { + } { + return "" + } + + ad_proc -public add_self_to_page { + {-portal_id:required} + {-package_id:required} + {-page_name ""} + {-pretty_name ""} + {-force_region ""} + {-scoped_p ""} + {-param_action "overwrite"} + } { + Adds the Tasks Portlet to the given page. + + @param portal_id The page to add self to + + @return element_id The new element's id + } { + + # allow overrides of pretty_name and force_region + + if {[empty_string_p $pretty_name]} { + set pretty_name [get_pretty_name] + } + + if {[empty_string_p $force_region]} { + set force_region [parameter::get_from_package_key \ + -package_key [my_package_key] \ + -parameter "force_region" + ] + } + + set extra_params "" + + return [portal::add_element_parameters \ + -portal_id $portal_id \ + -page_name $page_name \ + -portlet_name [get_my_name] \ + -value $package_id \ + -pretty_name $pretty_name \ + -force_region $force_region \ + -param_action $param_action] + } + + + + + ad_proc -public remove_self_from_page { + {-portal_id:required} + {-package_id:required} + } { + Removes a Task from the given page. + + @param portal_id The page to remove self from + @param package_id + } { + portal::remove_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -value $package_id + } + + ad_proc -public show { + cf + } { + } { + + + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf + + } + +} Index: openacs-4/packages/tasks-portlet/www/tasks-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks-portlet/www/tasks-portlet.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks-portlet/www/tasks-portlet.adp 28 Sep 2005 19:25:46 -0000 1.1 @@ -0,0 +1,3 @@ + + + \ No newline at end of file Index: openacs-4/packages/tasks-portlet/www/tasks-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks-portlet/www/tasks-portlet.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks-portlet/www/tasks-portlet.tcl 28 Sep 2005 19:25:46 -0000 1.1 @@ -0,0 +1,9 @@ +# /pacakges/tasks-portlet/www/tasks-portlet.tcl +ad_page_contract { + +} { + +} + +array set config $cf +set user_id [ad_conn user_id]