From 065cac2127271327363e97f0424013b15c24e43d Mon Sep 17 00:00:00 2001 From: Michael Wiebusch Date: Thu, 1 Aug 2013 10:29:33 +0200 Subject: [PATCH] status quo, changed js stuff to be accessible in a more general way, still testgui needs work --- layout/testgui.css | 2 +- tools/testgui.js | 5 + tools/testgui.pl | 235 +++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 222 insertions(+), 20 deletions(-) diff --git a/layout/testgui.css b/layout/testgui.css index 5f40b92..79f132a 100644 --- a/layout/testgui.css +++ b/layout/testgui.css @@ -183,7 +183,7 @@ table.fields td.button_move_deac { .bitfield { background:#dea; - visibility:collapse; +/* visibility:collapse; */ } table.registers td.fieldcontainer { diff --git a/tools/testgui.js b/tools/testgui.js index fd610dd..4d394ff 100644 --- a/tools/testgui.js +++ b/tools/testgui.js @@ -23,5 +23,10 @@ function getdata(command,dId,async) { +function reloadQuickEditArea(configFile,destId) { + var configFile_ = encodeURIComponent(configFile); + getdata("testgui.pl?action=print_quickEditArea&configFile="+configFile_,destId,"false"); + +} \ No newline at end of file diff --git a/tools/testgui.pl b/tools/testgui.pl index ec87f9e..0f5494b 100755 --- a/tools/testgui.pl +++ b/tools/testgui.pl @@ -54,6 +54,8 @@ unless($q->param()) { -src => './testgui.js'} ); #process the arguments + + report_param(); } @@ -97,8 +99,10 @@ print start_html( -style=>[{'src'=>'../layout/styles.css'}, {'src'=>'../layout/testgui.css'} ], --script=>{ -type => 'text/javascript', --src => './testgui.js'} +-script=>[ +{ -type => 'text/javascript', -src => './testgui.js'}, +{ -type => 'text/javascript', -src => './xmlOperations.js'} +] ); print h2("testgui"); @@ -269,6 +273,206 @@ sub print_quickEditArea { } +# sub print_registers { +# +# my $configFile = getConfigFile(); +# my $specFile = getSpecFile(); +# my $configFileName = getConfigFileName(); +# my $specFileName = getSpecFileName(); +# my $configTree = getConfigTree(); +# my $specTree = getSpecTree(); +# +# my $xmlfile = $_[0]; +# my $xmltree; +# if ( $xmlfile eq $configFile ) { +# $xmltree = $configTree; +# } +# elsif ( $xmlfile eq $specFile ) { +# $xmltree = $specTree; +# } +# else { +# die "xmlfile given to sub print_registers is unknown"; +# } +# +# my @registers = sort by_name $xmltree->findnodes("/MAPS/register"); +# print ""; +# +# for my $register (@registers) { +# +# +# my $registerName = $register->findvalue("./\@name"); +# +# # if register not in the mask file, don't print! +# unless( $quickEditMaskTree->findnodes("/MAPS/register[\@name='". +# $registerName."']")) { +# next; +# } +# +# my $registerId = $register->findvalue("./\@id"); +# my $registerSize = $register->findvalue("./\@size"); +# my $registerDescr = prepare_text( +# $specTree->findvalue( +# "/MAPS/register[\@name='" . $registerName . "']/description" +# ) +# || "n/a" +# ); +# +# my $flistid = $xmlfile . "//" . $registerName; +# +# print ""; +# +# print < +  +# EOF +# print ""; +# +# #print ""; +# +# if ( $xmlfile eq $configFile ) { # we are printing the Specifications Tree +# print < X  +# EOF +# } +# if ( $xmlfile eq $specFile ) { # we are printing the Settings Tree +# +# print < →  +# EOF +# } +# +# print ""; +# +# #print ""; +# +# print ''; +# print ''; +# print '"; +# } +# print "
$registerName$registerId
'; +# print_fields( $xmlfile, $register ); +# print ""; +# print "
"; +# } +# +# +# sub print_fields { +# +# my $configFile = getConfigFile(); +# my $specFile = getSpecFile(); +# my $configFileName = getConfigFileName(); +# my $specFileName = getSpecFileName(); +# my $configTree = getConfigTree(); +# my $specTree = getSpecTree(); +# +# my $register = $_[1]; +# my $xmlfile = $_[0]; +# my $registerName = $register->findvalue("./\@name"); +# my @fields = sort by_name $register->findnodes("./field"); +# print ""; +# for my $field (@fields) { +# +# my $fieldName = $field->findvalue("./\@name"); +# +# # if field not in the mask file, don't print! +# unless( $quickEditMaskTree->findnodes("/MAPS/register[\@name='". +# $registerName."']/field[\@name='".$fieldName."']")) { +# next; +# } +# +# my $isHeritageFrom = $field->findvalue("./\@isHeritageFrom") || ""; +# my $readOnlyFlag = 0; +# my $fieldValue = $field->findvalue("./\@value"); +# my $fieldSize = +# $specTree->findvalue( "/MAPS/register[\@name='" +# . $registerName +# . "']/field[\@name='" +# . $fieldName +# . "']/\@size" ) +# || "n/a"; +# my $fieldDescr = prepare_text( +# $specTree->findvalue( +# "/MAPS/register[\@name='" +# . $registerName +# . "']/field[\@name='" +# . $fieldName +# . "']/description" +# ) +# || "n/a" +# ); +# +# my $maxFieldVal = 2**$fieldSize; +# my $sizeInfo = +# sprintf( +# "Field contains %d bits, possible values: 0-%d (0x0-0x%x)\n\n", +# $fieldSize, $maxFieldVal, $maxFieldVal ); +# +# $fieldDescr = $sizeInfo . $fieldDescr; +# +# unless ( $isHeritageFrom eq "" ) { +# $fieldDescr = +# "Field was inherited from $isHeritageFrom\n\n" . $fieldDescr; +# } +# +# my $fieldId = $xmlfile . "//" . $registerName . "/" . $fieldName; +# if ( $fieldValue eq "" ) { +# $fieldValue = $field->findvalue("./\@defaultValue"); +# $readOnlyFlag = 1; +# } +# +# print ""; +# print ""; +# print ""; +# if ($readOnlyFlag) { +# print <$fieldValue +# EOF +# } +# else { +# print < +# +# +# EOF +# +# } +# +# print ''; +# if ( $xmlfile eq $specFile ) { # we are printing the Specifications tree +# print < →  +# EOF +# } +# if ( $xmlfile eq $configFile ) { # we are printing the Settings Tree +# +# if ( $isHeritageFrom eq "" ) +# { # these are actual settings, not inherited! +# print < X  +# EOF +# } +# else { +# print ""; +# } +# } +# print ""; +# if ( ( any2dec($fieldValue) < 0 ) +# or ( any2dec($fieldValue) > $maxFieldVal ) ) +# { +# print +# "" +# ; # just debug +# } +# } +# print "
$fieldName  =  X 
!!!Above value not in allowed range!!!
"; +# +# } + + sub print_registers { my $configFile = getConfigFile(); @@ -289,20 +493,17 @@ sub print_registers { else { die "xmlfile given to sub print_registers is unknown"; } - my @registers = sort by_name $xmltree->findnodes("/MAPS/register"); print ""; - for my $register (@registers) { - my $registerName = $register->findvalue("./\@name"); - # if register not in the mask file, don't print! + # if register not in the mask file, don't print! unless( $quickEditMaskTree->findnodes("/MAPS/register[\@name='". $registerName."']")) { next; @@ -330,13 +531,13 @@ EOF if ( $xmlfile eq $configFile ) { # we are printing the Specifications Tree print < X  + EOF } if ( $xmlfile eq $specFile ) { # we are printing the Settings Tree print < →  + EOF } @@ -344,7 +545,7 @@ EOF #print ""; - print ''; + print ''; print ''; print '
 X  → 
'; print_fields( $xmlfile, $register ); @@ -354,7 +555,6 @@ EOF print "
"; } - sub print_fields { my $configFile = getConfigFile(); @@ -370,15 +570,13 @@ sub print_fields { my @fields = sort by_name $register->findnodes("./field"); print ""; for my $field (@fields) { - - my $fieldName = $field->findvalue("./\@name"); - - # if field not in the mask file, don't print! + my $fieldName = $field->findvalue("./\@name"); + # if field not in the mask file, don't print! unless( $quickEditMaskTree->findnodes("/MAPS/register[\@name='". $registerName."']/field[\@name='".$fieldName."']")) { next; } - + my $isHeritageFrom = $field->findvalue("./\@isHeritageFrom") || ""; my $readOnlyFlag = 0; my $fieldValue = $field->findvalue("./\@value"); @@ -431,7 +629,7 @@ EOF else { print < - + EOF @@ -440,7 +638,7 @@ EOF print ''; if ( $xmlfile eq $specFile ) { # we are printing the Specifications tree print < →  + EOF } if ( $xmlfile eq $configFile ) { # we are printing the Settings Tree @@ -448,7 +646,7 @@ EOF if ( $isHeritageFrom eq "" ) { # these are actual settings, not inherited! print < X  + EOF } else { @@ -467,4 +665,3 @@ EOF print "
 →  X 
"; } - -- 2.43.0