Checklist

Check-in [25c9d1ec58]
Login

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

Overview
Comment:Set the default DATADIR to /checklist. A few other last-minute tweaks to get it working for the website.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 25c9d1ec589ddd57fcdd023c20de43b9225b2493
User & Date: drh 2018-01-30 17:37:17
Context
2018-01-30
18:01
Clean up legacy files and create a README.md file at the top-level. check-in: a165137c40 user: drh tags: trunk
17:37
Set the default DATADIR to /checklist. A few other last-minute tweaks to get it working for the website. check-in: 25c9d1ec58 user: drh tags: trunk
15:48
Fix a missing </b< in the 3080300.db database. check-in: 677b092f11 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to checklist.tcl.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
178
179
180
181
182
183
184

185
186
187
188
189
190
191
...
740
741
742
743
744
745
746

747
748
749
750
751
752
753
754
755
756
757
758
759
760
#            local machine.
#       (3b) Run "wapptclsh checklist.tcl --server 8080" for an HTTP server.
#       (3c) Make this script a CGI script according to however CGI works
#            on your web server
#       (3d) Run "wapptclsh checklist.tcl --scgi 9000" to start an SCGI
#            server, then configure Nginx to relay requests to TCP port 9000.
#
set DATADIR ./dbs      ;# 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 {} {
................................................................................
    set px [db one {SELECT hex($p)}]
    set ok [db exists {SELECT 1 FROM config
                        WHERE name=('user-'||$u)
                          AND hex(value)=$px}]
    if {$ok} {
      wapp-set-cookie checklist-login $u,$px
      wapp-redirect index

    }
    wapp-subst {<p class='error'>Invalid username or password</p>\n}
  }
  wapp-trim {
    <form method='POST' action='login'>
    <table border="0">
    <tr><td align='right'>Login:&nbsp;</td>
................................................................................
  dict set wapp ROOT_URL [dict get $wapp BASE_URL]
  if {[file readable $DATADIR/$dbname.db]} {
    # an appropriate database has been found
    dict set wapp OBJECT $DATADIR/$dbname.db
    if {[regexp {^([^/]+)(.*)$} [dict get $wapp PATH_TAIL] all head tail]} {
      dict set wapp PATH_HEAD $head
      dict set wapp PATH_TAIL [string trimleft $tail /]

    } else {
      dict set wapp PATH_HEAD {}
      dict set wapp PATH_TAIL {}
    }
  } else {
    # Not a valid database.  Change the method to list all available
    # databases.
    dict set wapp OBJECT {}
    dict set wapp PATH_HEAD listing
  }
}

# Start up the web-server
wapp-start $::argv







|







 







>







 







>








|





11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
...
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
#            local machine.
#       (3b) Run "wapptclsh checklist.tcl --server 8080" for an HTTP server.
#       (3c) Make this script a CGI script according to however CGI works
#            on your web server
#       (3d) Run "wapptclsh checklist.tcl --scgi 9000" to start an SCGI
#            server, then configure Nginx to relay requests to TCP port 9000.
#
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 {} {
................................................................................
    set px [db one {SELECT hex($p)}]
    set ok [db exists {SELECT 1 FROM config
                        WHERE name=('user-'||$u)
                          AND hex(value)=$px}]
    if {$ok} {
      wapp-set-cookie checklist-login $u,$px
      wapp-redirect index
      return
    }
    wapp-subst {<p class='error'>Invalid username or password</p>\n}
  }
  wapp-trim {
    <form method='POST' action='login'>
    <table border="0">
    <tr><td align='right'>Login:&nbsp;</td>
................................................................................
  dict set wapp ROOT_URL [dict get $wapp BASE_URL]
  if {[file readable $DATADIR/$dbname.db]} {
    # an appropriate database has been found
    dict set wapp OBJECT $DATADIR/$dbname.db
    if {[regexp {^([^/]+)(.*)$} [dict get $wapp PATH_TAIL] all head tail]} {
      dict set wapp PATH_HEAD $head
      dict set wapp PATH_TAIL [string trimleft $tail /]
      dict append wapp SELF_URL /$head
    } else {
      dict set wapp PATH_HEAD {}
      dict set wapp PATH_TAIL {}
    }
  } else {
    # Not a valid database.  Change the method to list all available
    # databases.
    dict set wapp OBJECT {}
    if {$dbname!="env"} {dict set wapp PATH_HEAD listing}
  }
}

# Start up the web-server
wapp-start $::argv