Bug #5683
closedprint_info_box() does not work with pkg_edit.php
0%
Description
In the pfBlockerNG IPv4 tab, I added a print_info_box() call on user "save", but it does not print the info box to the screen?
Updated by Anonymous over 8 years ago
Sounds risky :) Is that in the currently published version? i.e.: If I install the package now will I see the print_info_block() in the php?
Updated by BBcan177 . over 8 years ago
No I am trying to add a new informational message to the code but its not allowing that..
You can add this line to pfblockerng.inc at line 1765.
https://github.com/pfsense/FreeBSD-ports/blob/devel/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc#L1765
print_info_box("test");
Then hit "save" in IPv4 Tab when editing an Alias to call that function.
Updated by Anonymous over 8 years ago
- Status changed from New to Feedback
- Assignee set to BBcan177 .
I think this is because the print_infox_box() call takes place before the include("head.inc") line, so the HTML environment is not yet set up and there is nothing to print to. In other words the box is being printed long before the html/head/body tags.
Updated by BBcan177 . over 8 years ago
So what alternatives/workaround do we have to print a pop-up message?
Updated by Anonymous over 8 years ago
Well the "usual" way to do it is something like:
if ($_POST['sync']) { do_clever_stuff(); $savemsg = "pfBlockerNG has successfully synced with the server"); }
pkg.php will automatically print an info_box with that messages when the time comes.
Updated by BBcan177 . over 8 years ago
I tried that already ... See post #2 above... Add:
pfblockerng.inc Line: 1765
$savemsg = "Test";
Also tried to set $savemsg as a global variable.
Updated by Anonymous over 8 years ago
It looks like on clicking the save button you are saving the page via jQuery/AJAX and then the function exits without re-drawing the screen, hence you don't see the info_box. THe only thing I see that might be useful is this:
if ($_GET['savemsg'] != "") { $savemsg = htmlspecialchars($_GET['savemsg']); }
So presumably if you do a get to the page with savemsg="The file has been saved", it will generate the pop-up message.
Updated by Anonymous over 8 years ago
This seems to work as expected and might be of use to you:
pkg.php?xml=/pfblockerng/pfblockerng_v4lists.xml&savemsg=This%20is%20a%20test
Added to my browser address bar this produced the print_info_box