From 743beceb5827aae3c9ba91dc9c23bd2e6fe21753 Mon Sep 17 00:00:00 2001 From: bergware Date: Tue, 11 Feb 2020 16:38:41 +0100 Subject: [PATCH] Fixed cloning of share attributes --- plugins/dynamix/SecurityAFP.page | 139 ++++++++++++++++++------------- plugins/dynamix/SecurityNFS.page | 51 +++++++----- plugins/dynamix/SecuritySMB.page | 138 +++++++++++++++++------------- plugins/dynamix/ShareEdit.page | 61 ++++++++------ plugins/dynamix/UserEdit.page | 11 ++- 5 files changed, 232 insertions(+), 168 deletions(-) diff --git a/plugins/dynamix/SecurityAFP.page b/plugins/dynamix/SecurityAFP.page index 29e49177e..0056788f5 100644 --- a/plugins/dynamix/SecurityAFP.page +++ b/plugins/dynamix/SecurityAFP.page @@ -4,8 +4,8 @@ Tag="apple" Cond="(($var['shareAFPEnabled']!='no') && (isset($name)?array_key_exists($name,$sec_afp):0))" --- Select the desired destinations and press **Write** to copy the AFP security settings to the selected shares.
-Read settings from - - +
-Write settings to - (All)"; foreach ($rows as $row) echo $row; ?> - +
@@ -139,8 +139,8 @@ Security: > Select the desired destinations and press **Write** to copy the AFP User access settings to the selected shares.
-Read settings from - - +
-Write settings to - (All)"; foreach ($rows as $row)echo $row; ?> - +
@@ -187,8 +187,8 @@ foreach ($rows as $row)echo $row; > Select the desired destinations and press **Write** to copy the AFP User access settings to the selected shares.
-Read settings from - - +
-Write settings to - (All)"; foreach($rows as $row) echo $row; ?> - +
@@ -260,21 +260,31 @@ function readAFP() { }); $(form).find('select').trigger('change'); } -function writeAFP() { - var data = {}, copied = false; - data.shareExportAFP = ''; - data.shareVolsizelimitAFP = ''; - data.shareVoldbpathAFP = ''; - data.shareSecurityAFP = ''; - data.changeShareSecurityAFP = 'Apply'; - $('select#afp1 option').map(function() { - if ($(this).prop('selected')==true && $(this).val()!='(All)') { - data.shareName = $(this).val(); - $.post('/update.htm', data); - copied = true; +function writeAFP(data,n,i) { + if (data) { + if (n'; + data[i]['shareVolsizelimitAFP'] = ''; + data[i]['shareVoldbpathAFP'] = ''; + data[i]['shareSecurityAFP'] = ''; + data[i]['changeShareSecurityAFP'] = 'Apply'; + i++; + } + }); + toggleButton('writeafp',true); + $('div.spinner.fixed').show('slow'); + writeAFP(data,0,i); + } } function readUserAFP() { var form = document.afp_user_edit; @@ -296,32 +306,43 @@ function readUserAFP() { }); $(form).find('select').trigger('change'); } -function writeUserAFP() { - var data = {}, copied = false; - data['userAccess.0'] = 'no-access'; +function writeUserAFP(data,n,i) { + if (data) { + if (n - data.changeShareAccessAFP = 'Apply'; - $('select#afp2 option').map(function() { - if ($(this).prop('selected')==true && $(this).val()!='(All)') { - data.shareName = $(this).val(); - $.post('/update.htm', data); - copied = true; - } - }); - if (copied) swal({title:'Clone complete',text:'AFP User Access settings are written to the selected shares',type:'success'},function(){refresh();}); + data[i]['changeShareAccessAFP'] = 'Apply'; + i++; + } + }); + toggleButton('writeuserafp',true); + $('div.spinner.fixed').show('slow'); + writeUserAFP(data,0,i); + } } diff --git a/plugins/dynamix/SecurityNFS.page b/plugins/dynamix/SecurityNFS.page index d993bdf15..51442152c 100644 --- a/plugins/dynamix/SecurityNFS.page +++ b/plugins/dynamix/SecurityNFS.page @@ -4,8 +4,8 @@ Tag="linux" Cond="(($var['shareNFSEnabled']!='no') && (isset($name)?array_key_exists($name,$sec_nfs):0))" --- Select the desired destinations and press **Write** to copy the NFS security settings to the selected shares.
-Read settings from - - +
-Write settings to - (All)"; foreach ($rows as $row) echo $row; ?> - +
@@ -116,18 +116,29 @@ function readNFS() { }); $(form).find('select').trigger('change'); } -function writeNFS() { - var data = {}, copied = false; - data.shareExportNFS = ''; - data.shareSecurityNFS = ''; - data.changeShareSecurityNFS = 'Apply'; - $('select#nfs1 option').map(function() { - if ($(this).prop('selected')==true && $(this).val()!='(All)') { - data.shareName = $(this).val(); - $.post('/update.htm', data); - copied = true; +function writeNFS(data,n,i) { + if (data) { + if (n'; + data[i]['shareSecurityNFS'] = ''; + data[i]['changeShareSecurityNFS'] = 'Apply'; + i++; + } + }); + toggleButton('writenfs',true); + $('div.spinner.fixed').show('slow'); + writeNFS(data,0,i); + } } diff --git a/plugins/dynamix/SecuritySMB.page b/plugins/dynamix/SecuritySMB.page index af331bd8b..0f5cf1953 100644 --- a/plugins/dynamix/SecuritySMB.page +++ b/plugins/dynamix/SecuritySMB.page @@ -4,8 +4,8 @@ Tag="windows" Cond="(($var['shareSMBEnabled']!='no') && (isset($name)?array_key_exists($name,$sec):0))" --- Select the desired destinations and press **Write** to copy the SMB security settings to the selected shares.
-Read settings from - - +
-Write settings to - (All)"; foreach ($rows as $row) echo $row; ?> - +
@@ -126,8 +126,8 @@ Security: > Select the desired destinations and press **Write** to copy the SMB User access settings to the selected shares.
-Read settings from - - +
-Write settings to - (All)"; foreach ($rows as $row) echo $row; ?> - +
@@ -174,8 +174,8 @@ foreach ($rows as $row) echo $row; > Select the desired destinations and press **Write** to copy the SMB User access settings to the selected shares.
-Read settings from - - +
-Write settings to - (All)"; foreach ($rows as $row) echo $row; ?> - +
@@ -246,20 +246,31 @@ function readSMB() { }); $(form).find('select').trigger('change'); } -function writeSMB() { - var data = {}, copied = false; - data.shareExport = ''; - data.shareFruit = ''; - data.shareSecurity = ''; - data.changeShareSecurity = 'Apply'; - $('select#smb1 option').map(function() { - if ($(this).prop('selected')==true && $(this).val()!='(All)') { - data.shareName = $(this).val(); - $.post('/update.htm', data); - copied = true; +function writeSMB(data,n,i) { + if (data) { + if (n'; + data[i]['shareFruit'] = ''; + data[i]['shareSecurity'] = ''; + data[i]['changeShareSecurity'] = 'Apply'; + i++; + } + }); + toggleButton('writesmb',true); + $('div.spinner.fixed').show('slow'); + writeSMB(data,0,i); + } } function readUserSMB() { var form = document.smb_user_edit; @@ -281,32 +292,43 @@ function readUserSMB() { }); $(form).find('select').trigger('change'); } -function writeUserSMB() { - var data = {}, copied = false; - data['userAccess.0'] = 'no-access'; +function writeUserSMB(data,n,i) { + if (data) { + if (n - data.changeShareAccess = 'Apply'; - $('select#smb2 option').map(function() { - if ($(this).prop('selected')==true && $(this).val()!='(All)') { - data.shareName = $(this).val(); - $.post('/update.htm', data); - copied = true; - } - }); - if (copied) swal({title:'Clone complete',text:'SMB User Access settings are written to the selected shares',type:'success'},function(){refresh();}); + data[i]['changeShareAccess'] = 'Apply'; + i++; + } + }); + toggleButton('writeusersmb',true); + $('div.spinner.fixed').show('slow'); + writeUserSMB(data,0,i); + } } diff --git a/plugins/dynamix/ShareEdit.page b/plugins/dynamix/ShareEdit.page index 059458d90..88b167bf9 100644 --- a/plugins/dynamix/ShareEdit.page +++ b/plugins/dynamix/ShareEdit.page @@ -3,8 +3,8 @@ Title="Share Settings" Tag="share-alt-square" ---
-Read settings from - - +
-Write settings to - (All)"; foreach ($rows as $row) echo $row; ?> - +
@@ -372,23 +372,34 @@ function readShare() { }); $(form).find('select').trigger('change'); } -function writeShare() { - var data = {}, copied = false; - data.shareAllocator = ''; - data.shareFloor = ''; - data.shareSplitLevel = ''; - data.shareInclude = ''; - data.shareExclude = ''; - data.shareUseCache = ''; - data.cmdEditShare = 'Apply'; - $('select#s3 option').map(function() { - if ($(this).prop('selected')==true && $(this).val()!='(All)') { - data.shareNameOrig = $(this).val(); - data.shareName = $(this).val(); - $.post('/update.htm', data); - copied = true; +function writeShare(data,n,i) { + if (data) { + if (n'; + data[i]['shareFloor'] = ''; + data[i]['shareSplitLevel'] = ''; + data[i]['shareInclude'] = ''; + data[i]['shareExclude'] = ''; + data[i]['shareUseCache'] = ''; + data[i]['cmdEditShare'] = 'Apply'; + i++; + } + }); + toggleButton('writeshare',true); + $('div.spinner.fixed').show('slow'); + writeShare(data,0,i); + } } diff --git a/plugins/dynamix/UserEdit.page b/plugins/dynamix/UserEdit.page index 5ce5c7c51..5d844fd6c 100644 --- a/plugins/dynamix/UserEdit.page +++ b/plugins/dynamix/UserEdit.page @@ -3,8 +3,8 @@ Title="Edit User" Tag="user" ---