Merge pull request #3726 from phil-davis/multi-widget-optional

This commit is contained in:
Renato Botelho 2017-05-10 15:27:41 -03:00
commit c79376011d
14 changed files with 95 additions and 1 deletions

View File

@ -117,7 +117,12 @@ foreach (glob("/usr/local/www/widgets/widgets/*.widget.php") as $file) {
$widgettitle = ucwords(str_replace('_', ' ', $basename));
}
$known_widgets[$basename . '-0'] = array('basename' => $basename, 'title' => $widgettitle, 'display' => 'none');
$known_widgets[$basename . '-0'] = array(
'basename' => $basename,
'title' => $widgettitle,
'display' => 'none',
'multicopy' => ${$basename . '_allow_multiple_widget_copies'}
);
}
##if no config entry found, initialize config entry
@ -322,7 +327,11 @@ if ($user_settings['widgets']['sequence'] != "") {
'col' => $col,
'display' => $display,
'copynum' => $copynum,
'multicopy' => ${$basename . '_allow_multiple_widget_copies'}
);
// Update the known_widgets entry so we know if any copy of the widget is being displayed
$known_widgets[$basename . '-0']['display'] = $display;
}
// add widgets that may not be in the saved configuration, in case they are to be displayed later
@ -379,8 +388,11 @@ $available = $known_widgets;
uasort($available, function($a, $b){ return strcasecmp($a['title'], $b['title']); });
foreach ($available as $widgetkey => $widgetconfig):
// If the widget supports multiple copies, or no copies are displayed yet, then it is available to add
if (($widgetconfig['multicopy']) || ($widgetconfig['display'] == 'none')):
?>
<div class="col-sm-3"><a href="#" id="btnadd-<?=$widgetconfig['basename']?>"><i class="fa fa-plus"></i> <?=$widgetconfig['title']?></a></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>

View File

@ -23,5 +23,6 @@
//set variable for custom title
$dyn_dns_status_title = gettext("Dynamic DNS Status");
$dyn_dns_status_title_link = "services_dyndns.php";
$dyn_dns_status_allow_multiple_widget_copies = true;
?>

View File

@ -22,4 +22,5 @@
//set variable for custom title
$gateways_title = gettext("Gateways");
$gateways_title_link = "status_gateways.php";
$gateways_allow_multiple_widget_copies = true;
?>

View File

@ -22,4 +22,5 @@
//set variable for custom title
$interface_statistics_title = gettext("Interface Statistics");
$interface_statistics_title_link = "status_interfaces.php";
$interface_statistics_allow_multiple_widget_copies = true;
?>

View File

@ -22,5 +22,6 @@
//set variable for custom title
$interfaces_title = gettext("Interfaces");
$interfaces_title_link = "status_interfaces.php";
$interfaces_allow_multiple_widget_copies = true;
?>

View File

@ -22,5 +22,6 @@
//set variable for custom title
$log_title = gettext("Firewall Logs");
$log_title_link = "status_logs_filter.php";
$log_allow_multiple_widget_copies = true;
?>

View File

@ -21,4 +21,5 @@
$openvpn_title = gettext("OpenVPN");
$openvpn_title_link = "status_openvpn.php";
$openvpn_allow_multiple_widget_copies = true;
?>

View File

@ -0,0 +1,24 @@
<?php
/*
* picture.inc
*
* part of pfSense (https://www.pfsense.org)
* Copyright (c) 2004-2017 Rubicon Communications, LLC (Netgate)
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
$picture_title = gettext("Picture");
$picture_allow_multiple_widget_copies = true;
?>

View File

@ -0,0 +1,24 @@
<?php
/*
* rss.inc
*
* part of pfSense (https://www.pfsense.org)
* Copyright (c) 2004-2017 Rubicon Communications, LLC (Netgate)
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
$rss_title = gettext("RSS");
$rss_allow_multiple_widget_copies = true;
?>

View File

@ -23,5 +23,6 @@
//set variable for custom title
$services_status_title = gettext("Services Status");
$services_status_title_link = "status_services.php";
$services_status_allow_multiple_widget_copies = true;
?>

View File

@ -22,4 +22,5 @@
//set variable for custom title
$smart_status_title = gettext("S.M.A.R.T. Status");
$smart_status_title_link = "diag_smart.php";
$smart_status_allow_multiple_widget_copies = true;
?>

View File

@ -0,0 +1,24 @@
<?php
/*
* system_information.inc
*
* part of pfSense (https://www.pfsense.org)
* Copyright (c) 2004-2017 Rubicon Communications, LLC (Netgate)
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
$system_information_title = gettext("System Information");
$system_information_allow_multiple_widget_copies = true;
?>

View File

@ -23,6 +23,7 @@
//set variable for custom title
$thermal_sensors_widget_title = gettext("Thermal Sensors");
//$thermal_sensors_widget_link = "thermal_sensors.php";
$thermal_sensors_allow_multiple_widget_copies = true;
//returns core temp data (from coretemp.ko or amdtemp.ko driver) as "|"-delimited string.

View File

@ -23,5 +23,6 @@
//set variable for custom title
$wake_on_lan_title = gettext("Wake-on-Lan");
$wake_on_lan_title_link = "services_wol.php";
$wake_on_lan_allow_multiple_widget_copies = true;
?>