xowiki::includelet::personal-notification-messages proc get_messages_response (public)

 xowiki::includelet::personal-notification-messages[i] get_messages_response \
    [ -notification_id notification_id ] [ -user_id user_id ]

Defined in 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)
-user_id
(optional)

Partial Call Graph (max 5 caller/called nodes):
%3 xo::get_user_name xo::get_user_name xowiki::includelet::personal-notification-messages proc get_messages_response xowiki::includelet::personal-notification-messages proc get_messages_response xowiki::includelet::personal-notification-messages proc get_messages_response->xo::get_user_name

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
[ hide source ] | [ make this the default ]
Show another procedure: