# Copyright for the URLibService (c) 1995 - 2013, # by Gerald Banon. All rights reserved. # Version 2.1 # submit.tcl # used to confirm a submission or an update # Example: if 0 { # update http://banon-pc.dpi.inpe.br:1905/col/iconet.com.br/banon/2004/06.12.14.52/doc/confirm.cgi?repname=iconet.com.br/banon/2002/05.26.16.17&metadatarepname=iconet.com.br/banon/2002/05.26.16.17.13&referencetype=Conference+Proceedings&update=1&languagebutton=pt-BR&attachment=yes # submit http://banon-pc.dpi.inpe.br:1905/col/iconet.com.br/banon/2004/06.12.14.52/doc/confirm.cgi?repname=iconet.com.br/banon/2002/05.26.16.17&referencetype=Conference+Proceedings&update=0&nofile=0&languagebutton=pt-BR&returnbutton=yes&updatewarning=1&__documentstage_documentstage=&attachment=yes } # ---------------------------------------------------------------------- # Confirm proc Confirm {} { if [catch { global env global cgi global homePath ;# used in SynchronizeRepository (sourceDisplayControl) and FindLanguage global administratorUserName ;# used by CreateReturnButton global serverAddressWithIP ;# used by SynchronizeRepository (sourceDisplayControl) global localSite ;# used by Help global loCoInRep ;# used by SynchronizeRepository (sourceDisplayControl) global loBiMiRep ;# used while executing SynchronizeRepository (sourceDisplayControl) global URLibServiceRepository ;# used while executing SynchronizeRepository (sourceDisplayControl) # mirrorHomePageRepository # used in sourceDisplayControl set mirrorHomePageRepository dpi.inpe.br/banon/2000/01.23.20.24 set col ../../../../.. # URLibServiceRepository set URLibServiceRepository $env(URLIB_SERVICE_REP) source ../$col/$URLibServiceRepository/doc/utilities1.tcl source ../$col/$URLibServiceRepository/doc/cgi/mirrorfind-.tcl if [info exists env(QUERY_STRING)] { foreach {name value} [split $env(QUERY_STRING) &=] { set cgi([DecodeURL $name]) [DecodeURL $value] } } # serverAddress set serverAddress [list $env(SERVER_NAME) $env(URLIB_PORT)] # serverAddressWithIP set serverAddressWithIP [list $env(IP_ADDR) $env(URLIB_PORT)] # localSite set localSite $env(SERVER_NAME):$env(SERVER_PORT) # loCoInRep set loCoInRep $env(LOCOINREP) # loBiMiRep set loBiMiRep $env(LOBIMIREP) # http set http http[expr [info exists env(HTTPS)]?{s}:{}] # homePath (used in FindLanguage) set homePath $env(DOCUMENT_ROOT) # currentRep (local mirror repository - contains @siteList.txt) set pathInfo [file split $env(PATH_INFO)] regsub -all { } [lrange $pathInfo 1 4] {/} currentRep # 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} # Find the language and the language repository - end ## the line below must be after FindLanguage (otherwise FindLanguage doesn't returns under Linux) # if $cgi(startapacheserver) {Execute $serverAddress [list StartApacheServerAfterSubmission]} # puts below must be after FindLanguage # otherwise the first Submit in FindLanguage doesn't return with SunOs puts {Content-Type: text/html} puts {} # puts [array get cgi] # puts $currentRep # puts $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 # just for the old mirror (before 12/06/05) set display [GetFrameName] # Source displayControl.tcl set enableOutput 0 eval $sourceDisplayControl # Source displayControl.tc - end foreach {language languageRep2} [FindLanguageForSubmissionForm $language $submissionFormLanguage $firstLanguageRep $languageRep2] {break} source ../$col/$languageRep2/doc/mirror/${submissionFormLanguage}Submit.tcl global "${languageRep2}::Return" # global "${languageRep2}::Copy" global "${languageRep2}::Print" global "${languageRep2}::repository warning for submission" global "${languageRep2}::identifier warning for submission" global "${languageRep2}::repository warning for update" global "${languageRep2}::access warning" global "${languageRep2}::update warning" global "${languageRep2}::eprint update warning" global "${languageRep2}::registration warning for new user" global "${languageRep2}::registration warning for old user" global "${languageRep2}::Document" global "${languageRep2}::Reference" global "${languageRep2}::your document" global "${languageRep2}::your reference" # repName set repName $cgi(repname) # referenceType set referenceType $cgi(referencetype) ;# used by CreateReturnButton if $cgi(update) { # update set metadataRep $cgi(metadatarepname) set submissionType update # versionStamp set versionStamp [Execute $serverAddress [list GetMetadataLastUpdate $metadataRep-0]] # size set size [Execute $serverAddress [list GetFieldValue $metadataRep-0 size]] # title set title [Execute $serverAddress [list GetFieldValue $metadataRep-0 title]] set title [lrange [split $title] 0 9][expr [llength [split $title]] > 10?{ ...}:{}] # author set author [Execute $serverAddress [list GetAuthor $metadataRep-0]] set author [join [KeepInitials $author] {;}] if {[string compare {} $size] != 0} { set repositoryWarning ${repository warning for update} set accessWarning ${access warning} set Object $Document set object ${your document} } else { set repositoryWarning {} set accessWarning {} set Object $Reference set object ${your reference} } set updateWarning ${update warning} # Load ../$col/$submissionFormLanguageRep/doc/${submissionFormLanguage}UpdateAcknowledgement.html htmlContent if [file exists ../$col/$submissionFormLanguageRep/doc/${submissionFormLanguage}UpdateAcknowledgement.html] { Load ../$col/$submissionFormLanguageRep/doc/${submissionFormLanguage}UpdateAcknowledgement.html htmlContent } else { if [file exists ../$col/$languageRep1/doc/${language}UpdateAcknowledgement.html] { Load ../$col/$languageRep1/doc/${language}UpdateAcknowledgement.html htmlContent } else { Load ../$col/$languageRep2/doc/${language}UpdateAcknowledgement.html htmlContent } } } else { # submit set submissionType submit if {!$cgi(nofile) || ([info exists cgi(templaterepository)] && ![string equal {} $cgi(templaterepository)])} { set repositoryWarning ${repository warning for submission} set accessWarning ${access warning} set Object $Document set object ${your document} set cgi(attachment) yes ;# used for the copy button } else { set repositoryWarning ${identifier warning for submission} set accessWarning {} set Object $Reference set object ${your reference} # set cgi(attachment) no ;# used for the copy button set cgi(attachment) yes ;# used for the copy button } if $cgi(updatewarning) { set updateWarning ${update warning} } else { set updateWarning {} } # Process ePrint if [regexp {Electronic Source} $cgi(referencetype)] { set ePrintUpdateWarning ${eprint update warning} LoadService $repName targetFile targetFile 0 1 regsub {.pdf} $targetFile {} ePrintVersion } else { set ePrintUpdateWarning {} } # Process ePrint - end # Set random password warning Load ../$col/$repName/service/randomPassword randomPassword file delete ../$col/$repName/service/randomPassword if {[string compare {yes} $cgi(usernamefieldshown)] == 0} { # the user name and password fields are shown # no password to show (== mail without password) set randomPasswordWarning {} } elseif {[string compare {yes} $cgi(newadvanceduser)] == 0} { # show password (== mail with password) set randomPasswordWarning ${registration warning for new user} } else { # no password to show (== mail without password) set randomPasswordWarning ${registration warning for old user} } # Set random password warning - end # Load ../$col/$submissionFormLanguageRep/doc/${submissionFormLanguage}SubmitAcknowledgement.html htmlContent if [file exists ../$col/$submissionFormLanguageRep/doc/${submissionFormLanguage}SubmitAcknowledgement.html] { Load ../$col/$submissionFormLanguageRep/doc/${submissionFormLanguage}SubmitAcknowledgement.html htmlContent } else { if [file exists ../$col/$languageRep1/doc/${language}SubmitAcknowledgement.html] { Load ../$col/$languageRep1/doc/${language}SubmitAcknowledgement.html htmlContent } else { Load ../$col/$languageRep2/doc/${language}SubmitAcknowledgement.html htmlContent } } } regsub {returnbutton=yes} $env(QUERY_STRING) {returnbutton=no} queryString # catch {SetFont [subst [subst $htmlContent]]} output set output [SetFont [subst [subst $htmlContent]]] ;# needs localSite puts $output } m] {puts $m; if 0 {global errorInfo; puts $errorInfo}} } # Confirm - end # ----------------------------------------------------------------------