1#!./tclsh
2# $Id: querynewfoldir.tcl 1204 2009-02-02 19:54:23Z hubert@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#  querynewfoldir.tcl
15#
16#  Purpose:  CGI script to generate html form used to confirm
17#            folder and directory creation
18#  Input:
19set fldr_vars {
20  {fid	"No Collection Specified"}
21}
22
23#  Output:
24#
25#	HTML/CSS data representing the message specified
26#	by the 'uid' argument
27
28# inherit global config
29source ./alpine.tcl
30source cmdfunc.tcl
31
32set query_menu {
33  {
34    {}
35    {
36      {
37	# * * * * HELP * * * *
38	cgi_put [cgi_url "Get Help" wp.tcl?page=help&oncancel=folders class=navbar target=_top]
39      }
40    }
41  }
42}
43
44WPEval $fldr_vars {
45  if {[catch {WPCmd PEFolder collections} collections]} {
46    error [list _action "Collection list" $collections]
47  }
48
49  cgi_http_head {
50    WPStdHttpHdrs
51  }
52
53  cgi_html {
54    cgi_head {
55      WPStdHtmlHdr "Folder Creation"
56      WPStyleSheets
57    }
58
59    cgi_body BGCOLOR="$_wp(bordercolor)" {
60
61      catch {WPCmd PEInfo set help_context foldiradd}
62
63      cgi_form $_wp(appdir)/$_wp(ui1dir)/wp method=get name=confirm target=_top {
64	cgi_text "page=folders" type=hidden notab
65	cgi_text "fid=$fid" type=hidden notab
66	cgi_text "cid=[WPCmd PEInfo key]" type=hidden notab
67	cgi_text "frestore=1" type=hidden notab
68
69	cgi_table border=0 cellspacing=0 cellpadding=2 width="100%" height="100%" {
70	  cgi_table_row {
71	    eval {
72	      cgi_table_data $_wp(menuargs) {
73		WPTFCommandMenu query_menu {}
74	      }
75	    }
76
77	    if {[llength $fid] > 1} {
78		set Dirpref "Subd"
79		set dirpref "subd"
80	    } else {
81		set Dirpref "D"
82		set dirpref "d"
83	    }
84
85	    cgi_table_data valign=top align=center class=dialog {
86	      cgi_table border=0 cellspacing=0 cellpadding=2 width="70%" {
87
88		cgi_table_row {
89		  cgi_table_data align=center {
90		    cgi_br
91		    cgi_put "Folders are used to contain messages.  Typically, messages are placed in folders when you [cgi_italic Save] them from the Message View"
92		    if {[WPCmd PEInfo feature enable-aggregate-command-set]} {
93		      cgi_puts " or Message List pages."
94		    } else {
95		      cgi_puts "page."
96		    }
97
98		    cgi_put "To create a new folder"
99
100		    if {[llength $fid] > 1} {
101		      cgi_put " within the directory [cgi_bold [join [lrange $fid 1 end] /]]"
102		    }
103		    if {[llength $collections] > 1} {
104		      cgi_put " in the collection [cgi_bold [lindex [lindex $collections [lindex $fid 0]] 1]]"
105		    }
106
107		    cgi_put ", enter the name below and click [cgi_italic "Create New Folder"]."
108		    cgi_br
109		    cgi_br
110
111		    cgi_put "Furthermore, folders can be created within directories.  The directory can either be one that now exists "
112		    cgi_put " or one that you wish to create along with the new folder. "
113		    cgi_put "Simply specify the directory name before the folder name separating the two with a "[WPCmd PEFolder delimiter [lindex $fid 0]]" character."
114		    cgi_br
115		    cgi_br
116		    cgi_put "New folder name: "
117		    cgi_text folder= maxlength=64 size=25%
118		    cgi_br
119		    cgi_br
120		    cgi_submit_button "newfolder=Create New Folder" "style=\"margin-right: 10px\""
121		    cgi_submit_button cancelled=Cancel
122		  }
123		}
124	      }
125	    }
126	  }
127	}
128      }
129    }
130  }
131}
132