Webdar 1.0.0
Web user interface to libdar
html_form_overwrite_constant_action.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_FORM_OVERWRITE_CONSTANT_ACTION_HPP
25#define HTML_FORM_OVERWRITE_CONSTANT_ACTION_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 // webdar headers
37#include "html_overwrite_action.hpp"
38#include "body_builder.hpp"
39#include "html_form_select.hpp"
40#include "html_form_fieldset.hpp"
41#include "jsoner.hpp"
42#include "events.hpp"
43#include "actor.hpp"
44
46
48 public jsoner,
49 public events,
50 public actor
51{
52public:
53 // events
54 static const std::string changed;
55
56 // values for data
57
58 static constexpr const char* data_preserve = "Preserve";
59 static constexpr const char* data_overwrite = "Overwrite";
60 static constexpr const char* data_preserve_saved = "Preserve and mark already saved";
61 static constexpr const char* data_overwrite_saved = "Overwrite and mark already saved";
62 static constexpr const char* data_remove = "Remove";
63 static constexpr const char* data_undefined = "Keep undefined if not already defined";
64 static constexpr const char* data_ask = "Ask user what to do for each file in conflict";
65
66 // values for EA
67
68 static constexpr const char* ea_preserve = "Preserve";
69 static constexpr const char* ea_overwrite = "Overwrite";
70 static constexpr const char* ea_clear = "Clear all EA and FSA";
71 static constexpr const char* ea_preserve_saved = "Preserve and mark already saved";
72 static constexpr const char* ea_overwrite_saved = "Overwrite and mark already saved";
73 static constexpr const char* ea_merge_preserve = "Merge EA and preserve";
74 static constexpr const char* ea_merge_overwrite = "Merge EA and overwrite";
75 static constexpr const char* ea_undefined = "Keep undefined if not already defined";
76 static constexpr const char* ea_ask = "Ask user what to do for each file in conflict";
77
84
85
87
89 void set_data_action(const std::string & val) { data_action.set_selected_id(val); };
90
92
94 void set_ea_action(const std::string & val) { ea_action.set_selected_id(val); };
95
97 virtual std::unique_ptr<libdar::crit_action> get_overwriting_action() const override;
98
100 virtual void load_json(const json & source) override;
101
103 virtual json save_json() const override;
104
106 virtual void clear_json() override;
107
109 virtual void on_event(const std::string & event_name) override;
110
111private:
112 html_form_fieldset action_fs;
113 html_form_select data_action;
114 html_form_select ea_action;
115
116 static constexpr const unsigned int format_version = 1;
117 static constexpr const char* myclass_id = "html_form_overwrite_constant_action";
118
119 static constexpr const char* jlabel_data = "data";
120 static constexpr const char* jlabel_ea = "ea";
121};
122
123#endif
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
class events
Definition: events.hpp:52
class html_form_fieldset implements HTML fieldset feature
Definition: html_form_fieldset.hpp:51
html component to be adopted by an html_form that implements constant actions for overwriting policie...
Definition: html_form_overwrite_constant_action.hpp:51
virtual std::unique_ptr< libdar::crit_action > get_overwriting_action() const override
obtain the crit_constant_action object for libdar option
Definition: html_form_overwrite_constant_action.cpp:88
virtual void clear_json() override
inherited from jsoner
Definition: html_form_overwrite_constant_action.cpp:200
void set_ea_action(const std::string &val)
programmatically setup the action for EA
Definition: html_form_overwrite_constant_action.hpp:94
virtual void load_json(const json &source) override
inherited from jsoner
Definition: html_form_overwrite_constant_action.cpp:160
virtual json save_json() const override
inherited from jsoner
Definition: html_form_overwrite_constant_action.cpp:188
void set_data_action(const std::string &val)
programmatically setup the action for data
Definition: html_form_overwrite_constant_action.hpp:89
virtual void on_event(const std::string &event_name) override
inherited from actor
Definition: html_form_overwrite_constant_action.cpp:206
void set_selected_id(const std::string &id)
set the radio buttons to the item id given in argument
Definition: html_form_radio.cpp:89
class html_form_select implements HTML input of type "select"
Definition: html_form_select.hpp:53
html component used for constant actions in overwriting policies
Definition: html_overwrite_action.hpp:48
class jsoner
Definition: jsoner.hpp:73
defines the event class
defines jsoner class and class exception_json