summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthewM <mcm@they-got.us>2012-12-14 16:44:14 -0500
committerAdam <Adam@anope.org>2012-12-14 16:44:14 -0500
commit1075f3b457d9e144b883166b202cba919069f82b (patch)
treeb3dd6c9ff7b721953349172fe15850fb2e33e22e /modules
parentc1077faa281c5635f85b892e605e23bd6c8fcc3b (diff)
Allow opers to drop channels
Added chanserv drop to web panel Allow long lists of akills to scroll
Diffstat (limited to 'modules')
-rw-r--r--modules/extra/webcpanel/pages/chanserv/drop.cpp45
-rw-r--r--modules/extra/webcpanel/pages/chanserv/drop.h25
-rw-r--r--modules/extra/webcpanel/templates/default/chanserv/drop.html22
-rw-r--r--modules/extra/webcpanel/templates/default/operserv/akill.html44
-rw-r--r--modules/extra/webcpanel/templates/default/style.css23
-rw-r--r--modules/extra/webcpanel/webcpanel.cpp9
-rw-r--r--modules/extra/webcpanel/webcpanel.h1
7 files changed, 146 insertions, 23 deletions
diff --git a/modules/extra/webcpanel/pages/chanserv/drop.cpp b/modules/extra/webcpanel/pages/chanserv/drop.cpp
new file mode 100644
index 000000000..f0fc0d5c2
--- /dev/null
+++ b/modules/extra/webcpanel/pages/chanserv/drop.cpp
@@ -0,0 +1,45 @@
+/*
+ * (C) 2003-2012 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ */
+
+#include "../../webcpanel.h"
+
+WebCPanel::ChanServ::Drop::Drop(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage (cat, u)
+{
+}
+
+
+bool WebCPanel::ChanServ::Drop::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+{
+
+ if (message.post_data.count("channel") > 0 && message.post_data.count("confChan") > 0)
+ {
+ if (message.post_data["channel"] == message.post_data["confChan"]) {
+ std::vector<Anope::string> params;
+ params.push_back(HTTPUtils::URLDecode(message.post_data["channel"]));
+
+ WebPanel::RunCommand(na->nc->display, na->nc, Config->ChanServ, "chanserv/drop", params, replacements);
+ }
+ else replacements["MESSAGES"] = "Invalid Confirmation";
+ }
+ // XXX this is slightly inefficient
+ for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
+ {
+ ChannelInfo *ci = it->second;
+ if ((ci->HasFlag(CI_SECUREFOUNDER) ? ci->AccessFor(na->nc).founder : ci->AccessFor(na->nc).HasPriv("FOUNDER")) || (na->nc->IsServicesOper() && na->nc->o->ot->HasCommand("chanserv/drop")))
+ {
+ replacements["CHANNEL_NAMES"] = ci->name;
+ replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->name);
+ }
+ }
+
+ if (message.get_data.count("channel") > 0) {
+ replacements["CHANNEL_DROP"] = message.get_data["channel"];
+ }
+ TemplateFileServer page("chanserv/drop.html");
+ page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
+}
diff --git a/modules/extra/webcpanel/pages/chanserv/drop.h b/modules/extra/webcpanel/pages/chanserv/drop.h
new file mode 100644
index 000000000..9fd4be720
--- /dev/null
+++ b/modules/extra/webcpanel/pages/chanserv/drop.h
@@ -0,0 +1,25 @@
+/*
+ * (C) 2003-2012 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ */
+
+namespace WebCPanel
+{
+
+ namespace ChanServ
+ {
+
+ class Drop : public WebPanelProtectedPage
+ {
+ public:
+ Drop(const Anope::string &cat, const Anope::string &u);
+
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+
+ };
+
+ }
+
+}
diff --git a/modules/extra/webcpanel/templates/default/chanserv/drop.html b/modules/extra/webcpanel/templates/default/chanserv/drop.html
new file mode 100644
index 000000000..35f0283f2
--- /dev/null
+++ b/modules/extra/webcpanel/templates/default/chanserv/drop.html
@@ -0,0 +1,22 @@
+{INCLUDE header.html}
+ {IF EXISTS MESSAGES}
+ {FOR M IN MESSAGES}
+ {M}<br/>
+ {END FOR}
+ {END IF}
+ <h3>Channels you can drop:</h3>
+ <div class="scroll">
+ {FOR CH,ECH IN CHANNEL_NAMES,ESCAPED_CHANNEL_NAMES}
+ <a href="/chanserv/drop?channel={ECH}">{CH}</a></br>
+ {END FOR}
+ </div>
+ {IF EXISTS CHANNEL_DROP}
+ <h3>Drop Channel {CHANNEL_DROP}?</h3>
+ <form method="post" name="dropForm" action="/chanserv/drop">
+ <input type="hidden" value="{CHANNEL_DROP}" name="channel">
+ Enter Channel For Confirmation: <input type="text" name="confChan">
+ <input type="hidden" value="yes" name="drop">
+ <input type="submit" value="Drop">
+ </form>
+ {END IF}
+{INCLUDE footer.html} \ No newline at end of file
diff --git a/modules/extra/webcpanel/templates/default/operserv/akill.html b/modules/extra/webcpanel/templates/default/operserv/akill.html
index 317e31c71..2c3ea6de9 100644
--- a/modules/extra/webcpanel/templates/default/operserv/akill.html
+++ b/modules/extra/webcpanel/templates/default/operserv/akill.html
@@ -8,33 +8,33 @@
</br><b>AKILL List:</b>
<table width="100%" height="100%">
<tr>
- <th align="left">Number</th>
- <th align="left">Hostmask/Reason</th>
- <th align="left">Expires</th>
- <th align="left">Setter</th>
+ <td class="akillR1">Number</td>
+ <td class="akillR2">Hostmask</td>
+ <td class="akillR2">Expires</td>
+ <td class="akillR2">Setter</td>
+ <td>
</tr>
- {FOR N,H,S,T,E,R IN NUMBER,HOST,SETTER,TIME,EXPIRE,REASON}
- <tr>
- <td>{N}</td>
- <td>{H}</td>
- <td>{E}</td>
- <td>{S}</td>
- <td></td>
- <td><a href="/operserv/akill?&number={N}&del=1">Delete</a></td>
- </tr>
- <tr>
- <td></td>
- <td colspan="2">{R}</td>
- </tr>
- {END FOR}
- </table></br>
+ </table>
+ <div class="scroll">
+ <table>
+ {FOR N,H,S,T,E,R IN NUMBER,HOST,SETTER,TIME,EXPIRE,REASON}
+ <tr>
+ <td class="akillR1">{N}</td>
+ <td class="akillR2"><abbr class="akillR2" title="{R}">{H}</abbr></td>
+ <td class="akillR2"><abbr class="akillR2" title="{T}">{E}</abbr></td>
+ <td class="akillR2">{S}</td>
+ <td class="akillR3"><a href="/operserv/akill?&number={N}&del=1">Delete</a></td>
+ </tr>
+ {END FOR}
+ </table></br>
+ </div>
<b>Add a new AKILL</b>
<form method="post" action="/operserv/akill">
<table width="100%" height="100%" align="left">
<tr>
- <th align="left">HostMask</th>
- <th align="left">Expiry</th>
- <th align="left">Reason</th>
+ <th align="left">HostMask</td>
+ <th align="left">Expiry</td>
+ <th align="left">Reason</td>
</tr>
<tr>
<td><input type="text" name="mask"></td>
diff --git a/modules/extra/webcpanel/templates/default/style.css b/modules/extra/webcpanel/templates/default/style.css
index 78c044995..7934e4850 100644
--- a/modules/extra/webcpanel/templates/default/style.css
+++ b/modules/extra/webcpanel/templates/default/style.css
@@ -95,3 +95,26 @@ body {
background:#FFF;
text-decoration:underline;
}
+
+.scroll {
+ overflow-x: scroll;
+ height: 125px;
+}
+
+.akillR1 {
+ width: 80px;
+ text-align: left;
+}
+.akillR2 {
+ width: 250px;
+ text-align: left;
+}
+.akillR3 {
+ width: 100px;
+ text-align: left;
+}
+
+.danger {
+ color: red;
+ weight: bolder;
+}
diff --git a/modules/extra/webcpanel/webcpanel.cpp b/modules/extra/webcpanel/webcpanel.cpp
index 98c81665e..a20b88ee9 100644
--- a/modules/extra/webcpanel/webcpanel.cpp
+++ b/modules/extra/webcpanel/webcpanel.cpp
@@ -31,6 +31,7 @@ class ModuleWebCPanel : public Module
WebCPanel::ChanServ::Set chanserv_set;
WebCPanel::ChanServ::Access chanserv_access;
WebCPanel::ChanServ::Akick chanserv_akick;
+ WebCPanel::ChanServ::Drop chanserv_drop;
WebCPanel::MemoServ::Memos memoserv_memos;
@@ -46,7 +47,7 @@ class ModuleWebCPanel : public Module
index("/"), logout("/logout"), _register("/register"), confirm("/confirm"),
nickserv_info(Config->NickServ, "/nickserv/info"), nickserv_cert(Config->NickServ, "/nickserv/cert"), nickserv_access(Config->NickServ, "/nickserv/access"), nickserv_alist(Config->NickServ, "/nickserv/alist"),
chanserv_info(Config->ChanServ, "/chanserv/info"), chanserv_set(Config->ChanServ, "/chanserv/set"), chanserv_access(Config->ChanServ, "/chanserv/access"), chanserv_akick(Config->ChanServ, "/chanserv/akick"),
- memoserv_memos(Config->MemoServ, "/memoserv/memos"), hostserv_request(Config->HostServ, "/hostserv/request"), operserv_akill(Config->OperServ, "/operserv/akill")
+ chanserv_drop(Config->ChanServ, "/chanserv/drop"), memoserv_memos(Config->MemoServ, "/memoserv/memos"), hostserv_request(Config->HostServ, "/hostserv/request"), operserv_akill(Config->OperServ, "/operserv/akill")
{
this->SetAuthor("Anope");
@@ -129,6 +130,11 @@ class ModuleWebCPanel : public Module
s.subsections.push_back(ss);
provider->RegisterPage(&this->chanserv_akick);
+ ss.name = "Drop";
+ ss.url = "/chanserv/drop";
+ s.subsections.push_back(ss);
+ provider->RegisterPage(&this->chanserv_drop);
+
panel.sections.push_back(s);
}
@@ -198,6 +204,7 @@ class ModuleWebCPanel : public Module
provider->UnregisterPage(&this->chanserv_set);
provider->UnregisterPage(&this->chanserv_access);
provider->UnregisterPage(&this->chanserv_akick);
+ provider->UnregisterPage(&this->chanserv_drop);
provider->UnregisterPage(&this->memoserv_memos);
diff --git a/modules/extra/webcpanel/webcpanel.h b/modules/extra/webcpanel/webcpanel.h
index d21a95571..051bab790 100644
--- a/modules/extra/webcpanel/webcpanel.h
+++ b/modules/extra/webcpanel/webcpanel.h
@@ -162,6 +162,7 @@ namespace WebPanel
#include "pages/chanserv/set.h"
#include "pages/chanserv/access.h"
#include "pages/chanserv/akick.h"
+#include "pages/chanserv/drop.h"
#include "pages/memoserv/memos.h"