Ticket #543: cancel_button.patch

File cancel_button.patch, 1.8 KB (added by anonymous, 12 years ago)

This patch fixes the problem.

  • openwrt/package/webif/files/www/cgi-bin/webif/firewall.sh

    diff -rubN whiterussian.orig/openwrt/package/webif/files/www/cgi-bin/webif/firewall.sh whiterussian/openwrt/package/webif/files/www/cgi-bin/webif/firewall.sh
    old new  
    88FW_FILE_NEW="/tmp/.webif/file-firewall-new" 
    99 
    1010empty "$FORM_cancel" || { 
     11        empty "$FORM_delete_on_cancel" || { 
     12                awk \ 
     13                        -f - "$FW_FILE" > "$FW_FILE_NEW" <<EOF 
     14BEGIN { 
     15        first=1 
     16} 
     17{  
     18        if (first != 1) print old 
     19        old = \$0 
     20        first = 0 
     21} 
     22EOF 
     23                mv "$FW_FILE_NEW" "$FW_FILE" 
     24        } 
    1125        FORM_save="" 
    1226        FORM_edit="" 
     27        FORM_cancel="" 
    1328} 
    1429 
    1530empty "$FORM_save" || { 
     
    169184        -v del_layer7="$FORM_del_layer7" \ 
    170185        -v data_submit="$FORM_data_submit" \ 
    171186        -v new_match="$FORM_new_match" \ 
     187        -v delete_on_cancel="$FORM_delete_on_cancel" \ 
    172188        -f /usr/lib/webif/common.awk \ 
    173189        -f /usr/lib/common.awk \ 
    174190        -f - "$FW_FILE" <<EOF 
     
    296312 
    297313(\$1 == "drop") || (\$1 == "accept") || (\$1 == "forward" ) { 
    298314        if (n == edit) { 
    299                 printf "<tr><td>&nbsp;</td><td>" button("save", "Save") button("cancel", "Cancel") "</td></tr>" 
     315                printf "<tr><td>&nbsp;</td><td>" button("save", "Save")  
     316                if( delete_on_cancel != "" ) print hidden("delete_on_cancel", 1); 
     317                print button("cancel", "Cancel") 
     318                print "</td></tr>" 
    300319                 
    301320                print "</table>" 
    302321                print "</td></tr>" 
     
    317336        print "<tr><td class=\\"edit_title\\">@TR<<New Rule>>: </td><td colspan=\\"4\\">" 
    318337        print "<form method=\\"POST\\" action=\\"$SCRIPT_NAME\\" enctype=\\"multipart/form-data\\">" 
    319338        print hidden("edit", n + 1); 
     339        print hidden("delete_on_cancel", 1); 
    320340        print "<select name=\\"new_target\\">" 
    321341        print sel_option("forward", "Forward") 
    322342        print sel_option("accept", "Accept")