Revision 301e4aa0
Added by Stephen Beaver over 9 years ago
src/usr/local/www/firewall_rules.php | ||
---|---|---|
745 | 745 |
|
746 | 746 |
// Check all of the rule checkboxes so that their values are posted |
747 | 747 |
$('#order-store').click(function () { |
748 |
$('[id^=frc]').prop('checked', true); |
|
748 |
$('[id^=frc]').prop('checked', true); |
|
749 |
|
|
750 |
// Save the separator bar configuration |
|
751 |
save_separators(); |
|
749 | 752 |
}); |
750 | 753 |
|
751 |
// Separator bar stuff |
|
754 |
// Separator bar stuff ------------------------------------------------------------------------
|
|
752 | 755 |
$("#addsep").prop('type' ,'button'); |
753 | 756 |
|
754 | 757 |
$("#addsep").click(function() { |
755 | 758 |
alert("This feature is not yet complete. (Nothing is saved)\nIncluded for review only."); |
759 |
// Inset a temporary bar in which hte user can enter some optional text |
|
756 | 760 |
$('#ruletable > tbody:last').append('<tr>' + |
757 | 761 |
'<td bgcolor="#cce5ff" colspan="10"><input id="newsep" placeholder="<?=gettext("Enter a description, Save, then drag to final location.")?>" class="col-md-12" type="text"></input></td>' + |
758 | 762 |
'<td bgcolor="#cce5ff" colspan="2"><button class="btn btn-default btn-sm" id="btnnewsep"><?=gettext("Save")?></button></td>' + |
... | ... | |
760 | 764 |
|
761 | 765 |
$("#btnnewsep").prop('type' ,'button'); |
762 | 766 |
|
767 |
// Remove the temporary separator bar and replace it with the final version containing the |
|
768 |
// user's text and a delete icon |
|
763 | 769 |
$("#btnnewsep").click(function() { |
764 | 770 |
var septext = escapeHtml($('#newsep').val()); |
765 | 771 |
$('#ruletable > tbody:last >tr:last').remove(); |
766 | 772 |
$('#ruletable > tbody:last').append('<tr class="ui-sortable-handle">' + |
767 | 773 |
'<td bgcolor="#cce5ff" colspan="11">' + '<font color="#002699">' + septext + '</font></td>' + |
768 |
'<td bgcolor="#cce5ff"><a href="#"><i class="fa fa-trash"></i></a></td>' +
|
|
774 |
'<td bgcolor="#cce5ff"><a href="#"><i class="fa fa-trash sepdel"></i></a></td>' +
|
|
769 | 775 |
'</tr>'); |
770 | 776 |
}); |
771 | 777 |
}); |
772 |
/* |
|
778 |
|
|
779 |
// Delete a sepaator row |
|
773 | 780 |
$(function(){ |
774 |
$('table').on('click','tr a',function(e){ |
|
781 |
$('table').on('click','tr a .sepdel',function(e){
|
|
775 | 782 |
e.preventDefault(); |
776 | 783 |
$(this).parents('tr').remove(); |
777 | 784 |
}); |
778 | 785 |
}); |
779 |
*/ |
|
786 |
|
|
787 |
function save_separators() { |
|
788 |
return(true); |
|
789 |
} |
|
790 |
|
|
791 |
//JS equivalent to PHP htmlspecialchars() |
|
780 | 792 |
function escapeHtml(text) { |
781 | 793 |
var map = { |
782 | 794 |
'&': '&', |
... | ... | |
788 | 800 |
|
789 | 801 |
return text.replace(/[&<>"']/g, function(m) { return map[m]; }); |
790 | 802 |
} |
803 |
// -------------------------------------------------------------------------------------------- |
|
791 | 804 |
}); |
792 | 805 |
//]]> |
793 | 806 |
</script> |
Also available in: Unified diff
Restore separator bar delete functionality