From f33f7d98c4d38aabb9f9c54c7880249262e767a4 Mon Sep 17 00:00:00 2001 From: MatthewM Date: Mon, 17 Dec 2012 14:32:28 -0500 Subject: Added a modal window interface to MemoServs page that will automaticly fade out after a give time (currently 5s) --- modules/extra/webcpanel/pages/memoserv/memos.cpp | 4 +- .../extra/webcpanel/templates/default/header.html | 8 ++++ .../templates/default/memoserv/memos.html | 45 +++++++++++++++++++++- .../extra/webcpanel/templates/default/style.css | 26 +++++++++++++ modules/extra/webcpanel/webcpanel.cpp | 11 +++--- modules/extra/webcpanel/webcpanel.h | 5 ++- 6 files changed, 89 insertions(+), 10 deletions(-) (limited to 'modules/extra/webcpanel') diff --git a/modules/extra/webcpanel/pages/memoserv/memos.cpp b/modules/extra/webcpanel/pages/memoserv/memos.cpp index 54c7a1227..e3a3f9b80 100644 --- a/modules/extra/webcpanel/pages/memoserv/memos.cpp +++ b/modules/extra/webcpanel/pages/memoserv/memos.cpp @@ -57,7 +57,7 @@ bool WebCPanel::MemoServ::Memos::OnRequest(HTTPProvider *server, const Anope::st params.push_back(HTTPUtils::URLDecode(message.post_data["receiver"])); params.push_back(HTTPUtils::URLDecode(message.post_data["message"])); - WebPanel::RunCommand(na->nc->display, na->nc, Config->MemoServ, "memoserv/send", params, replacements); + WebPanel::RunCommand(na->nc->display, na->nc, Config->MemoServ, "memoserv/send", params, replacements, "CMDR"); } if (message.get_data.count("del") > 0 && message.get_data.count("number") > 0) { @@ -66,7 +66,7 @@ bool WebCPanel::MemoServ::Memos::OnRequest(HTTPProvider *server, const Anope::st params.push_back(chname); params.push_back(message.get_data["number"]); - WebPanel::RunCommand(na->nc->display, na->nc, Config->MemoServ, "memoserv/del", params, replacements); + WebPanel::RunCommand(na->nc->display, na->nc, Config->MemoServ, "memoserv/del", params, replacements, "CMDR"); } if (message.get_data.count("read") > 0 && message.get_data.count("number") > 0) { diff --git a/modules/extra/webcpanel/templates/default/header.html b/modules/extra/webcpanel/templates/default/header.html index 38f367acc..c16799259 100644 --- a/modules/extra/webcpanel/templates/default/header.html +++ b/modules/extra/webcpanel/templates/default/header.html @@ -3,8 +3,16 @@ {TITLE} + + +
+
+
+
    diff --git a/modules/extra/webcpanel/templates/default/memoserv/memos.html b/modules/extra/webcpanel/templates/default/memoserv/memos.html index 559efd35b..c5c6b2fdd 100644 --- a/modules/extra/webcpanel/templates/default/memoserv/memos.html +++ b/modules/extra/webcpanel/templates/default/memoserv/memos.html @@ -1,7 +1,50 @@ {INCLUDE header.html} + {IF EXISTS CMDR} + + {END IF} Channels you have access in:
    {FOR CH,ECH IN CHANNEL_NAMES,ESCAPED_CHANNEL_NAMES} - {CH} + {CH} {END FOR}

    {FOR M IN MESSAGES} diff --git a/modules/extra/webcpanel/templates/default/style.css b/modules/extra/webcpanel/templates/default/style.css index 65715faca..4341d568e 100644 --- a/modules/extra/webcpanel/templates/default/style.css +++ b/modules/extra/webcpanel/templates/default/style.css @@ -3,6 +3,7 @@ font-family: 'Cabin', Helvetica, Arial, sans-serif; } body { overflow:hidden; + z-index: 10; } .master { margin-left:0px; @@ -123,3 +124,28 @@ body { color: red; weight: bolder; } + +/* Modal Window */ +#mask { + position: aboslute; + z-index: 9000; + background-color: #000; + height: 100%; + width: 100%; + display: none; +} + +#boxes .window { + position:fixed; + width:440px; + height:200px; + display:none; + z-index:9999; + padding:20px; +} + + #boxes #dialog { + background-color: #FFF; + width:375px; + height:203px; +} diff --git a/modules/extra/webcpanel/webcpanel.cpp b/modules/extra/webcpanel/webcpanel.cpp index a20b88ee9..816624628 100644 --- a/modules/extra/webcpanel/webcpanel.cpp +++ b/modules/extra/webcpanel/webcpanel.cpp @@ -217,12 +217,12 @@ class ModuleWebCPanel : public Module namespace WebPanel { - void RunCommand(const Anope::string &user, NickCore *nc, const Anope::string &service, const Anope::string &c, const std::vector ¶ms, TemplateFileServer::Replacements &r) + void RunCommand(const Anope::string &user, NickCore *nc, const Anope::string &service, const Anope::string &c, const std::vector ¶ms, TemplateFileServer::Replacements &r, const Anope::string &key) { ServiceReference cmd("Command", c); if (!cmd) { - r["MESSAGES"] = "Unable to find command " + c; + r[key] = "Unable to find command " + c; return; } @@ -237,15 +237,16 @@ namespace WebPanel struct MyComandReply : CommandReply { TemplateFileServer::Replacements &re; + const Anope::string &k; - MyComandReply(TemplateFileServer::Replacements &_r) : re(_r) { } + MyComandReply(TemplateFileServer::Replacements &_r, const Anope::string &_k) : re(_r), k(_k) { } void SendMessage(const BotInfo *source, const Anope::string &msg) anope_override { - re["MESSAGES"] = msg; + re[k] = msg; } } - my_reply(r); + my_reply(r, key); CommandSource source(user, NULL, nc, &my_reply, bi); cmd->Execute(source, params); diff --git a/modules/extra/webcpanel/webcpanel.h b/modules/extra/webcpanel/webcpanel.h index 511ecf354..7c897f9af 100644 --- a/modules/extra/webcpanel/webcpanel.h +++ b/modules/extra/webcpanel/webcpanel.h @@ -145,9 +145,10 @@ namespace WebPanel * @param service Service for source.owner and source.service * @param c Command to run (as a service name) * @param params Command parameters - * @param r Replacements, reply from command goes back into r["MESSAGES"] + * @param r Replacements, reply from command goes back here into key + * @param key The key to put the replies into r */ - extern void RunCommand(const Anope::string &user, NickCore *nc, const Anope::string &service, const Anope::string &c, const std::vector ¶ms, TemplateFileServer::Replacements &r); + extern void RunCommand(const Anope::string &user, NickCore *nc, const Anope::string &service, const Anope::string &c, const std::vector ¶ms, TemplateFileServer::Replacements &r, const Anope::string &key = "MESSAGES"); } #include "pages/index.h" -- cgit