diff options
-rw-r--r-- | modules/extra/webcpanel/pages/memoserv/memos.cpp | 4 | ||||
-rw-r--r-- | modules/extra/webcpanel/templates/default/header.html | 8 | ||||
-rw-r--r-- | modules/extra/webcpanel/templates/default/memoserv/memos.html | 45 | ||||
-rw-r--r-- | modules/extra/webcpanel/templates/default/style.css | 26 | ||||
-rw-r--r-- | modules/extra/webcpanel/webcpanel.cpp | 11 | ||||
-rw-r--r-- | modules/extra/webcpanel/webcpanel.h | 5 |
6 files changed, 89 insertions, 10 deletions
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 @@ <head> <link href="/static/style.css" media="screen" rel="stylesheet" type="text/css" /> <title>{TITLE}</title> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script> + <script type="text/javascript"> + var t=5000; // Time in ms to display an overlay if one will be displayed + </script> </head> <body> + <div id="boxes"> + <div id="dialog" class="window"></div> + <div id="mask"></div> + </div> <div class="master"> <div class="header"> <ul id="button"> 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} + <script type="text/javascript"> + $(document).ready(function() \{ + var id = "#dialog"; + + showModal(); + setInterval('hideModal()', t); + + $('.close').click(function (e) \{ + e.preventDefault(); + hideModal(); + \}); + + $('#mask').click(function () \{ + hideModal(); + \}); + + function hideModal() \{ + $('.content').fadeIn(200); + $('#mask, .window').fadeOut(200); + \} + + function showModal() \{ + var mHeight = $(document).height(); + var mWidth = $(window).width(); + + $('#mask').css(\{'width': mWidth, 'height': mHeight\}); + $('#mask').fadeIn(200); + $('#mask').fadeTo('fast',0.8); + + $(id).html('<br/><br/>{CMDR} <br/><a href="#" class="close">Close</a>'); + var top = mHeight/2-$(id).height()/2; + var left= mWidth/2-$(id).width()/2; + + $(id).css('top', top); + $(id).css('left', left); + $(id).fadeIn(500); + $('.content').fadeOut(200); + \} + + \}); + </script> + {END IF} <b>Channels you have access in:</b><br/> {FOR CH,ECH IN CHANNEL_NAMES,ESCAPED_CHANNEL_NAMES} - <a href="/memoserv/memos?channel={ECH}">{CH}</a> + <a href="/memoserv/memos?channel={ECH}" class="channel">{CH}</a> {END FOR} <br/><br/> {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<Anope::string> ¶ms, TemplateFileServer::Replacements &r) + void RunCommand(const Anope::string &user, NickCore *nc, const Anope::string &service, const Anope::string &c, const std::vector<Anope::string> ¶ms, TemplateFileServer::Replacements &r, const Anope::string &key) { ServiceReference<Command> 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<Anope::string> ¶ms, TemplateFileServer::Replacements &r); + extern void RunCommand(const Anope::string &user, NickCore *nc, const Anope::string &service, const Anope::string &c, const std::vector<Anope::string> ¶ms, TemplateFileServer::Replacements &r, const Anope::string &key = "MESSAGES"); } #include "pages/index.h" |