Add in original html - play with sanitising paragraphs

This commit is contained in:
Brian Read 2024-09-14 18:08:48 +01:00
parent 3813f55f68
commit 3b6e1930a0
30 changed files with 562 additions and 167 deletions

View File

@ -0,0 +1,63 @@
#
# Routines to be edited by the developer to provide validation for parameters
# and provison of the control data for table(s)
#
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-14 17:41
#
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 {
my $c = shift;
my $prefix_data = shift; #Data hash as parameter
my $ret = 'ok';
return $ret;
}
# Get control data for tables(s)
# Return hash with values from row in which link clicked on table
sub get_selected_PARAMS {
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_PARAMS {
my $c = shift;
my $prefix_data = shift; #Data hash as parameter
my $ret = 'ok';
return $ret;
}
sub create_link{
# WIP
my ($c,$route, $panel, $index) = shift;
my $link = "$route?trt=$panel&Selected=$index";
return $link;
}
1;

View File

@ -1,6 +1,6 @@
package SrvMngr::Controller::CreateStarterWebsite; package SrvMngr::Controller::CreateStarterWebsite;
# #
# Generated by version:SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-13 19:20 # Generated by version:SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-14 17:41
# #
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# heading : Miscellaneous # heading : Miscellaneous

View File

@ -1,6 +1,6 @@
% layout 'default', title => "Sme server 2 - Create Starter Website", share_dir => './'; % layout 'default', title => "Sme server 2 - Create Starter Website", share_dir => './';
%# %#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-13 19:20 %# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-14 17:41
%# %#
% content_for 'module' => begin % content_for 'module' => begin
<div id="module" class="module CreateStarterWebsite-panel"> <div id="module" class="module CreateStarterWebsite-panel">

View File

@ -1,8 +1,16 @@
'csw_APPLY' => 'Apply', 'csw_Do_not_use_this_optionif' => 'Do not use this optionif you have already customized your web site, Since it will overwrite the \'index. Htm\' file in your web site directory. ',
'csw_Do_you_wish_to_proceed?' => 'Do you wish to proceed?', 'csw_Second_header,_typically_used_for' => 'Second header, Typically used for short phrases such as \'For more information\' or \'To order our products\':',
'csw_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful',
'csw_Manage_CreateStarterWebsite_settings:' => 'Manage CreateStarterWebsite settings:',
'csw_Hello_PARAMS' => 'Hello PARAMS', 'csw_Hello_PARAMS' => 'Hello PARAMS',
'csw_' => '', 'csw_To_create_a_simple_web' => 'To create a simple web page for your company, Fill in the fields below and click onCreate. ',
'csw_The_text_that_you_enter' => 'The text that you enter below will be line wrapped for a nicer appearance in your web page. Leave a blank line whenever you want to start a new paragraph. If you need to force a line break without starting a new paragraph (for example after each line of a mailing address), Then type the four-character sequence',
'csw_You_can_leave_any_field' => 'You can leave any field blank if you do not need it. ', 'csw_You_can_leave_any_field' => 'You can leave any field blank if you do not need it. ',
'csw_Text_following_first_header,_typically' => 'Text following first header, Typically used for a paragraph of marketing information. ',
'csw_Do_you_wish_to_proceed?' => 'Do you wish to proceed?',
'csw_Manage_CreateStarterWebsite_settings:' => 'Manage CreateStarterWebsite settings:',
'csw_When_you_create_this_web' => 'When you create this web page, The file \'index. Htm\' will be overwritten in your web site directory. ',
'csw_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful',
'csw_Create_Starter_Website' => 'Create Starter Website', 'csw_Create_Starter_Website' => 'Create Starter Website',
'csw_First_header,_typically_used_for' => 'First header, Typically used for short phrases such as \'Leader in the field of textile manufacturing\'',
'csw_' => '',
'csw_APPLY' => 'Apply',
'csw_Text_following_second_header,_typically' => 'Text following second header, Typically used for contact or ordering information:',

View File

@ -0,0 +1,96 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-14 17:41
%#
<div id="CreateStarterWebsite-PARAMS" class="partial CreateStarterWebsite-PARAMS">
<script>
window.onload = function() {
SelectInput();
};
</script>
<h2>
%= l('csw_Hello_PARAMS');
</h2>
% my $btn = l('csw_APPLY');
%= form_for "CreateStarterWebsited" => (method => 'POST') => begin
% param 'trt' => $csw_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $csw_data->{trt}
%# Inputs etc in here.
<h2><%=l('csw_Manage_CreateStarterWebsite_settings:')%></h2>
<p>
%=l('csw_To_create_a_simple_web')
</p>
<p>
%=l('csw_You_can_leave_any_field')
</p>
<p>
%=l('csw_The_text_that_you_enter')
</p>
<p>
%=l('csw_Do_not_use_this_optionif')
</p>
<p><span class=label>
%=l('csw_')
</span><span class=data>
%=
</span></p>
<p>
%=l('csw_First_header,_typically_used_for')
</p>
<p><span class=label>
%=l('csw_')
</span><span class=data>
%=
</span></p>
<p>
%=l('csw_Text_following_first_header,_typically')
</p>
<span class=label>
%=l('csw_')
</span><span class=data>
% param 'text1' => $csw_data->{text1} unless param 'text1';
%= text_area 'text1', cols=>40, rows=>10
</span><br>
<p>
%=l('csw_Second_header,_typically_used_for')
</p>
<p><span class=label>
%=l('csw_')
</span><span class=data>
%=
</span></p>
<p>
%=l('csw_Text_following_second_header,_typically')
</p>
<span class=label>
%=l('csw_')
</span><span class=data>
% param 'text2' => $csw_data->{text2} unless param 'text2';
%= text_area 'text2', cols=>40, rows=>10
</span><br>
<p>
%=l('csw_When_you_create_this_web')
</p>
<p>
%=l('csw_Do_you_wish_to_proceed?')
</p>
%# Probably finally by a submit.
%end
</div>

View File

@ -1,11 +0,0 @@
'du_APPLY' => "Приложи",
'du_Usage' => "Употреба",
'du_Path' => "Път",
'du_Wed_Sep_11_19:01:00_BST' => "Сряда, 11 септември 19:01:00 BST 2024",
'du_PARAMS_panel_action_was_successful' => "Панелът PARAMS беше успешен",
'du_&amp;nbsp' => "~~~&nbsp~~~",
'du_Manage_DiskUsage_settings:' => "Управление на настройките за използване на диска:",
'du_Disk_Usage' => "Дисково използване",
'du_Hello_PARAMS' => "~~~Здравейте PARAMS~~~",
'du_I-bays' => "I-бейове",
'du_Users' => "~~~Потребители~~~",

View File

@ -1,11 +0,0 @@
'du_APPLY' => "Anwenden",
'du_Usage' => "~~~Verwendung~~~",
'du_Path' => "Pfad",
'du_Wed_Sep_11_19:01:00_BST' => "~~~Mi Sep 11 19:01:00 BST 2024~~~",
'du_PARAMS_panel_action_was_successful' => "Die PARAMS-Panel-Aktion war erfolgreich",
'du_&amp;nbsp' => "~~~&nbsp~~~",
'du_Manage_DiskUsage_settings:' => "Festplattennutzungs-Einstellungen verwalten:",
'du_Disk_Usage' => "~~~Festplattennutzung~~~",
'du_Hello_PARAMS' => "~~~Hallo PARAMS~~~",
'du_I-bays' => "I-Bays",
'du_Users' => "Benutzer",

View File

@ -1,11 +0,0 @@
'du_APPLY' => "Anvend",
'du_Usage' => "Brug",
'du_Path' => "Sti",
'du_Wed_Sep_11_19:01:00_BST' => "Ons d. 11. sep 2024 19:01:00 BST",
'du_PARAMS_panel_action_was_successful' => "~~~PARAMS-panelets handling var vellykket~~~",
'du_&amp;nbsp' => "~~~&nbsp~~~",
'du_Manage_DiskUsage_settings:' => "Administrer indstillinger for diskforbrug:",
'du_Disk_Usage' => "Diskforbrug",
'du_Hello_PARAMS' => "Hej PARAMS",
'du_I-bays' => "I-bays",
'du_Users' => "Brugere",

View File

@ -1,11 +0,0 @@
'du_APPLY' => "Εφαρμογή",
'du_Usage' => "Χρήση",
'du_Path' => "Διαδρομή",
'du_Wed_Sep_11_19:01:00_BST' => "~~~Τετ 11 Σεπ 19:01:00 EET 2024~~~",
'du_PARAMS_panel_action_was_successful' => "Η ενέργεια του πίνακα PARAMS ήταν επιτυχής",
'du_&amp;nbsp' => "~~~&nbsp~~~",
'du_Manage_DiskUsage_settings:' => "Διαχείριση ρυθμίσεων Χρήσης Δίσκου:",
'du_Disk_Usage' => "Χρήση Δίσκου",
'du_Hello_PARAMS' => "Γειά σου PARAMS",
'du_I-bays' => "Κόλποι I",
'du_Users' => "Χρήστες",

View File

@ -1,11 +0,0 @@
'du_APPLY' => "Aplicar",
'du_Usage' => "Uso",
'du_Path' => "Ruta",
'du_Wed_Sep_11_19:01:00_BST' => "Mié Sep 11 19:01:00 BST 2024",
'du_PARAMS_panel_action_was_successful' => "La acción del panel PARAMS fue exitosa",
'du_&amp;nbsp' => "~~~&nbsp~~~",
'du_Manage_DiskUsage_settings:' => "Administrar configuraciones de uso de disco:",
'du_Disk_Usage' => "Uso de Disco",
'du_Hello_PARAMS' => "Hola PARAMS",
'du_I-bays' => "I-bays",
'du_Users' => "Usuarios",

View File

@ -1,11 +0,0 @@
'du_APPLY' => "Rakenda",
'du_Usage' => "Kasutus",
'du_Path' => "Tee",
'du_Wed_Sep_11_19:01:00_BST' => "Kolm, 11. september 2024, 19:01:00 BST",
'du_PARAMS_panel_action_was_successful' => "PARAMS paneeli toiming oli edukas",
'du_&amp;nbsp' => "~~~&nbsp~~~",
'du_Manage_DiskUsage_settings:' => "Halda kettakasutuse seadeid:",
'du_Disk_Usage' => "Kettakasutus",
'du_Hello_PARAMS' => "Tere PARAMS",
'du_I-bays' => "I-lahed",
'du_Users' => "Kasutajad",

View File

@ -1,11 +0,0 @@
'du_APPLY' => "Appliquer",
'du_Usage' => "Utilisation",
'du_Path' => "Chemin",
'du_Wed_Sep_11_19:01:00_BST' => "Mer 11 Sep 19:01:00 BST 2024",
'du_PARAMS_panel_action_was_successful' => "L\'action du panneau PARAMS a été réussie",
'du_&amp;nbsp' => "&nbsp",
'du_Manage_DiskUsage_settings:' => "Gérer les paramètres d\'utilisation du disque :",
'du_Disk_Usage' => "Utilisation du disque",
'du_Hello_PARAMS' => "~~~Bonjour PARAMÈTRES~~~",
'du_I-bays' => "Baies I",
'du_Users' => "Utilisateurs",

View File

@ -1,11 +0,0 @@
'du_APPLY' => "Alkalmazás",
'du_Usage' => "Használat",
'du_Path' => "Útvonal",
'du_Wed_Sep_11_19:01:00_BST' => "2024. szeptember 11., szerda, 19:01:00 BST",
'du_PARAMS_panel_action_was_successful' => "~~~PARAMS panel művelet sikeres volt~~~",
'du_&amp;nbsp' => "~~~&nbsp~~~",
'du_Manage_DiskUsage_settings:' => "Lemezhasználati beállítások kezelése:",
'du_Disk_Usage' => "Lemezhasználat",
'du_Hello_PARAMS' => "~~~Helló PARAMS~~~",
'du_I-bays' => "I-bayok",
'du_Users' => "Felhasználók",

View File

@ -1,11 +0,0 @@
'du_APPLY' => "Terapkan",
'du_Usage' => "Penggunaan",
'du_Path' => "Jalur",
'du_Wed_Sep_11_19:01:00_BST' => "~~~Rab 11 Sep 19:01:00 WIB 2024~~~",
'du_PARAMS_panel_action_was_successful' => "Panel PARAMS berhasil dijalankan",
'du_&amp;nbsp' => "~~~&nbsp~~~",
'du_Manage_DiskUsage_settings:' => "Kelola pengaturan Penggunaan Disk:",
'du_Disk_Usage' => "Penggunaan Disk",
'du_Hello_PARAMS' => "~~~Halo PARAMS~~~",
'du_I-bays' => "I-bays",
'du_Users' => "Pengguna",

View File

@ -1,11 +0,0 @@
'du_APPLY' => "החל",
'du_Usage' => "שימוש",
'du_Path' => "נתיב",
'du_Wed_Sep_11_19:01:00_BST' => "~~~ד׳ ספטמבר 11 19:01:00 שעון קיץ בריטי 2024~~~",
'du_PARAMS_panel_action_was_successful' => "פעולת לוח PARAMS הצליחה",
'du_&amp;nbsp' => "&nbsp",
'du_Manage_DiskUsage_settings:' => "נהל הגדרות שימוש בדיסק:",
'du_Disk_Usage' => "שימוש בדיסק",
'du_Hello_PARAMS' => "שלום PARAMS",
'du_I-bays' => "מפרצים",
'du_Users' => "משתמשים",

View File

@ -1,11 +0,0 @@
'du_APPLY' => "Applica",
'du_Usage' => "Utilizzo",
'du_Path' => "Percorso",
'du_Wed_Sep_11_19:01:00_BST' => "Mer 11 Set 19:01:00 BST 2024",
'du_PARAMS_panel_action_was_successful' => "L\'azione del pannello PARAMS è stata completata con successo",
'du_&amp;nbsp' => "&nbsp",
'du_Manage_DiskUsage_settings:' => "Gestisci impostazioni di utilizzo del disco:",
'du_Disk_Usage' => "Utilizzo del Disco",
'du_Hello_PARAMS' => "Ciao PARAMS",
'du_I-bays' => "I-bay",
'du_Users' => "Utenti",

View File

@ -1,11 +0,0 @@
'du_APPLY' => "適用",
'du_Usage' => "使用",
'du_Path' => "パス",
'du_Wed_Sep_11_19:01:00_BST' => "2024年9月11日(水) 19:01:00 BST",
'du_PARAMS_panel_action_was_successful' => "~~~PARAMSパネルの操作が成功しました~~~",
'du_&amp;nbsp' => "&nbsp",
'du_Manage_DiskUsage_settings:' => "ディスク使用量設定の管理:",
'du_Disk_Usage' => "ディスク使用量",
'du_Hello_PARAMS' => "こんにちは PARAMS",
'du_I-bays' => "I-bays",
'du_Users' => "ユーザー",

View File

@ -2,7 +2,7 @@
# Routines to be edited by the developer to provide validation for parameters # Routines to be edited 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:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-13 19:18 # Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-14 11:53
# #
use esmith::util; use esmith::util;

View File

@ -0,0 +1,79 @@
#
# Routines to be edited by the developer to provide validation for parameters
# and provison of the control data for table(s)
#
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-14 12:09
#
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 {
my $c = shift;
my $prefix_data = shift; #Data hash as parameter
my $ret = 'ok';
return $ret;
}
# Get control data for tables(s)
sub get_Table1 {
# Return an array of hashes of the contents for each row and column for Table1
# default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc"
my $c = shift;
my @ret = {};
return \@ret
}
sub get_Table2 {
# Return an array of hashes of the contents for each row and column for Table2
# default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc"
my $c = shift;
my @ret = {};
return \@ret
}
# Return hash with values from row in which link clicked on table
sub get_selected_PARAMS {
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_PARAMS {
my $c = shift;
my $prefix_data = shift; #Data hash as parameter
my $ret = 'ok';
return $ret;
}
sub create_link{
# WIP
my ($c,$route, $panel, $index) = shift;
my $link = "$route?trt=$panel&Selected=$index";
return $link;
}
1;

View File

@ -1,6 +1,6 @@
package SrvMngr::Controller::Diskusage; package SrvMngr::Controller::Diskusage;
# #
# Generated by version:SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-13 19:18 # Generated by version:SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-14 12:09
# #
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# heading : Miscellaneous # heading : Miscellaneous

View File

@ -1,6 +1,6 @@
% layout 'default', title => "Sme server 2 - Disk Usage", share_dir => './'; % layout 'default', title => "Sme server 2 - Disk Usage", share_dir => './';
%# %#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-13 19:18 %# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-14 12:09
%# %#
% content_for 'module' => begin % content_for 'module' => begin
<div id="module" class="module Diskusage-panel"> <div id="module" class="module Diskusage-panel">

View File

@ -1,11 +1,11 @@
'du_APPLY' => 'Apply', 'du_&amp;nbsp' => '&amp;nbsp',
'du_I-bays' => 'I-bays',
'du_Usage' => 'Usage', 'du_Usage' => 'Usage',
'du_Disk_Usage' => 'Disk Usage',
'du_Path' => 'Path', 'du_Path' => 'Path',
'du_Wed_Sep_11_19:01:00_BST' => 'Wed Sep 11 19:01:00 BST 2024', 'du_Wed_Sep_11_19:01:00_BST' => 'Wed Sep 11 19:01:00 BST 2024',
'du_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful',
'du_&amp;nbsp' => '&amp;nbsp',
'du_Manage_DiskUsage_settings:' => 'Manage DiskUsage settings:',
'du_Disk_Usage' => 'Disk Usage',
'du_Hello_PARAMS' => 'Hello PARAMS',
'du_I-bays' => 'I-bays',
'du_Users' => 'Users', 'du_Users' => 'Users',
'du_APPLY' => 'Apply',
'du_Hello_PARAMS' => 'Hello PARAMS',
'du_Manage_DiskUsage_settings:' => 'Manage DiskUsage settings:',
'du_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful',

View File

@ -1,5 +1,5 @@
%# %#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-13 19:18 %# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-14 12:09
%# %#
<div id="Diskusage-PARAMS" class="partial Diskusage-PARAMS"> <div id="Diskusage-PARAMS" class="partial Diskusage-PARAMS">
<script> <script>
@ -75,9 +75,9 @@ tmpfs 2.0G 648K 2.0G 1% /run
% my $control_data = $self->stash('Table2'); % my $control_data = $self->stash('Table2');
% foreach my $row (@$control_data) { % foreach my $row (@$control_data) {
<tr class='table-row'> <tr class='table-row'>
<td class='sme-border table-col table-col-Table2-Users'><%=$c->render_to_string(inline=>$row->{Table2-Users})%></td> <td class='sme-border table-col table-col-Table2-Users'><%=$c->render_to_string(inline=>$row->{'Table2-Users'})%></td>
<td class='sme-border table-col table-col-Table2-Usage'><%=$c->render_to_string(inline=>$row->{Table2-Usage})%></td> <td class='sme-border table-col table-col-Table2-Usage'><%=$c->render_to_string(inline=>$row->{'Table2-Usage'})%></td>
<td class='sme-border table-col table-col-Table2-Path'><%=$c->render_to_string(inline=>$row->{Table2-Path})%></td> <td class='sme-border table-col table-col-Table2-Path'><%=$c->render_to_string(inline=>$row->{'Table2-Path'})%></td>
</tr> </tr>
%} %}
</tbody> </tbody>

View File

@ -33,8 +33,14 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
# Get control data for tables(s) # Get control data for tables(s)
<tal:block tal:repeat="tablecontrol tablecontrols"> <tal:block tal:repeat="tablecontrol tablecontrols">
sub get_${tablecontrol} { sub get_${tablecontrol} {
# Return an array of hashes of the contents for each row and column for ${tablecontrol}
# default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc"
my $c = shift; my $c = shift;
my @ret = {}; my $control_data = $self->stash('${TableControl}');
my @ret = {}
# foreach my $colHead (@$control_data) {
# my ret{$colHead} = "$colhead-1"
# };
return \@ret return \@ret
} }
</tal:block> </tal:block>

View File

@ -49,7 +49,7 @@
<Paragraph><![CDATA[ <Paragraph><![CDATA[
<p> <p>
%= l('${value}') %=l('${value}')
</p> </p>
]]></Paragraph> ]]></Paragraph>
@ -125,4 +125,11 @@
]]> ]]>
</Preformatted> </Preformatted>
<submit><![CDATA[
<p> <br>
%= submit_button "${Value}", class => 'action'
</p>
]]>
</submit>
</root> </root>

View File

@ -0,0 +1,102 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SME Server sme11.thereadclan.me.uk</title>
<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>
<div class="sme-error"><h5>
Warning: a reconfigure and reboot is required before proceeding! Failure to do so now
may leave your system in an unknown state!</h5></div><div class="sme-error"><h5>
URGENT NOTICE: As per June 30th 2024, SME Server 10 is obsolete, and potentially INSECURE. NO support will be offered for any issue found with this installed version.
Please migrate IMMEDIATELY to Koozali SME Server 11 or higher version. Failure to upgrade may lead to the compromise of this server.
</br>Please, consult <a href="https://wiki.koozali.org/SME_Server:Download" target="_blank">https://wiki.koozali.org/SME_Server:Download</a> to get last available version.</h5></div>
<h1>Create a starter website</h1>
<form method="POST" action="starterwebsite" 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="53ee9f713d94b5ba86a563429440d21e">
<input type="hidden" name="csrf_token" value="iEskwobsBAfGQ8A05yW8QPL7guJPZVEylHcHb4RlmkB">
<table class="sme-noborders">
<tr><td colspan="2"><p><p>
To create a simple web page for your company, fill
in the fields below and click on <b>Create</b>.
</p>
<p>
You can leave any field blank if you do not need it.
</p>
<p>
The text that you enter below will be line wrapped
for a nicer appearance in your web page. Leave a blank line
whenever you want to start a new paragraph. If you need
to force a line break without starting a new paragraph (for
example after each line of a mailing address), then type
the four-character sequence
<blockquote>&lt;BR&gt;</blockquote>
where you would like each line break.
</p>
<p>
<em>Do not use this option</em>
if you have already customized your web site, since it will
overwrite the "index.htm" file in your web site directory.
</p></p></td>
</tr>
<tr>
<td class="sme-noborders-label">Company name
<td class="sme-noborders-content"><INPUT TYPE="text" SIZE="48" VALUE="" NAME="companyName"></td>
</tr>
<tr>
<td colspan="2"><p>First header, typically used for short phrases such
as "Leader in the field of textile manufacturing"</p></td>
</tr> <tr>
<td class="sme-noborders-label">
<td class="sme-noborders-content"><INPUT TYPE="text" NAME="header1" SIZE="48" VALUE=""></td>
</tr>
<tr>
<td colspan="2"><p>Text following first header, typically used for a
paragraph of marketing information.</p></td>
</tr> <tr>
<td class="sme-noborders-label">
<td class="sme-noborders-content"><TEXTAREA COLS="60" ROWS="5" NAME="text1"></TEXTAREA></td>
</tr>
<tr>
<td colspan="2"><p>Second header, typically used for short phrases such
as "For more information" or "To order our products":</p></td>
</tr> <tr>
<td class="sme-noborders-label">
<td class="sme-noborders-content"><INPUT TYPE="text" NAME="header2" VALUE="" SIZE="48"></td>
</tr>
<tr>
<td colspan="2"><p>Text following second header, typically used for contact
or ordering information:</p></td>
</tr> <tr>
<td class="sme-noborders-label">
<td class="sme-noborders-content"><TEXTAREA ROWS="5" NAME="text2" COLS="60"></TEXTAREA></td>
</tr>
<tr><td colspan=2><p>When you create this web page, the file
"index.htm" will be overwritten
in your web site directory.</p>
<p>Do you wish to proceed?</p></td></tr> </table>
<table width=100%><tr><th class="sme-layout"><input type="submit" name="Next" value="Create"></th></tr></table>
</table>
</form>
<HR class="sme-copyrightbar">
<FONT class="sme-copyright">
SME Server 11.0.0<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,61 @@
{
'PackageName': 'CreateStarterWebsite',
'prefix': 'csw',
'MenuHeading': 'Miscellaneous',
'MenuDescription': 'Create Starter Website',
'MenuNavigation': '2000 400',
'firstPanel': 'PARAMS',
'signalEvent': 'smeserver-createstarterwebsite-update',
'html': {
'Name': 'params',
'route': 'PARAMS',
'Header': 'Create a starter website',
'SubHeader': 'Manage CreateStarterWebsite settings:',
'Paragraph1': 'To create a simple web page for your company, fill in the fields below and click onCreate.',
'Paragraph2': 'You can leave any field blank if you do not need it.',
'Paragraph3': 'The text that you enter below will be line wrapped for a nicer appearance in your web page. Leave a blank line whenever you want to start a new paragraph. If you need to force a line break without starting a new paragraph (for example after each line of a mailing address), then type the four-character sequence',
'Paragraph4': 'Do not use this optionif you have already customized your web site, since it will overwrite the \\\'index.htm\\\' file in your web site directory.',
'Input1': {
'Type': 'Text',
'Value': '',
'Name': 'companyName',
'Label': null
},
'Paragraph5': 'First header, typically used for short phrases such as \\\'Leader in the field of textile manufacturing\\\'',
'Input2': {
'Type': 'Text',
'Value': '',
'Name': 'header1',
'Label': null
},
'Paragraph6': 'Text following first header, typically used for a paragraph of marketing information.',
'Input3': {
'Type': 'Textarea',
'Value': '',
'Name': 'text1',
'Label': null
},
'Paragraph7': 'Second header, typically used for short phrases such as \\\'For more information\\\' or \\\'To order our products\\\':',
'Input4': {
'Type': 'Text',
'Value': '',
'Name': 'header2',
'Label': null
},
'Paragraph8': 'Text following second header, typically used for contact or ordering information:',
'Input5': {
'Type': 'Textarea',
'Value': '',
'Name': 'text2',
'Label': null
},
'Paragraph9': 'When you create this web page, the file \\\'index.htm\\\' will be overwritten in your web site directory.',
'Paragraph10': 'Do you wish to proceed?',
'Input6': {
'Type': 'Submit',
'Value': 'Create',
'Name': 'Next',
'Label': null
}
}
}

93
html/DiskUsage.html Normal file
View File

@ -0,0 +1,93 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SME Server sme10.thereadclan.me.uk</title>
<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>Disk usage</h1>
<form method="POST" action="diskusage" 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="65306129a4e734ea46f31f7f8630a65d">
<input type="hidden" name="csrf_token" value="QbCmcx81coESLmdiNA5k9GiTKg2k7sJQLiY00BxtwXS">
<table class="sme-noborders">
<p>&nbsp
</p>
<p>Wed Sep 11 19:01:00 BST 2024
</p>
<p><pre>Filesystem Size Used Avail Use% Mounted on
/dev/mapper/main-root 29G 4.8G 24G 17% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 12K 2.0G 1% /dev/shm
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
tmpfs 2.0G 648K 2.0G 1% /run
/dev/sda1 497M 111M 386M 23% /boot
</pre></p>
<table class="sme-border">
<tr>
<th colspan="1" class="sme-border">I-bays</th>
<th colspan="1" class="sme-border">Usage</th>
<th colspan="1" class="sme-border">Path</th>
</tr>
<tr>
<td colspan="1" class="sme-border">Primary</td>
<td colspan="1" class="sme-border">4.0K</td>
<td colspan="1" class="sme-border">/home/e-smith/files/ibays/Primary</td>
</tr>
<tr>
<td colspan="1" class="sme-border">anibay</td>
<td colspan="1" class="sme-border">4.0K</td>
<td colspan="1" class="sme-border">/home/e-smith/files/ibays/anibay</td>
</tr>
<tr>
<td colspan="1" class="sme-border">opt</td>
<td colspan="1" class="sme-border">410M</td>
<td colspan="1" class="sme-border">/opt</td>
</tr>
</table>
<p>&nbsp
</p>
<table class="sme-border">
<tr>
<th colspan="1" class="sme-border">Users</th>
<th colspan="1" class="sme-border">Usage</th>
<th colspan="1" class="sme-border">Path</th>
</tr>
<tr>
<td colspan="1" class="sme-border">root</td>
<td colspan="1" class="sme-border">2.1M</td>
<td colspan="1" class="sme-border">/root</td>
</tr>
<tr>
<td colspan="1" class="sme-border">brianr</td>
<td colspan="1" class="sme-border">16K</td>
<td colspan="1" class="sme-border">/home/e-smith/files/users/brianr</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

@ -6,51 +6,50 @@
'MenuNavigation': '2000 400', 'MenuNavigation': '2000 400',
'firstPanel': 'PARAMS', 'firstPanel': 'PARAMS',
'signalEvent': 'smeserver-createstarterwebsite-update', 'signalEvent': 'smeserver-createstarterwebsite-update',
'html':[ 'html':[ {
{
'Name': 'params', 'Name': 'params',
'route': 'PARAMS', 'route': 'PARAMS',
'Header': 'Create a starter website', 'Header': 'Create a starter website',
'SubHeader': 'Manage CreateStarterWebsite settings:', 'SubHeader': 'Manage CreateStarterWebsite settings:',
'Paragraph1': 'To create a simple web page for your company, fill \n\t in the fields below and click onCreate.', 'Paragraph1': 'To create a simple web page for your company, fill in the fields below and click onCreate.',
'Paragraph2': 'You can leave any field blank if you do not need it.', 'Paragraph2': 'You can leave any field blank if you do not need it.',
'Paragraph3': 'The text that you enter below will be line wrapped \n\t for a nicer appearance in your web page. Leave a blank line \n\t whenever you want to start a new paragraph. If you need \n\t to force a line break without starting a new paragraph (for \n\t example after each line of a mailing address), then type \n\t the four-character sequence', 'Paragraph3': 'The text that you enter below will be line wrapped for a nicer appearance in your web page. Leave a blank line whenever you want to start a new paragraph. If you need to force a line break without starting a new paragraph (for example after each line of a mailing address), then type the four-character sequence',
'Paragraph4': 'Do not use this option if you have already customized your web site, since it will \n\t overwrite the \'index.htm\' file in your web site directory.', 'Paragraph4': 'Do not use this optionif you have already customized your web site, since it will overwrite the index.htm file in your web site directory.',
'Input1': { 'Input1': {
'Type': 'Text', 'Type': 'Text',
'Value': '', 'Value': '',
'Name': 'companyName', 'Name': 'companyName',
'Label': null 'Label': null
}, },
'Paragraph5': 'First header, typically used for short phrases such \n\t as \'Leader in the field of textile manufacturing\'', 'Paragraph5': 'First header, typically used for short phrases such as Leader in the field of textile manufacturing',
'Input2': { 'Input2': {
'Type': 'Text', 'Type': 'Text',
'Value': '', 'Value': '',
'Name': 'header1', 'Name': 'header1',
'Label': null 'Label': null
}, },
'Paragraph6': 'Text following first header, typically used for a \n\t paragraph of marketing information.', 'Paragraph6': 'Text following first header, typically used for a paragraph of marketing information.',
'Input3': { 'Input3': {
'Type': 'Textarea', 'Type': 'Textarea',
'Value': '', 'Value': '',
'Name': 'text1', 'Name': 'text1',
'Label': null 'Label': null
}, },
'Paragraph7': 'Second header, typically used for short phrases such \n\t as \'For more information\' or \'To order our products\':', 'Paragraph7': 'Second header, typically used for short phrases such as For more information or To order our products:',
'Input4': { 'Input4': {
'Type': 'Text', 'Type': 'Text',
'Value': '', 'Value': '',
'Name': 'header2', 'Name': 'header2',
'Label': null 'Label': null
}, },
'Paragraph8': 'Text following second header, typically used for contact \n\t or ordering information:', 'Paragraph8': 'Text following second header, typically used for contact or ordering information:',
'Input5': { 'Input5': {
'Type': 'Textarea', 'Type': 'Textarea',
'Value': '', 'Value': '',
'Name': 'text2', 'Name': 'text2',
'Label': null 'Label': null
}, },
'Paragraph9': 'When you create this web page, the file\n\t \'index.htm\' will be overwritten\n\t in your web site directory.', 'Paragraph9': 'When you create this web page, the file index.htm will be overwritten in your web site directory.',
'Paragraph10': 'Do you wish to proceed?', 'Paragraph10': 'Do you wish to proceed?',
'Input6': { 'Input6': {
'Type': 'Submit', 'Type': 'Submit',

View File

@ -16,6 +16,18 @@ def validate_html(html):
etree.fromstring(html, parser) # Attempt to parse the HTML etree.fromstring(html, parser) # Attempt to parse the HTML
except Exception as e: except Exception as e:
raise ValueError("Invalid HTML document") from e raise ValueError("Invalid HTML document") from e
def sanitize_text(text):
# Replace newlines with spaces
sanitized_text = text.replace('\n', ' ').replace('\r', ' ') # Handle both Unix and Windows line endings
# Replace tabs with spaces
sanitized_text = sanitized_text.replace('\t', ' ')
# Escape quote characters
sanitized_text = sanitized_text.replace('"', '\\"').replace("'", "\\'")
# Strip leading and trailing whitespace
sanitized_text = sanitized_text.strip()
return sanitized_text
def extract_data(html): def extract_data(html):
"""Extract paragraphs, inputs, tables, and pre blocks from HTML and organize them in order.""" """Extract paragraphs, inputs, tables, and pre blocks from HTML and organize them in order."""
@ -54,9 +66,10 @@ def extract_data(html):
elif element.name == 'p': elif element.name == 'p':
text = element.get_text(strip=True) text = element.get_text(strip=True)
if text: # Ignore empty paragraphs if text: # Ignore empty paragraphs
#Sanitise text freom newlines,tabs and escape quotes.
records.append({ records.append({
'Type': 'Paragraph', 'Type': 'Paragraph',
'Text': text 'Text': sanitize_text(text)
}) })
elif element.name == 'pre': elif element.name == 'pre':
@ -233,7 +246,7 @@ def save_to_json5(data, output_filename, package_name, header, sub_header):
json_file.truncate() # Remove any old content beyond the new content length json_file.truncate() # Remove any old content beyond the new content length
def main(): def main():
input_file = '/home/brianr/clients/SM2/SM1-JSONGen/DiskUsage.html' # Specify the input HTML file path input_file = '/home/brianr/clients/SM2/SM2Gen/venv/html/CreateStarterWebsite.html' # Specify the input HTML file path
# Read HTML content # Read HTML content
html_content = read_html_file(input_file) html_content = read_html_file(input_file)