Added version to all files, create .new Custom file if already there
This commit is contained in:
parent
7af3086d73
commit
b96239639c
@ -2,6 +2,8 @@
|
|||||||
# Routines to be editted by the developer to provide validation for parameters
|
# Routines to be editted by the developer to provide validation for parameters
|
||||||
# and provison of the control data for table(s)
|
# and provison of the control data for table(s)
|
||||||
#
|
#
|
||||||
|
# Generated by SM2Gen version:${version}
|
||||||
|
#
|
||||||
#$cdb=$main::cdb;
|
#$cdb=$main::cdb;
|
||||||
#$adb=$main::adb;
|
#$adb=$main::adb;
|
||||||
#$ndb=$main::ndb;
|
#$ndb=$main::ndb;
|
||||||
|
49
Targets/Nfsshare-Custom.pm.new
Normal file
49
Targets/Nfsshare-Custom.pm.new
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#
|
||||||
|
# Routines to be editted by the developer to provide validation for parameters
|
||||||
|
# and provison of the control data for table(s)
|
||||||
|
#
|
||||||
|
#$cdb=$main::cdb;
|
||||||
|
#$adb=$main::adb;
|
||||||
|
#$ndb=$main::ndb;
|
||||||
|
#$hdb=$main::hdb;
|
||||||
|
#$ddb=$main::ddb;
|
||||||
|
|
||||||
|
use esmith::util;
|
||||||
|
use esmith::HostsDB;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
use esmith::NetworksDB;
|
||||||
|
use esmith::HostsDB;
|
||||||
|
use esmith::DomainsDB;
|
||||||
|
|
||||||
|
|
||||||
|
#The most common ones
|
||||||
|
our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||||
|
our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
|
our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
||||||
|
our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
||||||
|
our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||||
|
|
||||||
|
# Validation routines - parameters for each panel
|
||||||
|
|
||||||
|
sub validate_PARAMS {
|
||||||
|
$ret = 'ok';
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub validate_TABLE {
|
||||||
|
$ret = 'ok';
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Get control data for tables(s)
|
||||||
|
|
||||||
|
sub get_ibays {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,22 +1,22 @@
|
|||||||
'nfs_These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays//files' => 'These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays//files'
|
'nfs_Delays the disk writing' => 'Delays the disk writing'
|
||||||
'nfs_For writing permissions,allowing the root user and using insecure ports, you must configure a list of one IP per line, being part of the local network(s).' => 'For writing permissions,allowing the root user and using insecure ports, you must configure a list of one IP per line, being part of the local network(s).'
|
|
||||||
'nfs_Share owner Group' => 'Share owner Group'
|
|
||||||
'nfs_Squash the power of users' => 'Squash the power of users'
|
|
||||||
'nfs_$thispanel successfull message' => '$thispanel successfull message'
|
|
||||||
'nfs Hello TABLE' => 'Hello TABLE'
|
|
||||||
'nfs_Set the UID.' => 'Set the UID.'
|
|
||||||
'nfs_NFS Client(s) allowed' => 'NFS Client(s) allowed'
|
|
||||||
'nfs Hello PARAMS' => 'Hello PARAMS'
|
|
||||||
'nfs_Save' => 'Save'
|
'nfs_Save' => 'Save'
|
||||||
'nfs_Set the uid and gid if you want all requests appear to be from one user or one group, otherwise leave blank' => 'Set the uid and gid if you want all requests appear to be from one user or one group, otherwise leave blank'
|
'nfs_Set the uid and gid if you want all requests appear to be from one user or one group, otherwise leave blank' => 'Set the uid and gid if you want all requests appear to be from one user or one group, otherwise leave blank'
|
||||||
'nfs_EnableShare on local network' => 'EnableShare on local network'
|
|
||||||
'nfs_Set the GID.' => 'Set the GID.'
|
|
||||||
'nfs_APPLY' => 'APPLY'
|
|
||||||
'nfs_NFS data share' => 'NFS data share'
|
'nfs_NFS data share' => 'NFS data share'
|
||||||
'nfs_File system permissions' => 'File system permissions'
|
'nfs_$thispanel successfull message' => '$thispanel successfull message'
|
||||||
'nfs_Requests on secure ports' => 'Requests on secure ports'
|
'nfs Hello TABLE' => 'Hello TABLE'
|
||||||
|
'nfs_For writing permissions,allowing the root user and using insecure ports, you must configure a list of one IP per line, being part of the local network(s).' => 'For writing permissions,allowing the root user and using insecure ports, you must configure a list of one IP per line, being part of the local network(s).'
|
||||||
'nfs_Write (a)synchronously' => 'Write (a)synchronously'
|
'nfs_Write (a)synchronously' => 'Write (a)synchronously'
|
||||||
'nfs_Delays the disk writing' => 'Delays the disk writing'
|
'nfs_Share owner Group' => 'Share owner Group'
|
||||||
|
'nfs_File system permissions' => 'File system permissions'
|
||||||
|
'nfs_EnableShare on local network' => 'EnableShare on local network'
|
||||||
|
'nfs_Squash the power of users' => 'Squash the power of users'
|
||||||
|
'nfs_Set the GID.' => 'Set the GID.'
|
||||||
|
'nfs_These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays//files' => 'These parameters will be effective only if the share is enabled. The share is in /home/e-smith/files/ibays//files'
|
||||||
'nfs_Enable the NFS Share' => 'Enable the NFS Share'
|
'nfs_Enable the NFS Share' => 'Enable the NFS Share'
|
||||||
|
'nfs_APPLY' => 'APPLY'
|
||||||
|
'nfs_Requests on secure ports' => 'Requests on secure ports'
|
||||||
'nfs_Browse the parent folders' => 'Browse the parent folders'
|
'nfs_Browse the parent folders' => 'Browse the parent folders'
|
||||||
|
'nfs_NFS Client(s) allowed' => 'NFS Client(s) allowed'
|
||||||
|
'nfs Hello PARAMS' => 'Hello PARAMS'
|
||||||
'nfs_Information Bay name' => 'Information Bay name'
|
'nfs_Information Bay name' => 'Information Bay name'
|
||||||
|
'nfs_Set the UID.' => 'Set the UID.'
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package SrvMngr::Controller::${PackageName};
|
package SrvMngr::Controller::${PackageName};
|
||||||
|
#
|
||||||
|
# Generated by SM2Gen version:${version}
|
||||||
|
#
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# heading : ${MenuHeading}
|
# heading : ${MenuHeading}
|
||||||
# description : ${MenuDescription}
|
# description : ${MenuDescription}
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
# Routines to be editted by the developer to provide validation for parameters
|
# Routines to be editted by the developer to provide validation for parameters
|
||||||
# and provison of the control data for table(s)
|
# and provison of the control data for table(s)
|
||||||
#
|
#
|
||||||
#$cdb=$main::cdb;
|
#
|
||||||
#$adb=$main::adb;
|
# Generated by SM2Gen version:${version}
|
||||||
#$ndb=$main::ndb;
|
#
|
||||||
#$hdb=$main::hdb;
|
|
||||||
#$ddb=$main::ddb;
|
|
||||||
|
|
||||||
use esmith::util;
|
use esmith::util;
|
||||||
use esmith::HostsDB;
|
use esmith::HostsDB;
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
</password>
|
</password>
|
||||||
|
|
||||||
<Table><![CDATA[
|
<Table><![CDATA[
|
||||||
<table class="sme-border TableSort">
|
<br /><table class="sme-border TableSort">
|
||||||
<thead>
|
<thead>
|
||||||
<tr><tal:block tal:repeat="ColHead TopHeadings">
|
<tr><tal:block tal:repeat="ColHead TopHeadings">
|
||||||
<th class='sme-border'>${ColHead}</th></tal:block>
|
<th class='sme-border'>${ColHead}</th></tal:block>
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
% layout 'default', title => "Sme server 2 - ${MenuDescription}", share_dir => './';
|
% layout 'default', title => "Sme server 2 - ${MenuDescription}", share_dir => './';
|
||||||
|
%#
|
||||||
|
%# Generated by SM2Gen version:${version}
|
||||||
|
%#
|
||||||
% content_for 'module' => begin
|
% content_for 'module' => begin
|
||||||
<div id="module" class="module ${PackageName}-panel">
|
<div id="module" class="module ${PackageName}-panel">
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
%#
|
||||||
|
%# Generated by SM2Gen version:${version}
|
||||||
|
%#
|
||||||
<div id="${PackageName}-${route}">
|
<div id="${PackageName}-${route}">
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
|
@ -7,14 +7,28 @@ import pkg_resources
|
|||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
import pkg_resources
|
||||||
|
from datetime import datetime
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
SME2Gen_version = '0.6'
|
||||||
|
|
||||||
version = 0.6
|
try:
|
||||||
|
chameleon_version = pkg_resources.get_distribution("Chameleon").version
|
||||||
|
except pkg_resources.DistributionNotFound:
|
||||||
|
chameleon_version = "Version information not available"
|
||||||
|
python_version = sys.version
|
||||||
|
python_version = python_version[:8]
|
||||||
|
current_datetime = datetime.now()
|
||||||
|
formatted_datetime = current_datetime.strftime("%Y-%m-%d %H:%M")
|
||||||
|
|
||||||
|
strVersion = "SME2Gen version:"+SME2Gen_version+" Chameleon version:"+chameleon_version+" On Python:"+python_version+" at "+formatted_datetime
|
||||||
|
|
||||||
json5_dict: dict = {}
|
json5_dict: dict = {}
|
||||||
json5_html_list: list = []
|
json5_html_list: list = []
|
||||||
|
|
||||||
print(f"Generate SM2 code from JSON5 - Version {version}")
|
print(f"SM2 code from JSON5 - {strVersion}")
|
||||||
|
quit()
|
||||||
# Get the version of Chameleon using pkg_resources
|
# Get the version of Chameleon using pkg_resources
|
||||||
try:
|
try:
|
||||||
version = pkg_resources.get_distribution("Chameleon").version
|
version = pkg_resources.get_distribution("Chameleon").version
|
||||||
@ -146,6 +160,8 @@ def has_file_been_modified(file_path):
|
|||||||
# Get the file's creation time and last modification time in Unix timestamp
|
# Get the file's creation time and last modification time in Unix timestamp
|
||||||
creation_time = os.path.getctime(file_path)
|
creation_time = os.path.getctime(file_path)
|
||||||
last_modification_time = os.path.getmtime(file_path)
|
last_modification_time = os.path.getmtime(file_path)
|
||||||
|
print(f"{creation_time}*{last_modification_time}")
|
||||||
|
quit()
|
||||||
|
|
||||||
# Compare the creation time and last modification time
|
# Compare the creation time and last modification time
|
||||||
if creation_time < last_modification_time:
|
if creation_time < last_modification_time:
|
||||||
@ -153,9 +169,6 @@ def has_file_been_modified(file_path):
|
|||||||
else:
|
else:
|
||||||
return False # File has not been modified after creation
|
return False # File has not been modified after creation
|
||||||
|
|
||||||
|
|
||||||
import xml.etree.ElementTree as ET
|
|
||||||
|
|
||||||
def parse_xml_to_dict(xml_file):
|
def parse_xml_to_dict(xml_file):
|
||||||
# Parse the XML file
|
# Parse the XML file
|
||||||
tree = ET.parse(xml_file)
|
tree = ET.parse(xml_file)
|
||||||
@ -226,7 +239,9 @@ if __name__ == "__main__":
|
|||||||
controller_file = 'Targets/'+hl('PackageName')+'.pm'
|
controller_file = 'Targets/'+hl('PackageName')+'.pm'
|
||||||
custom_controller_file = 'Targets/'+hl('PackageName')+'-Custom.pm'
|
custom_controller_file = 'Targets/'+hl('PackageName')+'-Custom.pm'
|
||||||
# see if it has been modified by developer
|
# see if it has been modified by developer
|
||||||
if has_file_been_modified(custom_controller_file):
|
#if has_file_been_modified(custom_controller_file):
|
||||||
|
# custom_controller_file = custom_controller_file+'.new'
|
||||||
|
if os.path.exists(custom_controller_file):
|
||||||
custom_controller_file = custom_controller_file+'.new'
|
custom_controller_file = custom_controller_file+'.new'
|
||||||
layout_file = 'Targets/'+hl('PackageName')+'.html.ep'
|
layout_file = 'Targets/'+hl('PackageName')+'.html.ep'
|
||||||
partial_files = list()
|
partial_files = list()
|
Loading…
Reference in New Issue
Block a user