~ubuntu-branches/debian/squeeze/alpine/squeeze

« back to all changes in this revision

Viewing changes to web/cgi/session/queryauth.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2007-02-17 13:17:42 UTC
  • Revision ID: james.westby@ubuntu.com-20070217131742-99x5c6cpg1pbkdhw
Tags: upstream-0.82+dfsg
ImportĀ upstreamĀ versionĀ 0.82+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!./tclsh
 
2
# $Id: queryauth.tcl 391 2007-01-25 03:53:59Z mikes@u.washington.edu $
 
3
# ========================================================================
 
4
# Copyright 2006 University of Washington
 
5
#
 
6
# Licensed under the Apache License, Version 2.0 (the "License");
 
7
# you may not use this file except in compliance with the License.
 
8
# You may obtain a copy of the License at
 
9
#
 
10
#     http://www.apache.org/licenses/LICENSE-2.0
 
11
#
 
12
# ========================================================================
 
13
 
 
14
#  queryauth.tcl
 
15
#
 
16
#  Purpose:  CGI script to generate html form used to ask for authentication
 
17
#            credentials
 
18
 
 
19
# input:
 
20
set query_vars {
 
21
  {cid          "Missing Command ID"}
 
22
  {authcol      "Missing Authenticaion Collection"}
 
23
  {authfolder   "Missing Authentication Folder"}
 
24
  {authpage     "No Post Authorization Instructions"}
 
25
  {authcancel   "No Auth Cancel Instructions"}
 
26
  {authuser     ""      ""}
 
27
  {reason       ""      ""}
 
28
}
 
29
 
 
30
#  Output:
 
31
#
 
32
#       HTML/Javascript/CSS data representing the message specified
 
33
#       by the 'uid' argument
 
34
 
 
35
 
 
36
# inherit global config
 
37
source ./alpine.tcl
 
38
source ../$_wp(appdir)/cmdfunc.tcl
 
39
 
 
40
 
 
41
set query_menu {
 
42
  {
 
43
    {}
 
44
    {
 
45
      {
 
46
        # * * * * Help * * * *
 
47
        cgi_put "Get Help"
 
48
      }
 
49
    }
 
50
  }
 
51
}
 
52
 
 
53
 
 
54
WPEval $query_vars {
 
55
 
 
56
  if {$cid != [WPCmd PEInfo key]} {
 
57
    error [list _action open "Invalid Operation ID" "Click Back button to try again."]
 
58
  }
 
59
 
 
60
  cgi_http_head {
 
61
    WPStdHttpHdrs
 
62
  }
 
63
 
 
64
  cgi_html {
 
65
    cgi_head {
 
66
      WPStdHtmlHdr "Authentication Credentials"
 
67
      WPStyleSheets
 
68
    }
 
69
 
 
70
    if {[string length $authuser]} {
 
71
      set onload "onLoad=document.auth.pass.focus()"
 
72
    } else {
 
73
      set onload "onLoad=document.auth.user.focus()"
 
74
    }
 
75
 
 
76
    cgi_body BGCOLOR="$_wp(bordercolor)" $onload {
 
77
      cgi_form $_wp(serverpath)/session/setauth.tcl method=post enctype=multipart/form-data name=auth target=_top {
 
78
        cgi_text "sessid=$sessid" type=hidden notab
 
79
        cgi_text "cid=$cid" type=hidden notab
 
80
        cgi_text "authcol=$authcol" type=hidden notab
 
81
        cgi_text "authfolder=$authfolder" type=hidden notab
 
82
        cgi_text "authpage=$authpage" type=hidden notab
 
83
        cgi_text "authcancel=$authcancel" type=hidden notab
 
84
 
 
85
        cgi_table border=0 cellspacing=0 cellpadding=2 width="100%" height="100%" {
 
86
          cgi_table_row {
 
87
            eval {
 
88
              cgi_table_data $_wp(menuargs) {
 
89
                WPTFCommandMenu query_menu {}
 
90
              }
 
91
            }
 
92
 
 
93
            cgi_table_data valign=top class=dialog {
 
94
              cgi_division align=center class=dialog "style=\"padding:30 12%\"" {
 
95
                if {[info exists reason] && [string compare $reason BADPASSWD]} {
 
96
                  cgi_puts $reason
 
97
                } else {
 
98
                  cgi_puts "Login Required"
 
99
                }
 
100
              }
 
101
 
 
102
              cgi_center {
 
103
                cgi_puts [cgi_font size=+1 class=dialog "Username: "]
 
104
                cgi_text user=$authuser maxlength=30 size=25%
 
105
                cgi_br
 
106
                cgi_br
 
107
                cgi_puts [cgi_font size=+1 class=dialog "Password: "]
 
108
                cgi_text pass= type=password maxlength=30 size=25%
 
109
                cgi_br
 
110
                cgi_br
 
111
                cgi_submit_button auths=Login
 
112
                cgi_submit_button cancel=Cancel
 
113
              }
 
114
            }
 
115
          }
 
116
        }
 
117
      }
 
118
    }
 
119
  }
 
120
}