1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * gtiaction.h --
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * A component of the Greenstone digital library software
|
---|
7 | * from the New Zealand Digital Library Project at the
|
---|
8 | * University of Waikato, New Zealand.
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | *********************************************************************/
|
---|
25 |
|
---|
26 |
|
---|
27 | #ifndef GTIACTION_H
|
---|
28 | #define GTIACTION_H
|
---|
29 |
|
---|
30 |
|
---|
31 | #include "action.h"
|
---|
32 | #include "receptionist.h"
|
---|
33 |
|
---|
34 |
|
---|
35 |
|
---|
36 | struct GTI_Response
|
---|
37 | {
|
---|
38 | text_t translation_file_key;
|
---|
39 | text_tmap translation_files_key_to_null_mapping;
|
---|
40 | text_tmap translation_files_key_to_num_chunks_translated_mapping;
|
---|
41 | text_tmap translation_files_key_to_num_chunks_requiring_translation_mapping;
|
---|
42 | text_tmap translation_files_key_to_num_chunks_requiring_updating_mapping;
|
---|
43 | text_tmap translation_files_key_to_target_file_path_mapping;
|
---|
44 |
|
---|
45 | text_t chunk_key;
|
---|
46 | text_tmap source_file_chunks_key_to_text_mapping;
|
---|
47 | text_tmap source_file_chunks_key_to_date_mapping;
|
---|
48 |
|
---|
49 | // For chunks requiring updating
|
---|
50 | text_tmap target_file_chunks_key_to_text_mapping;
|
---|
51 | text_tmap target_file_chunks_key_to_date_mapping;
|
---|
52 |
|
---|
53 | text_t num_chunks_matching_query;
|
---|
54 |
|
---|
55 | bool is_recording_text;
|
---|
56 | text_t recorded_text;
|
---|
57 |
|
---|
58 | text_t error_message;
|
---|
59 | };
|
---|
60 |
|
---|
61 |
|
---|
62 | class gtiaction : public action {
|
---|
63 |
|
---|
64 | protected:
|
---|
65 | receptionist *recpt;
|
---|
66 |
|
---|
67 | // package whose contents will be displayed in the form space
|
---|
68 | char *gsdlosc;
|
---|
69 | char *gsdlhomec;
|
---|
70 | char *pathc;
|
---|
71 |
|
---|
72 | public:
|
---|
73 | gtiaction ();
|
---|
74 | virtual ~gtiaction ();
|
---|
75 |
|
---|
76 | void set_receptionist (receptionist *therecpt) {recpt=therecpt;}
|
---|
77 |
|
---|
78 | text_t get_action_name () {return "gti";}
|
---|
79 |
|
---|
80 | bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
|
---|
81 | recptprotolistclass *protos, ostream &logout);
|
---|
82 |
|
---|
83 | void define_internal_macros (displayclass &disp, cgiargsclass &args,
|
---|
84 | recptprotolistclass *protos, ostream &logout);
|
---|
85 |
|
---|
86 | void get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
|
---|
87 | response_t &response,text_t &response_data,
|
---|
88 | ostream &logout);
|
---|
89 |
|
---|
90 | bool do_action (cgiargsclass &args, recptprotolistclass *protos,
|
---|
91 | browsermapclass *browsers, displayclass &disp,
|
---|
92 | outconvertclass &outconvert, ostream &textout,
|
---|
93 | ostream &logout);
|
---|
94 |
|
---|
95 | bool init (ostream & /*logout*/);
|
---|
96 |
|
---|
97 |
|
---|
98 | // The interesting functions
|
---|
99 | void define_gti_home_page(displayclass& disp, cgiargsclass& args, ostream& logout);
|
---|
100 |
|
---|
101 | void define_gti_lang_page(displayclass& disp, cgiargsclass& args, ostream& logout);
|
---|
102 |
|
---|
103 | void define_gti_find_page(displayclass& disp, cgiargsclass& args, ostream& logout);
|
---|
104 |
|
---|
105 | void define_gti_core_page(displayclass& disp, cgiargsclass& args, ostream& logout);
|
---|
106 |
|
---|
107 | text_t escape_all(text_t source_string, char character_to_escape);
|
---|
108 |
|
---|
109 | void process_gti_submissions(displayclass& disp, cgiargsclass& args, ostream& logout, bool force_submission);
|
---|
110 |
|
---|
111 | GTI_Response do_gti_request(text_t, ostream&);
|
---|
112 |
|
---|
113 | void do_gti_submission(text_t, text_t, ostream&);
|
---|
114 | };
|
---|
115 |
|
---|
116 |
|
---|
117 | #endif
|
---|