workflow::case::get_activity_html (private)

 workflow::case::get_activity_html -case_id case_id \
    [ -action_id action_id ] [ -max_n_actions max_n_actions ] \
    [ -style style ]

Defined in packages/workflow/tcl/case-procs.tcl

Get the activity log for a case as an HTML chunk. If action_id is non-empty, it means that we're in the progress of executing that action, and the corresponding line for the current action will be appended.

Switches:
-case_id
(required)
The case for which you want the activity log.
-action_id
(optional)
optional action which is currently being executed.
-max_n_actions
(optional)
Limit history to the max_n_actions number of most recent actions
-style
(defaults to "activity-entry") (optional)
Returns:
Activity log as HTML
Author:
Lars Pind <lars@collaboraid.biz>

Partial Call Graph (max 5 caller/called nodes):
%3 bug_tracker::search::bug::datasource bug_tracker::search::bug::datasource (private) workflow::case::get_activity_html workflow::case::get_activity_html bug_tracker::search::bug::datasource->workflow::case::get_activity_html packages/acs-tcl/lib/page-error.tcl packages/acs-tcl/ lib/page-error.tcl packages/acs-tcl/lib/page-error.tcl->workflow::case::get_activity_html packages/bug-tracker/www/bug.tcl packages/bug-tracker/ www/bug.tcl packages/bug-tracker/www/bug.tcl->workflow::case::get_activity_html acs_community_member_url acs_community_member_url (public) workflow::case::get_activity_html->acs_community_member_url acs_package_root_dir acs_package_root_dir (public) workflow::case::get_activity_html->acs_package_root_dir acs_user::get acs_user::get (public) workflow::case::get_activity_html->acs_user::get ad_acs_kernel_id ad_acs_kernel_id (public) workflow::case::get_activity_html->ad_acs_kernel_id ad_conn ad_conn (public) workflow::case::get_activity_html->ad_conn

Testcases:
No testcase defined.
Source code:
    set default_file_stub [file join [acs_package_root_dir "workflow"] lib activity-entry]
    set file_stub [template::util::url_to_file $style $default_file_stub]
    if { ![file exists "${file_stub}.adp"] } {
        ns_log Warning "workflow::case::get_activity_html: Cannot find log entry template file $file_stub, reverting to default template."
        # We always have a template named 'activity-entry'
        set file_stub $default_file_stub
    }
    
    # ensure that the style template has been compiled and is up-to-date
    set stub_call [template::adp_init adp $file_stub]

    set activity_entry_list [get_activity_log_info_not_cached -case_id $case_id]
    set start_index 0
    if { $max_n_actions ne "" && [llength $activity_entry_list] > $max_n_actions} { 
    # Only return the last max_n_actions actions
    set start_index [expr {[llength $activity_entry_list] - $max_n_actions}]
    } 

    set log_html {}

    foreach entry_arraylist [lrange $activity_entry_list $start_index end] {
        foreach { var value } $entry_arraylist {
            set $var $value
        }

        set comment_html [ad_html_text_convert -from $comment_mime_type -to "text/html" -- $comment] 
        if { [ad_conn isconnected] == 1 } {
            set community_member_url [acs_community_member_url -user_id $creation_user]
        } else {
            set community_member_url [export_vars -base [parameter::get -package_id [ad_acs_kernel_id]  -parameter CommunityMemberURL  -default "/shared/community-member"]  {user_id $ass(party_id)}]
    }

        # The output of this procedure will be placed in __adp_output in this stack frame.
        $stub_call
        append log_html $__adp_output
    }

    if { $action_id ne "" } {
        set action_pretty_past_tense [lang::util::localize  [workflow::action::get_element  -action_id $action_id  -element pretty_past_tense]]

        # sets first_names, last_name, email
        acs_user::get -user_id [ad_conn untrusted_user_id] -array user

        set creation_date_pretty [clock format [clock seconds] -format "%b %e, %Y"]

        set comment_html {}
        set user_first_names $user(first_names)
        set user_last_name $user(last_name)
        
        if { [ad_conn isconnected] == 1 } {
            set community_member_url [acs_community_member_url -user_id [ad_conn untrusted_user_id]]
        } else {
            set community_member_url [export_vars -base [parameter::get -package_id [ad_acs_kernel_id]  -parameter CommunityMemberURL  -default "/shared/community-member"]  {user_id $ass(party_id)}]
    }

        # The output of this procedure will be placed in __adp_output in this stack frame.
        $stub_call
        append log_html $__adp_output
    }

    return $log_html
Generic XQL file:
packages/workflow/tcl/case-procs.xql

PostgreSQL XQL file:
packages/workflow/tcl/case-procs-postgresql.xql

Oracle XQL file:
packages/workflow/tcl/case-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: