# submit.tcl # Copyright for the URLibService (c) 1995 - 2024, # by Gerald Banon. All rights reserved. # Version 2.1 # part of URLibService # used to submit a new document or update an already submitted one # ---------------------------------------------------------------------- # Submit # cgi inputs used by Submit # updatetype ## values are: update, {remove before update} (default), add, {add and copy}, run, finish # values are: update, {remove before update}, {update source directory}, {remove before update source directory}, {update agreement directory}, {remove before update agreement directory}, add, {add and copy}, run, and finish, default is given by updateOptionTable in displayControl.tcl # bodylink # defined in Get proc Submit {} { if [catch { set codeTesting 0 set currentProcedureName Submit ;# used in displayControl.tcl among other uses # global searchResultList global env global cgi ;# used in TryFillingOut, SendSubmissionConfirmationEMail and SendPermissionTransferWarningEMail global col global mirrorHomePageRep ;# defined in FindLanguage (utilities1.tcl) global homePath ;# used in SynchronizeRepository, TraceProcedure, CreatePDFFile, LoadService, StoreService, StorePassword, SortRandomNumber, FindLanguage, RunRemoteCGIScript, CheckMetadataSimilarity, KeepOldVersionOfTeXTargetFile, SendSubmissionConfirmationEMail and SendPermissionTransferWarningEMail global htpasswdPath ;# used in StorePassword global loCoInRep ;# used in SynchronizeRepository, StorePassword, CheckMetadataSimilarity, SendSubmissionConfirmationEMail and SendPermissionTransferWarningEMail global loBiMiRep ;# used while executing SynchronizeRepository global currentRep ;# used by CreateMirror, CheckMetadataSimilarity and by DisplaySearch and DisplayNumberOfEntries called within subst (see TCL Page), and by SendSubmissionConfirmationEMail and SendPermissionTransferWarningEMail global language languageRep1 languageRep2 firstLanguageRep ;# used by DisplaySearch, by DisplayNumberOfEntries called within subst (see TCL Page), by FindNextUser, SendSubmissionConfirmationEMail and SendPermissionTransferWarningEMail global bgColor ;# used when updating the Local Collection Index (see localIndex.html) global localSite ;# used by FindNextUser, SendSubmissionConfirmationEMail, SendPermissionTransferWarningEMail and others global ps2pdfConverterPathList ;# defined in displayControl.tcl and used by CreatePDFFile global headerTable ;# defined in displayControl.tcl and used by CreatePDFFile global referenceType ;# used by CreatePDFFile and by FindNextUser global orderingTable ;# used to sort review fields global URLibServiceRepository; # used by SynchronizeRepository, TraceProcedure, SortRandomNumber and by CreateTclPageFile global citationKey ;# set in CheckMetadataSimilarity and used within subst (see: a repository already exists) global multipleLineReferFieldNamePattern global multipleLineReferFieldNamePatternForCreator global http ;# used by FindNextUser global submissionFormRep global submissionFormLanguageRep submissionFormLanguage ;# used by SendSubmissionConfirmationEMail and SendPermissionTransferWarningEMail global cssFileURL ;# used in CreateTclPage global creatorFieldArray ;# used in TryFillingOut global thisRepository ;# used in CreateTclPageFile, DisplaySearch and DisplayMultipleSearch global optionTable2 ;# used in ComputeFieldValueList (when making table of contents) global errorInfo global tcl_platform # global targetFileType ;# used in CreateTclPageFile and DisplaySearch global timePeriod ;# set by TestForTclPageUpdate, used in CreateTclPageFile global accentTable2 ;# used in ReturnAttributeValue global serverAddress ;# used in CreateTclPage, SetFieldValue, SendSubmissionConfirmationEMail and SendPermissionTransferWarningEMail global serverAddressWithIP ;# used in SynchronizeRepository, FindNextUser, DisplaySearch, CreateTclPage and CreateTclPageFile global numberOfReviewersPerWorkTable ;# set by sourceDisplayControl, used in CreateTclPage global conferenceAcronym ;# set by sourceDisplayControl, used in CreateTclPage global optionTable ;# set by sourceDisplayControl, used in CreateTclPage global display ;# added by GJFB in 2016-06-05 - used in "subst $displayTable($referenceType,$fieldName)" within this procedure # array set environment [array get env] ;# used in MultipleSubmit # homePath (used in LoadService, StoreService, StorePassword and FindLanguage) set homePath $env(DOCUMENT_ROOT) # htpasswdPath (used in StorePassword) set htpasswdPath $env(HTPASSWD_PATH) # loCoInRep (used in StorePassword) set loCoInRep $env(LOCOINREP) # loBiMiRep set loBiMiRep $env(LOBIMIREP) ;# needed while executing SynchronizeRepository # URLibServiceRepository (used by SortRandomNumber and by CreateTclPageFile) set URLibServiceRepository $env(URLIB_SERVICE_REP) # multipleLineReferFieldNamePattern set multipleLineReferFieldNamePattern $env(MULI_PATTERN) # multipleLineReferFieldNamePatternForCreator set multipleLineReferFieldNamePatternForCreator $env(MULI_PATTERN_FOR_CREATOR) # authorFieldNameList set authorFieldNameList $env(AUTHOR_FIELD_NAME_LIST) # mirrorHomePageRepository # used in sourceDisplayControl set mirrorHomePageRepository dpi.inpe.br/banon/2000/01.23.20.24 set col ../../../../.. # set citationKeyRepository dpi.inpe.br/banon/1999/07.11.21.09 set sendMailRep iconet.com.br/lise/2005/06.25.14.21 source ../$col/$URLibServiceRepository/doc/utilities1.tcl source ../$col/$URLibServiceRepository/doc/cgi/mirrorfind-.tcl # set processReviewRep iconet.com.br/banon/2004/07.19.12.32 # serverAddress (used in CreateTclPage and SetFieldValue only) set serverAddress [list $env(SERVER_NAME) $env(URLIB_PORT)] # serverAddressWithIP (used in CreateTclPage and CreateTclPageFile) set serverAddressWithIP [list $env(IP_ADDR) $env(URLIB_PORT)] # localSite # set localSite $env(SERVER_NAME):$env(SERVER_PORT) set localSite [ReturnHTTPHost] # http set http http[expr [info exists env(HTTPS)]?{s}:{}] # set xxx 1a-[pid] # Store xxx C:/tmp/bbb auto 0 a # set xxx 2a-[pid] # Store xxx C:/tmp/bbb auto 0 a if 0 { puts {Content-Type: text/html} puts {} } # update set update [info exists env(PATH_INFO)] # puts $update # currentRep (local mirror repository - contains @siteList.txt) set uri [file split $env(REQUEST_URI)] regsub -all { } [lrange $uri 2 5] {/} currentRep ;# used in mirrorHomePage.html # puts --$env(QUERY_STRING)-- # exit if {[info exists env(QUERY_STRING)] && ![string equal {} $env(QUERY_STRING)]} { if [regexp {(updatetype)=([^&$]*)} $env(QUERY_STRING) m name value] {set cgi($name) $value} if [regexp {(returnaddress)=(.+)$} $env(QUERY_STRING) m name value] { # return address exists and is not empty # for Return Button set cgi($name) $value if [regexp {(attachment)=([^&$]*)} $env(QUERY_STRING) m name value] { set cgi($name) $value } # if [regexp {(%0\+referencetype)=([^&$]*)} $env(QUERY_STRING) m name value] # # in some browser (like konqueror) % is coded %25 - in this case 25 must be omitted if [regexp {(%2?5?0\+referencetype)=([^&$]*)} $env(QUERY_STRING) m name value] { regsub -all {\+} $value { } value set {cgi(%0 referencetype)} $value ;# {Conference Proceedings} } if [regexp {(lastupdate)=([^&$]*)} $env(QUERY_STRING) m name value] { set cgi($name) $value ;# leaves +, in this way value is a one element list and not treated has a check box value by MakeCGIArray (JoinCGIEntries) # set cgi($name) [DecodeURL $value] regsub -all {\+} $cgi(lastupdate) { } metadataLastUpdate2 } if [regexp {(metadatarepository)=([^&$]*)} $env(QUERY_STRING) m name value] { set cgi($name) $value } if [regexp {(returnbutton)=([^&$]*)} $env(QUERY_STRING) m name value] { set cgi($name) $value } if [regexp {(testoutofdateform)=([^&$]*)} $env(QUERY_STRING) m name value] { set cgi($name) $value ;# for example, used with ePrint (when the submission destination is another local collection) } if [regexp {(sourcesite)=([^&$]*)} $env(QUERY_STRING) m name value] { # for example, used with ePrint (when the submission destination is another local collection) set cgi($name) $value ;# leaves +, in this way value is a one element list and not treated has a check box value by MakeCGIArray (JoinCGIEntries) # set cgi($name) [DecodeURL $value] regsub -all {\+} $cgi(sourcesite) { } sourceSite } } else { # return address doesn't exist or is empty # for Copy Button foreach {name value} [split $env(QUERY_STRING) &=] { set cgi([DecodeURL $name]) [DecodeURL $value] } if [info exists cgi(returnaddress)] {unset cgi(returnaddress)} ;# drop empty return address (otherwise the update knowledgement doesn't work) } } # puts [array get cgi] if $update { # update set pathInfo [file split $env(PATH_INFO)] # repName regsub -all { } [lrange $pathInfo 1 4] {/} repName # puts $repName # thisRepository set thisRepository $repName ;# used in CreateTclPageFile, DisplaySearch and DisplayMultipleSearch LoadService $repName userName userName 1 1 ;# must be before source displayControl.tcl for dynamic forms set advancedUser $userName ;# alias - must be before source displayControl.tcl for dynamic forms # metadataRep if [info exists cgi(metadatarepository)] { set metadataRep $cgi(metadatarepository) ;# added by GJFB in 2013-02-11 because FindMetadataRep returns the first encountered, this metadata repository may not be the proper one for the current application } else { set metadataRep [Execute $serverAddressWithIP [list FindMetadataRep $repName]] } # mirrorRepository set mirrorRepository [Execute $serverAddressWithIP [list GetFieldValue $metadataRep-0 mirrorrepository]] if {![string equal {} $mirrorRepository] && [file isdirectory $homePath/col/$mirrorRepository]} { set currentRep $mirrorRepository ;# force to be mirrorRepository } } # Find the language and the language repository # use the same languages as used for the local bibliographic mirror foreach {language languageRep1 languageRep2 firstLanguageRep \ submissionFormRep submissionFormLanguage submissionFormLanguageRep} \ [FindLanguage $currentRep] {break} # puts --$language-- # Find the language and the language repository - end # set enableTrace 0 # @enableTrace must contain 0 or 1 Load $homePath/col/$URLibServiceRepository/auxdoc/@enableTrace enableTrace TraceProcedure Submit TraceProcedure ;# add executing time interval TraceProcedure [clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S] # puts $env(REQUEST_URI) # puts $currentRep # exit # puts [list $language $languageRep1 $languageRep2 $firstLanguageRep \ $submissionFormRep $submissionFormLanguage $submissionFormLanguageRep] # bgColor, background and bgProperties if 0 { # used in old mirror foreach {bgColor background bgProperties fontTag fontTag2} [GetBg $languageRep1 $language] {break} set background [subst $background] } # display # set display [subst [GetFrameName $mirrorHomePageRep]] set display [GetFrameName] # userGroup set userGroup {} ;# could be any thing - will be set correctly later on (existence is tested in displayControl.tcl) # submissionStage set submissionStage perform ;# used in displayControl foreach {language languageRep2} [FindLanguageForSubmissionForm $language $submissionFormLanguage $firstLanguageRep $languageRep2] {break} source ../$col/$languageRep2/doc/mirror/${submissionFormLanguage}Submit.tcl # GetConversionTable $languageRep2 $language GetConversionTable $languageRep2 $submissionFormLanguage global field::conversionTable global "${languageRep2}::submission header" ;# Submission Warning global "${languageRep2}::update header" global "${languageRep2}::footer" # global "${languageRep2}::Return" global "${languageRep2}::Continue" # global "${languageRep2}::Copy" global "${languageRep2}::Yes" global "${languageRep2}::No" global "${languageRep2}::empty field" global "${languageRep2}::empty fields" # global "${languageRep2}::empty checkbox" global "${languageRep2}::no file name" global "${languageRep2}::not a zip arquive" global "${languageRep2}::wrong content type for submission - singular" global "${languageRep2}::wrong content type for submission - plural" global "${languageRep2}::wrong content type for update - singular" global "${languageRep2}::wrong content type for update - plural" global "${languageRep2}::empty username" global "${languageRep2}::wrong username" global "${languageRep2}::unknown username" global "${languageRep2}::empty password" global "${languageRep2}::empty password1 at submission" global "${languageRep2}::empty password2 at submission" global "${languageRep2}::wrong password" global "${languageRep2}::existing user name and wrong password" global "${languageRep2}::passwords are different" # global "${languageRep2}::file not found" global "${languageRep2}::url not found" global "${languageRep2}::maximum size warning" global "${languageRep2}::repository warning for submission" global "${languageRep2}::repository warning for update" global "${languageRep2}::access warning" global "${languageRep2}::update warning" global "${languageRep2}::eprint update warning" global "${languageRep2}::Document" global "${languageRep2}::Reference" global "${languageRep2}::your document" global "${languageRep2}::your reference" global "${languageRep2}::Submission completed successfully..." global "${languageRep2}::Submission NOT completed..." global "${languageRep2}::Update completed successfully..." global "${languageRep2}::a repository already exists" global "${languageRep2}::the current update causes two or more repositories with the same citation key" global "${languageRep2}::out-of-date form" # global "${languageRep2}::no header" global "${languageRep2}::repository not found" global "${languageRep2}::currentVariableFileName" ;# for reverse engineering global "${languageRep2}::closed session" if 0 { # puts --$env(QUERY_STRING)-- # exit if {[info exists env(QUERY_STRING)] && ![string equal {} $env(QUERY_STRING)]} { if [regexp {(updatetype)=([^&$]*)} $env(QUERY_STRING) m name value] {set cgi($name) $value} if [regexp {(returnaddress)=(.+)$} $env(QUERY_STRING) m name value] { # return address exists and is not empty # for Return Button set cgi($name) $value if [regexp {(attachment)=([^&$]*)} $env(QUERY_STRING) m name value] { set cgi($name) $value } # if [regexp {(%0\+referencetype)=([^&$]*)} $env(QUERY_STRING) m name value] # # in some browser (like konqueror) % is coded %25 - in this case 25 must be omitted if [regexp {(%2?5?0\+referencetype)=([^&$]*)} $env(QUERY_STRING) m name value] { regsub -all {\+} $value { } value set {cgi(%0 referencetype)} $value ;# {Conference Proceedings} } if [regexp {(lastupdate)=([^&$]*)} $env(QUERY_STRING) m name value] { set cgi($name) $value ;# leaves +, in this way value is a one element list and not treated has a check box value by MakeCGIArray (JoinCGIEntries) # set cgi($name) [DecodeURL $value] regsub -all {\+} $cgi(lastupdate) { } metadataLastUpdate2 } if [regexp {(returnbutton)=([^&$]*)} $env(QUERY_STRING) m name value] { set cgi($name) $value } if [regexp {(testoutofdateform)=([^&$]*)} $env(QUERY_STRING) m name value] { set cgi($name) $value ;# for example, used with ePrint (when the submission destination is another local collection) } if [regexp {(sourcesite)=([^&$]*)} $env(QUERY_STRING) m name value] { # for example, used with ePrint (when the submission destination is another local collection) set cgi($name) $value ;# leaves +, in this way value is a one element list and not treated has a check box value by MakeCGIArray (JoinCGIEntries) # set cgi($name) [DecodeURL $value] regsub -all {\+} $cgi(sourcesite) { } sourceSite } } else { # return address doesn't exist or is empty # for Copy Button foreach {name value} [split $env(QUERY_STRING) &=] { set cgi([DecodeURL $name]) [DecodeURL $value] } if [info exists cgi(returnaddress)] {unset cgi(returnaddress)} ;# drop empty return address (otherwise the update knowledgement doesn't work) } } } # cssFileURL ConditionalSet cssFileURL cgi(cssfileurl) http://$localSite/col/$languageRep1/doc/mirrorStandard.css if ![info exists cgi(returnbutton)] {set cgi(returnbutton) no} ;# needed for example when using Get set queryInfo ?languagebutton=$language ;# cgi(languagebutton) is not created and not used # append queryInfo "&mirror=$currentRep" ;# commented by GJFB in 2013-01-12 append queryInfo "&requiredmirror=$currentRep" ;# added by GJFB in 2013-01-12 - needed when "a repository already exists" (in case of duplicate) append queryInfo "&returnbutton=$cgi(returnbutton)" # submissionType if $update { # update set submissionType update set header ${update header} } else { # submit set submissionType submit set header ${submission header} ;# Submission Warning } # sourceSite ## must be here because MakeCGIArray (JoinCGIEntries) below change {ePrint.sid.inpe.br 800} into {ePrint.sid.inpe.br; 800.} # if [info exists cgi(sourcesite)] # # regsub -all {\+} $cgi(sourcesite) { } sourceSite # # # attachment if ![info exists cgi(attachment)] {set cgi(attachment) yes} append queryInfo "&attachment=$cgi(attachment)" # referenceType if [info exists cgi(referencetype)] { # url submission # ::http::geturl returns: Illegal encoding character usage "%0+" in URL path # when the query string in the URL contains the string: %0+referencetype # ::http::geturl returns: Illegal encoding character in URL path # when the query string in the URL contains the string: %250+referencetype set referenceType $cgi(referencetype) set {cgi(%0 referencetype)} $referenceType ;# {Conference Proceedings} } else { # form submission # set referenceType ${cgi(%0 referencetype)} ;# doesn't work with tcl 8.0.2p set index {%0 referencetype} set referenceType [join $cgi($index)] ;# {Conference Proceedings} -> Conference Proceedings } if 0 { puts {Content-Type: text/html} puts {} puts --$env(QUERY_STRING)-- puts --[array get cgi]-- puts $cgi($index) puts $referenceType exit } # READ if {[info exists maximumFileSizeTable($referenceType)] && \ $env(CONTENT_LENGTH) > $maximumFileSizeTable($referenceType)} { puts {Content-Type: text/html} puts {} set cgi(returnbutton) yes set returnButton [CreateReturnButton
$col/$languageRep2/doc/mirror mirror.cgi/About $display $Continue {} {} {} {} 1] puts [SetFont [subst [subst ${maximum size warning}]]] return } # parsing rule: the only field allowed immediately after the field userfile is username # there may be other fields after username TraceProcedure ;# add executing time interval TraceProcedure {reading userfile...} fconfigure stdin -translation binary # fconfigure stdin -encoding utf-8 ;# doesn't work to convert from utf-8 set userfile [read stdin $env(CONTENT_LENGTH)] # Store userfile C:/tmp/bbb2.txt binary 0 a # Store userfile C:/tmp/bbb2.txt binary 0 # exit if [info exists cgi(referencetype)] { # url submission # it is assumed that the url is utf-8 encoded foreach {name value} [split $userfile &=] { set cgi([DecodeURL $name]) [encoding convertfrom utf-8 [DecodeURL $value]] } set contentType {} } else { # form submission # Mount query # formBoundary # -----------------------------7d61fa3620408 # ------WebKitFormBoundaryPNa7JXfdnPdVMA3s (Safari) # ------WebKitFormBoundarySYbjQSzm+1S+EHIQ (Safari) # --xYzZY (unconventional form boundary observed in 2017 with respect to a 2010 spamdexing attack reaching m12 and m16) regexp {^-----+([\w\+]+)..Content-Disposition: form-data;} $userfile m formBoundary if ![info exists formBoundary] { # set time [clock format [clock seconds]] # set log "Submit ($time):" ;# commented by GJFB in 2017-10-01 set log "\[[clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]\] \[alert\] Submit (1):\nunconventional navigator\n" ;# added by GJFB in 2017-10-01 Store log $homePath/@errorLog auto 0 a Store userfile $homePath/@errorLog auto 0 a puts {Content-Type: text/html} puts {} puts "The navigator you are using is returning data in an unknown format." puts "
" puts "The returned data have been stored in our server in order to turn this new format compatible in the future." puts "
" puts "Please, inform the reception of this message to $env(SERVER_ADMIN)." return } # if [regexp {^.*Content-Disposition: form-data; name="userfile"; filename="[^"]*"} $userfile a] # # puts [regexp "^.*-----+$formBoundary..Content-Disposition: form-data; name=\"userfile\"; filename=\"\[^\"\]*\"" $userfile a] # exit if [regexp "^.*-----+$formBoundary..Content-Disposition: form-data; name=\"userfile\"; filename=\"\[^\"\]*\"" $userfile a] { # there is a file (possibly empty) # set xxx ==$a== # Store xxx C:/tmp/aaa binary 0 a # formBoundary # if [regexp "Content-Type: \[^\n\]*" $userfile contentType] # if [regexp -- "-----+$formBoundary..Content-Disposition: form-data; name=\"userfile\"; filename=\"\[^\"\]*\"..Content-Type: (\[^\n\]*)" $userfile m contentType] { # there is a Content-Type # regsub {Content-Type: } $contentType {} contentType set contentType [string trim $contentType] # userfile # regsub "^.*Content-Type: \(\[^\n\]*\)\n" $userfile {} userfile # regsub "^.*-----+$formBoundary..Content-Disposition: form-data; name=\"userfile\"; filename=\"\[^\"\]*\"..Content-Type: \(\[^\n\]*\)\n" $userfile {} userfile ;# commented by GJFB in 2021-06-16 regsub "^.*-----+$formBoundary..Content-Disposition: form-data; name=\"userfile\"; filename=\"\[^\"\]*\"..Content-Type: \[^\n\]*\n" $userfile {} userfile ;# added by GJFB in 2021-06-16 - regular expression simplification } else { # there is no Content-Type set contentType {} # userfile # regsub {^.*Content-Disposition: form-data; name="userfile"; filename="[^"]*"} $userfile {} userfile ;# commented by GJFB in 2021-05-016 regsub "^.*-----+$formBoundary..Content-Disposition: form-data; name=\"userfile\"; filename=\"\[^\"\]*\"" $userfile {} userfile } # puts $userfile # Store userfile C:/tmp/bbb3.txt binary 0 a # exit # -----------------------------7d61fa3620408 # ------WebKitFormBoundaryPNa7JXfdnPdVMA3s (Safari) # ------WebKitFormBoundarySYbjQSzm+1S+EHIQ # Store userfile C:/tmp/aaa binary 0 a # if [regexp "\n-----------------------------.*Content-Disposition: form-data\; name=\"username\".*$" $userfile b] # if [regexp {\n-----------------------------\w+\nContent-Disposition: form-data; name="username".*$} $userfile b] ;# doesn't work with \n or \n\n # if [regexp {\n-----------------------------\w+..Content-Disposition: form-data; name="username".*$} $userfile b] # # if [regexp {\n-----+\w+..Content-Disposition: form-data; name="username".*$} $userfile b] # if [regexp "\n-----+$formBoundary..Content-Disposition: form-data; name=\"username\".*$" $userfile b] { # there is a username field # puts OK2 # regsub "\n-----------------------------.*Content-Disposition: form-data\; name=\"username\".*$" $userfile {} userfile # regsub {\n-----------------------------\w+..Content-Disposition: form-data; name="username".*$} $userfile {} userfile # regsub {\n-----+\w+..Content-Disposition: form-data; name="username".*$} $userfile {} userfile regsub "\n-----+$formBoundary..Content-Disposition: form-data; name=\"username\".*$" $userfile {} userfile } else { # there is no a username field (may occur with submit) # puts OK set b {} } # exit set query $a\n\n\n\n\n$b } else { # there is no file set query $userfile set contentType {} } # Mount query - end # Store userfile C:/tmp/doc.zip binary 0 w # set userfile [string trim $userfile] # Store userfile C:/tmp/bbb3.txt binary 1 w # Store query C:/tmp/bbb binary 0 a if 0 { puts {Content-Type: text/html} puts {} puts --$query-- puts --$env(QUERY_STRING)-- puts --[array get cgi]-- exit } # Make the cgi array set cgi(filename) {} ;# in case of submitting just a reference MakeCGIArray $query # Make the cgi array - end if [regexp {&} $cgi(filename)] { # added by GJFB in 2021-06-15 # Save Image As from an HTML e-mail results in a HTML coded file name - This coded name must be decoded, otherwise the & symbol used in target file name may collide with the & symbol used in query string (ex: see srcHeadder) # ex: Capture écran 2017-02-21 à 21.49.43.png -> Capture écran 2017-02-21 à 21.49.43.png # https://www.starr.net/is/type/alt740-855.jpg ConvertStringWithAccent cgi(filename) } } TraceProcedure ;# add executing time interval TraceProcedure {cgi made} if 0 { puts {Content-Type: text/html} puts {} # puts --$query-- # puts --$env(QUERY_STRING)-- puts --[array get cgi]-- exit } # Source displayControl.tcl and xxFillingInstructions.tcl # OBS: Include has priority over the doc/xxFillingInstructions.tcl file set enableOutput 1 eval $sourceDisplayControl set cellFont {} # puts [list $languageRep2 $mirrorHomePageRepository $submissionFormRep $submissionFormLanguageRep] # return # source ../$col/$languageRep2/doc/${language}FillingInstructions.tcl source ../$col/$languageRep2/doc/${submissionFormLanguage}FillingInstructions.tcl # the command source below must be after MakeCGIArray because xxFillingInstructions.tcl may use hidden inputs (like reviewprocess) source ../$col/$submissionFormLanguageRep/doc/${submissionFormLanguage}FillingInstructions.tcl # Source displayControl.tcl and xxFillingInstructions.tcl - end # ConditionalSet submissionDeadline submissionDeadlineTable($referenceType) {} ConditionalSet updateDeadline updateDeadlineTable($referenceType) {} if {[info exists cgi(__progress_progress)] && \ [regexp {Camera-ready paper submission} $cgi(__progress_progress)]} { ConditionalSet updateDeadline cameraReadySubmissionDeadlineTable($referenceType) $updateDeadline } if ![info exists conferenceAcronym] {set conferenceAcronym {}} if ![info exists conferenceHomePage] {set conferenceHomePage {}} # if ![info exists cgi(download)] {set cgi(download) dontgeturl} if ![info exists cgi(download)] {set cgi(download) no} if ![info exists cgi(ingestactor)] {set cgi(ingestactor) {}} ;# needed with multiple creator fields if ![info exists cgi(reviewprocess)] {set cgi(reviewprocess) {}} ;# needed with multiple creator fields if ![info exists cgi(session)] {set cgi(session) {}} ;# needed for the check return option set extraCGIList [list ingestactor $cgi(ingestactor) reviewprocess $cgi(reviewprocess)] if [info exists cgi(username)] { set cgi(username) [FilterEMailAddress $cgi(username)] } if ![info exists cgi(filename)] {set cgi(filename) {}} ;# optional field with url submission if ![info exists cgi(filename2)] {set cgi(filename2) {}} ;# added by GJFB in 2022-11-01 - optional field if ![info exists cgi(returntype)] {set cgi(returntype) 0} ;# optional field with url submission - Save/Exit (from the form) if ![info exists cgi(creatorfieldindex)] {set cgi(creatorfieldindex) {}} ;# optional field with url submission if ![info exists cgi(removeindex)] {set cgi(removeindex) {}} ;# optional field with url submission if ![info exists cgi(upindex)] {set cgi(upindex) {}} ;# optional field with url submission if ![info exists cgi(downindex)] {set cgi(downindex) {}} ;# optional field with url submission if ![info exists cgi(filloutindex)] {set cgi(filloutindex) {}} ;# optional field with url submission if ![info exists cgi(creatorfield)] {set cgi(creatorfield) _A_author} ;# optional field with url submission set noFile [string equal {} $cgi(filename)] if 0 { puts {Content-Type: text/html} puts {} puts $noFile puts $referenceType puts $update # puts $automaticFilling puts [info exists attributeTable] puts [info exists publishingYear] puts --[array get cgi]-- exit } # referenceType2 # Netscape doesn't work with regsub -all { } $referenceType {} referenceType2 ;# Conference Proceedings -> ConferenceProceedings # Process multiple creator fields if {[regexp {2.1} [lindex $displayTable($referenceType,%A) 0]] && ![string equal 2 $cgi(returntype)]} { # multiple creator fields and not upload (Run button) if {![string equal {} $cgi(creatorfieldindex)] || \ ![string equal {} $cgi(removeindex)] || \ ![string equal {} $cgi(upindex)] || \ ![string equal {} $cgi(downindex)] || \ ![string equal {} $cgi(filloutindex)]} { # for code testing in Submit and for CreateMirror puts {Content-Type: text/html} puts {} set codeTesting 1 } # creatorFieldName # regsub {[0-9]+$} [lindex [array names cgi _A_*] 0] {} creatorFieldName ;# _A_author # regexp {(_A_(.*))[0-9]+$} [lindex [array names cgi _A_*] 0] m creatorFieldName label ;# _A_author author regexp {_A_(.*)} $cgi(creatorfield) creatorFieldName label ;# _A_author author set creatorList {} foreach fieldName [lsort -dictionary [array names cgi _A_*]] { set creatorFieldArray($fieldName) $cgi($fieldName) lappend creatorList $cgi($fieldName) unset cgi($fieldName) } set resumeIDFlag [info exists cgi(__resumeid_resumeid1)] set orcidFlag [info exists cgi(__orcid_orcid1)] set groupFlag [info exists cgi(__group_group1)] set affiliationFlag [info exists cgi(__affiliation_affiliation1)] set electronicmailaddressFlag [info exists cgi(__electronicmailaddress_electronicmailaddress1)] if $resumeIDFlag { # resume set resumeIDList {} foreach fieldName [lsort -dictionary [array names cgi __resumeid_resumeid*]] { lappend resumeIDList $cgi($fieldName) unset cgi($fieldName) } } if $orcidFlag { # orcid set orcidList {} foreach fieldName [lsort -dictionary [array names cgi __orcid_orcid*]] { lappend orcidList $cgi($fieldName) unset cgi($fieldName) } } if $groupFlag { # group set groupList {} foreach fieldName [lsort -dictionary [array names cgi __group_group*]] { lappend groupList $cgi($fieldName) unset cgi($fieldName) } } if $affiliationFlag { # affiliation set affiliationList {} foreach fieldName [lsort -dictionary [array names cgi __affiliation_affiliation*]] { lappend affiliationList $cgi($fieldName) unset cgi($fieldName) } } if $electronicmailaddressFlag { # electronicmailaddress set electronicmailaddressList {} foreach fieldName [lsort -dictionary [array names cgi __electronicmailaddress_electronicmailaddress*]] { set cgi($fieldName) [FilterEMailAddress $cgi($fieldName)] lappend electronicmailaddressList $cgi($fieldName) unset cgi($fieldName) } } if ![string equal {} $cgi(creatorfieldindex)] { # puts [array get creatorFieldArray] set flag 1 foreach fieldValue $creatorList { if [string equal {} $fieldValue] {set flag 0; break} } # add a creator field # puts $creatorList # puts
# puts $affiliationList # puts --$cgi(creatorfieldindex)-- # puts $flag if {0 == $cgi(creatorfieldindex)} { if $flag { set creatorList2 [concat {{!#!}} $creatorList] if $resumeIDFlag {set resumeIDList2 [concat {{}} $resumeIDList]} if $orcidFlag {set orcidList2 [concat {{}} $orcidList]} if $groupFlag {set groupList2 [concat {{}} $groupList]} if $affiliationFlag {set affiliationList2 [concat {{}} $affiliationList]} if $electronicmailaddressFlag {set electronicmailaddressList2 [concat {{}} $electronicmailaddressList]} } else { set creatorList2 $creatorList if $resumeIDFlag {set resumeIDList2 $resumeIDList} if $orcidFlag {set orcidList2 $orcidList} if $groupFlag {set groupList2 $groupList} if $affiliationFlag {set affiliationList2 $affiliationList} if $electronicmailaddressFlag {set electronicmailaddressList2 $electronicmailaddressList} } } else { set i 0 set creatorList2 {} set resumeIDList2 {} set orcidList2 {} set groupList2 {} set affiliationList2 {} set electronicmailaddressList2 {} foreach line $creatorList { lappend creatorList2 $line if $resumeIDFlag {lappend resumeIDList2 [lindex $resumeIDList $i]} if $orcidFlag {lappend orcidList2 [lindex $orcidList $i]} if $groupFlag {lappend groupList2 [lindex $groupList $i]} if $affiliationFlag {lappend affiliationList2 [lindex $affiliationList $i]} if $electronicmailaddressFlag {lappend electronicmailaddressList2 [lindex $electronicmailaddressList $i]} incr i if {$flag && $i == $cgi(creatorfieldindex)} { lappend creatorList2 {!#!} if $resumeIDFlag {lappend resumeIDList2 {}} if $orcidFlag {lappend orcidList2 {}} if $groupFlag {lappend groupList2 {}} if $affiliationFlag {lappend affiliationList2 {}} if $electronicmailaddressFlag {lappend electronicmailaddressList2 {}} } } } if $flag { # puts $creatorList2 set i 0 foreach item $creatorList2 { if [string equal {} $item] {incr i; continue} if [string equal {!#!} $item] { lappend creatorList3 {} } else { lappend creatorList3 $item } if $resumeIDFlag {lappend resumeIDList3 [lindex $resumeIDList2 $i]} if $orcidFlag {lappend orcidList3 [lindex $orcidList2 $i]} if $groupFlag {lappend groupList3 [lindex $groupList2 $i]} if $affiliationFlag {lappend affiliationList3 [lindex $affiliationList2 $i]} if $electronicmailaddressFlag {lappend electronicmailaddressList3 [lindex $electronicmailaddressList2 $i]} incr i } # puts $creatorList3 # puts [join $creatorList3 \n] # puts $creatorFieldName ;# _A_author set cgi($creatorFieldName) [join $creatorList3 \n] if $resumeIDFlag {set cgi(__resumeid_resumeid) [join $resumeIDList3 \n]} if $orcidFlag {set cgi(__orcid_orcid) [join $orcidList3 \n]} if $groupFlag {set cgi(__group_group) [join $groupList3 \n]} if $affiliationFlag {set cgi(__affiliation_affiliation) [join $affiliationList3 \n]} if $electronicmailaddressFlag {set cgi(__electronicmailaddress_electronicmailaddress) [join $electronicmailaddressList3 \n]} } else { set cgi($creatorFieldName) [join $creatorList2 \n] if $resumeIDFlag {set cgi(__resumeid_resumeid) [join $resumeIDList2 \n]} if $orcidFlag {set cgi(__orcid_orcid) [join $orcidList2 \n]} if $groupFlag {set cgi(__group_group) [join $groupList2 \n]} if $affiliationFlag {set cgi(__affiliation_affiliation) [join $affiliationList2 \n]} if $electronicmailaddressFlag {set cgi(__electronicmailaddress_electronicmailaddress) [join $electronicmailaddressList2 \n]} } source $homePath/col/$URLibServiceRepository/doc/cgi/mirror.tcl CreateMirror $update 0 $extraCGIList return } elseif {![string equal {} $cgi(removeindex)]} { # remove set i [expr $cgi(removeindex) - 1] set cgi($creatorFieldName) [join [lreplace $creatorList $i $i] \n] if $resumeIDFlag { # resumeid set cgi(__resumeid_resumeid) [join [lreplace $resumeIDList $i $i] \n] } if $orcidFlag { # orcid set cgi(__orcid_orcid) [join [lreplace $orcidList $i $i] \n] } if $groupFlag { # group set cgi(__group_group) [join [lreplace $groupList $i $i] \n] } if $affiliationFlag { # affiliation set cgi(__affiliation_affiliation) [join [lreplace $affiliationList $i $i] \n] } if $electronicmailaddressFlag { # electronicmailaddress set cgi(__electronicmailaddress_electronicmailaddress) [join [lreplace $electronicmailaddressList $i $i] \n] } source $homePath/col/$URLibServiceRepository/doc/cgi/mirror.tcl CreateMirror $update 0 $extraCGIList return } elseif {![string equal {} $cgi(upindex)]} { # move up set i [expr $cgi(upindex) - 1] set fieldValue [lindex $creatorList $i] set cgi($creatorFieldName) [join [linsert [lreplace $creatorList $i $i] [expr $i - 1] $fieldValue] \n] if $resumeIDFlag { # resumeid set fieldValue [lindex $resumeIDList $i] set cgi(__resumeid_resumeid) [join [linsert [lreplace $resumeIDList $i $i] [expr $i - 1] $fieldValue] \n] } if $orcidFlag { # orcid set fieldValue [lindex $orcidList $i] set cgi(__orcid_orcid) [join [linsert [lreplace $orcidList $i $i] [expr $i - 1] $fieldValue] \n] } if $groupFlag { # group set fieldValue [lindex $groupList $i] set cgi(__group_group) [join [linsert [lreplace $groupList $i $i] [expr $i - 1] $fieldValue] \n] } if $affiliationFlag { # affiliation set fieldValue [lindex $affiliationList $i] set cgi(__affiliation_affiliation) [join [linsert [lreplace $affiliationList $i $i] [expr $i - 1] $fieldValue] \n] } if $electronicmailaddressFlag { # electronicmailaddress set fieldValue [lindex $electronicmailaddressList $i] set cgi(__electronicmailaddress_electronicmailaddress) [join [linsert [lreplace $electronicmailaddressList $i $i] [expr $i - 1] $fieldValue] \n] } source $homePath/col/$URLibServiceRepository/doc/cgi/mirror.tcl CreateMirror $update 0 $extraCGIList return } elseif {![string equal {} $cgi(downindex)]} { # move down set i [expr $cgi(downindex) - 1] set fieldValue [lindex $creatorList $i] set cgi($creatorFieldName) [join [linsert [lreplace $creatorList $i $i] [expr $i + 1] $fieldValue] \n] if $resumeIDFlag { # resumeid set fieldValue [lindex $resumeIDList $i] set cgi(__resumeid_resumeid) [join [linsert [lreplace $resumeIDList $i $i] [expr $i + 1] $fieldValue] \n] } if $orcidFlag { # orcid set fieldValue [lindex $orcidList $i] set cgi(__orcid_orcid) [join [linsert [lreplace $orcidList $i $i] [expr $i + 1] $fieldValue] \n] } if $groupFlag { # group set fieldValue [lindex $groupList $i] set cgi(__group_group) [join [linsert [lreplace $groupList $i $i] [expr $i + 1] $fieldValue] \n] } if $affiliationFlag { # affiliation set fieldValue [lindex $affiliationList $i] set cgi(__affiliation_affiliation) [join [linsert [lreplace $affiliationList $i $i] [expr $i + 1] $fieldValue] \n] } if $electronicmailaddressFlag { # electronicmailaddress set fieldValue [lindex $electronicmailaddressList $i] set cgi(__electronicmailaddress_electronicmailaddress) [join [linsert [lreplace $electronicmailaddressList $i $i] [expr $i + 1] $fieldValue] \n] } source $homePath/col/$URLibServiceRepository/doc/cgi/mirror.tcl CreateMirror $update 0 $extraCGIList return } elseif {![string equal {} $cgi(filloutindex)]} { # fill out set cgi($creatorFieldName) [join $creatorList \n] set fieldName $cgi(filloutfieldname) if $resumeIDFlag { # resumeid if [string equal {resumeid} $fieldName] {set resumeIDList [TryFillingOut resumeid $resumeIDList $creatorFieldName $label]} set cgi(__resumeid_resumeid) [join $resumeIDList \n] } if $orcidFlag { # orcid if [string equal {orcid} $fieldName] {set orcidList [TryFillingOut orcid $orcidList $creatorFieldName $label]} set cgi(__orcid_orcid) [join $orcidList \n] } if $groupFlag { # group if [string equal {group} $fieldName] {set groupList [TryFillingOut group $groupList $creatorFieldName $label]} set cgi(__group_group) [join $groupList \n] } if $affiliationFlag { # affiliation if [string equal {affiliation} $fieldName] {set affiliationList [TryFillingOut affiliation $affiliationList $creatorFieldName $label]} set cgi(__affiliation_affiliation) [join $affiliationList \n] } if $electronicmailaddressFlag { # electronicmailaddress if [string equal {electronicmailaddress} $fieldName] {set electronicmailaddressList [TryFillingOut electronicmailaddress $electronicmailaddressList $creatorFieldName $label]} set cgi(__electronicmailaddress_electronicmailaddress) [join $electronicmailaddressList \n] } source $homePath/col/$URLibServiceRepository/doc/cgi/mirror.tcl CreateMirror $update 0 $extraCGIList return } else { set i 0 set creatorList2 {} set resumeIDList2 {} set orcidList2 {} set groupList2 {} set affiliationList2 {} set electronicmailaddressList2 {} foreach creatorName $creatorList { if {[string compare {} $creatorName] == 0} {incr i; continue} lappend creatorList2 $creatorName if $resumeIDFlag {lappend resumeIDList2 [lindex $resumeIDList $i]} if $orcidFlag {lappend orcidList2 [lindex $orcidList $i]} if $groupFlag {lappend groupList2 [lindex $groupList $i]} if $affiliationFlag {lappend affiliationList2 [lindex $affiliationList $i]} if $electronicmailaddressFlag {lappend electronicmailaddressList2 [lindex $electronicmailaddressList $i]} incr i } set cgi($creatorFieldName) [join $creatorList2 \n] if $resumeIDFlag {set cgi(__resumeid_resumeid) [join $resumeIDList2 \n]} if $orcidFlag {set cgi(__orcid_orcid) [join $orcidList2 \n]} if $groupFlag {set cgi(__group_group) [join $groupList2 \n]} if $affiliationFlag {set cgi(__affiliation_affiliation) [join $affiliationList2 \n]} if $electronicmailaddressFlag {set cgi(__electronicmailaddress_electronicmailaddress) [join $electronicmailaddressList2 \n]} } } else { set groupFlag 0 ;# used in testing for readPermission update for Journal Article } # Process multiple creator fields - end if 0 { puts {Content-Type: text/html} puts {} puts $currentRep puts $update # puts $automaticFilling puts [info exists publishingYear] puts --[array get cgi]-- exit } # 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 } # this while must be before the out-of-date form test # in order to be executed only after the previous submission # that may be a submission with respect to the same repository while {[EnterQueue Submit]} { set x2 0; after 100 {set x2 1}; vwait x2 } if $update { # update # Test out-of-date form # testoutofdateform is set to {no} in mirror.tcl for ePrints if {(![info exists testOutOfDateForm($referenceType)] || \ $testOutOfDateForm($referenceType)) && \ (![info exists cgi(testoutofdateform)] || \ [string equal {yes} $cgi(testoutofdateform)])} { if [info exists metadataLastUpdate2] { set metadataLastUpdate [Execute $serverAddressWithIP [list GetMetadataLastUpdate $metadataRep-0]] # puts [list --$metadataLastUpdate-- --$metadataLastUpdate2--] if ![string equal [lindex $metadataLastUpdate 0] [lindex $metadataLastUpdate2 0]] { # out-of-date form regsub -all { } $metadataLastUpdate {+} metadataLastUpdate ConditionalSet returnAddress cgi(returnaddress) {} if {[info exists searchOptionTable($referenceType)] && \ [string compare {yes} $searchOptionTable($referenceType)] == 0} { # SEARCH OPTION - display the filling help green iframe containing the search option for form filling # set returnAddress http://$localSite/update/$repName?mirror=$currentRep&returnbutton=$cgi(returnbutton)&lastupdate=$metadataLastUpdate&frameinuse=yes&returnaddress=$returnAddress ;# commented by GJFB in 2020-06-24 # set returnAddress http://$localSite/update/$repName?mirror=$currentRep&returnbutton=$cgi(returnbutton)&lastupdate=$metadataLastUpdate&frameinuse=no&returnaddress=$returnAddress ;# added by GJFB in 2020-06-24 - force no frame to allow the creation of the filling help green iframe containing the search option for form filling - commented by GJFB in 2020-08-24 set returnAddress http://$localSite/update/$repName?mirror=$currentRep&targetframe=$cgi(targetframe)&returnbutton=$cgi(returnbutton)&lastupdate=$metadataLastUpdate&frameinuse=no&returnaddress=$returnAddress ;# added by GJFB in 2020-08-24 - required for returning to the display frame } else { # NO SEARCH OPTION # set returnAddress http://$localSite/update/$repName?mirror=$currentRep&returnbutton=$cgi(returnbutton)&lastupdate=$metadataLastUpdate&returnaddress=$returnAddress ;# commented by GJFB in 2020-08-24 set returnAddress http://$localSite/update/$repName?mirror=$currentRep&targetframe=$cgi(targetframe)&returnbutton=$cgi(returnbutton)&lastupdate=$metadataLastUpdate&returnaddress=$returnAddress ;# added by GJFB in 2020-08-24 - needed for returning to the display frame } puts {Content-Type: text/html} puts {} # puts $env(REQUEST_URI) # puts [array names cgi] # puts [subst ${out-of-date form}] puts [subst [subst ${out-of-date form}]] LeaveQueue return } } } # Test out-of-date form - end } else { # submit if {[info exists displayTable($referenceType,username)] && \ [lindex $displayTable($referenceType,username) 0]} { set userName $cgi(username) } else { set userName $cgi(__e_mailaddress_e_mailaddress) } if 0 { puts {Content-Type: text/html} puts {} puts --$userName-- } if ![info exists cgi(password2)] {set cgi(password2) {}} set extraPath {} set repName {} ;# used by ComputeNewVersion } # Check for the same authors, title and reference type # or the same authors, title in an Electronic Source if ![info exists cgi(deposit)] {set cgi(deposit) no} # if ![string equal {yes} $cgi(deposit)] # if [string equal {no} $cgi(deposit)] { set authorType [array names cgi _A_*] ;# _A_reporter regsub {_A_} $authorType {} authorType2 ;# reporter if {[info exists cgi($authorType)] && [info exists cgi(_T_title)]} { set auxiliaryMetadataEntryList2 {} ;# {%A {{Aa Bb} {Cc Dd}}} {%T {Tt tt}} ProcessAuthorField auxiliaryMetadataEntryList2 {%A} $cgi($authorType) set creatorFieldValueList [lindex [lindex $auxiliaryMetadataEntryList2 0] 1] set searchHiddenFlag 0 if {[info exists searchForSimilarityIncludingUserNameTable($referenceType)] && \ $searchForSimilarityIncludingUserNameTable($referenceType)} { # search for similarity including the user name set searchResultList [CheckMetadataSimilarity $referenceType $authorType2 $creatorFieldValueList $cgi(_T_title) {} {} $userName $searchHiddenFlag] } else { # search for similarity excluding the user name set searchResultList [CheckMetadataSimilarity $referenceType $authorType2 $creatorFieldValueList $cgi(_T_title) {} {} {} $searchHiddenFlag] } if 0 { puts {Content-Type: text/html} puts {} puts --$searchResultList-- } if $update { set searchResultList2 {} foreach item $searchResultList { set metadataRep-i [lindex $item 1] if ![string equal $metadataRep-0 ${metadataRep-i}] { lappend searchResultList2 $item } } set searchResultList $searchResultList2 } if {[llength $searchResultList] != 0} { # a repository already exists # or # the current update causes two or more repositories with the same citation key # it might exist one or more duplicates foreach searchResult $searchResultList { foreach {serverAddress2 rep-i} $searchResult {break} SetFieldValue $serverAddress2 ${rep-i} {repository} set site [ReturnHTTPHost $serverAddress2] regsub { +} $serverAddress2 {+} serverAddress3 regexp {(.*)-([^-]*)$} ${rep-i} m metadataRep i # window regsub -all {/} ${currentRep}___$metadataRep {__} window regsub -all {\.|@|-} $window {_} window set window ${window}___$i # append similarEntries "
<http://$site/$repository??>" ;# doesn't work when the duplicate belongs to other local collection (currentRep may not exist in the local collection of the duplicate) # append similarEntries "
<http://$site/$repository??>" append similarEntries "
<http://$site/$repository:>" ConditionalSet frameInUse cgi(frameinuse) no set returnButton $cgi(returnbutton) ConditionalSet returnAddress cgi(returnaddress) {} # append similarForms "
<http://$site/update/$repository>" # append similarForms "
<http://$site/update/$repository>" # append similarForms "
<http://$site/update/$repository>" ;# doesn't work when the duplicate belongs to other local collection (currentRep may not exist in the local collection of the duplicate) append similarForms "
<http://$site/update/$repository>" } if [info exists cgi(reviewprocess)] { append queryInfo "&reviewprocess=$cgi(reviewprocess)" ;# must be before returnaddress unset cgi(reviewprocess) } if [info exists cgi(returnaddress)] { append queryInfo "&returnaddress=$cgi(returnaddress)" ;# must be after reviewprocess unset cgi(returnaddress) } set cgi(frameinuse) no ;# added by GJFB in 2020-06-24 - force no frame to allow the creation of the filling help green iframe containing the search option for form filling CreateHiddenInput returnButton2 1 regsub {\?} $queryInfo {?deposit=yes\&} queryInfoForYes if {!$update && [info exists allowDuplicateSubmissionTable($referenceType)] && \ !$allowDuplicateSubmissionTable($referenceType)} { # don't allow duplicate set returnButton "

" append returnButton $returnButton2 append returnButton "
" } else { # allow duplicate if $update { set returnButton "

" append returnButton $returnButton2 append returnButton "
" append returnButton $returnButton2 append returnButton "
" } else { set returnButton "

" append returnButton $returnButton2 append returnButton "
" append returnButton $returnButton2 append returnButton "
" } } puts {Content-Type: text/html} puts {} # puts [array get cgi] # puts $submissionFormLanguageRep set fileContent [Include $homePath/col/$submissionFormLanguageRep/doc/include/${submissionFormLanguage}${referenceType2}DuplicateWarning.html] # puts [string equal {} $fileContent] if [string equal {} $fileContent] { # default warning if $update { set fileContent ${the current update causes two or more repositories with the same citation key} } else { set fileContent ${a repository already exists} } } puts [subst [subst $fileContent]] LeaveQueue return } } } # return ;# for testing # Check for the same authors, title and reference type - end # Process ePrint # set targetfile and lastupdatedate if {[string equal {Electronic Source} $referenceType] && \ (![info exists cgi(updatetype)] || ![regexp {update source directory} $cgi(updatetype)])} { set currentDate [clock format [clock second] -format %Y-%m-%d] if !$noFile { if {![info exists cgi(_8_lastupdatedate)] || \ [string compare $cgi(_8_lastupdatedate) $currentDate] != 1} { # a new version must be made set cgi(_3_targetfile) [ComputeNewVersion $repName].pdf set cgi(_8_lastupdatedate) [clock format [expr [clock second] + 24*60*60] -format %Y-%m-%d] } } } # Process ePrint - end # Process review data if $update { # update ConditionalSet keywords cgi(_K_keywords) {} if {[info exists optionTable2($referenceType,%@documentstage)] && [regexp {Closed Review} $optionTable2($referenceType,%@documentstage)] && \ [regexp {review} $keywords]} { # is a review source $homePath/col/$repName/doc/.reviewArray.tcl foreach index [array names reviewArray] { regsub {.*,} $index {} fieldName if ![info exists cgi(${fieldName}_$fieldName)] { # if the entry doesn't exist then SET CGI ENTRY TO EMPTY set cgi(${fieldName}_$fieldName) {} } } } } # Process review data - end # referenceType3 regsub -all { } $referenceType {+} referenceType3 ;# added by GJFB in 2011-04-01 # Make Return Button if [string equal 2 $cgi(returntype)] { # upload (Run button) # returnButton for password error (no return button) set returnButton "


" } else { # not upload (Run button) if $update { # update # regsub -all { } $referenceType {+} referenceType3 append queryInfo "&referencetype=$referenceType3" if [info exists cgi(returnaddress)] {append queryInfo "&returnaddress=$cgi(returnaddress)"} if [info exists sourceSite] { # needed to return to the source form after an update error (e.g., unknown username) when closing an ePrint set returnSite [ReturnHTTPHost $sourceSite] # regsub {mirror=[^&]*&} $queryInfo "mirror=$cgi(mirror)\\&" queryInfo regsub {requiredmirror=[^&]*&} $queryInfo "requiredmirror=$cgi(requiredmirror)\\&" queryInfo } else { set returnSite $localSite } set returnButton "


" } else { # submit if [info exists cgi(ingestactor)] {append queryInfo "&ingestactor=$cgi(ingestactor)"} ;# ingestactor must be before returnaddress because it is not part of it if [info exists cgi(reviewprocess)] {append queryInfo "&reviewprocess=$cgi(reviewprocess)"} ;# reviewprocess must be before returnaddress because it is not part of it if [info exists cgi(returnaddress)] {append queryInfo "&returnaddress=$cgi(returnaddress)"} set returnButton "


" } # passworderror value must be 1 set cgi(frameinuse) no ;# added by GJFB in 2020-06-24 - force no frame to allow the creation of the filling help green iframe containing the search option for form filling CreateHiddenInput returnButton append returnButton "\
" } # Make Return Button - end # Check form # Check password # must be first because the right password is kept by the browser if $update { # update # fieldTypeNumber set fieldTypeNumber [subst [lindex $displayTable($referenceType,username) 0]] ;# subst is useful when using metaforms, e.g., when displayTable contains expression like: {[expr $update?{3}:{0}]} if {[info exists cgi(session)] && ![string equal {} $cgi(session)]} { # a session # CHECK SESSION if [CheckSession $cgi(session) $userName] { puts {Content-Type: text/html} puts {} puts [subst [subst ${closed session}]] LeaveQueue return } set password1 $cgi(session) } else { # no session if $fieldTypeNumber { # user name displayed # there is a user name field set message [subst [subst [CheckUsernamePasswordForm]]] ;# sets password1 with cgi(codedpassword1) if ![string equal {} $message] { # regsub is useful for unknown username and wrong password regsub {NAME="wrongpassword" VALUE="no"} $message {NAME="wrongpassword" VALUE="yes"} message puts {Content-Type: text/html} puts {} puts $message LeaveQueue return } } } } else { # submit if {[info exists cgi(session)] && ![string equal {} $cgi(session)]} { # a session # CHECK SESSION if [CheckSession $cgi(session) $userName] { puts {Content-Type: text/html} puts {} # puts --$cgi(session)-- # puts --$userName-- puts [subst [subst ${closed session}]] LeaveQueue return } set password1 $cgi(session) } else { # no session if {[info exists displayTable($referenceType,username)] && \ [lindex $displayTable($referenceType,username) 0]} { # user name displayed # there is a user name field set password1 $cgi(codedpassword1) ConditionalSet password2 cgi(codedpassword2) {} # puts --$password1-- # puts
# puts --$password2-- if 0 { puts {Content-Type: text/html} puts {} puts --$userName-- } # set return [Execute $serverAddressWithIP [list CheckUsernamePassword $cgi(username) $password1 $password2 $restrictedSubmission write submissionform]] set return [Execute $serverAddressWithIP [list CheckUsernamePassword $userName $password1 $password2 $restrictedSubmission write submissionform]] if 0 { puts {Content-Type: text/html} puts {} puts --$return-- } if ![string equal {} $return] { if [info exists cgi(referencetype)] { # url submission puts {Content-Type: text/plain} puts {} puts "submissionerror = $return" LeaveQueue return } set output [subst [subst [subst $[list $return]]]] # if [string equal {wrong password} $return] # ;# commented by GJFB in 2019-01-04 if [regexp {wrong password} $return] { ;# added by GJFB in 2019-01-04 - the return message might be "existing user name and wrong password" regsub {NAME="wrongpassword" VALUE="no"} $output {NAME="wrongpassword" VALUE="yes"} output } puts {Content-Type: text/html} puts {} puts $output LeaveQueue return } } else { set password1 {} } } } # Check password - end if 0 { # commented by GjFB in 2020-07-29 - There is a javascript check in the submit form # Check file name if !$update { # submit if {$noFile && [string compare yes $cgi(attachment)] == 0 && \ [regexp "$requiredFieldSymbol" [lindex $displayTable($referenceType,filename) 1]]} { puts {Content-Type: text/html} puts {} puts [subst [subst ${no file name}]] LeaveQueue return } } # Check file name - end } # Check file size if {[info exists maximumFileSizeTable($referenceType)] && \ $env(CONTENT_LENGTH) > $maximumFileSizeTable($referenceType)} { puts {Content-Type: text/html} puts {} puts [SetFont [subst [subst ${maximum size warning}]]] LeaveQueue return } # Check file size - end # Process checkbox and radio foreach index [array names displayTable $referenceType,*] { # if {![regexp "$requiredFieldSymbol" [lindex $displayTable($index) 1]] && \ # !([info exists requiredFieldAtCloseSymbol] && \ # [regexp "$requiredFieldAtCloseSymbol" [lindex $displayTable($index) 1]])} {continue} ;# commented by GJFB in 2016-06-05 set displayValue [subst $displayTable($index)] ;# 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}]}]} if {![regexp "$requiredFieldSymbol" [lindex $displayValue 1]] && \ !([info exists requiredFieldAtCloseSymbol] && \ [regexp "$requiredFieldAtCloseSymbol" [lindex $displayValue 1]])} {continue} ;# added by GJFB in 2016-06-05 # required # if [regexp {2.2|2.3} [lindex $displayTable($index) 0]] # ;# commented by GJFB in 2016-06-05 if [regexp {2.2|2.3} [lindex $displayValue 0]] { ;# added by GJFB in 2016-06-05 regsub {.*,} $index {} fieldName ;# %@language regsub -all {%|@} $fieldName {_} fieldName2 ;# __language if [string equal {} [array names cgi $fieldName2*]] { # empty field if ![info exists fieldList] {set fieldList [Execute $serverAddressWithIP [list ReturnReferModel $referenceType]]} foreach field $fieldList { if [string equal $fieldName [lindex $field 0]] { # SET CGI ENTRY TO EMPTY regsub -all {%|@| |-} $field {_} field ;# for JavaScript compatibility set cgi($field) {} break } } } } } # Process checkbox and radio - end # userGroup (used in FindNextUser) # if [info exists cgi(__usergroup_usergroup)] # ;# commented by GJFB in 2022-11-15 if {[info exists cgi(__usergroup_usergroup)] && ![string equal {} $cgi(__usergroup_usergroup)]} { ;# added by GJFB in 2022-11-15 - some repositories have still empty usergroup which results in the lost of username in FindNextUser set userGroup $cgi(__usergroup_usergroup) # Migration 30/05/04 - (usergroup inclusion) # no or empty user group } elseif {[info exists cgi(username)]} { set userGroup $cgi(username) set cgi(__usergroup_usergroup) $userGroup ;# added by GJFB in 2022-11-15 - usergroup should be updated after 30/05/04 # Migration 30/05/04 - (usergroup inclusion) - end } else { set userGroup {} } if 0 { # testing puts {Content-Type: text/html} puts {} # puts [info exists userNameList($referenceType)] # puts [array names cgi] puts [array get cgi] puts ==[info exists attributeTable]== LeaveQueue return } # publishingYear - used in displayControl.tcl ConditionalSet publishingYear cgi(_D_year) {} # secondaryType - used in displayControl.tcl if [info exists cgi(__secondarytype_secondarytype)] { set secondaryType $cgi(__secondarytype_secondarytype) } set enableOutput 1 eval $sourceDisplayControl ;# needed again because now secondaryType might exist and used in some displayControl.tcl (e.g., at inpe) - if publishingYear and attributeTableFileList exist, then attributeTable is set when evaluating sourceDisplayControl (attributeTableFileList is usually set in the corresponding displayControl.tcl file) if 0 { puts {Content-Type: text/html} puts {} # puts $errorInfo puts --$publishingYear-- puts [info exists attributeTableFileList] puts ==[info exists attributeTable]== puts --[array names attributeTable year=$publishingYear,author,group,GERALD_JEAN_*]-- puts [info exists submissionPolicyTable($referenceType)] LeaveQueue return } if 0 { puts {Content-Type: text/html} puts {} # puts $userNameList($referenceType) puts $userGroup } if [info exists userNameList($referenceType)] { # userNameTable # SUBST array set userNameTable [subst $userNameList($referenceType)] ;# may use userGroup if {[info exists {userNameTable(Declined Review)}] && \ [string compare {} $userNameTable(Declined Review)] == 0} { # Force the write user to be the administrator # regsub {@.*$} $env(SERVER_ADMIN) {} administratorUserName # set {userNameTable(Declined Review)} $administratorUserName set {userNameTable(Declined Review)} {administrator} # Force the write user to be the administrator - end } } if 0 { puts --[array get userNameTable]-- LeaveQueue return } if {[info exists cgi(username)] && \ [regexp {^([^<\s@]+)@([^@\s>]+)$} $cgi(username)] && \ (![info exists cgi(__e_mailaddress_e_mailaddress)] || \ [string equal {} $cgi(__e_mailaddress_e_mailaddress)])} { # force the e-mail address to be the user name (if it is an e-mail address) # the e-mail address is needed when creating a new password set cgi(__e_mailaddress_e_mailaddress) $cgi(username) } # nextStage - used in FindNextUser and TestUpdateClosing if [info exists cgi(__documentstage_documentstage)] { # Migration 2009-06-21 # userNameTable doesn't exist any more (the if below could be deleted) if [info exists userNameTable($cgi(__documentstage_documentstage))] { set nextStage $userNameTable($cgi(__documentstage_documentstage)) } # Migration 2009-06-21 - end set nextStage $cgi(__documentstage_documentstage) } set emptyFieldList {} # set metadataEntryList {} ;# {%A {Aa Bb}} {%A {Cc Dd}} {%T {Tt tt}} set metadataEntryList2 {} ;# {%A {{Aa Bb} {Cc Dd}}} {%T {Tt tt}} set metadataEntryList3 {} ;# {%A Aa Bb} {%A Cc Dd} {%T Tt tt} - just for post-submission processing at update # for Newspaper Article, fill out the year from the issue date if {[string equal {Newspaper Article} $referenceType] && \ [info exists cgi(_8_issuedate)] && \ [regexp {^([0-9]{4,})-[0-9]{2}} $cgi(_8_issuedate) m year]} { if [info exists cgi(_D_year)] {unset cgi(_D_year)} # lappend metadataEntryList [list %D $year] lappend metadataEntryList2 [list %D $year] } # for Newspaper Article, fill out the year from the issue date - end if 0 { puts {Content-Type: text/html} puts {} puts [array get cgi] puts ==[info exists attributeTable]== LeaveQueue return } # Automatic filling using mappings (tables) # variableNameList # used within FOREACH below only to set the vn set variableNameList {} # if !$update # ## submit if 1 { if [info exists mappingOrder] { foreach mappingOption $mappingOrder { regexp {(.*),(.*)} $mappingOption m tableParameters mappingDomainName ;# year=2008 journal foreach {name value} [split $tableParameters ,=] { # value not used lappend variableNameList vn$name ;# the prefix vn stands for variable name - vnyear } lappend variableNameList vn$mappingDomainName ;# the prefix vn stands for variable name - vnjournal } set variableNameList [lsort -unique $variableNameList] ;# vnauthor vnfirstauthor vnissn vnjournal vnyear # vnyear ConditionalSet vnyear cgi(_D_year) {} ;# needed by anticipation to find firstauthor below } } # puts "variableNameList = $variableNameList" # => vnauthor vnfirstauthor vnissn vnjournal vnyear # Automatic filling using mappings (tables) - end if [string equal 2 $cgi(returntype)] { # cgi(returntype) value is 2 upload (Run button) # set in mirror/xxCover.tcl when using Get in cgi/get.tcl # upload (Run button) if $update { # ConditionalSet languageFieldValue cgi(__language_language) {} # ConditionalSet readPermission cgi(__readpermission_readpermission) {} # SET FIELD VALUES set language2 $language SetFieldValue $serverAddress $metadataRep-0 {language readpermission contenttype} set languageFieldValue $language set language $language2 set readPermission $readpermission set repositoryContentType $contenttype } } else { # cgi(returntype) value is 0 (Save/Exit button) or 1 (Save/Check button) # not upload (Run button) set targetFileFlag 1 ;# no target file defined TraceProcedure ;# add executing time interval TraceProcedure {processing fields...} if 0 { puts {Content-Type: text/html} puts {} puts [array get cgi] puts ==[info exists attributeTable]== LeaveQueue return } if 0 { puts {Content-Type: text/html} puts {} } # FOREACH # mounts metadataEntryList2 # ex: # {%@e-mailaddress {}} {%A {{Banon, Gerald Jean Francis,} {Banon, Lise,}}} {%C {Rio de Janeiro}} # array get cgi __group_group # => # __group_group {DSR-OBT-INPE-MCTI-GOV-BR # DPI-OBT-INPE-MCTI-GOV-BR} foreach field [array names cgi] { # puts $field # puts
regsub {^_} $field {%} field2 ;# field == _A_author regsub {%_} $field2 {%@} field2 regsub -all {e_mail} $field2 {e-mail} field2 regsub {_} $field2 { } field2 ;# field2 == {%A author} set fieldName [lindex $field2 0] ;# %A %0 # Store fieldName C:/tmp/bbb auto 0 a set label [lindex $field2 1] ;# author if [info exists fieldTypeNumber] {unset fieldTypeNumber} ;# (1/2) added by GJFB in 2023-04-20 to process correctly fields like lineage in Report that might not be part of the displayTable if {[regexp {^%} $fieldName] || [lsearch -regexp [array names reviewArray] $fieldName] != -1} { # check field beginning with % or defined in reviewArray # set fieldValue [ConvertFromHTML $cgi($field)] ;# commented by GJFB in 2012-04-21 - adds one more empty issn set fieldValue2 [string trimright [ConvertFromHTML $cgi($field)] \n] ;# added by GJFB in 2012-04-21 - similar to trimright in ReloadDisplayText if [regsub -nocase -all {<\s*?a.*?a\s*>} $fieldValue2 {} fieldValue] { ;# drop links - added by GJFB in 2017-09-30 to avoid possible link spamdexing (spam links) - xxx aaa bbb aaa ccc -> xxx bbb ccc set log "probably a spamdexing attack trying to inject the following spam links:\n$fieldValue2" StoreLog {alert} {Submit (2)} $log } # puts "$field = --$fieldValue--" if {[lsearch $variableNameList vn$label] != -1} { # parameter or input (not attribute, i.e., output) set vn$label $fieldValue ;# used in automatic filling using mappings - sets for example vnarea, vnyear and vnjournal } if {[lsearch $variableNameList vnfirst$label] != -1} { if [string equal {author} $label] { # vnfirstauthor # set attributeTable(year=2009,firstauthor,area,SERGIO_APARECIDO) INFO # Find the first author having an area defined set vnfirstauthor {} foreach value [split $fieldValue \n] { # continue set outputFieldValue [ReturnAttributeValue2 year=$vnyear firstauthor area $value] if [string equal {} $outputFieldValue] {continue} set vnfirstauthor $value ;# used in automatic filling using mappings - sets vnfirstauthor - first author having an area defined break } # Find the first author having an area defined - end } else { # for example for label == group (not used) foreach value [split $fieldValue \n] { if [string equal {} $value] {continue} set vnfirst$label $value ;# used in automatic filling using mappings break } } } # Apply field value filter command # example of field value filter command: # regsub {(..)/(..)/(....)} $fieldValue {\3-\2-\1} fieldValue if [info exists fieldValueFilterCommandTable($referenceType,$fieldName)] { eval $fieldValueFilterCommandTable($referenceType,$fieldName) } # Apply field value filter command - end if [info exists displayTable($referenceType,$fieldName)] { 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}]}]} # fieldTypeNumber set fieldTypeNumber [lindex $displayValue 0] ;# added by GJFB in 2016-06-05 } if [string equal {%0} $fieldName] { # set firstLine [list "$fieldName $fieldValue"] set firstLine [list [list $fieldName $fieldValue]] } elseif {[string equal {%D} $fieldName]} { # year set year $fieldValue if [string equal {} $year] { lappend metadataEntryList2 [list $fieldName {}] } else { if {$update && [info exists cgi(updatetype)] && \ ([string equal {add} $cgi(updatetype)] || \ [string equal {add and copy} $cgi(updatetype)])} { # Add # the year must be dropped when the year field should not be displayed if [info exists displayTable($referenceType,$fieldName)] { ## fieldTypeNumber # set fieldTypeNumber [subst [lindex $displayTable($referenceType,$fieldName) 0]] ;# commented by GJFB in 2016-06-05 if {$fieldTypeNumber != 0} { # lappend metadataEntryList [list $fieldName $year] lappend metadataEntryList2 [list $fieldName $year] } } } else { # lappend metadataEntryList [list $fieldName $year] lappend metadataEntryList2 [list $fieldName $year] } } } elseif {[string equal {%U} $fieldName] && [info exists cgi(removeurlfield)] && [string equal {yes} $cgi(removeurlfield)]} { # url - remove the url field - removeurlfield is not used in the URLibService kernel } elseif {[string equal {%@readergroup} $fieldName]} { # this field doesn't belong to @metadata.refer set readerGroup $fieldValue } elseif {[string equal {%@readpermission} $fieldName]} { # this field doesn't belong to @metadata.refer set readPermission $fieldValue } elseif {[string equal {%@language} $fieldName]} { # this field doesn't belong to @metadata.refer set languageFieldValue $fieldValue } elseif {[string equal {%@contenttype} $fieldName]} { # this field doesn't belong to @metadata.refer } elseif {[string equal {%@visibility} $fieldName]} { # this field doesn't belong to @metadata.refer } elseif {[string equal {%@copyright} $fieldName]} { # this field doesn't belong to @metadata.refer } elseif {[regexp {^%T} $fieldName]} { # regsub -all {\$([^ ])} $fieldValue {$ \1} fieldValue ;# cr$30 -> cr$ 30 ;# commented by GJFB in 2018-06-14 - now 30 (in $30) is no more treated as a tcl variable when displayed (see EscapeUntrustedData) # ProcessTitleField metadataEntryList $fieldName $fieldValue ProcessTitleField metadataEntryList2 $fieldName $fieldValue } elseif {[string equal {%K} $fieldName]} { # ProcessKeywordsField metadataEntryList $fieldName $fieldValue ProcessKeywordsField metadataEntryList2 $fieldName $fieldValue } elseif {[string equal {%X} $fieldName]} { # regsub -all {\$([^ ])} $fieldValue {$ \1} fieldValue ;# cr$30 -> cr$ 30 set fieldValue [ClearField $fieldValue] # ProcessAbstractField metadataEntryList $fieldName $fieldValue # ProcessAbstractField metadataEntryList2 $fieldName $fieldValue ;# commented by GJFB in 2024-10-19 set processedAbstractField [ProcessAbstractField metadataEntryList2 $fieldName $fieldValue] ;# added by GJFB in 2024-10-19 to preserve the processed abstract field value for further ajust of metadataEntryList2 because of a split added in ProcessAbstractField (see below, just before creating metadataEntryList3) } elseif [regexp {^%} $fieldName] { # if [regexp {^%A|^%E|^%Y|^%\?|^%@group|^%@affiliation|^%@electronicmailaddress} $fieldName] if [regexp $multipleLineReferFieldNamePattern $fieldName] { # multiple line fields if {[info exists auxiliaryMetadataEntryList2] && [string equal {%A} $fieldName]} { # auxiliaryMetadataEntryList2 has already be computed when checking for the same authors, title and reference type set metadataEntryList2 [concat $metadataEntryList2 $auxiliaryMetadataEntryList2] } else { if {[lsearch $authorFieldNameList $label] != -1} { # author editor... ## names are formatted in LoadMetadata through a call to the procedure FormatName # names are formatted in ProcessAuthorField through a call to the procedure FormatName ProcessAuthorField metadataEntryList2 $fieldName $fieldValue } else { # program receiver resumeid orcid group affiliation secondarymark... # puts $metadataEntryList2 ProcessMultipleLineField metadataEntryList2 $fieldName $fieldValue } } } else { # simple line fields # Store fieldName C:/tmp/bbb auto 0 a # set fieldValue $cgi($field) if [string equal {} $fieldValue] { lappend metadataEntryList2 [list $fieldName {}] } else { regsub -all {\\\[} $fieldValue {[} fieldValue ;# \[CD-ROM\] -> [CD-ROM] regsub -all {\\\]} $fieldValue {]} fieldValue # regsub -all {\$([^ ])} $fieldValue {$ \1} fieldValue ;# cr$30 -> cr$ 30 if [string equal {%3} $fieldName] { # targetfile if {[info exists targetFilePatternTable($referenceType)] && \ ![string equal {} $targetFilePatternTable($referenceType)]} { set fieldValue $targetFilePatternTable($referenceType) set cgi(_3_targetfile) $fieldValue ;# overwrite } set targetFileFlag 0 ;# target file defined } # lappend metadataEntryList [list $fieldName $fieldValue] lappend metadataEntryList2 [list $fieldName $fieldValue] # if #!$update && if {[string equal {Conference Proceedings} $referenceType] && \ [info exists publishingProgressTable($referenceType)] && \ [string equal {%@subject} $fieldName]} { if {!$update || [regexp {1} $publishingProgressTable($referenceType)]} { # submit or conference progress is Submission and Update, or Update Only # subject -> session set fieldTypeNumber [subst [lindex $displayTable($referenceType,%@session) 0]] if {$fieldTypeNumber == 0} { # lappend metadataEntryList [list %@session $fieldValue] # lappend metadataEntryList2 [list %@session $fieldValue] UpdateMetadataEntryList metadataEntryList2 %@session $fieldValue 1 } } if {!$update || [regexp {1|3} $publishingProgressTable($referenceType)]} { # submit or conference progress is Submission and Update, or Update Only # subject -> theme (%9 type) set fieldTypeNumber [subst [lindex $displayTable($referenceType,%9) 0]] if {$fieldTypeNumber == 0} { # lappend metadataEntryList [list %9 $fieldValue] # lappend metadataEntryList2 [list %9 $fieldValue] UpdateMetadataEntryList metadataEntryList2 %9 $fieldValue 1 } } } } if {[string equal {%@archivingpolicy} $fieldName]} { set archivingPolicy $fieldValue ;# used with Journal Article reference } elseif {[string equal {%8} $fieldName]} { set month $fieldValue ;# used with Journal Article reference } elseif {[string equal {%@versiontype} $fieldName]} { set versionType $fieldValue ;# used with Journal Article reference } } } # puts [list $fieldName [info exists requiredFieldAtCloseSymbol] [TestUpdateClosing]] # puts [list $field = $cgi($field)] if [info exists displayTable($referenceType,$fieldName)] { # set fillingInstruction [lindex $displayTable($referenceType,$fieldName) 1] ;# commented by GJFB in 2016-06-05 set fillingInstruction [lindex $displayValue 1] ;# added by GJFB in 2016-06-05 # puts [list $fieldName [regexp "$requiredFieldSymbol" $fillingInstruction]] # puts [list $fieldName $requiredFieldSymbol $fillingInstruction] if {![regexp "$requiredFieldSymbol" $fillingInstruction] && \ !([info exists requiredFieldAtCloseSymbol] && \ [regexp "$requiredFieldAtCloseSymbol" $fillingInstruction] && \ [TestUpdateClosing])} {continue} } # puts [list $field = $cgi($field)] if [string equal {} $cgi($field)] { # emptyFieldList # puts $field # puts $fieldTypeNumber # if [string equal {} [lindex $displayTable($referenceType,$fieldName) 3]] # ;# commented by GJFB in 2016-06-05 if [string equal {} [lindex $displayValue 3]] { ;# added by GJFB in 2016-06-05 set translatedCustomizedFieldName $conversionTable($label) } else { # set customizedFieldName [lindex $displayTable($referenceType,$fieldName) 3] ;# commented by GJFB in 2016-06-05 set customizedFieldName [lindex $displayValue 3] ;# added by GJFB in 2016-06-05 # if [info exists ${customizedFieldName}($referenceType,$fieldName)] # set translatedCustomizedFieldName [subst $\{${customizedFieldName}($referenceType,$fieldName)\}] if [info exists translationTable($customizedFieldName,$referenceType,$fieldName)] { set translatedCustomizedFieldName $translationTable($customizedFieldName,$referenceType,$fieldName) } else { # don't translate set translatedCustomizedFieldName $customizedFieldName } } ## fieldTypeNumber # set fieldTypeNumber [subst [lindex $displayTable($referenceType,$fieldName) 0]] ;# commented by GJFB in 2016-06-05 # if {$fieldTypeNumber != 0} # ;# commented by GJFB in 2023-04-20 if {[info exists fieldTypeNumber] && $fieldTypeNumber != 0} { ;# (2/2) added by GJFB in 2023-04-20 to process correctly fields like lineage in Report that might not be part of the displayTable # if added by GJFB in 2013-04-27 to allow the use of the string (*) (meaning required field) even with hidden input lappend emptyFieldList $translatedCustomizedFieldName } } } } # FOREACH - end if 0 { # testing LeaveQueue return } TraceProcedure ;# add executing time interval TraceProcedure {field processed} # duplicateTemplate if {[info exists cgi(templaterepository)] && \ [file isdirectory $homePath/col/$cgi(templaterepository)/doc] && \ [TestContentType $cgi(templaterepository) {Template} $homePath]} { set duplicateTemplate 1 } else { set duplicateTemplate 0 } if $targetFileFlag { # no target file defined if {[info exists targetFilePatternTable($referenceType)] && \ ![string equal {} $targetFilePatternTable($referenceType)]} { set fieldValue $targetFilePatternTable($referenceType) set cgi(_3_targetfile) $fieldValue # lappend metadataEntryList [list %3 $fieldValue] lappend metadataEntryList2 [list %3 $fieldValue] } else { if $duplicateTemplate { # duplicate template Load $homePath/col/$cgi(templaterepository)/service/targetFile targetFile lappend metadataEntryList2 [list %3 $targetFile] } } } if 0 { # testing puts {Content-Type: text/html} puts {} # puts --$vnfirstauthor-- # puts $targetFileFlag puts $metadataEntryList2 puts ==[info exists attributeTable]== puts $fieldName # => author4 puts $fieldTypeNumber # => 1 LeaveQueue return } if {[llength $emptyFieldList] == 1} { puts {Content-Type: text/html} puts {} puts [subst [subst ${empty field}]] LeaveQueue return } if {[llength $emptyFieldList] > 1} { puts {Content-Type: text/html} puts {} puts [subst [subst ${empty fields}]] LeaveQueue return } } ;# end of not upload (Run button) # Check content type if {!$noFile && \ [info exists contentTypeTable($referenceType)] && \ ![string equal {} $contentTypeTable($referenceType)] && \ ![string equal {} $contentType]} { if {[lsearch $contentTypeTable($referenceType) $contentType] == -1} { # sometimes the browser doesn't recognize the content file properly # in this case the file extension is checked set fileExtension [file extension $cgi(filename)] if [string equal {.pdf} $fileExtension] {set contentType application/pdf} if [string equal {.doc} $fileExtension] {set contentType application/msword} if {[lsearch $contentTypeTable($referenceType) $contentType] == -1} { # wrong content type set contentTypeList [join $contentTypeTable($referenceType)
] puts {Content-Type: text/html} puts {} if $update { # update if {[llength $contentTypeTable($referenceType)] == 1} { puts [SetFont [subst [subst ${wrong content type for update - singular}]]] } else { puts [SetFont [subst [subst ${wrong content type for update - plural}]]] } } else { # submit if {[llength $contentTypeTable($referenceType)] == 1} { puts [SetFont [subst [subst ${wrong content type for submission - singular}]]] } else { puts [SetFont [subst [subst ${wrong content type for submission - plural}]]] } } LeaveQueue return } } } # Check content type - end # Check for header # used for ePrint # if {[info exists headerTable($referenceType)] && !$noFile} # if {[info exists headerTable($referenceType)] && !$noFile && \ (![info exists cgi(updatetype)] || ![regexp {update source directory} $cgi(updatetype)])} { set wantedRepository dpi.inpe.br/banon-pc2@1905/2006/03.22.15.15 ;# a Tcl CGI script to add a header in a pdf document set siteRep [FindSite2 $wantedRepository] # set siteToAddHeader [ReturnHTTPHost [lindex $siteRep 0]] set siteToAddHeader [lindex $siteRep 0] ;# added by GJFB in 2013-08-15 - ReturnHTTPHost not needed (called in GetURLPropertyList) if [string equal {} $siteToAddHeader] { puts {Content-Type: text/html} puts {} puts [subst [subst ${repository not found}]] ;# uses wantedRepository LeaveQueue return } if 0 { # not used any more if ![string equal {application/pdf} $contentType] { # a Tcl CGI script to convert a PostScript file into a PDF file set wantedRepository dpi.inpe.br/banon-pc2@1905/2006/04.03.21.25 set siteToConvertPostScriptToPDF [lindex [FindSite2 $wantedRepository] 0] if {[string compare {} $siteToConvertPostScriptToPDF] == 0} { puts {Content-Type: text/html} puts {} puts [subst [subst ${repository not found}]] ;# uses wantedRepository LeaveQueue return } } } set rightPSFile 1 } else { set rightPSFile 0 } # Check for header - end if 0 { # testing puts {Content-Type: text/html} puts {} # puts $userNameList($referenceType) puts OK puts --$cgi(returntype)-- } # nextUser if [catch {FindNextUser $update} nextUser] { # next user not found puts {Content-Type: text/html} puts {} set codeTesting 1 error $errorInfo # error $nextUser LeaveQueue return } if 0 { # testing puts {Content-Type: text/html} puts {} puts [array get cgi]

puts --$nextUser-- # puts --[array names attributeListTable $referenceType,$year,*]-- puts ==[info exists attributeTable]== puts --[llength [array names attributeTable]]-- puts --[array names attributeTable year=$publishingYear,author,group,GERALD_JEAN_*]-- puts --[array get attributeTable year=$publishingYear,author,affiliation,GERALD_JEAN_*]-- # puts --[array get attributeTable]-- puts $metadataEntryList2 # puts $mappingOrder LeaveQueue return } # Check form - end # Automatic filling using mappings (tables) if 0 { puts {Content-Type: text/html} puts {} puts {automatic filling using mappings} puts
puts [info exists automaticFilling] puts
# puts $automaticFilling # puts
} if {[info exists automaticFilling] && $automaticFilling} { # puts "variableNameList = $variableNameList" # => vnauthor vnfirstauthor vnissn vnjournal vnyear # puts [array names fillOutFieldTable] # if !$update # ## submit if 1 { # fieldList # => {%A author} {%B journal} # puts [info exists fieldList] if ![info exists fieldList] {set fieldList [Execute $serverAddressWithIP [list ReturnReferModel $referenceType]]} # puts $fieldList # set attributeListTable(year=2012,journal) {dissemination issn secondarytype} # set attributeListTable(year=2012,author) {resumeid group affiliation} # set attributeListTable(year=2012,firstauthor) {area} # set attributeListTable(year=2012,issn) {secondarymark} ;# qualis # set mappingOrder {year=2012,journal year=2012,author year=2012,firstauthor year=2012,issn} # set attributeListTable(year=2008,area=SRE,issn) {secondarymark} # set mappingOrder {year=2008,area=SRE,issn} # puts "mappingOrder = --$mappingOrder--" if [info exists mappingOrder] { source ../$col/$URLibServiceRepository/doc/accentTables.tcl ;# used in ReturnAttributeValue foreach mappingOption $mappingOrder { # puts "mappingOption = --$mappingOption--" # => mappingOption = --year=2013,author-- set flag 1 ;# mappingOption is significant for this submission # 1 mappingDomainName regexp {(.*),(.*)} $mappingOption m tableParameters mappingDomainName ;# year=2007 journal ;# year=2008,area=SRE issn foreach domain [split $tableParameters ,] { foreach {name value} [split $domain =] { if {![info exists vn$name] || ![string equal [set vn$name] $value]} {set flag 0} } } # puts "mappingDomainName = --$mappingDomainName--" # puts [info exists vn$mappingDomainName] if ![info exists vn$mappingDomainName] {set flag 0} # puts "flag = $flag" if $flag { # mappingOption is significant for this submission # 2 fieldName (of the mappingDomainName) # inputReferName set inputReferName {} foreach field2 $fieldList { if [string equal $mappingDomainName [lindex $field2 1]] { set inputReferName [lindex $field2 0] ;# %B # puts "inputReferName = --$inputReferName--" break } } # puts "attributeListTable($mappingOption) = --$attributeListTable($mappingOption)--" # => attributeListTable(year=2012,journal) = --dissemination issn secondarytype-- foreach attributeName $attributeListTable($mappingOption) { if {[lsearch $authorFieldNameList $attributeName] != -1 && $update} {continue} ;# discard author field names at update (ProcessAuthorField just works at submit) # puts "attributeName == --$attributeName--
" # => attributeName == --affiliation--
# puts [info exists vn$attributeName] # if [info exists vn$attributeName] {puts --[set vn$attributeName]--} # if ![info exists vn$attributeName] # ;# commented by GJFB in 2013-02-14 otherwise the issn field is not filled out at update ## for example: issn doesn't exist (it could exists and it should not be changed - it could be output and is now input) set processFlag 1 ;# do automatic filling set inputFieldValue [set vn$mappingDomainName] # puts --[set vn$mappingDomainName]-- # puts "inputFieldValue = --$inputFieldValue--" # _B_journal = Acta_Astronautica # _A_author = {Gerald_Banon Lise_Banon} # attributeReferName foreach field2 $fieldList { set label [lindex $field2 1] ;# author if [string equal $attributeName $label] { set attributeReferName [lindex $field2 0] ;# %@dissemination break } } # array set fillOutFieldTable [list {Thesis,%@project,%@group} $courseGroupFillout] # puts $referenceType,*,$attributeReferName # puts [llength [array names fillOutFieldTable $referenceType,*,$attributeReferName]] # if {$update && [llength [array names fillOutFieldTable $referenceType,*,$attributeReferName]]} {continue} ;# at update don't do automatic filling - give priority to conditional filling - added by GJFB in 2013-04-27 if [llength [array names fillOutFieldTable $referenceType,*,$attributeReferName]] {continue} ;# don't do automatic filling - give priority to conditional filling, for example when attributeName == affiliation - added by GJFB in 2013-04-27 # puts "attributeName == --$attributeName--
" # fieldTypeNumber if [info exists displayTable($referenceType,$attributeReferName)] { set fieldTypeNumber [lindex $displayTable($referenceType,$attributeReferName) 0] } else { set fieldTypeNumber 0 } # metadataEntryArray if [info exists metadataEntryArray] {unset metadataEntryArray} array set metadataEntryArray [join $metadataEntryList2] ConditionalSet oldOutputValueList metadataEntryArray($attributeReferName) {} ;# the manually filled field value if any # puts "inputReferName = --$inputReferName--" if [regexp $multipleLineReferFieldNamePattern $inputReferName] { # multiple line fields # puts "inputReferName = --$inputReferName--" # => inputReferName = --%A-- # puts --$inputFieldValue-- set fieldValue {} foreach oldOutputValue $oldOutputValueList inputItemValue [split $inputFieldValue \n] { # puts "oldOutputValue = --$oldOutputValue--" # => oldOutputValue = --Instituto Nacional de Pesquisas Espaciais (INPE)-- set inputItemValue [string trim $inputItemValue] ;# added by GJFB in 2013-05-11 - needed to drop a trailing new line that appears when running url submission # examples: # ReturnAttributeValue year=$vnyear author group $value # ReturnAttributeValue year=$vnyear issn secondarymark $value # puts "attributeName == --$attributeName--
" # puts [list $tableParameters $mappingDomainName $attributeName $inputItemValue] if [catch {ReturnAttributeValue $tableParameters $mappingDomainName $attributeName $inputItemValue} outputItemValue] { set processFlag 0 ;# don't do automatic filling # set log "\[[clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]\] Submit (1):\n$errorInfo\n" # Store log $homePath/@errorLog auto 0 a StoreLog {alert} {Submit (3)} $errorInfo break } else { if [string equal {issn} $mappingDomainName] { set fieldValue $outputItemValue if [string equal {} $fieldValue] {continue} else {break} ;# uses the first issn value - secondarymark is not a multiple line field } else { # puts $fieldTypeNumber
# => [expr $update?{2.1}:{0}]
# puts [subst $fieldTypeNumber]
# => 2.1
# if {[string equal {} $outputItemValue] && [regexp {^(2.1|3)$} $fieldTypeNumber]} # ;# commented by GJFB in 2013-07-10 - don't allow manual change unless the field is empty # if [regexp {^(2.1|3)$} $fieldTypeNumber] # ;# commented by GJFB in 2020-11-08 if [regexp {^(2.1|3)$} [subst $fieldTypeNumber]] { ;# added by GJFB in 2020-11-08 - fieldTypeNumber value might be of the type [expr $update?{2.1}:{0}] (see metaform) # puts -1-$oldOutputValue--
# => -1-Instituto Nacional de Pesquisas Espaciais (INPE)--
lappend fieldValue $oldOutputValue ;# do no changes - use manual filling } else { # puts -2-$outputItemValue--
lappend fieldValue $outputItemValue ;# force update - use automatic filling } } } } # puts >>>$fieldValue
if $processFlag { # do automatic filling set fieldValue [DropTrailingEmptyItems $fieldValue] ;# a {} c {} -> a {} c # puts 1-$metadataEntryList2
# FILL # puts $fieldValue
if {[lsearch $authorFieldNameList $label] != -1} { # author editor... ProcessAuthorField metadataEntryList2 $attributeReferName [join $fieldValue \n] ;# attributeReferName == %A } else { # program receiver resumeid orcid group affiliation secondarymark... ProcessMultipleLineField metadataEntryList2 $attributeReferName [join $fieldValue \n] 1 ;# update metadataEntryList2 } } # puts 2-$metadataEntryList2
} else { # simple line fields # puts [list ReturnAttributeValue $tableParameters $mappingDomainName $attributeName $inputFieldValue] # puts --$inputFieldValue-- if [catch {ReturnAttributeValue $tableParameters $mappingDomainName $attributeName $inputFieldValue} outputfieldValue] { set processFlag 0 ;# don't do automatic filling # set log "\[[clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]\] Submit (2):\n$errorInfo\n" # Store log $homePath/@errorLog auto 0 a StoreLog {alert} {Submit (4)} $errorInfo } else { # if {[string equal {} $outputfieldValue] && [regexp {^(2.1|3)$} $fieldTypeNumber]} # ;# commented by GJFB in 2013-07-10 - don't allow changing manually secondarytype (PRE PI -> PRE PI IPV) # if [regexp {^(2.1|3)$} $fieldTypeNumber] # ;# commented by GJFB in 2020-11-08 if [regexp {^(2.1|3)$} [subst $fieldTypeNumber]] { ;# added by GJFB in 2020-11-08 - fieldTypeNumber value might be of the type [expr $update?{2.1}:{0}] (see metaform) set fieldValue $oldOutputValueList ;# do no changes - use manual filling } else { set fieldValue $outputfieldValue ;# force update - use automatic filling } # puts 1-$metadataEntryList2
# FILL # puts $fieldValue
UpdateMetadataEntryList metadataEntryList2 $attributeReferName $fieldValue 1 ;# attributeReferName == %@dissemination # puts 2-$metadataEntryList2
} } set vn$attributeName $fieldValue ;# used in case of mapping composition (see mappingOrder) # puts [list vn$attributeName [set vn$attributeName]] if [regexp $multipleLineReferFieldNamePattern $attributeReferName] { foreach value $fieldValue { if [string equal {} $value] {continue} set vnfirst$attributeName $value ;# used in case of mapping composition (see mappingOrder) break } } # } } } } } if 0 { LeaveQueue return } } # Automatic filling using mappings (tables) - end # metadataEntryList2 ex: # {%@e-mailaddress {}} {%A {{Banon, Gerald Jean Francis,} {Banon, Lise,}}} {%C {Rio de Janeiro}} {%@area SRE} {%@group {DPI-OBT-INPE-MCTI-GOV-BR {}}} {%@affiliation {{Instituto Nacional de Pesquisas Espaciais (INPE)} {}}} if 0 { # testing puts {Content-Type: text/html} puts {} # puts [info exists automaticFilling] # puts "mappingOrder = --$mappingOrder--" # puts --[array names attributeListTable $referenceType,$year,*]-- puts --[array get attributeTable]-- # puts --[array names attributeTable]-- puts $metadataEntryList2 LeaveQueue return } if ![string equal 2 $cgi(returntype)] { # not upload (Run button) # set metadataEntryList [concat $firstLine $metadataEntryList] set metadataEntryList2 [concat $firstLine $metadataEntryList2] # puts [join $metadataEntryList2
] # LeaveQueue # return } if $update { # update if {[info exists cgi(updatetype)] && \ ([string equal {add} $cgi(updatetype)] || \ [string equal {add and copy} $cgi(updatetype)])} { # Add set update 0 } } # Process review data if $update { # update if {[info exists optionTable2($referenceType,%@documentstage)] && [regexp {Closed Review} $optionTable2($referenceType,%@documentstage)] && \ [regexp {review} $keywords]} { # is a review foreach index [array names reviewArray] { regsub {.*,} $index {} fieldName set reviewArray($repName,$fieldName) $cgi(${fieldName}_$fieldName) } # SAVE the review StoreArray reviewArray $homePath/col/$repName/doc/.reviewArray.tcl w list array 1 } } # Process review data - end if 0 { puts {Content-Type: text/html} puts {} puts --$metadataEntryList2-- puts --$nextUser-- LeaveQueue exit } # Changing the document stage field value # when its value is {another advanced user} (replace it with the nextUser value) # puts [join $metadataEntryList2
] if [info exists cgi(__documentstage_documentstage)] { if [string equal {another advanced user} $cgi(__documentstage_documentstage)] { # UpdateMetadataEntryList metadataEntryList %@documentstage $nextUser 1 UpdateMetadataEntryList metadataEntryList2 %@documentstage $nextUser 1 } elseif {0 && ![string equal {Closed Review} $cgi(__documentstage_documentstage)]} { ;# commented by GJFB in 2024-08-29 since nothing is done within this elseif # not a closed review # nextUser has been computed using document stage value. Document stage value can now be changed to "not transferred" if !$cgi(returntype) { # 0 # exit (from the form) # UpdateMetadataEntryList metadataEntryList2 %@documentstage {not transferred} 1 ;# commented by GJFB in 2020-12-03 - documentstage should display the user name to whom the update permission has been transferred - in this way we know that the current metadata is from the user who have transferred the update permission - the name of this user appears in the History field } } } # puts [join $metadataEntryList2
] # Changing the document stage field value - end if ![info exists cgi(_U_url)] {set cgi(_U_url) {}} # ConditionalSet repositoryContentType cgi(__contenttype_contenttype) {} ;# commented by GJFB in 2012-02-21 - see $cgi(returntype) == 2 if ![info exists repositoryContentType] {ConditionalSet repositoryContentType cgi(__contenttype_contenttype) {}} if {[info exists localCollectionPublisherTable($referenceType)] && \ [info exists cgi(_I_publisher)] && \ ([string equal {} $repositoryContentType] || [string equal {External Contribution} $repositoryContentType])} { if [regexp $localCollectionPublisherTable($referenceType) $cgi(_I_publisher)] { set repositoryContentType {} } else { set repositoryContentType {External Contribution} } } if 0 { puts {Content-Type: text/html} puts {} # puts --$metadataEntryList2-- # puts --$contentType-- # puts --$repositoryContentType-- # puts [info exists {optionTable2(Conference Proceedings,%9)}] # puts $optionTable2(Conference Proceedings,%9) puts [array get cgi] LeaveQueue exit } if {![info exists cgi(updatetype)] || ![string equal {add and copy} $cgi(updatetype)]} { # PutDocumentOnClipboard if [catch { PutDocumentOnClipboard \ $noFile $cgi(download) $env(DOCUMENT_ROOT) $cgi(_U_url) $contentType userfile \ $cgi(filename) $rightPSFile $repositoryContentType $env(ENCODING_SYSTEM) \ $cgi(filename2) } message] { # foreach {message itemName token} $message {break} ;# commented by GJFB in 202-10-29 - might produce the error: list element in quotes followed by ":" instead of space if [catch {foreach {message itemName token} $message {break}}] { ;# if added by GJFB in 2022-10-29 puts {Content-Type: text/html} puts {} puts $message LeaveQueue return } else { if [info exists cgi(referencetype)] { # url submission puts {Content-Type: text/plain} puts {} puts "submissionerror = url $itemName not found" LeaveQueue return } catch {SetFont [subst [subst [subst $[list $message]]]]} output puts {Content-Type: text/html} puts {} puts $output LeaveQueue return } } else { foreach {noFile documentPath unzip contentType2} $message {break} ;# documentPath is clipboard2 # noFile == 0 means now that there is a file on the clipboard2 } } if 0 { LeaveQueue puts {Content-Type: text/html} puts {} puts --$noFile-- puts $documentPath # => /mnt/dados1/URLib21b/clipboard2 puts [exec ls -al $documentPath] # => -rw-rw-r-- 1 bibdigital urlib 17667 May 10 21:59 index.php exit } TraceProcedure ;# add executing time interval TraceProcedure {processing tcl page...} if $update { # update ConditionalSet folderName cgi(foldername) {} ;# used at update only for the moment if [string equal {} $folderName] { set folderName2 {} } else { set folderName2 $folderName/ } set processTclPage 0 if {[info exists cgi(updatetype)] && [regexp {update agreement directory} $cgi(updatetype)]} { set updateAgreement 1 } else { set updateAgreement 0 } if {[info exists cgi(turnattachedfiletargetfile)] && \ [string equal {yes} $cgi(turnattachedfiletargetfile)] && \ ![string equal {} $cgi(filename)]} { # set cgi(_3_targetfile) $cgi(filename) ;# overwrite set cgi(_3_targetfile) ${folderName2}$cgi(filename) ;# overwrite } if [info exists cgi(_3_targetfile)] { set targetFile $cgi(_3_targetfile) if [string equal {} $targetFile] { # new code (2008-06-05) file delete $homePath/col/$repName/service/targetFile } else { # nonempty target file name Load $homePath/col/$repName/service/targetFile oldTargetFile if ![string equal $oldTargetFile $targetFile] { # new target file name - target file name has changed # priority is given to the new target file - ignore any change of the code for dynamic page Store targetFile $homePath/col/$repName/service/targetFile set processTclPage 1 } else { # same target file name # assumption: the target file name is not empty # a == the attached file is the target file # b == there is a code for dynamic page # c == the code has changed # d == there is a file on the clipboard2 (!$noFile) # e == the update type is not update agreement directory (!$updateAgreement) # a => d (the symbol => means imply) # a,b,c,d,e array set processTclPageArray { 1,-,-,-,0 0 1,-,-,-,1 1 0,1,0,0,0 0 0,1,0,0,1 0 0,1,0,1,0 0 0,1,0,1,1 1 0,1,1,-,- 1 0,0,-,0,0 0 0,0,-,0,1 0 0,0,-,1,0 0 0,0,-,1,1 1 } # processTclPageArray not used explicitly # if [string equal $targetFile $cgi(filename)] # if [string equal $targetFile ${folderName2}$cgi(filename)] { # the attached file is the target file # priority is given to the attached file - ignore the code for dynamic page if !$updateAgreement { KeepOldVersionOfTeXTargetFile $repName $targetFile # set processTclPage [expr !$noFile] set processTclPage 1 } } else { # the attached file is NOT the target file if [info exists cgi(codefordynamicpage)] { # there is a code for dynamic page set fileContent $cgi(codefordynamicpage) Load $homePath/col/$repName/doc/$targetFile fileContent2 if [string equal [string trim $fileContent] [string trim $fileContent2]] { # are the same - the code has not changed # set processTclPage [expr !$noFile] set processTclPage [expr !$noFile && !$updateAgreement] } else { # are different - the code has changed # update the target file with the code for dynamic page KeepOldVersionOfTeXTargetFile $repName $targetFile Store fileContent $homePath/col/$repName/doc/$targetFile set processTclPage 1 } } else { # there is no code for dynamic page # set processTclPage [expr !$noFile] set processTclPage [expr !$noFile && !$updateAgreement] } } } } } else { # use the existing target file name contains in the metadata set processTclPage [expr !$noFile] } } TraceProcedure ;# add executing time interval TraceProcedure {tcl page processed} # postSubmissionScriptRepList if [info exists postSubmissionProcessTable($referenceType)] { set postSubmissionScriptRepList $postSubmissionProcessTable($referenceType) } else { set postSubmissionScriptRepList {} } if [info exists depositOptionTable($referenceType)] { array set depositOptionArray $depositOptionTable($referenceType) } ConditionalSet copyAbstractToDoc depositOptionArray(copyabstracttodoc) 0 ConditionalSet copyFooterToAgreement depositOptionArray(copyfootertoagreement) 1 if ![string equal 2 $cgi(returntype)] { # DROP NEWLINES # 0 1 # not upload (Run button) # regsub -all "\n+" $metadataEntryList { } metadataEntryList ;# mandatory, otherwise an error will occur in executing CreateRepMetadataRep below regsub -all "\n+" $metadataEntryList2 { } metadataEntryList2 ;# mandatory, otherwise an error will occur in executing CreateRepMetadataRep below if 0 { # commented by GJFB in 2024-10-19 because metadataEntryList2 must be updated like metadataEntryList3 was # metadataEntryList2 -> metadataEntryList3 ConvertListFormatToReferFormat metadataEntryList2 metadataEntryList3 # Add a 'join' for abstract # added by GJFB in 2023-05-25 added by GJFB in 2023-05-25 - a 'join' is required because of the 'split' that has been added in ProcessAbstractField set referMetadata [join $metadataEntryList3 \n] set abstract [join [GetReferField $referMetadata X]] # puts --$abstract-- set metadataEntryList3 [split [PutReferField $referMetadata %X $abstract] \n] # Add a 'join' for abstract - end } else { # added by GJFB in 2024-10-19 to have metadataEntryList2 updated like metadataEntryList3 was - otherwise, when the option excludedFieldListTable in the displayControl.tcl is in use (like for Thesis in the INPE displayControl.tcl) an unupdated metadataEntryList2 is used resulting in the creation of successive braces in abstract (like: BAM-62, {{~180km}} e BAM-126, {{~100km).}.} - see abstract of id 8JMKD3MGP3W34T/4BMBKAS) # Add a 'join' for abstract # added by GJFB in 2023-05-25 added by GJFB in 2023-05-25 - a 'join' is required because of the 'split' that has been added in ProcessAbstractField UpdateMetadataEntryList metadataEntryList2 %X [join $processedAbstractField] 1 # Add a 'join' for abstract - end # metadataEntryList2 -> metadataEntryList3 ConvertListFormatToReferFormat metadataEntryList2 metadataEntryList3 } } TraceProcedure ;# add executing time interval TraceProcedure {metadataEntryList3 made} if 0 { LeaveQueue puts {Content-Type: text/html} puts {} # puts $targetFile # Load $homePath/col/$repName/service/targetFile targetFile2 # puts $targetFile2 ;# targetFile and targetFile2 may be different because of permission problem (after import the group of service/targetFile might be root and not urlib) puts [info exists excludedFieldListTable($referenceType)] # puts $excludedFieldListTable($referenceType) puts 1-$metadataEntryList2 ;# {%@copyholder SID/SCD} {%@project CMC} puts 2-$metadataEntryList3 # puts 3-[join $metadataEntryList2] ; # %@copyholder SID/SCD %@project CMC puts $abstract puts $referMetadata exit } # set xxx $metadataEntryList3 # Store xxx C:/tmp/bbb.txt auto 0 a if ![info exists readPermission] {set readPermission {}} if $update { # update # if ![info exists readPermission] {set readPermission {}} if ![info exists languageFieldValue] {set languageFieldValue {}} if ![info exists archivingPolicy] {set archivingPolicy {}} ;# used with Journal Article reference if ![info exists month] {set month {}} ;# used with Journal Article reference if ![info exists versionType] {set versionType {}} ;# used with Journal Article reference if [info exists cgi(__visibility_visibility)] { # visibility set visibility [expr [string equal {hidden} $cgi(__visibility_visibility)]] # StoreService visibility $repName visibility 1 1 ;# commented by GJFB in 2011-06-13 - now in UpdateRepMetadataRep # UpdateRobotstxtFile $repName $visibility ;# commented by GJFB in 2011-06-13 - now in UpdateRepMetadataRep } else { set visibility 0 ;# shown } TraceProcedure ;# add executing time interval TraceProcedure {visibility processed} if ![string equal 2 $cgi(returntype)] { # 0 or 1 # not upload (Run button) - exit or check # referMetadata if [info exists excludedFieldListTable($referenceType)] { # warning: with this option, metadataEntryList3 and $homePath/col/$metadataRep/doc/@metadata.refer might not be the same # therefore, this option must not be used with a post-submission processing Load $homePath/col/$metadataRep/doc/@metadata.refer referMetadata # puts -1-$referMetadata-- set oldReferFieldNameList {} foreach line [split [string trim $referMetadata \n] \n] { # lappend oldReferFieldNameList [lindex $line 0] ;# doesn't work - may result in "unmatched open brace in list" when field value contains an unmatched open brace lappend oldReferFieldNameList [join [lindex [split $line] 0]] ;# added by GJFB in 2010-12-21 } set oldReferFieldNameList [lsort -unique $oldReferFieldNameList] ;# %0 if [info exists metadataEntryArray] {unset metadataEntryArray} # puts --$metadataEntryList2-- array set metadataEntryArray [join $metadataEntryList2] set newReferFieldNameList [array names metadataEntryArray] if $excludedFieldListTable($referenceType) { # update every fields except the ones in fieldListForSelectiveUpdateTable foreach fieldName $newReferFieldNameList { if {[lsearch $fieldListForSelectiveUpdateTable($referenceType) $fieldName] == -1} { set referMetadata [PutReferField $referMetadata $fieldName $metadataEntryArray($fieldName)] } } # puts -2-$referMetadata-- foreach fieldName $oldReferFieldNameList { if {[lsearch $newReferFieldNameList $fieldName] == -1} { # an existing field in the old metadata is now empty in the new metadata - added by GJFB in 2010-12-20 if {[lsearch $fieldListForSelectiveUpdateTable($referenceType) $fieldName] == -1} { set referMetadata [PutReferField $referMetadata $fieldName {}] } } } # puts -3-$referMetadata-- } else { # update only the fields in fieldListForSelectiveUpdateTable foreach fieldName $newReferFieldNameList { if {[lsearch $fieldListForSelectiveUpdateTable($referenceType) $fieldName] != -1} { set referMetadata [PutReferField $referMetadata $fieldName $metadataEntryArray($fieldName)] } } foreach fieldName $oldReferFieldNameList { if {[lsearch $newReferFieldNameList $fieldName] == -1} { # an existing field in the old metadata is now empty in the new metadata - added by GJFB in 2010-12-20 if {[lsearch $fieldListForSelectiveUpdateTable($referenceType) $fieldName] != -1} { set referMetadata [PutReferField $referMetadata $fieldName {}] } } } } } else { # puts [join $metadataEntryList3
] set referMetadata [join $metadataEntryList3 \n] } # puts --$referMetadata-- # STORE METADATA # set referMetadata [encoding convertto utf-8 $referMetadata] ;# doesn't solve accent problem like in “Geohidrológicos” (") # set referMetadata [encoding convertfrom iso8859-1 $referMetadata] ;# symbols like – (-) are not written properly in the channel - commented by GJFB in 2010-11-15 Store referMetadata $homePath/col/$metadataRep/doc/@metadata.refer auto 0 w 0 iso8859-1 ;# solves the accent/channel problem, otherwise symbols like – are not written properly in the channel - added by GJFB in 2010-11-15 TraceProcedure ;# add executing time interval TraceProcedure {referMetadata stored} if [info exists cgi(__copyright_copyright)] { # copyright set copyright $cgi(__copyright_copyright) if [string equal {} $copyright] { file delete ../$col/$repName/service/copyright } else { StoreService copyright $repName copyright 0 1 } } } ;# end not upload (Run button) if 0 { LeaveQueue fconfigure stdout -translation binary ;# solves the channel problem - added by GJFB in 2010-11-10 puts {Content-Type: text/html} puts {} # puts --$contentType2-- # puts [info exists cgi(_3_targetfile)] # puts $enableCopyToSource puts $referMetadata # puts [info exists cgi(turnattachedfiletargetfile)] # puts --$cgi(filename)-- exit } # rightPSFile is used to control SaveMetada # SaveMetada occurs in UpdateRepMetadataRep or in CreatePDFFile if {[info exists optionTable2($referenceType,%@documentstage)] && \ [regexp {Closed Review} $optionTable2($referenceType,%@documentstage)] && \ [regexp {review} $keywords]} { # is a review TraceProcedure ;# add executing time interval TraceProcedure {processing review...} # Find reviewRepository # set childRepositories [Execute $serverAddressWithIP [list GetCitingRepositoryList $repName]] ## Drop the metadataRep from the childRepositories # set i [lsearch -exact $childRepositories $metadataRep] # set reviewRepository [lreplace $childRepositories $i $i] # Drop the metadataRep from the childRepositories - end # submissionFormRep must be parent for reviewRepository set childRepositories [Execute $serverAddressWithIP [list GetCitingRepositoryList $submissionFormRep]] foreach childRepository $childRepositories { if [file exists $homePath/col/$childRepository/doc/assignmentArray.tcl] { set reviewRepository $childRepository break } } # Find reviewRepository - end set readUserList $nextUser set readUserListForParentRepositories {} # puts --$reviewRepository-- # puts [info exists cgi(__documentstage_documentstage)] if {[info exists reviewRepository] && \ [info exists cgi(__documentstage_documentstage)]} { # workRepository set workRepository $cgi(__parentrepositories_parentrepositories) if 0 { LeaveQueue puts {Content-Type: text/html} puts {} puts $cgi(__documentstage_documentstage) exit } if [string equal {Declined Review} $cgi(__documentstage_documentstage)] { # declining the review # Remove the reviewer from the existing reader group for the work Load ../$col/$workRepository/service/authenticatedUsers authenticatedUsers set readUserListForParentRepositories $authenticatedUsers set i [lsearch -exact $readUserListForParentRepositories $cgi(username)] set readUserListForParentRepositories [lreplace $readUserListForParentRepositories $i $i] # Remove the reviewer from the existing reader group for the work - end } elseif {[string equal {another advanced user} $cgi(__documentstage_documentstage)]} { # choosing another advanced user # Update assignmentArray source $homePath/col/$reviewRepository/doc/assignmentArray.tcl set assignmentList [array get assignmentArray] set index [lindex $assignmentList [expr [lsearch $assignmentList $repName] - 1]] unset assignmentArray($index) regsub {[^,]*$} $index $nextUser index ;# rep-1,Artigos,xx -> rep-1,Artigos,yy set assignmentArray($index) $repName StoreArray assignmentArray $homePath/col/$reviewRepository/doc/assignmentArray.tcl w list array 1 # Update assignmentArray - end # Change the reviewer in the existing reader group for the work Load ../$col/$workRepository/service/authenticatedUsers authenticatedUsers set readUserListForParentRepositories $authenticatedUsers set i [lsearch -exact $readUserListForParentRepositories $cgi(username)] set readUserListForParentRepositories [lreplace $readUserListForParentRepositories $i $i] lappend readUserListForParentRepositories $nextUser set readUserListForParentRepositories [lsort -unique $readUserListForParentRepositories] # Change the reviewer in the existing reader group for the work - end } elseif {[string equal {Closed Review} $cgi(__documentstage_documentstage)]} { # closing the review # Create @reviewSheet.html Load $homePath/col/$URLibServiceRepository/doc/reviewSheet.html fileContent set title $cgi(_T_title) set author {} foreach name [split $cgi(_A_author) \n] { if [regexp {([^,]*), *([^,]*)} $name m lastName firstName] { lappend author "$firstName $lastName" } else { lappend author $name } } set titleArray($repName) $title set returnButtonForReviewSheet {} # SUBST set fileContent [subst $fileContent] Store fileContent $homePath/col/$repName/doc/@reviewSheet.html # Create @reviewSheet.html - end # Update readUserList # ConditionalSet readUserList readUserNameList($referenceType) {} Load $homePath/col/$repName/service/authenticatedUsers readUserList if ![string equal {} $readUserList] { # authenticated user list must be updated to include the administrator and # the current and next advanced users # Add administrator user name and next user lappend readUserList administrator lappend readUserList $cgi(username) if ![string equal {} $nextUser] {lappend readUserList $nextUser} # Add administrator user name and next user - end set readUserList [lsort -unique $readUserList] } # Update readUserList - end # Store the mark in reviewRepository if [file exists $homePath/col/$reviewRepository/doc/markList.tcl] { source $homePath/col/$reviewRepository/doc/markList.tcl if ![info exists markList] {set markList {}} } else { set markList {} } # STORE the mark ComputeMark $workRepository $cgi(__area_area) ;# sets markList StoreArray markList $homePath/col/$reviewRepository/doc/markList.tcl w list list 1 # Store the mark in reviewRepository - end } } set targetFileOption disable } else { # is not a review TraceProcedure ;# add executing time interval TraceProcedure {creating readUserList...} # if [string equal {deny from all} $readPermission] # if {[string equal {deny from all} $readPermission] || \ [string equal {intranet} $readPermission] || \ [regexp {^[\d.\s]+$} $readPermission] || \ ([info exists displayTable($referenceType,%@readergroup)] && \ [lindex $displayTable($referenceType,%@readergroup) 0])} { # deny from all or intranet (added by GJFB in 2023-08-03 - otherwise readergroup becomes empty) or just ip list (ex: 150.163) or the readergroup field exists within the form if [string equal 2 $cgi(returntype)] { # upload (Run button) - readerGroup doesn't exist Load ../$col/$repName/service/authenticatedUsers readUserList ;# added by GJFB in 2021-10-05 otherwise readUserList (and later readergroup) value returns to the default value: "administrator $username" } else { # exit or check ConditionalSet readUserList readerGroup {} } lappend readUserList administrator lappend readUserList $cgi(username) if ![string equal {} $nextUser] {lappend readUserList $nextUser} set readUserList [lsort -unique $readUserList] # # elseif {[string equal {allow from all} $readPermission]} # # file delete ../$col/$repName/service/authenticatedUsers # set readUserList {} } else { set readUserList {} ;# don't change the authenticatedUsers } set readUserListForParentRepositories {} if {[string equal {Electronic Source} $referenceType] && \ (![info exists cgi(updatetype)] || ![regexp {update source directory} $cgi(updatetype)])} { # ePrint set targetFileOption disable ;# must be disable because of the first update (after 24h) } else { set targetFileOption enable } if 0 { # commented by GJFB in 2024-03-19 if [string equal {Archival Unit} $referenceType] { set targetFileOption disable ;# added by GJFB in 2022-04-26 - some Archival Unit might contain a file (@archivistWarning.html) } } else { # Don't let thisArchivalUnit.html or thisResume.html be the target file # otherwise displaydoccontent.cgi is not called and the Archive Unit or the Resume page is not updated # added by GJFB in 2024-03-19 if [regexp {^(Archival Unit|Resume)$} $referenceType] { set targetFileOption disable } # Don't let thisArchivalUnit.html or thisResume.html be the target file - end } } if 0 { LeaveQueue # fconfigure stdout -translation binary ;# solves the channel problem - added by GJFB in 2010-11-10 puts {Content-Type: text/html} puts {} puts --$readPermission-- puts --$userGroup-- puts "readerGroup = --$readerGroup--" puts "readUserList = --$readUserList--" puts --$metadataEntryList3-- puts [info exists cgi(remove)] puts $noFile puts $targetFileOption exit } # 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 - gives 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 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 } LoadService $repName userName userName 1 1 if ![string equal $userName2 $userName] { # change userName set userName $userName2 StoreService userName $repName userName 1 1 Execute $serverAddressWithIP [list UpdateRepositoryProperties $repName username] # Execute $serverAddressWithIP [list UpdateAccessFile $repName] } } # Change write user name - end TraceProcedure ;# add executing time interval TraceProcedure {write user name changed} # at this point, data in metadataEntryList3 and in $homePath/col/$metadataRep/doc/@metadata.refer # are the same (unless the option excludedFieldListTable is in use) # Set deleteDocContentBeforeUpdate if {![info exists cgi(updatetype)] || \ [regexp {remove before update} $cgi(updatetype)] || \ ([info exists cgi(remove)] && !$noFile)} { # Remove before Update and don't Copy to Source # Remove before Update set deleteDocContentBeforeUpdate 1 } else { set deleteDocContentBeforeUpdate 0 } # Set deleteDocContentBeforeUpdate - end # Set copyToSource # if {[info exists cgi(updatetype)] && [regexp {don't copy to source} $cgi(updatetype)]} # if {[info exists cgi(updatetype)] && [regexp {update source directory} $cgi(updatetype)]} { ## Update and don't Copy to Source ## Remove before Update and don't Copy to Source # Update source Directory # Remove before Update source Directory set copyToSource 1 ;# copy to source } else { set copyToSource 0 ;# copy to doc } # Set copyToSource - end # Set moveToSource if {[info exists cgi(updatetype)] && [regexp {move to source directory before update} $cgi(updatetype)]} { # Move to source Directory before Update set moveToSource 1 ;# move to source before updating doc directory } else { set moveToSource 0 ;# don't move to source } # Set moveToSource - end # Set moveBackToDoc # added by GJFB in 2021-05-27 if {[info exists cgi(updatetype)] && [regexp {move back to doc directory before update} $cgi(updatetype)]} { # Move back to doc Directory before Update set moveBackToDoc 1 ;# move to doc before updating doc directory } else { set moveBackToDoc 0 ;# don't move to doc } # Set moveBackToDoc - end # Update readPermission for Journal Article # here the archiving policy is not updated # there is a more complete code in GetURLPropertyList if {$groupFlag && \ ![string equal {} $year] && \ [string equal {Journal Article} $referenceType] && \ [string equal {External Contribution} $contentType2]} { # [regexp {deny} $readPermission]# # # >>> intranet if [catch {ReturnIntranetConfiguration $year $groupList} intranet] { # don't update - probably the intranet information was not reachable - this avoid VERSION STAMP instability # set log "\[[clock format [clock seconds] -format %Y:%m.%d.%H.%M.%S]\] Submit (3): $errorInfo\n" ## puts {Content-Type: text/html} ## puts {} # puts $log ;# commented by GJFB in 2013-03-08 to avoid an internal server error message # Store log $homePath/@errorLog auto 0 a StoreLog {alert} {Submit (5)} $errorInfo } else { # set intranet 150.163 # compute secondaryDate based on the archiving policy set secondaryDate [ComputeSecondaryDateFromArchivingPolicy $year $month $archivingPolicy $versionType $intranet] set permission [ComputeReadPermissionFromSecondaryDate $secondaryDate $readPermission] if ![string equal {} $permission] {set readPermission $permission} ;# update readPermission } } # Update readPermission for Journal Article - end # fieldTypeNumber set fieldTypeNumber [subst [lindex $displayTable($referenceType,username) 0]] ;# subst is useful when using metaforms, e.g., when displayTable contains expression like: {[expr $update?{3}:{0}]} - added by GJFB in 2016-05-14 - this line seems to be missing and has been added if $fieldTypeNumber { set userName $cgi(username) } else { # password1 Load $homePath/col/$loCoInRep/auxdoc/xxx data binary set data [UnShift $data] set password1 [lindex $data end] ;# coded password # userName set userName administrator } # UPDATE set command [list UpdateRepMetadataRep \ $repName $metadataRep $userName $password1 preserve $unzip \ $noFile $contentType2 [expr !$rightPSFile] $readPermission $nextUser $readUserList \ $targetFileOption $readUserListForParentRepositories \ $metadataEntryList3 $postSubmissionScriptRepList $copyAbstractToDoc \ $languageFieldValue $deleteDocContentBeforeUpdate $copyToSource \ $folderName $updateAgreement $visibility $moveToSource \ $moveBackToDoc] # place password1 at the trailing position (to hide its value when displaying an error) if 0 { LeaveQueue puts {Content-Type: text/html} puts {} # puts --$deleteDocContentBeforeUpdate-- # puts --$contentType2-- # puts --$metadataEntryList3-- # puts --$command-- # puts $cgi(updatetype) # puts $processTclPage puts $targetFileOption # puts $cgi(updatetype) # puts $copyToSource # if [info exists intranet] {puts --$intranet--} # puts --$readPermission-- puts --$userName-- puts --$nextUser-- exit } Load $homePath/col/$repName/service/authenticatedUsers fileContent ;# added by GJFB in 2018-11-02 set readUserListFlag [string equal $fileContent $readUserList] ;# added by GJFB in 2018-11-02 - used to decide to restart Apache (see below) TraceProcedure ;# add executing time interval TraceProcedure {executing UpdateRepMetadataRep...} set startApacheServer [Execute $serverAddressWithIP $command] TraceProcedure {UpdateRepMetadataRep done} # Restart Apache server # added by GJFB in 2018-11-02 # similar code in Script (see col/dpi.inpe.br/banon-pc@1905/2005/02.19.00.40/doc/script.cgi - 2018-07-22) SourceWithBackup $homePath/col/$URLibServiceRepository/auxdoc/.environmentArray.tcl environmentArray 1 if !$readUserListFlag { ConditionalSet defaultAuthenticationFlag environmentArray(spUseUserAuthentication) 0 if $defaultAuthenticationFlag { # reader has changed and the Apache virtual host configuration file should updated restarting Apache Load $homePath/col/$URLibServiceRepository/auxdoc/pid pid Execute $serverAddressWithIP "set $pid startApacheServer 1" ;# Set startApacheServer 1 Execute $serverAddressWithIP [list StartApacheServerAfterSubmission] } } # Restart Apache server - end if {![string equal 0 $startApacheServer] && ![string equal 1 $startApacheServer]} { # error # set time [clock format [clock seconds]] # set log "Submit ($time):" # Store log $homePath/@errorLog auto 0 a set log "error while executing: [lreplace $command 4 4 xxx]\n'$startApacheServer'" ;# hide coded password # Store log $homePath/@errorLog auto 0 a StoreLog {alert} {Submit (6)} $log # set log $errorInfo ;# tcl says: can't read "errorInfo": no such variable # Store log $homePath/@errorLog auto 0 a Store startApacheServer $homePath/@errorLog auto 0 a LeaveQueue puts {Content-Type: text/html} puts {} puts
			puts "Submit (7): error while executing [lreplace $command 4 4 xxx]\n'$startApacheServer'"	;# hide coded password
			puts {}			
			regsub {^<(.*)>$} $startApacheServer {\1} message
#			puts --$startApacheServer--
#			puts [join $message \n]
			puts $message
			puts 
return } # Load $homePath/col/$metadataRep/doc/@metadata.refer xxx # Store xxx C:/tmp/bbb.txt auto 0 a # SetFieldValue $serverAddressWithIP $metadataRep-0 title # Store title C:/tmp/bbb.txt binary 0 a if {[info exists cgi(updatetype)] && [string equal {update and finish} $cgi(updatetype)]} { # Finish file delete $homePath/col/$repName/service/userName } if {[info exists cgi(updatetype)] && [string equal {run} $cgi(updatetype)]} {set processTclPage 1} if 0 { LeaveQueue fconfigure stdout -translation binary ;# solves the channel problem - added by GJFB in 2010-11-10 puts {Content-Type: text/html} puts {} # puts [info exists submissionPolicyTable($referenceType)] puts $processTclPage puts --$readPermission-- exit } TraceProcedure {executing ProcessTclPage...} if $processTclPage {ProcessTclPage $repName $metadataRep $password1} ;# if any TraceProcedure {ProcessTclPage done} # Create PDF file # used for ePrint if $rightPSFile { if [catch {CreatePDFFile $repName $metadataRep userfile}] { puts {Content-Type: text/plain} puts {} puts "Submit (8): $errorInfo" ;# error message LeaveQueue return } } # Create PDF file - end TraceProcedure LeaveQueue LeaveQueue Load $homePath/col/$URLibServiceRepository/auxdoc/insertionOn- insertionOnContent TraceProcedure "insertionOnContent = --$insertionOnContent--" if {[info exists cgi(returnaddress)] && ![string equal {} $cgi(returnaddress)]} { # update - there is a return address if {[info exists cgi(updatetype)] && [string equal {update and finish} $cgi(updatetype)]} { set returnType 0 ;# force exit } else { set returnType $cgi(returntype) } if $returnType { # 1 or 2 # check or upload (Run button) # puts {Content-Type: text/html} # puts {} # puts $env(QUERY_STRING) # puts [array get cgi] # puts $env(REQUEST_URI) # return if {$returnType == 1} { set frameInUse no ;# added by GJFB in 2020-07-27 - force no frame to allow the creation of the filling help green iframe containing the search option for form filling } else { set frameInUse $cgi(frameinuse) } # puts "Location: http://$localSite/update/$repName?frameinuse=yes&targetframe=_parent&mirror=$cgi(mirror)&username=$cgi(username)&session=$cgi(session)&languagebutton=$language&returntype=$returnType&hidesimilarbutton=$cgi(hidesimilarbutton)&returnbutton=$cgi(returnbutton)&returnaddress=$cgi(returnaddress)" ;# cancel doesn't work - in some case must not be _parent # puts "Location: http://$localSite/update/$repName?frameinuse=$cgi(frameinuse)&targetframe=$cgi(targetframe)&mirror=$cgi(mirror)&username=$cgi(username)&session=$cgi(session)&languagebutton=$language&returntype=$returnType&hidesimilarbutton=$cgi(hidesimilarbutton)&returnbutton=$cgi(returnbutton)&returnaddress=$cgi(returnaddress)" ;# added by GJFB in 2010-12-21 # puts "Location: http://$localSite/update/$repName?frameinuse=$cgi(frameinuse)&targetframe=$cgi(targetframe)&requiredmirror=$cgi(requiredmirror)&username=$cgi(username)&session=$cgi(session)&languagebutton=$language&returntype=$returnType&hidesimilarbutton=$cgi(hidesimilarbutton)&returnbutton=$cgi(returnbutton)&returnaddress=$cgi(returnaddress)" ;# added by GJFB in 2010-12-21 puts "Location: http://$localSite/update/$repName?frameinuse=$frameInUse&targetframe=$cgi(targetframe)&requiredmirror=$cgi(requiredmirror)&username=$cgi(username)&session=$cgi(session)&languagebutton=$language&returntype=$returnType&hidesimilarbutton=$cgi(hidesimilarbutton)&returnbutton=$cgi(returnbutton)&returnaddress=$cgi(returnaddress)" ;# added by GJFB in 2020-07-27 puts "" return } else { # exit puts {Content-Type: text/html} puts {} # Store administratorPassword # used to search hidden references (see xxUpdateSubmission.html and mirrorsearch.tcl) # the administrator password might come from a cooky read in xxUpdateSubmission.html set pid [pid] if {[regexp {mirrorsearch.cgi\?query=} $cgi(returnaddress)] && \ [info exists cgi(administratorpassword)]} { set administratorPassword $cgi(administratorpassword) Store administratorPassword ../tmpForAdministratorPassword-$pid binary 1 ;# stored in auxdoc } # Store administratorPassword - end if [regexp {\?} $cgi(returnaddress)] {set separator &} else {set separator ?} # if [string equal {} $cgi(targetframe)] {set cgi(targetframe) _self} ;# commented by GJFB in 2020-06-19 # binary scan ' H2 x; puts $x => 27 regsub -all {'} $cgi(returnaddress) {%27} returnAddress ;# needed because of the ' characters in window.open below (return address may contain these characters as in query=ti+banon's+curriculo) ' # puts $cgi(returnaddress) # puts $cgi(targetframe) # puts $cgi(forcehistorybackflag) # puts $returnAddress${separator}time=[clock seconds]&pid=$pid&hidesimilarbutton=$cgi(hidesimilarbutton)&forcehistorybackflag=$cgi(forcehistorybackflag) # the time field below is just to produce a distinct link (to escape from the cache) puts " Redirection to the Display

${Update completed successfully...}

" SendPermissionTransferWarningEMail $userName $nextUser $referenceType $repName $metadataRep return } } # update - end } else { # submit # create a new repository if {[info exists cgi(updatetype)] && [string equal {add and copy} $cgi(updatetype)]} { # add and copy set documentType directory # set documentPath $homePath/col/$repName/doc # set unzip 0 # dir set dir $homePath/col/$repName/doc set fileList {} DirectoryContent fileList $dir $dir MakeArchive $repName fileList set documentPath $homePath/col/$repName/archive set unzip 1 ConditionalSet contentType2 cgi(__contenttype_contenttype) {} if [string equal {CGI Script} $contentType2] {set contentType2 {}} ;# security issue set metadataCaptured 1 set option copy } elseif $duplicateTemplate { # duplicate template set documentType directory # set documentPath $homePath/col/$cgi(templaterepository)/doc # set unzip 0 # dir set dir $homePath/col/$cgi(templaterepository)/doc set fileList {} DirectoryContent fileList $dir $dir MakeArchive $cgi(templaterepository) fileList set documentPath $homePath/col/$cgi(templaterepository)/archive set unzip 1 ConditionalSet contentType2 cgi(__contenttype_contenttype) {} set metadataCaptured 1 ;# 1 -> form metadata; 0 -> template metadata set option copy } else { if [string equal {} $documentPath] { set documentType empty ;# case of submitting just a reference } else { set documentType directory } set metadataCaptured 0 ;# could be anything since documentPath is not relative to a repository (is relative to the clipboard2) - see CreateRepMetadataRep set option preserve } if {[info exists cgi(preservezip)] && [string equal {yes} $cgi(preservezip)]} { set unzip 0 ;# force to 0 - used with url submission } if 0 { LeaveQueue puts {Content-Type: text/html} puts {} puts OK1 exit } # puts [join $metadataEntryList3
] # LeaveQueue # return # $metadataEntryList3 ==> # {%0 Misc} {%@tertiarytype } {%A aa} {%I Deposited in the URLib collection.} {%X aa} {%T tt} {%@secondarykey INPE--/} if ![info exists cgi(__e_mailaddress_e_mailaddress)] {set cgi(__e_mailaddress_e_mailaddress) {}} set cgi(__e_mailaddress_e_mailaddress) [FilterEMailAddress $cgi(__e_mailaddress_e_mailaddress)] if [info exists cgi(__documentstage_documentstage)] { set documentStage $cgi(__documentstage_documentstage) } else { set documentStage {} } # if ![info exists cgi(repository)] {set cgi(repository) {}} ;# commented by GJFB in 2013-03-03 because repository is not used as an entry to cgi # if ![info exists cgi(metadatarepository)] {set cgi(metadatarepository) {}} ;# commented by GJFB in 2013-03-03 because metadatarepository is not used as an entry to cgi unless updatetype value is "add" or "add and copy" (in this case it should be set to empty when used in CreateRepMetadataRep) # if ![info exists contentType2] {set contentType2 {}} # if ![info exists readPermission] {set readPermission {}} if ![info exists languageFieldValue] {set languageFieldValue {}} # targetFileOption if [info exists submitTargetFileOptionTable($referenceType)] { set targetFileOption $submitTargetFileOptionTable($referenceType) } elseif {[string equal {Electronic Source} $referenceType] && \ (![info exists cgi(updatetype)] || ![regexp {update source directory} $cgi(updatetype)])} { # ePrint set targetFileOption disable ;# must be disable because of the first update (after 24h) } else { set targetFileOption enable } # ePrintAdministrator (defined in displayControl.tcl) if ![info exists ePrintAdministrator] {set ePrintAdministrator {}} # ConditionalSet previousEditionSite sourceSite {} ;# commented by GJFB in 2015-07-31 ConditionalSet previousEditionSite sourceSite $localSite ;# added by GJFB in 2015-07-31 - needed when filling out the field previous edition and using the update option Add # Create readUserList, and set visibility and copyright ConditionalSet readUserList readUserNameList($referenceType) {} if {![string equal {} $readUserList] || [string equal {deny from all} $readPermission]} { # authenticated user list must be updated to include the administrator and # the current and next advanced users # Add administrator user name and next user lappend readUserList administrator lappend readUserList $userName if ![string equal {} $nextUser] {lappend readUserList $nextUser} # Add administrator user name and next user - end set readUserList [lsort -unique $readUserList] } if [info exists hideSubmissionTable($referenceType)] { set visibility $hideSubmissionTable($referenceType) } else { set visibility 0 ;# shown } if [info exists cgi(__visibility_visibility)] { # visibility set visibility [expr [string equal {hidden} $cgi(__visibility_visibility)]] } # copyright ConditionalSet copyright cgi(__copyright_copyright) {} # Create readUserList, and set visibility and copyright - end if 0 { LeaveQueue fconfigure stdout -translation binary ;# solves the channel problem - added by GJFB in 2010-11-10 puts {Content-Type: text/html} puts {} # puts --$contentType2-- # puts --$metadataEntryList3-- puts --$copyright-- puts --$readPermission-- # puts --$cgi(metadatarepository)-- puts [info exists submissionPolicyTable($referenceType)] exit } # CREATE # rightPSFile is to control SaveMetada # SaveMetada occurs in CreateRepMetadataRep or in CreatePDFFile # puts $metadataEntryList3 # if $copyFooterToAgreement # ;# commented by GJFB in 2023-04-20 if {$copyFooterToAgreement && ![info exists cgi(discardagreement)]} { ;# added by GJFB in 2023-04-20 - used only in codigoImportacao.tcl to discard default agreement set submissionAgreementText " $translationTable(Submission Agreement) [GetAgreement]

" ConditionalSet submissionPeriod submissionPeriodArray($referenceType) {} set submissionAgreementText [split [subst [subst $submissionAgreementText]] \n] } else { set submissionAgreementText {} } set copyToSource 0 ;# copy to doc if 0 { # commented by GJFB in 2013-03-03 because repository and metadatarepository are not used as entries to cgi # nevertheless, cgi(metadatarepository) exists and is not empty when updatetype value is "add" or "add and copy" # in this case it should be set to empty to avoid turning this metadata repository the one of the new document repository set command [list CreateRepMetadataRep $documentType $documentPath/ \ {} $metadataCaptured $targetFileOption \ $metadataEntryList3 $option $unzip 0 $cgi(repository) \ $cgi(metadatarepository) $userName $contentType2 $documentStage \ [expr !$rightPSFile] $readPermission $nextUser $copyToSource \ $readUserList {} $visibility \ {} $copyAbstractToDoc \ $postSubmissionScriptRepList $languageFieldValue \ $ePrintAdministrator $previousEditionSite $password1 \ $copyright $submissionAgreementText] } else { # added by GJFB in 2013-03-03 if 1 { set command [list CreateRepMetadataRep $documentType $documentPath/ \ {} $metadataCaptured $targetFileOption \ $metadataEntryList3 $option $unzip 0 {} \ {} $userName $contentType2 $documentStage \ [expr !$rightPSFile] $readPermission $nextUser $copyToSource \ $readUserList {} $visibility \ {} $copyAbstractToDoc \ $postSubmissionScriptRepList $languageFieldValue \ $ePrintAdministrator $previousEditionSite $password1 \ $copyright $submissionAgreementText] } else { # for testing submit without creating a new repository (see below also) } } if 0 { LeaveQueue puts {Content-Type: text/html} puts {} puts OK2 exit } if 1 { # set repName [Execute $serverAddressWithIP $command] ;# symbols like – are not written properly in the channel - commented by GJFB in 2010-11-15 set repName [Execute $serverAddressWithIP $command 1 iso8859-1] ;# solves the channel problem, otherwise symbols like – are not written properly in the channel - added by GJFB in 2010-11-15 if [regexp {^<[^>]*>} $repName] { # error # set time [clock format [clock seconds]] # set log "Submit ($time):" # Store log $homePath/@errorLog auto 0 a set log "error while executing: [lreplace $command 28 28 xxx]" ;# hide coded password # Store log $homePath/@errorLog auto 0 a StoreLog {alert} {Submit (9)} $log Store repName $homePath/@errorLog auto 0 a LeaveQueue puts {Content-Type: text/html} puts {} puts "Submit (9): error while executing [lreplace $command 28 28 xxx]" ;# hide coded password puts
puts $repName return } } else { # for testing submit without creating a new repository set repName xxx } if 0 { LeaveQueue puts {Content-Type: text/html} puts {} puts OK4 exit } # metadataRep set metadataRep [Execute $serverAddressWithIP [list FindMetadataRep $repName]] # Waiting for the completion of other authentication (author registration) while {[EnterQueue Submit authentication]} { set x 0; after 100 {set x 1}; vwait x } # Waiting for the completion of other authentication (author registration) - end if [file exists $homePath/col/$loCoInRep/auxdoc/.userArray.tcl] { source $homePath/col/$loCoInRep/auxdoc/.userArray.tcl } set randomPassword {} set updatewarning 1 ;# for default confirmation if ![string equal {} $cgi(__e_mailaddress_e_mailaddress)] { set userArray($userName,e-mailaddress) $cgi(__e_mailaddress_e_mailaddress) if {[info exists displayTable($referenceType,username)] && \ [lindex $displayTable($referenceType,username) 0]} { # there is a user name field # set randomPassword {} # set updatewarning 1 ;# for default confirmation } else { # there is no user name field if {[info exists submissionPolicyTable($referenceType)] && \ $submissionPolicyTable($referenceType) == 2} { # create a password for the user # randomPassword set randomPassword [CreateRandomPassword] set userName $cgi(__e_mailaddress_e_mailaddress) set password1 [CodeKey $randomPassword] } else { # set randomPassword {} # set updatewarning 1 ;# for default confirmation } } } else { # empty e-mail address # set randomPassword {} # set updatewarning 1 ;# for default confirmation } if 0 { LeaveQueue fconfigure stdout -translation binary ;# solves the channel problem - added by GJFB in 2010-11-10 puts {Content-Type: text/html} puts {} puts [info exists submissionPolicyTable($referenceType)] puts --$repName-- exit } # set flag [Execute $serverAddressWithIP [list CheckPassword $userName $password1]] set command [list list CheckPassword $userName $password1 write 0] set flag [MultipleExecute [list $serverAddressWithIP] $command] if [string equal 2 $flag] { # a new advanced user StorePassword $userName $password1 set userArray($userName,fullname) $repName ;# the user full name is probably the name of one of the creators of the document deposited in repName set newAdvancedUser yes # Make a copy of the administrator data set administratorEMailAddress $env(SERVER_ADMIN) if [string equal $userName $administratorEMailAddress] { # userName is administrator and login is an e-mail address regsub {@.*$} $administratorEMailAddress {} administratorUserName set userArray($administratorUserName,fullname) $repName set userArray($administratorUserName,e-mailaddress) $userName StorePassword $userName $password1 $userName } else { StorePassword $userName $password1 } # Make a copy of the administrator data - end } else { # not a new advanced user if [info exists userArray($userName,fullname)] { set fullName $userArray($userName,fullname) if [regexp {/.*/.*/} $fullName] { # full name is a repository name # update the repository name set userArray($userName,fullname) $repName ;# the user full name is probably the name of one of the creators of the document deposited in repName } } set randomPassword {} ;# no random password is needed set newAdvancedUser no } # STORE userArray StoreArray userArray $homePath/col/$loCoInRep/auxdoc/.userArray.tcl w list array 1 LeaveQueue {} authentication if {[info exists displayTable($referenceType,username)] && \ [lindex $displayTable($referenceType,username) 0]} { set userNameFieldShown yes } else { set userNameFieldShown no } if {!$duplicateTemplate && (![info exists cgi(updatetype)] || ![string equal {add and copy} $cgi(updatetype)])} { # process (don't process at add and copy or duplicate template, because processing might be time consuming) # thisRepository set thisRepository $repName ;# used in CreateTclPageFile, DisplaySearch and DisplayMultipleSearch (which are called in ProcessTclPage) ProcessTclPage $repName $metadataRep $password1 ;# if any } # Create PDF file # used for ePrint if $rightPSFile { if [catch {CreatePDFFile $repName $metadataRep userfile}] { puts {Content-Type: text/plain} puts {} puts "Submit (10): $errorInfo" ;# error message LeaveQueue return } } # Create PDF file - end LeaveQueue if ![string equal {} $repName] { ;# if added by GJFB in 2022-08-22 SendSubmissionConfirmationEMail $userName $referenceType $repName $metadataRep } # submit - end } # passwordloaded value is yes or no - yes means that the advanced user coded password has been loaded in a cookie # CloseSession if $update { # update - there is no return address # set queryString startapacheserver=$startApacheServer&repname=$repName&metadatarepname=$metadataRep&referencetype=$referenceType3&update=$update&languagebutton=$language&attachment=$cgi(attachment)&time=[clock seconds] # set queryString repname=$repName&metadatarepname=$metadataRep&referencetype=$referenceType3&update=$update&languagebutton=$language&attachment=$cgi(attachment)&time=[clock seconds] set queryString mirror=$currentRep&repname=$repName&metadatarepname=$metadataRep&referencetype=$referenceType3&update=$update&languagebutton=$language&attachment=$cgi(attachment)&time=[clock seconds] regsub -all { } $queryString {+} queryString if {[info exists cgi(updatetype)] && [string equal {update and finish} $cgi(updatetype)]} { set returnType 0 ;# force exit } else { set returnType $cgi(returntype) } if {[info exists cgi(frameinuse)] && [string equal {yes} $cgi(frameinuse)]} { # update - there is no return address and there is a frame in use # http://vaio:1905/update/urlib.net/www/2019/08.14.23.28?metadatarepository=urlib.net/www/2019/08.14.23.28.11&requiredmirror=dpi.inpe.br/banon/1999/06.19.17.00&username=administrator&session=&languagebutton=pt-BR&lastupdate=2020:06.10.01.54.52+dpi.inpe.br/banon/1999/01.09.22.14+banon+{D+2019}&returnbutton=yes&hidesimilarbutton=no&returnaddress=http://vaio:1905/col/dpi.inpe.br/banon/1999/06.19.17.00/doc/mirrorsearch.cgi?query=ti+ares&alternatequery=&query2=&languagebutton=pt-BR&returnbutton=yes&targetframe=display___dpi_inpe_br__banon__1999__06_19_17_00&choice=brief&sort=&accent=no&case=no&outputformat=0&codedpassword1=33&nameformat=short&nameseparator=;+&continue=no # http://vaio:1905/update/urlib.net/www/2019/08.14.23.28?returnbutton=no if $returnType { # 1 or 2 # check or upload (Run button) # puts "Location: http://$localSite/update/$repName?frameinuse=yes&targetframe=_parent&mirror=$cgi(mirror)&username=$cgi(username)&session=$cgi(session)&languagebutton=$language&returntype=$returnType" puts "Location: http://$localSite/update/$repName?frameinuse=yes&targetframe=_parent&requiredmirror=$cgi(requiredmirror)&username=$cgi(username)&session=$cgi(session)&languagebutton=$language&returntype=$returnType" puts "" return } else { # 0 # exit puts {Content-Type: text/html} puts {} puts " Redirection to the Display

${Update completed successfully...}

" } } else { # update - there is no return address and no frame in use TraceProcedure {there is no return address and no frame in use} # puts {Content-Type: text/html} # puts {} # puts [info exists targetFile] # puts $targetFile # puts --$cgi(bodylink)-- # puts --$updateDeadline-- TraceProcedure "returnType = $returnType" if {$returnType == 2} { # 2 # upload (Run button) if [info exists targetFile] { # the target file may have changed (when cgi(turnattachedfiletargetfile) has been set to yes) regsub {([^/]+/[^/]+/\d{4,}/[^/]+/doc/).*\?} $cgi(bodylink) \\1$targetFile? bodyLink } else { set bodyLink $cgi(bodylink) } puts "Location: http://$bodyLink" # => http://gjfb:1905/createpage.cgi/urlib.net/www/2010/09.29.20.13/doc/indice.htm?forcehistorybackflag=0&requiredmirror=dpi.inpe.br/banon/1999/06.19.17.00&parentidentifiercitedby=83LX3pFwXQZeBBx/hvk3g&searchmirror=dpi.inpe.br/banon/1999/06.19.17.00&metadatarepository=urlib.net/www/2010/09.29.20.13.51&forcerecentflag=0&searchinputvalue=-%20author%20index,&searchsite=gjfb:1905&languagebutton=pt-BR puts "" } else { # 0 or 1 if {[info exists submissionPolicyTable($referenceType)] && \ $submissionPolicyTable($referenceType) == 2 && \ [file exists $homePath/col/$submissionFormLanguageRep/doc/include/${submissionFormLanguage}UpdateConfirmationScreen.inc] && \ [file exists $homePath/col/$submissionFormLanguageRep/doc/include/${submissionFormLanguage}UpdateTitle.inc]} { # create a password for the user # use option send e-Mail (will display a confirmation screen but will not send confirmation e-mail) ConditionalSet session cgi(session) {} puts "Location: $http://$localSite/col/$sendMailRep/doc/sendUpdateMail.php?username=$cgi(username)&session=$session&conferencehomepage=$conferenceHomePage&conferenceacronym=$conferenceAcronym&updatedeadline=$updateDeadline&languagerep1=$languageRep1&submissionformrep=$submissionFormRep&submissionformlanguagerep=$submissionFormLanguageRep&submissionformlanguage=$submissionFormLanguage&$queryString©abstracttodoc=$copyAbstractToDoc" puts "" } else { if $returnType { # 1 # check # puts "Location: http://$localSite/update/$repName?frameinuse=no&targetframe=_self&mirror=$cgi(mirror)&username=$cgi(username)&session=$cgi(session)&languagebutton=$language&returntype=$returnType" puts "Location: http://$localSite/update/$repName?frameinuse=no&targetframe=_self&requiredmirror=$cgi(requiredmirror)&username=$cgi(username)&session=$cgi(session)&languagebutton=$language&returntype=$returnType" puts "" } else { # 0 # exit puts "Location: http://$localSite/col/$currentRep/doc/confirm.cgi?$queryString" puts "" } } } } } else { # submit if [info exists cgi(referencetype)] { # url submission puts {Content-Type: text/plain} puts {} puts "repositoryname = $repName" return } if 0 { LeaveQueue fconfigure stdout -translation binary ;# solves the channel problem - added by GJFB in 2010-11-10 puts {Content-Type: text/html} puts {} puts [info exists submissionPolicyTable($referenceType)] exit } # new code (17/09/2005) if {[info exists cgi(returnbutton)] && [string equal {yes} $cgi(returnbutton)]} { if [string equal {} $cgi(targetframe)] {set cgi(targetframe) _self} # the time field below is just to produce a distinct link (to escape from the cache) if [info exists cgi(returnaddress)] { # submit - there is a return button and a return adddress # puts $cgi(returnaddress) # => http://banon-pc3:80/col/dpi.inpe.br/banon/1999/06.19.17.00/doc/mirror.cgi/Recent?languagebutton=pt-BR&hidesimilarbutton=no set url "$cgi(returnaddress)&returnbutton=yes&targetframe=$cgi(targetframe)&time=[clock seconds]&returntoabout=yes" if [regexp {([^?]*)\?(.*)} $url m pathSegment querySegment] { set querySegment [join [lsort -unique [split $querySegment {&}]] {&}] ;# drop duplicate field pair (e.g., returnbutton=yes) set url $pathSegment?$querySegment } } else { # submit - there is a return button - return to The Most Recent # setTimeout(\"window.open('http://$localSite/col/$currentRep/doc/mirror.cgi/Recent?languagebutton=$language&returnbutton=yes&targetframe=$cgi(targetframe)&time=[clock seconds]&pid=$pid&returntoabout=yes', '$cgi(targetframe)')\", 800) set url "http://$localSite/col/$currentRep/doc/mirror.cgi/Recent?languagebutton=$language&returnbutton=yes&targetframe=$cgi(targetframe)&time=[clock seconds]&returntoabout=yes" } if [string equal {} $repName] { # Submission NOT completed... # no repository was created - probably urlib.net is not responding - try also unpost/post puts {Content-Type: text/html} puts {} # puts $url puts " Redirection to the Display

${Submission NOT completed...}

" return } if $cgi(returntype) { # 1 or 2 # check or upload (Run button) puts "Location: http://$localSite/update/$repName?frameinuse=yes&targetframe=_parent&mirror=$currentRep&username=$cgi(username)&session=$cgi(session)&languagebutton=$language&returntype=$cgi(returntype)&returnbutton=$cgi(returnbutton)&returnaddress=$cgi(returnaddress)" puts "" # SendSubmissionConfirmationEMail $userName $referenceType $repName $metadataRep ;# added by GJFB in 2022-03-20 - commented by GJFB in 2022-08-22 - now above return } else { # 0 # exit puts {Content-Type: text/html} puts {} # puts $url puts " Redirection to the Display

${Submission completed successfully...}

" # SendSubmissionConfirmationEMail $userName $referenceType $repName $metadataRep ;# added by GJFB in 2021-11-24 - commented by GJFB in 2022-08-22 - now above SendPermissionTransferWarningEMail $userName $nextUser $referenceType $repName $metadataRep return } } # new code (17/09/2005) - end # submit - there is no return button if [string equal {} $repName] { # Submission NOT completed... # no repository was created - probably urlib.net is not responding - try also unpost/post puts {Content-Type: text/html} puts {} puts {Submission NOT completed...} return } ConditionalSet templateRepository cgi(templaterepository) {} if [info exists cgi(returnaddress)] { set returnAddress $cgi(returnaddress) } else { # just for the old mirror (before 12/06/05) set returnAddress mirror.cgi/About } Store randomPassword $homePath/col/$repName/service/randomPassword # set queryString startapacheserver=1&newadvanceduser=$newAdvancedUser&usernamefieldshown=$userNameFieldShown&repname=$repName&referencetype=$referenceType3&update=$update&nofile=$noFile&languagebutton=$language&returnbutton=$cgi(returnbutton)&updatewarning=$updatewarning&__e_mailaddress_e_mailaddress=$cgi(__e_mailaddress_e_mailaddress)&__documentstage_documentstage=$documentStage&attachment=$cgi(attachment)&time=[clock seconds]&targetframe=$cgi(targetframe)&returnaddress=$returnAddress # set queryString newadvanceduser=$newAdvancedUser&usernamefieldshown=$userNameFieldShown&repname=$repName&referencetype=$referenceType3&update=$update&nofile=$noFile&mirror=$currentRep&languagebutton=$language&returnbutton=$cgi(returnbutton)&updatewarning=$updatewarning&__e_mailaddress_e_mailaddress=$cgi(__e_mailaddress_e_mailaddress)&__documentstage_documentstage=$documentStage&attachment=$cgi(attachment)&time=[clock seconds]&targetframe=$cgi(targetframe)&returnaddress=$returnAddress # set queryString newadvanceduser=$newAdvancedUser&usernamefieldshown=$userNameFieldShown&repname=$repName&referencetype=$referenceType3&update=$update&nofile=$noFile&mirror=$currentRep&languagebutton=$language&returnbutton=$cgi(returnbutton)&updatewarning=$updatewarning&username=$userName&__e_mailaddress_e_mailaddress=$cgi(__e_mailaddress_e_mailaddress)&__documentstage_documentstage=$documentStage&attachment=$cgi(attachment)&time=[clock seconds]&targetframe=$cgi(targetframe)&returnaddress=$returnAddress set queryString newadvanceduser=$newAdvancedUser&usernamefieldshown=$userNameFieldShown&repname=$repName&referencetype=$referenceType3&update=$update&nofile=$noFile&mirror=$currentRep&languagebutton=$language&returnbutton=$cgi(returnbutton)&updatewarning=$updatewarning&username=$userName&__e_mailaddress_e_mailaddress=$cgi(__e_mailaddress_e_mailaddress)&attachment=$cgi(attachment)&time=[clock seconds]&targetframe=$cgi(targetframe)&templaterepository=$templateRepository&returnaddress=$returnAddress regsub -all { } $queryString {+} queryString # it is assumed that no mail will be sent when the search option is in use if {[info exists cgi(frameinuse)] && [string equal {yes} $cgi(frameinuse)]} { # submit - there is no return button and a frame is in used if $cgi(returntype) { # 1 or 2 # check or upload (Run button) puts "Location: http://$localSite/update/$repName?frameinuse=yes&targetframe=_parent&mirror=$currentRep&username=$cgi(username)&session=$cgi(session)&languagebutton=$language&returntype=$cgi(returntype)" puts "" } else { # 0 # exit puts {Content-Type: text/html} puts {} puts " Redirection to the Display

${Submission completed successfully...}

" } } else { # submit - there is no return button and no frame is in used # puts {Content-Type: text/html} # puts {} # puts [info exists submissionPolicyTable($referenceType)] if {[info exists submissionPolicyTable($referenceType)] && \ $submissionPolicyTable($referenceType) == 2 && \ [file exists $homePath/col/$submissionFormLanguageRep/doc/include/${submissionFormLanguage}ConfirmationScreen.inc] && \ [file exists $homePath/col/$submissionFormLanguageRep/doc/include/${submissionFormLanguage}ConfirmationMail.inc] && \ [file exists $homePath/col/$submissionFormLanguageRep/doc/include/${submissionFormLanguage}Title.inc] && \ [file exists $homePath/col/$sendMailRep/auxdoc/smtp.txt]} { # create a password for the user # use option send e-Mail (will send a confirmation mail) puts "Location: $http://$localSite/col/$sendMailRep/doc/sendMail.php?username=$userName&session=[OpenSession $userName]&conferencehomepage=$conferenceHomePage&conferenceacronym=$conferenceAcronym&updatedeadline=$updateDeadline&languagerep1=$languageRep1&submissionformrep=$submissionFormRep&submissionformlanguagerep=$submissionFormLanguageRep&submissionformlanguage=$submissionFormLanguage&$queryString©abstracttodoc=$copyAbstractToDoc" puts "" } else { if $cgi(returntype) { # 1 or 2 # check or upload (Run button) puts "Location: http://$localSite/update/$repName?frameinuse=no&targetframe=_self&mirror=$currentRep&username=$cgi(username)&session=$cgi(session)&languagebutton=$language&returntype=$cgi(returntype)" puts "" } else { # 0 # exit puts "Location: $http://$localSite/col/$currentRep/doc/confirm.cgi?$queryString" puts "" } } } } if !$cgi(returntype) { # 0 # exit if 0 { # commented by GJFB in 2022-08-22 - now above if !$update { ;# added by GJFB in 2022-03-12 otherwise a submission confirmation is issued at update when there is no return address # submit SendSubmissionConfirmationEMail $userName $referenceType $repName $metadataRep } } SendPermissionTransferWarningEMail $userName $nextUser $referenceType $repName $metadataRep } TraceProcedure {end of Submit} # set xxx 3a-[pid] # Store xxx C:/tmp/bbb.txt auto 0 a } m] { if ![string equal {} $m] { set log "Submit (11) - ([clock format [clock seconds]]):" Store log $homePath/@errorLog auto 0 a if [info exists repName] { set log "an error was catched while processing repository: $repName" Store log $homePath/@errorLog auto 0 a set log "REQUEST_URI = $env(REQUEST_URI)" Store log $homePath/@errorLog auto 0 a set log "REMOTE_ADDR = $env(REMOTE_ADDR)" Store log $homePath/@errorLog auto 0 a } Store m $homePath/@errorLog auto 0 a if 0 { global errorInfo Store errorInfo $homePath/@errorLog auto 0 a } LeaveQueue if $codeTesting { puts {Content-Type: text/html} # puts {Content-Type: text/plain} puts {} # puts OK } # puts $m puts "" # if 0 {global errorInfo; puts $errorInfo} # if 0 {global errorInfo; puts ""} if 0 {global errorInfo; puts ""} ;# added by GJFB in 2021-01-20 # examples: # http://gjfb:1905/col/dpi.inpe.br/banon/1999/06.19.17.00/doc/submit.cgi/urlib.net/www/2020/08.25.19.04?languagebutton=en&%250%2Breferencetype=%7Misc%7D # http://gjfb:1905/col/dpi.inpe.br/banon/1999/06.19.17.00/doc/submit.cgi/urlib.net/www/2020/08.25.19.04?languagebutton=pt-BR&%250%2Breferencetype=%7Misc%7D switch $language { en { puts " Warning

Warning

Bad Request.

If you need some support, please, contact the URLib platform administrator at: <urlibservice@gmail.com>.



" } pt-BR { puts " Alerta

Alerta

Solicitação Incorreta.

Se precisar de algum suporte, por favor, entre em contato com o administrador da plataforma URLib em: <urlibservice@gmail.com>.



" } } } } } # Submit - end # ---------------------------------------------------------------------- # MakeCGIArray proc MakeCGIArray {query} { global cgi foreach line [split $query \n] { set f [regexp {Content-Disposition: form-data; name="([^"]*)"} $line m name] if $f { if [string equal userfile $name] { regexp {Content-Disposition: form-data; name="userfile"; filename="(.*)"} $line m value regsub -all {\\} $value {\\} value ;# \ -> \ - \ leads to problem # set cgi(filename) $value set cgi(filename) [list $value] # puts [list cgi(filename) = $cgi(filename)] # puts --$cgi(filename)-- } if [info exists previousName] { if ![string equal userfile $previousName] { # set cgi($previousName) [join [lreplace [lreplace $list 0 0] end end] \n] lappend cgi($previousName) [join [lreplace [lreplace $list 0 0] end end] \n] # puts [list cgi($previousName) = $cgi($previousName)] } } set previousName $name set list {} } else { # lappend list [string trim $line] lappend list [string trimright $line] ;# left tab must be preserved in codefordynamicpage, nevertheless right space must be trimed like in the username value 'banon ' } } if [info exists previousName] { set cgi($previousName) [join [lreplace [lreplace [lreplace $list 0 0] end end] end end]] } JoinCGIEntries } # MakeCGIArray - end # ---------------------------------------------------------------------- # CreatePDFFile # used for ePrint proc CreatePDFFile {repName metadataRep varName} { global homePath global serverAddressWithIP global localSite global headerTable global referenceType global cgi upvar $varName userfile upvar password1 password1 upvar contentType contentType upvar siteToAddHeader siteToAddHeader upvar siteToConvertPostScriptToPDF siteToConvertPostScriptToPDF if [info exists cgi(_3_targetfile)] { regsub {.pdf} $cgi(_3_targetfile) {} version } else { # case of updating an incomplete submission set version v1 } set versionDate $cgi(_8_lastupdatedate) regsub -all {/} $repName {==} repName2 regsub -all {\.} $repName2 {=} repName2 # if ![string equal {application/postscript} $contentType] # ## not a postscript file (probably a pdf file) if 1 { set userfile [string trim $userfile] # STORE userfile Store userfile $homePath/col/$repName/doc/$version.pdf binary 0 w } else { # the code below works but need a siteToConvertPostScriptToPDF (no more available at INPE) ## a postscrip file # STORE userfile Store userfile $homePath/col/$repName/doc/$version.ps # convert ps to pdf set scriptSite $siteToConvertPostScriptToPDF set scriptRepository dpi.inpe.br/banon-pc2@1905/2006/04.03.21.25 set scriptName ps2pdf.cgi set sourceFileName $version.ps set queryString "repname=$repName" set intermediateFileName $repName2.pdf set destinationFileName $version.pdf if [catch {RunRemoteCGIScript $scriptSite $scriptRepository $scriptName $repName \ $sourceFileName $queryString $intermediateFileName $destinationFileName} message] { file delete $homePath/col/$repName/doc/$version.ps return -code error $message } file delete $homePath/col/$repName/doc/$version.ps } # array set headerTable {{Electronic Source} {INPE ePrint: $repName $version $versionDate}} set header [subst $headerTable($referenceType)] regsub -all { } $header {+} header2 if 0 { # old code - now new code uses RunRemoteCGIScript package require http # Execute addHeader.cgi # A Tcl CGI script to add a header in a pdf document set convertedURL [ConvertURLToHexadecimal http://$siteToAddHeader/col/dpi.inpe.br/banon-pc2@1905/2006/03.22.15.15/doc/addHeader.cgi?fileurl=http://$localSite/col/$repName/doc/$version.pdf&repname=$repName&header=$header2] # Store convertedURL C:/tmp/bbb auto 0 a if [catch {http::geturl $convertedURL} token] { # don't transfer - unkown remote host collection # global errorInfo # return "$token $errorInfo" # set xxx "$token $errorInfo" # Store xxx C:/tmp/bbb auto 0 a file delete $homePath/col/$repName/doc/$version.pdf return -code error {unknown host} } else { if ![regexp {200 OK} [http::code $token]] { http::cleanup $token file delete $homePath/col/$repName/doc/$version.pdf return -code error [list {url not found} $convertedURL [http::code $token]] } http::cleanup $token } set message [http::data $token] if {[string compare {} $message] != 0} { file delete $homePath/col/$repName/doc/$version.pdf return -code error $message } # Execute addHeader.cgi - end # Capture the new pdf set convertedURL [ConvertURLToHexadecimal http://$siteToAddHeader/col/dpi.inpe.br/banon-pc2@1905/2006/03.22.15.15/doc/tmp/$repName2.pdf] # Store convertedURL C:/tmp/bbb auto 0 a set fileId [open $homePath/col/$repName/doc/$version.pdf w] if [catch {http::geturl $convertedURL -channel $fileId} token] { # don't transfer - unkown remote host collection # global errorInfo # return "$token $errorInfo" # set xxx "$token $errorInfo" # Store xxx C:/tmp/bbb auto 0 a file delete $homePath/col/$repName/doc/$version.pdf return -code error {unknown host} } else { if ![regexp {200 OK} [http::code $token]] { close $fileId http::cleanup $token file delete $homePath/col/$repName/doc/$version.pdf return -code error [list {url not found} $convertedURL [http::code $token]] } close $fileId http::cleanup $token } # Capture the new pdf - end } else { # new code using RunRemoteCGIScript # add header set scriptSite $siteToAddHeader set scriptRepository dpi.inpe.br/banon-pc2@1905/2006/03.22.15.15 set scriptName addHeader.cgi set sourceFileName $version.pdf set queryString "repname=$repName&header=$header2" set intermediateFileName $repName2.pdf set destinationFileName $version.pdf # set xxx [list RunRemoteCGIScript $scriptSite $scriptRepository $scriptName $repName \ $sourceFileName $queryString $intermediateFileName $destinationFileName] # Store xxx C:/tmp/bbb.txt auto 0 a # => RunRemoteCGIScript banon-pc2 dpi.inpe.br/banon-pc2@1905/2006/03.22.15.15 addHeader.cgi iconet.com.br/banon/2009/03.18.21.32 \ # v1.pdf repname=iconet.com.br/banon/2009/03.18.21.32&header=INPE+ePrint:+iconet.com.br/banon/2009/03.18.21.32+v1++2009-03-19 iconet=com=br==banon==2009==03=18=21=32.pdf v1.pdf if [catch {RunRemoteCGIScript $scriptSite $scriptRepository $scriptName $repName \ $sourceFileName $queryString $intermediateFileName $destinationFileName} message] { file delete $homePath/col/$repName/doc/$version.pdf return -code error $message } } Execute $serverAddressWithIP [list UpdateRepository2 $repName $metadataRep $cgi(username) $password1 directory $homePath/col/$repName/doc/ enable] } # CreatePDFFile - end # ---------------------------------------------------------------------- # ComputeNewVersion # used by Submit for ePrint proc ComputeNewVersion {repName} { global env if {[string compare {} $repName] == 0} {return v1} set numberOfVersions [llength [glob -nocomplain $env(DOCUMENT_ROOT)/col/$repName/doc/v*]] return v[expr $numberOfVersions + 1] } # ComputeNewVersion - end # ---------------------------------------------------------------------- # FindNextUser proc FindNextUser {update} { global referenceType global env global cgi global serverAddressWithIP global localSite ;# needed in the header of some message like "no advanced user name found" global searchResultList ;# used in MultipleSubmit global currentRep ;# used in MultipleSubmit global languageRep1 global languageRep2 global "${languageRep2}::footer" global "${languageRep2}::no other advanced user" global "${languageRep2}::no reviewer name found" global "${languageRep2}::no advanced user name found" global homePath global loCoInRep global http upvar displayTable displayTable upvar environment environment ;# used in MultipleSubmit upvar userNameList userNameList upvar userNameTable userNameTable upvar nextStage nextStage ;# alias for documentstage upvar updateOptionTable updateOptionTable upvar header header upvar cellFont cellFont upvar bgColor bgColor upvar background background upvar bgProperties bgProperties upvar fontTag fontTag upvar fontTag2 fontTag2 upvar returnButton returnButton upvar submissionFormLanguageRep submissionFormLanguageRep ;# used in error message to access mirrorStandard.css upvar userGroup userGroup if {$update && [info exists updateOptionTable($referenceType)] && \ [string equal {update and finish} $updateOptionTable($referenceType)]} { # finish update return {} ;# no more advanced user for this repository } if {[info exists cgi(updatetype)] && [string equal {update and finish} $cgi(updatetype)]} { return {} ;# no more advanced user for this repository } # puts --$cgi(returntype)-- # since 2009, "ePrint update" document stage is not used anymore # if {$cgi(returntype) || [info exists cgi(__documentstage_documentstage)] && \ # ([string equal {not transferred} $cgi(__documentstage_documentstage)] || \ # [string equal {ePrint update} $cgi(__documentstage_documentstage)]) && \ # [info exists cgi(username)]} # commented by GJFB in 2024-08-29 # puts [info exists cgi(username)] ConditionalSet documentStage cgi(__documentstage_documentstage) {} ;# added by GJFB in 2024-08-29 - when documentStage is empty one should continue with the current advanced user if {$cgi(returntype) || \ ([string equal {not transferred} $documentStage] || \ [string equal {} $documentStage] || \ [string equal {ePrint update} $documentStage]) && \ [info exists cgi(username)]} { ;# added by GJFB in 2024-08-29 - when documentStage is empty one should continue with the current advanced user return $cgi(username) ;# not transferred - keep the same user name } # puts [expr (![info exists displayTable($referenceType,username)] || ![lindex $displayTable($referenceType,username) 0]) && ![info exists userNameList($referenceType)]] if {(![info exists displayTable($referenceType,username)] || \ ![lindex $displayTable($referenceType,username) 0]) && \ ![info exists userNameList($referenceType)]} { # no user name field in the form and no userNameList if [info exists cgi(username)] { # there is a default username # used with the SBSR Submission # diplayControl.tcl must contain the line: # array set displayTable {{Misc,username} {0 {(*)[Help UserName]} {banon} {x}}} return $cgi(username) } elseif [info exists cgi(__e_mailaddress_e_mailaddress)] { set cgi(__e_mailaddress_e_mailaddress) [FilterEMailAddress $cgi(__e_mailaddress_e_mailaddress)] return $cgi(__e_mailaddress_e_mailaddress) } return } # puts [info exists nextStage] if [info exists nextStage] { # puts --$nextStage-- if ![string equal {} $nextStage] { if [regexp {Closed Review} $nextStage] { # close the review return } elseif {[string equal {another advanced user} $nextStage]} { if {![info exists cgi(anotheradvanceduser)] || [string equal {} $cgi(anotheradvanceduser)]} { # no other advanced user # ERROR error [subst [subst ${no other advanced user}]] } # get next user from another advanced user (second field) set nextUser $cgi(anotheradvanceduser) } else { # get next user from next stage (select option) set nextUser $nextStage } # Check if the next user exists if [string equal {administrator} $nextUser] { # administrator is alias for administrator user name } else { # MULTIPLE SUBMIT if 0 { set searchResultList {} if ![string equal {} $nextUser] { set query [list list GetUserData $nextUser write] MultipleSubmit {} $query searchResultList 0 [list $serverAddressWithIP] } } # puts --$nextUser-- # set command [list list CheckPassword $nextUser {}] ;# seek in other sites - commented by GJFB in 2014-06-05 set seekInOtherSites 1 set checkOnlyUserName 1 set command [list list CheckPassword $nextUser {} write $seekInOtherSites $checkOnlyUserName] ;# seek in other sites - added by GJFB in 2014-06-05 otherwise old passwords (stored in other sites) might be put in use set flag [MultipleExecute [list $serverAddressWithIP] $command] # if {[llength $searchResultList] == 0} # # puts --$flag-- if {[string equal 2 $flag] || [string equal {} $flag]} { # no advanced user name (or reviewer) was found # flag may be empty when a time-out occurs with CheckPassword (see MultipleSubmit) if {[info exists optionTable2($referenceType,%@documentstage)] && [regexp {Closed Review} $optionTable2($referenceType,%@documentstage)]} { # is a review # ERROR error [subst [subst ${no reviewer name found}]] } else { # is not a review # ERROR # puts $nextUser error [subst [subst ${no advanced user name found}]] ;# see mirror/xxSubmit.tcl } } else { # the advanced user name was found # set nextUser $searchResultList } } # Check if the next user exists - end } else { # undefined (empty) next stage # not revision by the library if $update { # puts --$userGroup-- regsub {administrator} $userGroup {} userList ;# drop the administrator # puts [info exists userNameList($referenceType)] if {0 && [info exists userNameList($referenceType)] && \ [regexp {update by the author} $userNameList($referenceType)]} { # userNameList not used any more # update by the author # Drop from user group the names which are in userNameList set userList2 [GetArrayRange userNameTable] # puts $userList # puts $userList2 set userList [ListSubtraction userList userList2] ;# userList - userList2 # Drop from user group the names which are in userNameList - end } # puts --$userList-- set nextUser [lindex $userList 0] ;# take the first - if the current username is not a member of the usergroup then it is replaced with one of the member of that usergroup } elseif [info exists cgi(username)] { set nextUser $cgi(username) } elseif [info exists cgi(__e_mailaddress_e_mailaddress)] { set cgi(__e_mailaddress_e_mailaddress) [FilterEMailAddress $cgi(__e_mailaddress_e_mailaddress)] set nextUser $cgi(__e_mailaddress_e_mailaddress) } else { set nextUser {} } } } elseif [info exists cgi(username)] { set nextUser $cgi(username) } else { set nextUser {} } # puts --$nextUser-- return $nextUser } # FindNextUser - end # ---------------------------------------------------------------------- # TestUpdateClosing # return 1 if update must be closed, 0 otherwise # the code is similar of the one in FindNextUser proc TestUpdateClosing {} { global referenceType global cgi upvar nextStage nextStage if {[info exists nextStage] && [regexp {Closed Review} $nextStage]} {return 1} return 0 } # TestUpdateClosing - end # ---------------------------------------------------------------------- # TryFillingOut # fills out empty field with the unique field value found (if any) within # the same year or the year before (there must not be two or more different field values) # fieldName value is group, affiliation or electronicmailaddress # fieldValueList value is $groupList, $affiliationList or $electronicmailaddressList proc TryFillingOut {fieldName fieldValueList creatorFieldName creatorLabel} { global creatorFieldArray global cgi global serverAddressWithIP set i $cgi(filloutindex) set j [expr $i - 1] if {![string equal {} $creatorFieldArray($creatorFieldName$i)] && \ [string equal {} [lindex $fieldValueList $j]]} { if {![info exists cgi(_D_year)] || [string equal {} $cgi(_D_year)]} { set year [clock format [clock seconds] -format %Y] ;# current year } else { set year $cgi(_D_year) } set previousYear [expr $year - 1] set fieldValueList2 {} set query "$creatorLabel $creatorFieldArray($creatorFieldName$i) and $fieldName * and (year $year or year $previousYear)" # puts $query # => author Banon, Gerald Jean Francis and group * and (year 2011 or year 2010) foreach item [FindMetadataRepositories $query 0 {} {} no no 1] { foreach {site rep-i} $item {break} SetFieldValue $site ${rep-i} [list $creatorLabel $fieldName] set k [lsearch -regexp [subst $$creatorLabel] $creatorFieldArray($creatorFieldName$i)] set fieldValue [lindex [subst $$fieldName] $k] if ![string equal {} $fieldValue] { lappend fieldValueList2 $fieldValue } } # puts $fieldValueList2 set fieldValue [lsort -unique $fieldValueList2] if {[llength $fieldValue] == 1} { set fieldValueList [lreplace $fieldValueList $j $j [join $fieldValue]] } } return $fieldValueList } # TryFillingOut - end # ---------------------------------------------------------------------- # ProcessTclPage # writeUserCodedPassword used by Load2 proc ProcessTclPage {repName metadataRep writeUserCodedPassword} { global env global cgi global targetFile ;# used in CreateTclPageFile global targetFileDirname ;# used in CreateTclPage (needed when using DisplayNumberOfEntries) global targetFileRootName ;# used in CreateTclPage (needed when using DisplayNumberOfEntries) global targetFileExtension ;# used in CreateTclPage (needed when using DisplayNumberOfEntries) global targetFileType ;# used in CreateTclPageFile and DisplaySearch upvar homePath homePath upvar serverAddressWithIP serverAddressWithIP upvar language language upvar languageRep2 languageRep2 # targetFile set targetFile [Execute $serverAddressWithIP [list GetTargetFile $repName]] set targetFileDirname [file dirname $targetFile] ;# used in CreateTclPage (needed when using DisplayNumberOfEntries) set targegFileTail [file tail $targetFile] set targetFileRootName [file rootname $targegFileTail] ;# used in CreateTclPage (needed when using DisplayNumberOfEntries) set targetFileExtension [file extension $targegFileTail] ;# used in CreateTclPage (needed when using DisplayNumberOfEntries) # targetFileType set targetFileType [string trimleft $targetFileExtension .] ;# (e.g., tex) used in CreateTclPageFile and DisplaySearch # targetFileType if {[regexp -nocase {tex} $targetFileType] || \ [TestContentType $repName {^Tcl Page$|^Index$|^CGI Script$} $homePath]} { # .tex target file or Tcl Page, Index, CGI Script if [string equal {} $targetFile] { set errorLogPath $homePath/col/$repName/doc/@errorLog set log [clock format [clock seconds] -format "%d/%m/%y %H:%M"] Store log $errorLogPath auto 0 a set log {ProcessTclPage: target file name is empty} Store log $errorLogPath auto 0 a } else { if ![regexp {^cgi/} $targetFile] { # the target file is not a cgi script set path $homePath/col/$repName/doc/$targetFile set path [encoding convertfrom utf-8 $path] ;# encoding convertfrom utf-8 {a b ç d @} => a b ç d @ set alternatePath [CreateAlternatePath $path] set parentRepositories [Execute $serverAddressWithIP [list GetCitedRepositoryList $repName 2]] ;# returns a mirror repository # mirrorRep if [string equal {} $parentRepositories] { set mirrorRep $env(LOBIMIREP) } else { set mirrorRep $parentRepositories } ## submissionFormRepository # foreach {w x y z submissionFormRepository} [FindLanguage $mirrorRep] {break} if 0 { puts {Content-Type: text/html} puts {} puts $alternatePath } ConditionalSet numberOfCompilations cgi(numberofcompilations) 5 CreateTclPageFile $path $alternatePath $language $languageRep2 $writeUserCodedPassword $numberOfCompilations Execute $serverAddressWithIP [list UpdateLastUpdate $repName $metadataRep none $cgi(username)] } } } } # ProcessTclPage - end # ---------------------------------------------------------------------- # KeepOldVersionOfTeXTargetFile proc KeepOldVersionOfTeXTargetFile {repName targetFile} { global homePath ;# set in Submit global storeOldTclPage ;# set in TestForTclPageUpdate set targetFileType [string trimleft [file extension $targetFile] .] if [regexp -nocase {tex} $targetFileType] { # tex file set path $homePath/col/$repName/doc/$targetFile set alternatePath [CreateAlternatePath $path] if {[file exists $path] && [file exists $alternatePath]} { TestForTclPageUpdate $repName $path $alternatePath ;# set storeOldTclPage if {[info exists storeOldTclPage] && $storeOldTclPage} { set mtimePattern [clock format [file mtime $alternatePath] -format %Y-%m-%d-%H-%M-%S] ;# 2006-11-29-18-06-43 set texFileName [file tail $path] ;# 4primeirasPaginas.tex regsub {\.} $texFileName "$mtimePattern." texFileName2 ;# 4primeirasPaginas2006-11-29-18-06-43.tex set dirName [file dirname $path] # file rename $path $dirName/$texFileName2 file copy -force $path $dirName/$texFileName2 } } } } # KeepOldVersionOfTeXTargetFile - end # ---------------------------------------------------------------------- # ConvertFromHTML # sometimes a browser returns HTML coded characters # in such case conversion must be done to avoid # storing HTML coded metatada # Standard ASCII set, HTML Entity names, ISO 10646, ISO 8879, ISO 8859-1 Latin alphabet No. 1 Browser support: All browsers # http://www.ascii.cl/htmlcodes.htm proc ConvertFromHTML {line} { # HTML name array set symbolArray { {à} {à} {à} {à} {á} {á} {â} {â} {ã} {ã} {ä} {ä} {å} {å} {æ} {æ} {ç} {ç} {è} {è} {é} {é} {ê} {ê} {ë} {ë} {ì} {ì} {í} {í} {î} {î} {ï} {ï} {ð} {ð} {ñ} {ñ} {ò} {ò} {ó} {ó} {ô} {ô} {õ} {õ} {ö} {ö} {÷} {÷} {ø} {ø} {ù} {ù} {ú} {ú} {û} {û} {ü} {ü} {ý} {ý} {þ} {þ} {ÿ} {ÿ} {À} {À} {Á} {Á} {Â} {Â} {Ã} {Ã} {Ä} {Ä} {Å} {Å} {Æ} {Æ} {Ç} {Ç} {È} {È} {É} {É} {Ê} {Ê} {Ë} {Ë} {Ì} {Ì} {Í} {Í} {Î} {Î} {Ï} {Ï} {Ð} {Ð} {Ñ} {Ñ} {Ò} {Ò} {Ó} {Ó} {Ô} {Ô} {Õ} {Õ} {Ö} {Ö} {×} {×} {Ø} {Ø} {Ù} {Ù} {Ú} {Ú} {Û} {Û} {Ü} {Ü} {Ý} {Ý} {Þ} {Þ} {ß} {ß} {"} {"} {&} {&} {<} {<} {>} {>} {¡} {¡} {¢} {¢} {£} {£} {¤} {¤} {¥} {¥} {¦} {¦} {§} {§} {¨} {¨} {©} {©} {ª} {ª} {«} {«} {¬} {¬} {­} {­} {®} {®} {¯} {¯} {°} {°} {±} {±} {²} {²} {³} {³} {´} {´} {µ} {µ} {¶} {¶} {·} {·} {¸} {¸} {¹} {¹} {º} {º} {»} {»} {¼} {¼} {½} {½} {¾} {¾} {¿} {¿} {€} {€} } # HTML number array set symbolArray { { } { } {!} {!} {"} {"} {#} {#} {$} {$} {%} {%} {&} {&} {'} {'} {(} {(} {)} {)} {*} {*} {+} {+} {,} {,} {-} {-} {.} {.} {/} {/} {0} {0} {1} {1} {2} {2} {3} {3} {4} {4} {5} {5} {6} {6} {7} {7} {8} {8} {9} {9} {:} {:} {;} {;} {<} {<} {=} {=} {>} {>} {?} {?} {@} {@} {A} {A} {B} {B} {C} {C} {D} {D} {E} {E} {F} {F} {G} {G} {H} {H} {I} {I} {J} {J} {K} {K} {L} {L} {M} {M} {N} {N} {O} {O} {P} {P} {Q} {Q} {R} {R} {S} {S} {T} {T} {U} {U} {V} {V} {W} {W} {X} {X} {Y} {Y} {Z} {Z} {[} {[} {\} "\\" {]} {]} {^} {^} {_} {_} {`} {`} {a} {a} {b} {b} {c} {c} {d} {d} {e} {e} {f} {f} {g} {g} {h} {h} {i} {i} {j} {j} {k} {k} {l} {l} {m} {m} {n} {n} {o} {o} {p} {p} {q} {q} {r} {r} {s} {s} {t} {t} {u} {u} {v} {v} {w} {w} {x} {x} {y} {y} {z} {z} {{} {{} {|} {|} {}} {}} {~} {~} {¡} {¡} {¢} {¢} {£} {£} {¤} {¤} {¥} {¥} {¦} {¦} {§} {§} {¨} {¨} {©} {©} {ª} {ª} {«} {«} {¬} {¬} {­} {­} {®} {®} {¯} {¯} {°} {°} {±} {±} {²} {²} {³} {³} {´} {´} {µ} {µ} {¶} {¶} {·} {·} {¸} {¸} {¹} {¹} {º} {º} {»} {»} {¼} {¼} {½} {½} {¾} {¾} {¿} {¿} {À} {À} {Á} {Á} {Â} {Â} {Ã} {Ã} {Ä} {Ä} {Å} {Å} {Æ} {Æ} {Ç} {Ç} {È} {È} {É} {É} {Ê} {Ê} {Ë} {Ë} {Ì} {Ì} {Í} {Í} {Î} {Î} {Ï} {Ï} {Ð} {Ð} {Ñ} {Ñ} {Ò} {Ò} {Ó} {Ó} {Ô} {Ô} {Õ} {Õ} {Ö} {Ö} {×} {×} {Ø} {Ø} {Ù} {Ù} {Ú} {Ú} {Û} {Û} {Ü} {Ü} {Ý} {Ý} {Þ} {Þ} {ß} {ß} {à} {à} {á} {á} {â} {â} {ã} {ã} {ä} {ä} {å} {å} {æ} {æ} {ç} {ç} {è} {è} {é} {é} {ê} {ê} {ë} {ë} {ì} {ì} {í} {í} {î} {î} {ï} {ï} {ð} {ð} {ñ} {ñ} {ò} {ò} {ó} {ó} {ô} {ô} {õ} {õ} {ö} {ö} {÷} {÷} {ø} {ø} {ù} {ù} {ú} {ú} {û} {û} {ü} {ü} {ý} {ý} {þ} {þ} {ÿ} {ÿ} {Œ} {œ} {œ} {œ} {Š} {š} {š} {š} {Ÿ} {ÿ} {ƒ} {ƒ} {–} {–} {—} {—} {‘} {‘} {’} {’} {‚} {‚} {“} {“} {”} {”} {„} {„} {†} {†} {‡} {‡} {•} {•} {…} {…} {‰} {‰} {€} {€} {™} {™} } foreach code [array names symbolArray] { regsub -all $code $line $symbolArray($code) line } return $line } # ConvertFromHTML - end # ---------------------------------------------------------------------- # DoNothing # used in Submit only proc DoNothing {} { } # DoNothing - end # ---------------------------------------------------------------------- # SendPermissionTransferWarningEMail proc SendPermissionTransferWarningEMail {userName nextUser referenceType repName metadataRep} { global cgi global loCoInRep global homePath global language languageRep2 global serverAddress global localSite global submissionFormLanguageRep global currentRep if ![string equal $userName $nextUser] { if [regexp {^([^<\s@]+)@([^@\s>]+)$} $nextUser] { # nextUser is an e-mail address if [LoadService $loCoInRep registrationPassword registrationPassword 1 1] { # corrupted password StoreLog {alert} {Submit} "$loCoInRep has a corrupted registration password" } else { set authorType [array names cgi _A_*] if {[info exists cgi($authorType)] && [info exists cgi(_T_title)]} { # author set author {} set author [FormatAuthorList [FormatAuthorName [split $cgi($authorType) \n] {} familynamelast] {;}] # title set title $cgi(_T_title) # referenceType2 source $homePath/col/$languageRep2/doc/mirror/${language}ReferenceTypeName.tcl ;# set translationTable set referenceType2 $translationTable($referenceType) # identifier SetFieldValue $serverAddress $metadataRep-0 {identifier} if 0 { # testing using gjfb.home:1905 set repSite gjfb.home:1905 } else { set repSite urlib.net } package require http set url http://$repSite/col/urlib.net/www/2016/05.23.20.38/doc/sendPermissionTransferWarningEMail.cgi? append url repname=$repName& append url username=$userName& append url nextuser=$nextUser& append url author=$author& append url title=$title& append url localsite=$localSite& append url language=$language& append url referencetype2=$referenceType2& append url ibi=$identifier& append url submissionformlanguagerep=$submissionFormLanguageRep& append url requiredmirror=$currentRep& append url locoinrep=$loCoInRep& append url codedregistrationpassword=[CodeKey $registrationPassword] set convertedURL [ConvertURLToHexadecimal $url 1] # Store convertedURL C:/tmp/bbb.txt auto 0 a # set convertedURL {http://urlib.net/col/urlib.net/www/2016/05.23.20.38/doc/sendPermissionTransferWarningEMail.cgi?repname=urlib.net/www/2016/06.14.22.58&username=gerald.banon@gmail.com&nextuser=vp@aabesplanada.org.br&author=Gabriela%20Paola%20Ribeiro%20Banon;%20Achache&title=Testando%20transfer%eancia%20alternada%20e%20mandat%f3ria%20de%20permiss%e3o%20de%20atualiza%e7%e3o&localsite=gjfb:1905&language=pt-BR&referencetype2=Artigo%20em%20Evento&ibi=J8LNKB5R7W/3LSET48&submissionformlanguagerep=urlib.net/www/2011/03.29.23.24&requiredmirror=urlib.net/www/2011/03.29.20.55&locoinrep=dpi.inpe.br/banon/1999/01.09.22.14&codedregistrationpassword=phIy44tiITIi} if [catch {http::geturl $convertedURL -command DoNothing} token] { ;# this script ends before calling back DoNothing StoreLog {alert} {SendPermissionTransferWarningEMail} "$token\nwhile getting URL: $convertedURL" } set xWaitQueue 0; after 100 {set xWaitQueue 1}; vwait xWaitQueue ;# delay required with Windows 10 (gjfb:1905) http::cleanup $token } } } } } # SendPermissionTransferWarningEMail - end # ---------------------------------------------------------------------- # SendSubmissionConfirmationEMail proc SendSubmissionConfirmationEMail {userName referenceType repName metadataRep} { global cgi global loCoInRep global homePath global language languageRep2 global serverAddress global localSite global submissionFormLanguageRep global currentRep if [regexp {^([^<\s@]+)@([^@\s>]+)$} $userName] { # userName is an e-mail address if [LoadService $loCoInRep registrationPassword registrationPassword 1 1] { # corrupted password StoreLog {alert} {Submit} "$loCoInRep has a corrupted registration password" } else { set authorType [array names cgi _A_*] if {[info exists cgi($authorType)] && [info exists cgi(_T_title)]} { # author set author {} set author [FormatAuthorList [FormatAuthorName [split $cgi($authorType) \n] {} familynamelast] {;}] # title set title $cgi(_T_title) # referenceType2 source $homePath/col/$languageRep2/doc/mirror/${language}ReferenceTypeName.tcl ;# set translationTable set referenceType2 $translationTable($referenceType) # identifier SetFieldValue $serverAddress $metadataRep-0 {identifier} if 0 { # testing using gjfb.home:1905 set repSite gjfb.home:1905 } else { set repSite urlib.net } package require http set url http://$repSite/col/urlib.net/www/2021/11.23.19.44/doc/sendSubmissionConfirmationEMail.cgi? append url repname=$repName& append url username=$userName& append url author=$author& append url title=$title& append url localsite=$localSite& append url language=$language& append url referencetype2=$referenceType2& append url ibi=$identifier& append url submissionformlanguagerep=$submissionFormLanguageRep& append url requiredmirror=$currentRep& append url locoinrep=$loCoInRep& append url codedregistrationpassword=[CodeKey $registrationPassword] set convertedURL [ConvertURLToHexadecimal $url 1] if [catch {http::geturl $convertedURL -command DoNothing} token] { ;# this script ends before calling back DoNothing StoreLog {alert} {SendSubmissionConfirmationEMail} "$token\nwhile getting URL: $convertedURL" } set xWaitQueue 0; after 100 {set xWaitQueue 1}; vwait xWaitQueue ;# delay required with Windows 10 (gjfb:1905) http::cleanup $token } } } } # SendSubmissionConfirmationEMail - end # ----------------------------------------------------------------------