Webdar 1.0.0
Web user interface to libdar
html_options_isolate.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_ISOLATE_HPP
25#define HTML_OPTIONS_ISOLATE_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 "html_form.hpp"
40#include "html_form_fieldset.hpp"
41#include "html_form_input.hpp"
42#include "html_hash_algo.hpp"
43#include "html_crypto_algo.hpp"
44#include "html_derouleur.hpp"
45#include "html_entrepot_landing.hpp"
46#include "html_form_gnupg_list.hpp"
47#include "html_form_select.hpp"
48#include "html_mask_form_path.hpp"
49#include "html_form_sig_block_size.hpp"
50#include "html_compression_params.hpp"
51#include "html_slicing.hpp"
52#include "html_ciphering.hpp"
53#include "guichet.hpp"
54#include "jsoner.hpp"
55#include "bibliotheque_subconfig.hpp"
56
58
60 public actor,
61 public events,
62 public jsoner,
64{
65public:
66 static const std::string landing_path_changed;
67 static const std::string entrepot_changed;
68 static const std::string changed;
69
71 html_options_isolate(const html_options_isolate & ref) = delete;
72 html_options_isolate(html_options_isolate && ref) noexcept = delete;
73 html_options_isolate & operator = (const html_options_isolate & ref) = delete;
74 html_options_isolate & operator = (html_options_isolate && ref) noexcept = delete;
75 ~html_options_isolate() = default;
76
78 void set_biblio(const std::shared_ptr<bibliotheque> & ptr);
79
81 virtual void load_json(const json & source) override;
82
84 virtual json save_json() const override;
85
87 virtual void clear_json() override;
88
90 virtual bibliotheque::using_set get_using_set() const override;
91
92
94 virtual void on_event(const std::string & event_name) override;
95
96
98
99 libdar::archive_options_isolate get_options(std::shared_ptr<html_web_user_interaction> & webui) const;
100
102 std::shared_ptr<libdar::entrepot> get_entrepot(std::shared_ptr<html_web_user_interaction> webui) const { return entrep->get_entrepot(webui); };
103
105 const std::string & get_landing_path() const { return entrep->get_landing_path(); };
106
109
110protected:
111
113 virtual std::string inherited_get_body_part(const chemin & path,
114 const request & req) override;
115
116 virtual void new_css_library_available() override;
117
118private:
119
120 // specific events
121 static constexpr const char* kdf_algo_changed = "kdf_algo_changed";
122
123 bool ignore_events;
124
125 html_derouleur deroule;
126
127 html_form form_delta_sig;
128 html_form_fieldset delta_fs;
129 html_form_input delta_sig;
130 html_form_input delta_transfer_mode;
131
132 html_text delta_filter_params;
133
134 guichet guichet_sig_block_size;
135 std::shared_ptr<html_form_sig_block_size> sig_block_size;
136
137 html_text delta_filter_title;
138
139 guichet guichet_delta_mask;
140 std::shared_ptr<html_mask_form_path> delta_mask;
141
142 guichet guichet_entrep;
143 std::shared_ptr<html_entrepot_landing> entrep;
144
145 html_form form_archgen;
146 html_form_fieldset fs_archgen;
147 html_form_input allow_over;
148 html_form_input warn_over;
149 html_form_input pause;
150 html_form_input sequential_marks;
151 html_form_input user_comment;
152 html_hash_algo hash_algo;
153 html_form_input execute;
154 html_form_input empty;
155 html_form_input repair_mode;
156
157 html_form form_shown;
158 html_form_fieldset fs_shown;
159 html_form_input info_details;
160
161 guichet guichet_compr_params;
162 std::shared_ptr<html_compression_params> compr_params;
163
164 guichet guichet_slicing;
165 std::shared_ptr<html_slicing> slicing;
166
167 guichet guichet_ciphering;
168 std::shared_ptr<html_ciphering> ciphering;
169
170 void init();
171 void trigger_changed();
172
173 static constexpr const unsigned int format_version = 1;
174 static constexpr const char* myclass_id = "html_options_isolate";
175
176 static constexpr const char* jlabel_delta_sig = "delta-sig";
177 static constexpr const char* jlabel_delta_xfer = "delta-sig-xfer";
178 static constexpr const char* jlabel_sig_block_size = "sig-block-size";
179 static constexpr const char* jlabel_delta_mask = "delta-mask";
180 static constexpr const char* jlabel_entrep = "entrepot";
181 static constexpr const char* jlabel_allow_over = "allow-over";
182 static constexpr const char* jlabel_warn_over = "warn-over";
183 static constexpr const char* jlabel_seq_masks = "seq-masks";
184 static constexpr const char* jlabel_user_comment = "user-comment";
185 static constexpr const char* jlabel_hash_algo = "hash-algo";
186 static constexpr const char* jlabel_execute = "execute";
187 static constexpr const char* jlabel_empty = "dry-run";
188 static constexpr const char* jlabel_repair_mode = "repair-mode";
189 static constexpr const char* jlabel_info_details = "info-details";
190 static constexpr const char* jlabel_compr_params = "compr-params";
191 static constexpr const char* jlabel_slicing = "slicing";
192 static constexpr const char* jlabel_ciphering = "ciphering";
193
194};
195
196#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_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 implements HTML input feature
Definition: html_form_input.hpp:57
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_hash_algo.hpp:43
html components for the user to provide parameters of a isolation operation
Definition: html_options_isolate.hpp:64
static const std::string landing_path_changed
landing path has changed
Definition: html_options_isolate.hpp:66
void set_to_webdar_defaults()
set the object to webdar defaults
Definition: html_options_isolate.cpp:509
virtual bibliotheque::using_set get_using_set() const override
inherited from bibliotheque_subconfig
Definition: html_options_isolate.cpp:367
virtual void on_event(const std::string &event_name) override
inherited from actor
Definition: html_options_isolate.cpp:381
virtual void clear_json() override
inherited from jsoner
Definition: html_options_isolate.cpp:351
static const std::string entrepot_changed
event only triggered when entrepot related params changed (excluding landing_path)
Definition: html_options_isolate.hpp:67
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_isolate.hpp:102
html_options_isolate()
Definition: html_options_isolate.cpp:50
virtual void new_css_library_available() override
Definition: html_options_isolate.cpp:533
const std::string & get_landing_path() const
obtain the entrepot landing path
Definition: html_options_isolate.hpp:105
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from bdy_builder
Definition: html_options_isolate.cpp:527
libdar::archive_options_isolate get_options(std::shared_ptr< html_web_user_interaction > &webui) const
informations available for libdar
Definition: html_options_isolate.cpp:430
void set_biblio(const std::shared_ptr< bibliotheque > &ptr)
mandatory call to invoke ASAP after constructor
Definition: html_options_isolate.cpp:218
virtual void load_json(const json &source) override
inherited from jsoner
Definition: html_options_isolate.cpp:250
static const std::string changed
triggered when the component changed, including entrepot params changed (excluding landing_path)
Definition: html_options_isolate.hpp:68
virtual json save_json() const override
inherited from jsoner
Definition: html_options_isolate.cpp:312
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 jsoner class and class exception_json