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_index_to_key_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 | char* set_gsdlhome_cstr;
|
---|
68 | char* set_gsdlos_cstr;
|
---|
69 |
|
---|
70 | public:
|
---|
71 | gtiaction ();
|
---|
72 | virtual ~gtiaction ();
|
---|
73 |
|
---|
74 | void set_receptionist (receptionist *therecpt) {recpt=therecpt;}
|
---|
75 |
|
---|
76 | text_t get_action_name () {return "gti";}
|
---|
77 |
|
---|
78 | bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
|
---|
79 | recptprotolistclass *protos, ostream &logout);
|
---|
80 |
|
---|
81 | void define_internal_macros (displayclass &disp, cgiargsclass &args,
|
---|
82 | recptprotolistclass *protos, ostream &logout);
|
---|
83 |
|
---|
84 | void get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
|
---|
85 | response_t &response,text_t &response_data,
|
---|
86 | ostream &logout);
|
---|
87 |
|
---|
88 | bool do_action (cgiargsclass &args, recptprotolistclass *protos,
|
---|
89 | browsermapclass *browsers, displayclass &disp,
|
---|
90 | outconvertclass &outconvert, ostream &textout,
|
---|
91 | ostream &logout);
|
---|
92 |
|
---|
93 | bool init (ostream & /*logout*/);
|
---|
94 |
|
---|
95 |
|
---|
96 | // The interesting functions
|
---|
97 | void define_gti_home_page(displayclass& disp, cgiargsclass& args, ostream& logout);
|
---|
98 |
|
---|
99 | void define_gti_lang_page(displayclass& disp, cgiargsclass& args, ostream& logout);
|
---|
100 |
|
---|
101 | void define_gti_find_page(displayclass& disp, cgiargsclass& args, ostream& logout);
|
---|
102 |
|
---|
103 | void define_gti_offline_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 | text_t xml_safe(const text_t &text_string);
|
---|
110 |
|
---|
111 | void process_gti_submissions(displayclass& disp, cgiargsclass& args, ostream& logout, bool force_submission);
|
---|
112 |
|
---|
113 | text_t do_gti_request(text_t gti_arguments, ostream& logout);
|
---|
114 |
|
---|
115 | GTI_Response parse_gti_response(text_t gti_response_xml_text, ostream& logout);
|
---|
116 |
|
---|
117 | void do_gti_submission(text_t gti_arguments, text_t gti_submission, ostream& logout);
|
---|
118 |
|
---|
119 | void define_gti_status_page(displayclass& disp, cgiargsclass& args, ostream& logout);
|
---|
120 |
|
---|
121 | bool produce_excel_spreadsheet(cgiargsclass& args, ostream& logout);
|
---|
122 | };
|
---|
123 |
|
---|
124 |
|
---|
125 | #endif
|
---|