Revision 7a2c0131
Added by Phil Davis over 9 years ago
src/usr/local/www/services_dhcp_edit.php | ||
---|---|---|
590 | 590 |
$pconfig['maxtime'] |
591 | 591 |
))->setHelp('This is the maximum lease time for clients that ask for a specific expiration time. The default is 86400 seconds.'); |
592 | 592 |
|
593 |
$btndyndns = new Form_Button(
|
|
594 |
'btndyndns',
|
|
595 |
'Advanced', |
|
593 |
$btnadv = new Form_Button(
|
|
594 |
'btnadvdns',
|
|
595 |
'Display Advanced',
|
|
596 | 596 |
null, |
597 | 597 |
'fa-cog' |
598 | 598 |
); |
599 | 599 |
|
600 |
$btndyndns->addClass('btn-info btn-sm');
|
|
600 |
$btnadv->addClass('btn-info btn-sm');
|
|
601 | 601 |
|
602 | 602 |
$section->addInput(new Form_StaticText( |
603 | 603 |
'Dynamic DNS', |
604 |
$btndyndns
|
|
604 |
$btnadv
|
|
605 | 605 |
)); |
606 | 606 |
|
607 | 607 |
$section->addInput(new Form_Checkbox( |
... | ... | |
638 | 638 |
$pconfig['ddnsdomainkey'] |
639 | 639 |
))->setHelp('Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.'); |
640 | 640 |
|
641 |
$btnntp = new Form_Button(
|
|
642 |
'btnntp', |
|
643 |
'Advanced', |
|
641 |
$btnadv = new Form_Button(
|
|
642 |
'btnadvntp',
|
|
643 |
'Display Advanced',
|
|
644 | 644 |
null, |
645 | 645 |
'fa-cog' |
646 | 646 |
); |
647 | 647 |
|
648 |
$btnntp->addClass('btn-info btn-sm');
|
|
648 |
$btnadv->addClass('btn-info btn-sm');
|
|
649 | 649 |
|
650 | 650 |
$section->addInput(new Form_StaticText( |
651 | 651 |
'NTP servers', |
652 |
$btnntp
|
|
652 |
$btnadv
|
|
653 | 653 |
)); |
654 | 654 |
|
655 | 655 |
$group = new Form_Group('NTP Servers'); |
... | ... | |
674 | 674 |
|
675 | 675 |
$section->add($group); |
676 | 676 |
|
677 |
$btntftp = new Form_Button(
|
|
678 |
'btntftp', |
|
679 |
'Advanced', |
|
677 |
$btnadv = new Form_Button(
|
|
678 |
'btnadvtftp',
|
|
679 |
'Display Advanced',
|
|
680 | 680 |
null, |
681 | 681 |
'fa-cog' |
682 | 682 |
); |
683 | 683 |
|
684 |
$btntftp->addClass('btn-info btn-sm');
|
|
684 |
$btnadv->addClass('btn-info btn-sm');
|
|
685 | 685 |
|
686 | 686 |
$section->addInput(new Form_StaticText( |
687 | 687 |
'TFTP servers', |
688 |
$btntftp
|
|
688 |
$btnadv
|
|
689 | 689 |
)); |
690 | 690 |
|
691 | 691 |
$section->addInput(new Form_Input( |
... | ... | |
703 | 703 |
//<![CDATA[ |
704 | 704 |
events.push(function() { |
705 | 705 |
|
706 |
function hideDDNS(hide) { |
|
707 |
hideCheckbox('ddnsupdate', hide); |
|
708 |
hideInput('ddnsdomain', hide); |
|
709 |
hideInput('ddnsdomainprimary', hide); |
|
710 |
hideInput('ddnsdomainkeyname', hide); |
|
711 |
hideInput('ddnsdomainkey', hide); |
|
706 |
// Show advanced DNS options ====================================================================================== |
|
707 |
var showadvdns = false; |
|
708 |
|
|
709 |
function show_advdns(ispageload) { |
|
710 |
var text; |
|
711 |
// On page load decide the initial state based on the data. |
|
712 |
if (ispageload) { |
|
713 |
<?php |
|
714 |
if (!$pconfig['ddnsupdate'] && empty($pconfig['ddnsdomain']) && empty($pconfig['ddnsdomainprimary']) && |
|
715 |
empty($pconfig['ddnsdomainkeyname']) && empty($pconfig['ddnsdomainkey'])) { |
|
716 |
$showadv = false; |
|
717 |
} else { |
|
718 |
$showadv = true; |
|
719 |
} |
|
720 |
?> |
|
721 |
showadvdns = <?php if ($showadv) {echo 'true';} else {echo 'false';} ?>; |
|
722 |
} else { |
|
723 |
// It was a click, swap the state. |
|
724 |
showadvdns = !showadvdns; |
|
725 |
} |
|
726 |
|
|
727 |
hideCheckbox('ddnsupdate', !showadvdns); |
|
728 |
hideInput('ddnsdomain', !showadvdns); |
|
729 |
hideInput('ddnsdomainprimary', !showadvdns); |
|
730 |
hideInput('ddnsdomainkeyname', !showadvdns); |
|
731 |
hideInput('ddnsdomainkey', !showadvdns); |
|
732 |
|
|
733 |
if (showadvdns) { |
|
734 |
text = "<?=gettext('Hide Advanced');?>"; |
|
735 |
} else { |
|
736 |
text = "<?=gettext('Display Advanced');?>"; |
|
737 |
} |
|
738 |
$('#btnadvdns').html('<i class="fa fa-cog"></i> ' + text); |
|
712 | 739 |
} |
713 | 740 |
|
714 |
// Make the ‘Copy My MAC’ button a plain button, not a submit button |
|
715 |
$("#btnmymac").prop('type','button'); |
|
741 |
$('#btnadvdns').prop('type', 'button'); |
|
716 | 742 |
|
717 |
// On click, copy the hidden 'mymac' text to the 'mac' input |
|
718 |
$("#btnmymac").click(function() { |
|
719 |
$('#mac').val('<?=$mymac?>'); |
|
743 |
$('#btnadvdns').click(function(event) { |
|
744 |
show_advdns(); |
|
720 | 745 |
}); |
721 | 746 |
|
722 |
// Make the ‘tftp’ button a plain button, not a submit button |
|
723 |
$("#btntftp").prop('type','button'); |
|
747 |
// Show advanced NTP options ====================================================================================== |
|
748 |
var showadvntp = false; |
|
749 |
|
|
750 |
function show_advntp(ispageload) { |
|
751 |
var text; |
|
752 |
// On page load decide the initial state based on the data. |
|
753 |
if (ispageload) { |
|
754 |
<?php |
|
755 |
if (empty($pconfig['ntp1']) && empty($pconfig['ntp2'])) { |
|
756 |
$showadv = false; |
|
757 |
} else { |
|
758 |
$showadv = true; |
|
759 |
} |
|
760 |
?> |
|
761 |
showadvntp = <?php if ($showadv) {echo 'true';} else {echo 'false';} ?>; |
|
762 |
} else { |
|
763 |
// It was a click, swap the state. |
|
764 |
showadvntp = !showadvntp; |
|
765 |
} |
|
766 |
|
|
767 |
hideInput('ntp1', !showadvntp); |
|
768 |
hideInput('ntp2', !showadvntp); |
|
724 | 769 |
|
725 |
// Show tftp controls |
|
726 |
$("#btntftp").click(function() { |
|
727 |
hideInput('tftp', false); |
|
770 |
if (showadvntp) { |
|
771 |
text = "<?=gettext('Hide Advanced');?>"; |
|
772 |
} else { |
|
773 |
text = "<?=gettext('Display Advanced');?>"; |
|
774 |
} |
|
775 |
$('#btnadvntp').html('<i class="fa fa-cog"></i> ' + text); |
|
776 |
} |
|
777 |
|
|
778 |
$('#btnadvntp').prop('type', 'button'); |
|
779 |
|
|
780 |
$('#btnadvntp').click(function(event) { |
|
781 |
show_advntp(); |
|
728 | 782 |
}); |
729 | 783 |
|
730 |
// Make the ‘ntp’ button a plain button, not a submit button |
|
731 |
$("#btnntp").prop('type','button'); |
|
784 |
// Show advanced TFTP options ====================================================================================== |
|
785 |
var showadvtftp = false; |
|
786 |
|
|
787 |
function show_advtftp(ispageload) { |
|
788 |
var text; |
|
789 |
// On page load decide the initial state based on the data. |
|
790 |
if (ispageload) { |
|
791 |
<?php |
|
792 |
if (empty($pconfig['tftp'])) { |
|
793 |
$showadv = false; |
|
794 |
} else { |
|
795 |
$showadv = true; |
|
796 |
} |
|
797 |
?> |
|
798 |
showadvtftp = <?php if ($showadv) {echo 'true';} else {echo 'false';} ?>; |
|
799 |
} else { |
|
800 |
// It was a click, swap the state. |
|
801 |
showadvtftp = !showadvtftp; |
|
802 |
} |
|
803 |
|
|
804 |
hideInput('tftp', !showadvtftp); |
|
805 |
|
|
806 |
if (showadvtftp) { |
|
807 |
text = "<?=gettext('Hide Advanced');?>"; |
|
808 |
} else { |
|
809 |
text = "<?=gettext('Display Advanced');?>"; |
|
810 |
} |
|
811 |
$('#btnadvtftp').html('<i class="fa fa-cog"></i> ' + text); |
|
812 |
} |
|
813 |
|
|
814 |
$('#btnadvtftp').prop('type', 'button'); |
|
732 | 815 |
|
733 |
// Show ntp controls |
|
734 |
$("#btnntp").click(function() { |
|
735 |
hideClass('ntpclass', false); |
|
816 |
$('#btnadvtftp').click(function(event) { |
|
817 |
show_advtftp(); |
|
736 | 818 |
}); |
737 | 819 |
|
738 |
// Make the ‘ddns’ button a plain button, not a submit button
|
|
739 |
$("#btndyndns").prop('type','button');
|
|
820 |
// Make the ‘Copy My MAC’ button a plain button, not a submit button
|
|
821 |
$("#btnmymac").prop('type','button');
|
|
740 | 822 |
|
741 |
// Show ddns controls
|
|
742 |
$("#btndyndns").click(function() {
|
|
743 |
hideDDNS(false);
|
|
823 |
// On click, copy the hidden 'mymac' text to the 'mac' input
|
|
824 |
$("#btnmymac").click(function() {
|
|
825 |
$('#mac').val('<?=$mymac?>');
|
|
744 | 826 |
}); |
745 | 827 |
|
746 | 828 |
// On initial load |
747 |
hideDDNS(true);
|
|
748 |
hideClass('ntpclass', true);
|
|
749 |
hideInput('tftp', true);
|
|
829 |
show_advdns(true);
|
|
830 |
show_advntp(true);
|
|
831 |
show_advtftp(true);
|
|
750 | 832 |
}); |
751 | 833 |
//]]> |
752 | 834 |
</script> |
Also available in: Unified diff
Redmine #5994 Make DHCP static edit advanced buttons
Make the advanced buttons consistent.