Changes

Jump to navigation Jump to search
no edit summary
Line 129: Line 129:  
Note the initial capital letter on the file name for the controller file, and also the Translation directory.
 
Note the initial capital letter on the file name for the controller file, and also the Translation directory.
    +
== Converting from formMagick ==
 
if you are converting an existing contrib with a formMagick panel, then you will want to use the current files as a basis for the re-write.
 
if you are converting an existing contrib with a formMagick panel, then you will want to use the current files as a basis for the re-write.
   Line 134: Line 135:     
# /etc/e-smith/web/functions/dhcpd  
 
# /etc/e-smith/web/functions/dhcpd  
# and sometimes a file in here: /usr/share/perl5/vendor_perl/esmith/FormMagick/Panel
+
# and sometimes a file in here: /usr/share/perl5/vendor_perl/esmith/FormMagick/Panel   Although in this case there is not. (and I find that directory structure impossible to remember - "esmith" sans "-" throws me).
# and translatable strings in here:  /etc/e-smith/locale/en-us/etc/e-smith/web/functions/<contrib name>
+
# and translatable strings in here:  /etc/e-smith/locale/en-us/etc/e-smith/web/functions/<contrib name> the format is XML- like whereas SM2 requires a more perl l- ike structure.
 +
Here is a sed script and extra commands to take a formMagick strings file and make it into a lex file suitable for SM2.
   −
Although in this case there is not. (and I find that directory structure impossible to remember - "esmith" sans "-" throws me).
+
Create a sed script file (cnv_lexi.vi):<syntaxhighlight lang="text">
 +
/lexicon/ d
 +
/entry/ d
 +
s/'/\\'/g
 +
s/<base>/'ddc_/
 +
s/<\/base>/' => /
 +
s/<trans>/'/
 +
s/<\/trans>/',/
 +
s/\t//g
 +
s/<!\[CDATA\[//g
 +
s/]]>//g
 +
/^$/d
 +
s/        '/'/g
 +
s/        //g
 +
s/=> \n/=> /g
 +
</syntaxhighlight>Then the shell script to run it: (extractlex.sh):<syntaxhighlight>
 +
#!/bin/sh
 +
cp /etc/e-smith/locale/en-us/etc/e-smith/web/functions/$1 $1.res
 +
sed -f cnv_lexi.vi /etc/e-smith/locale/en-us/etc/e-smith/web/functions/$1 $1.res | tr "\n" "~" | sed 's/\s+~/~/g' | sed 's/~,/,/g' | sed "s/~'~/'/g" | sed s/"~',~'/',~/g" | tr "~" "\n" > $1.lex
 +
 
 +
</syntaxhighlight>Run it by: ./extractlexi.sh dhcpd"
    
I have not really understood how formMagick works, but mostly the subroutine names and code shows what is needed.
 
I have not really understood how formMagick works, but mostly the subroutine names and code shows what is needed.
    +
== Coding Environment ==
 
I work using a "test" SME10 VM accessed through an SSH tunnel (setup in the fstab) from my Fedora/Cinnamon desktop using the "geany" editor.
 
I work using a "test" SME10 VM accessed through an SSH tunnel (setup in the fstab) from my Fedora/Cinnamon desktop using the "geany" editor.
   Line 146: Line 169:  
root@sme10.thereadclan.me.uk:/ /home/brianr/SME10 fuse.sshfs rw,auto 0 0
 
root@sme10.thereadclan.me.uk:/ /home/brianr/SME10 fuse.sshfs rw,auto 0 0
   −
</syntaxhighlight>I'll setup a geany project with all the above files open in tabs.  Opening the editor project will open all the files in one go, assuming that the mapping to SME10 is live (sometime I have to manually mount it in Nemo, epseically after the desktop has been suspended for a while).
+
</syntaxhighlight>I'll setup a geany project with all the above files open in tabs.  Opening the editor project will open all the files in one go, assuming that the mapping to SME10 is live (sometime I have to manually mount it in Nemo, especially after the desktop has been suspended for a while).
    
Your mileage may of course vary!! Other editors etc are available.
 
Your mileage may of course vary!! Other editors etc are available.
 +
 +
I can then run the Server Manager in a browser against the SME10 VM, and make changes directly into the VM and see the results quickly.
 +
 +
Sometimes the changes require a:<syntaxhighlight lang="shell">
 +
signal-event smanager-refresh
 +
</syntaxhighlight>
    
==The Controller File (Dhcpman.pm)==
 
==The Controller File (Dhcpman.pm)==

Navigation menu