notification::display::request_widget (public)

 notification::display::request_widget -type type -object_id object_id \
    -pretty_name pretty_name -url url [ -user_id user_id ]

Defined in packages/notifications/tcl/notification-display-procs.tcl

Produce a widget for requesting notifications of a given type. If the notifications package has not been mounted then return the empty string.

Switches:
-type (required)
-object_id (required)
-pretty_name (required)
-url (required)
-user_id (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 _ _ (public) ad_conn ad_conn (public) apm_package_url_from_key apm_package_url_from_key (public) export_vars export_vars (public) notification::display::subscribe_url notification::display::subscribe_url (public) notification::display::request_widget notification::display::request_widget notification::display::request_widget->_ notification::display::request_widget->ad_conn notification::display::request_widget->apm_package_url_from_key notification::display::request_widget->export_vars notification::display::request_widget->notification::display::subscribe_url

Testcases:
No testcase defined.
Source code:
    # Check that we're mounted
    if { [apm_package_url_from_key [notification::package_key]] eq "" } {
        return {}
    }

    if {$user_id eq ""} {
        set user_id [ad_conn user_id]
    }

    # Get the type id
    set type_id [notification::type::get_type_id -short_name $type]

    # Check if subscribed
    set request_id [notification::request::get_request_id -type_id $type_id -object_id $object_id -user_id $user_id]

    if {$request_id ne ""} {
        set icon /resources/acs-subsite/email_delete.gif
        set icon_alt [_ acs-subsite.icon_of_envelope]
        set sub_url [unsubscribe_url -request_id $request_id -url $url]
        set pretty_name [ns_quotehtml $pretty_name]
        set title [_ notifications.lt_Ubsubscribe_Notification_]
        set sub_chunk [_ notifications.lt_You_have_requested_no]
    } else {
        set icon /resources/acs-subsite/email_add.gif
        set icon_alt [_ acs-subsite.icon_of_envelope]
        set sub_url [subscribe_url -type $type -object_id $object_id -url $url -user_id $user_id -pretty_name $pretty_name]
        set pretty_name [ns_quotehtml $pretty_name]
        set title [_ notifications.lt_Request_Notification_]
        set sub_chunk [_ notifications.lt_You_may_a_hrefsub_url]
    }
    set notif_chunk "<a href=\"[ns_quotehtml $sub_url]\" title=\"[ns_quotehtml $title]\"> <img src=\"$icon\" alt=\"$icon_alt\" style=\"border:0\">$sub_chunk</a>"
    # if they are an admin give them to view all subscribers
    if { [permission::permission_p -object_id $object_id -privilege admin] } {
        set href [export_vars -base /notifications/subscribers -url {object_id}]
        append notif_chunk " \[<a href=\"[ns_quotehtml $href]\">[_ notifications.Subscribers]</a>\]"
    }

    if { $sub_url ne "" } {
        return $notif_chunk
    } else {
         return ""
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: