From 4338ae5cc521a5348a4dfc9574d05cd33e12bfa0 Mon Sep 17 00:00:00 2001 From: Vasily Fomin Date: Sun, 1 Jun 2014 21:37:39 +0200 Subject: [PATCH] Show empty checkbox if module can be loaded by the topic column. Fix const correctnes of the CModInfo::SupportsType method. --- include/znc/Modules.h | 2 +- .../data/webadmin/tmpl/add_edit_network.tmpl | 16 +++++++++++---- modules/data/webadmin/tmpl/add_edit_user.tmpl | 20 +++++++++++++------ modules/data/webadmin/tmpl/settings.tmpl | 20 +++++++++++++------ modules/webadmin.cpp | 12 ++++++++--- 5 files changed, 50 insertions(+), 20 deletions(-) diff --git a/include/znc/Modules.h b/include/znc/Modules.h index 6ffa9485..ca8e1182 100644 --- a/include/znc/Modules.h +++ b/include/znc/Modules.h @@ -203,7 +203,7 @@ public: return (GetName() < Info.GetName()); } - bool SupportsType(EModuleType eType) { + bool SupportsType(EModuleType eType) const { return m_seType.find(eType) != m_seType.end(); } diff --git a/modules/data/webadmin/tmpl/add_edit_network.tmpl b/modules/data/webadmin/tmpl/add_edit_network.tmpl index 1e84593f..118f875a 100644 --- a/modules/data/webadmin/tmpl/add_edit_network.tmpl +++ b/modules/data/webadmin/tmpl/add_edit_network.tmpl @@ -184,13 +184,21 @@ - - + + + checked="checked" + + disabled="disabled"/> - - + + + checked="checked" + + disabled="disabled"/> diff --git a/modules/data/webadmin/tmpl/add_edit_user.tmpl b/modules/data/webadmin/tmpl/add_edit_user.tmpl index 489ef828..fa0f85f2 100644 --- a/modules/data/webadmin/tmpl/add_edit_user.tmpl +++ b/modules/data/webadmin/tmpl/add_edit_user.tmpl @@ -194,14 +194,22 @@ - - - + + + checked="checked" + + disabled="disabled"/> + - - - + + + checked="checked" + + disabled="disabled"/> + diff --git a/modules/data/webadmin/tmpl/settings.tmpl b/modules/data/webadmin/tmpl/settings.tmpl index f3216acd..a599c180 100644 --- a/modules/data/webadmin/tmpl/settings.tmpl +++ b/modules/data/webadmin/tmpl/settings.tmpl @@ -189,9 +189,13 @@ - - - + + + checked="checked" + + disabled="disabled"/> + @@ -199,9 +203,13 @@ - - - + + + checked="checked" + + disabled="disabled"/> + diff --git a/modules/webadmin.cpp b/modules/webadmin.cpp index becf1853..3ce2637f 100644 --- a/modules/webadmin.cpp +++ b/modules/webadmin.cpp @@ -753,9 +753,11 @@ public: } // Check if module is loaded globally + l["CanBeLoadedGlobally"] = CString(Info.SupportsType(CModInfo::GlobalModule)); l["LoadedGlobally"] = CString(CZNC::Get().GetModules().FindModule(Info.GetName()) != NULL); // Check if module is loaded by user + l["CanBeLoadedByUser"] = CString(Info.SupportsType(CModInfo::UserModule)); l["LoadedByUser"] = CString(pUser->GetModules().FindModule(Info.GetName()) != NULL); if (!spSession->IsAdmin() && pUser->DenyLoadMod()) { @@ -1227,6 +1229,7 @@ public: networksWithRenderedModuleCount++; } } + l["CanBeLoadedByNetwork"] = CString(Info.SupportsType(CModInfo::NetworkModule)); l["LoadedByAllNetworks"] = CString(networksWithRenderedModuleCount == userNetworks.size()); l["LoadedBySomeNetworks"] = CString(networksWithRenderedModuleCount != 0); } @@ -1237,7 +1240,7 @@ public: l["Disabled"] = "true"; } } - + l["CanBeLoadedGlobally"] = CString(Info.SupportsType(CModInfo::GlobalModule)); // Check if module is loaded globally l["LoadedGlobally"] = CString(CZNC::Get().GetModules().FindModule(Info.GetName()) != NULL); @@ -1673,10 +1676,13 @@ public: } } } - l["LoadedByAllUsers"] = CString(usersWithRenderedModuleCount == allUsers.size()); - l["LoadedBySomeUsers"] = CString(usersWithRenderedModuleCount != 0); + l["CanBeLoadedByNetwork"] = CString(Info.SupportsType(CModInfo::NetworkModule)); l["LoadedByAllNetworks"] = CString(networksWithRenderedModuleCount == networksCount); l["LoadedBySomeNetworks"] = CString(networksWithRenderedModuleCount != 0); + + l["CanBeLoadedByUser"] = CString(Info.SupportsType(CModInfo::UserModule)); + l["LoadedByAllUsers"] = CString(usersWithRenderedModuleCount == allUsers.size()); + l["LoadedBySomeUsers"] = CString(usersWithRenderedModuleCount != 0); } return true;