Webdar 1.0.0
Web user interface to libdar
html_options_create.hpp
1/*********************************************************************/
2// webdar - a web server and interface program to libdar
3// Copyright (C) 2013-2025 Denis Corbin
4//
5// This file is part of Webdar
6//
7// Webdar is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// Webdar is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Webdar. If not, see <http://www.gnu.org/licenses/>
19//
20//----
21// to contact the author: dar.linux@free.fr
22/*********************************************************************/
23
24#ifndef HTML_OPTIONS_CREATE_HPP
25#define HTML_OPTIONS_CREATE_HPP
26
27 // C system header files
28#include "my_config.h"
29extern "C"
30{
31
32}
33
34 // C++ system header files
35#include <dar/libdar.hpp>
36#include <memory>
37
38 // webdar headers
39#include "body_builder.hpp"
40#include "actor.hpp"
41#include "events.hpp"
42#include "html_form_input.hpp"
43#include "html_comparison_fields.hpp"
44#include "html_form_fieldset.hpp"
45#include "html_datetime.hpp"
46#include "html_form.hpp"
47#include "html_archive_read.hpp"
48#include "html_hash_algo.hpp"
49#include "html_derouleur.hpp"
50#include "html_text.hpp"
51#include "html_entrepot_landing.hpp"
52#include "html_web_user_interaction.hpp"
53#include "html_mask_form_filename.hpp"
54#include "html_mask_form_path.hpp"
55#include "html_form_select.hpp"
56#include "html_form_same_fs.hpp"
57#include "html_form_ignore_as_symlink.hpp"
58#include "html_form_sig_block_size.hpp"
59#include "html_form_input_unit.hpp"
60#include "html_compression_params.hpp"
61#include "html_slicing.hpp"
62#include "html_ciphering.hpp"
63#include "html_fsa_scope.hpp"
64#include "guichet.hpp"
65#include "jsoner.hpp"
66#include "bibliotheque_subconfig.hpp"
67
69
71 public actor,
72 public events,
73 public jsoner,
75{
76public:
77 static const std::string landing_path_changed;
78 static const std::string entrepot_changed;
79 static const std::string changed;
80
82 html_options_create(const html_options_create & ref) = delete;
83 html_options_create(html_options_create && ref) noexcept = delete;
84 html_options_create & operator = (const html_options_create & ref) = delete;
85 html_options_create & operator = (html_options_create && ref) noexcept = delete;
86 ~html_options_create() = default;
87
89 void set_biblio(const std::shared_ptr<bibliotheque> & ptr);
90
92 virtual void load_json(const json & source) override;
93
95 virtual json save_json() const override;
96
98 virtual void clear_json() override;
99
101 virtual bibliotheque::using_set get_using_set() const override;
102
104 virtual void on_event(const std::string & event_name) override;
105
111 libdar::archive_options_create get_options(std::shared_ptr<html_web_user_interaction> & webui) const;
112
114 std::shared_ptr<libdar::entrepot> get_entrepot(std::shared_ptr<html_web_user_interaction> webui) const { return entrep->get_entrepot(webui); };
115
117 const std::string & get_landing_path() const { return entrep->get_landing_path(); };
118
120 void set_fs_root(const std::string & prefix) { path_mask->set_fs_root(prefix); };
121
124
125protected:
126
128 virtual std::string inherited_get_body_part(const chemin & path,
129 const request & req) override;
130
132 virtual void new_css_library_available() override;
133
134private:
135 bool ignore_events;
136
137 html_derouleur deroule;
138
139 guichet guichet_entrep;
140 std::shared_ptr<html_entrepot_landing> entrep;
141
142 html_form form_archtype;
143
144 html_form form_delta_sig;
145
146 html_form form_reading;
147
148 html_form form_archgen;
149
150 html_form form_shown;
151
152 html_form form_perimeter;
153
154 guichet guichet_filename_mask;
155 std::shared_ptr<html_mask_form_filename> filename_mask;
156
157 guichet guichet_path_mask;
158 std::shared_ptr<html_mask_form_path> path_mask;
159
160 guichet guichet_ea_mask;
161 std::shared_ptr<html_mask_form_filename> ea_mask;
162
163 html_form form_same_fs;
164
165 html_form_fieldset archtype_fs;
166 html_form_radio archtype; // fs_archtype member
167 html_datetime fixed_date; // fs_archtype member
168 html_archive_read reference; // fs_archtype member
169 html_form_fieldset wrap_ref; // help make distinction at display between archive or ref options and archive options
170 html_text binary_delta_note; // note about binary delta requirement
171 html_text ref_placeholder; // shows when archtype is not differential/incremental
172
173 html_form_fieldset delta_fs;
174 html_form_input delta_sig;
175
176 html_text delta_filter_params;
177
178 guichet guichet_sig_block_size;
179 std::shared_ptr<html_form_sig_block_size> sig_block_size;
180
181 html_text delta_filter_title;
182
183 guichet guichet_delta_mask;
184 std::shared_ptr<html_mask_form_path> delta_mask;
185
186 html_form_fieldset fs_alter_atime;
187 html_form_radio alter_atime;
188 html_form_input furtive_read_mode;
189 html_form_input zeroing_neg_date;
190 html_form_fieldset fs_mod_data_detect;
191 html_form_radio mod_data_detect;
192 html_form_ignore_as_symlink follow_symlinks;
193
194 html_form_fieldset archgen_fs;
195 html_form_input allow_over;
196 html_form_input warn_over;
197 html_form_input pause;
198 html_form_input retry_on_change_times;
199 html_form_input_unit retry_on_change_overhead;
200 html_form_input sequential_marks;
201 html_form_input_unit sparse_file_min_size;
202 html_form_input user_comment;
203 html_hash_algo hash_algo;
204 html_form_input execute;
205 html_comparison_fields what_to_check;
206 html_form_input hourshift; // fs_archtype member
207 html_form_input empty;
208
209 html_form_fieldset shown_fs;
210 html_form_input info_details;
211 html_form_input display_treated;
212 html_form_input display_treated_only_dir;
213 html_form_input display_skipped;
214 html_form_input display_dir_summary;
215 html_form_input security_check;
216 html_form_input dont_ignore_unknown_inode_type;
217
218 html_form_fieldset perimeter_fs;
219 html_form_input empty_dir;
220 html_form_input cache_directory_tagging;
221 html_form_input nodump;
222 html_form_fieldset exclu_by_ea_fs;
223 html_form_input exclude_by_ea;
224 html_form_input default_ea;
225 html_form_input exclude_by_ea_name;
226
227 html_form_same_fs same_fs;
228 html_form_fieldset same_fs_fs;
229
230 guichet guichet_compr_params;
231 std::shared_ptr<html_compression_params> compr_params;
232
233 html_text compr_filter_title;
234 guichet guichet_compr_mask;
235 std::shared_ptr<html_mask_form_filename> compr_mask;
236
237 html_fsa_scope fsa_scope;
238
239 guichet guichet_slicing;
240 std::shared_ptr<html_slicing> slicing;
241
242 guichet guichet_ciphering;
243 std::shared_ptr<html_ciphering> ciphering;
244
245 void init();
246 void trigger_changed();
247
248 static constexpr const unsigned int format_version = 1;
249 static constexpr const char* myclass_id = "html_form_options_create";
250
251 static constexpr const char* jlabel_entrep = "entrepot";
252 static constexpr const char* jlabel_file_mask = "file-mask";
253 static constexpr const char* jlabel_path_mask = "path-mask";
254 static constexpr const char* jlabel_ea_mask = "ea-mask";
255 static constexpr const char* jlabel_archtype = "archive-type";
256 static constexpr const char* jlabel_fixed_date = "fixed-date";
257 static constexpr const char* jlabel_reference = "reference";
258 static constexpr const char* jlabel_delta_sig = "delta-sig";
259 static constexpr const char* jlabel_sig_block_size = "delta-sig-block-size";
260 static constexpr const char* jlabel_delta_mask = "delta-mask";
261 static constexpr const char* jlabel_alter_atime = "alter-atime";
262 static constexpr const char* jlabel_furtive_read = "furtive-read";
263 static constexpr const char* jlabel_zeroing = "zeroing-neg-dates";
264 static constexpr const char* jlabel_mod_data = "modified-data-detection";
265 static constexpr const char* jlabel_follow_sym = "follow-symlinks";
266 static constexpr const char* jlabel_allow_over = "allow-overwrite";
267 static constexpr const char* jlabel_warn_over = "warn-overwrite";
268 static constexpr const char* jlabel_pause = "pause";
269 static constexpr const char* jlabel_retry_times = "retry-times";
270 static constexpr const char* jlabel_retry_overhead = "retry-overhead";
271 static constexpr const char* jlabel_sequential_marks = "tape-marks";
272 static constexpr const char* jlabel_sparse_min_size = "sparse-file-min-size";
273 static constexpr const char* jlabel_user_comment = "user-comment";
274 static constexpr const char* jlabel_hash_algo = "hash-algo";
275 static constexpr const char* jlabel_execute = "execute";
276 static constexpr const char* jlabel_what_to_check = "what-to-check";
277 static constexpr const char* jlabel_hourshift = "hourshift";
278 static constexpr const char* jlabel_empty = "dry-run";
279 static constexpr const char* jlabel_info_details = "info-details";
280 static constexpr const char* jlabel_display_treated = "display-treated";
281 static constexpr const char* jlabel_display_only_dir = "display-on-dirs";
282 static constexpr const char* jlabel_display_skipped = "display-skipped";
283 static constexpr const char* jlabel_display_dir_summ = "display-dir-summary";
284 static constexpr const char* jlabel_secu_check = "security-check";
285 static constexpr const char* jlabel_dont_ignore_unknown = "dont-ignore-unknown-inode-types";
286 static constexpr const char* jlabel_empty_dir = "empty-dirs";
287 static constexpr const char* jlabel_cache_dir_tag = "cache-dir-tagging";
288 static constexpr const char* jlabel_nodump = "nodump";
289 static constexpr const char* jlabel_exclude_by_ea = "exclude-by-ea";
290 static constexpr const char* jlabel_default_ea = "exclude-by-ea-default-name";
291 static constexpr const char* jlabel_exclude_by_ea_name = "exclude-by-ea-named";
292 static constexpr const char* jlabel_same_fs = "same-fs";
293 static constexpr const char* jlabel_compr_params = "compress-params";
294 static constexpr const char* jlabel_compr_mask = "compress-mask";
295 static constexpr const char* jlabel_fsa_scope = "fsa-scope";
296 static constexpr const char* jlabel_slicing = "slicing";
297 static constexpr const char* jlabel_ciphering = "ciphering";
298
299
300};
301
302#endif
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
class bibliotheque_subconfig is an interface (pure virtual class)
Definition: bibliotheque_subconfig.hpp:50
std::set< coordinates > using_set
list of configs a given config depends on
Definition: bibliotheque.hpp:117
class body_builder is the root class of object generating HTML body
Definition: body_builder.hpp:99
class chemin definition
Definition: chemin.hpp:51
class events
Definition: events.hpp:52
class guichet let one fetch config from a bibliotheque, save as or setup manually for a given compone...
Definition: guichet.hpp:92
class html_archive_read let user define the archive path, basename and option to read
Definition: html_archive_read.hpp:63
html component in the form of a drop-down list to let the user define a libdar comparison field value
Definition: html_comparison_fields.hpp:45
class html_datetime is a html_form_field object
Definition: html_datetime.hpp:55
class html_derouleur is a pure virtual class
Definition: html_derouleur.hpp:55
class html_form_fieldset implements HTML fieldset feature
Definition: html_form_fieldset.hpp:51
class html_form_input_unit implements HTML input::number feature with added unit box
Definition: html_form_input_unit.hpp:51
class html_form_input implements HTML input feature
Definition: html_form_input.hpp:57
class html_form_radio implements HTML "input" of type "radio"
Definition: html_form_radio.hpp:53
class html_form_same_fs provide interface for the user to filter base on mounted file system
Definition: html_form_same_fs.hpp:80
class html_form implements HTML form feature
Definition: html_form.hpp:51
html component used for the user to define a has algorithm
Definition: html_fsa_scope.hpp:52
html component used for the user to define a has algorithm
Definition: html_hash_algo.hpp:43
html component used for the user to provide the parameters to create a new archive
Definition: html_options_create.hpp:75
virtual void new_css_library_available() override
inherited from body_builder
Definition: html_options_create.cpp:1012
virtual json save_json() const override
inherited from jsoner
Definition: html_options_create.cpp:596
void set_fs_root(const std::string &prefix)
needed for path based filtering to filter accordingly to the current root_fs
Definition: html_options_create.hpp:120
virtual void load_json(const json &source) override
inherited from jsoner
Definition: html_options_create.cpp:490
virtual void clear_json() override
inherited from jsoner
Definition: html_options_create.cpp:680
void set_biblio(const std::shared_ptr< bibliotheque > &ptr)
mandatory call to invoke ASAP after constructor
Definition: html_options_create.cpp:435
static const std::string entrepot_changed
only changes are related to entrepot (excluding landing_path)
Definition: html_options_create.hpp:78
void set_to_webdar_defaults()
set the object to webdar defaults
Definition: html_options_create.cpp:870
const std::string & get_landing_path() const
obtain the current landing path
Definition: html_options_create.hpp:117
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_options_create.cpp:902
static const std::string changed
any parameter change (including entrepot_changed, but excluding landing_path)
Definition: html_options_create.hpp:79
virtual void on_event(const std::string &event_name) override
inherited from actor
Definition: html_options_create.cpp:908
static const std::string landing_path_changed
only change is related to entrepot's landing_path
Definition: html_options_create.hpp:77
virtual bibliotheque::using_set get_using_set() const override
inherited from bibliotheque_subconfig
Definition: html_options_create.cpp:696
std::shared_ptr< libdar::entrepot > get_entrepot(std::shared_ptr< html_web_user_interaction > webui) const
obtain the current entrepot object where is expected to be create the archive
Definition: html_options_create.hpp:114
libdar::archive_options_create get_options(std::shared_ptr< html_web_user_interaction > &webui) const
Definition: html_options_create.cpp:715
class html_text manage text and header in html document
Definition: html_text.hpp:52
class jsoner
Definition: jsoner.hpp:73
class reference gives a mean to link objects by a peering method
Definition: reference.hpp:47
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45
defines the event class
defines jsoner class and class exception_json