xowf::test_item::Question_manager method pagination_actions (public)

 <instance of xowf::test_item::Question_manager[i]> pagination_actions \
    [ -container container ] [ -question_count question_count ] \
    [ -visited visited ] [ -flagged flagged ] \
    [ -current_position current_position ] [ -CSSclass CSSclass ]

Defined in packages/xowf/tcl/test-item-procs.tcl

Create actions used for pagination.

Switches:
-container (optional, object)
-question_count (optional, integer)
-visited (optional, integer)
-flagged (optional, integer)
-current_position (optional, integer)
-CSSclass (optional, defaults to "btn-sm")

Testcases:
No testcase defined.
Source code:
set actions ""

if {$question_count > 1} {
  if {[[${:wfi} get_parent_object] property show_pagination_actions t]} {
    set extra_css [:pagination_button_css_class  -CSSclass $CSSclass  -cond [expr {$current_position == 0}]  -extra "disabled"]
    ${container}::previousQuestion configure  -extra_css_class $extra_css  -label "<small><adp:icon name='previous'> #acs-kernel.common_Previous#</small>"  -label_noquote true  -wrapper_CSSclass "pagination"
    lappend actions previousQuestion

    for {set count 1} {$count <= $question_count} {incr count} {
      set visited_css [expr {($count - 1) in $visited ? "visited" : ""}]
      set flag_label [expr {($count - 1) in $flagged
                            ? " [::xowiki::bootstrap::icon -name flag -CSSclass text-danger]"
                            : ""}]
      set extra_css [:pagination_button_css_class  -CSSclass "$CSSclass $visited_css"  -cond [expr {$current_position == $count - 1 }]  -extra "active current"]
      ${container}::Action create ${container}::q.$count  -label "$count$flag_label"  -label_noquote true  -state_safe true  -next_state working  -wrapper_CSSclass "pagination"  -extra_css_class $extra_css  -proc activate {obj} [subst {
            #ns_log notice "===== NAVIGATE next"
            next
            #ns_log notice "===== NAVIGATE goto [expr {$count - 1}]"
            :goto_page [expr {$count - 1}]
          }]
      lappend actions q.$count
    }
  }
  set extra_css [:pagination_button_css_class  -CSSclass $CSSclass  -cond [expr {$current_position+2 > $question_count}]  -extra "disabled"]
  ${container}::nextQuestion configure  -extra_css_class $extra_css  -label "<small>#acs-kernel.common_Next# <adp:icon name='next'></small>"  -label_noquote true  -wrapper_CSSclass "pagination"

  set flag_state [expr {$current_position in $flagged ? "delete" : "set"}]
  ${container}::flag configure  -label "#xowf.flag_${flag_state}#"  -title "#xowf.flag_${flag_state}_title#"

  lappend actions nextQuestion
}
return $actions
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: