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

« back to all changes in this revision

Viewing changes to web/cgi/alpine-2.0/conduit/empty.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: empty.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
 
#  empty.tcl
15
 
#
16
 
#  Purpose:  CGI script generating response to xmlHttpRequest
17
 
#
18
 
#  Input:    
19
 
#            
20
 
set empty_args {
21
 
  {c            "Unspecified Collection"}
22
 
  {f            "Unspecified Folder"}
23
 
  {u            ""      0}
24
 
}
25
 
 
26
 
# inherit global config
27
 
source ../alpine.tcl
28
 
source ../common.tcl
29
 
 
30
 
# Import data validate it and get session id
31
 
if {[catch {WPGetInputAndID sessid}]} {
32
 
  return
33
 
}
34
 
 
35
 
# grok parameters
36
 
foreach item $empty_args {
37
 
  if {[catch {eval WPImport $item} errstr]} {
38
 
    WPInfoPage "Web Alpine Error" [font size=+2 $errstr] "Please close this window."
39
 
    exit
40
 
  }
41
 
}
42
 
 
43
 
 
44
 
cgi_puts "Content-type: text/html; charset=\"UTF-8\""
45
 
cgi_puts ""
46
 
 
47
 
# ONLY ever empty Junk, Trash or Drafts
48
 
set defc [WPCmd PEFolder defaultcollection]
49
 
 
50
 
set tf [lindex [WPCmd PEConfig varget trash-folder] 0]
51
 
set df [lindex [WPCmd PEConfig varget postponed-folder] 0]
52
 
set f [wpLiteralFolder $c $f]
53
 
if {$c == $defc
54
 
    && (([info exists _wp(spamfolder)] && 0 == [string compare $f $_wp(spamfolder)])
55
 
        || ([string length $tf] && 0 == [string compare $f $tf])
56
 
        || ([string length $tf] && 0 == [string compare $f $df]))} {
57
 
  if {[catch {
58
 
    switch -regexp $u {
59
 
      ^([0-9]+)$ -
60
 
      ^selected$ -
61
 
      ^all$ {
62
 
        cgi_puts [WPCmd PEFolder empty $c $f $u]
63
 
      }
64
 
      default {
65
 
        error "Unknown option"
66
 
      }
67
 
    }
68
 
  } result]} {
69
 
    cgi_puts "$result"
70
 
  }
71
 
} else {
72
 
  cgi_puts "Empty $f NOT permitted"
73
 
}