transferred}	;# used in CreateFullEntry only - added by GJFB in 2024-07-25 - required when displaying metadata with CreateFullEntry after the search expression 'doc transferre*'
 	global {slides}
 	global {Slides}
	global {Translation by}	;# used in CreateFullBibINPEEntry only
	global {Arrangement}	;# used in CreateFullEntry only
	global {doc Directory Content}	;# used in CreateFullEntry only
	global {source Directory Content}	;# used in CreateFullEntry only
	global {there are no files}	;# used in CreateFullEntry only
if 1 {
# the two lines below have become obsolete since 2011-06-05
	global {agreement Directory Link}	;# used in CreateFullEntry only
	global {directory doesn't exist}	;# ' used in CreateFullEntry only
}
	global {agreement Directory Content}	;# used in CreateFullEntry only
	global {see directory content}	;# used in CreateFullEntry only
	set col ../../../../..
	set URLibServiceRepository $env(URLIB_SERVICE_REP)
	source ../$col/$URLibServiceRepository/doc/utilities1.tcl
	source ../$col/$URLibServiceRepository/doc/cgi/mirrorfind-.tcl
# homePath (used in LoadService, Help and FindLanguage)
	set homePath $env(DOCUMENT_ROOT)
	set currentProcedureName MirrorGet
#	set currentFileName $homePath/col/$URLibServiceRepository/doc/cgi/mirrorget.tcl
	set currentProcedureFileName $homePath/col/$URLibServiceRepository/doc/cgi/mirrorget.tcl
	set pathInfo [file split $env(PATH_INFO)]
# currentRep
	regsub -all { } [lrange $pathInfo 1 4] {/} currentRep	;# mirror
# Find the language and the language repository
# foreach {language languageRep1 languageRep2} [FindLanguage $currentRep] {break}
	foreach {language languageRep1 languageRep2 firstLanguageRep \
	submissionFormRep submissionFormLanguage submissionFormLanguageRep} \
	[FindLanguage $currentRep] {break}
# Find the language and the language repository - end
# administratorUserName
	regsub {@.*$} $env(SERVER_ADMIN) {} administratorUserName
	if [info exists env(QUERY_STRING)] {
		foreach {name value} [split $env(QUERY_STRING) &=] {
			set cgi([DecodeURL $name]) [DecodeURL $value]
		}
	}
	ConditionalSet languageButton cgi(languagebutton) $language	;# added by GJFB in 2022-06-17 - to avoid the need of defining explicitely the language in the URL calling the script mirrorget.cgi - this is after turning the title 'Metadata' a link (see topFull)
	
if 0 {
# test returning field name/value list - not used	
# http://gjfb:1905/urlib.net/www/2013/06.21.00.03:?fieldlist=shorttitle+nexthigherunit
	puts {Content-Type: text/html}
	puts {}
	
	global serverAddress	;# used by SetFieldValue
	
# serverAddress
	set serverAddress [list $env(SERVER_NAME) $env(URLIB_PORT)]	;# local site
	SetFieldValue $serverAddress $cgi(metadatarepository)-0 $cgi(fieldlist)
	set nameValueList {}
	foreach field $cgi(fieldlist) {
		lappend nameValueList $field [set $field]
	}
	puts $nameValueList
	return
}
# display
# set display [subst [GetFrameName $mirrorHomePageRep]]
	set display [GetFrameName]
	source ../$col/$languageRep2/doc/mirror/${language}SearchResult.tcl
	source ../$col/$languageRep2/doc/mirror/${language}FieldName.tcl	;# for full format - array set field::conversionTable
# accessdate
	set accessDate [subst [GetAccessDate $accessDate]]
# if index doesn't exist, we assume 0
	if ![info exists cgi(index)] {set cgi(index) 0}
	set rep-i $cgi(metadatarepository)-$cgi(index)
# if site doesn't exist, we assume the local site
# 	if ![info exists cgi(site)] {set cgi(site) $env(SERVER_NAME):$env(SERVER_PORT)}
# serverAddress
#	if ![info exists cgi(serveraddress)] {set cgi(serveraddress) [list $env(SERVER_NAME) $env(URLIB_PORT)]}
#	set serverAddress $cgi(serveraddress)
	ConditionalSet serverAddress cgi(serveraddress) [list $env(SERVER_NAME) $env(URLIB_PORT)]
# localSite
	set localSite [ReturnHTTPHost $serverAddress]
	
# 	regexp {(.*):(.*)} $site m serverName portNumber
	foreach {serverName urlibPort} [ReturnCommunicationAddress $serverAddress] {break}
# encodingName
	set encodingName [Execute $serverAddress [list GetEncodingName]]
#	set localURLibClientSocketId [StartCommunication $serverName $urlibPort]
#	set localURLibClientSocketId [StartCommunication $serverName $urlibPort 1 utf-8]	;# solves the accent problem - communication from banon-pc3 to plutao - done by GJFB in 2010-07-09 - doesn't work when displaying iconet.com.br/banon/2007/10.27.03.57 in banon-pc3
#	set localURLibClientSocketId [StartCommunication $serverName $urlibPort 1 $encodingName]	;# solves the accent problem - communication from banon-pc3 to plutao - doesn't work when displaying 8JMKD3MGP7W/37RP2TH in m19 from banon-pc3
 	set localURLibClientSocketId [StartCommunication $serverName $urlibPort]	;# added by GJFB in 2010-12-11 - the problems are now solved like in LoopOverEntries (see set entry2 at the end of this procedure)
set repName [Submit $localURLibClientSocketId [list ReturnRepositoryName $cgi(metadatarepository)] 0]	;# not async
# choice=full or fullbibtex or fullrefer (see utilitiesMirror.tcl)
# if choice don't exist, we assume full
if ![info exists cgi(choice)] {set cgi(choice) full}
ConditionalSet keywords cgi(keywords) {}
ConditionalSet accent cgi(accent) yes	;# used to highlight words
ConditionalSet case cgi(case) yes	;# used to highlight words
ConditionalSet outputFormat cgi(outputformat) {}
ConditionalSet imageFlag cgi(imageflag) 1
ConditionalSet serverAddress2 cgi(serveraddress) $serverAddress	;# added by GJFB in 2022-04-16 - used in topFull for arrangement update
ConditionalSet lastUpdate2 cgi(lastupdate) {}	;# added by GJFB in 2022-04-16 - used in topFull for arrangement update
# set mirrorGetFlag 1	;# added by GJFB in 2022-02-07- commented by GJFB in 2022-04-16
ConditionalSet mirrorGetFlag cgi(mirrorgetflag) 0	;# added by GJFB in 2022-04-16 - used in topFull for arrangement update
ConditionalSet continue cgi(continue) {}	;# needed with the short option
set siteList2 {}	;# needed with the short option
if [string equal {brief} $cgi(choice)] {
	puts {Content-Type: text/html}
	puts {}
	puts "MirrorGet error: brief choice is not supported"
	return
}
set returnButton {}	;# used in subst [join $entry \n] when entry comes from CreateBriefTitleAuthorEntry and outputFormat list contains the element update
# EXTRA
# set extra [list $keywords {} {} $env(REMOTE_ADDR)]	;# used when displaying the update link in a full entry
# set extra [list $keywords {} {} $env(REMOTE_ADDR)]	;# used when displaying the update link in a full entry
# set extra [list $keywords {^$} {1} $env(REMOTE_ADDR) {} $outputFormat {} $timeStamp {} {} {} {} {} {} {} {} {} $accent $case {} {} $imageFlag]
# set extra [list $keywords {^$} {1} $env(REMOTE_ADDR) {} $outputFormat {} {} {} {} {} {} {} {} {} {} {} $accent $case {} {} $imageFlag]	;# commented by GJFB in 2022-02-07
set extra [list $keywords {^$} {1} $env(REMOTE_ADDR) {} $outputFormat {} {} {} {} {} {} {} {} {} {} {} $accent $case {} {} $imageFlag $mirrorGetFlag]	;# added by GJFB in 2022-02-07
# set extra [list $keywords $excludedFields 0 $env(REMOTE_ADDR) $numbering $outputFormat $cellBackgroundColor $timeStamp $pageFlag $includeReturnAddress $linkType $hideSimilarButton $targetValue $dateFieldName $siteFieldName $nameFormat $nameSeparator $accent $case $similarity $originalRepForSimilarity $imageFlag]
# currentRep is the current mirror repository
#set entry [Submit $localURLibClientSocketId \
#[list GetEntry ${rep-i} $currentRep $cgi(choice) {} $language $extra] 0]	;# not async
# SUBMIT
set entry [Submit $localURLibClientSocketId \
[list GetEntry ${rep-i} $currentRep $cgi(choice) {} $languageRep2 $extra] 0]	;# not async
close $localURLibClientSocketId
# set xxx --$entry--
# Store xxx C:/tmp/bbb.txt auto 0 a
# puts --$entry-- ;# >>> useful in case of "Document contains no data" <<< may contain an error message
# exit
# puts [list Execute $serverAddress [list GetEntry ${rep-i} $currentRep $cgi(choice) {} $languageRep2 $extra]]
# catch {Execute $serverAddress [list GetEntry ${rep-i} $currentRep $cgi(choice) {} $languageRep2 $extra]} entry
# set metadataLastUpdate2 [lindex $entry 0]
if [catch {lindex $entry 0} metadataLastUpdate2] {
#	puts {Content-Type: text/html}
	puts {Content-Type: text/plain}
	puts {}
	if [regexp {<(.*)>} $entry m entry2] {set entry [join $entry2 \n]}
	puts $entry
#	puts [CallTrace]
	puts {}	;# new line
	puts [CallTrace]
#	exit
	return
}
if {[llength $entry] == 3} {
	set citationMetadaTagList [lindex $entry 1]	 ;# embedded metadata (or just DOI) (for Zotero) - added by GJFB in 2015-10-21 - not in used; see CreateFullBibINPEEntry
}
set entry [lindex $entry end]
if {[info exists cgi(returnbutton)] && \
[string equal {yes} $cgi(returnbutton)] && \
[info exists cgi(lastupdate)]} {
	if ![regexp "$cgi(lastupdate)" $metadataLastUpdate2] {
# Out-of-date
		set output [subst $bodyOutOfDate2]
		puts {Content-Type: text/html}
		puts {}
		puts $output
		return
# Out-of-date - end
	}
}
# a full reference to display
if [regexp {fullXML} $cgi(choice)] {
	set header 0
#	puts {Content-Type: text/xml}	;# commented by GJFB in 2020-06-17
	puts {Content-Type: text/html}	;# added by GJFB in 2020-06-17 - to display the metadata when selecting the full XML search result format in the green field of the mirror page
} else {
	set header 1
	puts {Content-Type: text/html}
}
puts {}
if [regexp {fullXML} $cgi(choice)] {
	puts 	;# added by GJFB in 2020-06-17
#	puts {}
	puts {<?xml version="1.0" encoding="ISO-8859-1"?>}	;# added by GJFB in 2020-06-17
#	puts 
	puts {<metadatalist>}	;# added by GJFB in 2020-06-17
} else {
# SUBST	
	set output [subst $topFull]
	puts $output
	if [regexp {fullbibtex} $cgi(choice)] {
		puts 
	}
}
regsub -all {\[} $entry {\[} entry	;# [ -> \[
regsub -all {\]} $entry {\]} entry	;# ] -> \]
# regsub -all {\\&} $entry {\\\\&} entry	;# \& -> \\&	;# commented by GJFB in 2018-06-14 - with this line CreateBibTeXEntry displays \$z as \\$z - nevertheless, \\$z causes a BibTeX compilation error - \& -> \\& implies \$z -> \\$z that is \$z -> \\$z
if [regexp {fullXML} $cgi(choice)] {	;# added by GJFB in 2020-06-17
	regsub -all {<} $entry {\<} entry	;# < -> < 
	regsub -all {>} $entry {\>} entry	;# > -> > 
}
# Migration - 2009-09-10
	if [string equal {en} $language ] {
		array set field::conversionTable {identificator {Identifier}}
	} else {
		array set field::conversionTable {identificator {Identificador}}
	}
# identicator and identifier are not used any more within metadata repository after 2010
# identifier is used only within data repository
# Migration - 2009-09-10 - end
# puts --$entry--	;# <<< may contain an error message - this error message might contain expression like "expr $previousAreaNumber == 2 && $areaNumber == 3" that produce another error message when applying the subst command below
# puts [join $entry \n]
#	regsub {} $entry {} entry	;# added by GJFB in 2024-07-25 required when displaying metadata with CreateFullEntry after the search expression 'doc transferre*'
if [string equal {utf-8} $encodingName] {
	puts [encoding convertfrom utf-8 [subst [join $entry \n]]]	;# solves the accent problem - added by GJFB in 2010-12-11 - needed when displaying a full reference of plutao (see for example title of J8LNKAN8RW/38JE8FB in plutao (working with utf-8)) from banon-pc3
} else {
	puts [subst [join $entry \n]]	;# needed when displaying a full reference with symbols like – (see for example title of 8JMKD3MGP7W/37RP2TH in m19 (working with iso8859-1)) from banon-pc3
}
if [regexp {fullXML} $cgi(choice)] {
#	puts 
	puts {</metadatalist>}	;# added by GJFB in 2020-06-17
	puts 	;# added by GJFB in 2020-06-17
} else {
	if [regexp {fullbibtex} $cgi(choice)] {
		puts 
	}
	set output [subst $bottomFull]
	puts $output
#	puts [CreateReturnButton 
 $col/$languageRep2/doc/mirror http://$env(HTTP_HOST)/rep/$repName {} $Return]
	puts