Webdar 1.0.0
Web user interface to libdar
html_bibliotheque.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_bibliotheque_HPP
25#define html_bibliotheque_HPP
26
27 // C system header files
28#include "my_config.h"
29
30extern "C"
31{
32
33}
34
35 // C++ system header files
36
37 // webdar headers
38#include "body_builder.hpp"
39#include "actor.hpp"
40#include "events.hpp"
41#include "html_tabs.hpp"
42#include "html_form_input_file.hpp"
43#include "html_double_button.hpp"
44#include "html_form_fieldset.hpp"
45#include "html_form.hpp"
46#include "bibliotheque.hpp"
47#include "arriere_boutique.hpp"
48#include "html_entrepot_landing.hpp"
49#include "html_mask_form_filename.hpp"
50#include "html_mask_form_path.hpp"
51#include "html_compression_params.hpp"
52#include "html_slicing.hpp"
53#include "html_ciphering.hpp"
54#include "html_form_sig_block_size.hpp"
55#include "html_form_overwrite_action.hpp"
56#include "html_options_test.hpp"
57#include "html_options_compare.hpp"
58#include "html_options_read.hpp"
59#include "html_options_create.hpp"
60#include "html_options_isolate.hpp"
61#include "html_options_merge.hpp"
62#include "html_options_repair.hpp"
63#include "html_options_extract.hpp"
64#include "html_yes_no_box.hpp"
65
67
76
107class html_bibliotheque: public body_builder, public actor, public events
108{
109public:
110 static const std::string event_download;
111
112 html_bibliotheque(std::shared_ptr<bibliotheque> & ptr, const std::string & bib_path);
113 html_bibliotheque(const html_bibliotheque & ref) = delete;
114 html_bibliotheque(html_bibliotheque && ref) noexcept = delete;
115 html_bibliotheque & operator = (const html_bibliotheque & ref) = delete;
116 html_bibliotheque & operator = (html_bibliotheque && ref) noexcept = delete;
117 ~html_bibliotheque() = default;
118
119
121 virtual void on_event(const std::string & event_name) override;
122
123
124protected:
126 virtual std::string inherited_get_body_part(const chemin & path,
127 const request & req) override;
128
130 virtual void new_css_library_available() override;
131
132private:
133 bool expect_upload;
134
135 std::shared_ptr<bibliotheque> biblio;
136
137 std::unique_ptr<arriere_boutique<html_entrepot_landing> > ab_entrepot;
138 std::unique_ptr<arriere_boutique<html_mask_form_filename> > ab_filemask;
139 html_text absolute_path_warning;
140 std::unique_ptr<arriere_boutique<html_mask_form_path> > ab_pathmask;
141 std::unique_ptr<arriere_boutique<html_compression_params> > ab_compr;
142 std::unique_ptr<arriere_boutique<html_slicing> > ab_slicing;
143 std::unique_ptr<arriere_boutique<html_ciphering> > ab_ciphering;
144 std::unique_ptr<arriere_boutique<html_form_sig_block_size> > ab_delta_sig;
145 std::unique_ptr<arriere_boutique<html_form_overwrite_action> > ab_over_policy;
146 std::unique_ptr<arriere_boutique<html_options_test> > ab_options_test;
147 std::unique_ptr<arriere_boutique<html_options_compare> > ab_options_compare;
148 std::unique_ptr<arriere_boutique<html_options_read> > ab_options_read;
149 std::unique_ptr<arriere_boutique<html_options_create> > ab_options_create;
150 std::unique_ptr<arriere_boutique<html_options_isolate> > ab_options_isolate;
151 std::unique_ptr<arriere_boutique<html_options_merge> > ab_options_merge;
152 std::unique_ptr<arriere_boutique<html_options_repair> > ab_options_repair;
153 std::unique_ptr<arriere_boutique<html_options_extract> > ab_options_extract;
154
155 html_tabs tabs;
156 html_text intro;
157 html_form_fieldset top_fs;
158 html_form form;
159 html_form_fieldset filename_fs;
160 html_form_input_file filename;
161 html_form_input autosave;
164 html_form_fieldset bot_fs;
165 html_form upload_form;
166 html_form_input upload_file;
167 html_form_fieldset down_fs;
168 html_double_button download;
169 html_form_fieldset clear_fs;
170 html_double_button clear_conf;
171 html_double_button generate_defaults;
172 html_text ok_loaded;
173 html_text ok_saved;
174 html_text ok_uploaded;
175 html_text ok_cleared;
176 html_text nok_message;
177
178 html_div statusbar;
179 html_text saved_status;
180 html_text unsaved_status;
181
182 enum { context_undefined, context_clear_conf, context_load_conf, context_upload_conf } q_context;
183 html_yes_no_box question;
184
185 void set_saved_status();
186 void clear_ok_messages();
187 void set_default_configs();
188 void set_default_configs_no_compress(); // called by set_default_configs(), separated method for better readability
189 void set_full_from_diff(); // called by set_default_configs(), separated method for better readability
190
191 static constexpr const char* tab_main = "main";
192 static constexpr const char* tab_repo = "repo";
193 static constexpr const char* tab_filemask = "filemask";
194 static constexpr const char* tab_pathmask = "pathmask";
195 static constexpr const char* tab_compression = "compression";
196 static constexpr const char* tab_slicing = "slicing";
197 static constexpr const char* tab_ciphering = "ciphering";
198 static constexpr const char* tab_delta_sig = "delta-sig";
199 static constexpr const char* tab_over_policy = "over-policy";
200 static constexpr const char* tab_options_test = "options-test";
201 static constexpr const char* tab_options_compare = "options-compare";
202 static constexpr const char* tab_options_read = "options-read";
203 static constexpr const char* tab_options_create = "options-create";
204 static constexpr const char* tab_options_isolate = "options-isolate";
205 static constexpr const char* tab_options_merge = "options-merge";
206 static constexpr const char* tab_options_repair = "options-repair";
207 static constexpr const char* tab_options_extract = "options-extract";
208
209 static constexpr const char* event_save = "save";
210 static constexpr const char* event_load = "load";
211 static constexpr const char* event_clear = "clear";
212 static constexpr const char* event_defaults = "defaults";
213
214 static constexpr const char* css_statusbar = "html_biblio_bar";
215};
216
217#endif
defines bibliotheque class
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
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 html_bibliotheque provide graphical mean to manipulate a bibliotheque object
Definition: html_bibliotheque.hpp:108
virtual void new_css_library_available() override
inherited from body_builder
Definition: html_bibliotheque.cpp:699
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_bibliotheque.cpp:652
virtual void on_event(const std::string &event_name) override
inherited from body_builder
Definition: html_bibliotheque.cpp:530
class html_div is the implementation of
Definition: html_div.hpp:46
html_button equivalent with changing path to trigger the button event
Definition: html_double_button.hpp:48
class html_form_fieldset implements HTML fieldset feature
Definition: html_form_fieldset.hpp:51
class html_form_input_file provides a mean to the user to navigate in a file system to select a file ...
Definition: html_form_input_file.hpp:60
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
class html_tabs implements tabs
Definition: html_tabs.hpp:55
class html_text manage text and header in html document
Definition: html_text.hpp:52
html component for user to answer by yes or no to a provided question
Definition: html_yes_no_box.hpp:51
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45
defines the event class