}
# puts $displayTable(Audiovisual Material,%C)
# puts $optionTable2(Report,%9)
# puts $optionTable(Report,%9)
if $updateStageOfSubmit {
if {[string equal {Misc} $referenceType] && [regexp {review} $keywords]} {
# review
set displayTable(Misc,%A) [list 1.1 {(*) [Help Name]} {} {Reviewer(s)}]
set displayTable(Misc,%T) [list 4 {} {} {}]
set displayTable(Misc,%D) [list 0 {} {} {}]
set displayTable(Misc,%9) [list 0 {} {} {}]
set displayTable(Misc,%3) [list 0 {} {} {}]
set displayTable(Misc,%K) [list 0 {} {} {}]
set displayTable(Misc,%X) [list 0 {} {} {}]
set displayTable(Misc,%O) [list 4 {} {} {Presentation Format}]
set displayTable(Misc,%U) [list 0 {} {} {}]
set displayTable(Misc,%@parentrepositories) [list 4 {click ->} {} {Work to be Reviewed}]
set displayTable(Misc,%@language) [list 0 {} {} {}]
set displayTable(Misc,%@copyholder) [list 0 {} {} {}]
set displayTable(Misc,%@area) [list 4 {} {} {}]
set displayTable(Misc,%@e-mailaddress) [list 0 {} {} {}]
set displayTable(Misc,%@project) [list 0 {} {} {}]
set displayTable(Misc,%@accessdate) [list 0 {} {} {}]
set displayTable(Misc,%@readpermission) [list 0 {} {} {}]
# set displayTable(Misc,%@documentstage) [list 3 {To Save keep your login and press Update ---- To Send select 'Send Review' and press Update ----(*) [Help NextReview]} {} {Action to be Performed at Update}]
set displayTable(Misc,%@documentstage) [list 3 {(*) [Help NextReview]} {} {Action to be Performed at Update}]
set displayTable(Misc,filename) [list 0 {} {} {x}]
set updateOptionTable(Misc) {update}
set searchBaseTable(Misc) {writeUserArray}
}
}
# if ![info exists cgi(targetframe)] {set cgi(targetframe) $display}
if {[info exists searchOptionTable($referenceType)] && \
[string equal {yes} $searchOptionTable($referenceType)] && \
[string equal {yes} $cgi(frameinuse)]} {
if ![info exists cgi(targetframe)] {set cgi(targetframe) _parent}
} else {
if ![info exists cgi(targetframe)] {set cgi(targetframe) _self}
}
if {[info exists submissionMaintenanceTable($referenceType)] && \
$submissionMaintenanceTable($referenceType)} {
# submission maintenance
if [file exists ../$col/$submissionFormLanguageRep/doc/include/$submissionFormLanguage${referenceType2}SubmissionMaintenance.html] {
# use include
puts [subst [Include ../$col/$submissionFormLanguageRep/doc/include/$submissionFormLanguage${referenceType2}SubmissionMaintenance.html]]
} else {
if [info exists submissionMaintenanceArray($referenceType)] {
# use xxFillingInstructions.tcl
puts [subst $submissionMaintenanceArray($referenceType)]
}
}
return
}
# Closed submission/update
if $update {
# update
if $updateStageOfSubmit {
# Change write user name
if [info exists updatePolicyTable($referenceType)] {
if $updatePolicyTable($referenceType) {
# force update by the alternate user - gives control to the alternate user
ConditionalSet userName2 alternateUserTable($referenceType) {administrator}
} else {
# force update by the author - give control to the author
ConditionalSet alternateUser alternateUserTable($referenceType) {administrator}
regsub $alternateUser $userGroup {} userList ;# drop the alternate user
if {[info exists userNameList($referenceType)] && \
[regexp {update by the author} $userNameList($referenceType)]} {
# update by the author
# Drop from user group the names which are in userNameList
array set userNameTable [subst $userNameList($referenceType)] ;# may use userGroup
set userList2 [GetArrayRange userNameTable]
set userList [ListSubtraction userList userList2] ;# userList - userList2
# Drop from user group the names which are in userNameList - end
}
set userName2 [lindex $userList 0] ;# take the first
}
if ![string equal $userName2 $userName] {
# change userName
set userName $userName2
}
}
# Change write user name - end
# Check session
if {[info exists checkingSessionDataTable($referenceType)] && \
$checkingSessionDataTable($referenceType)} {
# restricted access
# CHECK SESSION
if [info exists localMetadataArray($metadataRep-0,readergroup)] {
set readerGroup $localMetadataArray($metadataRep-0,readergroup)
} else {
set readerGroup {}
}
if {(![info exists cgi(username)] || \
![info exists cgi(session)] || \
[CheckSession $cgi(session) $cgi(username)]) && \
![string equal {} $readerGroup]} {
set returnButton [CreateReturnButton ../$col/$languageRep2/doc/mirror About $cgi(targetframe) $Cancel]
# puts [subst [subst ${closed session}]]
# return
# action
set action ${Please wait for the submission completion.}
# seconds
set seconds " "
set cgi(usertype) {} ;# could be removed ...
set cgi(delayedreturnbutton) {} ;# could be removed ...
set cgi(targetframe) {} ;# could be removed ...
set cgi(useraction) {} ;# could be removed ...
set cgi(username) $userName
set cgi(wrongpassword) {no}
set currentPassword 1
set currentFileName [FindCurrentHTMLFileName EnterPassword]
set updateForRegister 0
set formAction http://$localSite/update$env(PATH_INFO)?$env(QUERY_STRING)
if {[llength $readerGroup] == 1} {
# just one read user
set loginRow "
${cellFont}$User (Login)
$readerGroup
"
} else {
# more than one read user
set loginRow "
${cellFont}$User (Login)
"
# puts $userGroup
foreach user $readerGroup {
if [string equal $userName $user] {
append loginRow " $user
"
} else {
append loginRow " $user
"
}
}
append loginRow "
"
}
Load $currentFileName body
# set output [subst $body]
set output [subst [subst [subst [subst $body]]]] ;# more subtitutions are needed to resolve the content of $action
puts $output
return
}
}
# Check session - end
}
if {(([info exists closedUpdateTable($referenceType)] && \
$closedUpdateTable($referenceType)) || \
([info exists localMetadataArray($metadataRep-0,childrepositories)] && \
[info exists forceAssignedPaperUpdateTable($referenceType)] && \
!$forceAssignedPaperUpdateTable($referenceType))) && \
![string equal {administrator} $userName] && \
(![string equal {Misc} $referenceType] || [regexp {review} $keywords])} {
# closed update
if [file exists ../$col/$submissionFormLanguageRep/doc/include/$submissionFormLanguage${referenceType2}ClosedUpdate.html] {
# use include
puts [subst [Include ../$col/$submissionFormLanguageRep/doc/include/$submissionFormLanguage${referenceType2}ClosedUpdate.html]]
} else {
# use default include
puts [subst [Include ../$col/$languageRep2/doc/include/${language}${referenceType2}ClosedUpdate.html]]
}
return
}
} else {
# submit
if {[info exists closedSubmissionTable($referenceType)] && \
$closedSubmissionTable($referenceType)} {
# closed submit
if [file exists ../$col/$submissionFormLanguageRep/doc/include/$submissionFormLanguage${referenceType2}ClosedSubmission.html] {
# use include
puts [subst [Include ../$col/$submissionFormLanguageRep/doc/include/$submissionFormLanguage${referenceType2}ClosedSubmission.html]]
} else {
# use default include
puts [subst [Include ../$col/$languageRep2/doc/include/${language}${referenceType2}ClosedSubmission.html]]
}
return
}
}
# Closed submission/update - end
# requiredFieldSymbol and requiredFieldAtCloseSymbol
set requiredFieldSymbol $requiredFieldFootnoteTable($referenceType) ;# e.g., (*)
regsub -all {(\*|\+)} $requiredFieldSymbol {\\\1} requiredFieldSymbol ;# requiredFieldSymbol is used in regular expression
if [info exists requiredFieldAtCloseFootnoteTable($referenceType)] {
set requiredFieldAtCloseSymbol $requiredFieldAtCloseFootnoteTable($referenceType) ;# e.g., (*)
regsub -all {(\*|\+)} $requiredFieldAtCloseSymbol {\\\1} requiredFieldAtCloseSymbol ;# requiredFieldAtCloseSymbol is used in regular expression
}
# Create cgi array
# usefull to recover the filled fields after a submit error
CreateCGIArray ;# updates returnInfo
# Create cgi array - end
# puts [array names cgi]
# puts [array get cgi]
if {[info exists cgi(returnaddress)] && ![string equal {} $cgi(returnaddress)]} {
if $update {
if [info exists cgi(lastupdate)] {
set metadataLastUpdate $localMetadataArray($metadataRep-0,metadatalastupdate)
regsub -all {\+} $cgi(lastupdate) { } metadataLastUpdate2 ;# as in Submit
# puts [list $metadataLastUpdate $metadataLastUpdate2]
if ![regexp "$metadataLastUpdate" $metadataLastUpdate2] {
# out-of-date search
puts [subst [subst ${out-of-date search}]]
return
}
}
}
}
# puts $cgi(frameinuse)
# puts [info exists cgi(returntype)]
# Search option
if {[info exists searchOptionTable($referenceType)] && \
[string equal {yes} $searchOptionTable($referenceType)] && \
[string equal {no} $cgi(frameinuse)] && \
![info exists cgi(returntype)]} {
# SEARCH OPTION - create frame set
set frameHeight 32
if $update {
# update
set metadataList [Execute $serverAddressWithIP [list GetMetadata $metadataRep-*]]
array set localMetadataArray $metadataList
set repName $localMetadataArray($metadataRep-0,repository)
if ![file exists $homePath/col/$repName/service/userName] {
set header ${update header}
set returnButton [CreateReturnButton ../../../../col/$languageRep2/doc/mirror ../../../../col/$currentRep/doc/mirror.cgi/About $display $Cancel]
puts [subst [subst ${no user name for update}]]
return
}
set {search option} ${search option for update}
} else {
# submit
set {search option} ${search option for submit}
}
set queryString frameinuse=yes&$env(QUERY_STRING)
set output [subst ${search option}]
# puts OK ;# to see the frame set
puts $output
exit
}
# Search option - end
# changing return button default
# must be after the above CreateReturnButton
if ![info exists cgi(returnbutton)] {set cgi(returnbutton) {no}}
# attachment
# puts [info exists cgi(attachment)]
# puts [lindex $displayTable($referenceType,filename) 0]
if [regexp {0} [lindex $displayTable($referenceType,filename) 0]] {
if ![info exists cgi(attachment)] {set cgi(attachment) no}
}
if ![info exists cgi(attachment)] {set cgi(attachment) yes}
# puts $cgi(attachment)
# puts 3==$returnInfo
if ![regexp {.\?} $returnInfo] {
# doesn't contain return address
append returnInfo "&attachment=$cgi(attachment)"
append returnInfo "&returnbutton=$cgi(returnbutton)"
# returnaddress must be the last field in the returnInfo string because of the second ?
if {[info exists cgi(returnaddress)] && [string compare {} $cgi(returnaddress)] != 0} {
append returnInfo "&returnaddress=$cgi(returnaddress)"
if 0 {
if {[info exists cgi(username)] && [info exists cgi(session)]} {
append returnInfo "&username=$cgi(username)" ;# to maintain username
append returnInfo "&session=$cgi(session)" ;# to maintain session
}
}
}
}
# puts 4==$returnInfo
# puts [array get cgi]
# puts [info exists cgi(returnbutton)]
# if {[info exists cgi(returnbutton)] && \
# [string compare {no} $cgi(returnbutton)] == 0} {
### changing return button default
## if {[string compare {no} $cgi(returnbutton)] == 0}
# set cgi(targetframe) {""}
# }
# returnButton
# puts [info exists cgi(returnaddress)]
# puts
# puts [info exists cgi(returnbutton)]
# puts
# puts $display
# puts [array get cgi]
# if {([info exists cgi(returnaddress)] || !$update) && \
# (![info exists cgi(returnbutton)] || [string compare {no} $cgi(returnbutton)] != 0)}
# returnButton
if [string equal {yes} $cgi(returnbutton)] {
# add cancel button
set cgi(returnaddress) $cgi(returnaddress)&hidesimilarbutton=$cgi(hidesimilarbutton)
# puts $cgi(returnaddress)
set returnButton [CreateReturnButton http://$localSite/col/$languageRep2/doc/mirror {} $cgi(targetframe) $Cancel]
# set returnButton [CreateReturnButton http://$localSite/col/$languageRep2/doc/mirror {} $cgi(targetframe) $Cancel {} {} {} {} 1] ;# doesn't work, the browser returns a "page has expired" canceling update after a password error
} else {
set returnButton {}
}
# updateOption (is used at submit and update)
if ![string equal {} $cgi(updateoption)] {
set updateOption $cgi(updateoption)
} else {
ConditionalSet updateOption updateOptionTable($referenceType) {all}
}
if $update {
# update
if [info exists cgi(_(_previousedition)] {
# ignore targetfile, documentstage and notes of the previous edition
if [info exists localMetadataArray($metadataRep-0,targetfile)] {unset localMetadataArray($metadataRep-0,targetfile)}
if [info exists localMetadataArray($metadataRep-0,documentstage)] {unset localMetadataArray($metadataRep-0,documentstage)}
if [info exists localMetadataArray($metadataRep-0,notes)] {unset localMetadataArray($metadataRep-0,notes)}
if [info exists documentStage] {unset documentStage}
}
# targetFile
# targetFileExtension
if [info exists localMetadataArray($metadataRep-0,targetfile)] {
set targetFile $localMetadataArray($metadataRep-0,targetfile)
set targetFileExtension [string trimleft [file extension $targetFile] .]
}
# ifConditionForRemoveBeforeUpdate
if [string equal {all} $updateOption] {
# all
ConditionalSet updateType cgi(updatetype) {update} ;# default is update
if [info exists depositOptionTable($referenceType)] {
array set depositOptionArray $depositOptionTable($referenceType)
}
ConditionalSet copyToSource depositOptionArray(copytosource) 0
# updateOptionList
set updateOptionList {Update}
lappend updateOptionList {Update Submission Agreement} ;# added by GJFB in 2010-12-05
if [string equal {Electronic Source} $referenceType] {
set ifConditionForRemoveBeforeUpdate 0
} else {
if $copyToSource {
lappend updateOptionList {Remove before Update and don't Copy to Source} {Remove before Update} Add {Add and Copy}
set ifConditionForRemoveBeforeUpdate {document.update.userfile.value != "" && (document.update.updatetype\\\\\\\[2\\\\\\\].selected || document.update.updatetype\\\\\\\[3\\\\\\\].selected)}
} else {
lappend updateOptionList {Remove before Update} Add {Add and Copy}
set ifConditionForRemoveBeforeUpdate {document.update.userfile.value != "" && document.update.updatetype\\\\\\\[2\\\\\\\].selected}
}
}
# if [TestContentType $repName {^Tcl Page$} $homePath] #
if {[info exists targetFile] && (([info exists targetFileExtension] && \
[regexp -nocase {tex} $targetFileExtension]) || \
[TestContentType $repName {^Tcl Page$|^Index$|^CGI Script$} $homePath])} {
# .tex target file or Tcl Page, Index, CGI Script
lappend updateOptionList {Run}
}
lappend updateOptionList {Finish}
set updateMenu {}
append updateMenu "
"
append updateMenu " (?) "
# set buttonName OK ;# for old customized pages (xxFillingInstruction.tcl)
# set buttonName1 ${Save/Check}
# set buttonName2 ${Save/Exit}
} else {
# not all
set ifConditionForRemoveBeforeUpdate 0
set updateMenu "
"
# set buttonName ${Update}
}
set buttonName ${Update}
set buttonName1 ${Save/Check}
set buttonName2 ${Save/Exit}
} else {
# submit
if [string equal {all} $updateOption] {
# all
set buttonName ${Submit} ;# for old customized pages (xxFillingInstruction.tcl)
# set buttonName1 ${Accept/Save/Check}
# set buttonName2 ${Accept/Save/Exit}
set buttonName1 ${Save/Check}
set buttonName2 ${Save/Exit}
} else {
# not all
set buttonName ${Submit}
}
set buttonName ${Submit}
set buttonName1 ${Save/Check}
set buttonName2 ${Save/Exit}
}
# onClickExit
if {$restrictedSubmission || \
([info exists submissionPolicyTable($referenceType)] && $submissionPolicyTable($referenceType) == 1)} {
set restrictedSubmission2 1
} else {
set restrictedSubmission2 0
}
set onClickCheck2 "ONCLICK='ProcessSubmit(0, 0, 0, 0, 0, 0, 0, 1)'" ;# check
set onClickExit2 "ONCLICK='ProcessSubmit(0, 0, 0, 0, 0, 0, 0, 0)'" ;# exit
if {[info exists displayTable($referenceType,username)] && \
[lindex $displayTable($referenceType,username) 0] || \
$update} {
set onClickCheck "ONCLICK='ProcessSubmit(1, document.$submissionType.username.value, document.$submissionType.password1.value, $update, 1, $restrictedSubmission, 0, 1)'" ;# check
# set onClickExit "ONCLICK='ProcessSubmit(1, document.$submissionType.username.value, document.$submissionType.password1.value, $update, 1, $restrictedSubmission, 0, 0)'" ;# exit
set onClickExit "ONCLICK='ProcessSubmit(1, document.$submissionType.username.value, document.$submissionType.password1.value, $update, 1, $restrictedSubmission2, 0, 0)'" ;# exit
} else {
# submission without login (e.g., SBSR)
set onClickExit $onClickExit2
}
if [string equal {all} $updateOption] {
set documentWriteToProcessKey "document.write (\" \")"
set documentWrite "document.write (\" \")"
} else {
# ID name must not be Submit - Submit is a reserved word for IE7/8
set documentWriteToProcessKey "document.write (\" \")"
set documentWrite "document.write (\" \")"
}
if [string equal {} $referenceType] {set referenceType Misc}
# fieldList
# {%@doi doi} {%F label} {%L callnumber}
set fieldList [Execute $serverAddressWithIP [list ReturnReferModel $referenceType]]
# puts $referenceType
# puts $fieldList
# puts $language
# Migration 25/1/04
# fileTypeWarning
if {[info exists contentTypeTable($referenceType)] && \
[info exists fileTypeWarningArray($referenceType)] && \
![string equal {} $contentTypeTable($referenceType)]} {
set contentTypeList [join $contentTypeTable($referenceType) ]
set fileTypeWarning $fileTypeWarningArray($referenceType)
} else {
set fileTypeWarning {}
}
# Migration 25/1/04 - end
# Security issue
if ![info exists permissionList] {set permissionList {}}
lappend permissionList $env(IP_ADDR)
set found [AllowedRemoteAddress $permissionList]
if {!$found && \
[lsearch -exact $permissionList {All Sites}] == -1 && \
[lsearch -exact $permissionList {All IPs}] == -1} {
# not found
if [info exists returnAddress] {set cgi(returnaddress) $returnAddress} ;# returnAddress may be defined in displayControl.tcl
if $update {
set header ${update header}
puts [subst [subst ${forbidden update}]]
} else {
set header ${submission header}
puts [subst [subst ${forbidden submission}]]
}
return
}
if [Execute $serverAddressWithIP Check-htpasswd] {
puts {htpasswd program not found}
return
}
if {!$update && [string equal {127.0.0.1} $env(REMOTE_ADDR)]} {
set header ${submission header}
puts [subst [subst ${disabled submission}]]
return
}
# Security issue - end
# Migration 25/1/04
# footnoteNumber
if [info exists initialFootnoteNumberTable($referenceType)] {
set footnoteNumber $initialFootnoteNumberTable($referenceType)
incr footnoteNumber -1
}
# Migration 25/1/04 - end
# Process review data
# append review fields to fieldList
if {[info exists optionTable2($referenceType,%@documentstage)] && [regexp {Closed Review} $optionTable2($referenceType,%@documentstage)]} {
if $update {
# update
if [file exists ../$col/$repName/doc/.reviewArray.tcl] {
# source ../$col/$repName/doc/.reviewArray.tcl
# array set reviewArray {iconet.com.br/banon/2004/06.13.00.36,avaliacao 1 iconet.com.br/banon/2004/06.13.00.36,clareza 3 iconet.com.br/banon/2004/06.13.00.36,relevancia 1 iconet.com.br/banon/2004/06.13.00.36,conclusiva 1 iconet.com.br/banon/2004/06.13.00.36,consistencia 1 iconet.com.br/banon/2004/06.13.00.36,qualidadegrafica 1 iconet.com.br/banon/2004/06.13.00.36,comentarioeditor {} iconet.com.br/banon/2004/06.13.00.36,comentarioautor {} iconet.com.br/banon/2004/06.13.00.36,aprovacao {} iconet.com.br/banon/2004/06.13.00.36,adequacao 1}
# array set reviewArray {iconet.com.br/banon/2006/11.01.23.55,commentsfortheauthors {} iconet.com.br/banon/2006/11.01.23.55,summaryofthepaper {} iconet.com.br/banon/2006/11.01.23.55,presentation {} iconet.com.br/banon/2006/11.01.23.55,recommendation {} iconet.com.br/banon/2006/11.01.23.55,technicalsoundness {} iconet.com.br/banon/2006/11.01.23.55,confidenceintheevaluation {} iconet.com.br/banon/2006/11.01.23.55,overallrating {} iconet.com.br/banon/2006/11.01.23.55,commentsfortheprogramcommitteeonly {} iconet.com.br/banon/2006/11.01.23.55,originality {} iconet.com.br/banon/2006/11.01.23.55,significance {}}
if [catch {source ../$col/$repName/doc/.reviewArray.tcl} error] {
puts "error in sourcing file <\;$env(DOCUMENT_ROOT)/col/$repName/doc/.reviewArray.tcl>\; :"
puts
puts $error
}
foreach index [lsort -command FieldCompare [array names reviewArray]] {
regsub {.*,} $index {} fieldName
lappend fieldList [list $fieldName $fieldName]
}
}
}
}
# Process review data - end
if $update {
# submissionDestination
# used when closing an ePrint
# current destination
set submissionDestination $env(SERVER_NAME):$env(SERVER_PORT)/col/$currentRep
if {[string equal {add} $updateOption] && [info exists cgi(_(_previousedition)]} {
# ePrint update like
# insert sourcesite - needed to return to the source form after an update error (e.g, unknown username)
regsub { +} $serverAddress {+} serverAddress2
regsub {\?} $returnInfo "?sourcesite=$serverAddress2\\&" returnInfo
set index [lindex [array names submissionDestinationTable $referenceType,*] 0]
if {[string compare {} $index] != 0} {
regsub "$referenceType," $index {} referFieldName ;# @area
set referFieldIndex [lsearch -regexp $fieldList $referFieldName]
set label [lindex [lindex $fieldList $referFieldIndex] 1] ;# area
array set submissionDestinationArray $submissionDestinationTable($index)
if [info exists localMetadataArray($metadataRep-0,$label)] {
set value $localMetadataArray($metadataRep-0,$label)
if [info exists submissionDestinationArray($value)] {
# new destination
set submissionDestination $submissionDestinationArray($value)
if [info exists cgi(_(_previousedition)] {
regsub {\?} $returnInfo {?testoutofdateform=no\&} returnInfo
}
}
}
}
}
}
set hiddenInputList {}
set requiredFieldList {}
# set requiredFieldAtCloseList {}
# puts [array names cgi]
# puts [array get cgi]
# puts
# puts $fieldList
## Put documentstage at the end
# set documentStageIndex [lsearch $fieldList {%@documentstage documentstage}]
# set fieldList [lreplace $fieldList $documentStageIndex $documentStageIndex]
# lappend fieldList {%@documentstage documentstage}
## Put documentstage at the end - end
# lappend fieldList {%@readpermission readpermission}
# Create orderingFieldArray
if [info exists orderingFieldTable($referenceType)] {
set i 0
foreach fieldName $orderingFieldTable($referenceType) {
incr i
array set orderingFieldArray [list $fieldName $i]
}
}
# Create orderingFieldArray - end
set fillOutFieldCode {} ;# updated in CreateSelect
set numberOfCreatorFields 0 ;# could be any integer (the right value is computed later when needed)
# sourceFieldNameArray (needed in FindFieldValue)
if [info exists cgi(sourcereferencetype)] {
array set sourceFieldNameArray [join [Execute $serverAddressWithIP [list ReturnReferModel $cgi(sourcereferencetype)]]]
if [info exists excludedSourceFieldNameTable($referenceType)] {
foreach index $excludedSourceFieldNameTable($referenceType) {
if [info exists sourceFieldNameArray($index)] {unset sourceFieldNameArray($index)}
}
}
}
set electronicMailAddressLineList {}
set ifEMailAddressCondition {document.update.__e_mailaddress_e_mailaddress.value.match(eMailPattern) == null}
set onLoad { onLoad="Disable()"}
# ifListCreation (part of a JavaScript)
set lineList {}
# FOREACH
# fieldList is based on the refer model
foreach field [lsort -command CompareFieldName $fieldList] {
# puts $field
# field => %A author
set fieldName [lindex $field 0] ;# %A
set label [lindex $field 1] ;# author
regsub {e-mail} $label {e_mail} label2
if [info exists cgi(sourcereferencetype)] {
if [string equal {Electronic Source} $cgi(sourcereferencetype)] {
# Electronic Source
# closing ePrint
# Migration 2009-09-04
# documentstage is not used anymore for ePrint
# if below could be dropped in the future
if [regexp {^%@documentstage$} $fieldName] {
# drop the documentstage field
continue
}
# Migration 2009-09-04 - end
if [regexp {^%1$} $fieldName] {
# turn the %1 (stageofalternatepublication) field empty
if [info exists localMetadataArray($metadataRep-0,stageofalternatepublication)] {
unset localMetadataArray($metadataRep-0,stageofalternatepublication)
}
}
if [regexp {^%8$} $fieldName] {
# turn the %8 (lastupdatedate) field empty
if [info exists localMetadataArray($metadataRep-0,lastupdatedate)] {
unset localMetadataArray($metadataRep-0,lastupdatedate)
}
}
}
if [string equal {Conference Proceedings} $cgi(sourcereferencetype)] {
if [regexp {^%3$} $fieldName] {
# turn the %3 (targetfile) field empty
if [info exists localMetadataArray($metadataRep-0,targetfile)] {
unset localMetadataArray($metadataRep-0,targetfile)
}
}
}
}
# reshape field
regsub -all {%|@| |-} $field {_} field ;# for JavaScript compatibility
if [string equal {%A} $fieldName] {
# multiple creator fields
set creatorFieldName $field
lappend hiddenInputList " "
lappend hiddenInputList " "
lappend hiddenInputList " "
lappend hiddenInputList " "
lappend hiddenInputList " "
lappend hiddenInputList " "
lappend hiddenInputList " "
}
# value
set value [FindFieldValue $field $fieldName $label $referenceType $update]
if [info exists displayTable($referenceType,$fieldName)] {
foreach {translatedCustomizedFieldName translatedFootnoteReference} [Translate $fieldName $label $referenceType] {break}
set fillInstruction [lindex $displayTable($referenceType,$fieldName) 1]
regsub {\[Help .*\]} $fillInstruction {} fillInstruction
set fillInstruction [subst $fillInstruction] ;# subst is to resolve: [expr $update?{}:{(*) }] (see administrator page script)
if {[regexp "$requiredFieldSymbol" $fillInstruction] || \
([info exists requiredFieldAtCloseSymbol] && \
[regexp "$requiredFieldAtCloseSymbol" $fillInstruction])} {
# required field
regsub {abstract} $label2 {abstract2} label2 ;# abstract is a reserved word for Netscape
# puts $label2
# puts $translatedCustomizedFieldName
if [regexp -nocase {(.*) } $translatedCustomizedFieldName m translatedCustomizedFieldName2] {
lappend rowList " "
} else {
lappend rowList " "
}
lappend requiredFieldList $field
}
}
## fieldTypeNumber
# if [info exists displayTable($referenceType,$fieldName)] #
# set fieldTypeNumber [subst [lindex $displayTable($referenceType,$fieldName) 0]]
# #
if [info exists displayTable($referenceType,$fieldName)] {
# fieldTypeNumber
set fieldTypeNumber [subst [lindex $displayTable($referenceType,$fieldName) 0]]
if {[regexp {%@readpermission} $fieldName] && [info exists archivingPolicy] && ![string equal {} $archivingPolicy]} {
# read permission field and archiving policy is not empty
# hide the read permission field (read permission will be set automatically at the document next access, see Get- and Get)
set fieldTypeNumber 0 ;# force to 0
}
if {$update && ![string equal {External Contribution} $repositoryContentType]} {
if [regexp {%@versiontype|%@archivingpolicy} $fieldName] {
# version type or archiving policy field and not External Contribution
# hide the version and archiving policy type field
set fieldTypeNumber 0 ;# force to 0
}
}
if {$fieldTypeNumber == 0} {
# 0
# puts [list $fieldName = $value]
# Add the current mirror repository value at submission
if {!$update && [string equal {} $value] && [string equal {__mirrorrepository_mirrorrepository} $field]} {
lappend hiddenInputList " "
}
# Add the current mirror repository value at submission - end
if {![string equal {} $value] || [string equal {__e_mailaddress_e_mailaddress} $field]} {
# if {[string equal {%3} $fieldName] || [string equal {%O} $fieldName]} #
# target file (e.g., caoticas[1].pdf) - the two substitutions below are needed to avoid e.g., an invalid command name "1" when opening the form
# notes [CD-ROM]
# regsub -all {\[} $value {\\\\\\\[} value ;# commented by GJFB in 2011-02-09 - doesn't work with a field value like [CD-ROM]
# regsub -all {\]} $value {\\\\\\\]} value ;# commented by GJFB in 2011-02-09 - doesn't work with a field value like [CD-ROM]
regsub -all {\[} $value {\\\\\\\\\\\\\[} value ;# added by GJFB in 2011-02-09
regsub -all {\]} $value {\\\\\\\\\\\\\]} value ;# added by GJFB in 2011-02-09
# #
lappend hiddenInputList " "
}
# Migration 2006-05-14
# old collection may contain multiple e-mail addresses in the e-mail address field
if {[string equal {%@e-mailaddress} $fieldName] && $update} {
# %@e-mailaddress
set ifEMailAddressCondition {0} ;# don't check the e-mail address
}
# Migration 2006-05-14 - end
} elseif {[regexp {1.1} $fieldTypeNumber]} {
# 1.1
if ![string equal {} $value] {
set value [string trim $value]
set value \n$value\n ;# the browsers don't display the first blank line, the trailing blank line is for easily filling one more author
}
set onBlur {} ;# disable onblur effect
lappend rowList "
${cellFont}$translatedCustomizedFieldName
${cellFont}$translatedFootnoteReference
"
} elseif {$fieldTypeNumber == 1.2} {
# 1.2
if [string equal {%X} $fieldName] {
set numberOfRows 8
} else {
set numberOfRows 4
}
# puts $value
set valueArray($fieldName) $value
lappend rowList "
${cellFont}$translatedCustomizedFieldName
${cellFont}$translatedFootnoteReference
"
} elseif {$fieldTypeNumber == 1.3} {
# 1.3
lappend rowList "
${cellFont}$translatedCustomizedFieldName
${cellFont}$translatedFootnoteReference
"
} elseif {[regexp {2.1} $fieldTypeNumber]} {
# 2.1
if [string equal {%A} $fieldName] {
# %A
# multiple creator fields
if 0 {
lappend rowList "
${cellFont}
"
} else {
if ![info exists multipleCreatorWarning] {set multipleCreatorWarning { }}
lappend rowList "
${cellFont}$multipleCreatorWarning "
}
if [regexp {^2.1$|^3$} [lindex $displayTable($referenceType,%@group) 0]] {
# group
foreach {translatedCustomizedFieldNameForGroup translatedFootnoteReferenceForGroup} [Translate %@group group $referenceType] {break}
set groupValueList [FindFieldValue {__group_group} %@group group $referenceType $update]
# puts $groupValueList
}
if {[info exists displayTable($referenceType,%@affiliation)] && [regexp {2.1} [lindex $displayTable($referenceType,%@affiliation) 0]]} {
# affiliation
foreach {translatedCustomizedFieldNameForAffiliation translatedFootnoteReferenceForAffiliation} [Translate %@affiliation affiliation $referenceType] {break}
set affiliationValueList [FindFieldValue {__affiliation_affiliation} %@affiliation affiliation $referenceType $update]
}
if {[info exists displayTable($referenceType,%@electronicmailaddress)] && [regexp {2.1} [lindex $displayTable($referenceType,%@electronicmailaddress) 0]]} {
# electronicmailaddress
foreach {translatedCustomizedFieldNameForelectronicmailaddress translatedFootnoteReferenceForelectronicmailaddress} [Translate %@electronicmailaddress electronicmailaddress $referenceType] {break}
set electronicmailaddressValueList [FindFieldValue {__electronicmailaddress_electronicmailaddress} %@electronicmailaddress electronicmailaddress $referenceType $update]
# lappend rowList " " ;# for JavaScript alert
}
set numberOfCreatorFields [llength $value]
set i 0
# puts --$value--
foreach value2 $value {
incr i
set cellBackgroundColor [lindex {#DDDDFF #FFDDDD} [expr $i%2]]
lappend rowList "
${cellFont}[CreateOrdinalNumber $language $i] $translatedCustomizedFieldName
${cellFont}$translatedFootnoteReference
[expr $i > 1?{ }:{ \;}]
[expr $numberOfCreatorFields != 1?{ }:{ \;}]
[expr $i < $numberOfCreatorFields?{ \" class=multipleCreatorButton ONCLICK=\"SetDownIndex($i)\" STYLE=\"font-size: 8pt\; font-family: Verdana\" TITLE=\"${Move this author field down}\">}:{ \;}] "
lappend rowList " " ;# for JavaScript alert
if [regexp {^2.1$|^3$} [lindex $displayTable($referenceType,%@group) 0]] {
# group
set groupValue [lindex $groupValueList [expr $i - 1]]
if {[info exists fillingButtonTable($referenceType)] && \
$fillingButtonTable($referenceType)} {
set fillingButton " "
} else {
set fillingButton " "
}
if [regexp {^2.1$} [lindex $displayTable($referenceType,%@group) 0]] {
lappend rowList "
${cellFont}[subst $translatedCustomizedFieldNameForGroup]
${cellFont}$translatedFootnoteReferenceForGroup
$fillingButton "
lappend rowList " " ;# for JavaScript alert
} elseif [regexp {^3$} [lindex $displayTable($referenceType,%@group) 0]] {
set row
append row "${cellFont}[subst $translatedCustomizedFieldNameForGroup]
${cellFont}$translatedFootnoteReferenceForGroup "
append row ""
CreateSelect %@group __group_group$i $groupValue row $i
append row " $fillingButton "
lappend rowList $row
lappend rowList " " ;# for JavaScript alert
}
}
if {[info exists displayTable($referenceType,%@affiliation)] && [regexp {2.1} [lindex $displayTable($referenceType,%@affiliation) 0]]} {
# affiliation
set affiliationValue [lindex $affiliationValueList [expr $i - 1]]
if {[info exists fillingButtonTable($referenceType)] && \
$fillingButtonTable($referenceType)} {
set fillingButton " "
} else {
set fillingButton " "
}
lappend rowList "
${cellFont}$translatedCustomizedFieldNameForAffiliation ([CreateOrdinalNumber $language $i] $translatedCustomizedFieldName)
${cellFont}$translatedFootnoteReferenceForAffiliation
$fillingButton "
lappend rowList " " ;# for JavaScript alert
}
if {[info exists displayTable($referenceType,%@electronicmailaddress)] && [regexp {2.1} [lindex $displayTable($referenceType,%@electronicmailaddress) 0]]} {
# electronicmailaddress
set electronicmailaddressValue [lindex $electronicmailaddressValueList [expr $i - 1]]
if {[info exists fillingButtonTable($referenceType)] && \
$fillingButtonTable($referenceType)} {
set fillingButton " "
} else {
set fillingButton " "
}
lappend rowList "
${cellFont}$translatedCustomizedFieldNameForelectronicmailaddress ([CreateOrdinalNumber $language $i] $translatedCustomizedFieldName)
${cellFont}$translatedFootnoteReferenceForelectronicmailaddress
$fillingButton "
lappend rowList " " ;# for JavaScript alert
lappend electronicMailAddressLineList "if (document.$submissionType.__electronicmailaddress_electronicmailaddress$i.value.match(eMailPattern) == null) {j++}"
}
}
# lappend rowList "
#x "
} elseif [regexp {%@group|%@affiliation|%@electronicmailaddress} $fieldName] {
# nothing to append
} else {
if {!$update && [regexp {%T} $fieldName] && \
[regexp {2.1} [lindex $displayTable($referenceType,%A) 0]]} {
# title
set onFocus { onFocus="MultipleCreatorAlert()"}
} else {
set onFocus {}
}
# Migration 2006-05-14
# old collection may contain multiple e-mail addresses in the e-mail address field
if {[string equal {%@e-mailaddress} $fieldName] && $update} {
# %@e-mailaddress
if [regexp {\s} $value] {
# multiple e-mail addresses
set ifEMailAddressCondition {0} ;# don't check the e-mail address
}
}
# Migration 2006-05-14 - end
if {[string equal {%U} $fieldName] && [regexp {2.1d} $fieldTypeNumber]} {
# %U
# URL
if 0 {
# display the download radio buttons
set downloadRadioButtons "
${Don't Get URL}
${Get URL and Don't Transfer Copyright}
${Get URL and Transfer Copyright}
"
if [info exists cgi(download)] {
if {[string compare {geturldonttransfercopyright} $cgi(download)] == 0} {
set downloadRadioButtons "
${Don't Get URL}
${Get URL and Don't Transfer Copyright}
${Get URL and Transfer Copyright}
"
} elseif {[string compare {geturltransfercopyright} $cgi(download)] == 0} {
set downloadRadioButtons "
${Don't Get URL}
${Get URL and Don't Transfer Copyright}
${Get URL and Transfer Copyright}
"
}
}
lappend rowList "
${cellFont}$translatedCustomizedFieldName
${cellFont}$translatedFootnoteReference
"
lappend rowList $downloadRadioButtons
} else {
# display the check box for the URL field
set chekBoxCode " "
lappend rowList "
${cellFont}$translatedCustomizedFieldName
${cellFont}$translatedFootnoteReference
$chekBoxCode "
}
} else {
set valueArray($fieldName) $value ;# added by GJFB in 2010-11-26 - solves square bracket in the target file field (e.g., cartaz Prof[1]. Gerald Banon 19.6.ppt)
regsub {\)} $fieldName {\\\)} fieldName2 ;# added by GJFB in 2010-11-07 - solves field name %) (nextedition)
lappend rowList "
${cellFont}$translatedCustomizedFieldName
${cellFont}$translatedFootnoteReference
"
}
lappend rowList " "
}
} elseif {$fieldTypeNumber == 2.2} {
# 2.2
# display check box for the Content Type field
if {$update && [regexp {%@contenttype} $fieldName] && ![regexp {^$|^External Contribution$} $repositoryContentType]} {
# don't display the repository content type check box if the repository content type value is not empty neither External Contribution
# this is done to preserve the current repository content type value if it is not empty neither External Contribution
# just the External Contribution value may be set on-line, the other values must be set using the URLibService interface
lappend rowList " "
continue
} elseif {[info exists cgi(templaterepository)]} {
# don't display the repository content type check box if duplicating a respository from a template
continue
}
set row
append row "${cellFont}$translatedCustomizedFieldName
${cellFont}$translatedFootnoteReference "
CreateCheckBox $fieldName $field $value row
append row " "
lappend rowList $row
} elseif {$fieldTypeNumber == 2.3} {
# 2.3
# radio input
lappend rowList "
${cellFont}$translatedCustomizedFieldName
${cellFont}$translatedFootnoteReference
"
set radioOption {}
foreach item $optionTable2($referenceType,$fieldName) {
foreach {customizedOption option} $item {break}
if [info exists translationTable($customizedOption,$referenceType,$fieldName)] {
set translatedCustomizedOption $translationTable($customizedOption,$referenceType,$fieldName)
} else {
# don't translate
set translatedCustomizedOption $customizedOption
}
if [string equal $option $value] {
set checked { CHECKED}
} else {
set checked {}
}
lappend radioOption " $translatedCustomizedOption "
}
lappend rowList "[join $radioOption ] "
} elseif {$fieldTypeNumber == 3} {
# 3
if {[regexp {2.1} [lindex $displayTable($referenceType,%A) 0]] && \
[regexp {%@group} $fieldName]} {
# multiple creator fields (group field)
# nothing to append
} else {
set row
append row "${cellFont}$translatedCustomizedFieldName
${cellFont}$translatedFootnoteReference "
append row ""
CreateSelect $fieldName $field $value row ;# updates fillOutFieldCode
if [info exists optionTable2($referenceType,$fieldName)] {
if [regexp {=>} $optionTable2($referenceType,$fieldName)] {
if {[regexp {^%@documentstage$} $fieldName] && \
[string equal {another advanced user} $value]} {
set onLoad {}
}
lappend lineList "if (document.update.anotheradvanceduser.value == \"\" && document.update.__documentstage_documentstage.value == \"another advanced user\") {fieldNameList += document.update.anotheradvanceduserfieldname.value + \"\\\\\\\\\\\\\\\\n\"; i++}"
lappend fillOutFieldCode {if (document.update.__documentstage_documentstage.value == "another advanced user") {
document.getElementById('anotherAdvancedUser').disabled=false
} else {
document.getElementById('anotherAdvancedUser').disabled=true
document.update.anotheradvanceduser.value = ""
}\
}
ConditionalSet anotherAdvancedUser cgi(anotheradvanceduser) {}
append row " e-Mail (login) "
append row "\n"
append row " "
}
}
append row " "
lappend rowList $row
}
} elseif {[regexp {4|5} $fieldTypeNumber]} {
# 4 or 5
set preservedValue $value ;# used in hidden type input only
if [string equal {%@parentrepositories} $fieldName] {
# used for review
if {$fieldTypeNumber == 4} {
# display the parent document link
set value "$value "
}
if {$fieldTypeNumber == 5} {
# display the parent document link and the parent reference link
set metadataParentRep [Execute $serverAddressWithIP [list FindMetadataRep $value]]
set value "$Document | $Reference "
}
}
if {$update && [string equal {%@archivingpolicy} $fieldName]} {
# Update archiving policy
set archivingPolicy [Execute $serverAddressWithIP [list UpdateArchivingPolicy $rep $metadataRep administrator $codedPassword] 0] ;# archivingPolicy value is used to decide hiding or not the read permission field
set value $archivingPolicy
if [regexp {^<(.*)>$} $value m errorMessage] {
puts [join $errorMessage \n]
return
}
# Update archiving policy - end
set preservedValue $value ;# used in hidden type input only
set {archivingPolicyArray(allowpublisher allowfinaldraft)} { => publisher}
set {archivingPolicyArray(denypublisher allowfinaldraft)} { => finaldraft or publisher}
set {archivingPolicyArray(denypublisher* allowfinaldraft)} { => finaldraft or publisher}
set {archivingPolicyArray(allowpublisher denyfinaldraft)} { => publisher}
set {archivingPolicyArray(allowpublisher denyfinaldraft*)} { => publisher}
set {archivingPolicyArray(denypublisher denyfinaldraft)} { => publisher or finaldraft}
set {archivingPolicyArray(denypublisher* denyfinaldraft)} { => publisher}
set {archivingPolicyArray(denypublisher denyfinaldraft*)} { => finaldraft or publisher}
set {archivingPolicyArray(denypublisher* denyfinaldraft*)} { => publisher}
regsub -all {\d+} $preservedValue {*} arrayEntry
if [info exists archivingPolicyArray($arrayEntry)] {
set value $value$archivingPolicyArray($arrayEntry)
}
}
lappend rowList "
${cellFont}$translatedCustomizedFieldName
${cellFont}$translatedFootnoteReference
 \;$value
"
lappend hiddenInputList " "
}
} else {
# Preserve value when the field doesn't appear in displayTable in displayControl.tcl
# puts [list $fieldName = $value]
if ![string equal {} $value] {
# notes [CD-ROM]
regsub -all {\[} $value {\\\\\\\\\\\\\[} value ;# added by GJFB in 2011-02-09
regsub -all {\]} $value {\\\\\\\\\\\\\]} value ;# added by GJFB in 2011-02-09
lappend hiddenInputList " "
}
# Preserve value when the field doesn't appear in displayTable in displayControl.tcl - end
}
}
# FOREACH - end
# Add Code field
if $update {
# update
if {[info exists targetFile] && (([info exists targetFileExtension] && \
[regexp -nocase {tex} $targetFileExtension]) || \
[TestContentType $repName {^Tcl Page$|^Index$|^CGI Script$} $homePath])} {
# .tex target file or Tcl Page, Index, CGI Script
Load $homePath/col/$repName/doc/$targetFile codeValue
lappend rowList "
${cellFont}\$Code
${cellFont}
"
}
}
# Add Code field - end
set fillOutFieldCode [join $fillOutFieldCode \n] ;# updated in CreateSelect
# puts $requiredFieldList ;# => _A_author _T_title _B_journal _D_year _V_volume
foreach requiredField $requiredFieldList {
regsub {^_} $requiredField {%} field2
regsub {%_} $field2 {%@} field2
regsub -all {e_mail} $field2 {e-mail} field2
regsub {_} $field2 { } field2
set fieldName [lindex $field2 0] ;# %A
set label [lindex $field2 1] ;# author
regsub {e-mail} $label {e_mail} label2
# another advanced user
if [string equal {%@documentstage} $fieldName] {
lappend lineList "if (document.$submissionType.__documentstage_documentstage.value == \"another advanced user\" && document.$submissionType.anotheradvanceduser.value == \"\") {fieldNameList += document.$submissionType.documentstage.value + \"\\\\\\\\\\\\\\\\n\"; i++}"
}
# another advanced user - end
# fieldTypeNumber
set fieldTypeNumber [subst [lindex $displayTable($referenceType,$fieldName) 0]]
if {$fieldTypeNumber == 2.2} {
# checkbox
set i 0
set conditionList {}
foreach xxx $boxTable($referenceType,$fieldName) {
lappend conditionList "!(document.$submissionType.$requiredField\\\\\\\\\\\\\\\[$i\\\\\\\\\\\\\\\].checked)"
incr i
}
AppendLineList [join $conditionList { && }] $label2
} elseif {$fieldTypeNumber == 2.3} {
# radio
set i 0
set conditionList {}
foreach xxx $optionTable2($referenceType,$fieldName) {
lappend conditionList "!(document.$submissionType.$requiredField\\\\\\\\\\\\\\\[$i\\\\\\\\\\\\\\\].checked)"
incr i
}
AppendLineList [join $conditionList { && }] $label2
} else {
regsub {abstract} $label2 {abstract2} label2 ;# abstract is a reserved word for Netscape
if {[regexp {%A|%@group|%@affiliation|%@electronicmailaddress} $fieldName] && \
[regexp {2.1} [lindex $displayTable($referenceType,%A) 0]] && \
([regexp {%A} $fieldName] || \
([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
for {set i 1} {$i <= $numberOfCreatorFields} {incr i} {
AppendLineList "document.$submissionType.$requiredField$i.value == \"\"" $label2 $i
}
} else {
AppendLineList "document.$submissionType.$requiredField.value == \"\"" $label2
}
}
}
# seconds
lappend rowList " "
# Add File Name field
if [info exists cgi(filename)] {
set fileName $cgi(filename)
} else {
set fileName {}
}
regsub -all {//} $fileName {\\} fileName ;# // -> \
# Store fileName C:/tmp/aaa binary 0 a
# puts $cgi(attachment)
if {[info exists cgi(templaterepository)] && \
[file isdirectory $homePath/col/$cgi(templaterepository)/doc] && \
[TestContentType $cgi(templaterepository) {Template} $homePath]} {
# duplicate template
set Object $Document
set object ${a document}
lappend hiddenInputList " "
} else {
# >
if [string equal yes $cgi(attachment)] {
# NAME=foldername
if {[info exists displayTable($referenceType,foldername)] && \
[regexp {1} [lindex $displayTable($referenceType,foldername) 0]]} {
# foreach {translatedCustomizedFieldNameForFolderName translatedFootnoteReferenceForGroup} [Translate %@group group $referenceType] {break}
lappend rowList "
${cellFont}\${Folder Name}
${cellFont}[lindex $displayTable($referenceType,foldername) 1]
"
}
# NAME=userfile
# set alternativeFieldNameForFileName [lindex $displayTable($referenceType,filename) 3]
set alternativeFieldNameForFileName [lindex $displayTable($referenceType,filename) 3]
if [info exists translationTable($alternativeFieldNameForFileName,$referenceType,filename)] {
set alternativeFieldNameForFileName $translationTable($alternativeFieldNameForFileName,$referenceType,filename)
}
# Migration 5/2/06
if {[string compare {x} $alternativeFieldNameForFileName] == 0 || \
[string compare {} $alternativeFieldNameForFileName] == 0} {
set alternativeFieldNameForFileName ${File Name}
}
# Migration 5/2/06 - end
if [regexp {4|5} [lindex $displayTable($referenceType,filename) 0]] {
lappend rowList "
${cellFont}$alternativeFieldNameForFileName
${cellFont}[lindex $displayTable($referenceType,filename) 1]
<$repName >
"
} else {
set fillInstruction [subst [lindex $displayTable($referenceType,filename) 1]] ;# subst is to resolve: [expr $update?{}:{(*) }] (see administrator page script)
if {[regexp "$requiredFieldSymbol" $fillInstruction] || \
([info exists requiredFieldAtCloseSymbol] && \
[regexp "$requiredFieldAtCloseSymbol" $fillInstruction])} {
# required field
lappend rowList " "
set fieldName filename ;# used in AppendLineList
AppendLineList "document.$submissionType.userfile.value == \"\"" userfilefieldname
}
if 1 {
# display check box for the File Name field
if {![string equal {Electronic Source} $referenceType] && $update} {
set chekBoxCode " "
} else {
set chekBoxCode {}
}
if $update {
set onChange onChange="EnableDisableTargetFileCheckBox()"
} else {
set onChange {}
}
lappend rowList "
${cellFont}$alternativeFieldNameForFileName
${cellFont}[lindex $displayTable($referenceType,filename) 1]
$chekBoxCode
"
} else {
# testing safari
# with NAME=\"userfile\" safari doesn't work (the next hidden inputs are not sent to the server)
lappend rowList "
${cellFont}$alternativeFieldNameForFileName
${cellFont}[lindex $displayTable($referenceType,filename) 1]
"
}
}
if {[info exists optionTable2($referenceType,%@documentstage)] && [regexp {Closed Review} $optionTable2($referenceType,%@documentstage)] && \
[info exists keywords] && [regexp {review} $keywords]} {
set Object $Review
set object ${a review}
} else {
set Object $Document
set object ${a document}
}
} else {
if {[info exists optionTable2($referenceType,%@documentstage)] && [regexp {Closed Review} $optionTable2($referenceType,%@documentstage)] && \
[info exists keywords] && [regexp {review} $keywords]} {
set Object $Review
set object ${a review}
} else {
if [info exists depositOptionTable($referenceType)] {
array set depositOptionArray $depositOptionTable($referenceType)
}
ConditionalSet copyAbstractToDoc depositOptionArray(copyabstracttodoc) 0
if $copyAbstractToDoc {
set Object $Abstract
set object ${an abstract}
} else {
set Object $Reference
set object ${a reference}
}
}
}
# <
}
# Add File Name field - end
# Migration 25/1/04
if {[info exists maximumSize] && [info exists fileSizeWarningArray($referenceType)]} {
set fileSizeWarning $fileSizeWarningArray($referenceType)
} else {
set fileSizeWarning {}
}
# Migration 25/1/04 - end
if $update {
# update
if {[string equal {all} $updateOption] && \
(![info exists userListWithPermissionToFinish($referenceType)] || \
[lsearch $userListWithPermissionToFinish($referenceType) $advancedUser] != -1)} {
set finishOptionIndex [expr [llength $updateOptionList] - 1]
set ifLine "if (document.update.updatetype\\\\\\\\\\\\\\\[$finishOptionIndex\\\\\\\\\\\\\\\].selected) {" ;# } testing the finish option
set ifLine2 "if (false) {" ;# } don't ask
} elseif {[info exists optionTable2($referenceType,%@documentstage)] && [regexp {Closed Review} $optionTable2($referenceType,%@documentstage)] && \
[regexp {review} $keywords]} {
# is a review
# set ifLine "if ((document.update.__documentstage_documentstage.value != document.update.username.value) && !(document.update.__documentstage_documentstage.value == \"another advanced user\" && document.update.anotheradvanceduser.value == document.update.username.value)) {" ;# } testing reviewer form
# set ifLine2 "if ((document.update.__documentstage_documentstage.value == document.update.username.value) || (document.update.__documentstage_documentstage.value == \"another advanced user\" && document.update.anotheradvanceduser.value == document.update.username.value)) {" ;# } testing reviewer form
set ifLine "if ((document.update.__documentstage_documentstage.value != \"not transfered\") && !(document.update.__documentstage_documentstage.value == \"another advanced user\" && document.update.anotheradvanceduser.value == document.update.username.value)) {" ;# } testing reviewer form
set ifLine2 "if ((document.update.__documentstage_documentstage.value == \"not transfered\") || (document.update.__documentstage_documentstage.value == \"another advanced user\" && document.update.anotheradvanceduser.value == document.update.username.value)) {" ;# } testing reviewer form
} else {
set ifLine "if (false) {" ;# } don't ask
set ifLine2 "if (false) {" ;# } don't ask
}
# action
set action ${Please wait for the update completion.}
} else {
# submit
# action
set action ${Please wait for the submission completion.}
}
# Add username and password fields
if $update {
# update
# insert username and password
# NAME=username
lappend rowList " "
if [info exists cgi(session)] {
lappend rowList " " ;# to maintain session
}
lappend rowList "
${cellFont}$conversionTable(username)
 \;
 \;$userName
"
# NAME=password1
set additionalRowList {}
set column2Value [lindex $displayTable($referenceType,password1) 1]
lappend additionalRowList "
[expr [string equal {empty} $env(DOMAIN_NAME)] || ![regexp {^([^<\s@]+)@([^@\s>]+)$} $userName]?{${cellFont}${Password} }:{${cellFont}${Password} - ${Have Forgotten it?} }]
${cellFont}$column2Value
"
# an additional hidden input is needed because some browsers are not able to update the password field value with the coded password
# (see ProcessKey JavaScript procedure)
lappend additionalRowList " "
lappend additionalRowList " "
lappend lineList "if (document.update.password1.value == \"\") {fieldNameList += document.update.password1fieldname.value + \"\\\\\\\\\\\\\\\\n\"; i++}"
if [string equal {add} $updateOption] {
# add option
set index [lindex [array names submissionDestinationTable $referenceType,*] 0]
if ![string equal {} $index] {
# a submission destination is defined (used when closing some ePrint environments)
set helpExpression [Help Password2]
regsub -all {"} $helpExpression {\\"} helpExpression
# NAME=password2
lappend additionalRowList "
${cellFont}${Password}
${cellFont}$helpExpression
"
lappend additionalRowList " "
}
}
} else {
# submit
if {[info exists displayTable($referenceType,username)] && \
[lindex $displayTable($referenceType,username) 0] != 0} {
# insert username and password
# userName
if [info exists cgi(username)] {
set userName $cgi(username)
} else {
set userName {}
}
lappend rowList "
${cellFont}$conversionTable(username)
${cellFont}[lindex $displayTable($referenceType,username) 1]
"
lappend rowList " "
lappend lineList "if (document.submit.username.value == \"\") {fieldNameList += document.submit.usernamefieldname.value + \"\\\\\\\\\\\\\\\\n\"; i++}"
lappend rowList "
[expr [string equal {empty} $env(DOMAIN_NAME)] || !$restrictedSubmission?{${cellFont}${Password} }:{${cellFont}${Password} - ${Have Forgotten it?} }]
${cellFont}[lindex $displayTable($referenceType,password1) 1]
"
# an additional hidden input is needed because some browsers are not able to update the password field value with the coded password
# (see ProcessKey JavaScript procedure)
lappend rowList " "
lappend rowList " "
lappend lineList "if (document.submit.password1.value == \"\") {fieldNameList += document.submit.password1fieldname.value + \"\\\\\\\\\\\\\\\\n\"; i++}"
if {$restrictedSubmission || \
([info exists submissionPolicyTable($referenceType)] && $submissionPolicyTable($referenceType) == 1)} {
## Migration 25/1/04
# set password2Warning {}
## Migration 25/1/04 - end
} else {
# lappend rowList " "
# lappend lineList "if (document.submit.password2.value == \"\") {fieldNameList += document.submit.password2fieldname.value + \"\\\\\\\\\\\\\\\\n\"; i++}"
lappend rowList "
${cellFont}${Password}
${cellFont}[lindex $displayTable($referenceType,password2) 1]
"
lappend rowList " "
## Migration 25/1/04
# if ![info exists submissionPassword2WarningArray($referenceType)] {
# set submissionPassword2WarningArray($referenceType) {}
# }
# set password2Warning [subst $submissionPassword2WarningArray($referenceType)]
## Migration 25/1/04 - end
}
# Migration 25/1/04
if [info exists submissionPasswordWarningArray($referenceType)] {
set passwordWarning [subst $submissionPasswordWarningArray($referenceType)]
}
# Migration 25/1/04 - end
set wrongPassword { }
} else {
# don't insert
set passwordWarning {}
## Migration 25/1/04
# set password2Warning {}
## Migration 25/1/04 - end
set wrongPassword {}
if {[string compare {} [lindex $displayTable($referenceType,username) 2]] != 0} {
lappend rowList " "
}
}
}
# Add username and password fields - end
# Load htmlContent
if $update {
# update
if [file exists ../$col/$submissionFormLanguageRep/doc/${submissionFormLanguage}UpdateSubmission.html] {
set filePath $submissionFormLanguageRep/doc/${submissionFormLanguage}UpdateSubmission.html
} else {
if [file exists ../$col/$languageRep1/doc/${language}UpdateSubmission.html] {
set filePath $languageRep1/doc/${language}UpdateSubmission.html
} else {
set filePath $languageRep2/doc/${language}UpdateSubmission.html
}
}
# puts $filePath
Load ../$col/$filePath htmlContent
if [info exists updatePasswordWarningArray($referenceType)] {
set passwordWarning [subst $updatePasswordWarningArray($referenceType)]
}
## Migration 25/1/04
# set password2Warning {}
## Migration 25/1/04 - end
# displayControl.tcl after 31/1/04 doesn't use the variable below
set requiredFileName {}
# displayControl.tcl after 31/1/04 doesn't use the variable below - end
set additionalRowList [join $additionalRowList \n]
set additionalRowList2 {}
foreach line [split $additionalRowList \n] {
regsub -all {"} $line {\\\\\\\\"} line
lappend additionalRowList2 \"$line\"
}
set additionalRowList [join $additionalRowList2 ,\n]
# Used by JavaScript
# if ![info exists cgi(wrongpassword)] {set cgi(wrongpassword) {no}}
set cgi(wrongpassword) {no}
# Used by JavaScript - end
# requiredFieldSymbol
set requiredFieldSymbol $requiredFieldFootnoteTable($referenceType) ;# e.g., (*)
regsub -all {(\*|\+)} $requiredFieldSymbol {\\\1} requiredFieldSymbol ;# requiredFieldSymbol is used in regular expression
if [regexp "$requiredFieldSymbol" [lindex $displayTable($referenceType,filename) 1]] {
# required field - drop warning
set fileNameWarning {}
}
} else {
# submit
if [file exists ../$col/$submissionFormLanguageRep/doc/${submissionFormLanguage}Submit.html] {
set filePath $submissionFormLanguageRep/doc/${submissionFormLanguage}Submit.html
} else {
if [file exists ../$col/$languageRep1/doc/${language}Submit.html] {
set filePath $languageRep1/doc/${language}Submit.html
} else {
set filePath $languageRep2/doc/${language}Submit.html
}
}
# puts $filePath
Load ../$col/$filePath htmlContent
# Migration 25/1/04
set fileNameWarningArray($referenceType) {}
# Migration 25/1/04 - end
# displayControl.tcl after 31/1/04 doesn't use the variable below
set requiredFileName $requiredFieldFootnoteTable($referenceType)
set requiredUserName $requiredFieldFootnoteTable($referenceType)
# displayControl.tcl after 31/1/04 doesn't use the variable below - end
set fileNameWarning {}
}
# Load htmlContent - end
# Site warning
if [info exists cgi(showformsite)] {
# cgi(showformsite) value may be anything
global "${languageRep2}::to the site <\$localSite> "
set siteWarning "\${to the site <\$localSite> }"
} else {
Load ../$col/$currentRep/doc/@siteList.txt fileContent
set fileContent [string trim $fileContent " \n"]
regsub -all "\n+" $fileContent "\n" fileContent
set siteList [split $fileContent \n]
set numberOfSites2 [llength $siteList]
if {$numberOfSites2 == 0} {
set siteWarning ""
} else {
global "${languageRep2}::to the site <\$localSite> "
set siteWarning "\${to the site <\$localSite> }"
}
}
# Site warning - end
# Additional instructions
# set in xxFillingInstructions.tcl
ConditionalSet additionalInstructions additionalInstructionsArray($referenceType) {}
# Additional instructions - end
# ifListCreation
set ifListCreation [join $lineList \n]
# ifElectronicMailAddressListCreation
set ifElectronicMailAddressListCreation [join $electronicMailAddressLineList \n]
# displayControl.tcl after 31/1/04 doesn't use the variable below
set requiredPassword $requiredFieldFootnoteTable($referenceType)
# displayControl.tcl after 31/1/04 doesn't use the variable below - end
if ![info exists copyrightArray($referenceType)] {set copyrightArray($referenceType) {}}
ConditionalSet submissionPeriod submissionPeriodArray($referenceType) {}
if ![info exists submitHeaderArray($referenceType)] {set submitHeaderArray($referenceType) {}}
if ![info exists submitFooterArray($referenceType)] {set submitFooterArray($referenceType) {}}
# if [info exists documentStage] {
# lappend hiddenInputList " "
# }
set hiddenInput [join $hiddenInputList \n]
set rowList [join $rowList \n]
# puts $rowList
# regsub -all {\\} $rowList {\\\\\\\\} rowList ;# \ -> \\
# puts $htmlContent
set htmlContent [ProcessBrackets $htmlContent]
if [string equal {yes} $cgi(frameinuse)] {
set popupWarning ${popup warning}
} else {
set popupWarning {}
}
# catch {subst [subst $htmlContent]} output
# catch {subst [subst [subst $htmlContent]]} output
# catch {SetFont [subst [subst [subst [subst $htmlContent]]]]} output
# set output $htmlContent
# set output [subst $htmlContent]
# set output [subst [subst $htmlContent]]
# set output [subst [subst [subst $htmlContent]]]
# set output [subst [subst [subst [subst $htmlContent]]]]
if 1 {
set output [SetFont [subst [subst [subst [subst $htmlContent]]]]]
set output [UnProcessBrackets $output]
}
# puts [array get cgi]
# puts [pwd]
}
^FillingInstructions$ {
# cgi inputs used by FillingInstructions
# repository (used by instructions/xxUpdateInstructions.html)
# foreach {language languageRep2} [FindLanguageForSubmissionForm $language $submissionFormLanguage $firstLanguageRep $languageRep2] {break}
source ../$col/$languageRep2/doc/mirror/${submissionFormLanguage}Submit.tcl
global "${languageRep2}::headerWarning"
global "${languageRep2}::zipFileWarning"
global "${languageRep2}::fileNameWarning"
# referenceType
ConditionalSet referenceType cgi(referencetype) {Misc}
# instructionType
set instructionType $cgi(instructiontype)
# advancedUser
ConditionalSet advancedUser cgi(advanceduser) {} ;# advanceduser is used only with the instructions for choosing the update type
# repPath
if {![string equal $languageRep1 $submissionFormLanguageRep] && \
[file exists ../$col/$submissionFormLanguageRep/doc/instructions/$language${instructionType}Instructions.html]} {
# puts {use the submission form language repository}
set repPath ../$col/$submissionFormLanguageRep
} elseif [file exists ../$col/$languageRep1/doc/instructions/$language${instructionType}Instructions.html] {
# puts {use the default or customized (if any) language repository}
set repPath ../$col/$languageRep1
} else {
# puts {use the default language repository}
set repPath ../$col/$languageRep2
}
if [info exists repPath] {
set filePath $repPath/doc/instructions/$language${instructionType}Instructions.html
# puts $filePath
# puts [file exists $filePath]
Load $filePath fileContent
if ![string equal {Search} $instructionType] {
# Source displayControl.tcl
set enableOutput 0
eval $sourceDisplayControl
# Source displayControl.tc - end
# maximumFileSize
set maximumFileSize $maximumFileSizeTable($referenceType)
# contentTypeList
set contentTypeList [join $contentTypeTable($referenceType) ]
if ![regexp {application/x-zip-compressed|application/zip} $contentTypeTable($referenceType)] {
# drop the zip file warning
set zipFileWarning {}
}
if ![string equal {Electronic Source} $referenceType] {
# not an ePrint
# drop the header warning (saying: The submitted file must have the center part of the header empty.)
set headerWarning {}
}
}
# SUBST
# fieldName
# targetFile
if [string equal {Update} $instructionType] {
LoadService $cgi(repository) targetFile targetFile 0 1 ;# 0 is for uncrypted - 1 is for level 1
}
ConditionalSet fieldName cgi(fieldname) {}
set output [subst $fileContent]
} else {
set output {there are no instructions}
}
}
^NewPassword$ {
source ../$col/$languageRep2/doc/mirror/${language}Register.tcl ;# needed for Cancel
global "${languageRep2}::Cancel"
global "${languageRep2}::site"
if [file exists ../$col/$languageRep1/doc/${language}NewPassword.html] {
set languageRep $languageRep1
} else {
set languageRep $languageRep2
}
# Source displayControl.tcl
set enableOutput 0
eval $sourceDisplayControl
# Source displayControl.tc - end
if [info exists archiveAcronym] {
set archiveName $archiveAcronym
} else {
set archiveName "$site $localSite"
}
if [info exists conferenceAcronym] {
set archiveName $conferenceAcronym
}
if {[info exists cgi(returnbutton)] && [string equal {yes} $cgi(returnbutton)]} {
set returnButton [CreateReturnButton ../$col/$languageRep2/doc/mirror About $cgi(targetframe) $Cancel]
} else {
set returnButton [CreateReturnButton ../$col/$languageRep2/doc/mirror About {} $Cancel]
}
# repSite
if 0 {
# not used
if [catch {FindSite2 iconet.com.br/banon/2009/05.17.20.29} siteRep] {
puts $siteRep
global errorInfo; puts $errorInfo
}
foreach repServerAddress $siteRep {break}
set repSite [ReturnHTTPHost $repServerAddress]
}
if 0 {
# for a test in banon-pc3
set repSite banon-pc3
} else {
set repSite urlib.net
}
ConditionalSet targetFrame cgi(targetframe) {}
Load ../$col/$languageRep/doc/${language}NewPassword.html body
set output [subst $body]
}
^About$ {
set path $homePath/col/$mirrorHomePageRep/doc/${language}About.html
set alternatePath [CreateAlternatePath $path 1]
set timePeriod [TestForTclPageUpdate $path $alternatePath]
ConditionalSet forceAboutUpdating cgi(forceaboutupdating) 0 ;# default is 0
if {$timePeriod || $forceAboutUpdating} {
# global numberOfItems
global numberOfReferencesList ;# used in MultipleSubmit
global "${languageRep2}:: was distributed over \$numberOfActiveSites
within a total of \$numberOfSites2 collections and it "
global "${languageRep2}:: Last Version: <\$lastVersion> ."
global "${languageRep2}:: Download it."
global "${languageRep2}::welcome1"
global "${languageRep2}::welcome2"
global "${languageRep2}::You also can access all the full texts of the current local collection through the URLib Local Collection Index ."
# package require http ;# needed here as well
# set urlibServerAddress [Execute $serverAddressWithIP GetURLibServerAddress] ;# 150.163.x.xx:80
set urlibServerAddress [GetURLibServerAddress] ;# 150.163.x.xx:80
foreach {urlibServerName urlibPort} [ReturnCommunicationAddress $urlibServerAddress] {break}
if {"$env(IP_ADDR) $env(URLIB_PORT)" == "$urlibServerName $urlibPort"} {
# Main Site
set welcome $welcome2
} else {
set welcome $welcome1
}
# numberOfReferencesList
# set query {list GetNumberOfItems}
set query {list GetNumberOfReferences}
# MULTIPLE SUBMIT
set numberOfReferencesList {}
if 0 {
# testing update this page without GetNumberOfReferences
set numberOfSatisfiedQueries 0
set listOfSites 0
set listOfActiveSites 0
set numberOfSites 0
} else {
MultipleSubmit {} $query numberOfReferencesList 0
}
# one or more elements in numberOfReferencesList might contain an error message
# through listOfInactiveSites one can identify the sites that have produced
# the error messages
puts --$numberOfReferencesList--
# siteList - used by ReturnSiteInformation in xxAbout.html
set numberOfReferencesList2 {}
set siteList {}
foreach siteResult $numberOfReferencesList {
if [string equal {0 0} $siteResult] {continue} ;# see GetNumberOfReferences
lappend numberOfReferencesList2 $siteResult
lappend siteList [lindex $siteResult 0]
}
# puts $siteList
# siteInformationList
set siteInformationList [join $numberOfReferencesList2]
# puts $siteInformationList
array set siteInformationArray $siteInformationList
# puts [array names siteInformationArray]
set numberOfItemsList {}
foreach site [array names siteInformationArray] {
# $siteInformationArray($site)
# numberofreferences 300 numberofvisiblereferences 270 numberofvisiblereferenceswithfulltext 150
# puts [list $site --$siteInformationArray($site)--]
array set informationArray $siteInformationArray($site)
lappend numberOfItemsList [list $informationArray(numberofvisiblereferences) $informationArray(numberofvisiblereferenceswithfulltext)]
}
set numberOfItemsList [join $numberOfItemsList]
set numberOfActiveSites $numberOfSatisfiedQueries
set listOfInactiveSites {}
foreach item $listOfSites {
if {[lsearch $listOfActiveSites $item] == -1} {
lappend listOfInactiveSites $item
}
}
# nOR and nOFT
set nOR 0
set nOFT 0
foreach {numberOfVisibleReferences numberofvisiblereferenceswithfulltext} $numberOfItemsList {
set nOR [expr $nOR + $numberOfVisibleReferences]
set nOFT [expr $nOFT + $numberofvisiblereferenceswithfulltext]
}
# loBiMiRep
set loBiMiRep $env(LOBIMIREP) ;# needed with MultipleExecute
# MULTIPLE SUBMIT
set command [list list GetSiteInformation]
# GETSITEINFORMATION
set siteInformationList [MultipleExecute {} $command]
set siteInformationList [join $siteInformationList]
# puts $siteInformationList ;# may contain an error message (when time-out for GetSiteInformation is large)
array set siteInformationArray2 $siteInformationList
foreach site [array names siteInformationArray] {
if [info exists siteInformationArray2($site)] {
set siteInformationArray($site) [concat $siteInformationArray($site) $siteInformationArray2($site)]
}
}
set siteInformationList [array get siteInformationArray] ;# used by ReturnSiteInformation in xxAbout.html
# puts --$siteInformationList--
# URLibReferenceRep
set URLibReferenceRep iconet.com.br/banon/2001/02.10.22.55
if {$numberOfSites == 1} {
set siteWarning " "
} else {
set siteWarning "\${ was distributed over \$numberOfActiveSites
within a total of \$numberOfSites2 collections and it }"
}
if 0 {
if {"$env(IP_ADDR) $env(URLIB_PORT)" == "$urlibServerName $urlibPort"} {
# Main site
set lastVersionWarning ""
set downloadWarning ""
} else {
# lastVersion
set query {list GetURLibServiceLastVersion}
# MULTIPLE SUBMIT
set lastVersion {}
# MultipleSubmit {} $query lastVersion 0 [list $urlibServerAddress2]
MultipleSubmit {} $query lastVersion 1 [list $urlibServerAddress2]
if [string equal {} $lastVersion] {
set lastVersionWarning ""
} else {
set lastVersionWarning "\${ Last Version: <\$lastVersion> .}"
}
if [string equal $env(SERVICE_VERSION) $lastVersion] {
set downloadWarning ""
} else {
set downloadWarning "\${ Download it.}"
}
}
} else {
set lastVersionWarning ""
set downloadWarning ""
}
# Get number of visits
# set numberOfVisits [Execute $serverAddressWithIP [list GetNumberOfVisits $env(LOBIMIREP)]]
set numberOfVisits [Execute $serverAddressWithIP [list GetNumberOfVisits $currentRep]]
# Get number of visits - end
# Link to index1.html
if [file exists ../$col/$env(LOCOINREP)/doc/index1.html] {
set indexHTML "\${You also can access all the full texts of the current local collection through the URLib Local Collection Index .}"
} else {
set indexHTML ""
}
# Link to index1.html - end
# translationTable
source ../$col/$languageRep2/doc/mirror/${language}ReferenceTypeName.tcl ;# set translationTable
# global referencetype::translationTable
if [file exists ../$col/$languageRep1/doc/${language}About.html] {
Load ../$col/$languageRep1/doc/${language}About.html body
} else {
Load ../$col/$languageRep2/doc/${language}About.html body
}
set body [ProcessBrackets $body]
set numberOfSites2 $numberOfSites ;# numberOfSites is recomputed during a substitution below (executing ReturnTitleList)
# puts $body
# puts $currentRep
# catch {subst $body} output
set output [subst $body]
set output [UnProcessBrackets $output]
set output [ProcessBrackets $output]
set output [SetFont [subst [subst $output]]]
set output [UnProcessBrackets $output]
set dirName [file dirname $alternatePath]
file mkdir $dirName ;# create the auxdoc directory in the mirrorHomePage.html repository
Store output $alternatePath
} else {
Load $alternatePath output
}
}
.+ {
if [file exists ../$col/$languageRep1/doc/${language}$frameName.html] {
Load ../$col/$languageRep1/doc/${language}$frameName.html fileContent
set fileContent2 [ProcessBrackets $fileContent]
if [catch {subst $fileContent2} fileContent] {
return -code error "CreateMirror:
$fileContent
"
} else {
set output [UnProcessBrackets $fileContent]
}
} else {
return -code error "CreateMirror: file
$homePath/col/$languageRep1/doc/${language}$frameName.html
doesn't exist"
}
}
default {
# empty frameName
# puts OK
if $usePHP {
puts "Location: http://$localSite/col/$mirrorHomePageRep/doc/$mirrorHomePageTargetFile"
puts {}
return
}
# targetFrame
set targetFrame _top
if [info exists env(QUERY_STRING)] {
regexp {targetframe=([^&]*)} $env(QUERY_STRING) m targetFrame
}
# Capture URL (same code in createpage.tcl)
set q_u_e_r_y {}
if {[info exists env(QUERY_STRING)] && [string compare {} $env(QUERY_STRING)] != 0} {
# GET style
lappend q_u_e_r_y $env(QUERY_STRING)
}
if [info exists env(CONTENT_LENGTH)] {
# POST style
lappend q_u_e_r_y [string trim [read stdin $env(CONTENT_LENGTH)] \n]
}
set q_u_e_r_y [join $q_u_e_r_y &]
foreach {name value} [split $q_u_e_r_y &=] {
set cgi([DecodeURL $name]) [DecodeURL $value]
}
# Capture URL - end
set serverAddress $localSite ;# old usage of serverAddress
# Load ../$col/$mirrorHomePageRep/service/targetFile mirrorHomePageTargetFile
# puts ../$col/$mirrorHomePageRep/doc/$mirrorHomePageTargetFile
Load ../$col/$mirrorHomePageRep/doc/$mirrorHomePageTargetFile mirrorPage
source ../$col/$languageRep2/doc/mirror/${language}Home.tcl
global "${languageRep2}::Bibliographic Mirror at <\;\$serverAddress>\;"
set thisRepository $mirrorHomePageRep
set urlibServerAddress [GetURLibServerAddress] ;# 150.163.x.xx:80
foreach {urlibServerName urlibPort} [ReturnCommunicationAddress $urlibServerAddress] {break} ;# used in mirrorPage
# set output [subst $mirrorPage]
set output [subst [subst $mirrorPage]]
}
}
puts $output
# <
} m] {puts $m; if 0 {global errorInfo; puts $errorInfo}}
}
# CreateMirror - end
# ----------------------------------------------------------------------
# CreateSelect
# used with Register and Submit
# example of fieldName: %A
# example of field: _A_author
# creatorNumber is empty or is 1, 2, 3 ...
proc CreateSelect {fieldName field value varName {creatorNumber {}}} {
global cgi
# upvar translationTable translationTable
upvar referenceType referenceType
upvar optionTable optionTable
upvar optionTable2 optionTable2
upvar defaultOptionTable defaultOptionTable
upvar $varName row
upvar userName userName
upvar fillOutFieldCode fillOutFieldCode ;# used in submit.html
upvar fieldList fieldList ;# {%A author} {%T title}
upvar fillOutFieldTable fillOutFieldTable ;# set in displayControl.tcl
upvar actionTable actionTable ;# set in displayControl.tcl
upvar submissionType submissionType
upvar referenceType3 referenceType3
upvar language language
upvar http http
# Create fillOutFieldCode
# for function FillOutField(fieldName, optionNumber, creatorNumber)
if [info exists actionTable($referenceType,$fieldName)] {
# Dynamic action
lappend fillOutFieldCode " if (fieldName == \"$fieldName\") \{"
set i 0
lappend fillOutFieldCode " itemsAction = new Array([llength $actionTable($referenceType,$fieldName)])"
foreach item $actionTable($referenceType,$fieldName) {
lappend fillOutFieldCode " itemsAction\\\\\\\\\\\\\\\[$i\\\\\\\\\\\\\\\] = \"$http://[lindex [lindex $item 1] 0]/col/[lindex [lindex $item 1] 1]/doc/submit.cgi\""
incr i
}
lappend fillOutFieldCode " document.$submissionType.action = itemsAction\\\\\\\\\\\\\\\[optionNumber\\\\\\\\\\\\\\\] + '?%0+referencetype=\{$referenceType3\}&languagebutton=$language&returnbutton=$cgi(returnbutton)&targetframe=$cgi(targetframe)&attachment=$cgi(attachment)'"
lappend fillOutFieldCode " \}"
# Dynamic action - end
}
set fillOutFieldCode2 {}
foreach name [array names fillOutFieldTable $referenceType,$fieldName,*] {
regsub "^$referenceType,$fieldName," $name {} destinationFieldName ;# %@affiliation
if {[set i [lsearch -regexp $fieldList ^$destinationFieldName]] != -1} {
set destinationField [lindex $fieldList $i]
regsub -all {%|@| |-} $destinationField {_} destinationField ;# for JavaScript compatibility - __group_group
if [regexp {^$|^1$} $creatorNumber] {
lappend fillOutFieldCode2 " items$destinationField = new Array([expr [llength $fillOutFieldTable($name)] / 2])"
set i 0
foreach {x y} $fillOutFieldTable($name) {
lappend fillOutFieldCode2 " items$destinationField\\\\\\\\\\\\\\\[$i\\\\\\\\\\\\\\\] = \"$y\""
incr i
}
}
lappend fillOutFieldCode2 " if (creatorNumber == \"$creatorNumber\") \{"
lappend fillOutFieldCode2 " document.$submissionType.$destinationField$creatorNumber.value = items$destinationField\\\\\\\\\\\\\\\[optionNumber\\\\\\\\\\\\\\\]"
lappend fillOutFieldCode2 " \}"
}
}
if {[string compare {} $fillOutFieldCode2] != 0} {
lappend fillOutFieldCode "if (fieldName == \"$fieldName\") \{"
set fillOutFieldCode [concat $fillOutFieldCode $fillOutFieldCode2]
lappend fillOutFieldCode " \}"
}
# Create fillOutFieldCode - end
append row ""
# Find option list
# optionList
if [info exists optionTable($referenceType,$fieldName)] {
set optionList $optionTable($referenceType,$fieldName)
} elseif [info exists optionTable2($referenceType,$fieldName)] {
set optionList $optionTable2($referenceType,$fieldName)
} else {
puts "optionTable($referenceType,$fieldName) or optionTable2($referenceType,$fieldName) doesn't exist"
return
}
# Find option list - end
# puts --$value--
# puts $optionList
if [info exists defaultOptionTable($referenceType,$fieldName)] {
if [string equal {} $value] {
set value $defaultOptionTable($referenceType,$fieldName)
} elseif {[string equal {%@documentstage} $fieldName]} {
# with 8.5 could be [lsearch -index 1 $optionList $value] == -1
set flag 1
foreach option $optionList {
if [string equal [lindex $option 1] $value] {set flag 0; break}
}
if $flag {set value $defaultOptionTable($referenceType,$fieldName)}
}
}
# puts --$value--
# puts $optionList
if [info exists optionTable($referenceType,$fieldName)] {
# using optionTable
set flag 1
for {set i 0} {$i < [llength $optionList]} {incr i} {
if {[llength [lindex [lindex $optionList $i] 1]] > 1} {set flag 0; break}
}
if $flag {
# without subitem
foreach option $optionList {
CreateOptionForSelect $fieldName $value $option $option ;# appends row
}
} else {
# with subitems (an item has at least two subitems)
if [string equal {} [lindex $optionList 0]] {
# the first element is empty
set optionList [lreplace $optionList 0 0]
CreateOptionForSelect $fieldName $value {} {} ;# appends row
}
foreach option $optionList {
append row ""
foreach option2 [lindex $option 1] {
CreateOptionForSelect $fieldName $value $option2 $option2 ;# appends row
}
append row " "
}
}
} else {
# using optionTable2
# puts --$optionList--
set flag [expr [llength [lindex [lindex [lindex $optionList end] 1] 0]] <= 1]
if $flag {
# without subitem
foreach option $optionList {
set optionName [lindex $option 0]
set optionValue [lindex $option 1]
CreateOptionForSelect $fieldName $value $optionName $optionValue ;# appends row
}
} else {
# with subitems (the last item has a first subitem that has least two subitems)
if [string equal {} [lindex $optionList 0]] {
# the first element is empty
set optionList [lreplace $optionList 0 0]
CreateOptionForSelect $fieldName $value {} {} ;# appends row
}
foreach option $optionList {
append row ""
foreach option2 [lindex $option 1] {
set optionName [lindex $option2 0]
set optionValue [lindex $option2 1]
CreateOptionForSelect $fieldName $value $optionName $optionValue ;# appends row
}
append row " "
}
}
}
append row
}
# CreateSelect - end
# ----------------------------------------------------------------------
# CreateOptionForSelect
proc CreateOptionForSelect {fieldName fieldValue optionName optionValue} {
upvar row row
upvar 2 translationTable translationTable
upvar 2 referenceType referenceType
if [info exists translationTable($optionName,$referenceType,$fieldName)] {
set translatedOption $translationTable($optionName,$referenceType,$fieldName)
} else {
# don't translate
set translatedOption $optionName
}
# puts [list $fieldValue $optionValue]
# if [string equal $fieldValue $optionValue] # ;# not used because we may have fieldValue == DPI (or DPI-OBT-INPE-BR) and optionValue == DPI-OBT-INPE-MCT-BR
# 2008-01: later on, one should return to use the above if instead of the one below
regexp {[^-]*} $fieldValue fieldValue2
if {([string equal {%@group} $fieldName] && ![string equal {} $fieldValue] && [regexp ^$fieldValue2 $optionValue]) || \
(![string equal {%@group} $fieldName] && [string equal $fieldValue $optionValue])} {
# PhD Thesis
append row "$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)
set fillInstruction [lindex $displayTable($referenceType,$fieldName) 1]
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 multipleLineReferFieldNamePatternForCreator
upvar displayTable displayTable
upvar localMetadataArray localMetadataArray
upvar reviewArray reviewArray
upvar metadataRep metadataRep
upvar repName repName
upvar sourceFieldNameArray sourceFieldNameArray
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]]
}
if [info exists cgi($field)] {
if {[regexp {%A|%@group|%@affiliation|%@electronicmailaddress} $fieldName] && \
[info exists displayTable($referenceType,$fieldName)] && \
[regexp {2.1} [lindex $displayTable($referenceType,%A) 0]] && \
([regexp {%A} $fieldName] || \
([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)]} {
set value $localMetadataArray($metadataRep-0,$label2)
# if [regexp {^%A|^%E|^%Y|^%\?|^%@group|^%@affiliation|^%@electronicmailaddress} $fieldName]
if [regexp $multipleLineReferFieldNamePattern $fieldName] {
# multiple line fields
# if [regexp {^%@group|^%@affiliation|^%@electronicmailaddress} $fieldName] #
if ![regexp $multipleLineReferFieldNamePatternForCreator $fieldName] {
set value [MultipleRegsub {,*$} $value {}] ;# drop trailing commas
} else {
set value [MultipleRegsub {(,.+),$|^([^ ]+),$} $value {\1\2}] ;# drop trailing comma
}
if {[regexp {%A|%@group|%@affiliation|%@electronicmailaddress} $fieldName] && \
[info exists displayTable($referenceType,$fieldName)] && \
[regexp {2.1} [lindex $displayTable($referenceType,%A) 0]] && \
([regexp {%A} $fieldName] || \
([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 {
set value [join $value \n]
}
} 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 [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|%@group|%@affiliation|%@electronicmailaddress} $fieldName] && \
[info exists displayTable($referenceType,$fieldName)] && \
[regexp {2.1} [lindex $displayTable($referenceType,%A) 0]] && \
([regexp {%A} $fieldName] || \
([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]
# 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] {
set value [ReturnAllowedIPList $value]
}
}
# 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)
# translatedCustomizedFieldName
set customizedFieldName [lindex $displayTable($referenceType,$fieldName) 3]
set translatedCustomizedFieldName {} ;# could be anything
# fieldTypeNumber
set fieldTypeNumber [subst [lindex $displayTable($referenceType,$fieldName) 0]]
if {[string compare {} $customizedFieldName] == 0} {
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]
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 compare {} $translatedFootnoteReference] == 0} {set translatedFootnoteReference  \;} ;# empty cell for netscape
return [list $translatedCustomizedFieldName $translatedFootnoteReference]
}
# Translate - end
# ----------------------------------------------------------------------
# CreateOrdinalNumber
proc CreateOrdinalNumber {language number} {
switch $language {
en {
switch $number {
1 {return {1st }}
2 {return {2nd }}
3 {return {3rd }}
default {return "$numberth "}
}
}
pt-BR {return "$number°"}
default {return $number}
}
}
# CreateOrdinalNumber - end
# ----------------------------------------------------------------------