lappend tableList $themeTable
}
set reviews [join $tableList \n]
if !$numberOfReviews {
# set reviews ${there are no reviews to release}
set reviewedWorks "
${there are no reviews to release}
"
}
}
set openComment(reviewlist) {}
set closeComment(reviewlist) {}
} else {
set reviewList {}
set openComment(reviewlist) {}
}
set openComment(fullname) {}
set closeComment(fullname) {}
# Create a review list - end
} else {
# read user
set fileTable(accesspage) UserPage
set javaComment(fullname) {//}
set javaComment(theme) {//}
set ifCondition {}
set reviewList {}
set reviews {}
set openComment(reviewlist) {}
set openComment(fullname) {}
set inputRow {}
set openComment(theme) {}
}
set returnAddress http://$localSite/col/$currentRep/doc/mirror.cgi/Register?languagebutton=$language&usertype=$cgi(usertype)&username=$cgi(username)&__e_mailaddress_e_mailaddress=$cgi(__e_mailaddress_e_mailaddress)&formstate=nothingtoupdate
regsub -all { } $returnAddress {+} returnAddress
if 0 {
puts {Content-Type: text/html}
puts {}
puts [array get cgi]
}
# action
set action ${Please wait for the submission completion.}
# seconds
set seconds ""
if {[string compare {no} $cgi(registereduser)] == 0 && \
([string compare {} $cgi(useraction)] == 0 || \
[string compare {register} $cgi(useraction)] != 0)} {
# loginpage
# delayedreturnbutton says if the login page is with or without a return button
set returnButton [CreateReturnButton ../$col/$languageRep2/doc/mirror About $cgi(targetframe) $Cancel {} {} {} {} 0 $cgi(delayedreturnbutton)]
set fileTableEntry loginpage
} else {
if {[string equal {} $cgi(formstate)] && $restrictedSubmission} {
set currentPassword [regexp {register|update|review|seeworks|exportmetadata} $cgi(useraction)]
} else {
set currentPassword [regexp {update|review|seeworks|exportmetadata} $cgi(useraction)]
}
if [string equal {} $cgi(useraction)] {
# cgi(returnaddress) is used by CreateReturnButton when called from xxEnterPassword.html, xxUserPage.html or xxAdvancedUserPage.html
set cgi(returnaddress) Register?languagebutton=$language&usertype=$cgi(usertype)&returnbutton=$cgi(returnbutton)&delayedreturnbutton=$cgi(delayedreturnbutton)&targetframe=$cgi(targetframe)&username=$cgi(login)®istereduser=no&login=$cgi(login)
if ![string equal {} $cgi(session)] {
# accesspage
if {[info exists {displayTable(User Registration,reviewedworklist)}] || \
[info exists {displayTable(Advanced User Registration,reviewedworklist)}]} {
set openComment(reviewaccess) {}
set closeComment(reviewaccess) {}
} else {
set openComment(reviewaccess) {}
}
set returnButton [CreateReturnButton ../$col/$languageRep2/doc/mirror Register?languagebutton=$language&usertype=$cgi(usertype)&returnbutton=$cgi(returnbutton)&delayedreturnbutton=$cgi(delayedreturnbutton) $cgi(targetframe) $Cancel]
# set returnButton [CreateReturnButton ../$col/$languageRep2/doc/mirror About $cgi(targetframe) $Cancel]
# set returnButton [CreateReturnButton ../$col/$languageRep2/doc/mirror {} $cgi(targetframe) $Cancel {} {} {} {} 1] ;# using history.back()
set fileTableEntry accesspage
} else {
# passwordpage
set currentPassword 1
set fileTable(passwordpage) EnterPassword
set fileTableEntry passwordpage
}
} else {
# user action
# cgi(returnaddress) is used by CreateReturnButton when called from xxEnterPassword.html, xxUserPage.html, xxAdvancedUserPage.html or xxRegister.html
# puts [array get cgi]
if {[string equal {register} $cgi(useraction)] || \
![string equal {} $cgi(initialaction)] || \
[string equal {} $cgi(session)]} {
# returning to the loginpage
# set cgi(returnaddress) Register?languagebutton=$language&usertype=$cgi(usertype)&returnbutton=$cgi(returnbutton)&delayedreturnbutton=$cgi(delayedreturnbutton)&targetframe=$cgi(targetframe)&username=$cgi(login)&session=$cgi(session)®istereduser=no&login=$cgi(login)&useraction=$cgi(useraction)&initialaction=$cgi(initialaction)&displayedfieldlist=$displayedFieldList2
# set cgi(returnaddress) Register?languagebutton=$language&usertype=$cgi(usertype)&returnbutton=$cgi(returnbutton)&delayedreturnbutton=$cgi(delayedreturnbutton)&targetframe=$cgi(targetframe)®istereduser=no&useraction=$cgi(useraction)&initialaction=$cgi(initialaction)&displayedfieldlist=$displayedFieldList2
set cgi(returnaddress) Register?languagebutton=$language&usertype=$cgi(usertype)&returnbutton=$cgi(returnbutton)&delayedreturnbutton=$cgi(delayedreturnbutton)&targetframe=$cgi(targetframe)&useraction=update&initialaction=$cgi(initialaction)&displayedfieldlist=$displayedFieldList2
} else {
# returning to the accesspage
set cgi(returnaddress) Register?languagebutton=$language&usertype=$cgi(usertype)&returnbutton=$cgi(returnbutton)&delayedreturnbutton=$cgi(delayedreturnbutton)&targetframe=$cgi(targetframe)&username=$cgi(login)&session=$cgi(session)®istereduser=$cgi(registereduser)&login=$cgi(login)
}
if [regexp {register|update|review} $cgi(useraction)] {
# register update review
# puts [array get cgi]
# Create a reviewed work list
if {![string equal {} $cgi(username)] && \
[info exists {displayTable(User Registration,reviewedworklist)}] && \
![info exists cgi(passworderror)]} {
set themeLabelForQuery * ;# all
# QUERY
set query "usergroup, $cgi(username) and keywords, review and documentstage, closed"
# puts $query
set reviewList2 [FindMetadataRepositories $query 0 [list $serverAddressWithIP] $codedPassword]
if 0 {
set reviewedWorkList {}
foreach item $reviewList2 {
SetFieldValue $serverAddressWithIP $item {parentrepositories}
set workMetadataRep [Execute $serverAddressWithIP [list FindMetadataRep $parentrepositories]]
SetFieldValue $serverAddressWithIP $workMetadataRep-0 {title repository}
lappend reviewedWorkList "[lrange [split $title] 0 4][expr [llength [split $title]] > 5?{ ...}:{}]"
}
set reviewedWorks [join $reviewedWorkList ]
if {[string compare {} $reviewedWorkList] == 0} {
set reviewedWorks ${there are no reviews to display}
}
set numberOfReviewedWorks [llength $reviewedWorkList]
} else {
# display by subject, session, theme or format
# referenceField value is subject, session, type, tertiarytype or {}
if ![info exists referenceFielreviewsd] {
set referenceField {}
}
if {[string compare {} $referenceField] == 0} {
set {} x ;# used below in subst $$referenceField
}
if [info exist themeArray] {unset themeArray}
# puts --$reviewList2--
foreach item $reviewList2 {
SetFieldValue $serverAddressWithIP $item {parentrepositories}
set parentWorkRepository [Execute $serverAddressWithIP [list FindMetadataRep $parentrepositories]]
SetFieldValue $serverAddressWithIP $parentWorkRepository-0 [subst "$referenceField title author repository"]
lappend themeArray([subst $$referenceField]) [list $title $author $repository]
}
set tableList {}
set numberOfReviewedWorks 0
# puts --[array names themeArray]--
foreach theme [array names themeArray] {
set themeTable "
lappend tableList $themeTable
}
set reviewedWorks [join $tableList \n]
if !$numberOfReviewedWorks {
# set reviewedWorks ${there are no reviews to display}
set reviewedWorks "
${there are no reviews to display}
"
}
}
}
# Create a reviewed work list - end
} elseif {![string equal {} $cgi(session)] && [string equal {seeworks} $cgi(useraction)]} {
# seeworks
# QUERY
# puts $currentRep
set conferenceName [lindex $displayTable(Conference Proceedings,%B) 2]
# puts --$conferenceName--
if [string equal {} $conferenceName] {
# set query "mark 1 or not mark * and username, $cgi(username) and mirrorrepository, $currentRep"
set query "username, $cgi(username)"
} else {
regsub -all { and | and, } $conferenceName { } conferenceNameForQuery ;# in case of the english language
# set query "mark 1 or not mark * and username, $cgi(username) and mirrorrepository, $currentRep and conferencename, $conferenceNameForQuery"
# set query "username, $cgi(username) and conferencename, $conferenceNameForQuery"
set query "username, $cgi(username) and mirrorrepository $currentRep and conferencename, $conferenceNameForQuery"
}
# set query {usern banon and rep urlib.net/www*}
# set workList2 [FindMetadataRepositories $query 0 [list $serverAddressWithIP] $codedPassword] ;# adm coded password to see the hidden records as well
set workList2 [FindMetadataRepositories $query 0 {} $codedPassword no no 1] ;# adm coded password to see the hidden records as well
# puts --$workList2--
if [string equal {no} $cgi(returnbutton)] {
# open a new window
set target { TARGET=_blank}
} else {
set target {}
}
# translationTable
source ../$col/$languageRep2/doc/mirror/${language}ReferenceTypeName.tcl ;# set translationTable
set referenceTypeList {}
foreach item $workList2 {
# puts $item
foreach {site rep-i} $item {break} ;# site is actually serverAddress
# SetFieldValue $serverAddressWithIP $item {title author editor programmer reporter repository mirrorrepository childrepositories referencetype nextedition mark size}
SetFieldValue $site ${rep-i} {title author editor programmer reporter repository metadatarepository index mirrorrepository childrepositories referencetype nextedition mark size}
lappend referenceTypeList $referencetype
set author [EscapeUntrustedData $author] ;# added by GJFB in 2018-06-14
set author2 {}
foreach name $author {
regsub {,$} $name {} name
lappend author2 $name
}
if {[string compare {} $author] == 0} {
foreach name $editor {
regsub {,$} $name {} name
lappend author2 $name
}
}
foreach name $programmer {
regsub {,$} $name {} name
lappend author2 $name
}
foreach name $reporter {
regsub {,$} $name {} name
lappend author2 $name
}
set author2 [join $author2 {; }]
if {[string compare {} $author2] == 0} {set author2 {-}}
set buttonList {}
# window
regsub -all {/} ${currentRep}___$metadatarepository {__} window
regsub -all {\.|@|-} $window {_} window
set window ${window}___$index
regsub { } $site {+} site2
# http://plutao.dpi.inpe.br/col/dpi.inpe.br/plutao@80/2008/08.19.15.01.21/doc/mirrorget.cgi?languagebutton=pt-BR&metadatarepository=dpi.inpe.br/banon-pc@1905/2005/02.19.00.40.44&index=0&serveraddress=plutao.dpi.inpe.br+800&choice=fullbibtex&lastupdate=2013:07.16.22.42.14+dpi.inpe.br/banon/1999/01.09.22.14+banon+{D+{}}&continue=yes
# http://bibdigital.sid.inpe.br/col/sid.inpe.br/bibdigital@80/2006/04.07.15.50.13/doc/mirrorget.cgi?languagebutton=pt-BR&metadatarepository=sid.inpe.br/mtc-m19/2013/08.01.19.43.38&index=0&serveraddress=mtc-m19.sid.inpe.br+800&choice=fullbibtex&lastupdate=2013:08.01.20.04.43+sid.inpe.br/mtc-m19@80/2009/08.21.17.02+administrator+{D+2012}&continue=no
lappend buttonList "BibTeX"
if {![string equal {Conference Proceedings} $referencetype] || \
![info exists {closedUpdateTable(Conference Proceedings)}] || \
!$closedUpdateTable(Conference Proceedings)} {
# update button
if [string equal {no} $cgi(returnbutton)] {
# drop return address
lappend buttonList "$update2"
} else {
lappend buttonList "$update2"
}
}
if {[info exists displayReviewButton] && $displayReviewButton} {
# review button
set reviewButton [CreateReviewButton $item $repository $mirrorrepository $childrepositories]
if ![string equal {} $reviewButton] {
lappend buttonList [subst $reviewButton]
}
}
if {[string equal {Conference Proceedings} $referencetype] && \
[string equal {} $nextedition] && \
![string equal {} $mark] && $mark && \
[info exists addAudiovisualMaterialSubmissionOption] && $addAudiovisualMaterialSubmissionOption} {
# audiovisual material button
lappend buttonList "$submit $translationTable(Audiovisual Material)"
}
set title [EscapeUntrustedData $title] ;# added by GJFB in 2018-06-14
if [string equal {} $size] {
set titleLine $title
} else {
set titleLine "$title"
}
lappend $referencetype "
$titleLine
$author2
[join $buttonList { | }]
"
}
if [string equal {} $referenceTypeList] {
append works "
"
}
}
} elseif {![string equal {} $cgi(session)] && \
[string equal {exportmetadata} $cgi(useraction)]} {
# exportmetadata
source ../$col/$URLibServiceRepository/doc/utilities3.tcl ;# DisplaySearch
# puts [array get cgi]
set fullName [join [GetUserData $userName write {fullname2}]]
set CPF [GetUserData $userName write {cpf}]
# puts [GetUserData banon@dpi.inpe.br write {cpf}]
# puts $cgi(contents)
foreach item $cgi(contents) {
# puts $item
# puts $cgi(outputformat)
foreach {searchExpression sectionTitle} $item {break}
# puts $searchExpression
set searchExpression "referencetype, Journal Article or referencetype, Conference or referencetype, Book Section and author, $fullName and $searchExpression"
# linType values are 0, 1, ..., 9
#
# 0 is for absolute link with col (default)
# 1 is for absolute link with rep
# 2 is for absolute link with rep-
# 3 is for relative link with ../../../../..
# 4 is for relative link with ../../../../../../col
# 5 is for relative link with goto
# 6 is for relative link with goto-
# 7 is for no link
# 8 is for absolute link http://urlib.net/
# 9 is for absolute link http://urlib.net/rep/
# set searchExpression "y 2013"
# ---------------------------------------------------
set accent {yes}
set case {yes}
set choice {briefTitleAuthorMisc}
set title "
$sectionTitle (\$numberOfEntries)
"
set excludedFields {}
set localSearch {0}
set numbering {}
set siteList [ComputeSiteList]
set page {no}
set linkType {1}
set displayEverything {1}
set sort {}
# set outputFormat {referencetype checkbox}
set outputFormat $cgi(outputformat)
# set targetValue {_blank} ;# commented by GJFB in 2013-06-18
set targetValue {_parent} ;# added by GJFB in 2013-06-18 in order to navigate from the same window
set mirrorRep {}
set nameFormat {short}
set nameSeparator {; } ;# default
set latexOptionList {}
set multipleSearch {0}
set imageFlag {0}
# DISPLAYSEARCH
lappend searchResult [DisplaySearch $searchExpression $accent $case $choice $title $excludedFields $localSearch $numbering $siteList $page $linkType $displayEverything $sort $outputFormat $targetValue $mirrorRep $nameFormat $nameSeparator $latexOptionList $multipleSearch $imageFlag]
}
}
set fileTableEntry $cgi(useraction)
}
}
# LOAD
# puts $fileTableEntry
# => passwordpage
# => accesspage
# => update
# puts $fileTable($fileTableEntry)
# => EnterPassword
# => AdvancedUserPage
# => EnterPassword or Register
set currentFileName [FindCurrentHTMLFileName $fileTable($fileTableEntry)]
# puts $currentFileName
Load $currentFileName fileContent
if [string equal {EnterLogin} $fileTable($fileTableEntry)] {
set loginFieldName "${eMail Address}"
}
if [string equal {EnterPassword} $fileTable($fileTableEntry)] {
# formAction is used in register.tcl to make the Return Button for wrong password warning
set formAction http://$localSite/col/$currentRep/doc/mirror.cgi/Register?$env(QUERY_STRING)
if {[info exists {submissionPolicyTable(Conference Proceedings)}] && \
$submissionPolicyTable(Conference Proceedings) == 2} {
# create a password for the user
set loginFieldName "${eMail Address}"
} else {
set loginFieldName "$User"
}
if ![string equal {} $cgi(login)] {
set loginRow "
${cellFont}$loginFieldName (Login)
$cgi(login)
"
} else {
set loginRow "
${cellFont}$loginFieldName (Login)
"
}
}
if [string equal {Register} $fileTable($fileTableEntry)] {
if [regexp {^([^<\s@]+)@([^@\s>]+)$} $cgi(login)] {
# login is an e-mail address
set cgi(__e_mailaddress_e_mailaddress) $cgi(login) ;# new procedure - user name must be an e-mail address
} else {
# set cgi(__e_mailaddress_e_mailaddress) {}
}
# set displayEMailField [expr \
[string compare $cgi(__e_mailaddress_e_mailaddress) $cgi(login)] != 0 && \
(![info exists cgi(passworderror)] || !$cgi(passworderror)) && \
[string compare {yes} $cgi(displayemailfield)] == 0]
set displayEMailField [expr [string compare $cgi(__e_mailaddress_e_mailaddress) $cgi(login)] != 0]
}
# Used by JavaScript
# if ![info exists cgi(wrongpassword)] {set cgi(wrongpassword) {no}}
set cgi(wrongpassword) {no}
# Used by JavaScript - end
if [string equal {administrator} $cgi(username)] {set cgi(username) {}}
# puts $currentFileName
# => c:/users/geral/urlib 2/col/dpi.inpe.br/banon/1999/06.19.22.43/doc/pt-BREnterPassword.html
# => c:/users/geral/urlib 2/col/dpi.inpe.br/banon/1999/06.19.22.43/doc/pt-BREnterAdmPassword.html
# puts $fileTable($fileTableEntry)
if [regexp {EnterPassword|EnterAdmPassword|Register} $fileTable($fileTableEntry)] {
# sessionTime
# symmetricKey
# regexp {(.*)-(.*)} [OpenSession $env(REMOTE_ADDR) symmetricKey] m sessionTime symmetricKey
foreach {sessionTime symmetricKey} [OpenSession [list $env(REMOTE_ADDR) administrator] symmetricKey] {break}
}
# SUBST
# catch {subst $fileContent} output ;# returnButton is set in xxRegister.html
set output [subst $fileContent] ;# returnButton is set in xxRegister.html
# set output $fileContent ;# returnButton is set in xxRegister.html
}
^BannerSpace$ {
set output [CreateBannerSpace $languageRep2 $language]
}
^Form$ {
if [file exists ../$col/$languageRep1/doc/${language}Form.html] {
Load ../$col/$languageRep1/doc/${language}Form.html body
} else {
Load ../$col/$languageRep2/doc/${language}Form.html body
}
# Add Banner with INPE filter
if 0 {
if ![regexp {^150.163} $env(IP_ADDR)] {
regsub {([Hh][Ee][Aa][Dd])>} $body "[BannerScript ../mirror.cgi/BannerSpace]\\1>" body
}
}
# Add Banner with INPE filter - end
# puts [array get cgi]
# puts $env(QUERY_STRING)
if [info exists cgi(query)] {
ProcessQuery ;# reset cgi(query)
set formValue $cgi(query)
} else {
set formValue {}
}
# Source displayControl.tcl
set enableOutput 1
eval $sourceDisplayControl
# Source displayControl.tcl - end
# query2
ConditionalSet query2 secondarySearchExpression {} ;# set in displayControl.tcl
if ![info exists cgi(choice)] {set cgi(choice) brief}
if ![info exists cgi(sort)] {set cgi(sort) key}
if ![info exists cgi(accent)] {set cgi(accent) false}
if ![info exists cgi(case2)] {set cgi(case2) false}
# puts --$cgi(choice)--
# puts --$cgi(sort)--
# puts $body
regsub "
$translatedOption
"
} else {
append row "
$translatedOption
"
}
}
# CreateOptionForSelect - end
# ----------------------------------------------------------------------
# CreateCheckBox
# used with Register and Submit
# example of fieldName: %A
# example of field: _A_author
proc CreateCheckBox {fieldName field value varName} {
upvar referenceType referenceType
upvar boxTable boxTable
upvar $varName row
upvar userName userName
set boxValues $boxTable($referenceType,$fieldName)
if {[llength [lindex [lindex $boxValues 0] 1]] <= 1} {
# without subitem
foreach box $boxValues {
if [string equal {} [lindex $box 0]] {continue}
CreateBoxForCheckBox $fieldName $value $field $box ;# appends row
}
} else {
# with subitems (the first item has at least two subitems)
foreach box $boxValues {
append row [lindex $box 0]
foreach box2 [lindex $box 1] {
CreateBoxForCheckBox $fieldName $value $field $box2 ;# appends row
}
append row
}
}
}
# CreateCheckBox - end
# ----------------------------------------------------------------------
# CreateBoxForCheckBox
proc CreateBoxForCheckBox {fieldName fieldValue field box} {
upvar row row
upvar 2 translationTable translationTable
upvar 2 referenceType referenceType
upvar 2 update update
set name [lindex $box 0]
if [info exists translationTable($name,$referenceType,$fieldName)] {
set translatedName $translationTable($name,$referenceType,$fieldName)
} else {
# don't translate
set translatedName $name
}
set checked {}
if [string equal {} $fieldValue] {
if {(![info exists update] || !$update) && [lindex $box 1]} {set checked CHECKED} ;# use default value at submit only
} else {
# puts [list $fieldValue $name]
if {[lsearch $fieldValue $name] != -1} {set checked CHECKED}
}
# append row "  \;$translatedName "
append row " \;$translatedName "
}
# CreateBoxForCheckBox - end
# ----------------------------------------------------------------------
# AppendLineList
proc AppendLineList {condition label2 {i {}}} {
upvar requiredFieldSymbol requiredFieldSymbol
upvar displayTable displayTable
upvar referenceType referenceType
upvar fieldName fieldName
upvar conditionList conditionList
upvar lineList lineList
upvar optionTable2 optionTable2
upvar submissionType submissionType
upvar update update ;# used in subst (see fillInstruction)
upvar updateOption updateOption ;# used in subst (see fillInstruction)
upvar languageRep1 languageRep1 ;# added by GJFB in 2016-06-05
upvar languageRep2 languageRep2 ;# added by GJFB in 2016-06-05
upvar firstLanguageRep firstLanguageRep ;# added by GJFB in 2016-06-05
upvar submissionFormRep submissionFormRep ;# added by GJFB in 2016-06-05
upvar submissionFormLanguage submissionFormLanguage ;# added by GJFB in 2016-06-05
upvar submissionFormLanguageRep submissionFormLanguageRep ;# added by GJFB in 2016-06-05
upvar submissionType submissionType ;# added by GJFB in 2016-06-05
upvar supervisorList supervisorList ;# added by GJFB in 2016-06-05
upvar userName userName ;# added by GJFB in 2016-06-05
# set fillInstruction [lindex $displayTable($referenceType,$fieldName) 1] ;# commented by GJFB in 2016-06-05
set displayValue [subst $displayTable($referenceType,$fieldName)] ;# added by GJFB in 2016-06-05 - subst added to solve a conditonal display of the mark field in Conference Proceeding form based on a list of supervisors (see SetFieldProperties) - subst is needed when using metaforms, e.g., when displayTable contains expression like: {[expr [lsearch -index 1 $supervisorList $userName] == -1?{[list 0 {} {} {}]}:{[list 3 {} {} {Recomendação do orientador}]}]}
set fillInstruction [lindex $displayValue 1] ;# added by GJFB in 2016-06-05
regsub {\[Help .*\]} $fillInstruction {} fillInstruction
set fillInstruction [subst $fillInstruction] ;# subst is to resolve: [expr $update?{}:{(*)}] (see administrator page script)
if [regexp "$requiredFieldSymbol" $fillInstruction] {
lappend lineList "if ($condition) {fieldNameList += document.$submissionType.$label2$i.value + \"\\\\\\\\\\\\\\\\n\"; i++}"
} else {
if {[info exists optionTable2($referenceType,%@documentstage)] && [regexp {Closed Review} $optionTable2($referenceType,%@documentstage)]} {
lappend lineList "if (document.$submissionType.__documentstage_documentstage.value == \"Closed Review\" && $condition) {fieldNameList += document.$submissionType.$label2.value + \"\\\\\\\\\\\\\\\\n\"; i++}"
}
}
}
# AppendLineList - end
# ----------------------------------------------------------------------
# CompareFieldName
proc CompareFieldName {a b} {
global orderingFieldArray
set a1 [lindex $a 0] ;# %A
set b1 [lindex $b 0]
if {[info exists orderingFieldArray($a1)] && \
[info exists orderingFieldArray($b1)]} {
set a2 $orderingFieldArray($a1)
set b2 $orderingFieldArray($b1)
return [expr $a2<=$b2?-1:1]
} elseif {[info exists orderingFieldArray($a1)] && \
![info exists orderingFieldArray($b1)]} {
return -1
} elseif {![info exists orderingFieldArray($a1)] && \
[info exists orderingFieldArray($b1)]} {
return 1
} else {
return 0
}
}
# CompareFieldName - end
# ----------------------------------------------------------------------
# FindFieldValue
# example:
# FindFieldValue {__group_group} %@group group $referenceType $update
proc FindFieldValue {field fieldName label referenceType update} {
global cgi
global multipleLineReferFieldNamePattern
global multipleLineReferFieldNamePattern2
global multipleLineReferFieldNamePatternForCreator
upvar displayTable displayTable
upvar localMetadataArray localMetadataArray
upvar reviewArray reviewArray
upvar metadataRep metadataRep
upvar repName repName
upvar sourceFieldNameArray sourceFieldNameArray
upvar languageRep1 languageRep1 ;# added by GJFB in 2016-06-05
upvar languageRep2 languageRep2 ;# added by GJFB in 2016-06-05
upvar firstLanguageRep firstLanguageRep ;# added by GJFB in 2016-06-05
upvar submissionFormRep submissionFormRep ;# added by GJFB in 2016-06-05
upvar submissionFormLanguage submissionFormLanguage ;# added by GJFB in 2016-06-05
upvar submissionFormLanguageRep submissionFormLanguageRep ;# added by GJFB in 2016-06-05
upvar submissionType submissionType ;# added by GJFB in 2016-06-05
upvar supervisorList supervisorList ;# added by GJFB in 2016-06-05
upvar userName userName ;# added by GJFB in 2016-06-05
if [info exists cgi(sourcereferencetype)] {
if [info exists sourceFieldNameArray($fieldName)] {
set label2 $sourceFieldNameArray($fieldName)
} else {
set label2 {}
}
} else {
set label2 $label
}
# fieldTypeNumber
if [info exists displayTable($referenceType,$fieldName)] {
# set fieldTypeNumber [subst [lindex $displayTable($referenceType,$fieldName) 0]] ;# commented by GJFB in 2016-06-05
set displayValue [subst $displayTable($referenceType,$fieldName)] ;# added by GJFB in 2016-06-05 - subst added to solve a conditonal display of the mark field in Conference Proceeding form based on a list of supervisors (see SetFieldProperties) - subst is needed when using metaforms, e.g., when displayTable contains expression like: {[expr [lsearch -index 1 $supervisorList $userName] == -1?{[list 0 {} {} {}]}:{[list 3 {} {} {Recomendação do orientador}]}]}
set fieldTypeNumber [lindex $displayValue 0] ;# added by GJFB in 2016-06-05
}
if [info exists cgi($field)] {
if {[regexp {%A|%@resumeid|%@orcid|%@group|%@affiliation|%@electronicmailaddress} $fieldName] && \
[info exists displayTable($referenceType,$fieldName)] && \
[regexp {2.1} [lindex $displayTable($referenceType,%A) 0]] && \
![string equal {Resume} $referenceType] && \
([regexp {%A} $fieldName] || \
([regexp {%@resumeid} $fieldName] && [regexp {^(2.1|4)$} $fieldTypeNumber]) || \
([regexp {%@orcid} $fieldName] && [regexp {^(2.1|4)$} $fieldTypeNumber]) || \
([regexp {%@group} $fieldName] && [regexp {^(2.1|3)$} $fieldTypeNumber]) || \
([regexp {%@affiliation} $fieldName] && [regexp {2.1} $fieldTypeNumber]) || \
([regexp {%@electronicmailaddress} $fieldName] && [regexp {2.1} $fieldTypeNumber]))} {
# multiple creator fields
# change into a list
if {[info exists cgi(passworderror)] && $cgi(passworderror)} {
regsub -all {\s\n} $cgi($field) "\n" value ;# drop extra blank lines (needed when returning after a wrong password)
} else {
set value $cgi($field)
}
set value [split $value \n]
if ![llength $value] {set value {{}}} ;# to avoid zero creator field
# puts --$value--
} else {
set value $cgi($field)
# regsub -all {"} $value {\"} value ;# " -> " - " leads to problem in INPUT VALUE
}
# Store value C:/tmp/aaa binary 0 a
# puts $field--$value--
# regsub -all "\n" $value {} value ;# preserve lines ! (otherwise we get double lines) - doesn't work with multiple creator fields
regsub -all {\s\n} $value "\n" value ;# TEXTAREA adds one blank line between each line
} elseif {$update && [info exists localMetadataArray($metadataRep-0,$label2)]} {
# VALUE
set value $localMetadataArray($metadataRep-0,$label2)
# puts $multipleLineReferFieldNamePattern2
# => A|E|Y|\?|O|@isbn|@lineage|@group|@orcid|@readergroup|@archivist|@sponsor|@resumeid|@affiliation|@supervisor|@electronicmailaddress|@issn|@usergroup
if [regexp $multipleLineReferFieldNamePattern2 $fieldName] {
# multiple line fields
# puts $value
# if [regexp {^%@group|^%@affiliation|^%@electronicmailaddress} $fieldName] #
if ![regexp $multipleLineReferFieldNamePatternForCreator $fieldName] {
set value [MultipleRegsub {,*$} $value {}] ;# drop trailing commas
} else {
# puts $value
# set value [MultipleRegsub {(,.+),$|^([^ ]+),$} $value {\1\2}] ;# drop trailing comma
set value [MultipleRegsub {(,[^()]+),$|^([^ ]+),$|(,.+\(.*\)),$} $value {\1\2\3}] ;# drop trailing comma - added by GJFB in 2018-02-28 to solve cases like {aa, bb (dd, ff),} (-> aa, bb (dd, ff)) and {aa bb (dd, ff),} (-> aa, bb (dd, ff),) - useful when filling out the component field
}
if {[regexp {%A|%@resumeid|%@orcid|%@group|%@affiliation|%@electronicmailaddress} $fieldName] && \
[info exists displayTable($referenceType,$fieldName)] && \
[regexp {2.1} [lindex $displayTable($referenceType,%A) 0]] && \
![string equal {Resume} $referenceType] && \
([regexp {%A} $fieldName] || \
([regexp {%@resumeid} $fieldName] && [regexp {^(2.1|4)$} $fieldTypeNumber]) || \
([regexp {%@orcid} $fieldName] && [regexp {^(2.1|4)$} $fieldTypeNumber]) || \
([regexp {%@group} $fieldName] && [regexp {^(2.1|3)$} $fieldTypeNumber]) || \
([regexp {%@affiliation} $fieldName] && [regexp {2.1} $fieldTypeNumber]) || \
([regexp {%@electronicmailaddress} $fieldName] && [regexp {2.1} $fieldTypeNumber]))} {
# multiple creator fields
# leave as a list
} else {
# puts $fieldName
# puts 1--$value--
if [regexp {%A|%@resumeid|%@orcid|%@group|%@affiliation|%@electronicmailaddress} $fieldName] { ;# 'if' added by GJFB in 2022-06-11 - fieldName like %@usergroup should not be treated as having blank line (for such field, the blanks ( ) are not removed at submit - see function ProcessSubmit)
# in field like resumeid, orcid, group, affiliation and electronicmailaddress some lines might be empty
set value [join $value  \;\n] ;# added by GJFB in 2022-01-25 - preserves empty lines, otherwise they are lost in the form - line originally empty in metadata (e.g. resumeid) must contain a blank ( ) to be displayed correctly in textarea (this blank is removed at submit - see function ProcessSubmit)
} else {
if 1 {
# added by GJFB in 2022-08-04 to fix metadata updated between 2022-01-25 and 2022-06-11 and in Archive with URLibService not updated after 2022-06-11
if [regexp {%@usergroup|%@readergroup} $fieldName] {
# puts --$value--
set nbsp [format %c 160] ;# no-break space
set value [lsort -unique [regsub -all $nbsp $value {}]] ;# drop no-break spaces and duplicates
}
}
set value [join $value \n]
}
# puts 2--$value--
}
} else {
# puts $value
## set value [join $value] ;# doesn't work - lost quotes (")
# regsub -all {"} $value {\"} value ;# " -> " - " leads to problem in INPUT VALUE
# puts $value
if {[string equal {Archival Unit} $referenceType] && [string equal {contents} $label]} {
# contents
set contentsList {}
foreach {searchExpression title} $value {
lappend contentsList [list $searchExpression $title]
}
set value [join $contentsList \n] ;# added by GJFB in 2013-04-13
}
if [regexp $multipleLineReferFieldNamePattern $fieldName] {
# multipleLineReferFieldNamePattern - multipleLineReferFieldNamePattern2 ( = nexthigheunit or previouslowerunit)
if [regexp {^(1.1|4)$} $fieldTypeNumber] {
set value [join $value \n]
}
}
}
# if [regexp {^%T} $fieldName] {
## hide $ in title, ex: cr$30
# regsub -all {\$} $value {\\\\\\\$} value ;# cr$30 -> cr\$30
# }
} elseif {$update && [info exists reviewArray($repName,$fieldName)]} {
set value $reviewArray($repName,$fieldName)
} else {
if {[regexp {%A|%@resumeid|%@orcid|%@group|%@affiliation|%@electronicmailaddress} $fieldName] && \
[info exists displayTable($referenceType,$fieldName)] && \
[regexp {2.1} [lindex $displayTable($referenceType,%A) 0]] && \
![string equal {Resume} $referenceType] && \
([regexp {%A} $fieldName] || \
([regexp {%@resumeid} $fieldName] && [regexp {^(2.1|4)$} $fieldTypeNumber]) || \
([regexp {%@orcid} $fieldName] && [regexp {^(2.1|4)$} $fieldTypeNumber]) || \
([regexp {%@group} $fieldName] && [regexp {^(2.1|3)$} $fieldTypeNumber]) || \
([regexp {%@affiliation} $fieldName] && [regexp {2.1} $fieldTypeNumber]) || \
([regexp {%@electronicmailaddress} $fieldName] && [regexp {2.1} $fieldTypeNumber]))} {
# multiple creator fields
set value {{}}
} else {
set value {}
}
}
# puts --$value--
regsub -all {"} $value {\"} value ;# " -> " - " leads to problem in INPUT VALUE
# regsub -all {\$} $value {\\\\\\$} value ;# $ -> \\\\\\$ ($w$-operator)
# puts $referenceType,$fieldName
# puts [info exists displayTable($referenceType,$fieldName)]
if [info exists displayTable($referenceType,$fieldName)] {
# Process check box type entry
if {$fieldTypeNumber == 2.2} {
# 2.2
# checkbox
set value [TurnIntoList $value]
}
# Process check box type entry - end
# puts "$field = $value"
if [string equal {} $value] {
# set default value (from displayTable)
# set value [lindex $displayTable($referenceType,$fieldName) 2] ;# commented by GJFB in 2016-06-05
set value [lindex $displayValue 2] ;# added by GJFB in 2016-06-05
# puts "$field = $value"
} else {
# puts 1-$value
## use fifteen \ before square brackets (1 + 2 + 4 + 8 = 15 (there are four substitutions)
## in regsub we must double the number of \, that is we need thirty \.
# regsub -all {\[} $value {\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\[} value
# regsub -all {\]} $value {\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\]} value
# use three \ before square brackets (1 + 2 = 3 (there are two substitutions)
# in regsub we must double the number of \, that is we need six \.
# regsub -all {\[} $value {\\\\\\[} value ;# removed by GJFB in 2010-11-26 - doesn't work when using square bracket in the abstract field (e.g., [1])
# regsub -all {\]} $value {\\\\\\]} value ;# removed by GJFB in 2010-11-26 - doesn't work when using square bracket in the abstract field (e.g., [1])
# puts 2-$value
}
if [string equal {readpermission} $label] {
if [string equal {Journal Article} $referenceType] {
if [regexp {deny} $value] {
set value intranet
}
} else {
set value2 [ReturnAllowedIPList $value]
if [regexp {^[\d. ]+$} $value2] {
set value intranet
} else {
set value $value2
}
}
}
}
# puts --$value--
return $value
}
# FindFieldValue - end
# ----------------------------------------------------------------------
# Translate
proc Translate {fieldName label referenceType} {
upvar displayTable displayTable
upvar conversionTable conversionTable
upvar translationTable translationTable
upvar update update ;# used in subst (see fieldTypeNumber)
upvar languageRep1 languageRep1 ;# added by GJFB in 2016-06-05
upvar languageRep2 languageRep2 ;# added by GJFB in 2016-06-05
upvar firstLanguageRep firstLanguageRep ;# added by GJFB in 2016-06-05
upvar submissionFormRep submissionFormRep ;# added by GJFB in 2016-06-05
upvar submissionFormLanguage submissionFormLanguage ;# added by GJFB in 2016-06-05
upvar submissionFormLanguageRep submissionFormLanguageRep ;# added by GJFB in 2016-06-05
upvar submissionType submissionType ;# added by GJFB in 2016-06-05
upvar supervisorList supervisorList ;# added by GJFB in 2016-06-05
upvar userName userName ;# added by GJFB in 2016-06-05
# puts $fieldName
# puts $displayTable($referenceType,$fieldName)
# translatedCustomizedFieldName
# set customizedFieldName [lindex $displayTable($referenceType,$fieldName) 3] ;# commented by GJFB in 2016-06-05
set displayValue [subst $displayTable($referenceType,$fieldName)] ;# added by GJFB in 2016-06-05 - subst added to solve a conditional display of the mark field in Conference Proceeding form based on a list of supervisors (see SetFieldProperties) - subst is needed when using metaforms, e.g., when displayTable contains expression like: {[expr [lsearch -index 1 $supervisorList $userName] == -1?{[list 0 {} {} {}]}:{[list 3 {} {} {Recomendação do orientador}]}]}
set customizedFieldName [lindex $displayValue 3] ;# added by GJFB in 2016-06-05
set translatedCustomizedFieldName {} ;# could be anything
# fieldTypeNumber
# set fieldTypeNumber [subst [lindex $displayTable($referenceType,$fieldName) 0]] ;# commented by GJFB in 2016-06-05
set fieldTypeNumber [lindex $displayValue 0] ;# added by GJFB in 2016-06-05
if [string equal {} $customizedFieldName] {
if {$fieldTypeNumber != 0} {
set translatedCustomizedFieldName $conversionTable($label)
}
} else {
if [info exists translationTable($customizedFieldName,$referenceType,$fieldName)] {
set translatedCustomizedFieldName $translationTable($customizedFieldName,$referenceType,$fieldName)
} else {
# don't translate
set translatedCustomizedFieldName $customizedFieldName
}
}
# translatedFootnoteReference
# set footnoteReference [lindex $displayTable($referenceType,$fieldName) 1] ;# commented by GJFB in 2016-06-05
set footnoteReference [lindex $displayValue 1] ;# added by GJFB in 2016-06-05
set translatedFootnoteReference {} ;# could be anything
if [info exists translationTable($footnoteReference,$referenceType,$fieldName)] {
set translatedFootnoteReference $translationTable($footnoteReference,$referenceType,$fieldName)
} else {
# don't translate
set translatedFootnoteReference $footnoteReference
}
if [string equal {} $translatedFootnoteReference] {set translatedFootnoteReference  \;} ;# empty cell for netscape
return [list $translatedCustomizedFieldName $translatedFootnoteReference]
}
# Translate - end
# ----------------------------------------------------------------------
# CreateOrdinalNumber
proc CreateOrdinalNumber {language number {htmlFlag 1}} {
switch $language {
en {
if $htmlFlag {
switch $number {
1 {return {1st}}
2 {return {2nd}}
3 {return {3rd}}
default {return "$numberth"}
}
} else {
switch $number {
1 {return {1st}}
2 {return {2nd}}
3 {return {3rd}}
default {return "${number}th"}
}
}
}
pt-BR {return "$number°"}
default {return $number}
}
}
# CreateOrdinalNumber - end
# ----------------------------------------------------------------------