- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::formfield::abstract_page
::xowiki::formfield::abstract_page create ... \
[ -as_box (default "false") ] \
[ -multiple_style (default "comma") ]
Class Relations
- class: ::xotcl::Class
- superclass: ::xowiki::formfield::candidate_box_select
- subclass: ::xowiki::formfield::page, ::xowiki::formfield::form_page
::xotcl::Class create ::xowiki::formfield::abstract_page \ -superclass ::xowiki::formfield::candidate_box_selectMethods (to be applied on instances)
as_box (setter)
check=options (scripted)
# # This is a very basic check, which disallows in essence space and # some funny characters. # if {${:multiple}} { set result [nsf::is graph,0..n $value] } else { set result [nsf::is graph $value] } #ns_log notice "OPTIONS CHECK abstract_page '$value' -> $result // '${:multiple}'" return $resultfetch_entry_label (scripted)
# The following is a temporary solution, only working with cr-item attributes # We should support as well user level instance attributes. set entry_label [string trimleft $entry_label _] ::xo::dc 1row [self proc] "select $entry_label from cr_items ci, cr_revisions cr where cr.revision_id = ci.live_revision and ci.item_id = :item_id" return [set $entry_label]get_entry_label (scripted)
foreach o ${:options} { lassign $o label rep if {$value eq $rep} { return $label } } return ""initialize (scripted)
set :package_id [${:object} package_id] #:compute_options nextmultiple_style (setter)
pretty_value (scripted)
set parent_id [${:object} parent_id] set package ::${:package_id} set :options [:get_labels $v] if {${:multiple}} { set default_lang [$package default_language] set root_folder [$package folder_id] set package_root [$package package_url] foreach o ${:options} { lassign $o label value # # "value" is an item_ref. Resolve it (assuming this works) and # prepend the package root URL) # set item_info [$package item_ref -default_lang $default_lang -parent_id $root_folder $value] set href $package_root[dict get $item_info link] set labels($value) "<a href='[ns_quotehtml $href]'>[ns_quotehtml $label]</a>" } set hrefs [list] foreach i $v { if {![info exists labels($i)]} { #:msg "can't determine label for value '$i' (values=$v, l=[array names labels])" set labels($i) $i } set href [$package pretty_link -parent_id $parent_id $i] lappend hrefs "<a href='[ns_quotehtml $href]'>$labels($i)</a>" } if {[:multiple_style] eq "list"} { return "<ul><li>[join $hrefs {</li><li>}]</li></ul>\n" } else { return [join $hrefs {, }] } } else { foreach o ${:options} { lassign $o label value #:log "comparing '$value' with '$v'" if {$value eq $v} { if {${:as_box}} { return [${:object} include [list $value -decoration rightbox]] } set href [$package pretty_link -parent_id $parent_id $value] return "<a href='[ns_quotehtml $href]'>$label</a>" } } }render_input (scripted)
:compute_options next
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables