Add in shares contrib also fix comment out script in partial add fix json5 python

This commit is contained in:
Brian Read 2025-05-21 11:06:32 +01:00
parent b6a31f89df
commit 588081417b
21 changed files with 3288 additions and 5 deletions

View File

@ -0,0 +1,546 @@
#
# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
#
#
# Routines to be edited by the developer to provide content and validation for parameters
# and provison of the control data for table(s)
#
use esmith::util;
use esmith::util::network;
use esmith::ConfigDB;
use esmith::HostsDB;
use esmith::AccountsDB;
use esmith::NetworksDB;
use esmith::DomainsDB;
use constant FALSE => 0;
use constant TRUE => 1;
#The most common ones - open DB when required.
my $cdb;
my $adb;
my $ndb;
my $hdb;
my $ddb;
# Validation routines - parameters for each panel
sub validate_LIST {
my $c = shift;
my $sf_data = shift; #Data hash as parameter
# Validation for each field
my $ret = "";
if ($ret eq "") {$ret = 'ok';}
return $ret;
}
sub validate_MODIFY {
my $c = shift;
my $sf_data = shift; #Data hash as parameter
# Validation for each field
my $ret = "";
if (! TRUE) #validate $c->param('description')
{$ret .= 'Validation for description failed';}
if (! TRUE) #validate $c->param('smbaccess')
{$ret .= 'Validation for smbaccess failed';}
if (! TRUE) #validate $c->param('recyclebin')
{$ret .= 'Validation for recyclebin failed';}
if (! TRUE) #validate $c->param('retention')
{$ret .= 'Validation for retention failed';}
if (! TRUE) #validate $c->param('httpaccess')
{$ret .= 'Validation for httpaccess failed';}
if (! TRUE) #validate $c->param('webdav')
{$ret .= 'Validation for webdav failed';}
if (! TRUE) #validate $c->param('requireSSL')
{$ret .= 'Validation for requireSSL failed';}
if (! TRUE) #validate $c->param('indexes')
{$ret .= 'Validation for indexes failed';}
if (! TRUE) #validate $c->param('dynamic')
{$ret .= 'Validation for dynamic failed';}
if ($ret eq "") {$ret = 'ok';}
return $ret;
}
sub validate_PERMISSIONS {
my $c = shift;
my $sf_data = shift; #Data hash as parameter
# Validation for each field
my $ret = "";
if (! TRUE) #validate $c->param('writegroup')
{$ret .= 'Validation for writegroup failed';}
if (! TRUE) #validate $c->param('readgroup')
{$ret .= 'Validation for readgroup failed';}
if (! TRUE) #validate $c->param('writegroup')
{$ret .= 'Validation for writegroup failed';}
if (! TRUE) #validate $c->param('readgroup')
{$ret .= 'Validation for readgroup failed';}
if (! TRUE) #validate $c->param('writegroup')
{$ret .= 'Validation for writegroup failed';}
if (! TRUE) #validate $c->param('readgroup')
{$ret .= 'Validation for readgroup failed';}
if (! TRUE) #validate $c->param('writegroup')
{$ret .= 'Validation for writegroup failed';}
if (! TRUE) #validate $c->param('readgroup')
{$ret .= 'Validation for readgroup failed';}
if (! TRUE) #validate $c->param('writegroup')
{$ret .= 'Validation for writegroup failed';}
if (! TRUE) #validate $c->param('readgroup')
{$ret .= 'Validation for readgroup failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if (! TRUE) #validate $c->param('writeuser')
{$ret .= 'Validation for writeuser failed';}
if (! TRUE) #validate $c->param('readuser')
{$ret .= 'Validation for readuser failed';}
if ($ret eq "") {$ret = 'ok';}
return $ret;
}
sub validate_REMOVE {
my $c = shift;
my $sf_data = shift; #Data hash as parameter
# Validation for each field
my $ret = "";
if ($ret eq "") {$ret = 'ok';}
return $ret;
}
# Get singleton data for each panel
sub get_data_for_panel_LIST {
# Return a hash with the fields required which will be loaded into the shared data
my $c = shift;
my %ret = (
'Data1'=>'Data for LIST', #Example
# fields from Inputs in LIST $fields['LIST']
);
return %ret;
}
sub get_data_for_panel_MODIFY {
# Return a hash with the fields required which will be loaded into the shared data
my $c = shift;
my %ret = (
'Data1'=>'Data for MODIFY', #Example
# fields from Inputs in MODIFY $fields['MODIFY']
'description'=>'description contents',
'smbaccess'=>'smbaccess contents',
'recyclebin'=>'recyclebin contents',
'retention'=>'retention contents',
'httpaccess'=>'httpaccess contents',
'webdav'=>'webdav contents',
'requireSSL'=>'requireSSL contents',
'indexes'=>'indexes contents',
'dynamic'=>'dynamic contents',
);
return %ret;
}
sub get_data_for_panel_PERMISSIONS {
# Return a hash with the fields required which will be loaded into the shared data
my $c = shift;
my %ret = (
'Data1'=>'Data for PERMISSIONS', #Example
# fields from Inputs in PERMISSIONS $fields['PERMISSIONS']
'writegroup'=>'writegroup contents',
'readgroup'=>'readgroup contents',
'writegroup'=>'writegroup contents',
'readgroup'=>'readgroup contents',
'writegroup'=>'writegroup contents',
'readgroup'=>'readgroup contents',
'writegroup'=>'writegroup contents',
'readgroup'=>'readgroup contents',
'writegroup'=>'writegroup contents',
'readgroup'=>'readgroup contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
'writeuser'=>'writeuser contents',
'readuser'=>'readuser contents',
);
return %ret;
}
sub get_data_for_panel_REMOVE {
# Return a hash with the fields required which will be loaded into the shared data
my $c = shift;
my %ret = (
'Data1'=>'Data for REMOVE', #Example
# fields from Inputs in REMOVE $fields['REMOVE']
);
return %ret;
}
# Get control data for table(s)
# Define a constant hash for field name mapping
use constant Table1_FIELD_MAPPING => (
'Table1-Name' => 'Table1-Name',
'Table1-Description' => 'Table1-Description',
'Table1-Actionp' => 'Table1-Actionp',
'Table1-Actionm' => 'Table1-Actionm',
'Table1-Actionr' => 'Table1-Actionr',
);
sub actual_Table1 {
my $c = shift;
my @ret = ();
# Actual code for extracting Table1
$adb = esmith::AccountsDB::open() | die("Unable to open accounts DB");
my @shares = $adb->get_all_by_prop(type => 'share');
foreach my $share (@shares) {
my $sharename = $share->key();
my $sharedesc = $share->prop('Name');
next if (($share->prop('Hide') || 'no') eq 'yes');
my $removable = $share->prop('Removable') || 'yes';
my $actionModify = '<a href="sharesd?trt=MODIFY&Selected='.$sharename.'>'.$c->l('sf_Modify').'>';
my $actionPerm = '<a href="sharesd?trt=PERMISSIONS&Selected='.$sharename.'>'.$c->l('sf_Permisssions').'>';
my $actionRemove = ($removable ne 'no') ?'<a href="sharesd?trt=REMOVE&Selected='.$sharename.'>'.$c->l('sf_Remove').'>' : '';
push @ret,
{ Table1-Name => $sharename,
Table1-Description => $sharedesc,
Table1-Actionp => $actionPerm,
Table1-Actionm => $actionModify,
Table1-Actionr => $actionRemove,
}
}
return @ret;
}
sub get_Table1 {
# Return an array of hashes of the contents for each row and column for Table1
my $c = shift;
my @source_records = $c->actual_Table1();
my @transformed_records;
my %Field_Mapping = Table1_FIELD_MAPPING();
# Iterate over each record in the source array
for my $source_record (@source_records) {
my %transformed_record;
# Iterate over each key-value pair in the $Field_Mapping constant
while (my ($target, $source) = each %Field_Mapping) {
# Check if the source field exists in the source record
if (exists $source_record->{$source}) {
# Assign the source field value to the target field in the transformed record
$transformed_record{$target} = $source_record->{$source};
}
}
# Add transformed record to the array if it's not empty
push @transformed_records, \%transformed_record if %transformed_record;
}
return \@transformed_records;
}
# Define a constant hash for field name mapping
use constant Table2_FIELD_MAPPING => (
'Table2-Groups' => 'Source-for-Table2-Groups',
'Table2-Description' => 'Source-for-Table2-Description',
'Table2-Read / Write' => 'Source-for-Table2-Read / Write',
'Table2-Read Only' => 'Source-for-Table2-Read Only'
#'target_field2' => 'source_field2',
# Add more mappings as needed
);
sub actual_Table2 {
my $c = shift;
my @ret = ();
# Actual code for extracting Table2
return @ret;
}
sub get_Table2 {
# Return an array of hashes of the contents for each row and column for Table2
my $c = shift;
my @source_records = $c->actual_Table2();
my @transformed_records;
my %Field_Mapping = Table2_FIELD_MAPPING();
# Iterate over each record in the source array
for my $source_record (@source_records) {
my %transformed_record;
# Iterate over each key-value pair in the $Field_Mapping constant
while (my ($target, $source) = each %Field_Mapping) {
# Check if the source field exists in the source record
if (exists $source_record->{$source}) {
# Assign the source field value to the target field in the transformed record
$transformed_record{$target} = $source_record->{$source};
}
}
# Add transformed record to the array if it's not empty
push @transformed_records, \%transformed_record if %transformed_record;
}
return \@transformed_records;
}
# Return hash with values from row in which link clicked on table
sub get_selected_LIST {
my $c = shift;
my $selected = shift; #Parameter is name of selected row.
my $is_new_record = shift; #Indicates new record required (defaults)
my %ret = {};
return %ret;
}
sub get_selected_MODIFY {
my $c = shift;
my $selected = shift; #Parameter is name of selected row.
my $is_new_record = shift; #Indicates new record required (defaults)
my %ret = {};
return %ret;
}
sub get_selected_PERMISSIONS {
my $c = shift;
my $selected = shift; #Parameter is name of selected row.
my $is_new_record = shift; #Indicates new record required (defaults)
my %ret = {};
return %ret;
}
sub get_selected_REMOVE {
my $c = shift;
my $selected = shift; #Parameter is name of selected row.
my $is_new_record = shift; #Indicates new record required (defaults)
my %ret = {};
return %ret;
}
#after sucessful modify or create or whatever and submit then perfom (if the params validate)
sub perform_LIST {
my $c = shift;
my $sf_data = shift; #Data hash as parameter
my $ret = "";
my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis';
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
if ($ret eq "") {$ret = 'ok';}
return $ret;
}
sub perform_MODIFY {
my $c = shift;
my $sf_data = shift; #Data hash as parameter
my $ret = "";
my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis';
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
if (! TRUE) #copy or perform with value: description e.g. $db->set_prop($dbkey,'description',$c->param('description'),type=>'service'))
{$ret .= 'Perform/save failed for description';}
if (! TRUE) #copy or perform with value: smbaccess e.g. $db->set_prop($dbkey,'smbaccess',$c->param('smbaccess'),type=>'service'))
{$ret .= 'Perform/save failed for smbaccess';}
if (! TRUE) #copy or perform with value: recyclebin e.g. $db->set_prop($dbkey,'recyclebin',$c->param('recyclebin'),type=>'service'))
{$ret .= 'Perform/save failed for recyclebin';}
if (! TRUE) #copy or perform with value: retention e.g. $db->set_prop($dbkey,'retention',$c->param('retention'),type=>'service'))
{$ret .= 'Perform/save failed for retention';}
if (! TRUE) #copy or perform with value: httpaccess e.g. $db->set_prop($dbkey,'httpaccess',$c->param('httpaccess'),type=>'service'))
{$ret .= 'Perform/save failed for httpaccess';}
if (! TRUE) #copy or perform with value: webdav e.g. $db->set_prop($dbkey,'webdav',$c->param('webdav'),type=>'service'))
{$ret .= 'Perform/save failed for webdav';}
if (! TRUE) #copy or perform with value: requireSSL e.g. $db->set_prop($dbkey,'requireSSL',$c->param('requireSSL'),type=>'service'))
{$ret .= 'Perform/save failed for requireSSL';}
if (! TRUE) #copy or perform with value: indexes e.g. $db->set_prop($dbkey,'indexes',$c->param('indexes'),type=>'service'))
{$ret .= 'Perform/save failed for indexes';}
if (! TRUE) #copy or perform with value: dynamic e.g. $db->set_prop($dbkey,'dynamic',$c->param('dynamic'),type=>'service'))
{$ret .= 'Perform/save failed for dynamic';}
if ($ret eq "") {$ret = 'ok';}
return $ret;
}
sub perform_PERMISSIONS {
my $c = shift;
my $sf_data = shift; #Data hash as parameter
my $ret = "";
my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis';
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
if (! TRUE) #copy or perform with value: writegroup e.g. $db->set_prop($dbkey,'writegroup',$c->param('writegroup'),type=>'service'))
{$ret .= 'Perform/save failed for writegroup';}
if (! TRUE) #copy or perform with value: readgroup e.g. $db->set_prop($dbkey,'readgroup',$c->param('readgroup'),type=>'service'))
{$ret .= 'Perform/save failed for readgroup';}
if (! TRUE) #copy or perform with value: writegroup e.g. $db->set_prop($dbkey,'writegroup',$c->param('writegroup'),type=>'service'))
{$ret .= 'Perform/save failed for writegroup';}
if (! TRUE) #copy or perform with value: readgroup e.g. $db->set_prop($dbkey,'readgroup',$c->param('readgroup'),type=>'service'))
{$ret .= 'Perform/save failed for readgroup';}
if (! TRUE) #copy or perform with value: writegroup e.g. $db->set_prop($dbkey,'writegroup',$c->param('writegroup'),type=>'service'))
{$ret .= 'Perform/save failed for writegroup';}
if (! TRUE) #copy or perform with value: readgroup e.g. $db->set_prop($dbkey,'readgroup',$c->param('readgroup'),type=>'service'))
{$ret .= 'Perform/save failed for readgroup';}
if (! TRUE) #copy or perform with value: writegroup e.g. $db->set_prop($dbkey,'writegroup',$c->param('writegroup'),type=>'service'))
{$ret .= 'Perform/save failed for writegroup';}
if (! TRUE) #copy or perform with value: readgroup e.g. $db->set_prop($dbkey,'readgroup',$c->param('readgroup'),type=>'service'))
{$ret .= 'Perform/save failed for readgroup';}
if (! TRUE) #copy or perform with value: writegroup e.g. $db->set_prop($dbkey,'writegroup',$c->param('writegroup'),type=>'service'))
{$ret .= 'Perform/save failed for writegroup';}
if (! TRUE) #copy or perform with value: readgroup e.g. $db->set_prop($dbkey,'readgroup',$c->param('readgroup'),type=>'service'))
{$ret .= 'Perform/save failed for readgroup';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
{$ret .= 'Perform/save failed for writeuser';}
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
{$ret .= 'Perform/save failed for readuser';}
if ($ret eq "") {$ret = 'ok';}
return $ret;
}
sub perform_REMOVE {
my $c = shift;
my $sf_data = shift; #Data hash as parameter
my $ret = "";
my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis';
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
if ($ret eq "") {$ret = 'ok';}
return $ret;
}
sub create_link{
# WIP
my ($c,$route, $panel, $index) = @_;
my $link = "$route?trt=$panel&Selected=$index";
return $link;
}
1;

398
Targets/Shares/Shares.pm Normal file
View File

@ -0,0 +1,398 @@
package SrvMngr::Controller::Shares;
#
# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
# Remember that each route must be unique (else they just overwrite each other).
# you cannot have get and post on the same name and url.
#
#----------------------------------------------------------------------
# heading : Network
# description : Shared Folders
# navigation : 7000 400
#
# name : shares, method : get, url : /shares, ctlact : Shares#main
# name : sharesu, method : post, url : /sharesu, ctlact : Shares#do_update
# name : sharesd, method : get, url : /sharesd, ctlact : Shares#do_display
#
# routes : end
#
# Documentation: https://wiki.contribs.org/Shares
#----------------------------------------------------------------------
#
# Scheme of things:
#
# TBA!!
use strict;
use warnings;
use Mojo::Base 'Mojolicious::Controller';
use constant FALSE => 0;
use constant TRUE => 1;
use Locale::gettext;
use SrvMngr::I18N;
use SrvMngr qw(theme_list init_session);
use Data::Dumper;
use esmith::util;
use esmith::util::network;
use esmith::ConfigDB;
use esmith::AccountsDB;
use esmith::NetworksDB;
use esmith::HostsDB;
use esmith::DomainsDB;
my $cdb;
my $adb;
my $ndb;
my $hdb;
my $ddb;
my %sf_data;
require '/usr/share/smanager/lib/SrvMngr/Controller/Shares-Custom.pm'; #The code that is to be added by the developer
sub main {
#
# Initial entry - route is "/<whatever>"
#
#set initial panel
#for initial panel:
#Specifiy panel to enter
#load up _data hash with DB fields
#load up stash with pointer(s) to control fields hash(= get-))
#and a pointer to the prefix_data hash
#render initial panel
my $c = shift;
$c->app->log->info( $c->log_req );
#The most common ones
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
$hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
$ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
%sf_data = ();
my $title = $c->l('sf_Shared_Folders');
my $modul = '';
$sf_data{'trt'} = 'LIST';
#Load any DB entries into the <prefix>_data area so as they are preset in the form
# which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE
my $db = $cdb; #pickup local or global db or Default to config
$c->do_display($sf_data{'trt'});
}
# Post request with params - submit from the form
sub do_update {
#
# Return after submit pushed on panel (this is a post) - route is "/<whatever>u"
# parameters in the params hash.
#
#load up all params into prefix_data hash:
#By panel (series of if statements - only one executed):
#call validate-PANEL() - return ret = ok or error message
#if validation not ok:
#render back to current panel with error message in stash
#otherwise:
#By panel (series of if statements - only one executed):
#do whatever is required: call perform-PANEL() - return "ok" or Error Message
#call signal-event for any global actions specified (check it exists - error and continue?)
#if action smeserver-<whatever>-update exists
#signal_event smeserver-<whatever>-update
#call signal-event for any specific actions for thids panel (check it exists first - error and continue)
#set success in stash
#if no "nextpanel" entry:
#set firstpanel
#else
#set nextpanel
#call render
my $c = shift;
$c->app->log->info($c->log_req);
my $modul = '';
#The most common ones - you might want to comment out any not used.
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
$hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
$ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
my $title = $c->l('sf_Shared_Folders');
# Accessing all POST/GET parameters
my $params = $c->req->params->to_hash;
# Get number of POST parameters
#my $num_params = keys scaler %$params;
#Params are available in the hash "params" - copy to the prefix_data hash
#while (my ($key, $value) = each %{$c->req->params->to_hash}) {
# $sf_data{$key} = $value;
#}
# the value of trt will tell you which panel has returned
my $trt = $c->param('trt') || 'LIST'; #hidden control on every form.
my $ret = 'ok';
#Validate the parameters in a custom sub one for each panel (although only one of these will be executed)
my $thispanel;
if ($trt eq 'LIST'){
#Validate form parameters for panel LIST
$ret = $c->validate_LIST(\%sf_data);
$thispanel = 'LIST';
}
if ($trt eq 'MODIFY'){
#Validate form parameters for panel MODIFY
$ret = $c->validate_MODIFY(\%sf_data);
$thispanel = 'MODIFY';
}
if ($trt eq 'PERMISSIONS'){
#Validate form parameters for panel PERMISSIONS
$ret = $c->validate_PERMISSIONS(\%sf_data);
$thispanel = 'PERMISSIONS';
}
if ($trt eq 'REMOVE'){
#Validate form parameters for panel REMOVE
$ret = $c->validate_REMOVE(\%sf_data);
$thispanel = 'REMOVE';
}
if ($ret ne "ok"){
$c->stash(error => $c->l($ret));
$c->do_display($thispanel);
} else {
#Do whatever is needed, including writing values to the DB
if ($trt eq 'LIST'){
#do whatever is required ...
$ret = $c->perform_LIST(\%sf_data);
if ($ret ne "ok") {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->stash(
title => $title,
modul => $modul,
sf_data => \%sf_data
);
$c->render(template => "shares");
} else {
$c->stash( success => $c->l('sf_LIST_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
if ($trt eq 'MODIFY'){
#do whatever is required ...
$ret = $c->perform_MODIFY(\%sf_data);
if ($ret ne "ok") {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->stash(
title => $title,
modul => $modul,
sf_data => \%sf_data
);
$c->render(template => "shares");
} else {
$c->stash( success => $c->l('sf_MODIFY_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
if ($trt eq 'PERMISSIONS'){
#do whatever is required ...
$ret = $c->perform_PERMISSIONS(\%sf_data);
if ($ret ne "ok") {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->stash(
title => $title,
modul => $modul,
sf_data => \%sf_data
);
$c->render(template => "shares");
} else {
$c->stash( success => $c->l('sf_PERMISSIONS_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
if ($trt eq 'REMOVE'){
#do whatever is required ...
$ret = $c->perform_REMOVE(\%sf_data);
if ($ret ne "ok") {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->stash(
title => $title,
modul => $modul,
sf_data => \%sf_data
);
$c->render(template => "shares");
} else {
$c->stash( success => $c->l('sf_REMOVE_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
# and call any signal-events needed
#TBD
# Setup shared data and call panel
if ('none' eq 'none') {
$sf_data{'trt'} = 'LIST';
} else {
$sf_data{'trt'} = 'none';
}
$c->do_display($sf_data{'trt'});
}
}
sub do_display {
#
# Return after link clicked in table (this is a get) - route is "/<whatever>d"
# Expects ?trt=PANEL&selected="TableRowName" plus any other required
#
# OR it maybe a post from the main panel to add a new record
#
#load up all supplied params into prefix_data hash
#call get-selected-PANEL() - returns hash of all relevent parameters
#load up returned hash into prefix_data
#render - to called panel
my ($c,$trt) = @_;
$c->app->log->info($c->log_req);
#The most common ones - you might want to comment out any not used.
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
$hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
$ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
my $title = $c->l('sf_Shared_Folders');
my $modul = "";
# Accessing all parameters
my $params = $c->req->params->to_hash;
# Get number of parameters
my $num_params = keys %$params;
#Tag as Post or Get (ie. create new entry or edit existing one
my $is_new_record = ($c->req->method() eq 'POST');
#Params are available in the hash "params" - copy to the prefix_data hash
#while (my ($key, $value) = each %{$c->req->params->to_hash}) {
# $sf_data{$key} = $value;
#}
# the value of trt will tell you which panel has returned
if (! $trt){
$trt = $c->param('trt') || 'LIST'; #Indicates where to go now
}
# Now add in the params from the selected row from the table
my %selectedrow;
if ($trt eq 'LIST'){
#Validate Get selected row (if applicable) LIST
%selectedrow = $c->get_selected_LIST($sf_data{'Selected'},$is_new_record);
}
if ($trt eq 'MODIFY'){
#Validate Get selected row (if applicable) MODIFY
%selectedrow = $c->get_selected_MODIFY($sf_data{'Selected'},$is_new_record);
}
if ($trt eq 'PERMISSIONS'){
#Validate Get selected row (if applicable) PERMISSIONS
%selectedrow = $c->get_selected_PERMISSIONS($sf_data{'Selected'},$is_new_record);
}
if ($trt eq 'REMOVE'){
#Validate Get selected row (if applicable) REMOVE
%selectedrow = $c->get_selected_REMOVE($sf_data{'Selected'},$is_new_record);
}
#Copy in the selected row params to the prefix_data hash to pass to the panel
while (my ($key, $value) = each %selectedrow){
$sf_data{$key} = $value;
}
# Where to go now
$sf_data{'trt'} = $trt;
# Set up other shared data according to the panel to go to
if ($trt eq 'LIST'){
# pickup any other contents needed and load them into hash shared with panel
my %returned_hash;
# subroutine returns a hash directly
%returned_hash = $c->get_data_for_panel_LIST();
# Copy each key-value pair from the returned hash to the prefix data hash
while (my ($key, $value) = each %returned_hash) {
$sf_data{$key} = $value;
}
}
if ($trt eq 'MODIFY'){
# pickup any other contents needed and load them into hash shared with panel
my %returned_hash;
# subroutine returns a hash directly
%returned_hash = $c->get_data_for_panel_MODIFY();
# Copy each key-value pair from the returned hash to the prefix data hash
while (my ($key, $value) = each %returned_hash) {
$sf_data{$key} = $value;
}
}
if ($trt eq 'PERMISSIONS'){
# pickup any other contents needed and load them into hash shared with panel
my %returned_hash;
# subroutine returns a hash directly
%returned_hash = $c->get_data_for_panel_PERMISSIONS();
# Copy each key-value pair from the returned hash to the prefix data hash
while (my ($key, $value) = each %returned_hash) {
$sf_data{$key} = $value;
}
}
if ($trt eq 'REMOVE'){
# pickup any other contents needed and load them into hash shared with panel
my %returned_hash;
# subroutine returns a hash directly
%returned_hash = $c->get_data_for_panel_REMOVE();
# Copy each key-value pair from the returned hash to the prefix data hash
while (my ($key, $value) = each %returned_hash) {
$sf_data{$key} = $value;
}
}
# and table control fields
$c->stash(Table1=>$c->get_Table1());
$c->stash(Table2=>$c->get_Table2());
# Data for panel
$c->stash(
title => $title,
modul => $modul,
sf_data => \%sf_data
);
$c->render(template => "shares");
}
1;

View File

@ -0,0 +1,69 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
%#
<div id="Shares-LIST" class="partial Shares-LIST">
# <script>
# window.onload = function() {
# SelectInput();
# };
# </script>
% if (config->{debug} == 1) {
<pre>
%= dumper $sf_data
</pre>
% }
% my $btn = l('sf_APPLY');
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
%= form_for "sharesu" => (method => 'POST') => begin
% param 'trt' => $sf_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $sf_data->{trt}
%# Inputs etc in here.
<h1 class='head'><%=l('sf_Create,_modify,_or_remove_shared')%></h1>
<h2 class='subh'><%=l('sf_Manage_shared-folders_settings:')%></h2>
<p class='paragraph para1'>
%=l('sf_You_can_remove_any_shared')
</p>
<p class='paragraph para2'>
%=l('sf_Create_a_new_shared_folder')
</p>
<a href='shared-folderu?trt=MODIFY' class='link link1'>
%= l('sf_Create_a_new_shared_folder')
</a>
%#= link_to l('sf_Create_a_new_shared_folder'), 'shared-folderu?trt=MODIFY' , class=>'link link1'
<br /><table class="sme-border TableSort sme-table tabl1 ">
<thead class='tabl1'>
<tr table-head-row>
<th class='sme-border table-head-col table-head-col-Name '><%=l('sf_Name')%></th>
<th class='sme-border table-head-col table-head-col-Description '><%=l('sf_Description')%></th>
<th class='sme-border table-head-col table-head-col-Actionp '><%=l('sf_Actionp')%></th>
<th class='sme-border table-head-col table-head-col-Actionm '><%=l('sf_Actionm')%></th>
<th class='sme-border table-head-col table-head-col-Actionr '><%=l('sf_Actionr')%></th>
</tr>
</thead>
<tbody class='tabl1'>
% my $control_data = $c->stash('Table1');
% foreach my $row (@$control_data) {
<tr class='table-row'>
<td class='sme-border table-col table-col-Table1-Name'><%=$c->render_to_string(inline=>$row->{'Table1-Name'})%></td>
<td class='sme-border table-col table-col-Table1-Description'><%=$c->render_to_string(inline=>$row->{'Table1-Description'})%></td>
<td class='sme-border table-col table-col-Table1-Actionp'><%=$c->render_to_string(inline=>$row->{'Table1-Actionp'})%></td>
<td class='sme-border table-col table-col-Table1-Actionm'><%=$c->render_to_string(inline=>$row->{'Table1-Actionm'})%></td>
<td class='sme-border table-col table-col-Table1-Actionr'><%=$c->render_to_string(inline=>$row->{'Table1-Actionr'})%></td>
</tr>
%}
</tbody>
</table>
%# Probably finally by a submit.
%end
</div>

View File

@ -0,0 +1,113 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
%#
<div id="Shares-MODIFY" class="partial Shares-MODIFY">
# <script>
# window.onload = function() {
# SelectInput();
# };
# </script>
% if (config->{debug} == 1) {
<pre>
%= dumper $sf_data
</pre>
% }
% my $btn = l('sf_APPLY');
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
%= form_for "sharesu" => (method => 'POST') => begin
% param 'trt' => $sf_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $sf_data->{trt}
%# Inputs etc in here.
<h1 class='head'><%=l('sf_Create,_modify,_or_remove_shared')%></h1>
<h2 class='subh'><%=l('sf_Create_or_modify_a_shared')%></h2>
<p><span class=label>
%=l('sf_description')
</span><span class=data>
% param 'description' => $sf_data->{description} unless param 'description';
%= text_field 'description', size => '50', class => 'textinput description' , pattern=>'.*' , placeholder=>'description', title =>'Pattern regex mismatch', id => 'description_text'
<br></span></p>
<p class='paragraph para14'>
%=l('sf_The_following_settings_control_the')
</p>
<p><span class=label>
%=l('sf_smbaccess')
</span><span class=data>
% my @smbaccess_options = [['Enabled, browseable' => 'browseable'], ['Enabled, hidden' => 'non-browseable'], ['No access' => 'none']];
% param 'smbaccess' => $sf_data->{smbaccess} unless param 'smbaccess';
%= select_field 'smbaccess' => @smbaccess_options, class => 'input', id => 'smbaccess_select'
<br></span> </p>
<p><span class=label>
%=l('sf_recyclebin')
</span><span class=data>
% my @recyclebin_options = [['disabled' => 'disabled'], ['Enabled, keep only the latest version' => 'enabled'], ['Enabled, keep a copy of all versions' => 'keep-versions']];
% param 'recyclebin' => $sf_data->{recyclebin} unless param 'recyclebin';
%= select_field 'recyclebin' => @recyclebin_options, class => 'input', id => 'recyclebin_select'
<br></span> </p>
<p><span class=label>
%=l('sf_retention')
</span><span class=data>
% my @retention_options = [['one month' => '30'], ['one week' => '7'], ['one year' => '365'], ['six months' => '180'], ['unlimited' => 'unlimited']];
% param 'retention' => $sf_data->{retention} unless param 'retention';
%= select_field 'retention' => @retention_options, class => 'input', id => 'retention_select'
<br></span> </p>
<p class='paragraph para2'>
%=l('sf_The_following_settings_control_the')
</p>
<p><span class=label>
%=l('sf_httpaccess')
</span><span class=data>
% my @httpaccess_options = [['Entire Internet (no password required)' => 'global'], ['Entire Internet (password required)' => 'global-pw'], ['Entire Internet (password required outside local network)' => 'global-pw-remote'], ['Local network (no password required)' => 'local'], ['Local network (password required)' => 'local-pw'], ['No access' => 'none']];
% param 'httpaccess' => $sf_data->{httpaccess} unless param 'httpaccess';
%= select_field 'httpaccess' => @httpaccess_options, class => 'input', id => 'httpaccess_select'
<br></span> </p>
<p><span class=label>
%=l('sf_webdav')
</span><span class=data>
% my @webdav_options = [['disabled' => 'disabled'], ['enabled' => 'enabled']];
% param 'webdav' => $sf_data->{webdav} unless param 'webdav';
%= select_field 'webdav' => @webdav_options, class => 'input', id => 'webdav_select'
<br></span> </p>
<p><span class=label>
%=l('sf_requireSSL')
</span><span class=data>
% my @requireSSL_options = [['disabled' => 'disabled'], ['enabled' => 'enabled']];
% param 'requireSSL' => $sf_data->{requireSSL} unless param 'requireSSL';
%= select_field 'requireSSL' => @requireSSL_options, class => 'input', id => 'requireSSL_select'
<br></span> </p>
<p><span class=label>
%=l('sf_indexes')
</span><span class=data>
% my @indexes_options = [['disabled' => 'disabled'], ['enabled' => 'enabled']];
% param 'indexes' => $sf_data->{indexes} unless param 'indexes';
%= select_field 'indexes' => @indexes_options, class => 'input', id => 'indexes_select'
<br></span> </p>
<p><span class=label>
%=l('sf_dynamic')
</span><span class=data>
% my @dynamic_options = [['disabled' => 'disabled'], ['enabled' => 'enabled']];
% param 'dynamic' => $sf_data->{dynamic} unless param 'dynamic';
%= select_field 'dynamic' => @dynamic_options, class => 'input', id => 'dynamic_select'
<br></span> </p>
<span class='data'>
%= submit_button l('sf_Save'), class => 'action subm109'
</span>
%# Probably finally by a submit.
%end
</div>

View File

@ -0,0 +1,365 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
%#
<div id="Shares-PERMISSIONS" class="partial Shares-PERMISSIONS">
# <script>
# window.onload = function() {
# SelectInput();
# };
# </script>
% if (config->{debug} == 1) {
<pre>
%= dumper $sf_data
</pre>
% }
% my $btn = l('sf_APPLY');
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
%= form_for "sharesu" => (method => 'POST') => begin
% param 'trt' => $sf_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $sf_data->{trt}
%# Inputs etc in here.
<h1 class='head'><%=l('sf_Create,_modify,_or_remove_shared')%></h1>
<h2 class='subh'><%=l('sf_Access_right_management')%></h2>
<p class='paragraph para10'>
%=l('sf_You_can_use_this_matrix')
</p>
<br /><table class="sme-border TableSort sme-table tabl2 ">
<thead class='tabl2'>
<tr table-head-row>
<th class='sme-border table-head-col table-head-col-Groups '><%=l('sf_Groups')%></th>
<th class='sme-border table-head-col table-head-col-Description '><%=l('sf_Description')%></th>
<th class='sme-border table-head-col table-head-col-Read / Write '><%=l('sf_Read_/_Write')%></th>
<th class='sme-border table-head-col table-head-col-Read Only '><%=l('sf_Read_Only')%></th>
</tr>
</thead>
<tbody class='tabl2'>
% my $control_data = $c->stash('Table2');
% foreach my $row (@$control_data) {
<tr class='table-row'>
<td class='sme-border table-col table-col-Table2-Groups'><%=$c->render_to_string(inline=>$row->{'Table2-Groups'})%></td>
<td class='sme-border table-col table-col-Table2-Description'><%=$c->render_to_string(inline=>$row->{'Table2-Description'})%></td>
<td class='sme-border table-col table-col-Table2-Read / Write'><%=$c->render_to_string(inline=>$row->{'Table2-Read / Write'})%></td>
<td class='sme-border table-col table-col-Table2-Read Only'><%=$c->render_to_string(inline=>$row->{'Table2-Read Only'})%></td>
</tr>
%}
</tbody>
</table>
<p><span class='label'>
%=l('sf_writegroup')
</span><span class=data>
% param 'writegroup' => $sf_data->{writegroup} unless param 'writegroup';
%=checkbox_field 'writegroup', class => 'chec110'
</span></p>
<p><span class='label'>
%=l('sf_readgroup')
</span><span class=data>
% param 'readgroup' => $sf_data->{readgroup} unless param 'readgroup';
%=checkbox_field 'readgroup', class => 'chec111'
</span></p>
<p><span class='label'>
%=l('sf_writegroup')
</span><span class=data>
% param 'writegroup' => $sf_data->{writegroup} unless param 'writegroup';
%=checkbox_field 'writegroup', class => 'chec112'
</span></p>
<p><span class='label'>
%=l('sf_readgroup')
</span><span class=data>
% param 'readgroup' => $sf_data->{readgroup} unless param 'readgroup';
%=checkbox_field 'readgroup', class => 'chec113'
</span></p>
<p><span class='label'>
%=l('sf_writegroup')
</span><span class=data>
% param 'writegroup' => $sf_data->{writegroup} unless param 'writegroup';
%=checkbox_field 'writegroup', class => 'chec114'
</span></p>
<p><span class='label'>
%=l('sf_readgroup')
</span><span class=data>
% param 'readgroup' => $sf_data->{readgroup} unless param 'readgroup';
%=checkbox_field 'readgroup', class => 'chec115'
</span></p>
<p><span class='label'>
%=l('sf_writegroup')
</span><span class=data>
% param 'writegroup' => $sf_data->{writegroup} unless param 'writegroup';
%=checkbox_field 'writegroup', class => 'chec116'
</span></p>
<p><span class='label'>
%=l('sf_readgroup')
</span><span class=data>
% param 'readgroup' => $sf_data->{readgroup} unless param 'readgroup';
%=checkbox_field 'readgroup', class => 'chec117'
</span></p>
<p><span class='label'>
%=l('sf_writegroup')
</span><span class=data>
% param 'writegroup' => $sf_data->{writegroup} unless param 'writegroup';
%=checkbox_field 'writegroup', class => 'chec118'
</span></p>
<p><span class='label'>
%=l('sf_readgroup')
</span><span class=data>
% param 'readgroup' => $sf_data->{readgroup} unless param 'readgroup';
%=checkbox_field 'readgroup', class => 'chec119'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec120'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec121'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec122'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec123'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec124'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec125'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec126'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec127'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec128'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec129'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec130'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec131'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec132'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec133'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec134'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec135'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec136'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec137'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec138'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec139'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec140'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec141'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec142'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec143'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec144'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec145'
</span></p>
<p><span class='label'>
%=l('sf_writeuser')
</span><span class=data>
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
%=checkbox_field 'writeuser', class => 'chec146'
</span></p>
<p><span class='label'>
%=l('sf_readuser')
</span><span class=data>
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
%=checkbox_field 'readuser', class => 'chec147'
</span></p>
<span class='data'>
%= submit_button l('sf_Save'), class => 'action subm148'
</span>
%# Probably finally by a submit.
%end
</div>

View File

@ -0,0 +1,50 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
%#
<div id="Shares-REMOVE" class="partial Shares-REMOVE">
# <script>
# window.onload = function() {
# SelectInput();
# };
# </script>
% if (config->{debug} == 1) {
<pre>
%= dumper $sf_data
</pre>
% }
% my $btn = l('sf_APPLY');
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
%= form_for "sharesu" => (method => 'POST') => begin
% param 'trt' => $sf_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $sf_data->{trt}
%# Inputs etc in here.
<h1 class='head'><%=l('sf_Create,_modify,_or_remove_shared')%></h1>
<h2 class='subh'><%=l('sf_Remove_shared_folder')%></h2>
<p class='paragraph para11'>
%=l('sf_You_are_about_to_remove')
</p>
<p class='paragraph para21'>
%=l('sf_All_files_belonging_to_this')
</p>
<p class='paragraph para31'>
%=l('sf_Are_you_sure_you_wish')
</p>
<span class='data'>
%= submit_button l('sf_Cancel'), class => 'action subm149'
</span>
<span class='data'>
%= submit_button l('sf_Remove'), class => 'action subm150'
</span>
%# Probably finally by a submit.
%end
</div>

86
Targets/Shares/shares.css Normal file
View File

@ -0,0 +1,86 @@
/*
Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
*/
.Shares-panel {}
.name {}
.rout {}
.head {}
.subh {}
.para1 {}
.para2 {}
.link1 {}
.tabl1 {}
thead .tabl1 {}
tbody .tabl1 {}
.name {}
.rout {}
.head {}
.subh {}
.text100 {}
.para14 {}
.sele101 {}
.sele102 {}
.sele103 {}
.para2 {}
.sele104 {}
.sele105 {}
.sele106 {}
.sele107 {}
.sele108 {}
.subm109 {}
.name {}
.rout {}
.head {}
.subh {}
.para10 {}
.tabl2 {}
thead .tabl2 {}
tbody .tabl2 {}
.chec110 {}
.chec111 {}
.chec112 {}
.chec113 {}
.chec114 {}
.chec115 {}
.chec116 {}
.chec117 {}
.chec118 {}
.chec119 {}
.chec120 {}
.chec121 {}
.chec122 {}
.chec123 {}
.chec124 {}
.chec125 {}
.chec126 {}
.chec127 {}
.chec128 {}
.chec129 {}
.chec130 {}
.chec131 {}
.chec132 {}
.chec133 {}
.chec134 {}
.chec135 {}
.chec136 {}
.chec137 {}
.chec138 {}
.chec139 {}
.chec140 {}
.chec141 {}
.chec142 {}
.chec143 {}
.chec144 {}
.chec145 {}
.chec146 {}
.chec147 {}
.subm148 {}
.name {}
.rout {}
.head {}
.subh {}
.para11 {}
.para21 {}
.para31 {}
.subm149 {}
.subm150 {}

View File

@ -0,0 +1,68 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
%#
% layout 'default', title => "Sme server 2 - Shared Folders", share_dir => './';
%# css specific to this panel:
% content_for 'module' => begin
%= stylesheet '/css/shares.css'
%= javascript '/js/shares.js'
<div id="module" class="module Shares-panel">
% if (config->{debug} == 1) {
<pre>
%= dumper $c->current_route
%= dumper $sf_data->{trt}
</pre>
% }
<h1><%=$title%></h1>
% if ( stash('modul')) {
%= $c->render_to_string(inline => stash('modul') );
% }
%if ($c->stash('first')) {
<br><p>
%=$c->render_to_string(inline =>$c->l($c->stash('first')))
</p>
%} elsif ($c->stash('success')) {
<div class='success '>
<p>
%= $c->l($c->stash('success'));
</p>
</div>
<br />
%} elsif ($c->stash('error')) {
<div class='sme-error'>
<p>
%= $c->l($c->stash('error'));
</p>
</div>
<br />
%}
%#Routing to partials according to trt parameter.
%#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement'
% if ($sf_data->{trt} eq "LIST") {
%= include 'partials/_sf_LIST'
%}
% if ($sf_data->{trt} eq "MODIFY") {
%= include 'partials/_sf_MODIFY'
%}
% if ($sf_data->{trt} eq "PERMISSIONS") {
%= include 'partials/_sf_PERMISSIONS'
%}
% if ($sf_data->{trt} eq "REMOVE") {
%= include 'partials/_sf_REMOVE'
%}
</div>
%end

5
Targets/Shares/shares.js Normal file
View File

@ -0,0 +1,5 @@
//
//Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
//
$(document).ready(function() {
});

View File

@ -0,0 +1,46 @@
#
# Generated by SM2Gen version: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
#
'sf_readgroup' => 'regroup',
'sf_Description' => 'Description',
'sf_dynamic' => 'Dynamic',
'sf_description' => 'Description',
'sf_The_following_settings_control_the' => 'The following settings control the access of this shared folder using the HTTP/HTTPS protocol',
'sf_Create,_modify,_or_remove_shared' => 'create modify Or remove shared folders',
'sf_Remove' => 'Remove',
'sf_httpaccess' => 'Httpaccess',
'sf_readuser' => 'reader',
'sf_Cancel' => 'Cancel',
'sf_All_files_belonging_to_this' => 'All files belonging to this shared folder will be deleted',
'sf_smbaccess' => 'Smbaccess',
'sf_You_can_use_this_matrix' => 'You can use this matrix to define groups and users access permissions',
'sf_webdav' => 'Webdav',
'sf_Create_a_new_shared_folder' => 'Create a new shared folder',
'sf_REMOVE_panel_action_was_successful' => 'REMOVE panel action was successful',
'sf_Actionr' => 'action',
'sf_You_are_about_to_remove' => 'You are about to remove the following shared folder',
'sf_Shared_Folders' => 'Shared Folders',
'sf_MODIFY_panel_action_was_successful' => 'MODIFY panel action was successful',
'sf_indexes' => 'Indexes',
'sf_Are_you_sure_you_wish' => 'Are you sure you wish to remove it ?',
'sf_Actionm' => 'action',
'sf_writeuser' => 'Writeuser',
'sf_LIST_panel_action_was_successful' => 'LIST panel action was successful',
'sf_Remove_shared_folder' => 'Remove shared folder',
'sf_PERMISSIONS_panel_action_was_successful' => 'PERMISSIONS panel action was successful',
'sf_Manage_shared-folders_settings:' => 'Manage shared-folders settings',
'sf_You_can_remove_any_shared' => 'You can remove any shared folder by clicking on the corresponding command next to the shared folder',
'sf_APPLY' => 'Apply',
'sf_requireSSL' => 'requires',
'sf_Groups' => 'Groups',
'sf_Save' => 'Save',
'sf_Actionp' => 'action',
'sf_writegroup' => 'Writegroup',
'sf_Name' => 'Name',
'sf_Read_Only' => 'Read Only',
'sf_retention' => 'Retention',
'sf_Access_right_management' => 'Access right management',
'sf_Read_/_Write' => 'Read / Write',
'sf_Create_or_modify_a_shared' => 'Create or modify a shared folder',
'sf_The_following_settings_control_the' => 'The following settings control the access of this shared folder from the local network Using the SMB/CIFS protocol',
'sf_recyclebin' => 'Recyclebin',

View File

@ -2,11 +2,11 @@
%# Generated by ${version}
%#
<div id="${PackageName}-${route}" class="partial ${PackageName}-${route}">
# <script>
# window.onload = function() {
# SelectInput();
# };
# </script>
%# <script>
%# window.onload = function() {
%# SelectInput();
%# };
%# </script>
% if (config->{debug} == 1) {
<pre>
%= dumper $$${prefix}_data

View File

@ -0,0 +1,57 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SME Server mailserver.bjsystems.co.uk</title>
<style type="text/css">
@import url("/server-common/css/hwinfo.css");
</style>
<link rev="made" href="mailto:bugs%40koozali.org">
<meta name="copyright" content="(head.tmpl)Copyright 2003-2004 Mitel Corporation">
<link rel="stylesheet" type="text/css" href="/server-common/css/sme_core.css">
<style type="text/css">
@import url("/server-common/css/sme_main.css");
</style>
</head>
<body>
<h1>Create, modify, or remove shared folders</h1>
<form method="POST" action="shares" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="page" value="0">
<input type="hidden" name="page_stack" value="">
<input type=hidden name=".id" value="c0cdcbf334471423ad151c4e5d38f927">
<input type="hidden" name="csrf_token" value="TvmFptTylfwxUjzsqWoFJNOdXc50KkJV5b9mgUp0xsW">
<table class="sme-noborders">
<tr><td colspan="2"><p>You can remove any shared folder by clicking on the corresponding command next to the shared folder.</p></td>
</tr>
<tr>
<td colspan='2'>
<p><a class="button-like" href="shares?page=0&amp;page_stack=&amp;Next=Next&amp;wherenext=CreateModify">Create a new shared folder</a></p></tr>
<table class="sme-border">
<tr><th colspan="1" class="sme-border">Name</th>
<th colspan="1" class="sme-border">Description</th>
<th colspan="3" class="sme-border">Action</th>
</tr>
<tr><td colspan="1" class="sme-border">africa2023</td>
<td colspan="1" class="sme-border">New one</td>
<td colspan="1" class="sme-border"><a href="shares?page=;page_stack=;wherenext=Permissions&amp;name=africa2023">Permissions</a>&nbsp;</td>
<td colspan="1" class="sme-border"><a href="shares?page=;page_stack=;wherenext=CreateModify&amp;action=modify&amp;name=africa2023">Modify</a>&nbsp;</td>
<td colspan="1" class="sme-border"><a href="shares?page=;page_stack=;wherenext=Remove&amp;name=africa2023&amp;description=New one">Remove</a>&nbsp</td>
</tr></table>
</table>
</form>
<HR class="sme-copyrightbar">
<FONT class="sme-copyright">
SME Server 10.1<BR>Copyright 1999-2006 Mitel Corporation<BR>All rights reserved.
<BR>Copyright (c) 2013 - 2021 Koozali Foundation Inc.<BR>
</FONT>
</BODY>
</HTML>

View File

@ -0,0 +1,129 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SME Server mailserver.bjsystems.co.uk</title>
<style type="text/css">
@import url("/server-common/css/hwinfo.css");
</style>
<link rev="made" href="mailto:bugs%40koozali.org">
<meta name="copyright" content="(head.tmpl)Copyright 2003-2004 Mitel Corporation">
<link rel="stylesheet" type="text/css" href="/server-common/css/sme_core.css">
<style type="text/css">
@import url("/server-common/css/sme_main.css");
</style>
</head>
<body>
<h1>Create, modify, or remove shared folders</h1>
<h2>Create or modify a shared folder</h2>
<form method="POST" action="shares" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="page" value="1">
<input type="hidden" name="page_stack" value="0">
<input type=hidden name=".id" value="3250b0901fa9d5aadac6bbc80694be75">
<input type="hidden" name="csrf_token" value="rVRGjkTMEpY5xE11Ykgsm9k7hXGLuQAV2YwjMQG8I2Q">
<table class="sme-noborders">
<tr><td colspan="2">The share name should contain only lower-case letters, numbers, periods, hyphens and underscores, and should start with a lower-case letter. For example "johnson", "intra", and "cust3.prj12" are all valid names, but "3associates", "John Smith" and "Bus!Partner" are not. The name is limited to 12 characters.</td></tr><tr><td class="sme-noborders-label">Shared folder name</td>
<td class="sme-noborders-content">africa2023
<input type="hidden" name="name" value="africa2023">
<input type="hidden" name="action" value="modify">
</td>
</tr>
<tr>
<td class="sme-noborders-label">Description
<td class="sme-noborders-content"><INPUT VALUE="New one" NAME="description" TYPE="text"></td>
</tr>
<tr>
<td colspan='2'>
<hr class="sectionbar"/>
<tr>
<td colspan="2"><p>The following settings control the access of this shared folder from the local network, using the SMB/CIFS protocol.</p></td>
</tr> <tr>
<td class="sme-noborders-label">SMB Access
<td class="sme-noborders-content"><SELECT NAME="smbaccess" TYPE="select">
<OPTION VALUE="browseable" SELECTED>Enabled, browseable
<OPTION VALUE="non-browseable">Enabled, hidden
<OPTION VALUE="none">No access
</SELECT></td>
</tr>
<tr>
<td class="sme-noborders-label">Recycle bin
<td class="sme-noborders-content"><SELECT NAME="recyclebin" TYPE="select">
<OPTION VALUE="disabled" SELECTED>disabled
<OPTION VALUE="enabled">Enabled, keep only the latest version
<OPTION VALUE="keep-versions">Enabled, keep a copy of all versions
</SELECT></td>
</tr>
<tr>
<td class="sme-noborders-label">Retention time
<td class="sme-noborders-content"><SELECT NAME="retention" TYPE="select">
<OPTION VALUE="30">one month
<OPTION VALUE="7">one week
<OPTION VALUE="365">one year
<OPTION VALUE="180">six months
<OPTION VALUE="unlimited" SELECTED>unlimited
</SELECT></td>
</tr>
<tr>
<td colspan='2'>
<hr class="sectionbar"/>
<tr>
<td colspan="2"><p>The following settings control the access of this shared folder using the HTTP/HTTPS protocol.</p></td>
</tr> <tr>
<td class="sme-noborders-label">Web Access
<td class="sme-noborders-content"><SELECT NAME="httpaccess" TYPE="select">
<OPTION VALUE="global">Entire Internet (no password required)
<OPTION VALUE="global-pw">Entire Internet (password required)
<OPTION VALUE="global-pw-remote">Entire Internet (password required outside local network)
<OPTION VALUE="local">Local network (no password required)
<OPTION VALUE="local-pw">Local network (password required)
<OPTION VALUE="none" SELECTED>No access
</SELECT></td>
</tr>
<tr>
<td class="sme-noborders-label">WebDav support
<td class="sme-noborders-content"><SELECT NAME="webdav" TYPE="select">
<OPTION VALUE="disabled" SELECTED>disabled
<OPTION VALUE="enabled">enabled
</SELECT></td>
</tr>
<tr>
<td class="sme-noborders-label">Force secure connections
<td class="sme-noborders-content"><SELECT NAME="requireSSL" TYPE="select">
<OPTION VALUE="disabled" SELECTED>disabled
<OPTION VALUE="enabled">enabled
</SELECT></td>
</tr>
<tr>
<td class="sme-noborders-label">Indexes
<td class="sme-noborders-content"><SELECT NAME="indexes" TYPE="select">
<OPTION VALUE="disabled" SELECTED>disabled
<OPTION VALUE="enabled">enabled
</SELECT></td>
</tr>
<tr>
<td class="sme-noborders-label">Dynamic content execution (PHP, CGI, SSI)
<td class="sme-noborders-content"><SELECT NAME="dynamic" TYPE="select">
<OPTION VALUE="disabled" SELECTED>disabled
<OPTION VALUE="enabled">enabled
</SELECT></td>
</tr>
</table>
<table width=100%><tr><th class="sme-layout"><input type="submit" name="Next" value="Save"></th></tr></table>
</table>
</form>
<HR class="sme-copyrightbar">
<FONT class="sme-copyright">
SME Server 10.1<BR>Copyright 1999-2006 Mitel Corporation<BR>All rights reserved.
<BR>Copyright (c) 2013 - 2021 Koozali Foundation Inc.<BR>
</FONT>
</BODY>
</HTML>

View File

@ -0,0 +1,136 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SME Server mailserver.bjsystems.co.uk</title>
<style type="text/css">
@import url("/server-common/css/hwinfo.css");
</style>
<link rev="made" href="mailto:bugs%40koozali.org">
<meta name="copyright" content="(head.tmpl)Copyright 2003-2004 Mitel Corporation">
<link rel="stylesheet" type="text/css" href="/server-common/css/sme_core.css">
<style type="text/css">
@import url("/server-common/css/sme_main.css");
</style>
</head>
<body>
<h1>Create, modify, or remove shared folders</h1>
<h2>Access right management</h2>
<form method="POST" action="shares" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="page" value="3">
<input type="hidden" name="page_stack" value="0">
<input type=hidden name=".id" value="4cf77970572e8c694559fe2ca4df6f02">
<input type="hidden" name="csrf_token" value="RrDuaqzmzwa1PN4K54W8TYd3DOi4zSp3qnMVSbsTofY">
<table class="sme-noborders">
<tr>
<td colspan="2"><p>You can use this matrix to define groups and users access permissions.</p></td>
</tr>
<tr><td colspan="2"><tr><td class="sme-noborders-label">Shared folder name</td>
<td class="sme-noborders-content">africa2023</td><tr><td class="sme-noborders-label">Description</td>
<td class="sme-noborders-content">New one</td><tr><td class="sme-noborders-label">Permissions</td><td>
<table class="sme-border">
<tr><th colspan="1" class="sme-border">Groups</th>
<th colspan="1" class="sme-border">Description</th>
<th colspan="1" class="sme-border">Read / Write</th>
<th colspan="1" class="sme-border">Read Only</th>
</tr><tr><td colspan="1" class="sme-border">shared</td>
<td colspan="1" class="sme-border">Everyone</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writegroup" value="shared"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readgroup" value="shared"></td>
</tr><tr><td colspan="1" class="sme-border">changeofkey</td>
<td colspan="1" class="sme-border">Group for emails</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writegroup" value="changeofkey"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readgroup" value="changeofkey"></td>
</tr><tr><td colspan="1" class="sme-border">domainadmins</td>
<td colspan="1" class="sme-border">Domain Admins</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writegroup" value="domainadmins"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readgroup" value="domainadmins"></td>
</tr><tr><td colspan="1" class="sme-border">ecmw2023grp</td>
<td colspan="1" class="sme-border">ecmw 2023</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writegroup" value="ecmw2023grp"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readgroup" value="ecmw2023grp"></td>
</tr><tr><td colspan="1" class="sme-border">miwgrp</td>
<td colspan="1" class="sme-border">Group for MIW payments</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writegroup" value="miwgrp"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readgroup" value="miwgrp"></td>
</tr><tr><th colspan="1" class="sme-border">Users</th>
<th colspan="1" class="sme-border">Description</th>
<th colspan="1" class="sme-border">Read / Write</th>
<th colspan="1" class="sme-border">Read Only</th>
</tr><tr><td colspan="1" class="sme-border">brianr</td>
<td colspan="1" class="sme-border">Brian Read</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="brianr"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="brianr"></td>
</tr><tr><td colspan="1" class="sme-border">cok1</td>
<td colspan="1" class="sme-border">Clare Park</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="cok1"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="cok1"></td>
</tr><tr><td colspan="1" class="sme-border">cok2</td>
<td colspan="1" class="sme-border">Frank Park</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="cok2"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="cok2"></td>
</tr><tr><td colspan="1" class="sme-border">dmarc</td>
<td colspan="1" class="sme-border">Dmarc Dmarc</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="dmarc"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="dmarc"></td>
</tr><tr><td colspan="1" class="sme-border">ecmw2025</td>
<td colspan="1" class="sme-border">ecmw 2025</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="ecmw2025"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="ecmw2025"></td>
</tr><tr><td colspan="1" class="sme-border">englishcountrymusicweekend</td>
<td colspan="1" class="sme-border">English Music Weekend</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="englishcountrymusicweekend"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="englishcountrymusicweekend"></td>
</tr><tr><td colspan="1" class="sme-border">guest</td>
<td colspan="1" class="sme-border">Guest Guest</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="guest"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="guest"></td>
</tr><tr><td colspan="1" class="sme-border">katy</td>
<td colspan="1" class="sme-border">Katy Read</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="katy"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="katy"></td>
</tr><tr><td colspan="1" class="sme-border">more</td>
<td colspan="1" class="sme-border">More 4AllianceForFoodPurity</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="more"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="more"></td>
</tr><tr><td colspan="1" class="sme-border">nikki</td>
<td colspan="1" class="sme-border">Nicola Escott</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="nikki"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="nikki"></td>
</tr><tr><td colspan="1" class="sme-border">phil</td>
<td colspan="1" class="sme-border">Phil Fermor</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="phil"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="phil"></td>
</tr><tr><td colspan="1" class="sme-border">sheila</td>
<td colspan="1" class="sme-border">Sheila Read</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="sheila"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="sheila"></td>
</tr><tr><td colspan="1" class="sme-border">smeserver</td>
<td colspan="1" class="sme-border">sme server</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="smeserver"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="smeserver"></td>
</tr><tr><td colspan="1" class="sme-border">zara.healy</td>
<td colspan="1" class="sme-border">Zara Healy</td>
<td colspan="1" class="sme-border"><input type="checkbox" name="writeuser" value="zara.healy"></td>
<td colspan="1" class="sme-border"><input type="checkbox" name="readuser" value="zara.healy"></td>
</tr></table></td></tr>
</td></tr>
</table>
<table width=100%><tr><th class="sme-layout"><input type="submit" name="Next" value="Save"></th></tr></table>
</table>
</form>
<HR class="sme-copyrightbar">
<FONT class="sme-copyright">
SME Server 10.1<BR>Copyright 1999-2006 Mitel Corporation<BR>All rights reserved.
<BR>Copyright (c) 2013 - 2021 Koozali Foundation Inc.<BR>
</FONT>
</BODY>
</HTML>

View File

@ -0,0 +1,55 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SME Server mailserver.bjsystems.co.uk</title>
<style type="text/css">
@import url("/server-common/css/hwinfo.css");
</style>
<link rev="made" href="mailto:bugs%40koozali.org">
<meta name="copyright" content="(head.tmpl)Copyright 2003-2004 Mitel Corporation">
<link rel="stylesheet" type="text/css" href="/server-common/css/sme_core.css">
<style type="text/css">
@import url("/server-common/css/sme_main.css");
</style>
</head>
<body>
<h1>Create, modify, or remove shared folders</h1>
<h2>Remove shared folder</h2>
<form method="POST" action="shares" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="page" value="2">
<input type="hidden" name="page_stack" value="0">
<input type=hidden name=".id" value="4ac6b55069cf10e90f4b5d7d64b5b352">
<input type="hidden" name="csrf_token" value="qvZ5GjwZ0fhXu6bszNjS1M94ds9FDFnubBjjcwzYF4x">
<table class="sme-noborders">
<tr><td colspan="2"><p><p>
You are about to remove the following shared folder
</p>
<p>
All files belonging to this shared folder will be deleted.
</p>
<p>
Are you sure you wish to remove it ?
</p></p></td>
</tr>
<tr><td class="sme-noborders-label">Name</td> <td class="sme-noborders-content">africa2023</td></tr>
<tr><td class="sme-noborders-label">Description</td> <td class="sme-noborders-content">New one</td></tr>
<table width="100%"><tr><th class="sme-layout"><input type="submit" name="cancel" value="Cancel" > <input type="submit" name="remove" value="Remove" ></th></tr></table>
</table>
</form>
<HR class="sme-copyrightbar">
<FONT class="sme-copyright">
SME Server 10.1<BR>Copyright 1999-2006 Mitel Corporation<BR>All rights reserved.
<BR>Copyright (c) 2013 - 2021 Koozali Foundation Inc.<BR>
</FONT>
</BODY>
</HTML>

504
json5/Shares.json5 Normal file
View File

@ -0,0 +1,504 @@
{
PackageName: 'Shares',
prefix: 'sf',
MenuHeading: 'Network',
MenuDescription: 'Shared Folders',
MenuNavigation: '7000 400',
firstPanel: 'LIST',
signalEvent: 'smeserver-shared-folders-update',
html: [
{
Name: 'list',
route: 'LIST',
Header: 'Create, modify, or remove shared folders',
SubHeader: 'Manage shared-folders settings:',
Paragraph1: 'You can remove any shared folder by clicking on the corresponding command next to the shared folder.',
Paragraph2: 'Create a new shared folder',
Link1: {
Type: 'Link',
href: 'shared-folderu?trt=MODIFY',
title: 'Create a new shared folder'
},
Table1: {
Type: 'Table',
TableControl: 'Table1',
TopHeadings: [
'Name',
'Description',
'Actionp',
'Actionm',
'Actionr'
],
Columns: [
'Table1-Name',
'Table1-Description',
'Table1-Actionp',
'Table1-Actionm',
'Table1-Actionr'
]
}
},
{
Name: 'modify',
route: 'MODIFY',
Header: 'Create, modify, or remove shared folders',
SubHeader: 'Create or modify a shared folder',
Input100: {
Type: 'Text',
Value: 'New one',
Name: 'description',
Label: 'description'
},
Paragraph14: 'The following settings control the access of this shared folder from the local network, using the SMB/CIFS protocol.',
Input101: {
Type: 'Select',
Value: '',
Name: 'smbaccess',
Label: 'smbaccess',
Options: [
{
Value: 'browseable',
Text: 'Enabled, browseable'
},
{
Value: 'non-browseable',
Text: 'Enabled, hidden'
},
{
Value: 'none',
Text: 'No access'
}
]
},
Input102: {
Type: 'Select',
Value: '',
Name: 'recyclebin',
Label: 'recyclebin',
Options: [
{
Value: 'disabled',
Text: 'disabled'
},
{
Value: 'enabled',
Text: 'Enabled, keep only the latest version'
},
{
Value: 'keep-versions',
Text: 'Enabled, keep a copy of all versions'
}
]
},
Input103: {
Type: 'Select',
Value: '',
Name: 'retention',
Label: 'retention',
Options: [
{
Value: '30',
Text: 'one month'
},
{
Value: '7',
Text: 'one week'
},
{
Value: '365',
Text: 'one year'
},
{
Value: '180',
Text: 'six months'
},
{
Value: 'unlimited',
Text: 'unlimited'
}
]
},
Paragraph2: 'The following settings control the access of this shared folder using the HTTP/HTTPS protocol.',
Input104: {
Type: 'Select',
Value: '',
Name: 'httpaccess',
Label: 'httpaccess',
Options: [
{
Value: 'global',
Text: 'Entire Internet (no password required)'
},
{
Value: 'global-pw',
Text: 'Entire Internet (password required)'
},
{
Value: 'global-pw-remote',
Text: 'Entire Internet (password required outside local network)'
},
{
Value: 'local',
Text: 'Local network (no password required)'
},
{
Value: 'local-pw',
Text: 'Local network (password required)'
},
{
Value: 'none',
Text: 'No access'
}
]
},
Input105: {
Type: 'Select',
Value: '',
Name: 'webdav',
Label: 'webdav',
Options: [
{
Value: 'disabled',
Text: 'disabled'
},
{
Value: 'enabled',
Text: 'enabled'
}
]
},
Input106: {
Type: 'Select',
Value: '',
Name: 'requireSSL',
Label: 'requireSSL',
Options: [
{
Value: 'disabled',
Text: 'disabled'
},
{
Value: 'enabled',
Text: 'enabled'
}
]
},
Input107: {
Type: 'Select',
Value: '',
Name: 'indexes',
Label: 'indexes',
Options: [
{
Value: 'disabled',
Text: 'disabled'
},
{
Value: 'enabled',
Text: 'enabled'
}
]
},
Input108: {
Type: 'Select',
Value: '',
Name: 'dynamic',
Label: 'dynamic',
Options: [
{
Value: 'disabled',
Text: 'disabled'
},
{
Value: 'enabled',
Text: 'enabled'
}
]
},
Input109: {
Type: 'Submit',
Value: 'Save',
Name: 'Next',
Label: 'Next'
}
},
{
Name: 'permissions',
route: 'PERMISSIONS',
Header: 'Create, modify, or remove shared folders',
SubHeader: 'Access right management',
Paragraph10: 'You can use this matrix to define groups and users access permissions.',
Table2: {
Type: 'Table',
TableControl: 'Table2',
TopHeadings: [
'Groups',
'Description',
'Read / Write',
'Read Only'
],
Columns: [
'Table2-Groups',
'Table2-Description',
'Table2-Read / Write',
'Table2-Read Only'
]
},
Input110: {
Type: 'Checkbox',
Value: 'shared',
Name: 'writegroup',
Label: 'writegroup'
},
Input111: {
Type: 'Checkbox',
Value: 'shared',
Name: 'readgroup',
Label: 'readgroup'
},
Input112: {
Type: 'Checkbox',
Value: 'changeofkey',
Name: 'writegroup',
Label: 'writegroup'
},
Input113: {
Type: 'Checkbox',
Value: 'changeofkey',
Name: 'readgroup',
Label: 'readgroup'
},
Input114: {
Type: 'Checkbox',
Value: 'domainadmins',
Name: 'writegroup',
Label: 'writegroup'
},
Input115: {
Type: 'Checkbox',
Value: 'domainadmins',
Name: 'readgroup',
Label: 'readgroup'
},
Input116: {
Type: 'Checkbox',
Value: 'ecmw2023grp',
Name: 'writegroup',
Label: 'writegroup'
},
Input117: {
Type: 'Checkbox',
Value: 'ecmw2023grp',
Name: 'readgroup',
Label: 'readgroup'
},
Input118: {
Type: 'Checkbox',
Value: 'miwgrp',
Name: 'writegroup',
Label: 'writegroup'
},
Input119: {
Type: 'Checkbox',
Value: 'miwgrp',
Name: 'readgroup',
Label: 'readgroup'
},
Input120: {
Type: 'Checkbox',
Value: 'brianr',
Name: 'writeuser',
Label: 'writeuser'
},
Input121: {
Type: 'Checkbox',
Value: 'brianr',
Name: 'readuser',
Label: 'readuser'
},
Input122: {
Type: 'Checkbox',
Value: 'cok1',
Name: 'writeuser',
Label: 'writeuser'
},
Input123: {
Type: 'Checkbox',
Value: 'cok1',
Name: 'readuser',
Label: 'readuser'
},
Input124: {
Type: 'Checkbox',
Value: 'cok2',
Name: 'writeuser',
Label: 'writeuser'
},
Input125: {
Type: 'Checkbox',
Value: 'cok2',
Name: 'readuser',
Label: 'readuser'
},
Input126: {
Type: 'Checkbox',
Value: 'dmarc',
Name: 'writeuser',
Label: 'writeuser'
},
Input127: {
Type: 'Checkbox',
Value: 'dmarc',
Name: 'readuser',
Label: 'readuser'
},
Input128: {
Type: 'Checkbox',
Value: 'ecmw2025',
Name: 'writeuser',
Label: 'writeuser'
},
Input129: {
Type: 'Checkbox',
Value: 'ecmw2025',
Name: 'readuser',
Label: 'readuser'
},
Input130: {
Type: 'Checkbox',
Value: 'englishcountrymusicweekend',
Name: 'writeuser',
Label: 'writeuser'
},
Input131: {
Type: 'Checkbox',
Value: 'englishcountrymusicweekend',
Name: 'readuser',
Label: 'readuser'
},
Input132: {
Type: 'Checkbox',
Value: 'guest',
Name: 'writeuser',
Label: 'writeuser'
},
Input133: {
Type: 'Checkbox',
Value: 'guest',
Name: 'readuser',
Label: 'readuser'
},
Input134: {
Type: 'Checkbox',
Value: 'katy',
Name: 'writeuser',
Label: 'writeuser'
},
Input135: {
Type: 'Checkbox',
Value: 'katy',
Name: 'readuser',
Label: 'readuser'
},
Input136: {
Type: 'Checkbox',
Value: 'more',
Name: 'writeuser',
Label: 'writeuser'
},
Input137: {
Type: 'Checkbox',
Value: 'more',
Name: 'readuser',
Label: 'readuser'
},
Input138: {
Type: 'Checkbox',
Value: 'nikki',
Name: 'writeuser',
Label: 'writeuser'
},
Input139: {
Type: 'Checkbox',
Value: 'nikki',
Name: 'readuser',
Label: 'readuser'
},
Input140: {
Type: 'Checkbox',
Value: 'phil',
Name: 'writeuser',
Label: 'writeuser'
},
Input141: {
Type: 'Checkbox',
Value: 'phil',
Name: 'readuser',
Label: 'readuser'
},
Input142: {
Type: 'Checkbox',
Value: 'sheila',
Name: 'writeuser',
Label: 'writeuser'
},
Input143: {
Type: 'Checkbox',
Value: 'sheila',
Name: 'readuser',
Label: 'readuser'
},
Input144: {
Type: 'Checkbox',
Value: 'smeserver',
Name: 'writeuser',
Label: 'writeuser'
},
Input145: {
Type: 'Checkbox',
Value: 'smeserver',
Name: 'readuser',
Label: 'readuser'
},
Input146: {
Type: 'Checkbox',
Value: 'zara.healy',
Name: 'writeuser',
Label: 'writeuser'
},
Input147: {
Type: 'Checkbox',
Value: 'zara.healy',
Name: 'readuser',
Label: 'readuser'
},
Input148: {
Type: 'Submit',
Value: 'Save',
Name: 'Next',
Label: 'Next'
}
},
{
Name: 'remove',
route: 'REMOVE',
Header: 'Create, modify, or remove shared folders',
SubHeader: 'Remove shared folder',
Paragraph11: 'You are about to remove the following shared folder',
Paragraph21: 'All files belonging to this shared folder will be deleted.',
Paragraph31: 'Are you sure you wish to remove it ?',
Input149: {
Type: 'Submit',
Value: 'Cancel',
Name: 'cancel',
Label: 'cancel'
},
Input150: {
Type: 'Submit',
Value: 'Remove',
Name: 'remove',
Label: 'remove'
}
}
]
}

View File

@ -0,0 +1,56 @@
//
// Generated by sm1-html-2-json5 version:0.5 Chameleon version:3.8.1 On Python:3.12.3 at 2025-05-20 15:40:23
//
{
'PackageName': 'shared-folders_list',
'prefix': '',
'MenuHeading': 'Miscellaneous',
'MenuDescription': 'shared-folders_list',
'MenuNavigation': '2000 400',
'firstPanel': 'PARAMS',
'signalEvent': 'smeserver-shared-folders_list-update',
'html': [
{
'Name': 'params',
'route': 'PARAMS',
'Header': 'Create, modify, or remove shared folders',
'SubHeader': 'Manage shared-folders_list settings:',
'Paragraph1': 'You can remove any shared folder by clicking on the corresponding command next to the shared folder.',
'Paragraph2': 'Create a new shared folder',
'Link1': {
'Type': 'Link',
'href': 'shares?page=0&page_stack=&Next=Next&wherenext=CreateModify',
'title': 'Create a new shared folder'
},
'Table1': {
'Type': 'Table',
'TableControl': 'Table1',
'TopHeadings': [
'Name',
'Description',
'Action'
],
'Columns': [
'Table1-Name',
'Table1-Description',
'Table1-Action'
]
},
'Link2': {
'Type': 'Link',
'href': 'shares?page=;page_stack=;wherenext=Permissions&name=africa2023',
'title': 'Permissions'
},
'Link3': {
'Type': 'Link',
'href': 'shares?page=;page_stack=;wherenext=CreateModify&action=modify&name=africa2023',
'title': 'Modify'
},
'Link4': {
'Type': 'Link',
'href': 'shares?page=;page_stack=;wherenext=Remove&name=africa2023&description=New one',
'title': 'Remove'
}
}
]
}

View File

@ -0,0 +1,198 @@
//
// Generated by sm1-html-2-json5 version:0.5 Chameleon version:3.8.1 On Python:3.12.3 at 2025-05-20 15:40:34
//
{
'PackageName': 'shared-folders_modify',
'prefix': '',
'MenuHeading': 'Miscellaneous',
'MenuDescription': 'shared-folders_modify',
'MenuNavigation': '2000 400',
'firstPanel': 'PARAMS',
'signalEvent': 'smeserver-shared-folders_modify-update',
'html': [
{
'Name': 'params',
'route': 'PARAMS',
'Header': 'Create, modify, or remove shared folders',
'SubHeader': 'Create or modify a shared folder',
'Input1': {
'Type': 'Text',
'Value': 'New one',
'Name': 'description',
'Label': 'description'
},
'Paragraph1': 'The following settings control the access of this shared folder from the local network, using the SMB/CIFS protocol.',
'Input2': {
'Type': 'Select',
'Value': '',
'Name': 'smbaccess',
'Label': 'smbaccess',
'Options': [
{
'Value': 'browseable',
'Text': 'Enabled, browseable'
},
{
'Value': 'non-browseable',
'Text': 'Enabled, hidden'
},
{
'Value': 'none',
'Text': 'No access'
}
]
},
'Input3': {
'Type': 'Select',
'Value': '',
'Name': 'recyclebin',
'Label': 'recyclebin',
'Options': [
{
'Value': 'disabled',
'Text': 'disabled'
},
{
'Value': 'enabled',
'Text': 'Enabled, keep only the latest version'
},
{
'Value': 'keep-versions',
'Text': 'Enabled, keep a copy of all versions'
}
]
},
'Input4': {
'Type': 'Select',
'Value': '',
'Name': 'retention',
'Label': 'retention',
'Options': [
{
'Value': '30',
'Text': 'one month'
},
{
'Value': '7',
'Text': 'one week'
},
{
'Value': '365',
'Text': 'one year'
},
{
'Value': '180',
'Text': 'six months'
},
{
'Value': 'unlimited',
'Text': 'unlimited'
}
]
},
'Paragraph2': 'The following settings control the access of this shared folder using the HTTP/HTTPS protocol.',
'Input5': {
'Type': 'Select',
'Value': '',
'Name': 'httpaccess',
'Label': 'httpaccess',
'Options': [
{
'Value': 'global',
'Text': 'Entire Internet (no password required)'
},
{
'Value': 'global-pw',
'Text': 'Entire Internet (password required)'
},
{
'Value': 'global-pw-remote',
'Text': 'Entire Internet (password required outside local network)'
},
{
'Value': 'local',
'Text': 'Local network (no password required)'
},
{
'Value': 'local-pw',
'Text': 'Local network (password required)'
},
{
'Value': 'none',
'Text': 'No access'
}
]
},
'Input6': {
'Type': 'Select',
'Value': '',
'Name': 'webdav',
'Label': 'webdav',
'Options': [
{
'Value': 'disabled',
'Text': 'disabled'
},
{
'Value': 'enabled',
'Text': 'enabled'
}
]
},
'Input7': {
'Type': 'Select',
'Value': '',
'Name': 'requireSSL',
'Label': 'requireSSL',
'Options': [
{
'Value': 'disabled',
'Text': 'disabled'
},
{
'Value': 'enabled',
'Text': 'enabled'
}
]
},
'Input8': {
'Type': 'Select',
'Value': '',
'Name': 'indexes',
'Label': 'indexes',
'Options': [
{
'Value': 'disabled',
'Text': 'disabled'
},
{
'Value': 'enabled',
'Text': 'enabled'
}
]
},
'Input9': {
'Type': 'Select',
'Value': '',
'Name': 'dynamic',
'Label': 'dynamic',
'Options': [
{
'Value': 'disabled',
'Text': 'disabled'
},
{
'Value': 'enabled',
'Text': 'enabled'
}
]
},
'Input10': {
'Type': 'Submit',
'Value': 'Save',
'Name': 'Next',
'Label': 'Next'
}
}
]
}

View File

@ -0,0 +1,271 @@
//
// Generated by sm1-html-2-json5 version:0.5 Chameleon version:3.8.1 On Python:3.12.3 at 2025-05-20 15:41:06
//
{
'PackageName': 'shared-folders_perms',
'prefix': '',
'MenuHeading': 'Miscellaneous',
'MenuDescription': 'shared-folders_perms',
'MenuNavigation': '2000 400',
'firstPanel': 'PARAMS',
'signalEvent': 'smeserver-shared-folders_perms-update',
'html': [
{
'Name': 'params',
'route': 'PARAMS',
'Header': 'Create, modify, or remove shared folders',
'SubHeader': 'Access right management',
'Paragraph1': 'You can use this matrix to define groups and users access permissions.',
'Table1': {
'Type': 'Table',
'TableControl': 'Table1',
'TopHeadings': [
'Groups',
'Description',
'Read / Write',
'Read Only'
],
'Columns': [
'Table1-Groups',
'Table1-Description',
'Table1-Read / Write',
'Table1-Read Only'
]
},
'Input1': {
'Type': 'Checkbox',
'Value': 'shared',
'Name': 'writegroup',
'Label': 'writegroup'
},
'Input2': {
'Type': 'Checkbox',
'Value': 'shared',
'Name': 'readgroup',
'Label': 'readgroup'
},
'Input3': {
'Type': 'Checkbox',
'Value': 'changeofkey',
'Name': 'writegroup',
'Label': 'writegroup'
},
'Input4': {
'Type': 'Checkbox',
'Value': 'changeofkey',
'Name': 'readgroup',
'Label': 'readgroup'
},
'Input5': {
'Type': 'Checkbox',
'Value': 'domainadmins',
'Name': 'writegroup',
'Label': 'writegroup'
},
'Input6': {
'Type': 'Checkbox',
'Value': 'domainadmins',
'Name': 'readgroup',
'Label': 'readgroup'
},
'Input7': {
'Type': 'Checkbox',
'Value': 'ecmw2023grp',
'Name': 'writegroup',
'Label': 'writegroup'
},
'Input8': {
'Type': 'Checkbox',
'Value': 'ecmw2023grp',
'Name': 'readgroup',
'Label': 'readgroup'
},
'Input9': {
'Type': 'Checkbox',
'Value': 'miwgrp',
'Name': 'writegroup',
'Label': 'writegroup'
},
'Input10': {
'Type': 'Checkbox',
'Value': 'miwgrp',
'Name': 'readgroup',
'Label': 'readgroup'
},
'Input11': {
'Type': 'Checkbox',
'Value': 'brianr',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input12': {
'Type': 'Checkbox',
'Value': 'brianr',
'Name': 'readuser',
'Label': 'readuser'
},
'Input13': {
'Type': 'Checkbox',
'Value': 'cok1',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input14': {
'Type': 'Checkbox',
'Value': 'cok1',
'Name': 'readuser',
'Label': 'readuser'
},
'Input15': {
'Type': 'Checkbox',
'Value': 'cok2',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input16': {
'Type': 'Checkbox',
'Value': 'cok2',
'Name': 'readuser',
'Label': 'readuser'
},
'Input17': {
'Type': 'Checkbox',
'Value': 'dmarc',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input18': {
'Type': 'Checkbox',
'Value': 'dmarc',
'Name': 'readuser',
'Label': 'readuser'
},
'Input19': {
'Type': 'Checkbox',
'Value': 'ecmw2025',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input20': {
'Type': 'Checkbox',
'Value': 'ecmw2025',
'Name': 'readuser',
'Label': 'readuser'
},
'Input21': {
'Type': 'Checkbox',
'Value': 'englishcountrymusicweekend',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input22': {
'Type': 'Checkbox',
'Value': 'englishcountrymusicweekend',
'Name': 'readuser',
'Label': 'readuser'
},
'Input23': {
'Type': 'Checkbox',
'Value': 'guest',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input24': {
'Type': 'Checkbox',
'Value': 'guest',
'Name': 'readuser',
'Label': 'readuser'
},
'Input25': {
'Type': 'Checkbox',
'Value': 'katy',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input26': {
'Type': 'Checkbox',
'Value': 'katy',
'Name': 'readuser',
'Label': 'readuser'
},
'Input27': {
'Type': 'Checkbox',
'Value': 'more',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input28': {
'Type': 'Checkbox',
'Value': 'more',
'Name': 'readuser',
'Label': 'readuser'
},
'Input29': {
'Type': 'Checkbox',
'Value': 'nikki',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input30': {
'Type': 'Checkbox',
'Value': 'nikki',
'Name': 'readuser',
'Label': 'readuser'
},
'Input31': {
'Type': 'Checkbox',
'Value': 'phil',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input32': {
'Type': 'Checkbox',
'Value': 'phil',
'Name': 'readuser',
'Label': 'readuser'
},
'Input33': {
'Type': 'Checkbox',
'Value': 'sheila',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input34': {
'Type': 'Checkbox',
'Value': 'sheila',
'Name': 'readuser',
'Label': 'readuser'
},
'Input35': {
'Type': 'Checkbox',
'Value': 'smeserver',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input36': {
'Type': 'Checkbox',
'Value': 'smeserver',
'Name': 'readuser',
'Label': 'readuser'
},
'Input37': {
'Type': 'Checkbox',
'Value': 'zara.healy',
'Name': 'writeuser',
'Label': 'writeuser'
},
'Input38': {
'Type': 'Checkbox',
'Value': 'zara.healy',
'Name': 'readuser',
'Label': 'readuser'
},
'Input39': {
'Type': 'Submit',
'Value': 'Save',
'Name': 'Next',
'Label': 'Next'
}
}
]
}

View File

@ -0,0 +1,35 @@
//
// Generated by sm1-html-2-json5 version:0.5 Chameleon version:3.8.1 On Python:3.12.3 at 2025-05-20 15:41:15
//
{
'PackageName': 'shared-folders_remove',
'prefix': '',
'MenuHeading': 'Miscellaneous',
'MenuDescription': 'shared-folders_remove',
'MenuNavigation': '2000 400',
'firstPanel': 'PARAMS',
'signalEvent': 'smeserver-shared-folders_remove-update',
'html': [
{
'Name': 'params',
'route': 'PARAMS',
'Header': 'Create, modify, or remove shared folders',
'SubHeader': 'Remove shared folder',
'Paragraph1': 'You are about to remove the following shared folder',
'Paragraph2': 'All files belonging to this shared folder will be deleted.',
'Paragraph3': 'Are you sure you wish to remove it ?',
'Input1': {
'Type': 'Submit',
'Value': 'Cancel',
'Name': 'cancel',
'Label': 'cancel'
},
'Input2': {
'Type': 'Submit',
'Value': 'Remove',
'Name': 'remove',
'Label': 'remove'
}
}
]
}

96
json5_fix_format.py Normal file
View File

@ -0,0 +1,96 @@
import re
import json5
def fix_json5_syntax(text):
# Remove comments
text = re.sub(r'//.*', '', text)
text = re.sub(r'/\*.*?\*/', '', text, flags=re.DOTALL)
# Replace single quotes with double quotes
text = re.sub(r"'", '"', text)
# Add missing commas between objects in arrays (naive)
text = re.sub(r'(\})(\s*\{)', r'\1,\2', text)
# Remove trailing commas before closing } or ]
text = re.sub(r',(\s*[}\]])', r'\1', text)
return text
def renumber_inputs(obj, start=100):
"""
Recursively renumber InputN keys to Input{start}, Input{start+1}, ...
Returns the new object and the next available number.
"""
if isinstance(obj, dict):
new_obj = {}
for k, v in obj.items():
m = re.match(r'Input(\d+)', k)
if m:
new_key = f"Input{start}"
start += 1
else:
new_key = k
new_obj[new_key], start = renumber_inputs(v, start)
return new_obj, start
elif isinstance(obj, list):
new_list = []
for item in obj:
new_item, start = renumber_inputs(item, start)
new_list.append(new_item)
return new_list, start
else:
return obj, start
def dict_to_json5(obj, indent=0):
"""Convert a dict to JSON5-like text with unquoted field names."""
IND = ' '
if isinstance(obj, dict):
items = []
for k, v in obj.items():
# Only quote keys if necessary (not a valid identifier)
if re.match(r'^[A-Za-z_]\w*$', k):
key = k
else:
key = f'"{k}"'
items.append(f"{IND* (indent+1)}{key}: {dict_to_json5(v, indent+1)}")
return '{\n' + ',\n'.join(items) + f'\n{IND*indent}' + '}'
elif isinstance(obj, list):
items = [f"{IND*(indent+1)}{dict_to_json5(v, indent+1)}" for v in obj]
return '[\n' + ',\n'.join(items) + f'\n{IND*indent}' + ']'
elif isinstance(obj, str):
# Always single-quote strings for JSON5 style
return "'" + obj.replace("'", "\\'") + "'"
elif obj is True:
return 'true'
elif obj is False:
return 'false'
elif obj is None:
return 'null'
else:
return str(obj)
def main():
input_file = 'json5/shared-folders.json5'
output_file = 'json5/shared-folders-renumbered.json5'
# Read and fix the JSON5 input
with open(input_file, 'r', encoding='utf-8') as f:
raw = f.read()
fixed = fix_json5_syntax(raw)
# Parse with json5
try:
data = json5.loads(fixed)
except Exception as e:
print("Error parsing JSON5:", e)
return
# Renumber Input fields
data, _ = renumber_inputs(data, 100)
# Write out as JSON5 with unquoted field names
with open(output_file, 'w', encoding='utf-8') as f:
f.write(dict_to_json5(data, indent=0))
print(f"Renumbered file written to: {output_file}")
if __name__ == '__main__':
main()