Adjust dropdownchecklst width according to selected theme

This commit is contained in:
bergware
2017-08-21 14:29:25 +02:00
parent 8e3da0399c
commit 65a498230a
11 changed files with 42 additions and 26 deletions
+7 -6
View File
@@ -22,6 +22,7 @@ $template = "$docroot/webGui/EthX.page";
$ini = '/var/local/emhttp/network.ini';
$validIP4 = '((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
$validIP6 = '((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4}))*::((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4}))*|((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4})){7}';
$width = strstr('gray,azure',$display['theme']) ? [166,305]:[131,300];
// get available ethernet ports (excluding eth0)
exec("ls --indicator-style=none /sys/class/net|grep -P '^eth[1-9][0-9]*$'",$ports);
@@ -268,7 +269,7 @@ function checkBondingSettings(form,ctrl,port) {
$('#bond-members-'+port).hide(me);
} else {
$('#bond-members-'+port).show(me);
$('#bond-'+port).dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:131});
$('#bond-'+port).dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
}
if (ctrl==1) checkBridgingSettings(form,1,port);
}
@@ -279,7 +280,7 @@ function checkBridgingSettings(form,ctrl,port) {
var i = 0;
if (form.BRIDGING.value=='yes' && form.BONDING.value=='no') {
$('#bridge-members-'+port).show(me);
$('#bridge-'+port).dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:131});
$('#bridge-'+port).dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
} else {
$('#bridge-members-'+port).hide(me);
}
@@ -339,12 +340,12 @@ $(function() {
var form = document.eth0_settings;
<?if ($tabbed && !$service):?>
$('#tab1').bind({click:function(){
$('#bond-eth0').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:131});
$('#bridge-eth0').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:131});
$('#bond-eth0').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
$('#bridge-eth0').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
}});
<?endif;?>
$('#bond-eth0').dropdownchecklist({emptyText:'None', width:131});
$('#bridge-eth0').dropdownchecklist({emptyText:'None', width:131});
$('#bond-eth0').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
$('#bridge-eth0').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
checkBondingSettings(form,0,'eth0');
checkBridgingSettings(form,0,'eth0');
checkNetworkAccess(form,'eth0');
+4 -4
View File
@@ -56,12 +56,12 @@ $(function() {
var form = document.ethX_settings;
<?if ($tabbed && !$service):?>
$('#tabX').bind({click:function(){
$('#bond-ethX').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:131});
$('#bridge-ethX').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:131});
$('#bond-ethX').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
$('#bridge-ethX').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
}});
<?endif;?>
$('#bond-ethX').dropdownchecklist({emptyText:'None', width:131});
$('#bridge-ethX').dropdownchecklist({emptyText:'None', width:131});
$('#bond-ethX').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
$('#bridge-ethX').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
checkBondingSettings(form,0,'ethX');
checkBridgingSettings(form,0,'ethX');
checkNetworkAccess(form,'ethX');
+2 -1
View File
@@ -17,6 +17,7 @@ Tag="hand-paper-o"
<?
$newarray = $var['mdState']=='NEW_ARRAY';
$disabled = $var['fsState']=="Started";
$width = strstr('gray,azure',$display['theme']) ? [166,305]:[131,300];
if ($newarray) {
@unlink('/boot/config/smart-one.cfg');
@unlink('/boot/config/smart-all.cfg');
@@ -39,7 +40,7 @@ function prepareNewConfig(form) {
form.preset.disabled = true;
}
$(function() {
$('#s1').dropdownchecklist({emptyText:'None', width:131, firstItemChecksAll:true, explicitClose:'...close'});
$('#s1').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>, firstItemChecksAll:true, explicitClose:'...close'});
<?if ($disabled):?>
$('#s1').dropdownchecklist('disable');
<?endif;?>
+4 -2
View File
@@ -15,6 +15,8 @@ Tag="hand-paper-o"
*/
?>
<?
$width = strstr('gray,azure',$display['theme']) ? [166,305]:[131,300];
function data_disks($disk) {
return ($disk['type']=='Data' && $disk['status']=='DISK_OK');
}
@@ -37,8 +39,8 @@ function setNewPerms(form) {
if (dirs) swal({title:'Proceed?',text:'This will update folder & file permissions',type:'warning',showCancelButton:true},function(){openBox('/webGui/scripts/newperms&arg1='+dirs,'New Permissions',490,430,true);});
}
$(function() {
$('#s1').dropdownchecklist({emptyText:'None', width:131, firstItemChecksAll:true, explicitClose:'...close'});
$('#s2').dropdownchecklist({emptyText:'None', width:131, firstItemChecksAll:true, explicitClose:'...close'});
$('#s1').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>, firstItemChecksAll:true, explicitClose:'...close'});
$('#s2').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>, firstItemChecksAll:true, explicitClose:'...close'});
<?if ($var['fsState']!="Started"):?>
$('#s1').dropdownchecklist('disable');
$('#s2').dropdownchecklist('disable');
+2 -1
View File
@@ -8,6 +8,7 @@ var enabledAgents = new Object();
var disabledAgents = new Object();
var openPage = true;
<?$width = strstr('gray,azure',$display['theme']) ? [166,305]:[131,300];?>
<?if ($tabbed):?>
$('#tab3').bind({click:function(){initDropdown();}});
$(function(){if ($('#tab3').is(':checked')) initDropdown();});
@@ -66,7 +67,7 @@ function testService(name) {
form.submit();
}
function initDropdown() {
if (openPage) {$("[id^='slot_']").dropdownchecklist({width:300,explicitClose:'...close'}); openPage = false;}
if (openPage) {$("[id^='slot_']").dropdownchecklist({width:<?=$width[1]?>,explicitClose:'...close'}); openPage = false;}
}
</script>
<form method="POST" id="formExec" action="/update.php" target="progressFrame">
+3 -3
View File
@@ -15,8 +15,8 @@ Cond="($disks['parity']['status']!='DISK_NP_DSBL')"
* all copies or substantial portions of the Software.
*/
?>
<?
$width = strstr('gray,azure',$display['theme']) ? [166,305]:[131,300];
$mode = ['Disabled','Daily','Weekly','Monthly','Yearly','Custom'];
$days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
$months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
@@ -33,8 +33,8 @@ if (file_exists($memory)) {
<script>
<?if ($parity['mode']==5):?>
$(function() {
$("#s1").dropdownchecklist({emptyText:'Every day', width:131, explicitClose:'...close'});
$("#s2").dropdownchecklist({emptyText:'Every month', width:131, explicitClose:'...close'});
$("#s1").dropdownchecklist({emptyText:'Every day', width:<?=$width[0]?>, explicitClose:'...close'});
$("#s2").dropdownchecklist({emptyText:'Every month', width:<?=$width[0]?>, explicitClose:'...close'});
});
// Simulate a single input field
function prepareParity(form) {
+5 -2
View File
@@ -15,6 +15,9 @@ Cond="(($var['shareAFPEnabled']!='no') && (isset($name)?array_key_exists($name,$
* all copies or substantial portions of the Software.
*/
?>
<?
$width = strstr('gray,azure',$display['theme']) ? [123,305]:[123,300];
?>
> This section is used to configure the security settings for the share when accessed using AFP and
> appears only when AFP is enabled on the Network Services page.
>
@@ -242,8 +245,8 @@ function initDropdownAFP(reset) {
$('#afp1').dropdownchecklist('destroy');
$('#afp2').dropdownchecklist('destroy');
}
$("#afp1").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:120, explicitClose:'...close'});
$("#afp2").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:120, explicitClose:'...close'});
$("#afp1").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:<?=$width[0]?>, explicitClose:'...close'});
$("#afp2").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:<?=$width[0]?>, explicitClose:'...close'});
}
function readAFP() {
var form = document.afp_edit;
+4 -1
View File
@@ -15,6 +15,9 @@ Cond="(($var['shareNFSEnabled']!='no') && (isset($name)?array_key_exists($name,$
* all copies or substantial portions of the Software.
*/
?>
<?
$width = strstr('gray,azure',$display['theme']) ? [123,305]:[123,300];
?>
> *Read settings from* is used to preset the NFS security settings of the current selected share with the settings of an existing share.
>
> Select the desired share name and press **Read** to copy the NFS security settings from the selected source.
@@ -101,7 +104,7 @@ function initDropdownNFS(reset) {
if (reset) {
$('#nfs1').dropdownchecklist('destroy');
}
$("#nfs1").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:120, explicitClose:'...close'});
$("#nfs1").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:<?=$width[0]?>, explicitClose:'...close'});
}
function readNFS() {
var form = document.nfs_edit;
+5 -2
View File
@@ -15,6 +15,9 @@ Cond="(($var['shareSMBEnabled']!='no') && (isset($name)?array_key_exists($name,$
* all copies or substantial portions of the Software.
*/
?>
<?
$width = strstr('gray,azure',$display['theme']) ? [123,305]:[123,300];
?>
> *Read settings from* is used to preset the SMB security settings of the current selected share with the settings of an existing share.
>
> Select the desired share name and press **Read** to copy the SMB security settings from the selected source.
@@ -215,8 +218,8 @@ function initDropdownSMB(reset) {
$('#smb1').dropdownchecklist('destroy');
$('#smb2').dropdownchecklist('destroy');
}
$("#smb1").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:120, explicitClose:'...close'});
$("#smb2").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:120, explicitClose:'...close'});
$("#smb1").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:<?=$width[0]?>, explicitClose:'...close'});
$("#smb2").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:<?=$width[0]?>, explicitClose:'...close'});
}
function readSMB() {
var form = document.smb_edit;
+5 -3
View File
@@ -15,6 +15,8 @@ Tag="share-alt-square"
*/
?>
<?
$width = strstr('gray,azure',$display['theme']) ? [123,305]:[123,300];
if ($name == "") {
/* default values when adding new share */
$share = ["nameOrig" => "",
@@ -272,10 +274,10 @@ function initDropdown(remove,create) {
<?endif;?>
}
if (create) {
$("#s1").dropdownchecklist({emptyText:'All', width:300, explicitClose:'...close'});
$("#s2").dropdownchecklist({emptyText:'None', width:300, explicitClose:'...close'});
$("#s1").dropdownchecklist({emptyText:'All', width:<?=$width[1]?>, explicitClose:'...close'});
$("#s2").dropdownchecklist({emptyText:'None', width:<?=$width[1]?>, explicitClose:'...close'});
<?if ($name):?>
$("#s3").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:120, explicitClose:'...close'});
$("#s3").dropdownchecklist({firstItemChecksAll:true, emptyText:'select...', width:<?=$width[0]?>, explicitClose:'...close'});
<?endif;?>
}
}
@@ -34,7 +34,7 @@ $banner = '/boot/config/plugins/dynamix/banner.png';
echo "#header.image{background-image:url(";
echo file_exists($banner) ? autov($banner) : '/webGui/images/banner.png';
echo ")}\n";
if ($display['theme']=='gray' || $display['theme']=='azure') {
if (strstr('gray,azure',$display['theme'])) {
$pages = find_pages('Tasks');
foreach ($pages as $page) if ($page['Code']) echo "#nav-item a[href='/{$page['name']}']:before{content:'\\{$page['Code']}'}\n";
}