otsdaq  v2_04_01
CodeEditorSupervisor.cc
1 #include "otsdaq-core/CodeEditor/CodeEditorSupervisor.h"
2 
3 using namespace ots;
4 
5 XDAQ_INSTANTIATOR_IMPL(CodeEditorSupervisor)
6 
7 //========================================================================================================================
8 CodeEditorSupervisor::CodeEditorSupervisor(xdaq::ApplicationStub* s)
10 {
11  __SUP_COUT__ << "Constructed." << __E__;
12 } // end constructor
13 
14 //========================================================================================================================
15 CodeEditorSupervisor::~CodeEditorSupervisor(void)
16 {
17  __SUP_COUT__ << "Destroying..." << __E__;
18  // theStateMachineImplementation_ is reset and the object it points to deleted in
19  // ~CoreSupervisorBase()
20 } // end destructor
21 
22 //========================================================================================================================
23 void CodeEditorSupervisor::defaultPage(xgi::Input* in, xgi::Output* out)
24 {
25  __SUP_COUT__ << "ApplicationDescriptor LID="
26  << getApplicationDescriptor()->getLocalId() << __E__;
27  *out << "<!DOCTYPE HTML><html lang='en'><frameset col='100%' row='100%'><frame "
28  "src='/WebPath/html/CodeEditor.html?urn="
29  << getApplicationDescriptor()->getLocalId() << "'></frameset></html>";
30 } // end defaultPage()
31 
32 //========================================================================================================================
33 // setSupervisorPropertyDefaults
34 // override to set defaults for supervisor property values (before user settings
35 // override)
36 void CodeEditorSupervisor::setSupervisorPropertyDefaults()
37 {
38  CorePropertySupervisorBase::setSupervisorProperty(
39  CorePropertySupervisorBase::SUPERVISOR_PROPERTIES.UserPermissionsThreshold,
40  std::string() + "*=1 | codeEditor=-1");
41 
42 } // end setSupervisorPropertyDefaults()
43 
44 //========================================================================================================================
45 // forceSupervisorPropertyValues
46 // override to force supervisor property values (and ignore user settings)
47 void CodeEditorSupervisor::forceSupervisorPropertyValues()
48 {
49  CorePropertySupervisorBase::setSupervisorProperty(
50  CorePropertySupervisorBase::SUPERVISOR_PROPERTIES.RequireUserLockRequestTypes,
51  "codeEditor");
52 
53 } // end forceSupervisorPropertyValues()
54 
55 //========================================================================================================================
56 // Request
57 // Handles Web Interface requests to Console supervisor.
58 // Does not refresh cookie for automatic update checks.
59 void CodeEditorSupervisor::request(const std::string& requestType,
60  cgicc::Cgicc& cgiIn,
61  HttpXmlDocument& xmlOut,
62  const WebUsers::RequestUserInfo& userInfo)
63 {
64  // Commands:
65  // codeEditor
66 
67  if(requestType == "codeEditor")
68  {
69  __SUP_COUT__ << "Code Editor" << __E__;
70 
71  codeEditor_.xmlRequest(CgiDataUtilities::getData(cgiIn, "option"),
72  cgiIn,
73  &xmlOut,
74  userInfo.username_);
75  }
76  else
77  {
78  __SUP_SS__ << "requestType Request, " << requestType << ", not recognized."
79  << __E__;
80  __SUP_SS_THROW__;
81  }
82 } // end request()