Webdar 1.0.0
Web user interface to libdar
html_options_extract.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_EXTRACT_HPP
25#define HTML_OPTIONS_EXTRACT_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 "html_form_select.hpp"
41#include "html_form_input.hpp"
42#include "html_form.hpp"
43#include "html_form_fieldset.hpp"
44#include "html_derouleur.hpp"
45#include "html_mask_form_filename.hpp"
46#include "html_mask_form_path.hpp"
47#include "html_form_overwrite_action.hpp"
48#include "html_fsa_scope.hpp"
49#include "guichet.hpp"
50#include "jsoner.hpp"
51#include "bibliotheque_subconfig.hpp"
52#include "events.hpp"
53
55
57 public actor,
58 public jsoner,
60 public events
61{
62public:
63 static const std::string changed;
64
66 html_options_extract(const html_options_extract & ref) = delete;
67 html_options_extract(html_options_extract && ref) noexcept = delete;
68 html_options_extract & operator = (const html_options_extract & ref) = delete;
69 html_options_extract & operator = (html_options_extract && ref) noexcept = delete;
70 ~html_options_extract() = default;
71
73 void set_biblio(const std::shared_ptr<bibliotheque> & ptr);
74
76 void set_fs_root(const std::string & prefix) { path_mask->set_fs_root(prefix); };
77
79 libdar::archive_options_extract get_options() const;
80
82 bool get_in_place_mode() const { return in_place.get_value_as_bool(); };
83
85 virtual void load_json(const json & source) override;
86
88 virtual json save_json() const override;
89
91 virtual void clear_json() override;
92
94 virtual bibliotheque::using_set get_using_set() const override;
95
97 virtual void on_event(const std::string & event_name) override;
98
101
102protected:
103
104 // inherited from body_builder
105 virtual std::string inherited_get_body_part(const chemin & path,
106 const request & req) override;
107
108 // inherited from body_builder
109 virtual void new_css_library_available() override;
110
111private:
112 bool ignore_events;
113
114 html_derouleur deroule;
115 html_form form_archgen;
117 html_form_input in_place;
118 html_form_input warn_over;
119 html_form_input flat;
120 html_form_select what_to_check;
121 html_form_input warn_remove_no_match;
122 html_form_input empty;
123 html_form_input empty_dir;
124 html_form_select dirty_behavior;
125 html_form_input ignore_sockets;
126
127 html_form form_show;
128 html_form_fieldset fs_show;
129 html_form_input info_details;
130 html_form_input display_treated;
131 html_form_input display_treated_only_dir;
132 html_form_input display_skipped;
133
134 guichet guichet_overwriting_policy;
135 std::shared_ptr<html_form_overwrite_action> overwriting_policy;
136 html_form_input only_deleted;
137 html_form_input ignore_deleted;
138
139 guichet guichet_filename_mask;
140 std::shared_ptr<html_mask_form_filename> filename_mask;
141
142 guichet guichet_path_mask;
143 std::shared_ptr<html_mask_form_path> path_mask;
144
145 guichet guichet_ea_mask;
146 std::shared_ptr<html_mask_form_filename> ea_mask;
147
148 html_fsa_scope fsa_scope;
149
150 void init();
151 void trigger_changed();
152
153 static constexpr const unsigned int format_version = 1;
154 static constexpr const char* myclass_id = "html_options_extract";
155
156 static constexpr const char* jlabel_in_place = "in-place";
157 static constexpr const char* jlabel_warn_over = "warn-over";
158 static constexpr const char* jlabel_flat = "flat";
159 static constexpr const char* jlabel_what_to_check = "what-to-check";
160 static constexpr const char* jlabel_warn_remove_no_match = "warn-remove-no-match";
161 static constexpr const char* jlabel_empty = "dry-run";
162 static constexpr const char* jlabel_empty_dir = "empty-dir";
163 static constexpr const char* jlabel_dirty_behavior = "dirty-behavior";
164 static constexpr const char* jlabel_ignore_sockets = "ignore-sockets";
165 static constexpr const char* jlabel_info_details = "info-details";
166 static constexpr const char* jlabel_display_treated = "display-treated";
167 static constexpr const char* jlabel_display_only_dir = "display-only-dir";
168 static constexpr const char* jlabel_display_skipped = "display-skipped";
169 static constexpr const char* jlabel_overwriting_policy = "overwriting-policy";
170 static constexpr const char* jlabel_only_deleted = "only-deleted";
171 static constexpr const char* jlabel_ignore_deleted = "ignore-deleted";
172 static constexpr const char* jlabel_filename_mask = "filename-mask";
173 static constexpr const char* jlabel_path_mask = "path-mask";
174 static constexpr const char* jlabel_ea_mask = "ea-mask";
175 static constexpr const char* jlabel_fsa_scope = "fsa-scope";
176
177};
178
179#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_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 components used for the user to provide parameters of libdar archive restoration operation
Definition: html_options_extract.hpp:61
virtual void on_event(const std::string &event_name) override
inherited from actor
Definition: html_options_extract.cpp:438
void set_biblio(const std::shared_ptr< bibliotheque > &ptr)
mandatory call to invoke ASAP after constructor
Definition: html_options_extract.cpp:251
void set_to_webdar_defaults()
set the object to webdar defaults
Definition: html_options_extract.cpp:457
void set_fs_root(const std::string &prefix)
needed for path based filtering to filter accordingly to the current root_fs
Definition: html_options_extract.hpp:76
virtual json save_json() const override
inherited from jsoner
Definition: html_options_extract.cpp:380
virtual bibliotheque::using_set get_using_set() const override
inherited from bibliotheque_subconfig
Definition: html_options_extract.cpp:426
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
implementation of get_body_part() method for inherited classes
Definition: html_options_extract.cpp:473
virtual void clear_json() override
inherited from jsoner
Definition: html_options_extract.cpp:410
virtual void load_json(const json &source) override
inherited from jsoner
Definition: html_options_extract.cpp:323
virtual void new_css_library_available() override
Definition: html_options_extract.cpp:480
libdar::archive_options_extract get_options() const
providing the parameters as libdar object
Definition: html_options_extract.cpp:277
bool get_in_place_mode() const
know whether the in-place restoration is set
Definition: html_options_extract.hpp:82
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