From: Michael Wiebusch Date: Thu, 1 Aug 2013 17:44:46 +0000 (+0200) Subject: YES, stuff works! Now default values from the specfile are ready underlying the setti... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=831b2cdacb4cee759161570167463c12c049431d;p=mvdsensorcontrol.git YES, stuff works! Now default values from the specfile are ready underlying the settings in the quickEditArea of testgui.pl --- diff --git a/tools/jtageditor.pl b/tools/jtageditor.pl index 51063ce..79f0839 100755 --- a/tools/jtageditor.pl +++ b/tools/jtageditor.pl @@ -3,6 +3,9 @@ print "Content-type: text/html\n\n"; # TODO +# remove CGI processing routines that are now in xmlOperation.pl +# still there but commented out + # substitute selectedConfigFile() with "$configFileName" inside print_registers and print_fieldsi # outsource print_registers and print_fields to xmlOperations @@ -17,13 +20,14 @@ print "Content-type: text/html\n\n"; # correct size in tooltip -# build ancestry without ancestry tree outside + # find a solution for fileLevel <=6 # our to ENV # DONE +# build ancestry without ancestry tree outside # do not include wrong type, different specfile # whine, wenn specfile/setfiles not found # supress circular dependencies @@ -105,41 +109,42 @@ if ( defined $cgiHash{'debuginput'} ) { print $cgiHash{'debuginput'}; } -if ( defined $cgiHash{'action'} ) { - - printHash( \%cgiHash ); - if ( $cgiHash{'action'} eq 'save' ) { - parseConfigFile( $cgiHash{'configFile'} ); - save( $cgiHash{'register'}, $cgiHash{'field'}, $cgiHash{'value'} ); - writeConfigFile(); - } - if ( $cgiHash{'action'} eq 'delete' ) { - parseConfigFile( $cgiHash{'configFile'} ); - del( $cgiHash{'register'}, $cgiHash{'field'} ); - writeConfigFile(); - } - if ( $cgiHash{'action'} eq 'copyDefaultRegister' ) { - parseConfigAndSpec( $cgiHash{'configFile'} ); - del( $cgiHash{'register'}, "" ); # delete existing register from setfile - copyDefaultRegister( $cgiHash{'register'} ); - writeConfigFile(); - } - if ( $cgiHash{'action'} eq 'createFile' ) { - createConfigFile( $cgiHash{'configFile'}, $cgiHash{'specFile'} ); - writeConfigFile(); - } - - if ( $cgiHash{'action'} eq 'deleteFile' ) { - deleteFile( $cgiHash{'configFile'} ); - } - - if ( $cgiHash{'action'} eq 'changeAncestor' ) { - parseConfigFile( $cgiHash{'configFile'} ); - changeAncestor( $cgiHash{'newAncestor'} ); - writeConfigFile(); - } - -} +# # obsolete +# if ( defined $cgiHash{'action'} ) { +# +# printHash( \%cgiHash ); +# if ( $cgiHash{'action'} eq 'save' ) { +# parseConfigFile( $cgiHash{'configFile'} ); +# save( $cgiHash{'register'}, $cgiHash{'field'}, $cgiHash{'value'} ); +# writeConfigFile(); +# } +# if ( $cgiHash{'action'} eq 'delete' ) { +# parseConfigFile( $cgiHash{'configFile'} ); +# del( $cgiHash{'register'}, $cgiHash{'field'} ); +# writeConfigFile(); +# } +# if ( $cgiHash{'action'} eq 'copyDefaultRegister' ) { +# parseConfigAndSpec( $cgiHash{'configFile'} ); +# del( $cgiHash{'register'}, "" ); # delete existing register from setfile +# copyDefaultRegister( $cgiHash{'register'} ); +# writeConfigFile(); +# } +# if ( $cgiHash{'action'} eq 'createFile' ) { +# createConfigFile( $cgiHash{'configFile'}, $cgiHash{'specFile'} ); +# writeConfigFile(); +# } +# +# if ( $cgiHash{'action'} eq 'deleteFile' ) { +# deleteFile( $cgiHash{'configFile'} ); +# } +# +# if ( $cgiHash{'action'} eq 'changeAncestor' ) { +# parseConfigFile( $cgiHash{'configFile'} ); +# changeAncestor( $cgiHash{'newAncestor'} ); +# writeConfigFile(); +# } +# +# } #################### SUBLAND ###################### @@ -401,7 +406,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 diff --git a/tools/testgui.pl b/tools/testgui.pl index b2e5282..a771a55 100755 --- a/tools/testgui.pl +++ b/tools/testgui.pl @@ -216,8 +216,8 @@ sub print_setupStructure { my $sensorPosition = $sensor->findnodes("./position")->shift(); my $sensorDescription = $sensor->findvalue("./description"); - print h5("Sensor name:$sensorName id:$sensorId"); - print "

description: $sensorDescription

"; +# print h5("Sensor name:$sensorName id:$sensorId"); +# print "

description: $sensorDescription

"; print_sensorArea($sensor); } @@ -266,7 +266,10 @@ sub print_sensorArea { print "
"; print ""; print ""; - print ""; + print ""; print ""; print ""; my $previewAreaId = "preview_".$sensorId; @@ -331,16 +334,16 @@ sub print_registers { 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"); +# 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 $quickEditMaskTree->findnodes("/MAPS/register"); print "
$sensorName"; + print ""; + print "
$sensorName (id=$sensorId)
description: $sensorDescription
"; + print "
findvalue("./\@name"); - # if register not in the mask file, don't print! - unless( $quickEditMaskTree->findnodes("/MAPS/register[\@name='". - $registerName."']")) { - next; - } +# # 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"); @@ -365,7 +368,7 @@ sub print_registers { || "n/a" ); - my $flistid = $xmlfile . "//" . $registerName; + my $flistid = $configFile . "//" . $registerName; print ""; @@ -381,12 +384,7 @@ EOF EOF } - if ( $xmlfile eq $specFile ) { # we are printing the Settings Tree - print < →  -EOF - } print ""; @@ -395,7 +393,7 @@ EOF print ''; print ''; print '"; } @@ -414,17 +412,37 @@ sub print_fields { my $register = $_[1]; my $xmlfile = $_[0]; my $registerName = $register->findvalue("./\@name"); - my @fields = sort by_name $register->findnodes("./field"); + my @maskFields = sort by_name $register->findnodes("./field"); print "
 X 
'; - print_fields( $xmlfile, $register ); + print_fields( $configFile, $register ); print ""; 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; + for my $maskField (@maskFields) { + + my $fieldName = $maskField->findvalue("./\@name"); + + my $field = $configTree->findnodes("/MAPS/register[\@name='". + $registerName."']/field[\@name='".$fieldName."']")->shift(); + + + unless(defined($field)){ + + my $specField = $specTree->findnodes("/MAPS/register[\@name='". + $registerName."']/field[\@name='".$fieldName."']")->shift(); + $field=$register->addNewChild("","field"); + $field->setAttribute("name",$fieldName); + $field->setAttribute("value",$specField->findvalue("./\@defaultValue")); + $field->setAttribute( "isHeritageFrom", $specFileName ); } + + + + +# # 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 $isHeritageFrom = ""; my $readOnlyFlag = 0; my $fieldValue = $field->findvalue("./\@value"); my $fieldSize =