Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add "Loaded" flag to the user page.

  • Loading branch information...
commit 3ad285243d282270f7195c6efc8a3a7df32b9658 1 parent 78f7897
@devfom devfom authored
View
18 modules/data/webadmin/tmpl/add_edit_user.tmpl
@@ -172,6 +172,8 @@
<td>Name</td>
<td>Arguments</td>
<td>Description</td>
+ <td>Loaded globally</td>
+ <td>Loaded by networks</td>
</tr>
</thead>
<tbody>
@@ -191,6 +193,22 @@
<? ENDIF ?>
</td>
<td class="mod_descr"><? VAR Description ?></td>
+ <td align="center">
+ <? IF LoadedGlobally ?>
+ <input type="checkbox" name="loaded_globally" id="loaded_globally_<? VAR Name ?>" checked="checked" disabled="disabled"/>
+ <? ENDIF ?>
+ </td>
+ <td align="center">
+ <? IF LoadedByAllNetworks ?>
+ <input type="checkbox" name="loaded_by_network" id="loaded_by_net_<? VAR Name ?>" checked="checked" disabled="disabled"/>
+ <? ELSE IF LoadedBySomeNetworks ?>
+ <input type="checkbox" name="loaded_by_network" id="loaded_by_net_<? VAR Name ?>" checked="checked" disabled="disabled"/>
+ <script type="text/javascript">
+ var checkbox = document.getElementById("loaded_by_net_<? VAR Name ?>");
+ checkbox.indeterminate = true;
+ </script>
+ <? ENDIF ?>
+ </td>
</tr>
<? ENDLOOP ?>
View
20 modules/webadmin.cpp
@@ -1225,6 +1225,26 @@ class CWebAdminMod : public CModule {
}
}
+ // Check if module is loaded globally
+ l["LoadedGlobally"] = CString(CZNC::Get().GetModules().FindModule(Info.GetName()) != NULL);
+
+ // Check if module is loaded by all or some networks
+ const vector<CIRCNetwork*>& userNetworks = pUser->GetNetworks();
+ unsigned int networksWithRenderedModuleCount = 0;
+ for (unsigned int networkIndex = 0; networkIndex < userNetworks.size(); ++networkIndex) {
+ const CIRCNetwork* pCurrentNetwork = userNetworks[networkIndex];
+ const CModules& networkModules = pCurrentNetwork->GetModules();
+ for (unsigned int networkModuleIndex = 0; networkModuleIndex < networkModules.size(); ++networkModuleIndex) {
+ const CModule* pCurModule = networkModules[networkModuleIndex];
+ if (Info.GetName() == pCurModule->GetModName()) {
+ networksWithRenderedModuleCount++;
+ }
+ }
+ }
+ l["LoadedByAllNetworks"] = CString(networksWithRenderedModuleCount == userNetworks.size());
+ const bool isLoadedBySomeNetworks = (networksWithRenderedModuleCount != 0) && (networksWithRenderedModuleCount < userNetworks.size());
+ l["LoadedBySomeNetworks"] = CString(isLoadedBySomeNetworks);
+
if (!spSession->IsAdmin() && pUser && pUser->DenyLoadMod()) {
l["Disabled"] = "true";
}
Please sign in to comment.
Something went wrong with that request. Please try again.