$treeview $search $mathjax $extrastylesheet
otsdaq_utilities
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef _ots_LogbookSupervisor_h 00002 #define _ots_LogbookSupervisor_h 00003 00004 #include "otsdaq-core/CoreSupervisors/CoreSupervisorBase.h" 00005 00006 namespace ots 00007 { 00008 // LogbookSupervisor 00009 // This class handles the write and read requests for web users interfacing to the web 00010 // desktop Logbook 00011 class LogbookSupervisor : public CoreSupervisorBase 00012 { 00013 public: 00014 XDAQ_INSTANTIATOR(); 00015 LogbookSupervisor(xdaq::ApplicationStub* s); 00016 virtual ~LogbookSupervisor(void); 00017 00018 void init(void); 00019 void destroy(void); 00020 00021 virtual void defaultPage(xgi::Input* in, xgi::Output* out) override; 00022 virtual void request(const std::string& requestType, 00023 cgicc::Cgicc& cgiIn, 00024 HttpXmlDocument& xmlOut, 00025 const WebUsers::RequestUserInfo& userInfo) override; 00026 virtual void nonXmlRequest(const std::string& requestType, 00027 cgicc::Cgicc& cgiIn, 00028 std::ostream& out, 00029 const WebUsers::RequestUserInfo& userInfo) override; 00030 00031 virtual void setSupervisorPropertyDefaults( 00032 void) override; // override to control supervisor specific defaults 00033 virtual void forceSupervisorPropertyValues(void) override; // override to force 00034 // supervisor property 00035 // values (and ignore user 00036 // settings) 00037 00038 // External Supervisor XOAP handlers 00039 xoap::MessageReference MakeSystemLogbookEntry(xoap::MessageReference msg); 00040 00041 private: 00042 bool validateExperimentName(std::string& experiment); 00043 std::string getActiveExperiment(void); 00044 void setActiveExperiment(std::string experiment = ""); 00045 void createExperiment(std::string experiment, 00046 std::string creator, 00047 HttpXmlDocument* xmldoc = 0); 00048 void removeExperiment(std::string experiment, 00049 std::string remover, 00050 HttpXmlDocument* xmldoc = 0); 00051 void getExperiments(HttpXmlDocument* xmldoc = 0, std::ostringstream* out = 0); 00052 void webUserSetActiveExperiment(std::string experiment, HttpXmlDocument* xmldoc = 0); 00053 void refreshLogbook(time_t date, 00054 unsigned char duration, 00055 HttpXmlDocument* xmldoc = 0, 00056 std::ostringstream* out = 0, 00057 std::string experiment = ""); 00058 void cleanUpPreviews(void); 00059 void savePostPreview(std::string& subject, 00060 std::string& text, 00061 const std::vector<cgicc::FormFile>& files, 00062 std::string creator, 00063 HttpXmlDocument* xmldoc = 0); 00064 void escapeLogbookEntry(std::string& entry); 00065 std::string validateUploadFileType(const std::string fileType); 00066 void movePreviewEntry(std::string previewNumber, 00067 bool approve, 00068 HttpXmlDocument* xmldoc = 0); 00069 void hideLogbookEntry(const std::string& entryId, 00070 bool hide, 00071 const std::string& hider); 00072 static void MFReceiverWorkLoop(void); 00073 00074 enum 00075 { 00076 ADMIN_PERMISSIONS_THRESHOLD = 255, 00077 EXPERIMENT_NAME_MIN_LENTH = 3, 00078 EXPERIMENT_NAME_MAX_LENTH = 25, 00079 LOGBOOK_PREVIEW_EXPIRATION_TIME = 60 * 20, // 20 minutes 00080 }; 00081 std::vector<std::string> allowedFileUploadTypes_, matchingFileUploadTypes_; 00082 00083 std::string activeExperiment_; 00084 unsigned int mostRecentDayIndex_; 00085 }; 00086 } 00087 00088 #endif