Webdar 1.0.0
Web user interface to libdar
html_options_compare.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_COMPARE_HPP
25#define HTML_OPTIONS_COMPARE_HPP
26
27 // C system header files
28#include "my_config.h"
29extern "C"
30{
31
32}
33
34 // C++ system header files
35
36
37 // webdar headers
38#include "body_builder.hpp"
39#include "actor.hpp"
40#include "html_form_input.hpp"
41#include "html_form_fieldset.hpp"
42#include "html_comparison_fields.hpp"
43#include "html_form.hpp"
44#include "html_derouleur.hpp"
45#include "html_mask_form_filename.hpp"
46#include "html_mask_form_path.hpp"
47#include "html_fsa_scope.hpp"
48#include "guichet.hpp"
49#include "jsoner.hpp"
50#include "events.hpp"
51
53
55 public actor,
56 public jsoner,
57 public events,
59{
60public:
61 static const std::string changed;
62
64 html_options_compare(const html_options_compare & ref) = delete;
65 html_options_compare(html_options_compare && ref) noexcept = delete;
66 html_options_compare & operator = (const html_options_compare & ref) = delete;
67 html_options_compare & operator = (html_options_compare && ref) noexcept = delete;
68 ~html_options_compare() = default;
69
71 void set_biblio(const std::shared_ptr<bibliotheque> & ptr);
72
74 void set_fs_root(const std::string & prefix) { path_mask->set_fs_root(prefix); };
75
77 libdar::archive_options_diff get_options() const;
78
80 bool get_in_place_mode() const { return in_place.get_value_as_bool(); };
81
83 virtual void load_json(const json & source) override;
84
86 virtual json save_json() const override;
87
89 virtual void clear_json() override;
90
92 virtual bibliotheque::using_set get_using_set() const override;
93
95 virtual void on_event(const std::string & event_name) override;
96
99
100protected:
101
103 virtual std::string inherited_get_body_part(const chemin & path,
104 const request & req) override;
105
107 virtual void new_css_library_available() override;
108
109private:
110 static constexpr const char* treated_none = "none";
111 static constexpr const char* treated_dir = "dir";
112 static constexpr const char* treated_all = "all";
113
114 bool ignore_events;
115
116 html_derouleur deroule;
117
118 html_form form_reading;
119 html_form_fieldset fs_alter_atime;
120 html_form_radio alter_atime;
121 html_form_input furtive_read_mode;
122 html_form_input zeroing_neg_date;
123 html_form_input hourshift;
124
125 html_form form;
127 html_form_input in_place;
128 html_comparison_fields what_to_check;
129 html_form_input compare_symlink_date;
130
131 html_form form_show;
132 html_form_fieldset fs_show;
133 html_form_input info_details;
134 html_form_input display_treated;
135 html_form_input display_treated_only_dir;
136 html_form_input display_skipped;
137
138 guichet guichet_filename_mask;
139 std::shared_ptr<html_mask_form_filename> filename_mask;
140
141 guichet guichet_path_mask;
142 std::shared_ptr<html_mask_form_path> path_mask;
143
144 guichet guichet_ea_mask;
145 std::shared_ptr<html_mask_form_filename> ea_mask;
146
147 html_fsa_scope fsa_scope;
148
149 void trigger_change();
150
151 static constexpr const unsigned int format_version = 1;
152 static constexpr const char* myclass_id = "html_options_compare";
153
154 static constexpr const char* jlabel_alter_atime = "alter-atime";
155 static constexpr const char* jlabel_furtive_read = "furtive-read";
156 static constexpr const char* jlabel_zeroing_neg_dates = "zeroing-negative-dates";
157 static constexpr const char* jlabel_hourshift = "hourshift";
158 static constexpr const char* jlabel_in_place = "use-in-place-root";
159 static constexpr const char* jlabel_what_to_check = "what-to-check-for";
160 static constexpr const char* jlabel_symlink_date = "compare-symlink-mtime";
161 static constexpr const char* jlabel_info_details = "info-details";
162 static constexpr const char* jlabel_disp_treated = "display-treated";
163 static constexpr const char* jlabel_disp_only_dir = "display-only-dirs";
164 static constexpr const char* jlabel_disp_skipped = "display-skipped";
165 static constexpr const char* jlabel_file_mask = "file-mask";
166 static constexpr const char* jlabel_path_mask = "path-mask";
167 static constexpr const char* jlabel_ea_mask = "ea-mask";
168 static constexpr const char* jlabel_fsa_scope = "fsa-scope";
169};
170
171
172#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
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_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_radio implements HTML "input" of type "radio"
Definition: html_form_radio.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 providing a way for the user to set the parameter of libdar comparison operation
Definition: html_options_compare.hpp:59
virtual bibliotheque::using_set get_using_set() const override
inherited from bibliotheque_subconfig
Definition: html_options_compare.cpp:371
virtual json save_json() const override
inherited from jsoner
Definition: html_options_compare.cpp:318
libdar::archive_options_diff get_options() const
gathering informations for libdar
Definition: html_options_compare.cpp:242
void set_biblio(const std::shared_ptr< bibliotheque > &ptr)
mandatory call to invoke ASAP after constructor
Definition: html_options_compare.cpp:221
virtual void clear_json() override
inherited from jsoner
Definition: html_options_compare.cpp:342
bool get_in_place_mode() const
know whether the in-place restoration is set
Definition: html_options_compare.hpp:80
virtual void new_css_library_available() override
inherited from body_builder
Definition: html_options_compare.cpp:422
virtual void on_event(const std::string &event_name) override
inherited from actor
Definition: html_options_compare.cpp:382
virtual void load_json(const json &source) override
inherited from jsoner
Definition: html_options_compare.cpp:265
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_options_compare.cpp:416
void set_fs_root(const std::string &prefix)
needed for path based filtering to filter accordingly to the current root_fs
Definition: html_options_compare.hpp:74
html_options_compare()
Definition: html_options_compare.cpp:47
void set_to_webdar_defaults()
set the object to webdar defaults
Definition: html_options_compare.cpp:402
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