diff --git a/CODE/cgi-bin/WebObs/GML.pm b/CODE/cgi-bin/WebObs/GML.pm index e70615ac..cf9cd466 100755 --- a/CODE/cgi-bin/WebObs/GML.pm +++ b/CODE/cgi-bin/WebObs/GML.pm @@ -253,4 +253,8 @@ sub gml2mmdtable { return @outlines; } +sub gml2date { + +} + 1; diff --git a/CODE/cgi-bin/formCLB.pl b/CODE/cgi-bin/formCLB.pl index 539d71dd..15f528cf 100755 --- a/CODE/cgi-bin/formCLB.pl +++ b/CODE/cgi-bin/formCLB.pl @@ -83,7 +83,7 @@ sub sort_clb_lines { if (%CLBS) { @clbNote = wiki2html(join("",readFile($CLBS{NOTES}))); @fieldCLB = readCfg($CLBS{FIELDS_FILE}); - if ( $theiaAuth != 1 ) { pop(@fieldCLB); } + unless ( isok($theiaAuth) ) { pop(@fieldCLB); } if (@fieldCLB) { $fileDATA = "$NODES{PATH_NODES}/$NODEName/$GRIDType.$GRIDName.$NODEName.clb"; $fileDATA = "$NODES{PATH_NODES}/$NODEName/$NODEName.clb" if ( ! -e $fileDATA ); # for backwards compatibility diff --git a/CODE/cgi-bin/formGRID.pl b/CODE/cgi-bin/formGRID.pl index 0283483d..cb9a0272 100755 --- a/CODE/cgi-bin/formGRID.pl +++ b/CODE/cgi-bin/formGRID.pl @@ -66,7 +66,7 @@ =head1 CONFIGURATION VARIABLES use WebObs::Form; use WebObs::Utils; use WebObs::i18n; -my $me = $ENV{SCRIPT_NAME}; + # ---- misc inits # set_message(\&webobs_cgi_msg); diff --git a/CODE/cgi-bin/formNODE.pl b/CODE/cgi-bin/formNODE.pl index fa889e70..46049d5c 100755 --- a/CODE/cgi-bin/formNODE.pl +++ b/CODE/cgi-bin/formNODE.pl @@ -244,7 +244,7 @@ =head1 Query string parameters } # ---- load the database information if NODE is already filled out in the contacts table -my $stmt = qq(SELECT * FROM contacts WHERE EXISTS ( SELECT related_id from contacts ) AND related_id LIKE "\%$GRIDName.$NODEName"); +my $stmt = qq(SELECT * FROM contacts WHERE EXISTS ( SELECT related_id from contacts ) AND related_id LIKE "$usrProducer\%$GRIDName.$NODEName"); my $sth = $dbh->prepare( $stmt ); my $rv = $sth->execute() or die $DBI::errstr; @@ -371,28 +371,42 @@ =head1 Query string parameters for (var i=0; i 1) { - for (var i=0; i1) { + for (var i=0; i$__{'Description'}:"; print "  
"; # --- show THEIA fields ? - #print " 

"; + print "
 

"; print "
"; # --- PRODUCER print ""; @@ -1158,14 +1184,14 @@ =head1 Query string parameters print ""; print < - const theia = document.getElementById("showHide"); + const checked = document.getElementById("theiaChecked"); const auth = $theiaAuth; - + if (auth == 1) { // console.log(theia); - theia.style.display = "block"; + checked.style.display = "block"; } else { - theia.style.display = "none"; + checked.style.display = "none"; } var map = L.map('map', mapOptions); diff --git a/CODE/cgi-bin/gridsMgr.pl b/CODE/cgi-bin/gridsMgr.pl index 798c8d74..d9d2af32 100755 --- a/CODE/cgi-bin/gridsMgr.pl +++ b/CODE/cgi-bin/gridsMgr.pl @@ -137,12 +137,6 @@ =head1 QUERY-STRING PARAMETERS push(@nameFunders, (split ':|\(', $_)[1]); push(@acronyms, (split '\(|\)', $_)[1]); } -=pod -my @typeFunders= split('_,', (split '\|', $QryParm->{'funders'})[0]); -my @idScanR = split('_,', (split '\|', $QryParm->{'funders'})[1]); -my @funders = split('_,', (split '\|', $QryParm->{'funders'})[2]); -my @acronyms = split('_,', (split '\|', $QryParm->{'funders'})[3]); -=cut my @onlineRes = split('_,', $QryParm->{'onlineRes'}); foreach (@onlineRes) { diff --git a/CODE/cgi-bin/listGRIDS.pl b/CODE/cgi-bin/listGRIDS.pl index 11908ff2..f4de5abc 100755 --- a/CODE/cgi-bin/listGRIDS.pl +++ b/CODE/cgi-bin/listGRIDS.pl @@ -223,6 +223,7 @@ sub getDomainSefrans { print ""; print WebObs::Search::searchpopup(); print geditpopup(); + print feditpopup(); # ---- The GRIDS table # @@ -232,7 +233,7 @@ sub getDomainSefrans { if ($subsetDomain eq "") { print ""; if (WebObs::Users::clientHasAdm(type=>"authmisc",name=>"*")) { - print "    "; + print "    "; } print "Domain"; } @@ -246,7 +247,10 @@ sub getDomainSefrans { print "Type" if ($showType); print "Owner" if ($showOwnr); print "Graphs"; - print "Raw Data" if ($wantProcs || $wantSefrans); + if (WebObs::Users::clientHasAdm(type=>"authviews",name=>"*") && WebObs::Users::clientHasAdm(type=>"authprocs",name=>"*") ) { + print " " if ($wantProcs || $wantSefrans); + } + print "   Raw Data" if ($wantProcs || $wantSefrans); print "\n"; for my $d (@$domains) { my ($dc, $dn) = @$d; @@ -477,6 +481,51 @@ sub geditpopup { return $SP; } +# ---- helper edit form popup +sub feditpopup { + # prepares a list of form's templates +=pod + my @tplates; + my @tmp = glob("$WEBOBS{ROOT_CODE}/tplates/{VIEW,PROC,SEFRAN}.*"); + foreach my $t (@tmp) { + if (! -l $t) { + my @conf = readCfg($t); + next if (@conf == 1); # readCfg returns [0] if the file is empty + my %G = @conf; + $t =~ s/$WEBOBS{ROOT_CODE}\/tplates\///; + my ($gt,$gn) = split(/\./,$t); + push(@tplates,"$gt|$gn|".u2l($G{NAME})); + } + } +=cut + my $SP = ""; + $SP .= "
"; + $SP .= "
"; + $SP .= "

Create/edit a FORM

"; +=pod + $SP .= ""; + $SP .= " \n"; + $SP .= "

"; +=cut + $SP .= ""; + $SP .= " \n"; + $SP .= "

"; + + $SP .= "

"; + $SP .= ""; + $SP .= ""; + $SP .= "

"; + $SP .= "
"; + return $SP; +} + __END__ =pod diff --git a/CODE/cgi-bin/postCLB.pl b/CODE/cgi-bin/postCLB.pl index e254dbf2..8b349cd3 100755 --- a/CODE/cgi-bin/postCLB.pl +++ b/CODE/cgi-bin/postCLB.pl @@ -152,11 +152,26 @@ =head1 Query string parameters my $password = ""; my $dbh = DBI->connect($dsn, $userid, $password, { RaiseError => 1 }) or die $DBI::errstr; + + # reading the NODEName dataset row to get the producer id + my $stmt = qq(SELECT identifier FROM datasets WHERE identifier LIKE "\%$GRIDName.$NODEName"); + my $sth = $dbh->prepare( $stmt ); + my $rv = $sth->execute() or die $DBI::errstr; + + if($rv < 0) { + print $DBI::errstr; + } + + my $producerId; + + while( my @row = $sth->fetchrow_array() ) { + $producerId = (split /_/, $row[0])[0]; + } - my $station = $GRIDName.'.'.$NODEName; - my $dataset = 'OBSE_DAT_'.$GRIDName.'.'.$NODEName; - my $dataname = 'OBSE_OBS_'.$GRIDName.'.'.$NODEName.'_'.$GRID{THEIA_SELECTED_TS}.'.txt'; - my $extension= $NODEName.'_'.$GRID{THEIA_SELECTED_TS}.'.txt'; + my $station = $GRIDName.'.'.$NODEName; + my $dataset = "$producerId\_DAT_$GRIDName.$NODEName"; + my $dataname = "$producerId\_OBS_$GRIDName.$NODEName\_$GRID{THEIA_SELECTED_TS}.txt"; + my $extension = "$NODEName\_$GRID{THEIA_SELECTED_TS}.txt"; my $filepath; foreach (@donnees) { @@ -169,8 +184,8 @@ =head1 Query string parameters my $chan = $obs[2]; # observations table - my $obsid = 'OBSE_OBS_'.$GRIDName.'.'.$NODEName.'_'.$id; - my @first_date = split(/ /,$obs[0]); + my $obsid = "$producerId\_OBS_$GRIDName.$NODEName\_$id"; + my @first_date = split(/ /,$obs[0]); my $first_year = $first_date[0]; my $first_hour = $first_date[3] || "00"; my $first_minute = $first_date[4] || "00"; diff --git a/CODE/cgi-bin/postNODE.pl b/CODE/cgi-bin/postNODE.pl index 0074ae69..0bf342e2 100755 --- a/CODE/cgi-bin/postNODE.pl +++ b/CODE/cgi-bin/postNODE.pl @@ -147,9 +147,10 @@ =head1 Query string parameters } } else { htmlMsgNotOK ("Invalid NODE (".$cgi->param('node').") posted for create/update/delete") } -# ---- checking if user is a THEIA user +# ---- checking if user is a THEIA user and if he wants to save data in metadatabase # my $theiaAuth = $WEBOBS{THEIA_USER_FLAG}; +my $saveAuth = $cgi->param('saveAuth') // ''; # ---- where are the NODE's directory and NODE's conf file ? my %allNodeGrids = WebObs::Grids::listNodeGrids(node=>$NODEName); @@ -172,7 +173,7 @@ =head1 Query string parameters @lines = readFile($NODES{FILE_NODES2NODES},qr/^(?!$NODEName\|)/); saveN2N(@lines); - if ( isok($theiaAuth) ) { + if ( isok($theiaAuth) and isok($saveAuth) ) { # --- connecting to the database my $driver = "SQLite"; my $database = $WEBOBS{SQL_METADATA}; @@ -313,6 +314,7 @@ =head1 Query string parameters push(@lines,"NAME|\"".u2l($name)."\"\n"); push(@lines,"ALIAS|".u2l($alias)."\n"); push(@lines,"TYPE|".u2l($type)."\n"); +push(@lines,"DESCRIPTION|".u2l($desc)."\n"); push(@lines,"VALID|$valide\n"); push(@lines,"TZ|$tz\n"); push(@lines,"LAT_WGS84|$lat\n"); @@ -339,7 +341,7 @@ =head1 Query string parameters push(@lines,"$GRIDType.$GRIDName.ACQ_RATE|$acqr\n"); push(@lines,"$GRIDType.$GRIDName.LAST_DELAY|$ldly\n"); push(@lines,"$GRIDType.$GRIDName.CHANNEL_LIST|".join(',',@chanlist)."\n"); - push(@lines,"$GRIDType.$GRIDName.DESCRIPTION|$desc\n"); + push(@lines,"$GRIDType.$GRIDName.DESCRIPTION|".u2l($desc)."\n"); } # ---- other grid's parameters (not linked to the active grid) are transfered "as is" @@ -433,7 +435,7 @@ =head1 Query string parameters } else { htmlMsgNotOK("$geojsonfile $!") } } -if ( isok($theiaAuth) ) { +if ( isok($theiaAuth) and $saveAuth == 1 ) { # --- connecting to the database my $driver = "SQLite"; my $database = $WEBOBS{SQL_METADATA}; @@ -479,9 +481,14 @@ =head1 Query string parameters my $sth = $dbh->prepare('INSERT OR REPLACE INTO sampling_features (IDENTIFIER, NAME, GEOMETRY) VALUES (?,?,?);'); $sth->execute($alias,$alias,$point); - - $sth = $dbh->prepare('INSERT OR REPLACE INTO datasets (IDENTIFIER, TITLE, DESCRIPTION, SUBJECT, SPATIALCOVERAGE, LINEAGE) VALUES (?,?,?,?,?,?);'); - $sth->execute($id,$name,$desc,$subject,$spatialcov,$lineage); + + if ($spatialcov eq "") { + $sth = $dbh->prepare('INSERT OR REPLACE INTO datasets (IDENTIFIER, TITLE, DESCRIPTION, SUBJECT, LINEAGE) VALUES (?,?,?,?,?);'); + $sth->execute($id,$name,$desc,$subject,$lineage); + } else { + $sth = $dbh->prepare('INSERT OR REPLACE INTO datasets (IDENTIFIER, TITLE, DESCRIPTION, SUBJECT, SPATIALCOVERAGE, LINEAGE) VALUES (?,?,?,?,?,?);'); + $sth->execute($id,$name,$desc,$subject,$spatialcov,$lineage); + } $dbh->disconnect(); } diff --git a/CODE/cgi-bin/postTHEIA.pl b/CODE/cgi-bin/postTHEIA.pl index 0a4754ad..e60b1e67 100755 --- a/CODE/cgi-bin/postTHEIA.pl +++ b/CODE/cgi-bin/postTHEIA.pl @@ -227,9 +227,10 @@ sub compressTxtFiles { my $lon = $coordinates[1]; $coordinates[2] = $coordinates[2] + 0; my $alt = $coordinates[2]; + my @new_crds = ($coordinates[1],$coordinates[0]); my %geometry = ( type => (split '\(|\)', $geometry)[0], - coordinates => \@coordinates, + coordinates => \@new_crds, ); my %samplingFeature = ( name => $row[6], diff --git a/CODE/cgi-bin/showNODE.pl b/CODE/cgi-bin/showNODE.pl index 1c03954d..53c73fb5 100755 --- a/CODE/cgi-bin/showNODE.pl +++ b/CODE/cgi-bin/showNODE.pl @@ -12,6 +12,7 @@ =head1 DESCRIPTION Displays data associated to a NODE identified by its fully qualified name (node=gridtype.gridname.nodename) +Although a NODE is an independent entity, a GRID-context (the 2 high level qualifiers of the Although a NODE is an independent entity, a GRID-context (the 2 high level qualifiers of the fully qualified nodename) is required as a validation/authorization/reference information. @@ -640,7 +641,7 @@ =head1 Query string parameters print "M3G GNSS Metadata"; } #print "".join("
",$m3g_link_sitelog,$m3g_link_gml,$m3g_xml,$txt_rec,$txt_ant)."\n"; print "".join("
",$m3g_link_sitelog,$m3g_link_gml,$m3g_xml)."
\n"; - print "
Receiver history featureAntenna history feature>
".wiki2html($txt_rec)."".wiki2html($txt_ant)."
"; + print "
Receiver history featureAntenna history feature
".wiki2html($txt_rec)."".wiki2html($txt_ant)."
"; } diff --git a/CODE/cgi-bin/showTHEIA.pl b/CODE/cgi-bin/showTHEIA.pl index 9202beb6..0f33209d 100755 --- a/CODE/cgi-bin/showTHEIA.pl +++ b/CODE/cgi-bin/showTHEIA.pl @@ -192,11 +192,12 @@ =head1 DESCRIPTION my %G = readProc($GRIDName); #print $G{$GRIDName}."\n"; %GRID = %{$G{$GRIDName}}; - my @NODELIST = split / /,$GRID{THEIA_SELECTED_NODELIST}; + my @NODELIST = split /,/,$GRID{THEIA_SELECTED_NODELIST}; if ( clientHasEdit(type=>"auth".lc($GRIDType)."s",name=>"$GRIDName") || clientHasAdm(type=>"auth".lc($GRIDType)."s",name=>"$GRIDName") ){ - if ( grep(/^$NODEName$/,@NODELIST) || substr($NODEName, 1) ~~ $GRID{THEIA_SELECTED_NODELIST}) { + #if ( grep(/^$NODEName/,@NODELIST) || substr($NODEName, 1) ~~ @NODELIST) { + if ( $GRID{THEIA_SELECTED_NODELIST} =~ substr($NODEName,1) ) { my $subject = join(',', split(/_/,$row[3])); - push(@NODELIST, $NODEName); + #push(@NODELIST, $NODEName); # ---- extracting datasets contacts data my $stmt2 = qq(SELECT * FROM contacts WHERE related_id LIKE '$row[0]%';); @@ -281,10 +282,10 @@ =head1 DESCRIPTION @CHANLIST = split /,/,$NODE{"PROC.$GRIDName.CHANNEL_LIST"}; my $fileDATA = "$NODES{PATH_NODES}/$NODEName/PROC.$GRIDName.$NODEName.clb"; my @donnees = map { my @e = split /\|/; \@e; } readCfgFile($fileDATA); - my @vars = map {$donnees[$_-1]} @CHANLIST; - #print $donnees[0]; + my @vars = map {$donnees[$_-1][3]} @CHANLIST; if ( clientHasEdit(type=>"auth".lc($GRIDType)."s",name=>"$GRIDName") || clientHasAdm(type=>"auth".lc($GRIDType)."s",name=>"$GRIDName") ) { - if ( (grep(/^$NODEName$/,@NODELIST) || substr($NODEName, 1) ~~ $GRID{THEIA_SELECTED_NODELIST}) and $channelId ~~ @vars) { + #if ( grep(/^$NODEName/,@NODELIST) || substr($NODEName, 1) ~~ @NODELIST and $channelId ~~ @vars) { + if ( $GRID{THEIA_SELECTED_NODELIST} =~ substr($NODEName,1) and $channelId ~~ @vars ) { my $subject = join(',', split(/_/,$row[3])); print "" ."" diff --git a/CODE/css/listGRIDS.css b/CODE/css/listGRIDS.css index 17de3e67..dc8fb395 100644 --- a/CODE/css/listGRIDS.css +++ b/CODE/css/listGRIDS.css @@ -65,3 +65,68 @@ h2.h2gn { padding: 5px 0 5px 2px; float: left; } + +#feditovly { + display: none; + position: fixed; + top:0px; left:0px; width:100%; height:100%; + text-align:center; vertical-align:middle; + opacity: 0.4; + background-color:#000000; + z-index: 10000; +} + +#feditoverlay_form { + position: absolute; + border: 3px solid gray; + border-radius: 5px; + padding: 10px; + background: #FFFFEE; + width: 440px; + height: auto; + opacity: 1; + z-index: 10001; +} +#feditoverlay_form label{ + display:block; + font-weight:bold; + text-align:right; + width:120px; + float:left; +} +#feditoverlay_form .small{ + color: #666666; + display:block; + font-size: x-small; + font-weight: lighter; + text-align:right; + width:120px; +} +#feditoverlay_form input[type=text]{ + float:left; + padding:4px 2px; + border:solid 1px #aacfe4; + width:300px; + margin:2px 0 15px 10px; +} +#feditoverlay_form input[type=checkbox]{ + float:left; + padding:4px 2px; + /* + border:solid 1px #aacfe4; + margin:2px 0 15px 10px; + */ +} +#feditoverlay_form select{ + float:left; + padding:1px 1px; +} +#feditoverlay_form p { + background: #EAE4CE; + width: 100%; + height: 20px; + padding: 5px 0 5px 2px; + float: left; +} + +