# Copyright for the Uniform Repository Service (c) 1995 - 2021, # by Gerald Banon. All rights reserved. # Version 2.1 # mirrorrecent.tcl # created in 2021-04-30 by GJFB to resolve IBI # example: # http://gjfb:1905/resolve?languagebutton=pt-BR # http://www.urlib.net/resolve?languagebutton=pt-BR # ---------------------------------------------------------------------- # Resolve proc Resolve {} { if [catch { global currentProcedureName ;# used in LoopOverEntries global currentProcedureFileName ;# used in CreateOutput and LoopOverEntries global env global cgi global currentRep global language global homePath ;# used in CreateOutput and FindLanguage global URLibServiceRepository ;# used in MultipleSubmit (called in MultipleExecute2 called in CreateOutput) global queueLengthFlag ;# used in MultipleSubmit (called in MultipleExecute2 called in CreateOutput) global mirrorHomePageRepository ;# used in LoopOverEntries to access submission.js set col ../../../../.. set URLibServiceRepository dpi.inpe.br/banon/1998/08.02.08.56 source ../$col/$URLibServiceRepository/doc/utilities1.tcl source ../$col/$URLibServiceRepository/doc/cgi/mirrorfind-.tcl ;# ReturnHTTPHost set homePath $env(DOCUMENT_ROOT) set currentProcedureName MirrorResolve set currentProcedureFileName $homePath/col/$URLibServiceRepository/doc/cgi/MirrorResolve.tcl # localSite # set localSite $env(SERVER_NAME):$env(SERVER_PORT) set localSite [ReturnHTTPHost] # used with GET # doesn't hidden password1 and codedpassword1 if [info exists env(QUERY_STRING)] { set queryString $env(QUERY_STRING) foreach {name value} [split $queryString &=] { set cgi([DecodeURL $name]) [DecodeURL $value] } } CreateCGIArray ;# used with POST if 0 { puts {Content-Type: text/html} puts {} puts $env(QUERY_STRING) puts
puts
puts [array get cgi] } if [string equal {} $cgi(ibienter)] {set ibi $cgi(ibi)} if [string equal {} $cgi(ibi)] {set ibi $cgi(ibienter)} if ![info exists ibi] {set ibi $cgi(ibienter)} regsub {:} $ibi {/} ibi ;# added by GJFB in 2021-11-12 - ex: ibi:QABCDSTQQW/3UAK378 -> ibi/QABCDSTQQW/3UAK378 set splitID [file split $ibi] if {[llength $splitID] == 2} { # ibi puts "Location: http://$localSite/ibi/$ibi?ibiurl.backgroundlanguage=$cgi(languagebutton)" } else { set idType [lindex $splitID 0] if [catch {eval file join [lrange $splitID 1 2]} id] { puts {Content-Type: text/html} puts { Syntax Error

Syntax Error

} puts "

<$ibi> has not the right syntax.

" puts {

To resolve an IBI the syntax is <prefix/sufix> or <ibi:prefix/sufix> or <ibi/prefix/sufix>.

To resolve a DOI the syntax is <doi:prefix/sufix> or <doi/prefix/sufix>.



} return } if [string equal ibi $idType] { # ibi puts "Location: http://$localSite/ibi/$id?ibiurl.backgroundlanguage=$cgi(languagebutton)" } elseif {[string equal doi $idType]} { # doi # doi/10.1087/20110107 puts "Location: http://doi.org/$id" } } puts "" return } m] { if ![string equal {} $m] { puts {Content-Type: text/html} puts {} puts "
Resolve: $m
" if 0 {global errorInfo; puts
$errorInfo
} } } } # Resolve - end # ----------------------------------------------------------------------