* Sat May 10 2025 Brian Read <brianr@koozali.org> 11.0.0-3.sme
- Get javascript working and password visible icon [SME: 13001] - Fix missing cmd in panel - Delete out of date list of protocols/device/services etc from controller source
This commit is contained in:
62
root/usr/share/smanager/themes/default/public/js/ddclient.js
Normal file
62
root/usr/share/smanager/themes/default/public/js/ddclient.js
Normal file
@@ -0,0 +1,62 @@
|
||||
function showPass() {
|
||||
var x = document.getElementById("ddcPass");
|
||||
if (x.type === "password") {
|
||||
x.type = "text";
|
||||
} else {
|
||||
x.type = "password";
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Run on page load
|
||||
SelectInput_custom();
|
||||
|
||||
// Attach onchange event to the select element
|
||||
var dnsSelect = document.getElementById('dns');
|
||||
if (dnsSelect) {
|
||||
dnsSelect.addEventListener('change', SelectInput_custom);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function SelectInput_custom() {
|
||||
var method = document.querySelector("#dns");
|
||||
const types=['custom'];
|
||||
types.forEach((type)=>{
|
||||
var service = document.querySelector(`.${type}`);
|
||||
if (service != null) {
|
||||
if (method.value == type) {
|
||||
service.style.display = 'block';
|
||||
} else {
|
||||
service.style.display = 'none';
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Run on page load (replaces onload)
|
||||
SelectInput_params();
|
||||
|
||||
// Attach onchange event (replaces inline onchange)
|
||||
var dnsSelect = document.getElementById('retrievemethod');
|
||||
if (dnsSelect) {
|
||||
dnsSelect.addEventListener('change', SelectInput_params);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function SelectInput_params() {
|
||||
var method = document.querySelector("#retrievemethod");
|
||||
const types=['smeIF','smeCMD','web','router','if','ip','cmd','custom'];
|
||||
types.forEach((type)=>{
|
||||
var service = document.querySelector(`.${type}`);
|
||||
if (service != null) {
|
||||
if (method.value == type) {
|
||||
service.style.display = 'block';
|
||||
} else {
|
||||
service.style.display = 'none';
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
@@ -1,6 +1,7 @@
|
||||
% layout 'default', title => "Sme server 2 - Dynamic Clients", share_dir => './';
|
||||
|
||||
% content_for 'module' => begin
|
||||
%= javascript '/js/ddclient.js'
|
||||
<div id="module" class="module ddclient-panel">
|
||||
|
||||
% if (config->{debug} == 1) {
|
||||
|
@@ -39,19 +39,7 @@
|
||||
<span class=label>
|
||||
%=l 'PASSWORD_LABEL'
|
||||
</span><span class=data>
|
||||
%=password_field 'password',id=>"ddcPass"
|
||||
%=label_for show=>"Show"
|
||||
%=check_box show=>1,onclick=>"showPass()",style=>"vertical-align:middle;"
|
||||
%= javascript begin
|
||||
function showPass() {
|
||||
var x = document.getElementById("ddcPass");
|
||||
if (x.type === "password") {
|
||||
x.type = "text";
|
||||
} else {
|
||||
x.type = "password";
|
||||
}
|
||||
}
|
||||
% end
|
||||
%=password_field 'password',id=>"ddcPass", class=>'sme-password'
|
||||
</span><br>
|
||||
<span class=label>
|
||||
%=l 'MX'
|
||||
@@ -60,6 +48,4 @@
|
||||
</span><br>
|
||||
%= submit_button "$btn", class => 'action'
|
||||
% end
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
@@ -1,9 +1,4 @@
|
||||
<div id='modifydomain'>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
SelectInput();
|
||||
};
|
||||
</script>
|
||||
<h2>
|
||||
%= l 'MODIFY_DESCRIPTION'
|
||||
</h2><br>
|
||||
@@ -34,23 +29,7 @@
|
||||
%=l 'SERVERS_LABEL'
|
||||
</span><span class=data>
|
||||
% param dns=>$ddc_datas->{"Domain_details"}->{"dns"};
|
||||
%=select_field dns=>$dnslabels,id=>"dns",onchange=>"SelectInput()",onload=>"SelectInput()"
|
||||
%= javascript begin
|
||||
function SelectInput() {
|
||||
var method = document.querySelector("#dns");
|
||||
const types=['custom'];
|
||||
types.forEach((type)=>{
|
||||
var service = document.querySelector(`.${type}`);
|
||||
if (service != null) {
|
||||
if (method.value == type) {
|
||||
service.style.display = 'block';
|
||||
} else {
|
||||
service.style.display = 'none';
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
%end
|
||||
%=select_field dns=>$dnslabels,id=>"dns",class=>'selectinputcustom'
|
||||
</span><br>
|
||||
|
||||
%# Dependant on the custom choice from above
|
||||
@@ -79,19 +58,7 @@
|
||||
%=l 'PASSWORD_LABEL'
|
||||
</span><span class=data>
|
||||
% param password=>$ddc_datas->{"Domain_details"}->{"password"};
|
||||
%=password_field 'password',id=>"ddcPass",value=>$ddc_datas->{"Domain_details"}->{"password"}
|
||||
%=label_for show=>"Show"
|
||||
%=check_box show=>1,onclick=>"showPass()",style=>"vertical-align:middle;"
|
||||
%= javascript begin
|
||||
function showPass() {
|
||||
var x = document.getElementById("ddcPass");
|
||||
if (x.type === "password") {
|
||||
x.type = "text";
|
||||
} else {
|
||||
x.type = "password";
|
||||
}
|
||||
}
|
||||
% end
|
||||
%=password_field 'password',id=>"ddcPass",value=>$ddc_datas->{"Domain_details"}->{"password"}, class=>'sme-password'
|
||||
</span><br>
|
||||
<span class=label>
|
||||
%=l 'MX'
|
||||
@@ -103,6 +70,4 @@
|
||||
%= hidden_field Route=>$c->current_route
|
||||
%= submit_button "$btn", class => 'action'
|
||||
% end
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
@@ -1,9 +1,4 @@
|
||||
<div id='paramlist'>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
SelectInput();
|
||||
};
|
||||
</script>
|
||||
<h2>
|
||||
%= l 'Params_for_IP_Retrieval'
|
||||
</h2>
|
||||
@@ -25,23 +20,7 @@
|
||||
%=l 'RETRIEVE_METHOD'
|
||||
</span><span class=data>
|
||||
% param retrievemethod=>$ddc_datas->{"params"}->{"method"} unless param 'retrievemethod';
|
||||
%=select_field retrievemethod=>$methodlabels,id=>"retrievemethod",onchange=>"SelectInput()"
|
||||
%= javascript begin
|
||||
function SelectInput() {
|
||||
var method = document.querySelector("#retrievemethod");
|
||||
const types=['smeIF','smeCMD','web','router','if','ip','cmdv4','custom'];
|
||||
types.forEach((type)=>{
|
||||
var service = document.querySelector(`.${type}`);
|
||||
if (service != null) {
|
||||
if (method.value == type) {
|
||||
service.style.display = 'block';
|
||||
} else {
|
||||
service.style.display = 'none';
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
% end
|
||||
%=select_field retrievemethod=>$methodlabels,id=>"retrievemethod"
|
||||
</span><br>
|
||||
%#
|
||||
%# From here the one that is shown depends on the choice above
|
||||
@@ -65,19 +44,7 @@
|
||||
%=l 'Router password'
|
||||
</span><span class=data>
|
||||
% param retrieverouterpassword=>$ddc_datas->{"params"}->{"FWPassword"} unless param 'retrieverouterpassword';
|
||||
%=password_field 'retrieverouterpassword', id=>'ddcPass'
|
||||
%=label_for show=>"Show"
|
||||
%=check_box show=>1,onclick=>"showPass()",style=>"vertical-align:middle;"
|
||||
%= javascript begin
|
||||
function showPass() {
|
||||
var x = document.getElementById("ddcPass");
|
||||
if (x.type === "password") {
|
||||
x.type = "text";
|
||||
} else {
|
||||
x.type = "password";
|
||||
}
|
||||
}
|
||||
% end
|
||||
%=password_field 'retrieverouterpassword', id=>'ddcPass', class=>'sme-password'
|
||||
</span><br>
|
||||
</div>
|
||||
|
||||
@@ -102,11 +69,11 @@
|
||||
</div>
|
||||
|
||||
%# Only if "cmd" is chosen
|
||||
<div class=cmdv4>
|
||||
<div class=cmd>
|
||||
<span class=label cmd>
|
||||
%=l 'RETRIEVE_CMD'
|
||||
</span><span class=data cmd>
|
||||
% param retrievecmd=>$ddc_datas->{"params"}->{"cmdv4"} unless param 'retrievecmd';
|
||||
% param retrievecmd=>$ddc_datas->{"params"}->{"cmd"} unless param 'retrievecmd';
|
||||
%=text_field 'retrievecmd'
|
||||
</span><br>
|
||||
</div>
|
||||
@@ -133,4 +100,4 @@
|
||||
|
||||
%= submit_button "$btn", class => 'action'
|
||||
% end
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user