Пример #1
0
    bool OnWebRequest(CWebSock& WebSock, const CString& sPageName,
                      CTemplate& Tmpl) override {
        if (sPageName != "index") {
            // only accept requests to index
            return false;
        }

        if (WebSock.IsPost()) {
            VCString vsPerf;
            WebSock.GetRawParam("perform", true).Split("\n", vsPerf, false);
            m_vPerform.clear();

            for (const CString& sPerf : vsPerf)
                m_vPerform.push_back(ParsePerform(sPerf));

            Save();
        }

        for (const CString& sPerf : m_vPerform) {
            CTemplate& Row = Tmpl.AddRow("PerformLoop");
            Row["Perform"] = sPerf;
        }

        return true;
    }
Пример #2
0
    void Add(const CString& sCommand) {
        CString sPerf = sCommand.Token(1, true);

        if (sPerf.empty()) {
            PutModule(t_s("Usage: add <command>"));
            return;
        }

        m_vPerform.push_back(ParsePerform(sPerf));
        PutModule(t_s("Added!"));
        Save();
    }
Пример #3
0
	virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) {
		if (sPageName != "index") {
			// only accept requests to /mods/perform/
			return false;
		}

		if (WebSock.IsPost()) {
			VCString vsPerf;
			WebSock.GetRawParam("perform", true).Split("\n", vsPerf, false);
			m_vPerform.clear();

			for (VCString::const_iterator it = vsPerf.begin(); it != vsPerf.end(); ++it)
				m_vPerform.push_back(ParsePerform(*it));

			Save();
		}

		for (VCString::const_iterator it = m_vPerform.begin(); it != m_vPerform.end(); ++it) {
			CTemplate& Row = Tmpl.AddRow("PerformLoop");
			Row["Perform"] = *it;
		}

		return true;
	}