summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/extra/webcpanel/pages/chanserv/access.cpp24
-rw-r--r--modules/extra/webcpanel/pages/chanserv/akick.cpp23
-rw-r--r--modules/extra/webcpanel/pages/chanserv/drop.cpp7
-rw-r--r--modules/extra/webcpanel/pages/chanserv/info.cpp21
-rw-r--r--modules/extra/webcpanel/pages/chanserv/modes.cpp104
-rw-r--r--modules/extra/webcpanel/pages/chanserv/modes.h27
-rw-r--r--modules/extra/webcpanel/pages/chanserv/set.cpp75
-rw-r--r--modules/extra/webcpanel/pages/chanserv/utils.cpp29
-rw-r--r--modules/extra/webcpanel/pages/chanserv/utils.h10
-rw-r--r--modules/extra/webcpanel/templates/default/chanserv/access.html112
-rw-r--r--modules/extra/webcpanel/templates/default/chanserv/akick.html86
-rw-r--r--modules/extra/webcpanel/templates/default/chanserv/chanlist.html13
-rw-r--r--modules/extra/webcpanel/templates/default/chanserv/drop.html6
-rw-r--r--modules/extra/webcpanel/templates/default/chanserv/main.html16
-rw-r--r--modules/extra/webcpanel/templates/default/chanserv/modes.html57
-rw-r--r--modules/extra/webcpanel/templates/default/chanserv/set.html10
-rw-r--r--modules/extra/webcpanel/templates/default/header.html1
-rw-r--r--modules/extra/webcpanel/webcpanel.cpp10
-rw-r--r--modules/extra/webcpanel/webcpanel.h1
19 files changed, 452 insertions, 180 deletions
diff --git a/modules/extra/webcpanel/pages/chanserv/access.cpp b/modules/extra/webcpanel/pages/chanserv/access.cpp
index 06b363b53..ce36ecae9 100644
--- a/modules/extra/webcpanel/pages/chanserv/access.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/access.cpp
@@ -6,6 +6,7 @@
*/
#include "../../webcpanel.h"
+#include "utils.h"
WebCPanel::ChanServ::Access::Access(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage(cat, u)
{
@@ -15,23 +16,30 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
{
const Anope::string &chname = message.get_data["channel"];
+ BuildChanlist(page_name, na, replacements);
+
if (chname.empty())
{
- reply.error = HTTP_FOUND;
- reply.headers["Location"] = Anope::string("http") + (server->IsSSL() ? "s" : "") + "://" + message.headers["Host"] + "/chanserv/info";
- return true;
+ replacements["STOP"];
+ return ServePage("chanserv/access.html", server, page_name, client, message, reply, replacements);
}
ChannelInfo *ci = ChannelInfo::Find(chname);
if (!ci)
- return true;
+ {
+ replacements["STOP"];
+ replacements["MESSAGES"] = "Channel not registered.";
+ return ServePage("chanserv/access.html", server, page_name, client, message, reply, replacements);
+ }
AccessGroup u_access = ci->AccessFor(na->nc);
bool has_priv = na->nc->IsServicesOper() && na->nc->o->ot->HasPriv("chanserv/access/modify");
if (!u_access.HasPriv("ACCESS_LIST") && !has_priv)
- return true;
+ { replacements["STOP"];
+ replacements["MESSAGES"] = "Access denied.";
+ }
const ChanAccess *highest = u_access.Highest();
@@ -119,6 +127,7 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
}
replacements["ESCAPED_CHANNEL"] = HTTPUtils::URLEncode(chname);
+ replacements["ACCESS_CHANGE"] = ci->AccessFor(na->nc).HasPriv("ACCESS_CHANGE") ? "YES" : "NO";
for (unsigned i = 0; i < ci->GetAccessCount(); ++i)
{
@@ -127,7 +136,6 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
replacements["MASKS"] = HTTPUtils::Escape(access->mask);
replacements["ACCESSES"] = HTTPUtils::Escape(access->AccessSerialize());
replacements["CREATORS"] = HTTPUtils::Escape(access->creator);
- replacements["ACCESS_CHANGES"] = ci->AccessFor(na->nc).HasPriv("ACCESS_CHANGE") ? "YES" : "NO";
}
for (std::list<AccessProvider *>::const_iterator it = AccessProvider::GetProviders().begin(); it != AccessProvider::GetProviders().end(); ++it)
@@ -136,9 +144,7 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
replacements["PROVIDERS"] = a->name;
}
- TemplateFileServer page("chanserv/access.html");
- page.Serve(server, page_name, client, message, reply, replacements);
- return true;
+ return ServePage("chanserv/access.html", server, page_name, client, message, reply, replacements);
}
std::set<Anope::string> WebCPanel::ChanServ::Access::GetData()
diff --git a/modules/extra/webcpanel/pages/chanserv/akick.cpp b/modules/extra/webcpanel/pages/chanserv/akick.cpp
index 80a8a6a3d..cfcf58b28 100644
--- a/modules/extra/webcpanel/pages/chanserv/akick.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/akick.cpp
@@ -6,6 +6,7 @@
*/
#include "../../webcpanel.h"
+#include "utils.h"
WebCPanel::ChanServ::Akick::Akick(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage(cat, u)
{
@@ -15,23 +16,31 @@ bool WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::st
{
const Anope::string &chname = message.get_data["channel"];
+ BuildChanlist(page_name, na, replacements);
if (chname.empty())
{
- reply.error = HTTP_FOUND;
- reply.headers["Location"] = Anope::string("http") + (server->IsSSL() ? "s" : "") + "://" + message.headers["Host"] + "/chanserv/info";
- return true;
+ replacements["STOP"];
+ return ServePage("chanserv/akick.html", server, page_name, client, message, reply, replacements);
}
ChannelInfo *ci = ChannelInfo::Find(chname);
if (!ci)
- return true;
+ {
+ replacements["STOP"];
+ replacements["MESSAGES"] = "Channel not registered";
+ return ServePage("chanserv/akick.html", server, page_name, client, message, reply, replacements);
+ }
AccessGroup u_access = ci->AccessFor(na->nc);
bool has_priv = na->nc->IsServicesOper() && na->nc->o->ot->HasPriv("chanserv/access/modify");
if (!u_access.HasPriv("akick") && !has_priv)
- return true;
+ {
+ replacements["STOP"];
+ replacements["MESSAGES"] = "Permission denied.";
+ return ServePage("chanserv/akick.html", server, page_name, client, message, reply, replacements);
+ }
if (message.get_data["del"].empty() == false && message.get_data["mask"].empty() == false)
{
@@ -68,9 +77,7 @@ bool WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::st
replacements["REASONS"] = HTTPUtils::Escape(akick->reason);
}
- TemplateFileServer page("chanserv/akick.html");
- page.Serve(server, page_name, client, message, reply, replacements);
- return true;
+ return ServePage("chanserv/akick.html", server, page_name, client, message, reply, replacements);
}
std::set<Anope::string> WebCPanel::ChanServ::Akick::GetData()
diff --git a/modules/extra/webcpanel/pages/chanserv/drop.cpp b/modules/extra/webcpanel/pages/chanserv/drop.cpp
index 8d1342ed3..8f52f7f08 100644
--- a/modules/extra/webcpanel/pages/chanserv/drop.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/drop.cpp
@@ -6,6 +6,7 @@
*/
#include "../../webcpanel.h"
+#include "utils.h"
WebCPanel::ChanServ::Drop::Drop(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage (cat, u)
{
@@ -37,11 +38,11 @@ bool WebCPanel::ChanServ::Drop::OnRequest(HTTPProvider *server, const Anope::str
replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->name);
}
}
+ replacements["PAGE"] = page_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;
+ return ServePage("chanserv/drop.html", server, page_name, client, message, reply, replacements);
+
}
diff --git a/modules/extra/webcpanel/pages/chanserv/info.cpp b/modules/extra/webcpanel/pages/chanserv/info.cpp
index 95592706d..5338cc4b2 100644
--- a/modules/extra/webcpanel/pages/chanserv/info.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/info.cpp
@@ -6,6 +6,7 @@
*/
#include "../../webcpanel.h"
+#include "utils.h"
WebCPanel::ChanServ::Info::Info(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage(cat, u)
{
@@ -13,21 +14,13 @@ WebCPanel::ChanServ::Info::Info(const Anope::string &cat, const Anope::string &u
bool WebCPanel::ChanServ::Info::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
- std::deque<ChannelInfo *> queue;
- na->nc->GetChannelReferences(queue);
- for (unsigned i = 0; i < queue.size(); ++i)
- {
- ChannelInfo *ci = queue[i];
+ const Anope::string &chname = message.get_data["channel"];
- if (ci->AccessFor(na->nc).HasPriv("SET") || ci->AccessFor(na->nc).HasPriv("ACCESS_LIST"))
- {
- replacements["CHANNEL_NAMES"] = ci->name;
- replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->name);
- }
- }
+ if (!chname.empty())
+ replacements["ESCAPED_CHANNEL"] = HTTPUtils::URLEncode(chname);
- TemplateFileServer page("chanserv/main.html");
- page.Serve(server, page_name, client, message, reply, replacements);
- return true;
+ BuildChanlist("/chanserv/set", na, replacements);
+
+ return ServePage("chanserv/main.html", server, page_name, client, message, reply, replacements);
}
diff --git a/modules/extra/webcpanel/pages/chanserv/modes.cpp b/modules/extra/webcpanel/pages/chanserv/modes.cpp
new file mode 100644
index 000000000..d29fff723
--- /dev/null
+++ b/modules/extra/webcpanel/pages/chanserv/modes.cpp
@@ -0,0 +1,104 @@
+/*
+ * (C) 2003-2013 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ */
+
+#include "../../webcpanel.h"
+#include "utils.h"
+
+WebCPanel::ChanServ::Modes::Modes(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage(cat, u)
+{
+}
+
+bool WebCPanel::ChanServ::Modes::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+{
+ const Anope::string &chname = message.get_data["channel"];
+ const Anope::string &mode = message.get_data["m"];
+
+ BuildChanlist(page_name, na, replacements);
+
+ if (chname.empty())
+ {
+ replacements["STOP"];
+ return ServePage("chanserv/modes.html", server, page_name, client, message, reply, replacements);
+ }
+
+ ChannelInfo *ci = ChannelInfo::Find(chname);
+
+ if (!ci)
+ {
+ replacements["STOP"];
+ return ServePage("chanserv/modes.html", server, page_name, client, message, reply, replacements);
+ }
+
+ Channel *c = Channel::Find(chname);
+
+ if (!c)
+ {
+ replacements["MESSAGES"] = "Channel is empty / does not exist on the network.";
+ replacements["STOP"];
+ return ServePage("chanserv/modes.html", server, page_name, client, message, reply, replacements);
+ }
+
+ AccessGroup u_access = ci->AccessFor(na->nc);
+ bool has_priv = na->nc->IsServicesOper() && na->nc->o->ot->HasPriv("chanserv/administration");
+
+ if (!u_access.HasPriv("MODE") && !has_priv)
+ {
+ replacements["MESSAGES"] = "Access denied.";
+ replacements["STOP"];
+ return ServePage("chanserv/modes.html", server, page_name, client, message, reply, replacements);
+ }
+
+ /* build a list with the names of all listmodes */
+ for (std::vector<ChannelMode *>::const_iterator it = ModeManager::GetChannelModes().begin(); it != ModeManager::GetChannelModes().end(); ++it)
+ {
+ /* "NAMEBASE" is a special mode from InspIRCds m_namedmodes, we dont want this here*/
+ if ((*it) && (*it)->type == MODE_LIST && (*it)->name != "NAMEBASE")
+ replacements["LISTMODES"] = (*it)->name;
+ }
+
+ ChannelMode *cm = ModeManager::FindChannelModeByName(mode);
+ if (cm)
+ {
+ if (message.get_data["del"].empty() == false && message.get_data["mask"].empty() == false)
+ {
+ std::vector<Anope::string> params;
+ params.push_back(ci->name);
+ params.push_back("SET");
+ params.push_back("-" + Anope::string(cm->mchar));
+ params.push_back(message.get_data["mask"]);
+ WebPanel::RunCommand(na->nc->display, na->nc, "ChanServ", "chanserv/mode", params, replacements);
+ }
+ else if (message.post_data["mask"].empty() == false)
+ {
+ std::vector<Anope::string> params;
+ params.push_back(ci->name);
+ params.push_back("SET");
+ params.push_back("+" + Anope::string(cm->mchar));
+ params.push_back(message.post_data["mask"]);
+ WebPanel::RunCommand(na->nc->display, na->nc, "ChanServ", "chanserv/mode", params, replacements);
+ }
+
+ for (Channel::ModeList::const_iterator it = c->GetModes().begin(); it != c->GetModes().end(); ++it)
+ {
+ if (it->first == mode)
+ replacements["MASKS"] = HTTPUtils::Escape(it->second);
+ }
+ }
+
+ replacements["ESCAPED_CHANNEL"] = HTTPUtils::URLEncode(chname);
+ replacements["ESCAPED_MODE"] = HTTPUtils::URLEncode(mode);
+
+ return ServePage("chanserv/modes.html", server, page_name, client, message, reply, replacements);
+}
+
+std::set<Anope::string> WebCPanel::ChanServ::Modes::GetData()
+{
+ std::set<Anope::string> v;
+ v.insert("channel");
+ return v;
+}
+
diff --git a/modules/extra/webcpanel/pages/chanserv/modes.h b/modules/extra/webcpanel/pages/chanserv/modes.h
new file mode 100644
index 000000000..2b5a58852
--- /dev/null
+++ b/modules/extra/webcpanel/pages/chanserv/modes.h
@@ -0,0 +1,27 @@
+/*
+ * (C) 2003-2013 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ */
+
+namespace WebCPanel
+{
+
+namespace ChanServ
+{
+
+class Modes : public WebPanelProtectedPage
+{
+ public:
+ Modes(const Anope::string &cat, const Anope::string &u);
+
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+
+ std::set<Anope::string> GetData() anope_override;
+};
+
+}
+
+}
+
diff --git a/modules/extra/webcpanel/pages/chanserv/set.cpp b/modules/extra/webcpanel/pages/chanserv/set.cpp
index d0b54d15a..42a3fcfe6 100644
--- a/modules/extra/webcpanel/pages/chanserv/set.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/set.cpp
@@ -6,6 +6,7 @@
*/
#include "../../webcpanel.h"
+#include "utils.h"
WebCPanel::ChanServ::Set::Set(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage(cat, u)
{
@@ -14,20 +15,32 @@ WebCPanel::ChanServ::Set::Set(const Anope::string &cat, const Anope::string &u)
bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
const Anope::string &chname = message.get_data["channel"];
+ bool can_set = false;
+
+ BuildChanlist(page_name, na, replacements);
if (chname.empty())
{
- reply.error = HTTP_FOUND;
- reply.headers["Location"] = Anope::string("http") + (server->IsSSL() ? "s" : "") + "://" + message.headers["Host"] + "/chanserv/info";
- return true;
+ replacements["STOP"];
+ return ServePage("chanserv/set.html", server, page_name, client, message, reply, replacements);
}
ChannelInfo *ci = ChannelInfo::Find(chname);
- if (!ci || !ci->AccessFor(na->nc).HasPriv("SET"))
- return true;
+ if (!ci)
+ {
+ replacements["STOP"];
+ return ServePage("chanserv/set.html", server, page_name, client, message, reply, replacements);
+ }
- if (message.post_data.empty() == false)
+
+ if (ci->AccessFor(na->nc).HasPriv("SET"))
+ {
+ replacements["CAN_SET"];
+ can_set = true;
+ }
+
+ if (can_set && message.post_data.empty() == false)
{
if (ci->HasExt("KEEPTOPIC") != message.post_data.count("keeptopic"))
{
@@ -102,30 +115,32 @@ bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri
replacements["LAST_TOPIC_SETTER"] = HTTPUtils::Escape(ci->last_topic_setter);
}
- if (ci->HasExt("KEEPTOPIC"))
- replacements["KEEPTOPIC"];
-
- if (ci->HasExt("PEACE"))
- replacements["PEACE"];
-
- if (ci->HasExt("CS_PRIVATE"))
- replacements["PRIVATE"];
-
- if (ci->HasExt("RESTRICTED"))
- replacements["RESTRICTED"];
-
- if (ci->HasExt("CS_SECURE"))
- replacements["SECURE"];
-
- if (ci->HasExt("SECUREOPS"))
- replacements["SECUREOPS"];
-
- if (ci->HasExt("TOPICLOCK"))
- replacements["TOPICLOCK"];
-
- TemplateFileServer page("chanserv/set.html");
- page.Serve(server, page_name, client, message, reply, replacements);
- return true;
+ if (can_set)
+ {
+ if (ci->HasExt("KEEPTOPIC"))
+ replacements["KEEPTOPIC"];
+
+ if (ci->HasExt("PEACE"))
+ replacements["PEACE"];
+
+ if (ci->HasExt("CS_PRIVATE"))
+ replacements["PRIVATE"];
+
+ if (ci->HasExt("RESTRICTED"))
+ replacements["RESTRICTED"];
+
+ if (ci->HasExt("CS_SECURE"))
+ replacements["SECURE"];
+
+ if (ci->HasExt("SECUREOPS"))
+ replacements["SECUREOPS"];
+
+ if (ci->HasExt("TOPICLOCK"))
+ replacements["TOPICLOCK"];
+ }
+
+ return ServePage("chanserv/set.html", server, page_name, client, message, reply, replacements);
+
}
std::set<Anope::string> WebCPanel::ChanServ::Set::GetData()
diff --git a/modules/extra/webcpanel/pages/chanserv/utils.cpp b/modules/extra/webcpanel/pages/chanserv/utils.cpp
new file mode 100644
index 000000000..d5ca188e4
--- /dev/null
+++ b/modules/extra/webcpanel/pages/chanserv/utils.cpp
@@ -0,0 +1,29 @@
+/*
+ * (C) 2003-2013 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ */
+
+#include "../../webcpanel.h"
+
+void BuildChanlist(const Anope::string &page_name, NickAlias *na, TemplateFileServer::Replacements &replacements)
+{
+ std::deque<ChannelInfo *> queue;
+ na->nc->GetChannelReferences(queue);
+ for (unsigned i = 0; i < queue.size(); ++i)
+ {
+ ChannelInfo *ci = queue[i];
+ replacements["CHANNEL_NAMES"] = ci->name;
+ replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->name);
+ }
+ replacements["PAGE"] = page_name;
+ return;
+}
+
+bool ServePage(const Anope::string &page, HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, TemplateFileServer::Replacements &replacements)
+{
+ TemplateFileServer Page(page);
+ Page.Serve(server, page_name, client, message, reply, replacements);
+ return 1;
+} \ No newline at end of file
diff --git a/modules/extra/webcpanel/pages/chanserv/utils.h b/modules/extra/webcpanel/pages/chanserv/utils.h
new file mode 100644
index 000000000..cf4683936
--- /dev/null
+++ b/modules/extra/webcpanel/pages/chanserv/utils.h
@@ -0,0 +1,10 @@
+/*
+ * (C) 2003-2013 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ */
+
+void BuildChanlist(const Anope::string &, NickAlias *, TemplateFileServer::Replacements &);
+
+bool ServePage(const Anope::string &, HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, TemplateFileServer::Replacements &);
diff --git a/modules/extra/webcpanel/templates/default/chanserv/access.html b/modules/extra/webcpanel/templates/default/chanserv/access.html
index 5b02c068a..5364a4e94 100644
--- a/modules/extra/webcpanel/templates/default/chanserv/access.html
+++ b/modules/extra/webcpanel/templates/default/chanserv/access.html
@@ -1,4 +1,5 @@
{INCLUDE header.html}
+{INCLUDE chanserv/chanlist.html}
<div class="panel-heading">Access List</div>
<div class="panel-body">
{FOR M IN MESSAGES}
@@ -7,64 +8,71 @@
</div>
{END FOR}
- {IF EXISTS ACCESSES}
- <table id="tableNSAccess" class="table table-hover">
- <thead>
- <tr>
- <th>Mask</th>
- <th>Access</th>
- <th>Creator</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {FOR MASK,ACCESS,CREATOR,ACCESS_CHANGE IN MASKS,ACCESSES,CREATORS,ACCESS_CHANGES}
- <tr>
- <td style="font-weight: bold;">{MASK}</td>
- <td>{ACCESS}</td>
- <td>{CREATOR}</td>
- {IF EQ ACCESS_CHANGE YES}
- <td><a href="/chanserv/access?channel={ESCAPED_CHANNEL}&mask={MASK}&del=1" class="btn btn-sm btn-danger">Delete</a></td>
- {END IF}
- </tr>
- {END FOR}
- </tbody>
- </table>
+ {IF EXISTS STOP}
{ELSE}
- <em>Access list is empty.</em>
- {END IF}
+ {IF EXISTS ACCESSES}
+ <table id="tableNSAccess" class="table table-hover">
+ <thead>
+ <tr>
+ <th>Mask</th>
+ <th>Access</th>
+ <th>Creator</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {FOR MASK,ACCESS,CREATOR IN MASKS,ACCESSES,CREATORS}
+ <tr>
+ <td style="font-weight: bold;">{MASK}</td>
+ <td>{ACCESS}</td>
+ <td>{CREATOR}</td>
+ {IF EQ ACCESS_CHANGE YES}
+ <td><a href="/chanserv/access?channel={ESCAPED_CHANNEL}&mask={MASK}&del=1" class="btn btn-sm btn-danger">Delete</a></td>
+ {ELSE}
+ <td></td>
+ {END IF}
+ </tr>
+ {END FOR}
+ </tbody>
+ </table>
+ {ELSE}
+ <em>Access list is empty.</em>
+ {END IF}
- <hr>
+ <hr>
- <h4>Add an access entry</h4>
- <form class="form-horizontal" method="post" action="/chanserv/access?channel={ESCAPED_CHANNEL}">
- <div class="form-group">
- <label class="control-label col-lg-2" for="mask">Mask:</label>
- <div class="col-lg-6">
- <input class="form-control" type="text" name="mask" id="mask" placeholder="Valid HostMask">
+ {IF EQ ACCESS_CHANGE YES}
+ <h4>Add an access entry</h4>
+ <form class="form-horizontal" method="post" action="/chanserv/access?channel={ESCAPED_CHANNEL}">
+ <div class="form-group">
+ <label class="control-label col-lg-2" for="mask">Mask:</label>
+ <div class="col-lg-6">
+ <input class="form-control" type="text" name="mask" id="mask" placeholder="Valid HostMask">
+ </div>
</div>
- </div>
- <div class="form-group">
- <label class="control-label col-lg-2" for="access">Access:</label>
- <div class="col-lg-6">
- <input class="form-control" type="text" name="access" id="access" placeholder="Access level">
+ <div class="form-group">
+ <label class="control-label col-lg-2" for="access">Access:</label>
+ <div class="col-lg-6">
+ <input class="form-control" type="text" name="access" id="access" placeholder="Access level">
+ </div>
</div>
- </div>
- <div class="form-group">
- <label class="control-label col-lg-2" for="reason">Provider:</label>
- <div class="col-lg-6">
- <select name="provider" class="form-control">
- {FOR PROVIDER IN PROVIDERS}
- <option value="{PROVIDER}">{PROVIDER}</option>
- {END FOR}
- </select>
+ <div class="form-group">
+ <label class="control-label col-lg-2" for="reason">Provider:</label>
+ <div class="col-lg-6">
+ <select name="provider" class="form-control">
+ {FOR PROVIDER IN PROVIDERS}
+ <option value="{PROVIDER}">{PROVIDER}</option>
+ {END FOR}
+ </select>
+ </div>
</div>
- </div>
- <div class="form-group">
- <div class="col-lg-offset-2 col-lg-6">
- <button type="submit" class="btn btn-primary">Send</button>
+ <div class="form-group">
+ <div class="col-lg-offset-2 col-lg-6">
+ <button type="submit" class="btn btn-primary">Send</button>
+ </div>
</div>
- </div>
- </form>
+ </form>
+ {END IF}
+ {END IF}
</div>
{INCLUDE footer.html}
diff --git a/modules/extra/webcpanel/templates/default/chanserv/akick.html b/modules/extra/webcpanel/templates/default/chanserv/akick.html
index 3b6a2f190..1483cd660 100644
--- a/modules/extra/webcpanel/templates/default/chanserv/akick.html
+++ b/modules/extra/webcpanel/templates/default/chanserv/akick.html
@@ -1,4 +1,5 @@
{INCLUDE header.html}
+{INCLUDE chanserv/chanlist.html}
<div class="panel-heading">Akick List</div>
<div class="panel-body">
{FOR M IN MESSAGES}
@@ -7,52 +8,55 @@
</div>
{END FOR}
- {IF EXISTS MASKS}
- <table id="tableNSAccess" class="table table-hover">
- <thead>
- <tr>
- <th>Mask</th>
- <th>Reason</th>
- <th>Creator</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {FOR MASK,REASON,CREATOR IN MASKS,REASONS,CREATORS}
- <tr>
- <td style="font-weight: bold;">{MASK}</td>
- <td>{REASON}</td>
- <td>{CREATOR}</td>
- <td><a href="/chanserv/akick?channel={ESCAPED_CHANNEL}&mask={MASK}&del=1" class="btn btn-sm btn-danger">Delete</a></td>
- </tr>
- {END FOR}
- </tbody>
- </table>
+ {IF EXISTS STOP}
{ELSE}
- <em>Akick list is empty.</em>
- {END IF}
+ {IF EXISTS MASKS}
+ <table id="tableNSAccess" class="table table-hover">
+ <thead>
+ <tr>
+ <th>Mask</th>
+ <th>Reason</th>
+ <th>Creator</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {FOR MASK,REASON,CREATOR IN MASKS,REASONS,CREATORS}
+ <tr>
+ <td style="font-weight: bold;">{MASK}</td>
+ <td>{REASON}</td>
+ <td>{CREATOR}</td>
+ <td><a href="/chanserv/akick?channel={ESCAPED_CHANNEL}&mask={MASK}&del=1" class="btn btn-sm btn-danger">Delete</a></td>
+ </tr>
+ {END FOR}
+ </tbody>
+ </table>
+ {ELSE}
+ <em>Akick list is empty.</em>
+ {END IF}
- <hr>
+ <hr>
- <h4>Add an akick entry</h4>
- <form class="form-horizontal" method="post" action="/chanserv/akick?channel={ESCAPED_CHANNEL}">
- <div class="form-group">
- <label class="control-label col-lg-2" for="mask">Mask:</label>
- <div class="col-lg-6">
- <input class="form-control" type="text" name="mask" id="mask" placeholder="Valid HostMask">
+ <h4>Add an akick entry</h4>
+ <form class="form-horizontal" method="post" action="/chanserv/akick?channel={ESCAPED_CHANNEL}">
+ <div class="form-group">
+ <label class="control-label col-lg-2" for="mask">Mask:</label>
+ <div class="col-lg-6">
+ <input class="form-control" type="text" name="mask" id="mask" placeholder="Valid HostMask">
+ </div>
</div>
- </div>
- <div class="form-group">
- <label class="control-label col-lg-2" for="reason">Reason:</label>
- <div class="col-lg-6">
- <input class="form-control" type="text" name="reason" id="reason" placeholder="Reason for AKICK">
+ <div class="form-group">
+ <label class="control-label col-lg-2" for="reason">Reason:</label>
+ <div class="col-lg-6">
+ <input class="form-control" type="text" name="reason" id="reason" placeholder="Reason for AKICK">
+ </div>
</div>
- </div>
- <div class="form-group">
- <div class="col-lg-offset-2 col-lg-6">
- <button type="submit" class="btn btn-primary">Send</button>
+ <div class="form-group">
+ <div class="col-lg-offset-2 col-lg-6">
+ <button type="submit" class="btn btn-primary">Send</button>
+ </div>
</div>
- </div>
- </form>
+ </form>
+ {END IF}
</div>
{INCLUDE footer.html}
diff --git a/modules/extra/webcpanel/templates/default/chanserv/chanlist.html b/modules/extra/webcpanel/templates/default/chanserv/chanlist.html
new file mode 100644
index 000000000..50e3a60f6
--- /dev/null
+++ b/modules/extra/webcpanel/templates/default/chanserv/chanlist.html
@@ -0,0 +1,13 @@
+<!--- <div class="panel-heading">Channels you have access in</div> -->
+<div class="panel-body">
+ {IF EXISTS CHANNEL_NAMES}
+ <div>
+ <h3 style="margin: -12px 0 20px 0;"><small>Choose a channel to access it's Settings, Access or Akick pages.</small></h3>
+ {FOR CH,ECH IN CHANNEL_NAMES,ESCAPED_CHANNEL_NAMES}
+ <td><a href="{PAGE}?channel={ECH}" class="btn btn-sm btn-primary {IF EQ ECH ESCAPED_CHANNEL}disabled{END IF}">{CH}</a></td>
+ {END FOR}
+ </div>
+ {ELSE}
+ <em>You don't have access in any channel</em><br>
+ {END IF}
+</div><br>
diff --git a/modules/extra/webcpanel/templates/default/chanserv/drop.html b/modules/extra/webcpanel/templates/default/chanserv/drop.html
index 1b7e788d0..23cb42a1e 100644
--- a/modules/extra/webcpanel/templates/default/chanserv/drop.html
+++ b/modules/extra/webcpanel/templates/default/chanserv/drop.html
@@ -1,4 +1,5 @@
{INCLUDE header.html}
+{INCLUDE chanserv/chanlist.html}
<div class="panel-heading">Channels you can drop</div>
<div class="panel-body">
{FOR M IN MESSAGES}
@@ -7,11 +8,6 @@
</div>
{END FOR}
- <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}
<div class="alert alert-danger" style="margin-top: 15px; margin-bottom: 0; padding-bottom: 0;">
<h4>Drop Channel <strong>{CHANNEL_DROP}</strong>?</h4>
diff --git a/modules/extra/webcpanel/templates/default/chanserv/main.html b/modules/extra/webcpanel/templates/default/chanserv/main.html
index 8b88970e8..e77626f31 100644
--- a/modules/extra/webcpanel/templates/default/chanserv/main.html
+++ b/modules/extra/webcpanel/templates/default/chanserv/main.html
@@ -1,17 +1,3 @@
{INCLUDE header.html}
- <div class="panel-heading">Channels you have access in</div>
- <div class="panel-body">
- {IF EXISTS CHANNEL_NAMES}
- <div>
- <h3 style="margin: -12px 0 20px 0;"><small>Choose a channel to access it's Settings, Access or Akick pages.</small></h3>
- <ul id="channelList">
- {FOR CH,ECH IN CHANNEL_NAMES,ESCAPED_CHANNEL_NAMES}
- <li><a href="/chanserv/set?channel={ECH}">{CH}</a></li>
- {END FOR}
- </ul>
- </div>
- {ELSE}
- <em>You don't have access in any channel</em><br>
- {END IF}
- </div>
+{INCLUDE chanserv/chanlist.html}
{INCLUDE footer.html}
diff --git a/modules/extra/webcpanel/templates/default/chanserv/modes.html b/modules/extra/webcpanel/templates/default/chanserv/modes.html
new file mode 100644
index 000000000..e441797dc
--- /dev/null
+++ b/modules/extra/webcpanel/templates/default/chanserv/modes.html
@@ -0,0 +1,57 @@
+{INCLUDE header.html}
+{INCLUDE chanserv/chanlist.html}
+ <div class="panel-heading">Channel Mode List</div>
+ <div class="panel-body">
+ {FOR M IN MESSAGES}
+ <div class="alert alert-info">
+ {M}<br>
+ </div>
+ {END FOR}
+
+ {IF EXISTS STOP}
+ {ELSE}
+ {FOR LM IN LISTMODES}
+ <td><a href="/chanserv/modes?channel={ESCAPED_CHANNEL}&m={LM}" class="btn btn-sm btn-primary {IF EQ LM ESCAPED_MODE}disabled{END IF}">{LM}</a></td>
+ {END FOR}
+ <br>
+
+ {IF EXISTS MASKS}
+ <table id="tableNSAccess" class="table table-hover">
+ <thead>
+ <tr>
+ <th>Mask</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {FOR MASK IN MASKS}
+ <tr>
+ <td style="font-weight: bold;">{MASK}</td>
+ <td><a href="/chanserv/modes?channel={ESCAPED_CHANNEL}&m={ESCAPED_MODE}&mask={MASK}&del=1" class="btn btn-sm btn-danger">Delete</a></td>
+ </tr>
+ {END FOR}
+ </tbody>
+ </table>
+ {ELSE}
+ <em>Nothing to display.</em>
+ {END IF}
+
+ <hr>
+
+ <h4>Set a new mode</h4>
+ <form class="form-horizontal" method="post" action="/chanserv/modes?channel={ESCAPED_CHANNEL}&m={ESCAPED_MODE}">
+ <div class="form-group">
+ <label class="control-label col-lg-2" for="mask">Mask:</label>
+ <div class="col-lg-6">
+ <input class="form-control" type="text" name="mask" id="mask" placeholder="Valid HostMask">
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="col-lg-offset-2 col-lg-6">
+ <button type="submit" class="btn btn-primary">Send</button>
+ </div>
+ </div>
+ </form>
+ {END IF}
+ </div>
+{INCLUDE footer.html}
diff --git a/modules/extra/webcpanel/templates/default/chanserv/set.html b/modules/extra/webcpanel/templates/default/chanserv/set.html
index 0c2596dc6..e8522cef9 100644
--- a/modules/extra/webcpanel/templates/default/chanserv/set.html
+++ b/modules/extra/webcpanel/templates/default/chanserv/set.html
@@ -1,4 +1,5 @@
{INCLUDE header.html}
+{INCLUDE chanserv/chanlist.html}
<div class="panel-heading">Channel Information</div>
<div class="panel-body">
{FOR M IN MESSAGES}
@@ -7,7 +8,9 @@
</div>
{END FOR}
- <form method="post" action="/chanserv/set?channel={CHANNEL_ESCAPED}">
+ {IF EXISTS STOP}
+ {ELSE}
+ {IF EXISTS CAN_SET}<form method="post" action="/chanserv/set?channel={CHANNEL_ESCAPED}">{END IF}
<table id="tableInfo" class="table table-hover">
<tr>
<td>Channel Name</td>
@@ -43,6 +46,7 @@
<td>{LAST_TOPIC_SETTER}</td>
</tr>
{END IF}
+ {IF EXISTS CAN_SET}
<tr>
<td>Keep topic</td>
<td><input type="checkbox" name="keeptopic" value="on" {IF EXISTS KEEPTOPIC}checked{END IF}></td>
@@ -75,7 +79,9 @@
<td></td>
<td><button type="submit" class="btn btn-primary">Save</button></td>
</tr>
+ {END IF}
</table>
- </form>
+ {IF EXISTS CAN_SET}</form>{END IF}
+ {END IF}
</div>
{INCLUDE footer.html}
diff --git a/modules/extra/webcpanel/templates/default/header.html b/modules/extra/webcpanel/templates/default/header.html
index 9d9710c30..93d2c31fb 100644
--- a/modules/extra/webcpanel/templates/default/header.html
+++ b/modules/extra/webcpanel/templates/default/header.html
@@ -17,6 +17,7 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.2.0/respond.js"></script>
<![endif]-->
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>{TITLE}</title>
</head>
<body>
diff --git a/modules/extra/webcpanel/webcpanel.cpp b/modules/extra/webcpanel/webcpanel.cpp
index c0bd841a0..4f4dca97e 100644
--- a/modules/extra/webcpanel/webcpanel.cpp
+++ b/modules/extra/webcpanel/webcpanel.cpp
@@ -32,6 +32,7 @@ class ModuleWebCPanel : public Module
WebCPanel::ChanServ::Set chanserv_set;
WebCPanel::ChanServ::Access chanserv_access;
WebCPanel::ChanServ::Akick chanserv_akick;
+ WebCPanel::ChanServ::Modes chanserv_modes;
WebCPanel::ChanServ::Drop chanserv_drop;
WebCPanel::MemoServ::Memos memoserv_memos;
@@ -48,7 +49,8 @@ class ModuleWebCPanel : public Module
index("/"), logout("/logout"), _register("/register"), confirm("/confirm"),
nickserv_info("NickServ", "/nickserv/info"), nickserv_cert("NickServ", "/nickserv/cert"), nickserv_access("NickServ", "/nickserv/access"), nickserv_alist("NickServ", "/nickserv/alist"),
chanserv_info("ChanServ", "/chanserv/info"), chanserv_set("ChanServ", "/chanserv/set"), chanserv_access("ChanServ", "/chanserv/access"), chanserv_akick("ChanServ", "/chanserv/akick"),
- chanserv_drop("ChanServ", "/chanserv/drop"), memoserv_memos("MemoServ", "/memoserv/memos"), hostserv_request("HostServ", "/hostserv/request"), operserv_akill("OperServ", "/operserv/akill")
+ chanserv_modes("ChanServ", "/chanserv/modes"), chanserv_drop("ChanServ", "/chanserv/drop"), memoserv_memos("MemoServ", "/memoserv/memos"), hostserv_request("HostServ", "/hostserv/request"),
+ operserv_akill("OperServ", "/operserv/akill")
{
me = this;
@@ -133,6 +135,11 @@ class ModuleWebCPanel : public Module
s.subsections.push_back(ss);
provider->RegisterPage(&this->chanserv_akick);
+ ss.name = "Modes";
+ ss.url = "/chanserv/modes";
+ s.subsections.push_back(ss);
+ provider->RegisterPage(&this->chanserv_modes);
+
ss.name = "Drop";
ss.url = "/chanserv/drop";
s.subsections.push_back(ss);
@@ -210,6 +217,7 @@ class ModuleWebCPanel : public Module
provider->UnregisterPage(&this->chanserv_set);
provider->UnregisterPage(&this->chanserv_access);
provider->UnregisterPage(&this->chanserv_akick);
+ provider->UnregisterPage(&this->chanserv_modes);
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 ebce325d2..b04859376 100644
--- a/modules/extra/webcpanel/webcpanel.h
+++ b/modules/extra/webcpanel/webcpanel.h
@@ -166,6 +166,7 @@ namespace WebPanel
#include "pages/chanserv/set.h"
#include "pages/chanserv/access.h"
#include "pages/chanserv/akick.h"
+#include "pages/chanserv/modes.h"
#include "pages/chanserv/drop.h"
#include "pages/memoserv/memos.h"