1 #ifndef _ots_CodeEditor_h_
2 #define _ots_CodeEditor_h_
4 #include "otsdaq/Macros/CoutMacros.h"
5 #include "otsdaq/Macros/StringMacros.h"
6 #include "otsdaq/MessageFacility/MessageFacility.h"
7 #include "otsdaq/SOAPUtilities/SOAPMessenger.h"
8 #pragma GCC diagnostic push
9 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
10 #include <xgi/Method.h>
11 #pragma GCC diagnostic pop
15 #include <unordered_map>
20 class HttpXmlDocument;
30 void xmlRequest(
const std::string& option,
bool readOnlyMode, cgicc::Cgicc& cgiIn,
HttpXmlDocument* xmlOut,
const std::string& username);
34 void getPathContent(
const std::string& basepath,
const std::string& path,
HttpXmlDocument* xmlOut);
36 void saveFileContent(cgicc::Cgicc& cgiIn,
HttpXmlDocument* xmlOut,
const std::string& username);
37 void build(cgicc::Cgicc& cgiIn,
HttpXmlDocument* xmlOut,
const std::string& username);
39 std::string safePathString(
const std::string& path);
40 std::string safeExtensionString(
const std::string& extension);
43 static const std::string SPECIAL_TYPE_FEInterface, SPECIAL_TYPE_DataProcessor, SPECIAL_TYPE_Table, SPECIAL_TYPE_SlowControls, SPECIAL_TYPE_Tools,
44 SPECIAL_TYPE_UserData, SPECIAL_TYPE_OutputData;
46 static const std::string SOURCE_BASE_PATH, USER_DATA_PATH, OTSDAQ_DATA_PATH;
48 static std::map<std::string , std::set<std::string> > getSpecialsMap(
void);
50 static void readFile(
const std::string& basepath,
const std::string& path, std::string& contents);
51 static void writeFile(
const std::string& basepath,
52 const std::string& path,
53 const std::string& contents,
54 const std::string& username,
55 const unsigned long long& insertPos = -1,
56 const std::string& insertString =
"");
58 const std::set<std::string> ALLOWED_FILE_EXTENSIONS_;