Documentation Source Text

Check-in [e8d378f753]
Login

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

Overview
Comment:Improvements to the header comment on the checklist application, bringing it up-to-date with the actual implementation. Added a prototype checklist database file.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e8d378f7537fd7ad239396452504906f985518425f09aa3902c099b546209e31
User & Date: drh 2019-07-27 16:09:39
Context
2019-08-01
02:44
Update the change log. check-in: 6ec9f2a9c8 user: drh tags: trunk
2019-07-27
16:09
Improvements to the header comment on the checklist application, bringing it up-to-date with the actual implementation. Added a prototype checklist database file. check-in: e8d378f753 user: drh tags: trunk
15:39
Add the CGI-Environment and Source-code submenu links to the checklist application. check-in: a5c38ef1bf user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added misc/checklist-prototype.db.

cannot compute difference between binary files

Changes to misc/checklist.tcl.

1
2
3
4
5
6
7

8
9
10

11
12
13
14
15

16
17
18
19
20

21
22
23
24
25
26

27

28























29
30
31
32
33
34
35
..
84
85
86
87
88
89
90
91
92

93
94
95
96
97
98
99
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/wapptclsh
#
# This script implements a release-checklist web application.  Installation
# steps:
#
#   (1) Put the wapptclsh framework binary in /usr/bin (or equivalent)
#   (2) Create a directory to store checklist databases.  Edit this

#       script to store the database directory in DATADIR
#   (3) Install at least one template database.  Perhaps use one of the
#       testing databases found in the source code repository for this

#       script.  The details of the checklist, logins and passwords, and
#       so forth can be edited after the application is running.
#   (4) Activate the server by one of the following techniques:
#       (4a) Run "wapptclsh checklist.tcl" for a pop-up instance on the
#            local machine.

#       (4b) Run "wapptclsh checklist.tcl --server 8080" for an HTTP server.
#       (4c) Make this script a CGI script according to however CGI works
#            on your web server
#       (4d) Run "wapptclsh checklist.tcl --scgi 9000" to start an SCGI
#            server, then configure Nginx to relay requests to TCP port 9000.

#
# Update 2019-07-26:
# The script has been revised to run as a Fossil extension.  It now uses
# Fossil for login and user credentials.  Anyone with check-in privilege
# can edit.  Anyone with Setup privilege can be a checklist admin.
#

set DATADIR /checklist  ;# Edit to be the directory holding checklist databases

























package require wapp

# Any unknown URL dispatches to this routine.  List all available
# checklists.
#
proc wapp-default {} {
  wapp-page-listing
................................................................................
    CGI extension</a>:</p>
    <pre>%html($script)</pre>
  }
  wapp-subst {</div>\n}
}


# Check user permissions by looking at the login/password in the
# checklist-login cookie.  Set the following environment variables:

#
#     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.
#
................................................................................
  } 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 all pages
#
# Return 1 to abort.  Return 0 to continue with page generation.
#
proc checklist-common-header {} {
  if {![wapp-param-exists OBJECT] || [set dbfile [wapp-param OBJECT]]==""} {
    wapp-redirect listing
    return 1


|
|

|
<
>
|
|
<
>
|
|
|
<
|
>
|
|
|
|
|
>

<
|
|
<

>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|
>







 







|







1
2
3
4
5
6

7
8
9

10
11
12
13

14
15
16
17
18
19
20
21
22

23
24

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
...
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/wapptclsh
#
# This is a Wapp[1] script that implements a release-checklist web application
# using the Fossil CGI extension mechanism[2].
#
# Installation instructions:

#
#    1.  Put the wapptclsh binary in /usr/bin.  (Or put it somewhere else
#        and edit the #! on the first line of this script.)

#
#    2.  Activate the CGI extension mechanism of Fossil.  Instructions
#        on how to do that are found at [2].  Add this script to the
#        extroot directory that you create as part of the activation

#        process.
#
#    3.  Create a directory in which to store checklist database files.
#        Edit this script to make the DATADIR variable hold the name
#        of that directory.  (The default name is "/checklist".  The
#        default name is a top-level directory in the filesystem because
#        in the canonical use case for this application, the Fossil
#        server is running inside a chroot jail.)
#

#           vvvvvvvvvv---  This is what you might need to edit
set DATADIR /checklist

#
#    4.  Add a prototype checklist database to DATADIR.  Perhaps use [3]
#        as the prototype.  Name the checklist database something that matches
#        the pattern "3*.db".
#
# To add a new checklist in the catalog:
#
#    1.  Copy an existing checklist database in the DATADIR directory
#        into the new filename.  Remember that checklist filenames should
#        follow the pattern "3*.db"
#
#    2.  Use the SQLite command-line utility program or the "SQL" option
#        in the checklist application to make the following SQL changes in
#        the new database:
#
#           a.  UPDATE config SET value='<Checklist-Name>' WHERE name='title';
#           b.  DELETE FROM history;
#           c.  DELETE FROM ckitem;
#
#        In step 2a, use an appropriate name for the checklist in place of
#        <Checklist-Name>, obviously.
#
# Links:
#
# [1] https://wapp.tcl.tk/
# [2] https://fossil-scm.org/home/doc/trunk/www/serverext.wiki
# [3] https://sqlite.org/docsrc/file/misc/checklist-prototype.db
#
package require wapp

# Any unknown URL dispatches to this routine.  List all available
# checklists.
#
proc wapp-default {} {
  wapp-page-listing
................................................................................
    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.
#
................................................................................
  } 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.
#
proc checklist-common-header {} {
  if {![wapp-param-exists OBJECT] || [set dbfile [wapp-param OBJECT]]==""} {
    wapp-redirect listing
    return 1