Documentation Source Text

Check-in [ee656f1e92]
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. (Originally checked in on the wrong branch.)
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ee656f1e92304bcafd1724e6a99d92f6200b124baf863d5524924303596ffcf2
User & Date: drh 2019-08-02 17:54:52
Context
2019-08-05
12:54
Update the documentation on the affinity of the columns of VIEWs and subqueries that are generated from expressions to match the actual implementation of 10 years standing - namely such columns have BLOB affinity, not no affinity. Ticket https://www.sqlite.org/src/info/d52a29a9e6bc55c5 check-in: 07b7749da8 user: drh tags: trunk
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
2019-08-01
16:46
Update the /env method of the checklist application to work better with the latest version of Wapp for CGI. check-in: b1400ebb42 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs 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
...
114
115
116
117
118
119
120
121
122
123
124
125
126

127
128
129
130
131
132
133
134
135
136
137
...
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
  }
  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_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.
................................................................................
    }
    </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.
#







>


<




>






|










|







 







|
<
<
|
<
<
>
|
<
<
<







 







<
|
<
>
>


>
>
>



<
<
<



<
<







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
...
115
116
117
118
119
120
121
122


123


124
125



126
127
128
129
130
131
132
...
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
  }
  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_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.
................................................................................
    }
    </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.
#