Project

General

Profile

Actions

Bug #10406

closed

Interfaces.php PPPoE selection display inappropriate "Toggle All" button when periodic reset set to "pre-set"

Added by Grischa Zengel about 4 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Low
Assignee:
-
Category:
Web Interface
Target version:
Start date:
04/01/2020
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
2.5.0
Affected Architecture:

Description

"cron based reset" for PPPoE connections at interfaces.php uses radio buttons and shows Toggle All Button.

$group = new Form_MultiCheckboxGroup('cron based reset');
$group->addClass('pppoepreset');

$group->add(new Form_MultiCheckbox(
    'pppoe_pr_preset_val',
    null,
    'Reset at each month ("0 0 1 * *")',
    $pconfig['pppoe_monthly'],
    'monthly'
))->displayAsRadio();
Actions #1

Updated by Jim Pingle about 4 years ago

  • Status changed from New to Rejected

I don't see a "Toggle All" button on the page in the source or rendered in the browser. I tried in Firefox and Chrome.

Ensure you do not have any ad blocking or script blocking browser add-ons active while viewing the GUI. If you still have problems, post on the forum to discuss the problem and try to find out what might be happening in your environment.

Actions #2

Updated by Grischa Zengel about 4 years ago

Are you sure?

I get it with Linux Firefox, Windows 10 Edge.
From different customers intranet.
Even with Netgate SG-3100 on 2.4.4 P2.

Actions #3

Updated by Grischa Zengel about 4 years ago

It should always show the button, even for you.

If I have this:

<div class="form-group pppoepreset">
    <label class="col-sm-2 control-label">
        cron based reset
    </label>

    <div class="checkbox multi col-sm-10">
        <label class="chkboxlbl"><input name="pppoe_pr_preset_val" id="pppoe_pr_preset_val_monthly:d5ea" type="radio" value="monthly"> Reset at each month (&quot;0 0 1 * *&quot;)</label><label class="chkboxlbl"><input name="pppoe_pr_preset_val" id="pppoe_pr_preset_val_weekly:d5fd" type="radio" value="weekly"> Reset at each week (&quot;0 0 * * 0&quot;)</label><label class="chkboxlbl"><input name="pppoe_pr_preset_val" id="pppoe_pr_preset_val_daily:d60b" type="radio" value="daily"> Reset at each day (&quot;0 0 * * *&quot;)</label><label class="chkboxlbl"><input name="pppoe_pr_preset_val" id="pppoe_pr_preset_val_hourly:d61a" type="radio" value="hourly"> Reset at each hour (&quot;0 * * * *&quot;)</label>
    </div>
</div>    

This should always add the Toggle All button:


$('.control-label + .checkbox.multi').each(function() {
        var a = $('<a name="btntoggleall" class="btn btn-xs btn-info"><i class="fa fa-check-square-o icon-embed-btn"></i>Toggle All</a>');

        a.on('click', function() {
            var wrap = $(this).parents('.form-group').find('.checkbox.multi'),
                all = wrap.find('input[type=checkbox]'),
                checked = wrap.find('input[type=checkbox]:checked');

            all.prop('checked', (all.length != checked.length));
        });

        if ( ! $(this).parent().hasClass("notoggleall")) {
            a.appendTo($(this));
        }
    });
Actions #4

Updated by Grischa Zengel about 4 years ago

Did you choose Pre-Set at "Periodic reset" ?

Actions #5

Updated by Jim Pingle about 4 years ago

  • Status changed from Rejected to Confirmed
  • Target version set to 2.5.0

I did, but apparently I was looking on the actual PPP interface settings page not interfaces.php. I see it there.

It's fine on interfaces_ppps_edit.php

Actions #6

Updated by Renato Botelho over 3 years ago

  • Assignee set to Anonymous
Actions #7

Updated by Anonymous over 3 years ago

  • Subject changed from "Toggle All" button for radio buttons to Interfaces.php PPPoE selection display inappropriate "Toggle All" button when periodic reset set to "pre-set"
  • Status changed from Confirmed to Feedback
  • Assignee changed from Anonymous to Grischa Zengel
if ( ! $(this).parent().hasClass("notoggleall"))
was a bit of a giveaway
Actions #8

Updated by Anonymous over 3 years ago

  • % Done changed from 0 to 100
Actions #9

Updated by Max Leighton over 3 years ago

Tested this in

2.5.0-DEVELOPMENT (amd64)
built on Tue Oct 20 07:02:36 EDT 2020
FreeBSD 12.2-STABLE

Currently the patch needs to be applied to change the behavior. Once applied, the Toggle All button won't appear under Interfaces / <PPPPoE Interface> / Periodic Reset.

Tested in Chrome, Firefox, IE, Edge.

Actions #10

Updated by Renato Botelho over 3 years ago

  • Status changed from Feedback to Resolved
  • Assignee changed from Grischa Zengel to Anonymous
Actions

Also available in: Atom PDF