Project

General

Profile

Bug #10406

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

Added by Grischa Zengel 7 months ago. Updated 1 day ago.

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

100%

Estimated time:
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();

Associated revisions

Revision dccd106a (diff)
Added by Steve Beaver 9 days ago

Fixed #10406 By adding "notoggleall" class to button group

History

#1 Updated by Jim Pingle 7 months 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.

#2 Updated by Grischa Zengel 7 months 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.

#3 Updated by Grischa Zengel 7 months 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));
        }
    });

#4 Updated by Grischa Zengel 7 months ago

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

#5 Updated by Jim Pingle 7 months 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

#6 Updated by Renato Botelho 9 days ago

  • Assignee set to Steve Beaver

#7 Updated by Steve Beaver 9 days 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 Steve Beaver to Grischa Zengel
if ( ! $(this).parent().hasClass("notoggleall"))
was a bit of a giveaway

#8 Updated by Steve Beaver 9 days ago

  • % Done changed from 0 to 100

#9 Updated by Max Leighton 1 day 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.

#10 Updated by Renato Botelho 1 day ago

  • Status changed from Feedback to Resolved
  • Assignee changed from Grischa Zengel to Steve Beaver

Also available in: Atom PDF