Documentation Source Text

Check-in [20a5bb3601]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the checklist application, improve the submenu and simplify the login processing.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | test-dashboard
Files: files | file ages | folders
SHA3-256: 20a5bb3601e3772be4af90fe763aea1fc1302b9959f41e8f53554f03e1f29f44
User & Date: drh 2019-08-02 17:49:33.295
Context
2019-08-05
11:51
Show a table of outcomes in the dashboard.tcl app. (check-in: 1f66b2f1a9 user: drh tags: test-dashboard)
2019-08-02
17:54
In the checklist application, improve the submenu and simplify the login processing. (Originally checked in on the wrong branch.) (check-in: ee656f1e92 user: drh tags: trunk)
17:49
In the checklist application, improve the submenu and simplify the login processing. (check-in: 20a5bb3601 user: drh tags: test-dashboard)
15:52
Add an initial version of the client-side uplink library. (check-in: 4e0da90810 user: drh tags: test-dashboard)
Changes
Unified Diff Ignore Whitespace Patch
Changes to misc/checklist.tcl.
74
75
76
77
78
79
80

81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
  }
  wapp-subst {</ol></div>\n</html>\n}
}

# Show the CGI environment for testing purposes.
#
proc wapp-page-env {} {

  sqlite3 db :memory:
  set v [db one {SELECT sqlite_source_id()}]
  checklist-verify-login
  wapp-trim {
     <div class='fossil-doc' data-title='Checklist Environment'>
     <pre>%html([wapp-debug-env])}
  wapp-subst {SQLite = %html($v)</pre>\n</div>\n}

}

# Show the complete text of this script.
#
proc wapp-page-self {} {
  wapp-cache-control max-age=3600
  wapp-subst {<div class='fossil-doc' data-title='Checklist Program Listing'>\n}
  set fd [open [wapp-param SCRIPT_FILENAME] rb]
  set script [read $fd]
  close $fd
  wapp-trim {
    <p>The following is the complete text of the 
    <a href='https://wapp.tcl.tk/'>Wapp script</a> that implements this
    <a href='https://fossil-scm.org/home/doc/trunk/www/serverext.wiki'>Fossil
    CGI extension</a>:</p>
    <pre>%html($script)</pre>
  }
  wapp-subst {</div>\n}
}


# Check user permissions provided to use by Fossil in the FOSSIL_USER
# and FOSSIL_CAPABILITIES environment variables.  Set the Wapp parameters
# as follows:
#
#     CKLIST_USER      Name of the user.  Empty string if not logged in
#     CKLIST_WRITE     True if the user is allowed to make updates
#     CKLIST_ADMIN     True if the user is an administrator.
#
# The database should already be open.
#
proc checklist-verify-login {} {
  global env
  if {[info exists env(FOSSIL_USER)]} {
    wapp-set-param CKLIST_USER $env(FOSSIL_USER)
  } else {
    wapp-set-param CKLIST_USER {}
  }
  if {[info exists env(FOSSIL_CAPABILITIES)]} {
    set perm $env(FOSSIL_CAPABILITIES)
  } else {
    set perm {}
  }
  wapp-set-param CKLIST_WRITE [string match {*i*} $perm]
  wapp-set-param CKLIST_ADMIN [string match {*[as]*} $perm]
}

# Print the common header shown on most pages
#
# Return 1 to abort.  Return 0 to continue with page generation.







>


<




>






|










|















|
|
<
|
<
<
|
<
<
<







74
75
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

124


125



126
127
128
129
130
131
132
  }
  wapp-subst {</ol></div>\n</html>\n}
}

# Show the CGI environment for testing purposes.
#
proc wapp-page-env {} {
  checklist-common-header
  sqlite3 db :memory:
  set v [db one {SELECT sqlite_source_id()}]

  wapp-trim {
     <div class='fossil-doc' data-title='Checklist Environment'>
     <pre>%html([wapp-debug-env])}
  wapp-subst {SQLite = %html($v)</pre>\n</div>\n}
  checklist-common-footer
}

# Show the complete text of this script.
#
proc wapp-page-self {} {
  wapp-cache-control max-age=3600
  checklist-common-header
  set fd [open [wapp-param SCRIPT_FILENAME] rb]
  set script [read $fd]
  close $fd
  wapp-trim {
    <p>The following is the complete text of the 
    <a href='https://wapp.tcl.tk/'>Wapp script</a> that implements this
    <a href='https://fossil-scm.org/home/doc/trunk/www/serverext.wiki'>Fossil
    CGI extension</a>:</p>
    <pre>%html($script)</pre>
  }
  checklist-common-footer
}


# Check user permissions provided to use by Fossil in the FOSSIL_USER
# and FOSSIL_CAPABILITIES environment variables.  Set the Wapp parameters
# as follows:
#
#     CKLIST_USER      Name of the user.  Empty string if not logged in
#     CKLIST_WRITE     True if the user is allowed to make updates
#     CKLIST_ADMIN     True if the user is an administrator.
#
# The database should already be open.
#
proc checklist-verify-login {} {
  global env
  set usr [wapp-param FOSSIL_USER]
  wapp-set-param CKLIST_USER $usr

  if {$usr!=""} wapp-allow-xorigin-params


  set perm [wapp-param FOSSIL_CAPABILITIES]



  wapp-set-param CKLIST_WRITE [string match {*i*} $perm]
  wapp-set-param CKLIST_ADMIN [string match {*[as]*} $perm]
}

# Print the common header shown on most pages
#
# Return 1 to abort.  Return 0 to continue with page generation.
167
168
169
170
171
172
173
174
175
176


177
178



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
    }
    </style>
  }
  checklist-verify-login
  wapp-subst {<div class="submenu">\n}
  set base [wapp-param BASE]
  set this [wapp-param PATH_HEAD]
  if {$this!="index"} {
    wapp-subst {<a href='%html($base/index)'>Checklist</a>\n}
  }


  set admin [wapp-param CKLIST_ADMIN 0]
  if {$admin} {



    if {$this!="sql"} {
      wapp-subst {<a href='%html($base/sql)'>SQL</a>\n}
    }
    if {$this!="cklistedit"} {
      wapp-subst {<a href='%html($base/cklistedit)'>Edit-checklist</a>\n}
    }
    wapp-subst {<a href='%html($base/env)'>CGI-environment</a>}
    wapp-subst {<a href='%html($base/self)'>Source-code</a>}
  }
  set dir [wapp-param ROOT_URL]
  wapp-subst {<a href='%html($dir/listing)'>Catalog</a>\n}
  wapp-subst {</div>\n}
  return 0
}

# Close out a web page.  Close the database connection that was opened
# by checklist-common-header.
#







<
|
<
>
>


>
>
>



<
<
<



<
<







162
163
164
165
166
167
168

169

170
171
172
173
174
175
176
177
178
179



180
181
182


183
184
185
186
187
188
189
    }
    </style>
  }
  checklist-verify-login
  wapp-subst {<div class="submenu">\n}
  set base [wapp-param BASE]
  set this [wapp-param PATH_HEAD]

  wapp-subst {<a href='%html($base/index)'>Checklist</a>\n}

  set dir [wapp-param ROOT_URL]
  wapp-subst {<a href='%html($dir/listing)'>Catalog</a>\n}
  set admin [wapp-param CKLIST_ADMIN 0]
  if {$admin} {
    if {$this!="cklistedit"} {
      wapp-subst {<a href='%html($base/cklistedit)'>Edit-checklist</a>\n}
    }
    if {$this!="sql"} {
      wapp-subst {<a href='%html($base/sql)'>SQL</a>\n}
    }



    wapp-subst {<a href='%html($base/env)'>CGI-environment</a>}
    wapp-subst {<a href='%html($base/self)'>Source-code</a>}
  }


  wapp-subst {</div>\n}
  return 0
}

# Close out a web page.  Close the database connection that was opened
# by checklist-common-header.
#