Webdar 1.0.0
Web user interface to libdar
html_disconnect.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_DISCONNECT_HPP
25#define HTML_DISCONNECT_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 "html_div.hpp"
39#include "actor.hpp"
40#include "events.hpp"
41#include "html_text.hpp"
42#include "html_double_button.hpp"
43#include "html_image.hpp"
44#include "html_version.hpp"
45
47
48class html_disconnect : public html_div, public actor, public events
49{
50public:
52 static const std::string event_disconn;
53
55 html_disconnect(const html_disconnect & ref) = delete;
56 html_disconnect(html_disconnect && ref) noexcept = delete;
57 html_disconnect & operator = (const html_disconnect & ref) = delete;
58 html_disconnect & operator = (html_disconnect && ref) noexcept = delete;
59 ~html_disconnect() = default;
60
62 void set_username(const std::string & username);
63
65 virtual void on_event(const std::string & event_name) override;
66
68
80 static void force_disconnection_at_end_of_session(bool val) { default_basic_auth = ! val; };
81
82protected:
83
85 virtual void new_css_library_available() override;
86
87
88private:
89 static const std::string event_version;
90
91 static const std::string css_global;
92 static const std::string css_logo;
93 static const std::string css_title;
94 static const std::string css_title_vers;
95 static const std::string css_title_box;
96 static const std::string css_status;
97 static const std::string css_status_box;
98 static const std::string css_quit_box;
99
100 html_image logo;
101 html_div title_box;
102 html_text title;
103 html_button title_vers;
104 html_div status_box;
105 html_text status;
107 html_version version_details;
108
109 static bool default_basic_auth;
110
111};
112
113#endif
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
class events
Definition: events.hpp:52
simple html component providing the usual button feature of GUIs, better using html_double_button ins...
Definition: html_button.hpp:48
html component used for the user to define a has algorithm
Definition: html_disconnect.hpp:49
virtual void new_css_library_available() override
inherited from body_builder from html_button
Definition: html_disconnect.cpp:121
static const std::string event_disconn
disconnect event
Definition: html_disconnect.hpp:52
static void force_disconnection_at_end_of_session(bool val)
whether to emulate user logout while using basic authentication (see also class server)
Definition: html_disconnect.hpp:80
void set_username(const std::string &username)
set the username to display for the session ownership
Definition: html_disconnect.cpp:104
virtual void on_event(const std::string &event_name) override
inherited from actor
Definition: html_disconnect.cpp:111
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
html static component displaying an image from a given URL
Definition: html_image.hpp:44
class html_text manage text and header in html document
Definition: html_text.hpp:52
class html_version is a popup displaying version information
Definition: html_version.hpp:49
defines the event class