Annotation of libwww/Library/src/HTDialog.html, revision 2.10
2.1 frystyk 1: <HTML>
2: <HEAD>
2.9 frystyk 3: <TITLE>W3C Sample Code Library libwww Messages and Dialogs</TITLE>
2.1 frystyk 4: </HEAD>
5: <BODY>
2.8 frystyk 6: <H1>
7: Application side Error Messages And the like
8: </H1>
2.1 frystyk 9: <PRE>
10: /*
11: ** (c) COPYRIGHT MIT 1995.
12: ** Please first read the full copyright statement in the file COPYRIGH.
13: */
14: </PRE>
2.8 frystyk 15: <P>
16: This module provides some "make life easier" functions in order to get the
17: application going. The functionality of this module was originally in
18: <A HREF="HTAccess.html">HTAccess</A>, but now It is part of the
19: <A HREF="WWWApp.html">application interface</A> which the application
20: <EM>may</EM> use it if desired.
21: <P>
22: This module is implemented by <A HREF="HTHome.c">HTHome.c</A>, and it is
23: a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
24: Library</A>.
2.1 frystyk 25: <PRE>
2.9 frystyk 26: #ifndef HTDIALOG_H
27: #define HTDIALOG_H
2.1 frystyk 28: #include "WWWLib.h"
2.10 ! vbancrof 29:
! 30: #ifdef __cplusplus
! 31: extern "C" {
! 32: #endif
2.1 frystyk 33: </PRE>
2.8 frystyk 34: <H2>
2.9 frystyk 35: <A NAME="English">Default English Error Messages and Progress Notifications</A>
2.8 frystyk 36: </H2>
37: <P>
2.9 frystyk 38: The following functions provide a default set of error messages and prompts
39: in plain English. You can of course change this as you like.
40: <H3>
41: <A NAME="Prompt">Default English User Prompts and Questions</A>
42: </H3>
43: <P>
44: This list corresponds to the enumeration list defined in the
45: <A HREF="HTAlert.html#String">HTAlert module</A>
46: <PRE>
47: #define HT_MSG_ENGLISH_INITIALIZER \
48: "Please enter username:", \
49: "Please enter username for proxy authentication:", \
50: "Please enter username for this FTP server:", \
51: "Password:", \
52: "Please give name of file to save in:", \
53: "Plase enter account:", \
54: "You might not be allowed to use this method here, continue?", \
55: "Location has moved, continue?", \
56: "A new set of rules is requested to be added to your setup - continue?", \
57: "This file already exists - replace existing file?", \
58: "Authentication failed - retry?", \
59: "Proxy authentication failed - retry?", \
60: "This method has already been performed - repeat operation?", \
61: "This document is very big - continue operation?", \
62: "The source document for this operation has moved - continue operation \
63: with new location?", \
64: "The destination document for this operation has moved - continue \
65: operation with new location?", \
66: "A redirection may change the behavior of this method - proceed anyway?", \
67: "An automatic request for changing proxy has been encountered - continue?", \
68: "The persistent cache is already in use by another user. If this is not \
69: the case then you can manually delete this lock and restart.", \
70: "The server has sent you a cookie - accept?"
71: </PRE>
72: <H3>
73: <A NAME="Messsages">Default English Messages and Progress Notifications</A>
74: </H3>
75: <P>
76: This list corresponds to the enumeration list defined in the
77: <A HREF="HTError.html#errorinfo">HTError module</A>
78: <PRE>
79: /* CODE ERROR MESSAGE ERROR URL */
80: #define HTERR_ENGLISH_INITIALIZER \
81: { 100, "Continue", "information" }, \
82: { 101, "Switching Protocols", "information" }, \
83: { 200, "OK", "success" }, \
84: { 201, "Created", "success" }, \
85: { 202, "Accepted", "success" }, \
86: { 203, "Non-authoritative Information", "success" }, \
87: { 204, "Document Updated", "success" }, \
88: { 205, "Reset Content", "success" }, \
89: { 206, "Partial Content", "success" }, \
90: { 207, "Partial Update OK", "success" }, \
91: { 300, "Multiple Choices", "redirection" }, \
92: { 301, "Moved Permanently", "redirection" }, \
93: { 302, "Found", "redirection" }, \
94: { 303, "See Other", "redirection" }, \
95: { 304, "Not Modified", "redirection" }, \
96: { 305, "Use Proxy", "redirection" }, \
97: { 306, "Proxy Redirect", "redirection" }, \
98: { 307, "Temporary Redirect", "redirection" }, \
99: { 400, "Bad Request", "client_error" }, \
100: { 401, "Unauthorized", "client_error" }, \
101: { 402, "Payment Required", "client_error" }, \
102: { 403, "Forbidden", "client_error" }, \
103: { 404, "Not Found", "client_error" }, \
104: { 405, "Method Not Allowed", "client_error" }, \
105: { 406, "Not Acceptable", "client_error" }, \
106: { 407, "Proxy Authentication Required", "client_error" }, \
107: { 408, "Request Timeout", "client_error" }, \
108: { 409, "Conflict", "client_error" }, \
109: { 410, "Gone", "client_error" }, \
110: { 411, "Length Required", "client_error" }, \
111: { 412, "Precondition Failed", "client_error" }, \
112: { 413, "Request Entity Too Large", "client_error" }, \
113: { 414, "Request-URI Too Large", "client_error" }, \
114: { 415, "Unsupported Media Type", "client_error" }, \
115: { 416, "Range Not Satisfiable", "client_error" }, \
116: { 417, "Expectation Failed", "client_error" }, \
117: { 418, "Reauthentication Required", "client_error" }, \
118: { 419, "Proxy Reauthentication Reuired", "client_error" }, \
119: { 500, "Internal Server Error", "server_error" }, \
120: { 501, "Not Implemented", "server_error" }, \
121: { 502, "Bad Gateway", "server_error" }, \
122: { 503, "Service Unavailable", "server_error" }, \
123: { 504, "Gateway Timeout", "server_error" }, \
124: { 505, "HTTP Version not supported", "server_error" }, \
125: { 506, "Partial update Not Implemented", "server_error" }, \
126: \
127: /* Cache Warnings */ \
128: { 10, "Response is Stale", "cache" }, \
129: { 11, "Revalidation Failed", "cache" }, \
130: { 12, "Disconnected Opeartion", "cache" }, \
131: { 13, "Heuristic Expiration", "cache" }, \
132: { 14, "Transformation Applied", "cache" }, \
133: { 99, "Cache warning", "cache" }, \
134: \
135: /* Non-HTTP Error codes and warnings */ \
136: { 0, "Can't locate remote host", "internal" }, \
137: { 0, "No host name found", "internal" }, \
138: { 0, "No file name found or file not accessible", "internal" }, \
139: { 0, "FTP server replies", "internal" }, \
140: { 0, "FTP server doesn't reply", "internal" }, \
141: { 0, "FTP login failure", "internal" }, \
142: { 0, "Server timed out", "internal" }, \
143: { 0, "Gopher-server replies", "internal" }, \
144: { 0, "Data transfer interrupted", "internal" }, \
145: { 0, "Connection establishment interrupted", "internal" }, \
146: { 0, "CSO-server replies", "internal" }, \
147: { 0, "This is probably a HTTP server 0.9 or less","internal" }, \
148: { 0, "Bad, Incomplete, or Unknown Response", "internal" }, \
149: { 0, "Unknown access authentication scheme", "internal" }, \
150: { 0, "News-server replies", "internal" }, \
151: { 0, "Trying `ftp://' instead of `file://'", "internal" }, \
152: { 0, "Too many redirections", "internal" }, \
153: { 0, "Method not suited for automatic redirection","internal" }, \
154: { 0, "Premature End Of File", "internal" }, \
155: { 0, "Response from WAIS Server too Large - Extra lines \
156: ignored","internal"}, \
157: { 0, "WAIS-server doesn't return any data", "internal" }, \
158: { 0, "Can't connect to WAIS-server", "internal" }, \
159: { 0, "operation failed", "internal" }, \
160: { 0, "Wrong or unknown access scheme", "internal" }, \
161: { 0, "Access scheme not allowed in this context", "internal" }, \
162: { 0, "When you are connected, you can log in", "internal" }, \
163: { 0, "This version has expired and will be automatically reloaded", "internal" }, \
164: { 0, "Loading new rules must be explicitly acknowledged", "internal" }, \
165: { 0, "Automatic proxy redirection must be explicitly acknowledged", "internal" }
166: </PRE>
167: <H3>
168: Generate a Default Error Message
169: </H3>
170: <P>
2.8 frystyk 171: This function provides an unformatted English string containing the possibly
172: nested status message that explains the result of a request. This is essentially
173: "flattening out" the information provided in the <A HREF="HTReq.html">request
174: error strack</A>. The string must be freed by the caller.
175: <PRE>
176: extern char * HTDialog_errorMessage (HTRequest * request, HTAlertOpcode op,
177: int msgnum, const char * dfault,
178: void * input);
179: </PRE>
2.9 frystyk 180: <H3>
181: Generate a Default Progress Notification Message
182: </H3>
2.8 frystyk 183: <P>
184: This function provides a string containin an English progress message that
185: the application can present to the user if desired. The string must be freed
186: by the caller.
187: <PRE>
188: extern char * HTDialog_progressMessage (HTRequest * request, HTAlertOpcode op,
189: int msgnum, const char * dfault,
190: void * input);
191: </PRE>
192: <H2>
193: Default User Interaction Handlers
194: </H2>
195: <P>
196: You can register a set of callback functions to handle user prompting, error
197: messages, confimations etc. Here we give a set of functions that can be used
198: on almost anu thinkable platform. If you want to provide your own platform
199: dependent implementation then fine :-)
200: <H3>
201: Display a message, then wait for 'YES' or 'NO'
202: </H3>
203: <P>
204: This function prompts the user for a confirmation on the message passed as
205: a parameter. If the user reacts in the affirmative, returns <EM>TRUE</EM>,
206: returns <EM>FALSE</EM> otherwise.
2.1 frystyk 207: <PRE>
208: extern HTAlertCallback HTConfirm;
209: </PRE>
2.8 frystyk 210: <H3>
211: Prompt the User a Question
212: </H3>
213: <P>
214: Prompt for answer and get text back. Reply text is either NULL on error or
215: a dynamic string which the caller must free.
2.1 frystyk 216: <PRE>
217: extern HTAlertCallback HTPrompt;
218: </PRE>
2.8 frystyk 219: <H3>
220: Prompt for a Password
221: </H3>
222: <P>
223: Prompt for password without echoing the reply. Reply text is weither NULL
224: on error or a dynamic string which the caller must free.
225: <P>
226: <B>NOTE:</B> The current version uses <EM>getpass</EM> which on many systems
227: returns a string of 8 or 16 bytes.
2.1 frystyk 228: <PRE>
229: extern HTAlertCallback HTPromptPassword;
230: </PRE>
2.8 frystyk 231: <H3>
232: Prompt for a UserID and a Password
233: </H3>
234: <P>
2.1 frystyk 235: This is just a composite function using <EM>HTPrompt</EM> and
2.8 frystyk 236: <EM>HTPromptPassword</EM>. The strings returned must be freed by caller.
2.1 frystyk 237: <PRE>
238: extern HTAlertCallback HTPromptUsernameAndPassword;
239: </PRE>
2.8 frystyk 240: <H3>
241: Display a Message
242: </H3>
243: <P>
2.1 frystyk 244: This function simply puts out the message passed.
245: <PRE>
246: extern HTAlertCallback HTAlert;
247: </PRE>
2.8 frystyk 248: <H3>
249: Progress Notification
250: </H3>
251: <P>
252: This function can be used to indicate the current status of a certain action.
253: In order to avoid having strings directly in the core parts of the Library,
254: this function is passed a "state" argument from which the message can be
255: generated in this module. The "param" argument is for additional information
256: to be passed.
2.1 frystyk 257: <PRE>
258: extern HTAlertCallback HTProgress;
259: </PRE>
2.8 frystyk 260: <H3>
261: Generating a User Error Message of a request
262: </H3>
263: <P>
264: This function outputs the content of the error list to standard output (used
265: in Line Mode Browser), but smart clients and servers might overwrite this
266: function so that the error messages can be handled to the user in a nice(r)
267: way. That is the reason for putting the actual implementation in
268: <A HREF="HTAlert.c">HTAlert.c</A>.
269: <P>
2.1 frystyk 270: <PRE>
271: extern HTAlertCallback HTError_print;
2.2 frystyk 272: </PRE>
2.8 frystyk 273: <H3>
274: Generating a Server Error Message of a request
275: </H3>
276: <P>
277: Default function that creates an error message using HTAlert() to put out
278: the contents of the error_stack messages. Furthermore, the error_info structure
279: contains a name of a help file that might be put up as a link. This file
280: can then be multi-linguistic.
2.2 frystyk 281: <PRE>
282: extern BOOL HTError_response (HTRequest * request, HTAlertOpcode op,
2.3 frystyk 283: int msgnum, const char * dfault, void * input,
2.2 frystyk 284: HTAlertPar * reply);
2.1 frystyk 285: </PRE>
286: <PRE>
2.10 ! vbancrof 287: #ifdef __cplusplus
! 288: }
! 289: #endif
! 290:
2.9 frystyk 291: #endif /* HTDIALOG_H */
2.1 frystyk 292: </PRE>
2.8 frystyk 293: <P>
294: <HR>
2.5 frystyk 295: <ADDRESS>
2.10 ! vbancrof 296: @(#) $Id: HTDialog.html,v 2.9 1999/04/01 19:35:39 frystyk Exp $
2.5 frystyk 297: </ADDRESS>
2.8 frystyk 298: </BODY></HTML>
Webmaster