mirror of
https://github.com/znc/znc.git
synced 2026-08-07 17:33:34 +02:00
Add drag-and-drop to SASL webpage
This commit is contained in:
committed by
J-P Nurmi
parent
72223febcf
commit
cc0574b084
@@ -33,27 +33,40 @@
|
||||
<div class="section">
|
||||
<h3>Mechanisms</h3>
|
||||
<div class="sectionbg">
|
||||
<table class="data">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<? LOOP MechanismLoop SORTASC=Name ?>
|
||||
<tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>">
|
||||
<td>
|
||||
<input type="checkbox" name="<? VAR Name ?>" id="opt_<? VAR Name ?>" value="1"<? IF Checked ?> checked="checked"<? ENDIF ?> />
|
||||
<label for="opt_<? VAR Name ?>"><? VAR Name ?></label>
|
||||
</td>
|
||||
<td><? VAR Description ?></td>
|
||||
</tr>
|
||||
<? ENDLOOP ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="sectionbody">
|
||||
<div class="subsection">
|
||||
<table class="data">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<? LOOP MechanismLoop SORTASC=Name ?>
|
||||
<tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>">
|
||||
<td><? VAR Name ?></td>
|
||||
<td><? VAR Description ?></td>
|
||||
</tr>
|
||||
<? ENDLOOP ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="subsection">
|
||||
<div class="inputlabel">Selected mechanisms and their order:</div>
|
||||
<input type="text" name="mechanisms" id="mechanisms" value="<? VAR Mechanisms ?>" class="half"/>
|
||||
<script>
|
||||
$("#mechanisms").selectize({
|
||||
plugins: ["drag_drop"],
|
||||
delimiter: " ",
|
||||
options: [<? LOOP MechanismLoop SORTASC=Name ?>{value:"<? VAR Name ?>",text:"<? VAR Name ?>"},<? ENDLOOP ?>],
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
|
||||
<div class="submitline">
|
||||
<input type="hidden" name="submitted" value="1" />
|
||||
|
||||
+5
-16
@@ -266,36 +266,25 @@ public:
|
||||
}
|
||||
|
||||
if (WebSock.IsPost()) {
|
||||
SetNV("username", WebSock.GetRawParam("username"));
|
||||
CString sPassword = WebSock.GetRawParam("password");
|
||||
SetNV("username", WebSock.GetParam("username"));
|
||||
CString sPassword = WebSock.GetParam("password");
|
||||
if (!sPassword.empty()) {
|
||||
SetNV("password", sPassword);
|
||||
}
|
||||
SetNV(NV_REQUIRE_AUTH, WebSock.GetRawParam(NV_REQUIRE_AUTH));
|
||||
|
||||
VCString vsMechanisms;
|
||||
for (const auto& it : SupportedMechanisms) {
|
||||
bool bChecked = WebSock.GetRawParam(it.szName).ToBool();
|
||||
if (bChecked) {
|
||||
vsMechanisms.push_back(it.szName);
|
||||
}
|
||||
}
|
||||
SetNV(NV_MECHANISMS, CString(" ").Join(vsMechanisms.begin(), vsMechanisms.end()));
|
||||
SetNV(NV_REQUIRE_AUTH, WebSock.GetParam("require_auth"));
|
||||
SetNV(NV_MECHANISMS, WebSock.GetParam("mechanisms"));
|
||||
}
|
||||
|
||||
Tmpl["Username"] = GetNV("username");
|
||||
Tmpl["Password"] = GetNV("password");
|
||||
Tmpl["RequireAuth"] = GetNV(NV_REQUIRE_AUTH);
|
||||
|
||||
VCString vsMechanisms;
|
||||
GetMechanismsString().Split(" ", vsMechanisms);
|
||||
Tmpl["Mechanisms"] = GetMechanismsString();
|
||||
|
||||
for (const auto& it : SupportedMechanisms) {
|
||||
CTemplate& Row = Tmpl.AddRow("MechanismLoop");
|
||||
CString sName(it.szName);
|
||||
Row["Name"] = sName;
|
||||
Row["Description"] = CString(it.szDescription);
|
||||
Row["Checked"] = CString(std::find(vsMechanisms.begin(), vsMechanisms.end(), sName) != vsMechanisms.end());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user