Ispmanager 6 business documentation

Creating of own output format

 

You can create your own output format in ISPmanager using the C++ programming language as follows:

  1. Install the developer package.
    CentOS:
    yum install coremanager-devel
    Debian, Ubuntu:
    apt-get install coremanager-devel
  2. Develop your module using the guidelines provided in Lower-level interaction, C++ plug-ins.
  3. Create a subclass that will inherit methods from the OutputFormat class.
  4. Redefine the Write method.
  5. To check, request the method with indication of the new format: out=MyCustomFormat.

Code example:

#include <api/output.h>
#include <mgr/mgrlog.h>
#include <api/module.h>
#include <api/connection.h>

MODULE("output");

namespace {
using namespace isp_api;
using namespace mgr_xml;

class OutputMyCustomFormat : public OutputFormat {
public:
OutputMyCustomFormat() : OutputFormat("MyCustomFormat") {}
virtual ~OutputMyCustomFormat() {}

virtual bool IsHtml() const { return true; }
virtual bool WantMessages() const { return true; }
virtual void Write(Connection &conn, Xml &xml) 
	const string output = "output" // here, using the xml received as input, you need to form the server response
	conn.Output() <<  "\n" << output << std::endl;
}

};

MODULE_INIT(OutputMyCustomFormat, "") {
new OutputMyCustomFormat();
}
}