~ubuntu-branches/debian/stretch/alpine/stretch

« back to all changes in this revision

Viewing changes to web/cgi/alpine-2.0/conduit/apply.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2010-10-03 15:31:55 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20101003153155-2exypc96j1e8tw0p
Tags: 2.02-1
* New upstream release, based on re-alpine project
* Updated debian/copyright to reflect this fact
* re-alpine removed the non-free from the tarball, so now
  we do not repack the upstream tarball. (Yay!)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!./tclsh
2
 
# $Id: apply.tcl 1150 2008-08-20 00:27:11Z mikes@u.washington.edu $
3
 
# ========================================================================
4
 
# Copyright 2008 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
 
#  apply
15
 
#
16
 
#  Purpose:  CGI script generating response to xmlHttpRequest
17
 
#
18
 
#  Input:    
19
 
#            
20
 
set apply_args {
21
 
  {f    {}      ""}
22
 
  {s    {}      ""}
23
 
}
24
 
 
25
 
# inherit global config
26
 
source ../alpine.tcl
27
 
 
28
 
 
29
 
# Import data validate it and get session id
30
 
if {[catch {WPGetInputAndID sessid}]} {
31
 
  return
32
 
}
33
 
 
34
 
# grok parameters
35
 
foreach item $apply_args {
36
 
  if {[catch {eval WPImport $item} errstr]} {
37
 
    WPInfoPage "Web Alpine Error" [font size=+2 $errstr] "Please close this window."
38
 
    exit
39
 
  }
40
 
}
41
 
 
42
 
switch -- $f {
43
 
  {new} -
44
 
  {imp} -
45
 
  {del} {
46
 
    set flag $f
47
 
  }
48
 
  default {
49
 
  }
50
 
}
51
 
 
52
 
switch -- $s {
53
 
  ton -
54
 
  not {
55
 
    set state $s
56
 
  }
57
 
  default {
58
 
  }
59
 
}
60
 
 
61
 
cgi_puts "Content-type: text/html; charset=\"UTF-8\""
62
 
cgi_puts ""
63
 
if {[catch {
64
 
  if {[info exists flag] && [info exists state]} {
65
 
    if {[catch {WPCmd PEMailbox apply flag $state $flag} result]} {
66
 
      error "Apply $state ${flag}: $result"
67
 
    } else {
68
 
      set response "$result [WPCmd PEMailbox selected] [WPCmd PEMailbox messagecount]"
69
 
      cgi_puts $response
70
 
    }
71
 
  } else {
72
 
    WPCmd PEInfo statmsg "Unknown flag ($f) or state ($s)"
73
 
  }
74
 
} result]} {
75
 
  cgi_puts "failed: $result"
76
 
}