diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2010-07-12 13:28:52 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2010-07-12 13:30:01 -0400 |
commit | 619f2dbd0722d8f1a9c2ed5106cbd43a487b67e2 (patch) | |
tree | cbf497a5721427804142cb137b42b94b8afd4362 /usr | |
parent | 2a0e85128c5076a038743a5e0634c58c11019655 (diff) | |
download | pfsense-619f2dbd0722d8f1a9c2ed5106cbd43a487b67e2.zip pfsense-619f2dbd0722d8f1a9c2ed5106cbd43a487b67e2.tar.gz |
Add undo button for drag and drop reordering
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/firewall_rules.php | 23 | ||||
-rwxr-xr-x | usr/local/www/guiconfig.inc | 64 |
2 files changed, 85 insertions, 2 deletions
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index cd358da..704f394 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -126,7 +126,17 @@ if($_REQUEST['dragdroporder']) { $config = write_config("Drag and drop firewall rules ordering update."); // Redirect back to page mark_subsystem_dirty('filter'); - Header("Location: firewall_rules.php?if=" . $_REQUEST['if']); + $undo = array(); + foreach($_REQUEST['dragtable'] as $dt) + $undo[] = ""; + $counter = 0; + foreach($_REQUEST['dragtable'] as $dt) { + $undo[$dt] = $counter; + $counter++; + } + foreach($undo as $dt) + $undotxt .= "&dragtable[]={$dt}"; + Header("Location: firewall_rules.php?if=" . $_REQUEST['if'] . "&undodrag=true" . $undotxt); exit; } @@ -286,7 +296,16 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript </script> <?php if ($savemsg) print_info_box($savemsg); ?> <?php if (is_subsystem_dirty('filter')): ?><p> -<?php print_info_box_np("The firewall rule configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br> +<?php +if($_REQUEST['undodrag']) { + foreach($_REQUEST['dragtable'] as $dt) + $dragtable .= "&dragtable[]={$dt}"; + print_info_box_np_undo("The firewall rule configuration has been changed.<br>You must apply the changes in order for them to take effect.", "apply" , "Apply changes" , "firewall_rules.php?if={$_REQUEST['if']}&dragdroporder=true&{$dragtable}"); +} else { + print_info_box_np("The firewall rule configuration has been changed.<br>You must apply the changes in order for them to take effect."); +} +?> +<br> <?php endif; ?> <div id="loading" style="visibity:hidden"> <img src="/themes/<?=$g['theme']?>/images/misc/loader.gif"> Loading, please wait... diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 44680aa..e27b78b 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -338,6 +338,70 @@ EOFnp; } +function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $undo) { + global $g; + + if(stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) { + $savebutton = "<td class='infoboxsave'><nobr>"; + $savebutton .= " <input type=\"button\" value=\"Undo\" onClick=\"document.location='{$undo}'\">"; + $savebutton .= " <input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\">"; + $savebutton.="</nobr></td>"; + if($_POST['if']) + $savebutton .= "<input type='hidden' name='if' value='{$_POST['if']}'>"; + } + $nifty_redbox = "#990000"; + $nifty_blackbox = "#000000"; + + $themename = $g['theme']; + + if(file_exists("/usr/local/www/themes/{$themename}/tabcontrols.php")) { + $toeval = file_get_contents("/usr/local/www/themes/{$themename}/tabcontrols.php"); + eval($toeval); + } + + if(file_exists("/usr/local/www/themes/{$themename}/infobox.php")) { + $toeval = file_get_contents("/usr/local/www/themes/{$themename}/infobox.php"); + eval($toeval); + } + + + if(!$savebutton) { + $savebutton = '<td class="infoboxsave"><input value="Close" type="button" onClick="$(\'redboxtable\').hide();"></td>'; + } + + echo <<<EOFnp + <table class='infobox' id='redboxtable'> + <tr> + <td> + <div class='infoboxnp' id='redbox'> + <table class='infoboxnptable2'> + <tr> + <td class='infoboxnptd'> + <img class='infoboxnpimg' src="/themes/{$g['theme']}/images/icons/icon_exclam.gif" > + </td> + <td class='infoboxnptd2'> + <b>{$msg}</b> + </td> + {$savebutton} + {$undobutton} + </tr> + </table> + </div> + <div> + <p/> + </div> + </td> + </tr> + </table> + <script type="text/javascript"> + NiftyCheck(); + Rounded("div#redbox","all","#FFF","{$nifty_redbox}","smooth"); + Rounded("td#blackbox","all","#FFF","{$nifty_blackbox}","smooth"); + </script> +EOFnp; + +} + function print_info_box($msg) { print_info_box_np($msg); } |