xowiki::includelet::personal-notification-messages proc get_messages_response (public)
xowiki::includelet::personal-notification-messages get_messages_response \ [ -notification_id notification_id ] [ -user_id user_id ]
Defined in /var/www/openacs.org/packages/xowiki/tcl/personal-notification-procs.tcl
Get all messages for the notification-id and the give user in form of an AJAX array.
- Switches:
- -notification_id (optional, integer)
- -user_id (optional, integer)
- Testcases:
- No testcase defined.
Source code: # # Get messages for this notification_id and user. This function # returns a JSON result. # # TODO: replace inclass_exam with personal_notifications if {[nsv_dict exists inclass_exam $notification_id $user_id]} { set msgs [nsv_dict get inclass_exam $notification_id $user_id] } else { set msgs {} } # # Convert the messages to JSON. The timestamp (ts) is used as an # ID for an individual message. # set json {} foreach {ts msgDict} $msgs { set msg [string map {\" {\"} \n {<br>}} [dict get $msgDict msg]] set from [string map {\" {\"} \n {<br>}} [::xo::get_user_name [dict get $msgDict from]]] set urgency [string map {\" {\"} \n {<br>}} [dict get $msgDict urgency]] lappend json [subst -nobackslash {{"text": "$msg","ts":$ts,"from":"$from","urgency":"$urgency"}}] } return [subst {\[[join $json ,]\]}]XQL Not present: Generic, PostgreSQL, Oracle