24#ifndef HTML_SELECT_FILE_HPP
25#define HTML_SELECT_FILE_HPP
36#include <dar/libdar.hpp>
38#include <libthreadar/libthreadar.hpp>
43#include "html_div.hpp"
44#include "html_text.hpp"
45#include "html_form_fieldset.hpp"
46#include "html_button.hpp"
47#include "html_double_button.hpp"
48#include "html_table.hpp"
49#include "html_popup.hpp"
50#include "html_form.hpp"
51#include "html_form_input.hpp"
52#include "html_web_user_interaction.hpp"
149 void set_filter(
const std::string & mask) { filter = mask; };
157 void go_select(
const std::shared_ptr<libdar::entrepot> & x_entr,
158 const std::string & start_dir);
161 std::string
get_selected_path()
const {
if(status != st_completed)
throw WEBDAR_BUG; status = st_init;
return fieldset.get_label(); };
164 virtual void on_event(
const std::string & event_name)
override;
186 static const std::string op_chdir_parent;
187 static const std::string op_createdir;
188 static const std::string op_hide_createdir;
191 static const std::string css_sticky_top;
192 static const std::string css_sticky_bot;
195 static constexpr const unsigned int width_pct = 80;
196 static constexpr const unsigned int height_pct = 80;
203 libdar::inode_type type;
204 libdar::inode_type target_type;
205 item() { btn =
nullptr; type = target_type = libdar::inode_type::unknown; };
206 item(
html_button* ptr) { btn = ptr; type = target_type = libdar::inode_type::unknown; };
212 libthreadar::mutex content_mutex;
229 mutable thread_to_run which_thread;
232 bool is_loading_mode;
234 libdar::inode_type fieldset_target_type;
235 libdar::inode_type fieldset_type;
238 std::string x_message;
242 std::shared_ptr<libdar::entrepot> entr;
243 std::shared_ptr<libdar::user_interaction> mem_ui;
255 std::string path_loaded;
256 std::map<std::string, item> listed;
259 bool need_reload_content;
276 bool init_fieldset_target_type();
285 void add_content_entry(
const std::string & event_name,
286 libdar::inode_type tp,
287 libdar::inode_type target_tp,
288 const std::string & entry);
293 void run_thread(thread_to_run val);
296 void clear_content();
302 void loading_mode(
bool mode);
305 static std::string get_parent_path(
const std::string & somepath);
315 bool is_a_valid_dir(
const std::string & pathval,
const std::string & name)
const;
318 void update_entrepot_url();
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
void set_visible(bool mode)
ask for the object to become visible in HTML page or temporarily hidden
Definition: body_builder.cpp:211
class chemin definition
Definition: chemin.hpp:51
class events
Definition: events.hpp:52
class html_div is the implementation of
Definition: html_div.hpp:46
class html_select_file
Definition: html_select_file.hpp:110
void go_select(const std::shared_ptr< libdar::entrepot > &x_entr, const std::string &start_dir)
start the user interaction for a path selection
Definition: html_select_file.cpp:158
html_select_file(const std::string &message)
constructor
Definition: html_select_file.cpp:59
std::string get_message() const
returns the message argument passed at construction time
Definition: html_select_file.hpp:167
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder (via html_div)
Definition: html_select_file.cpp:353
static const std::string op_cancelled
event when the user cancelled file selection
Definition: html_select_file.hpp:116
select_mode
Definition: html_select_file.hpp:119
@ sel_file
only non dir and symlinks and non symlink should be selectable
Definition: html_select_file.hpp:120
@ sel_symlinks
only symlinks should be selectable
Definition: html_select_file.hpp:122
@ sel_dir
only directories and symlinks pointing to dir
Definition: html_select_file.hpp:121
virtual void signaled_inherited_cancel() override
inherited from libthreadar::thread
Definition: html_select_file.cpp:720
void set_filter(const std::string &mask)
Definition: html_select_file.hpp:149
std::string get_selected_path() const
obtain the path selected by the user (mandatory after entry_selected event, in order to reuse this ob...
Definition: html_select_file.hpp:161
void set_can_create_dir(bool val)
whether to show the button allowing the user to create a subdirectory
Definition: html_select_file.hpp:144
static const std::string entry_selected
event when user selected a file
Definition: html_select_file.hpp:113
void set_select_mode(select_mode val)
ask the user to select a file path (false) or a directory path (true)
Definition: html_select_file.hpp:139
virtual void on_event(const std::string &event_name) override
action triggered from html_buttons internally used in this class implementation (do not use,...
Definition: html_select_file.cpp:189
virtual void inherited_run() override
inherited from libthreadar::thread
Definition: html_select_file.cpp:447
virtual void new_css_library_available() override
inherited from body_builder (via html_div)
Definition: html_select_file.cpp:405
html component implementing the html table structure
Definition: html_table.hpp:52
class html_text manage text and header in html document
Definition: html_text.hpp:52
body_builder component, providing an html interface to libdar::user_interaction
Definition: html_web_user_interaction.hpp:119
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45