Class ::xowiki::includelet::my-categories

::xowiki::includelet::my-categories[i] create ... \
           [ -__decoration (default "none") ] \
           [ -parameter_declaration (default " {-summary 1} ") ]

List the categories associated with the current page.
Defined in /var/www/openacs.org/packages/xowiki/tcl/includelet-procs.tcl

Class Relations

  • class: ::xowiki::IncludeletClass[i]
  • superclass: ::xowiki::Includelet[i]
::xowiki::IncludeletClass create ::xowiki::includelet::my-categories \
     -superclass ::xowiki::Includelet

Methods (to be applied on instances)

  • __decoration (setter)

  • parameter_declaration (setter)

  • render (scripted)

    :get_parameters
    set content ""
    
    set weblog_page [::$package_id get_parameter weblog_page:graph weblog]
    set entries [list]
    set href [export_vars -base [::$package_id package_url]$weblog_page {summary}]
    set notification_type ""
    if {[::$package_id get_parameter with_notifications:boolean 1] &&
        [::xo::cc user_id] != 0} { ;# notifications require login
      set notification_type [notification::type::get_type_id -short_name xowiki_notif]
    }
    if {[::$package_id exists_query_parameter return_url]} {
      set return_url [::$package_id query_parameter return_url:localurl]
    }
    foreach cat_id [category::get_mapped_categories [${:__including_page} set item_id]] {
      lassign [category::get_data $cat_id] category_id category_name tree_id tree_name
      #:log "--cat $cat_id $category_id $category_name $tree_id $tree_name"
      set label [ns_quotehtml "$category_name ($tree_name)"]
      set entry "<a href='[ns_quotehtml $href&category_id=$category_id]'>[ns_quotehtml $label]</a>"
      if {$notification_type ne ""} {
        set notification_text "Subscribe category $category_name in tree $tree_name"
        set notifications_return_url [expr {[info exists return_url] ? $return_url : [ad_return_url]}]
        set notification_image "<adp:icon name='envelope' title='[ns_quotehtml $notification_text]'>"
    
        set cat_notif_link [export_vars -base /notifications/request-new  {{return_url $notifications_return_url}  {pretty_name $notification_text}  {type_id $notification_type}  {object_id $category_id}}]
        append entry "<a href='[ns_quotehtml $cat_notif_link]'> " $notification_image </a>
      }
      lappend entries $entry
    }
    if {[llength $entries]>0} {
      set content "#xowiki.categories#: [join $entries {, }]"
    }
    return $content