Webdar 1.0.0
Web user interface to libdar
html_options_merge.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_MERGE_HPP
25#define HTML_OPTIONS_MERGE_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
37 // webdar headers
38#include "body_builder.hpp"
39#include "actor.hpp"
40#include "events.hpp"
41#include "html_form.hpp"
42#include "html_form_fieldset.hpp"
43#include "html_form_input.hpp"
44#include "html_compression.hpp"
45#include "html_hash_algo.hpp"
46#include "html_crypto_algo.hpp"
47#include "html_archive_read.hpp"
48#include "html_derouleur.hpp"
49#include "html_entrepot_landing.hpp"
50#include "html_mask_form_filename.hpp"
51#include "html_mask_form_path.hpp"
52#include "html_form_overwrite_action.hpp"
53#include "html_form_input_unit.hpp"
54#include "html_compression_params.hpp"
55#include "html_slicing.hpp"
56#include "html_ciphering.hpp"
57#include "html_form_sig_block_size.hpp"
58#include "html_form_select.hpp"
59#include "html_fsa_scope.hpp"
60#include "guichet.hpp"
61#include "jsoner.hpp"
62#include "bibliotheque_subconfig.hpp"
63
65
67 public actor,
68 public events,
69 public jsoner,
71{
72public:
73 static const std::string landing_path_changed;
74 static const std::string entrepot_changed;
75 static const std::string changed;
76
78 html_options_merge(const html_options_merge & ref) = delete;
79 html_options_merge(html_options_merge && ref) noexcept = delete;
80 html_options_merge & operator = (const html_options_merge & ref) = delete;
81 html_options_merge & operator = (html_options_merge && ref) noexcept = delete;
82 ~html_options_merge() = default;
83
85 void set_biblio(const std::shared_ptr<bibliotheque> & ptr);
86
88 virtual void load_json(const json & source) override;
89
91 virtual json save_json() const override;
92
94 virtual void clear_json() override;
95
97 virtual bibliotheque::using_set get_using_set() const override;
98
100 virtual void on_event(const std::string & event_name) override;
101
107 libdar::archive_options_merge get_options(std::shared_ptr<html_web_user_interaction> & webui) const;
108
110 std::shared_ptr<libdar::entrepot> get_entrepot(std::shared_ptr<html_web_user_interaction> webui) const { return entrep->get_entrepot(webui); };
111
113 const std::string & get_landing_path() const { return entrep->get_landing_path(); };
114
117
118protected:
119
121 virtual std::string inherited_get_body_part(const chemin & path,
122 const request & req) override;
123
124 virtual void new_css_library_available() override;
125
126
127private:
128 bool ignore_events;
129
130 html_derouleur deroule;
131
132 html_form form_archgen;
133
134 guichet guichet_entrep;
135 std::shared_ptr<html_entrepot_landing> entrep;
136
137 html_form_fieldset fs_archgen;
138 html_form_input allow_over;
139 html_form_input warn_over;
140 html_form_input pause;
141 html_form_input sequential_marks;
142 html_form_input_unit sparse_file_min_size;
143 html_form_input user_comment;
144 html_hash_algo hash_algo;
145 html_form_input execute;
146 html_form_input empty;
147
148 html_form_fieldset has_aux_fs;
149 html_form_input has_aux;
150 html_form_input decremental;
151 html_form aux_form;
152
153 html_form_fieldset aux_block;
154 html_archive_read auxiliary;
155
156 html_form form_delta_sig;
157 html_form_fieldset delta_fs;
158 html_form_select delta_sig;
159
160 html_text delta_filter_params;
161
162 guichet guichet_sig_block_size;
163 std::shared_ptr<html_form_sig_block_size> sig_block_size;
164
165 html_text delta_filter_title;
166
167 guichet guichet_delta_mask;
168 std::shared_ptr<html_mask_form_path> delta_mask;
169
170 html_form form_shown;
171 html_form_fieldset fs_shown;
172 html_form_input info_details;
173 html_form_input display_treated;
174 html_form_input display_treated_only_dir;
175 html_form_input display_skipped;
176
177 html_form form_perimeter;
178 html_form_fieldset fs_perimeter;
179 html_form_input empty_dir;
180
181 guichet guichet_filename_mask;
182 std::shared_ptr<html_mask_form_filename> filename_mask;
183
184 guichet guichet_path_mask;
185 std::shared_ptr<html_mask_form_path> path_mask;
186
187 guichet guichet_ea_mask;
188 std::shared_ptr<html_mask_form_filename> ea_mask;
189
190 html_fsa_scope fsa_scope;
191
192 guichet guichet_overwriting_policy;
193 std::shared_ptr<html_form_overwrite_action> overwriting_policy;
194
195 guichet guichet_compr_params;
196 std::shared_ptr<html_compression_params> compr_params;
197 html_text compr_filter_title;
198
199 guichet guichet_compr_mask;
200 std::shared_ptr<html_mask_form_filename> compr_mask;
201
202 guichet guichet_slicing;
203 std::shared_ptr<html_slicing> slicing;
204
205 guichet guichet_ciphering;
206 std::shared_ptr<html_ciphering> ciphering;
207
208 void init();
209 void trigger_changed();
210
211 static constexpr const unsigned int format_version = 1;
212 static constexpr const char* myclass_id = "html_options_merge";
213
214 static constexpr const char* jlabel_entrep = "entrepot";
215 static constexpr const char* jlabel_allow_over = "allow-over";
216 static constexpr const char* jlabel_warn_over = "warn-over";
217 static constexpr const char* jlabel_pause = "pause";
218 static constexpr const char* jlabel_seq_marks = "sequential-marks";
219 static constexpr const char* jlabel_sparse_min_size = "sparse-file-min-size";
220 static constexpr const char* jlabel_user_comment = "user-comments";
221 static constexpr const char* jlabel_hash_algo = "hash-algo";
222 static constexpr const char* jlabel_execute = "execute";
223 static constexpr const char* jlabel_empty = "dry-run";
224 static constexpr const char* jlabel_has_aux = "has-auxiliary";
225 static constexpr const char* jlabel_decremental = "decremental";
226 static constexpr const char* jlabel_auxiliary = "auxiliary";
227 static constexpr const char* jlabel_delta_sig = "delta-sig";
228 static constexpr const char* jlabel_sig_block_size = "delta-sig-block-size";
229 static constexpr const char* jlabel_delta_mask = "delta-mask";
230 static constexpr const char* jlabel_info_details = "info-details";
231 static constexpr const char* jlabel_display_treated = "disp-treated";
232 static constexpr const char* jlabel_display_only_dir = "disp-only-dirs";
233 static constexpr const char* jlabel_display_skipped = "disp-skipped";
234 static constexpr const char* jlabel_empty_dir = "empty-dirs";
235 static constexpr const char* jlabel_filename_mask = "filename-mask";
236 static constexpr const char* jlabel_path_mask = "path-mask";
237 static constexpr const char* jlabel_ea_mask = "ea-mask";
238 static constexpr const char* jlabel_fsa_scope = "fsa-scope";
239 static constexpr const char* jlabel_overwrite_policy = "overwriting-policy";
240 static constexpr const char* jlabel_compr_params = "compression-params";
241 static constexpr const char* jlabel_compr_mask = "compression-mask";
242 static constexpr const char* jlabel_slicing = "slicing";
243 static constexpr const char* jlabel_ciphering = "ciphering";
244
245
246};
247
248#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
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_select implements HTML input of type "select"
Definition: html_form_select.hpp:53
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 for the user to provided parameters of a libdar merging operation
Definition: html_options_merge.hpp:71
static const std::string changed
event for any change in this component, including entrpot changes except landing_path
Definition: html_options_merge.hpp:75
void set_to_webdar_defaults()
set the object to webdar defaults
Definition: html_options_merge.cpp:728
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from bdy_builder
Definition: html_options_merge.cpp:750
virtual void clear_json() override
inherited from jsoner
Definition: html_options_merge.cpp:512
std::shared_ptr< libdar::entrepot > get_entrepot(std::shared_ptr< html_web_user_interaction > webui) const
optain the current entrepot object where is expected to be create the archive
Definition: html_options_merge.hpp:110
virtual void new_css_library_available() override
Definition: html_options_merge.cpp:757
virtual bibliotheque::using_set get_using_set() const override
inherited from bibliotheque_subconfig
Definition: html_options_merge.cpp:528
const std::string & get_landing_path() const
obtain the entrepot landing path
Definition: html_options_merge.hpp:113
virtual void load_json(const json &source) override
inherited from jsoner
Definition: html_options_merge.cpp:379
virtual void on_event(const std::string &event_name) override
inherited from actor
Definition: html_options_merge.cpp:547
virtual json save_json() const override
inherited from jsoner
Definition: html_options_merge.cpp:457
void set_biblio(const std::shared_ptr< bibliotheque > &ptr)
mandatory call to invoke ASAP after constructor
Definition: html_options_merge.cpp:318
static const std::string entrepot_changed
event triggered only for entrepot related changes except landing_path
Definition: html_options_merge.hpp:74
static const std::string landing_path_changed
landing path has changed
Definition: html_options_merge.hpp:73
libdar::archive_options_merge get_options(std::shared_ptr< html_web_user_interaction > &webui) const
Definition: html_options_merge.cpp:604
class html_text manage text and header in html document
Definition: html_text.hpp:52
class jsoner
Definition: jsoner.hpp:73
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