# Copyright for the Uniform Repository Service (c) 1995 - 2024, # by Gerald Banon. All rights reserved. # Version 2.1 # get.tcl # Examples: if 0 { http://banon-pc3/rep/iconet.com.br/banon/2001/02.10.22.55 http://banon-pc3/rep/LK47B6W/E6H5HH http://banon-pc3/rep/dpi.inpe.br/banon/1998/08.02.08.56 http://banon-pc3/rep/dpi.inpe.br/banon/1998/08.02.08.56/post http://banon-pc3/rep/iconet.com.br/banon/2001/02.10.22.55+ http://banon-pc3/rep/LK47B6W/E6H5HH+ http://vaio:1905/rep/J8LNKB5R7W/3NGUDHH http://vaio:1905/rep/J8LNKB5R7W/3NGUDHH: http://gjfb.home:1905/rep/8JMKD3MGP3W34P/3MPQ9AE http://urlib.net/rep/8JMKD3MGPAW34P/3NERTH2 http://urlib.net/rep/J8LNKB5R7W/3CAK5T2 http://urlib.net/rep/8JMKD3MGPAW/3MGQ5S5 http://urlib.net/rep/J8LNKB5R7W/3CP2248 } # ---------------------------------------------------------------------- # Get proc Get {} { if [catch { set currentProcedureName Get global env global cgi ;# used by FindLanguage, ResolveIBI, CreatePasswordField and CheckUsernamePasswordForm global localSite ;# used in CreateResponseList, CreateMetadataTags and GetServerAddressFromHTTPHost global homePath ;# used in CreateListOfurlPropertiesFromAgencies, FindLanguage and FindSiteList global URLibServiceRepository ;# used in ReturnFullServerNameIP global loCoInRep ;# used in CreateListOfurlPropertiesFromAgencies and FormatSiteList called by FindURLPropertyList called by ReturnURLPropertyList called by ReturnURLPropertyList2 called by ResolveIBI global loBiMiRep ;# used in FindURLPropertyList called by ResolveIBI global serverAddress ;# used by SetFieldValue and GetServerAddressFromHTTPHost # global documentServerAddress ;# used in UpdateReadPermissionFromSecondaryDate global mirrorHomePageRep ;# set in FindLanguage global queueLengthFlag ;# used in MultipleSubmit (called in MultipleExecute2 called in CreateOutput) global printFlag ;# used in ReturnURLPropertyList only global selectedLanguageFromMirror languageRep1 languageRep2 ;# used in CreateResponseList only global serverAdministratorAddress ;# used in FindURLPropertyList global multipleLineReferFieldNamePattern ;# used by GetReferField (called by CreateVersionStamp called by ChangeFieldValue) global urlibServerAddress ;# used in BuildReturnPathArray only global queryString ;# used in BuildReturnPathArray only global tcl_platform global languageRep2 ;# used in CreateAdditionalRowList only global searchResultList ;# placed here by GJFB in 2021-08-31 set printFlag 0 # set printFlag 1 set redirectFlag 1 ;# added by GJFB in 2021-05-23 - useful to avoid turning the cookies used in mirrorHomePage.html third-party cookies (in this case Chrome blocks the cookies) - for example http://urlib.net/rep/6qtX3pFwXQZeBBx/pBvav (the bibliographic mirror of the sibgrapi.sid.inpe.br) must be redirected to http://sibgrapi.sid.inpe.br/rep/6qtX3pFwXQZeBBx/pBvav if !$redirectFlag { # commented by GJFB in 2021-05-23 puts {Content-Type: text/html} # puts {Content-Type: text/plain} puts {} } # puts [encoding system] encoding system $env(ENCODING_SYSTEM) ;# added by GJFB in 2023-02-03 to solve the accent problem in return path to the root after updating metadata - for some reason encoding system might be different from $env(ENCODING_SYSTEM) - for example iso8859-1 instead of utf-8 whe using m12 (noaa candeias in gjfb0520) # defaultMirrorHomePageRepository set defaultMirrorHomePageRepository dpi.inpe.br/banon/2000/01.23.20.24 # col set col ../../../../.. set URLibServiceRepository $env(URLIB_SERVICE_REP) set standaloneModeFlag $env(STANDALONE_MODE_FLAG) # set urlibServerAddressWithIP $env(URLIB_SERVER_ADDR) ;# ip and port of www.urlib.net source ../$col/$URLibServiceRepository/doc/utilities1.tcl source ../$col/$URLibServiceRepository/doc/cgi/mirrorfind-.tcl # set queueLengthFlag 1 ;# could be anything - added by GJFB in 2013-04-17 in order to detect not writable site (site that doesn't reply) # loCoInRep set loCoInRep $env(LOCOINREP) # loBiMiRep set loBiMiRep $env(LOBIMIREP) # homePath (used in FindLanguage) set homePath $env(DOCUMENT_ROOT) # localSite set localSite $env(SERVER_NAME):$env(SERVER_PORT) ;# used in the document not found warning and in syntax error # serverAddress set serverAddress [list $env(SERVER_NAME) $env(URLIB_PORT)] # serverAddressWithIP set serverAddressWithIP [list $env(IP_ADDR) $env(URLIB_PORT)] # clientServerAddressWithIP regsub -all { } $serverAddressWithIP {+} clientServerAddressWithIP # urlibServerAddress set urlibServerAddress $env(URLIB_SERVER_ADDR) ;# www.urlib.net and port # serverAdministratorAddress set serverAdministratorAddress $env(SERVER_ADMIN) ## resolverIndexRepository # set resolverIndexRepository $env(RESOLVER_INDEX_REPOSITORY) # resolverMirrorRepository set resolverMirrorRepository $env(RESOLVER_MIRROR_REPOSITORY) # currentProcedureFileName (for reverse engineering only) set currentProcedureFileName $homePath/col/$URLibServiceRepository/doc/cgi/get.tcl # pathInfo if [info exists env(PATH_INFO)] { set pathInfo $env(PATH_INFO) } else { set pathInfo / } set pathInfo [string trim $pathInfo] ;# added by GJFB in 2011-05-03 - some paths may contain trailing blanks that are interpreted further as / # splitedPathInfo set splitedPathInfo [file split $pathInfo] # frameName set frameName [lindex $splitedPathInfo 1] # puts --$env(QUERY_STRING)-- # queryString ConditionalSet queryString env(QUERY_STRING) {} set queryString [EscapeUntrustedData $queryString] if ![string equal {} $queryString] { # bodylink is used in Submit (see cgi/submit.tcl) if [regexp {(bodylink)=(.*)$} $queryString m name value] { set cgi($name) [DecodeURL $value] } # puts $cgi(bodylink) regsub {&?bodylink=.*$} $queryString {} queryString2 # ? is alias for verb=GetMetadata regsub {^\?} $queryString2 {} queryString2 foreach {name value} [split $queryString2 &=] { if [regexp {^(Return|Header|AdvancedUserHeader)$} $frameName] { set cgi([DecodeURL $name]) [DecodeURL $value] } else { # Warning1 and Warning2 if [string equal {title} $name] { # set cgi($name) [DecodeURL $value] ;# commented by GJFB in 2023-02-25 set cgi($name) [encoding convertfrom utf-8 [DecodeURL $value]] ;# added by GJFB in 2023-02-25 - solves the accent problem - ex: Relevés -> Relevés (id J8LNKB5R7W/3LRBP4E in gjfb:1905) } else { set cgi($name) $value ;# added by GJFB in 2021-08-19 - srcbody value must not be decoded (must be preserve coded like in: srcbody=gjfb:1905/col/iconet.com.br/banon/2001/03.15.10.39/doc/RELAT%d4RIO%20FINAL%20.txt) } } } } if 0 { puts {Content-Type: text/html} puts {} puts [array names cgi] # => srcbody title puts [array get cgi] # puts [encoding system] # puts [encoding convertfrom utf-8 $cgi(title)] } if 0 { # commented by GJFB in 2014-04-23 - choice is conflicting when displaying metadata # choice - useful for adding searchSiteName when choice is not brief ConditionalSet choice cgi(choice) {} } # > mirror # requiredmirror=sid.inpe.br/mtc-m21b/2013/09.26.14.25.22 ConditionalSet mirror cgi(requiredmirror) $loBiMiRep ;# used in this procedure only # > searchSite - useful for searching from header # searchsite=bibdigital.sid.inpe.br:80 ConditionalSet searchSite cgi(searchsite) $localSite ;# without this line and localsite attribute, www.urlib.net gets a 100% cpu - searchSite value might be changed below for Archival Unit # > searchMirror - useful for searching from header # searchmirror=sid.inpe.br/bibdigital@80/2006/04.07.15.50.13 ConditionalSet searchMirror cgi(searchmirror) $mirror ;# searchMirror value might be changed below for Archival Unit and Misc regsub {\..*(:.*)} $searchSite {\1} searchSiteName ;# bibdigital.sid.inpe.br:80 -> bibdigital:80 - used in mirror/xxCover.tcl if [info exists cgi(submissionformrep)] { set selectedLanguageFromMirror $cgi(selectedlanguagefrommirror) set languageRep1 $cgi(languagerep1) ;# used in $Header set languageRep2 $cgi(languagerep2) set submissionFormRep $cgi(submissionformrep) } else { # Find the language and the language repository # use the same languages as the ones used for the local bibliographic mirror foreach {selectedLanguageFromMirror languageRep1 languageRep2 firstLanguageRep \ submissionFormRep submissionFormLanguage submissionFormLanguageRep} \ [FindLanguage $mirror] {break} # puts $selectedLanguageFromMirror # Find the language and the language repository - end } # filePath (for reverse engineering only) if [file exists $homePath/col/$languageRep1/doc/mirror/${selectedLanguageFromMirror}Cover.tcl] { set filePath $languageRep1/doc/mirror/${selectedLanguageFromMirror}Cover.tcl } else { set filePath $languageRep2/doc/mirror/${selectedLanguageFromMirror}Cover.tcl } if 0 { # doesn't work when opening sid.inpe.br/mtc-m15@80/2006/12.06.11.48 (located at mtc-m15) # see new code below within the switch # set convertToUTF8 [expr [regexp {Apache/2} $env(SERVER_SOFTWARE)] || [string equal {utf-8} $env(ENCODING_SYSTEM)]] ;# solves the accent problem - same code is used in xxDocContent.html set convertToUTF8 1 ;# solves the accent problem } # set oldCode 1 ;# still work unless the access to the URLibService of the Archive which have the identified item is not fully permitted # ex: http://gjfb.home:1905/rep/8JMKD3MGP3W34P/3MPQ9AE doesn't work because m21b has the port 804 not fullly open set oldCode 0 ;# new code - added by GJFB in 2017-03-19 - with this code http://gjfb.home:1905/rep/8JMKD3MGP3W34P/3MPQ9AE works because there is no need for gjfb.home:1905 to access directly m21b - this is done indirectly via urlib.net if $oldCode { # commented by GJFB in 2017-03-19 } else { # added by GJFB in 2017-03-19 # set fieldNameList1 {title targetfile referencetype fullname contenttype username} set fieldNameList1 {title targetfile referencetype booktitle fullname contenttype username} # set fieldNameList2 {metadatarepository identifier referencetype size targetfile language readpermission contenttype copyright rightsholder doi nextedition previousedition issn nexthigherunit mirrorrepository parameterlist} # set fieldNameList2 {metadatarepository identifier referencetype booktitle size targetfile language readpermission contenttype copyright rightsholder doi nextedition previousedition issn nexthigherunit mirrorrepository parameterlist} ;# commented by GJFB in 2021-06-09 # set fieldNameList2 {metadatarepository identifier referencetype booktitle size targetfile language readpermission readergroup contenttype copyright rightsholder doi nextedition previousedition issn nexthigherunit mirrorrepository parameterlist} ;# added by GJFB in 2021-06-09 - readergroup - commented by GJFB in 2022-05-09 # set fieldNameList2 {metadatarepository identifier referencetype booktitle size targetfile language readpermission readergroup contenttype copyright rightsholder doi nextedition previousedition issn nexthigherunit mirrorrepository parameterlist versiontype} ;# added by GJFB in 2022-05-09 - versiontype - commented by GJFB in 2022-06-13 # DEFINITION >>> parentidentifiercitedby stands for 'the current information item identifier is cited by' - from 2023-03-10 parentidentifiercitedby can be a list of identifiers - see example of list in localIndexInOnePage # set fieldNameList2 {metadatarepository identifier referencetype booktitle size targetfile language readpermission readergroup contenttype copyright rightsholder doi nextedition previousedition issn nexthigherunit mirrorrepository parameterlist versiontype searchinputvalue parentidentifiercitedby forcerecentflag} ;# added by GJFB in 2022-06-13 - searchinputvalue parentidentifiercitedby forcerecentflag - commented by GJFB in 2022-12-02 # set fieldNameList2 {metadatarepository identifier referencetype booktitle size targetfile language readpermission readergroup contenttype copyright rightsholder doi nextedition previousedition issn nexthigherunit mirrorrepository parameterlist versiontype searchinputvalue parentidentifiercitedby forcerecentflag forcehistorybackflag} ;# added by GJFB in 2022-12-02 - searchinputvalue parentidentifiercitedby forcerecentflag forcehistorybackflag - commented by GJFB in 2024-01-02 set fieldNameList2 {metadatarepository identifier referencetype booktitle size targetfile language readpermission readergroup contenttype copyright rightsholder doi nextedition previousedition issn nexthigherunit mirrorrepository parameterlist versiontype searchinputvalue parentidentifiercitedby forcerecentflag forcehistorybackflag shortmenu} ;# added by GJFB in 2024-01-02 - searchinputvalue parentidentifiercitedby forcerecentflag forcehistorybackflag shortmenu set fieldNameList3 {repository metadatarepository metadatalastupdate nexthigherunit shorttitle} set fieldNameList4 {nexthigherunit shorttitle} set fieldNameListAll [lsort -unique [concat $fieldNameList1 $fieldNameList2 $fieldNameList3]] } if 0 { puts {Content-Type: text/html} puts {} # puts --$frameName-- } # if ![regexp {\.} $frameName] # ;# commented by GJFB in 2021-05-24 if [regexp {^(Return|Header|AdvancedUserHeader|Warning1|Warning2)$} $frameName] { ;# added by GJFB in 2021-05-24 # not the domain name of a repository name neither the prefix of an IBIp or IBIn # Return, Header, AdvancedUserHeader, Warning1 and Warning2 if $redirectFlag { # added by GJFB in 2021-05-23 puts {Content-Type: text/html} puts {} } } if [regexp {^(Return|Header|AdvancedUserHeader)$} $frameName] { ;# added by GJFB in 2021-05-24 # not the domain name of a repository name neither the prefix of an IBIp or IBIn # Return, Header and AdvancedUserHeader ## dropped $ in VALUE="$cgi(converttoutf8) by GJFB in 2018-12-26 - this attribute is no more needed # added $ by GJFB in 2022-02-03 set hiddenInputs { } if $oldCode { # commented by GJFB in 2017-03-19 append hiddenInputs {\n} append hiddenInputs {\n} } else { # added by GJFB in 2017-03-19 # username must not be part of hiddenInputs, the hidden input username aready exists and cannot be duplicated foreach item $fieldNameListAll { append hiddenInputs "\n" } } } # searchSiteIdentifier - used in xxCover.tcl if 0 { # commented by GJFB in 2023-03-04 package require http if [catch {http::geturl [ConvertURLToHexadecimal http://$searchSite/@loBiMiId]} token] { set searchSiteIdentifier {} } else { if [string equal {404} [::http::ncode $token]] { set searchSiteIdentifier {} } else { set searchSiteIdentifier [string trim [http::data $token]] } http::cleanup $token } } else { # added by GJFB in 2023-03-04 for the sake of simplicity set searchSiteIdentifier [FindIdentifierNameFromIBI $loBiMiRep] ;# added by GJFB in 2022-06-13 } # puts --$searchSiteIdentifier-- # set termsOfUse {} switch -regexp -- $frameName { {Header|AdvancedUserHeader} { set headerType $frameName # puts "1 - [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]" # puts [array get cgi] # puts $env(PATH_INFO) # => /iconet.com.br/banon/2001/02.10.22.55/post # puts ../$col/$languageRep2/doc/mirror/${selectedLanguageFromMirror}SearchResult.tcl ConditionalSet queryValue cgi(query) {} ConditionalSet userName cgi(username) {} ConditionalSet codedPassword1 cgi(codedpassword1) {} source ../$col/$languageRep2/doc/mirror/${selectedLanguageFromMirror}SearchResult.tcl ;# access the files that comprise the document source ../$col/$languageRep2/doc/mirror/${selectedLanguageFromMirror}Cover.tcl ;# Header, wrong password, ... global "${languageRep2}::Header" ;# uses languageRep1 global "${languageRep2}::unknown username" global "${languageRep2}::empty password" global "${languageRep2}::wrong password" global "${languageRep2}::the original author" global "translationTable" ;# set in mirror/xxSearchResult.tcl and in mirror/xxCover.tcl global "Update" # currentRep (the repository of the current ibi) set currentRep $cgi(currentrep) # textLanguage ConditionalSet textLanguage cgi(textlanguage) {} # puts --$textLanguage-- # documentServerAddress set documentServerAddress $cgi(documentserveraddress) # puts --$documentServerAddress-- # waitForCompletionFlag set waitForCompletionFlag $cgi(waitforcompletionflag) # agencyStructureFlag set agencyStructureFlag $cgi(agencystructureflag) # progressKey ConditionalSet progressKey cgi(progresskey) {} # searchInputValue ConditionalSet searchInputValue cgi(searchinputvalue) {} ;# added by GJFB in 2022-06-13 - value is a search expression # parentIdentifierCitedBy ConditionalSet parentIdentifierCitedBy cgi(parentidentifiercitedby) {} ;# added by GJFB in 2022-06-13 set parentIdentifierCitedBy1 [lindex $parentIdentifierCitedBy 0] ;# added by GJFB in 2023-03-10 - now parentIdentifierCitedBy can be a list - see example of list in localIndexInOnePage.html - used when linkType is 1 and targetValue is _top set parentIdentifierCitedBy2 [lrange $parentIdentifierCitedBy 1 end] ;# added by GJFB in 2023-03-10 - now parentIdentifierCitedBy can be a list - see example of list in localIndexInOnePage.html - used when linkType is 1 and targetValue is _top # forceRecentFlag ConditionalSet forceRecentFlag cgi(forcerecentflag) 0 ;# added by GJFB in 2022-06-13 - used in the mirror home page file - value is 0 (default) or 1 (means to force 'The Most Recent' display) # forcehistorybackflag ConditionalSet forceHistoryBackFlag cgi(forcehistorybackflag) 1 ;# added by GJFB in 2023-06-09 used in 'Guia do administrador' (8JMKD3MGP5W34M/3FU99GE) - value is 0 or 1 (default - means to force the display of the 'history.back' arrow) # shortMenu ConditionalSet shortMenu cgi(shortmenu) {} ;# added by GJFB in 2024-01-02 if 0 { puts {Content-Type: text/html} puts {} puts $searchInputValue puts $parentIdentifierCitedBy puts $forceRecentFlag } # SET FIELD VALUES if $oldCode { # commented by GJFB in 2017-03-19 - doesn't work with http://gjfb.home:1905/rep/8JMKD3MGP3W34P/3MPQ9AE because m21b has the port 804 closed for the rest of the world # SetFieldValue $documentServerAddress $cgi(metadatarepository)-0 {identifier referencetype size username targetfile language readpermission contenttype copyright rightsholder doi nextedition previousedition issn nexthigherunit} SetFieldValue $documentServerAddress $cgi(metadatarepository)-0 {identifier referencetype size targetfile language readpermission contenttype copyright rightsholder doi nextedition previousedition issn nexthigherunit mirrorrepository parameterlist} } else { # added by GJFB in 2017-03-19 # set fieldNameList2 {metadatarepository identifier referencetype size username targetfile language readpermission contenttype copyright rightsholder doi nextedition previousedition issn nexthigherunit mirrorrepository parameterlist} set pairList {} foreach item2 $fieldNameList2 { set $item2 $cgi($item2) } } # puts --$identifier-- if [string equal {} $cgi(file)] { set currentTargetFile $targetfile ;# use the default target file } else { set currentTargetFile $cgi(file) } if 0 { # old code # commented by GJFB in 2013-09-21 # the target file may have changed (when cgi(turnattachedfiletargetfile) has been set to yes) regsub {([^/]+/[^/]+/\d{4,}/[^/]+/doc/).*\?} $cgi(bodylink) \\1$targetfile? bodyLink # puts $bodyLink # bodyLink2 regsub -all { } $bodyLink {} bodyLink2 ;# Archival Unit -> ArchivalUnit - added by GJFB in 2013-09-11 - when cgi(bodylink) contains a blank (e.g., Archival Unit) it will be traited as a check box type entry value by MakeCGIArray (see JoinCGIEntries) in Submit (see cgi/submit.tcl) # => http://banon-pc3/displaydoccontent.cgi/urlib.net/www/2013/06.21.00.03?displaytype=ArchivalUnit&metadatarepository=urlib.net/www/2013/06.21.00.03.30&languagebutton=pt-BR set bodyLink2 [join [ConvertURLToHexadecimal $bodyLink2 $cgi(converttoutf8)]] # puts $bodyLink2 # bodyLink3 if [regexp {Archival Unit|Resume} $referencetype] { set bodyLink3 $bodyLink2&updatebodyflag=1 ;# used in DisplayDocContent when returning to the document after a Run } else { set bodyLink3 $bodyLink2 } } else { # added by GJFB in 2013-09-21 - the code above can now be simplified since bodyLink is just $site/$currentRep (or $site/$currentRep/$file ...) set bodyLink $cgi(bodylink) ;# ex: Petiçao de Depósito_Imagens Radográficas_BR102013008118-3.pdf # regsub -all { } $cgi(bodylink) {+} bodyLink # set bodyLink2 $cgi(bodylink) # set bodyLink2 [join [ConvertURLToHexadecimal $cgi(bodylink) $cgi(converttoutf8)]] # set bodyLink2 [ConvertURLToHexadecimal $cgi(bodylink) $cgi(converttoutf8)] ;# added by GJFB - bodyLink2 must be coded otherwise the refresh button doesn´t work when the URL contains accents - commented by GJFB in 2018-12-26 otherwise the button Hide, Refresh and Run in the menu bar of http://md-m09.sid.inpe.br/rep/sid.inpe.br/md-m09/2013/07.04.14.29 don't work because of an accent problem # set bodyLink2 [ConvertURLToHexadecimal $cgi(bodylink)] ;# added by GJFB in 2018-12-26 - bodyLink2 must not be converted to utf-8 - wrong - commented by GJFB in 2022-02-03 set bodyLink2 [ConvertURLToHexadecimal $cgi(bodylink) $cgi(converttoutf8)] ;# added by GJFB in 2022-02-03 - bodyLink2 must be coded otherwise the Hide, Refresh and Run buttons don´t work when the URL contains accents (accent problem) - for exemple with the Run button at http://urlib.net/ibi/J8LNKB5R7W/3AELQS5 or at http://md-m09.sid.inpe.br/rep/sid.inpe.br/md-m09/2013/07.04.14.29 # puts $bodyLink2 # bodyLink3 if [regexp {Archival Unit|Resume} $referencetype] { if [regexp {\?} $bodyLink2] { set bodyLink3 $bodyLink2&updatebodyflag=1 } else { set bodyLink3 $bodyLink2?updatebodyflag=1 } } else { set bodyLink3 $bodyLink2 } } # targetFileExtension set targetFileExtension [file extension $targetfile] # inputTitle1 set inputTitle1 {see the return path up to the root} # inputTitle2 set inputTitle2 {click once to see return path to root - twice to return to the previous page} ;# added vy GJFB in 2022-06-13 # site (document site) set site [ReturnHTTPHost $documentServerAddress] # documentServerIP # puts "1.1 - [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]" # set documentServerIP [lindex [ReturnFullServerNameIP [lindex $documentServerAddress 0]] end] ;# used in mirror/xxCover.tcl and in this procedure - commented by GJFB in 2019-04-02 set pingFlag 0 ;# added by GJFB in 2019-04-02 to disable ping when this script (Get) is run under unix - when this script (Get) is run by urlib.net and the document server address is at 150.163, this is necessary because there exists a firewall in between at INPE # puts --$documentServerAddress-- # => --vaio 19050-- set documentServerIP [lindex [ReturnFullServerNameIP [lindex $documentServerAddress 0] $pingFlag] end] ;# used in mirror/xxCover.tcl and in this procedure - added by GJFB in 2019-04-02 # puts --$documentServerIP-- # => --192.168.15.13-- # puts "1.2 - [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]" # resolverSite # if !$standaloneModeFlag # ;# commented by BGFB in 2021-11-27 foreach {localServerName urlibPort} [ReturnCommunicationAddress $serverAddress] {break} ;# added by BGFB in 2021-11-27 # >>> here it is assumed that the complete host name without domain doesn't contain any periods (.) set domainNameFlag [regexp {\.} $localServerName] ;# 1 means that the local collection has a domain name # used only with the next and previous edition green buttons if $domainNameFlag { ;# added by BGFB in 2021-11-27 set resolverSite [ReturnHTTPHost $urlibServerAddress] } else { set resolverSite $localSite } # documentMirrorRep if 0 { # commented by GJFB in 2022-02-12 - mirrorrepository is irrelevant for search purpose, it is used preliminary to open the right form # puts --$mirrorrepository-- # set mirrorMetadataRep [FindMetadataRepositories [list repository, $mirrorrepository] 0 [list $documentServerAddress]] ;# mirrorrepository visibility must be shown if [string equal {} $mirrorrepository] { set documentMirrorRep [Execute $documentServerAddress [list ReturnLoBiMiRep]] } else { set mirrorMetadataRep [Execute $documentServerAddress [list FindMetadataRep $mirrorrepository]] # puts --$mirrorMetadataRep-- if [string equal {} $mirrorMetadataRep] { # mirrorrepository doesn´t exist in the document collection set documentMirrorRep [Execute $documentServerAddress [list ReturnLoBiMiRep]] } else { # mirrorrepository exists in the document collection set documentMirrorRep $mirrorrepository } } } else { set documentMirrorRep [Execute $documentServerAddress [list ReturnLoBiMiRep]] } # set documentState [Execute $documentServerAddress [list GetDocumentState $currentRep]] ;# not in use in mirror/xxCover.tcl # set searchSite $site ;# use site instead - the search site should not be the resolver site, it must be the site of the archival unit (for example bibdigital.sid.inpe.br and not www.urlib.net) otherwise the search may not refer to the archival unit content - commented by GJFB in 2022-08-20 set searchSite2 $site ;# use site instead - the search site should not be the resolver site, it must be the site of the archival unit (for example bibdigital.sid.inpe.br and not www.urlib.net) otherwise the search may not refer to the archival unit content - added by GJFB in 2022-08-20 - searchSite value must be preserved - placed here by GJFB in 2024-01-10 to be used borth by AdvancedUserHeader and UserHeader # set searchMirror $documentMirrorRep ;# use documentMirrorRep instead - the search mirror should not depend on the mirror of the resolver site, it must depend on the site of the archival unit (for example bibdigital.sid.inpe.br and not www.urlib.net) otherwise the search may not refer to the archival unit content - commented by GJFB in 2022-08-20 set searchMirror2 $documentMirrorRep ;# use documentMirrorRep instead - the search mirror should not depend on the mirror of the resolver site, it must depend on the site of the archival unit (for example bibdigital.sid.inpe.br and not www.urlib.net) otherwise the search may not refer to the archival unit content - added by GJFB in 2022-08-20 - searchMirror value must be preserved - placed here by GJFB in 2024-01-10 to be used borth by AdvancedUserHeader and UserHeader if [string equal {AdvancedUserHeader} $frameName] { # AdvancedUserHeader # Check password if [string equal {Tcl Page} $contenttype] { set jqueryCode " \$(document).ready(function() { \$.PeriodicalUpdater('http://$site/col/$currentRep/doc/@progress.txt', { maxTimeout: 4000 }, function(data) { \$('#progress').text(data); }); }) " } elseif {[string equal {Archival Unit} $referencetype]} { set jqueryCode " \$(document).ready(function() { \$.PeriodicalUpdater('http://$site/getprogress?repository=$currentRep', { maxTimeout: 4000 }, function(data) { \$('#progress').text(data); }); }) " } else { set jqueryCode {} } set targetFileType [string trimleft $targetFileExtension .] # puts --$documentServerIP-- # puts --$documentServerAddress-- if [string equal {} $documentServerIP] { # standalone or LAN mode or nslookup fails or ping fails in ReturnFullServerNameIP # use domain name instead set documentServerIP [lindex $documentServerAddress 0] ;# no IP, use the host name } set documentServerPort [lindex $documentServerAddress end] set serverAddressWithIP [list $documentServerIP $documentServerPort] ;# used in CheckUsernamePasswordForm # puts --$serverAddressWithIP-- set numberOfRecords $cgi(numberofrecords) set digitalStorageIndicator $cgi(digitalstorageindicator) set message [CheckUsernamePasswordForm] if [string equal {} $message] { set termsOfUse {} set simplifiedRightsholder {} } else { set termsOfUse $cgi(termsofuse) set simplifiedRightsholder $cgi(simplifiedrightsholder) set frameName {Header} } # display check box for the File Name field source ../$col/$languageRep2/doc/mirror/${selectedLanguageFromMirror}Submit.tcl ;# {turn the attached file, the target file} global "${languageRep2}::turn the attached file, the target file" # if [string equal {Electronic Source} $referencetype] # # commented by GJFB in 2023-05-29 to avoid undue target file changes (for example, in the case of enIndex.html) if {[string equal {Electronic Source} $referencetype] || [regexp {.(Index.html|FillingInstructions.tcl)$} $targetfile]} { ;# added by GJFB in 2023-05-29 set chekBoxCode { ❘ } } else { # set chekBoxCode " " set chekBoxCode "  ❘ " } ConditionalSet searchExpression parameterArray(searchexpression) "nexthigherunit, $identifier" ;# added by GJFB in 2015-06-21 - otherwise can't read "searchExpression": no such variable (with wrong password) ConditionalSet choice parameterArray(choice) briefTitleAuthorMisc ;# added by GJFB in 2015-06-21 - otherwise can't read "choice": no such variable (with wrong password) ConditionalSet outputFormat parameterArray(outputformat) ref-year-cite ;# added by GJFB in 2015-06-21 - otherwise can't read "outputFormat": no such variable (with wrong password) # Check password - end } else { # Header # puts "2 - [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]" array set parameterArray $parameterlist set jqueryCode {} set message {} # array set creativeCommonsRepositoryArray {urlib.net/www/2012/11.12.15.19 {CC BY-NC-ND} urlib.net/www/2012/11.12.15.15 {CC BY-NC-SA} urlib.net/www/2012/11.12.15.10 {CC BY-NC} urlib.net/www/2012/11.12.15.03 {CC BY-ND} urlib.net/www/2012/11.12.14.48 {CC BY-SA} urlib.net/www/2012/11.12.14.05 {CC BY} urlib.net/www/2012/11.12.20.35 CC0} ;# used in mirror/xxCover.tcl - commented by GJFB in 2023-12-12 array set creativeCommonsRepositoryArray {urlib.net/www/2012/11.12.15.19 {CC BY-NC-ND 3.0} urlib.net/www/2023/12.20.03.49 {CC BY-NC-ND 4.0} urlib.net/www/2012/11.12.15.15 {CC BY-NC-SA 3.0} urlib.net/www/2023/12.20.03.47 {CC BY-NC-SA 4.0} urlib.net/www/2012/11.12.15.10 {CC BY-NC 3.0} urlib.net/www/2023/12.20.03.45 {CC BY-NC 4.0} urlib.net/www/2012/11.12.15.03 {CC BY-ND 3.0} urlib.net/www/2023/12.20.03.39 {CC BY-ND 4.0} urlib.net/www/2012/11.12.14.48 {CC BY-SA 3.0} urlib.net/www/2023/12.20.03.32 {CC BY-SA 4.0} urlib.net/www/2012/11.12.14.05 {CC BY 3.0} urlib.net/www/2023/12.12.20.50 {CC BY 4.0} urlib.net/www/2012/11.12.20.35 CC0} ;# used in mirror/xxCover.tcl - added by GJFB in 2023-12-12 if {[string equal {Journal Article} $referencetype] && ![string equal {} $size]} { if $standaloneModeFlag { # in standalone mode set useURLibServerFlag 0 } else { set useURLibServerFlag 1 ;# avoid waiting for nonexisting repository in the local scope } set repositoryName dpi.inpe.br/banon-pc3/2011/03.14.15.45 ;# contains the file year=_issn_termsofuse.tcl set tclFileName year=_issn_termsofuse.tcl ;# file defining the terms of use of the journal having issn # puts OK # puts "$repositoryName $tclFileName $useURLibServerFlag" # => # dpi.inpe.br/banon-pc3/2011/03.14.15.45 year=_issn_termsofuse.tcl 1 # puts "" ;# to have the above puts displayed at once catch {SetAttributeTable $repositoryName $tclFileName $useURLibServerFlag} m ;# set attributeTable using the Source procedure - the Source procedure was updated by GJFB in 2018-02-12 to turn around a long time-out of http::geturl when a firewall is set up # puts --$m-- # puts OK2 # puts "" ;# to have the above puts displayed at once } ConditionalSet termsOfUse attributeTable(year=,issn,termsofuse,[lindex $issn 0]) {} # puts --$termsOfUse-- set simplifiedRightsholder {} # if [info exists creativeCommonsRepositoryArray($copyright)] # if ![string equal {} $rightsholder] { array set rightsholderArray $rightsholder if {[info exists rightsholderArray(originalauthor)] && [string equal {yes} $rightsholderArray(originalauthor)]} { # yes set simplifiedRightsholder ${the original author} } else { # no if [info exists rightsholderArray(name)] { set simplifiedRightsholder $rightsholderArray(name) } } } # # # puts $referencetype if {0 && [regexp {^(Archival Unit|Misc)$} $referencetype]} { ;# commented by GJFB in 2024-01-10 - now searchSite2 and searchMirror2 are defined above to be used also with AdvancedUserHeader, otherwise one gets the erro: can't read "searchSite2": no such variable, when the password field is empty and the + button is pressed # site is obtained from documentserveraddress which is obtained from urlPropertyArray(archiveaddress) # set searchSite $site ;# use site instead - the search site should not be the resolver site, it must be the site of the archival unit (for example bibdigital.sid.inpe.br and not www.urlib.net) otherwise the search may not refer to the archival unit content - commented by GJFB in 2022-08-20 set searchSite2 $site ;# use site instead - the search site should not be the resolver site, it must be the site of the archival unit (for example bibdigital.sid.inpe.br and not www.urlib.net) otherwise the search may not refer to the archival unit content - added by GJFB in 2022-08-20 - searchSite value must be preserved # set searchMirror $documentMirrorRep ;# use documentMirrorRep instead - the search mirror should not depend on the mirror of the resolver site, it must depend on the site of the archival unit (for example bibdigital.sid.inpe.br and not www.urlib.net) otherwise the search may not refer to the archival unit content - commented by GJFB in 2022-08-20 set searchMirror2 $documentMirrorRep ;# use documentMirrorRep instead - the search mirror should not depend on the mirror of the resolver site, it must depend on the site of the archival unit (for example bibdigital.sid.inpe.br and not www.urlib.net) otherwise the search may not refer to the archival unit content - added by GJFB in 2022-08-20 - searchMirror value must be preserved } elseif {[regexp {^(Conference Proceedings)$} $referencetype]} { set siteList [FindSiteList $documentMirrorRep $site $documentServerAddress] if [string equal {} $identifier] { set numberOfSupplementaryMaterial 0 ;# added by GJFB in 2021-09-12 - when an old record doesn't yet have an identifier, the search expression "nexthigherunit" might return a non-empty result } else { set searchExpression "nexthigherunit $identifier" set query [list list GetMetadataRepositories {} 0 $searchExpression yes yes 1] set searchResultList {} MultipleSubmit {} $query searchResultList 0 $siteList ;# level == 1 set numberOfSupplementaryMaterial [llength [lsort -unique $searchResultList]] } # puts $numberOfSupplementaryMaterial } ConditionalSet searchExpression parameterArray(searchexpression) "nexthigherunit, $identifier" ConditionalSet choice parameterArray(choice) briefTitleAuthorMisc ConditionalSet outputFormat parameterArray(outputformat) ref-year-cite # puts --$searchExpression-- if [info exists cgi(numberofrecords)] { set numberOfRecords $cgi(numberofrecords) set digitalStorageIndicator $cgi(digitalstorageindicator) } else { # puts "3 - [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]" # Compute numberOfRecords if {[info exists parameterArray(searchexpression)] || [string equal {Archival Unit} $referencetype]} { set currentRep2 $currentRep ;# preserve currentRep # set currentRep $searchMirror ;# used MultipleSubmit - commented by GJFB in 2022-08-20 set currentRep $searchMirror2 ;# used MultipleSubmit - added by GJFB in 2022-08-20 if 0 { # old code - excludes copies # set query [list list GetMetadataRepositories {} 5 "nexthigherunit, $identifier" yes yes 1] set query [list list GetMetadataRepositories {} 5 "nexthigherunit, $identifier and hostcollection, *" yes yes 1] global searchResultList set searchResultList {} MultipleSubmit {} $query searchResultList 0 ;# level == 1 set numberOfRecords 0 foreach i $searchResultList {incr numberOfRecords $i} } else { # new code - counts original and copies # puts [file isdirectory $homePath/col/$documentMirrorRep] if ![info exists siteList] {set siteList [FindSiteList $documentMirrorRep $site $documentServerAddress]} # global searchResultList ;# removed by GJFB in 2021-08-31 # puts --$siteList-- set query [list list GetMetadataRepositories {} 0 $searchExpression yes yes 1] # puts $query set searchResultList {} MultipleSubmit {} $query searchResultList 0 $siteList ;# level == 1 set numberOfRecords [llength [lsort -unique $searchResultList]] set query [list list GetMetadataRepositories {} 0 "$searchExpression and size *" yes yes 1] set searchResultList {} MultipleSubmit {} $query searchResultList 0 $siteList ;# level == 1 set numberOfFullText [llength [lsort -unique $searchResultList]] if {$numberOfRecords > 0} { set digitalStorageIndicator [expr 100 * $numberOfFullText / $numberOfRecords]% } else { set digitalStorageIndicator - ;# undefined } } set currentRep $currentRep2 ;# restore currentRep } else { set numberOfRecords 0 ;# added by GJFB in 2022-06-16 - Misc reference type (ex: Tcl Page for Author Index) only displays the number of information itens and the search field if the parameterlist field contains a search expression (ex: id 3ERPFQRT3W/38BF6CH) set digitalStorageIndicator - } # Compute numberOfRecords - end # puts "4 - [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]" } # puts $numberOfRecords } ;# specific Header - end # window regsub -all {/} ${mirror}___$cgi(metadatarepository) {__} window regsub -all {\.|@|-} $window {_} window set window ${window}___0 if [string equal {} $identifier] { if [catch {ConvertFromRepository [string tolower $currentRep]} identifier] { # identifier syntax error # currentRep == cptec.inpe.br/adm_conf/2005/10.31.12.09 (ICSHMO) # can't read "inverseDigitArray(_)": no such element in array set identifier {} ;# added by GJFB in 2010-12-27 } } # identifier is just used to display the IBI (ibip or ibin) # noAccessRestrictionFlag set noAccessRestrictionFlag [ComputeAccessRestrictionFlag $readpermission $env(REMOTE_ADDR)] ;# used in mirror/xxCover.tcl array set bookTitleXreferenceTypeArray { Abstracts {Conference Abstract} Resumos {Conference Abstract} Abstracts/Posters {Conference Abstract/Poster} Resumos/Pôsteres {Conference Abstract/Poster} {Extended Abstracts} {Conference Extended Abstract} {Resumos Extendidos} {Conference Extended Abstract} Posters {Conference Poster} Pôsteres {Conference Poster} Videos {Conference Video} Vídeos {Conference Video} } # puts $referencetype if [regexp {^(Conference Proceedings|Audiovisual Material)$} $referencetype] { if [string equal {} $booktitle)] { set value $translationTable($referencetype) } else { if [info exists bookTitleXreferenceTypeArray($booktitle)] { set value $translationTable($bookTitleXreferenceTypeArray($booktitle)) } else { set value $translationTable($referencetype) } } } else { set value $translationTable($referencetype) } # referenceType (used in mirror/xxCover.tcl) # regsub -all { } $translationTable($referencetype) {\ } referenceType ;# commented by GJFB in 2021-01-17 regsub -all { } $value {\ } referenceType ;# added by GJFB in 2021-01-17 # referenceType2 regsub -all { } $referencetype {+} referenceType2 set linkForHide http://$bodyLink2 # documentserverAddress2 regsub { +} $documentServerAddress {+} documentServerAddress2 # howToCite # puts http://$site/$cgi(metadatarepository)?ibiurl.language=$selectedLanguageFromMirror&ibiurl.metadataformat=BibINPE # => http://gjfb/iconet.com.br/banon/2006/10.21.11.08.17?ibiurl.language=pt-BR&ibiurl.metadataformat=BibINPE # http://gjfb/col/iconet.com.br/banon/2006/10.21.11.08.17/doc/metadata.cgi?choice=fullBibINPE if {[info exists env(BIBINPE_REP)] && [regexp {^(Journal Article|Book|Book Section|Edited Book|Newspaper|Newspaper Article|Conference Proceedings|Thesis|Report|Electronic Source|Audiovisual Material|Film or Broadcast|Misc|Archival Unit|Administrative Document)$} $referencetype]} { regsub -all { } $translationTable(How to cite?) {\ } anchor # set howToCite "$anchor" # set howToCite "$anchor" # set howToCite "$anchor" # set howToCite "$anchor" ;# ibiurl.language is alias for languagebutton # set howToCite "$anchor" ;# ibiurl.language is alias for languagebutton # set howToCite "$anchor" ;# ibiurl.language is alias for languagebutton # set howToCite "$anchor" set howToCite "$anchor" } else { set howToCite {} } # size and size2 set size [lindex $size 0] if {$size <= 1} { global "${languageRep2}::Kbyte" set size2 "$size $Kbyte" } else { global "${languageRep2}::Kbytes" set size2 "$size $Kbytes" } set cgi(wrongpassword) {no} if $oldCode { # commented by GJFB in 2017-03-19 - doesn't work with http://gjfb.home:1905/rep/8JMKD3MGP3W34P/3MPQ9AE because m21b has the port 804 closed for the rest of the world SetFieldValue $documentServerAddress $cgi(metadatarepository)-0 {repository metadatarepository metadatalastupdate nexthigherunit shorttitle} } else { # added by GJFB in 2017-03-19 # set fieldNameList3 {repository metadatarepository metadatalastupdate nexthigherunit shorttitle} set pairList {} foreach item3 $fieldNameList3 { set $item3 $cgi($item3) } } # puts [encoding system] # => iso8859-1 using gjfb0520 if [file exists $homePath/clipboard3/$currentRep/auxdoc/returnPathArray.tcl] { # SOURCE returnPathArray.tcl (Header|AdvancedUserHeader) catch { ;# catch added by GJFB in 2023-03-12 - for some reason returnPathArray.tcl might be corrupted and must be recreated source $homePath/clipboard3/$currentRep/auxdoc/returnPathArray.tcl ;# set returnPathArray - added by GJFB in 2021-05-22 - returnPathArray.tcl may exist after a first load of the header - used in mirror/xxCover.tcl to have (<) displayed } } if [file exists $homePath/clipboard3/$currentRep/auxdoc/missingNextHigherUnitIBIList.txt] { Load $homePath/clipboard3/$currentRep/auxdoc/missingNextHigherUnitIBIList.txt missingNextHigherUnitIBIList set color #D52A2A ;# see "list of missing next higher units" in the source code of the menu bar set doubleClickColor #D52A2A } else { set missingNextHigherUnitIBIList {} # set color #000000 ;# commented by GJFB in 2022-06-14 set color #119911 ;# added by GJFB in 2022-06-14 to highlight the return button < # set doubleClickColor blue ;# added by GJFB in 2022-06-14 to highlight the return button < for double click set doubleClickColor #119911 ;# added by GJFB in 2022-06-14 to highlight the return button < for double click } # puts $color # set output [subst $Header] # puts --$shorttitle-- # puts "5 - [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]" # PUTS HEADER (menu bar: Header|AdvancedUserHeader) puts [subst $Header] # puts "6 - [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]" puts "" ;# to have the menu displayed at once - this has been working with urlib.net only after creating an id (IBIn) for loCoInRep if 0 { # commented by GJFB in 2019-03-23 - time consuming - after 2017-03-19 a pink "<" button alerts the user to missing next higher units - correctives measures should be done manually instead (for exemplo when a missing next higher unit is defined in a record copy) # Check for deleted next higher unit # added by GJFB in 2014-08-02 foreach unit $nexthigherunit { set parsedIBIURL [list parsedibiurl.ibi $unit] set condition [expr $agencyStructureFlag && ([string equal $serverAddress $urlibServerAddress] || [string equal www.$serverAddress $urlibServerAddress]) && [string equal {} $queryString] && ![regexp {[\w/@.]+[!+:]} $pathInfo]] # >>> for testing # set condition [expr $agencyStructureFlag && [string equal {} $queryString]] ;# for testing if $condition { # try using the agency structure # agency structure specific code # www.urlib.net resolver running set urlPropertyList [CreateListOfurlPropertiesFromAgencies $parsedIBIURL $selectedLanguageFromMirror $languageRep1 $languageRep2 $localSite] set agencyStructureFlag2 1 ;# agency structure used } else { set agencyStructureFlag2 0 ;# agency structure not used } if {!$agencyStructureFlag2 || ([info exists urlPropertyList] && [string equal {} $urlPropertyList])} { # agency structure disabled or not used or fails to connect to all agencies and to find the url properties of the ibi # not agency structure specific code # any resolvers (www.urlib.net or agency resolvers) running # agency resolver running set displayWarningMessage 0 set useURLibServerFlag 0 ;# try locally first # RESOLVEIBI # set urlPropertyList [ResolveIBI $parsedIBIURL {} $displayWarningMessage {} $useURLibServerFlag] ;# commented by GJFB in 2017-02-20 set urlPropertyList [ResolveIBI $parsedIBIURL {} $displayWarningMessage {} $useURLibServerFlag $agencyStructureFlag] ;# added by GJFB in 2017-02-20 } # puts --$urlPropertyList-- if ![string equal {} $urlPropertyList] { array set urlPropertyArray $urlPropertyList set state $urlPropertyArray(state) if [string equal {Deleted} $state] { # puts $state # Update nexthigherunit field # similar code in DisplayDocContent # SetFieldValue $documentServerAddress $cgi(metadatarepository)-0 {repository metadatarepository metadatalastupdate nexthigherunit} if [Execute $documentServerAddress [list GetDocumentState $repository]] { # the document is the original ## loCoInRep # set loCoInRep $env(LOCOINREP) # codedPassword Load $homePath/col/$loCoInRep/auxdoc/xxx data binary set data [UnShift $data] set codedPassword [lindex $data end] set command [list list CheckPassword administrator $codedPassword] ;# codedPassword should be the same for all sites set flag [MultipleExecute [list $documentServerAddress] $command] if {[string equal {} $flag] || $flag} {continue} ;# wrong password Execute $documentServerAddress [list WaitQueue2 Get {} $codedPassword] 0 ;# not async # multipleLineReferFieldNamePattern set multipleLineReferFieldNamePattern $env(MULI_PATTERN) ;# used by GetReferField (called by CreateVersionStamp called by ChangeFieldValue) set metadataList {} ;# for add set metadata2List {} ;# for remove set repositoryList {} set fieldNameList nexthigherunit set oldFieldValueList [list $nexthigherunit] set index [lsearch $nexthigherunit $unit] set newNextHigherUnit [lreplace $nexthigherunit $index $index] set newFieldValueList [list $newNextHigherUnit] set rangeList {{}} set userName administrator ChangeFieldValue $documentServerAddress $metadatarepository $metadatalastupdate $fieldNameList $oldFieldValueList $newFieldValueList $rangeList $userName $codedPassword ;# changes metadataList and metadata2List lappend repositoryList $repository $metadatarepository if 0 { # commented by GJFB in 2020-08-18 Execute $documentServerAddress [list RemoveMetadata $metadata2List] Execute $documentServerAddress [list AddMetadata $metadataList] } else { Execute $documentServerAddress [list UpdateMetadata $metadata2List $metadataList] ;# added by GJFB in 2020-08-18 - uses metadata2List and metadataList } Execute $documentServerAddress [list UpdateRepositoryListForPost $repositoryList] Execute $documentServerAddress [list LeaveQueue] 0 ;# not async } # Update nexthigherunit field - end } } } # Check for deleted next higher unit - end } # (< or <<) is displayed in the menu bar # puts --$shorttitle-- ;# to see the puts message, see the bottom part of the source code of the menu bar (no other steps are required) # puts [expr ![info exists cgi(forcehistorybackflag)] || !$cgi(forcehistorybackflag)] if {![info exists cgi(forcehistorybackflag)] || !$cgi(forcehistorybackflag)} { ;# if added by GJFB in 2022-12-30 to avoid unnecessary computing # set timePeriod 1 ;# 1 seconds set timePeriod [expr 24*60*60] ;# 1 day set filePath $homePath/clipboard3/$currentRep/auxdoc/returnPathArray.tcl set updateFlag [ComputeFileUpdateFlag $filePath $timePeriod] if $updateFlag { ;# if added by GJFB in 2023-01-14 # STORERETURNPATHARRAY (uses BuildReturnPathArray) StoreReturnPathArray $nexthigherunit $shorttitle $agencyStructureFlag $currentRep ;# same code in CreateFullEntry } } # puts [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S] return } ;# Header|AdvancedUserHeader - end {Return} { # RETURN # v # return to root (ex: < 1-> < 2-> < 3-> >) (> and possibly <) are displayed in the menu bar source ../$col/$languageRep2/doc/mirror/${selectedLanguageFromMirror}Cover.tcl ;# {turn the attached file, the target file} global "${languageRep2}::Return" ;# uses languageRep1 # global "translationTable" ;# set in mirror/xxCover.tcl global "${languageRep2}::translationTable" ;# set in mirror/xxCover.tcl # puts [array get cgi] # currentRep (the repository of the current ibi) set currentRep $cgi(currentrep) ConditionalSet queryValue cgi(query) {} ConditionalSet userName cgi(username) {} ConditionalSet codedPassword1 cgi(codedpassword1) {} set documentServerAddress $cgi(documentserveraddress) set termsOfUse $cgi(termsofuse) set simplifiedRightsholder $cgi(simplifiedrightsholder) set returnPathNumber $cgi(returnpathnumber) set numberOfRecords $cgi(numberofrecords) set digitalStorageIndicator $cgi(digitalstorageindicator) set waitForCompletionFlag $cgi(waitforcompletionflag) # agencyStructureFlag set agencyStructureFlag $cgi(agencystructureflag) # progressKey ConditionalSet progressKey cgi(progresskey) {} # searchInputValue ConditionalSet searchInputValue cgi(searchinputvalue) {} ;# added by GJFB in 2022-06-13 - value is a search expression # parentIdentifierCitedBy ConditionalSet parentIdentifierCitedBy cgi(parentidentifiercitedby) {} ;# added by GJFB in 2022-06-13 set parentIdentifierCitedBy1 [lindex $parentIdentifierCitedBy 0] ;# added by GJFB in 2023-03-10 - now parentIdentifierCitedBy can be a list - see example of list in localIndexInOnePage.html - used when linkType is 1 and targetValue is _top set parentIdentifierCitedBy2 [lrange $parentIdentifierCitedBy 1 end] ;# added by GJFB in 2023-03-10 - now parentIdentifierCitedBy can be a list - see example of list in localIndexInOnePage.html - used when linkType is 1 and targetValue is _top # forceRecentFlag ConditionalSet forceRecentFlag cgi(forcerecentflag) 0 ;# added by GJFB in 2022-06-13 - used in the mirror home page file - value is 0 (default) or 1 (means to force 'The Most Recent' display) # forcehistorybackflag ConditionalSet forceHistoryBackFlag cgi(forcehistorybackflag) 1 ;# added by GJFB in 2023-06-09 used in 'Guia do administrador' (8JMKD3MGP5W34M/3FU99GE) - value is 0 or 1 (default - means to force the display of the 'history.back' arrow) set bodyLink $cgi(bodylink) # migration 2018-03-30 file delete $homePath/col/$currentRep/auxdoc/returnPathArray.tcl # migration 2018-03-30 - end # puts [encoding system] # => iso8859-1 using gjfb0520 if [file exists $homePath/clipboard3/$currentRep/auxdoc/returnPathArray.tcl] { # SOURCE returnPathArray.tcl (Return) source $homePath/clipboard3/$currentRep/auxdoc/returnPathArray.tcl ;# set returnPathArray SetFieldValue $documentServerAddress $cgi(metadatarepository)-0 {nexthigherunit} } else { if $oldCode { # commented by GJFB in 2017-03-19 - doesn't work with http://gjfb.home:1905/rep/8JMKD3MGP3W34P/3MPQ9AE because m21b has the port 804 closed for the rest of the world SetFieldValue $documentServerAddress $cgi(metadatarepository)-0 {nexthigherunit shorttitle} } else { # added by GJFB in 2017-03-19 # set fieldNameList4 {nexthigherunit shorttitle} set pairList {} foreach item4 $fieldNameList4 { set $item4 $cgi($item4) } } # puts [list $nexthigherunit $shorttitle] set i 1 set returnPathArrayList {} set missingNextHigherUnitIBIList {} # BUILDRETURNPATHARRAY (Return) if [catch {BuildReturnPathArray [list {} $nexthigherunit $shorttitle] $agencyStructureFlag $i $returnPathArrayList $missingNextHigherUnitIBIList} buildOutput] { global errorInfo puts "" } else { foreach {i returnPathArrayList missingNextHigherUnitIBIList} $buildOutput {break} array set returnPathArray $returnPathArrayList } } # puts -1-[array get returnPathArray]-- # => # 1 {83LX3pFwXQZeBBx/BbsHa urlib.net {} {Documentação URLib}} # other returnPathArray examples: # 1 {3ERPFQRTRW34M/3E7G88S {SBSR 16} {} {}} # 2 {3ERPFQRTRW34M/3E7G88S {SBSR 16} 3ERPFQRTRW34M/3EHNQ68 Indice {} {}} # returnPathArray example: # 1 {8JMKD3MGPCW/3DT298S INPE 83LX3pFwXQZ5Jpy/CxGU3 {Biblioteca SBSR} 3ERPFQRTRW34M/3E7G88S {SBSR 16} {} {}} # 2 {8JMKD3MGPCW/3DT298S INPE 83LX3pFwXQZ5Jpy/CxGU3 {Biblioteca SBSR} 3ERPFQRTRW34M/3E7G88S {SBSR 16} 3ERPFQRTRW34M/3EHNQ68 Indice {} {}} # 1 {8JMKD3MGPCW/3DT298S INPE 83LX3pFwXQZ5Jpy/CxGU3 {Biblioteca SBSR} 3ERPFQRTRW34M/3E7G88S {SBSR 16} {} {}} # 2 {8JMKD3MGPCW/3DT298S INPE 83LX3pF putswXQZ5Jpy/CxGU3 {Biblioteca SBSR} 3ERPFQRTRW34M/3E7G88S {SBSR 16} 3ERPFQRTRW34M/3EHNQ68 Indice {} {} 8JMKD3MGPCW/3DT298S INPE 8JMKD3MGPCW/3EQCC85 Produção 8JMKD3MGPCW/3ER446E DSR 3ERPFQRTRW34M/3E7G88S {SBSR 16}} # 3 {8JMKD3MGPCW/3DT298S INPE 8JMKD3MGPCW/3EQCC85 Produção 8JMKD3MGPCW/3EQCCU5 DPI 3ERPFQRTRW34M/3EHNQ68 Indice 8JMKD3MGPCW/3DT298S INPE 8JMKD3MGPCW/3EQCC85 Produção 8JMKD3MGPCW/3ER446E DSR 3ERPFQRTRW34M/3E7G88S {SBSR 16}} # returnPathArray2 (contains the return path up to the root) if 1 { # Drop the paths contained in other paths # added by GJFB in 2022-07-28 set nameList [array names returnPathArray] array set returnPathArray2 [array get returnPathArray] foreach name1 $nameList { foreach name2 $nameList { if [string equal $returnPathArray($name1) $returnPathArray($name2)] {continue} set path1 [lrange $returnPathArray($name1) 0 end-2] set path2 [lrange $returnPathArray($name2) 0 end-2] if [regexp $path1 $path2] { # path1 is stricly contained in path2 unset returnPathArray2($name1) break } } } set nameList [array names returnPathArray2] set j 1 foreach name $nameList { set returnPathArray3($j) $returnPathArray2($name) incr j } unset returnPathArray array set returnPathArray [array get returnPathArray3] # Drop the paths contained in other paths - end } set nameList [array names returnPathArray] set numberOfReturnPaths [llength $nameList] if 0 { puts {Content-Type: text/html} puts {} } # puts --$nameList-- # => --4 1 2 3-- set j 1 set greenFlag1 0 foreach i $nameList { # puts --$returnPathArray($i)-- set greenFlag2 0 set returnPathArray2($i) {} foreach {ibi shortTitle} $returnPathArray($i) { if [string equal {} $ibi] { lappend returnPathArray2($i) "$shortTitle" } else { # lappend returnPathArray2($i) "$shortTitle" if {1 || [file exists $homePath/col/$loCoInRep/auxdoc/siteStampXcodedPasswordArray.tcl]} { ;# if added by GJFB in 2021-02-16 - commented in 2022-08-16 since siteStampXcodedPasswordArray.tcl now exists for all Archive (see LoadGlobalVariable) set repName [Execute $serverAddress [list FindRepositoryNameFromIBI $ibi]] ;# added by GJFB in 2021-09-02 if [string equal {} $repName] { # the record is not in the (local) collection # if [string equal $ibi $parentIdentifierCitedBy] # ;# commented by GJFB in 2023-03-10 if [regexp $ibi $parentIdentifierCitedBy1] { ;# added by GJFB in 2023-03-10 - now parentIdentifierCitedBy can be a list - see example of list in localIndexInOnePage.html - used when linkType is 1 and targetValue is _top # green background if [string equal {} $cgi(searchinputvalue)] { # lappend returnPathArray2($i) " $shortTitle " ;# added by GJFB in 2022-06-13 lappend returnPathArray2($i) " $shortTitle " ;# added by GJFB in 2022-06-13 } else { # lappend returnPathArray2($i) " $shortTitle " ;# added by GJFB in 2022-06-13 lappend returnPathArray2($i) " $shortTitle " ;# added by GJFB in 2022-06-13 } set greenFlag2 1 } else { # lappend returnPathArray2($i) "$shortTitle" ;# ibiurl.backgroundlanguage is alias for languagebutton - commented by GJFB in 2022-07-28 lappend returnPathArray2($i) "$shortTitle" ;# ibiurl.backgroundlanguage is alias for languagebutton - added by GJFB in 2022-07-28 to avoid the double click option } } else { # puts "--$ibi $parentIdentifierCitedBy1--" # the record is in the (local) collection - useful alternative when the host has a dynamique IP. In that case, urlib.net would not be able to find any record in that local collection # if [string equal $ibi $parentIdentifierCitedBy] # ;# commented by GJFB in 2023-03-10 if [regexp $ibi $parentIdentifierCitedBy1] { ;# added by GJFB in 2023-03-10 - now parentIdentifierCitedBy can be a list - see example of list in localIndexInOnePage.html - used when linkType is 1 and targetValue is _top if [string equal {} $cgi(searchinputvalue)] { # green background # lappend returnPathArray2($i) " $shortTitle " ;# added by GJFB in 2022-06-13 lappend returnPathArray2($i) " $shortTitle " ;# added by GJFB in 2022-06-13 } else { # lappend returnPathArray2($i) " $shortTitle " ;# added by GJFB in 2022-06-13 lappend returnPathArray2($i) " $shortTitle " ;# added by GJFB in 2022-06-13 } set greenFlag2 1 } else { if {0 && [string equal $searchSiteIdentifier $parentIdentifierCitedBy1]} { # green background - all links become green lappend returnPathArray2($i) " $shortTitle " ;# ibiurl.backgroundlanguage is alias for languagebutton set greenFlag2 1 } else { # lappend returnPathArray2($i) "$shortTitle" ;# ibiurl.backgroundlanguage is alias for languagebutton - commented by GJFB in 2022-07-28 lappend returnPathArray2($i) "$shortTitle" ;# ibiurl.backgroundlanguage is alias for languagebutton - added by GJFB in 2022-07-28 to avoid the double click option } } } } else { # something must probably be updated here - commented (see above) by GJFB in 2022-08-16 lappend returnPathArray2($i) "$shortTitle" ;# ibiurl.backgroundlanguage is alias for languagebutton } } } ;# end of foreach # puts --[array get returnPathArray2]-- if $greenFlag2 { set returnPathArray4($j) $returnPathArray2($i) set greenFlag1 1 incr j } if !$greenFlag1 { if {$numberOfReturnPaths > 1} { set returnPathArray2($i) "($i/$numberOfReturnPaths) - [join $returnPathArray2($i) { > }]" } else { set returnPathArray2($i) [join $returnPathArray2($i) { > }] } } } ;# end of foreach if 1 { # Drop the paths without green highlight if there is at least one with green highlight # added by GJFB in 2022-07-28 if $greenFlag1 { unset returnPathArray2 set nameList [array names returnPathArray4] set numberOfReturnPaths [llength $nameList] foreach j $nameList { if {$numberOfReturnPaths > 1} { set returnPathArray2($j) "($j/$numberOfReturnPaths) - [join $returnPathArray4($j) { > }]" } else { set returnPathArray2($j) [join $returnPathArray4($j) { > }] } } } # Drop the paths without green highlight if there is at least one with green highlight - end } if {$returnPathNumber >= $numberOfReturnPaths} { set returnAction $cgi(headertype) set inputValue > set inputTitle1 {go to the menu} } else { set returnAction Return set inputValue < set inputTitle1 {see the return path up to the root} set inputTitle2 {click once to see return path to root - twice to return to the previous page} ;# added vy GJFB in 2022-06-13 } # puts -2-[array get returnPathArray2]-- # => # 1 {urlib.net > Documentação URLib} # puts $Return # PUTS RETURN set output [subst $Return] } Warning1 { source ../$col/$languageRep2/doc/mirror/${selectedLanguageFromMirror}Cover.tcl ;# Header, wrong password, ... global "${languageRep2}::Warning1" ;# uses languageRep1 set output [subst $Warning1] } Warning2 { source ../$col/$languageRep2/doc/mirror/${selectedLanguageFromMirror}Cover.tcl ;# Header, wrong password, ... global "${languageRep2}::Warning2" ;# uses languageRep1 set output [subst $Warning2] } default { # FRAMESET encoding system utf-8 ;# added by GJFB in 2015-01-09 to solve the accent problem with gjfb.home (Windows OS) when the filePath contains upper case accented letter (e.g., Ã) - must be just before creating pathInfo # e.g., http://gjfb.home/rep/dpi.inpe.br/banon-pc2@80/2008/11.25.15.05/pasta/manuscrito VERSÃO 2.pdf if [info exists env(PATH_INFO)] { set pathInfo $env(PATH_INFO) } else { set pathInfo / } if [catch {ParseIBIURL $pathInfo $queryString} parsedIBIURL] { # syntax error # example: http://banon-pc3.dpi.inpe.br/rep/LK47B6/362SFKI source ../$col/$languageRep2/doc/mirror/${selectedLanguageFromMirror}Cover.tcl catch {subst [set [list ${languageRep2}::syntax error]]} output error $output } if 0 { puts {Content-Type: text/html} puts {} puts --$pathInfo-- puts --$queryString-- puts --$parsedIBIURL-- } array set ibiURLArray $parsedIBIURL # file set file $ibiURLArray(parsedibiurl.filepath) ;# used in header - used to decide to count one click only if $oldCode { # commented by GJFB in 2017-03-19 } elseif 0 { # added by GJFB in 2017-03-19 - commented by GJFB in 2022-02-22 # parsedibiurl.metadatafieldnamelist already exists and might be empty (see ParseIBIURL) lappend parsedIBIURL parsedibiurl.metadatafieldnamelist $fieldNameListAll } else { # added by GJFB in 2022-02-22 set fieldNameList2 [concat $ibiURLArray(parsedibiurl.metadatafieldnamelist) $fieldNameListAll] set ibiURLArray(parsedibiurl.metadatafieldnamelist) [lsort -unique $fieldNameList2] set parsedIBIURL [array get ibiURLArray] } # Create urlPropertyList2 # set agencyStructureFlag 0 ;# disable agency structure set agencyStructureFlag 1 ;# enable agency structure - don't use urlib.net resolution - agencyStructureFlag must be set also in CreateFullEntry set condition [expr $agencyStructureFlag && ([string equal $serverAddress $urlibServerAddress] || [string equal www.$serverAddress $urlibServerAddress]) && [string equal {} $queryString] && ![regexp {[\w/@.]+[!+:]} $pathInfo]] # >>> for testing # http://vaio:1905/rep/urlib.net/www/2017/07.08.14.36 # set condition [expr $agencyStructureFlag && [string equal {} $queryString] && ![regexp {[\w/@.]+[!+:]} $pathInfo]] ;# for testing # set condition [expr $agencyStructureFlag && [file exists $homePath/col/$loCoInRep/auxdoc/agencyHTTPHostList.tcl] && [string equal {} $queryString]] ;# for future use - for more than two resolver layers # set condition [expr $agencyStructureFlag && [file exists $homePath/col/$loCoInRep/auxdoc/agencyHTTPHostList.tcl] && [string equal {} $queryString]] ;# for future use - for more than two resolver layers # puts $agencyStructureFlag # puts --$queryString-- if 0 { puts {Content-Type: text/html} puts {} puts "condition = $condition" puts "parsedIBIURL = $parsedIBIURL" puts "selectedLanguageFromMirror = $selectedLanguageFromMirror" puts "languageRep1 = $languageRep1" puts "languageRep2 = $languageRep2" puts "localSite = $localSite" } if $condition { # agency structure specific code # www.urlib.net resolver running # use of the HTTP protocol # puts "parsedIBIURL = $parsedIBIURL" set urlPropertyList2 [CreateListOfurlPropertiesFromAgencies $parsedIBIURL $selectedLanguageFromMirror $languageRep1 $languageRep2 $localSite] # puts "urlPropertyList2 = --$urlPropertyList2--" set agencyStructureFlag2 1 ;# agency structure used } else { set agencyStructureFlag2 0 ;# agency structure not used } if {!$agencyStructureFlag2 || ([info exists urlPropertyList2] && [string equal {} $urlPropertyList2])} { # agency structure disabled or not used or fails to connect to all agencies and find the url properties of the ibi # not agency structure specific code # any resolvers (www.urlib.net or agency resolvers) running # agency resolver running # >>> step 1 (output) of the agency structure communication scheme (www.urlib.net resolver -> agency resolver) # http://gjfb.home:1905/rep-/J8LNKB5R7W/3N8UTK5?ibiurl.returntype=urlpropertylist # http://gjfb.home:1905/rep-/urlib.net/www/2013/06.24.20.00?ibiurl.returntype=urlpropertylist # set displayWarningMessage 1 ;# commented by GJFB in 2017-02-20 set displayWarningMessage [string equal {content} $ibiURLArray(parsedibiurl.returntype)] ;# added by GJFB in 2017-02-20 - agency structure communication # puts [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S] # set urlPropertyList2 [ResolveIBI $parsedIBIURL $selectedLanguageFromMirror $displayWarningMessage $currentProcedureName] ;# commented by GJFB in 2017-02-20 set useURLibServerFlag 0 ;# try locally first if 0 { puts {Content-Type: text/html} puts {} puts --$parsedIBIURL-- } # RESOLVEIBI set urlPropertyList2 [ResolveIBI $parsedIBIURL $selectedLanguageFromMirror $displayWarningMessage $currentProcedureName $useURLibServerFlag $agencyStructureFlag] ;# added by GJFB in 2017-02-20 # puts [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S] if 0 { puts {Content-Type: text/html} puts {} puts --$urlPropertyList2-- } # set xxx 1-$urlPropertyList2 # Store xxx C:/tmp/bbb.txt binary 0 a } # Create urlPropertyList2 - end array set urlPropertyArray $urlPropertyList2 # site (document site) set site $urlPropertyArray(archiveaddress) # puts $site # => www.urlib.net # puts $localSite # => www.urlib.net:80 if $redirectFlag { # added by GJFB in 2021-05-23 if [string equal $site [regsub {:80$} $localSite {}]] { puts {Content-Type: text/html} puts {} } else { # REDIRECT puts "Location: http://$site$env(REQUEST_URI)" puts {} return } } # puts --$urlPropertyList2-- # puts {} # puts [array names urlPropertyArray] # puts {} # puts $urlPropertyArray(metadatafieldlist) # documentServerAddress set documentServerAddress [GetServerAddressFromHTTPHost $site] # url set url $urlPropertyArray(url) # puts $url # regsub {http://} $url {} link # state - used in header set state $urlPropertyArray(state) # currentRep - used in header # set currentRep [Execute $documentServerAddress [list FindRepositoryNameFromIBI $urlPropertyArray(ibi)]] array set ibiArray $urlPropertyArray(ibi) set currentRep $ibiArray(rep) # puts $documentServerAddress # puts $currentRep # puts $cgi(metadatarepository) if $oldCode { # commented by GJFB in 2017-03-19 - doesn't work with http://gjfb.home:1905/rep/8JMKD3MGP3W34P/3MPQ9AE because m21b has the port 804 closed for the rest of the world # metadataRep if [info exists cgi(metadatarepository)] { set metadataRep $cgi(metadatarepository) # set metadataRepPlus $metadataRep } else { # currentRep must not be a metadata repository otherwise FindMetadataRep returns empty # set metadataRep [Execute $documentServerAddress [list FindMetadataRep $currentRep]] ;# returns the one which is not a metadata translation set metadataFlag [Execute $documentServerAddress [list TestContentType $currentRep Metadata]] if {[string equal {} $metadataFlag] || $metadataFlag} { # currentRep is a metadata repository set metadataRep $currentRep ;# involution } else { set metadataRep [Execute $documentServerAddress [list FindMetadataRep $currentRep $selectedLanguageFromMirror]] } } # puts --$metadataRep-- # SET FIELD VALUES # SetFieldValue $documentServerAddress $metadataRep-0 {title targetfile referencetype fullname} # SetFieldValue $documentServerAddress $metadataRep-0 {title targetfile referencetype fullname contenttype} # SetFieldValue $documentServerAddress $metadataRep-0 {title targetfile referencetype fullname contenttype username} ;# added by GJFB in 2017-03-19, targetfile is used in a hidden code in mirror/xxCover.tcl - commented by GJFB in 2022-05-09 SetFieldValue $documentServerAddress $metadataRep-0 {title targetfile referencetype fullname contenttype username versiontype} ;# added by GJFB in 2022-05-09 - versiontype } else { # added by GJFB in 2017-03-19 ConditionalSet metadataFieldList urlPropertyArray(metadatafieldlist) {} foreach {metadataFieldName metadataFieldValue} $metadataFieldList { set $metadataFieldName $metadataFieldValue ;# set title, targetfile, referencetype, fullname, ..., readpermission, ... } # set metadataRep $metadatarepository } # new code - equal to the code in Get- - added by GJFB in 2010-10-26 # works with http://banon-pc3/rep/dpi.inpe.br/plutao@80/2009/07.13.14.44 # works when opening sid.inpe.br/mtc-m15@80/2006/12.06.11.48 (located at mtc-m15) # searchinputvalue ConditionalSet searchinputvalue cgi(searchinputvalue) {} ;# added by GJFB in 2022-06-13 - value is a search expression # parentidentifiercitedby ConditionalSet parentidentifiercitedby cgi(parentidentifiercitedby) {} ;# added by GJFB in 2022-06-13 # forcerecentflag ConditionalSet forcerecentflag cgi(forcerecentflag) 0 ;# added by GJFB in 2022-06-13 - used in the mirror home page file - value is 0 (default) or 1 (means to force 'The Most Recent' display) # forcehistorybackflag ConditionalSet forcehistorybackflag cgi(forcehistorybackflag) 1 ;# added by GJFB in 2022-12-02 used in 'Guia do administrador' (8JMKD3MGP5W34M/3FU99GE) - value is 0 or 1 (default - means to force the display of the 'history.back' arrow) # shortmenu ConditionalSet shortmenu cgi(shortmenu) {} ;# added by GJFB in 2024-01-02 if [string equal {Resume} $referencetype] { set title "[FormatAuthorList $fullname] - Resume" } set encodingName [Execute $documentServerAddress [list GetEncodingName]] # puts $documentServerAddress # puts $encodingName set convertToUTF8 [string equal {utf-8} $encodingName] ;# solves the accent problem - same code is used in xxDocContent.html # puts $convertToUTF8 if $convertToUTF8 { # set targetfile [encoding convertto utf-8 $targetfile] ;# Fragmentação -> Fragmentação - commented by GJFB in 2018-12-26 - not needed set title [encoding convertfrom utf-8 $title] ;# Fragmentação -> Fragmentação } # documentServerAddress2 regsub { +} $documentServerAddress {+} documentServerAddress2 if 0 { # if [regsub {^[^/]+/(col/[^/]+/[^/]+/[^/]+/[^/]+/doc/[^?]*)} $link "$homePath/\\1" filePath] # if [regsub {^http://[^/]+/(col/[^/]+/[^/]+/[^/]+/[^/]+/doc/[^?]*)} $url "$homePath/\\1" filePath] { # filePath is used instead of the target file path because they might not be coded in the same way set convertToUTF8 [expr [string equal {utf-8} $encodingName] && ![file exists $filePath]] ;# solves the accent problem when image file names are coded differently (iso and utf) in the same directory (in consequence of a migration between different operating systems (iso and utf)) - added by GJFB in 2013-09-01 - with the new operating system of md-m09.sid.inpe.br, inputList was created (in UpdateRepMetadataRep) with utf-8 as given by $env(ENCODING_SYSTEM) and the current encoding system is iso8859-1 (because of the apache configuration: AddDefaultCharset ISO-8859-1) } } ## puts $site$env(REQUEST_URI) ## regsub {rep/} $site$env(REQUEST_URI) {} bodyLink # set bodyLink $link if 0 { # commented by GJFB in 2014-12-30 - conversion is now made in CreateAbsolutePath - encodingsystem is obsolete set convertedURL [ConvertURLToHexadecimal $url $convertToUTF8] ;# solves the accent problem - communication from banon-pc3 to plutao } else { set convertedURL $url ;# url is already converted in CreateAbsolutePath } regsub {http://} $convertedURL {} bodyLink # puts
# puts $bodyLink set waitForCompletionFlag 0 if [string equal {Tcl Page} $contenttype] { # source $homePath/col/$currentRep/doc/@schedule.tcl ;# set timePeriod Source http://$site/col/$currentRep/doc/@schedule.tcl timePeriod ;# set timePeriod if {[info exists timePeriod] && $timePeriod} { set waitForCompletionFlag 1 } } # pairList if $oldCode { # commented by GJFB in 2017-03-19 lappend pairList metadatarepository=$metadataRep lappend pairList username=$username } else { # added by GJFB in 2017-03-19 # Create automatic short title # added by GJFB in 2018-01-09 if [string equal {} $shorttitle] { regsub -all {"} $title {} title2 ;# added by GJFB in 2018-02-13 to avoid error like 'list element in quotes followed by "," instead of space' when running lrange set shorttitle [lrange $title2 0 2] if {[llength $title2] > 3} { set shorttitle $shorttitle... } } # Create automatic short title - end foreach name $fieldNameListAll { set value [set $name] regsub -all {=} $value {%3D} value ;# added by GJFB in 2021-06-13 - to solve title containing string like T&D = x, otherwise the query string in srcHeadder cannot be interpreted correctly - leads to am erfror message like: can't read "cgi(currentRep)": no such variable ConvertStringWithAccent value ;# added by GJFB in 2023-02-14 because the presence of '#' breaks the query string and produces the error 'can't read "cgi(currentrep)": no such variable' - ex: Simpósio must be converted into Simpósio lappend pairList $name=$value } regsub -all {&} $pairList {%26} pairList ;# added by GJFB in 2021-06-13 - to solve title containing string like T&D, otherwise the query string in srcHeadder cannot be interpreted correctly - leads to am erfror message like: can't read "cgi(currentRep)": no such variable # puts $pairList } if $waitForCompletionFlag { if {[info tclversion] > 8.4} {set progressKey [clock microseconds]} else {set progressKey [clock seconds]} # puts $bodyLink if [regsub {\?} $bodyLink ?clientserveraddresswithip=$clientServerAddressWithIP\\&progresskey=$progressKey\\& refreshBodyLink] { set refreshURL http://$refreshBodyLink } else { set refreshURL http://$bodyLink?clientserveraddresswithip=$clientServerAddressWithIP&progresskey=$progressKey } set fileContent " Waiting for completion

" file mkdir $homePath/col/$URLibServiceRepository/doc/progressDir Store fileContent $homePath/col/$URLibServiceRepository/doc/progressDir/$progressKey.html set bodyWaitingForCompletionURL $localSite/col/$URLibServiceRepository/doc/progressDir/$progressKey.html # header frame with progresskey ## dropped $ in converttoutf8=$convertToUTF8 by GJFB in 2018-12-26 - this attribute is no more needed # added $ by GJFB in 2022-02-03 set srcHeadder [ConvertURLToHexadecimal http://$localSite/rep/Header?selectedlanguagefrommirror=$selectedLanguageFromMirror&mirror=$mirror&[join $pairList &]&documentserveraddress=$documentServerAddress2&converttoutf8=$convertToUTF8&languagerep1=$languageRep1&languagerep2=$languageRep2&submissionformrep=$submissionFormRep&searchsite=$searchSite&searchmirror=$searchMirror¤trep=$currentRep&file=$file&state=$state&waitforcompletionflag=$waitForCompletionFlag&agencystructureflag=$agencyStructureFlag&progresskey=$progressKey&bodylink=$bodyLink] set srcBody $bodyWaitingForCompletionURL } else { # header frame without progresskey ## dropped $ in converttoutf8=$convertToUTF8 by GJFB in 2018-12-26 - this attribute is no more needed # added $ by GJFB in 2022-02-03 set srcHeadder [ConvertURLToHexadecimal http://$localSite/rep/Header?selectedlanguagefrommirror=$selectedLanguageFromMirror&mirror=$mirror&[join $pairList &]&documentserveraddress=$documentServerAddress2&converttoutf8=$convertToUTF8&languagerep1=$languageRep1&languagerep2=$languageRep2&submissionformrep=$submissionFormRep&searchsite=$searchSite&searchmirror=$searchMirror¤trep=$currentRep&file=$file&state=$state&waitforcompletionflag=$waitForCompletionFlag&agencystructureflag=$agencyStructureFlag&bodylink=$bodyLink] # puts $bodyLink set srcBody $bodyLink } # puts $srcBody # if ![regexp {:} $pathInfo] # ;# added by GJFB in 2021-11-28 otherwise metadata of restricted access information item are not displayed - commented by GJFB in 2022-09-07 if {![regexp {:} $pathInfo] && [string equal {Data} $urlPropertyArray(contenttype)]} { ;# added by GJFB in 2021-11-28 otherwise metadata of restricted access information item are not displayed - added by GJFB in 2022-09-07 to bypass the warning messages when the ibi is the metadata repository of restricted access item # not metadata set noAccessRestrictionFlag [ComputeAccessRestrictionFlag $readpermission $env(REMOTE_ADDR)] regsub -all {"} $title {%22} title ;# added by GJFB in 2023-04-13 otherwise, when the title contains quotation marks ("), the src attribute value of the body frame for Warning1 gets truncated, resulting in the error: can't read "cgi(srcbody)": no such element in array (usefull for example with id 8JMKD3MGP8W/355229L) regsub -all {=} $srcBody {%3D} srcBody1 ;# added by GJFB in 2022-07-12 otherwise the Warning1 CONTINUE button query string gets truncated like that: ?requiredmirror= regsub -all {&} $srcBody1 {%26} srcBody1 ;# added by GJFB in 2022-07-12 if [regexp {allow} $readpermission] { if !$noAccessRestrictionFlag { # access restriction if [ReturnRestrictedAccessWarning $mirrorrepository $documentServerAddress $site] { if [string equal {} $readergroup] { # 2. readp allow and readp deny and not readerg * (search expression) # Warning2 # set srcBody $localSite/rep/Warning2?title=$title&srcbody=$srcBody1 ;# commented by GJFB in 2023-12-16 set srcBody $localSite/rep/Warning2?title=$title&srcbody=$srcBody1&ibiurl.backgroundlanguage=$selectedLanguageFromMirror ;# added by GJFB in 2023-12-16 to ensure the Warning display in the same language as of the upper menu bar } else { # 3. readp allow and readp deny and readerg * (search expression) # Warning1 # set srcBody $localSite/rep/Warning1?title=$title&srcbody=$srcBody1 ;# commented by GJFB in 2023-12-16 set srcBody $localSite/rep/Warning1?title=$title&srcbody=$srcBody1&ibiurl.backgroundlanguage=$selectedLanguageFromMirror ;# added by GJFB in 2023-12-16 to ensure the Warning display in the same language as of the upper menu bar } } } } else { # 4. not readp allow and readp deny and readerg * (search expression) if {[regexp {deny} $readpermission] && ![string equal {} $readergroup]} { if [ReturnRestrictedAccessWarning $mirrorrepository $documentServerAddress $site] { # Warning1 # set srcBody $localSite/rep/Warning1?title=$title&srcbody=$srcBody1 ;# commented by GJFB in 2023-12-16 set srcBody $localSite/rep/Warning1?title=$title&srcbody=$srcBody1&ibiurl.backgroundlanguage=$selectedLanguageFromMirror ;# added by GJFB in 2023-12-16 to ensure the Warning display in the same language as of the upper menu bar } } } } # puts $srcBody set englishMirrorRepository $env(ENGLISH_MIRROR_REP) GetConversionTable $englishMirrorRepository en global field::conversionTable ;# used in CreateMetadataTags set errorLogPath $homePath/@errorLog set tagType DC set identifierType IBI set dcType SEO foreach {name value} [CreateMetadataTags $serverAddress $metadatarepository-0 $tagType $identifierType $errorLogPath $dcType] { # identifier # lappend outputList "\t lappend outputList "" ;# added by GFB in 2023-02-22 for Search engine optimization (SEO) } set tagType HP set identifierType IBI foreach {name value} [CreateMetadataTags $serverAddress $metadatarepository-0 $tagType $identifierType $errorLogPath] { # identifier # lappend outputList "\t lappend outputList "" ;# added by GFB in 2023-02-22 for Search engine optimization (SEO) } set output " URLib - $title[expr [string equal {} $identifier]?{}:{ | $identifier}] [join $outputList \n\t\t\t\t\t\t] Your browser cannot display frames. " if 0 { AcknowledgeArchive $urlPropertyList2 ;# Count one click } else { package require http # servicesubject=acknowledgment # communication scheme step 5 set clientIPAddress [GetClientIP] lappend urlPropertyList3 clientinformation.ipaddress $clientIPAddress lappend urlPropertyList3 contenttype $urlPropertyArray(contenttype) if [info exists urlPropertyArray(ibi)] {lappend urlPropertyList3 ibi $urlPropertyArray(ibi)} ;# urlPropertyArray(ibi) always exists with the URLib platform but may not exist with others, for example when the URL points to metadata lappend urlPropertyList3 servicesubject acknowledgment lappend urlPropertyList3 state $urlPropertyArray(state) # if [info exists urlPropertyArray(url)] {lappend urlPropertyList3 url $urlPropertyArray(url)} lappend urlPropertyList3 url $urlPropertyArray(url) lappend urlPropertyList3 url.persistent http://$localSite$env(REQUEST_URI) ;# add persistent URL # if [info exists urlPropertyArray(urlkey)] {lappend urlPropertyList3 urlkey $urlPropertyArray(urlkey)} lappend urlPropertyList3 urlkey $urlPropertyArray(urlkey) ConditionalSet citingItem cgi(ibiurl.clientinformation.citingitem) {} ;# added by GJFB in 2024-01-04 lappend urlPropertyList3 clientinformation.citingitem $citingItem ;# added by GJFB in 2024-01-04 set queryString [ConvertListForArratyToQueryString $urlPropertyList3] set documentArchiveAddress $urlPropertyArray(archiveaddress) set index [lindex $urlPropertyArray(ibi.archiveservice) end] # puts [ConvertURLToHexadecimal http://$documentArchiveAddress/$index?$queryString 1] ## J8LNKB5R7W/3FTRH3S == Archive service for IBI resolution # if [catch {http::geturl [ConvertURLToHexadecimal http://$documentArchiveAddress/J8LNKB5R7W/3FTRH3S?$queryString 1]} token] # if [catch {http::geturl [ConvertURLToHexadecimal http://$documentArchiveAddress/$index?$queryString 1] -timeout 2000} token] { } else { # geturl returned if [string equal {404} [::http::ncode $token]] { # not found # puts {not found} } else { # puts OK # puts --[string trimright [http::data $token]]-- } http::cleanup $token } } if 1 { # added by GJFB in 2023-02-26 to solve a Google indexing requirement # see: https://scholar.google.com/intl/en/scholar/inclusion.html#indexing # puts ../$col/$repository/doc/[file dirname $targetfile]/thisInformationItemHomePage.html if {[string equal -nocase {.pdf} [file extension $targetfile]] && ![regexp {/customizeerror.cgi/409} $srcBody] && ![string equal {External Contribution} $contenttype]} { # Store output ../$col/$repository/doc/[file dirname $targetfile]/thisInformationItemHomePage.html ;# commented by GJFB in 2023-03-02 Store output ../$col/$repository/doc/[file dirname $targetfile]/thisInformationItemHomePage.html auto 0 w 0 iso8859-1 ;# added by GJFB in 2023-03-02 - solves the accent/channel problem in title and meta tags - Aplicação -> Aplicação (solves accent problem in: http://mtc-m21b.sid.inpe.br/col/sid.inpe.br/mtc-m21b/2016/12.19.13.06/doc/thisInformationItemHomePage.html) if 0 { # commented by GJFB in 2023-03-02 puts $output } else { # added by GJFB in 2023-03-02 puts " Redirection to thisInformationItemHomePage.html " } } else { file delete ../$col/$repository/doc/[file dirname $targetfile]/thisInformationItemHomePage.html puts $output } return } # end default } } ;# end switch puts $output } m] { if !$redirectFlag { # commented by GJFB in 2021-05-23 puts {Content-Type: text/html} # puts {Content-Type: text/plain} puts {} } if [regexp {.*} $m] { # HTML code # puts {HTML code} puts {Content-Type: text/html} ;# added by GJFB in 2023-03-20 - required to display the 'identifier warning' message (see output of DisplayWarningMessage) puts {} puts $m if 0 {global errorInfo; puts $errorInfo} } else { # not an HTML code puts
		puts $m
		if 0 {global errorInfo; puts $errorInfo}
# >>> to see the puts output you might go to the bottom of the source code page of the upper menu
		puts 
} } } # # # Resume # # # # #
#
# # # Get - end # ---------------------------------------------------------------------- # CreateAdditionalRowList # used in CreatePasswordField only proc CreateAdditionalRowList {} { global languageRep2 global "${languageRep2}::password field - enter the password for the login \$userName" set additionalRowList {} lappend additionalRowList "" set variableName "password field - enter the password for the login \$userName" lappend additionalRowList "" lappend additionalRowList "" lappend additionalRowList "" set additionalRowList [join $additionalRowList \n] set additionalRowList2 {} foreach line [split $additionalRowList \n] { regsub -all {"} $line {\\"} line lappend additionalRowList2 \"$line\" } set additionalRowList [join $additionalRowList2 ,\n] return $additionalRowList } # CreateAdditionalRowList - end # ---------------------------------------------------------------------- # CreatePasswordField proc CreatePasswordField {userName} { global cgi return " " } # CreatePasswordField - end # ---------------------------------------------------------------------- # ReturnRestrictedAccessWarning # returns, if any, the value of the restrictedAccessWarning variable set in the appropriate displayControl.tcl file proc ReturnRestrictedAccessWarning {mirrorRepository documentServerAddress site} { global homePath global env if [string equal {} $mirrorRepository] { set documentDefaultBibliographicMirror [Execute $documentServerAddress [list GetDefaultBibliographicMirror]] } else { set documentDefaultBibliographicMirror $mirrorRepository } set documentMirrorHomePageRep [Execute $documentServerAddress [list GetCitedRepositoryList $documentDefaultBibliographicMirror]] source $homePath/col/$env(MIRROR_HOME_PAGE_REPOSITORY)/doc/displayControl.tcl ;# added by GJFB in 2022-10-10 required to set the list referenceTypeList that migth be used in some sources below, for example when sourcing col/iconet.com.br/banon/2003/05.31.10.26/doc/displayControl.tcl Source http://$site/col/$documentMirrorHomePageRep/doc/displayControl.tcl restrictedAccessWarning 1 ;# set restrictedAccessWarning if [info exists restrictedAccessWarning] { return $restrictedAccessWarning } else { set parentRepList [Execute $documentServerAddress [list GetCitedRepositoryList $documentMirrorHomePageRep]] foreach rep $parentRepList { if [Execute $documentServerAddress [list TestContentType $rep {Submission Form}]] { # a Submission Form Source http://$site/col/$rep/doc/displayControl.tcl restrictedAccessWarning 1 ;# set restrictedAccessWarning if [info exists restrictedAccessWarning] { return $restrictedAccessWarning } break } } } return 0 ;# default } # ReturnRestrictedAccessWarning - end # ---------------------------------------------------------------------- # FindSiteList # used just in Get # site is document site proc FindSiteList {documentMirrorRep site documentServerAddress} { global homePath if [file isdirectory $homePath/col/$documentMirrorRep] { # document site is the current site set siteList {} ;# MultipleSubmit will use currentRep } else { package require http ;# see online manual set token [http::geturl http://$site/col/$documentMirrorRep/doc/@siteList.txt] if ![regexp {200 OK} [http::code $token]] { # file not found - @siteList.txt may not exist set fileContent {} } else { # documentMirrorRep is part of the document site set fileContent [http::data $token] } http::cleanup $token foreach {siteList} [FormatSiteList $fileContent $documentServerAddress] {break} } } # FindSiteList - end # ----------------------------------------------------------------------