#!/bin/sh # Copyright for the Uniform Repository Service (c) 1995 - 1999, # by Gerald Banon. All rights reserved. # Version 2.1 # start.tcl \ nohup ../../../../../\ dpi.inpe.br/banon/1997/10.21.17.24\ /doc/tk8.0/unix/wish "$0" ${1+"$@"} # global languageList ;# list of available languages # global browserList ;# list of available browsers # global languageTable ;# the values are repository names # global keyRepositoryList ;# list of identification keys and repositories # global environmentArray ;# # global referenceTable ;# # global repositoryProperties ;# localversion, history, targetfile # global conversionTable ;# for refer format of EndNote # global inverseTable ;# inverse of conversionTable # global metadataArray ;# indices are repository names and refer fields # global repArray ;# contains repository names, index is type,field,word # global wordOccurrenceArray ;# contains number of words, index is word # global saveMetadata ;# values are 0 or 1; 1 means save # global indexArray ;# obsolete - indices are repository names, values are refer references # global indexIndicator ;# obsolete - 1 means that the index must be updated # global log ;# text widget name # global textLog ;# text log # global spPreferenceButton ;# values are language, mail, ... # global spPreference ;# values are spLanguage, spMail, ... # global ddDirectory ;# value is ddDirectory # global ddRepository ;# value is ddRepository # global ddChoice2 ;# values are new or repository # global spDialogLanguage ;# language used to construct the dialog # global ddDialogLanguage ;# language used to construct the dialog # global wDialogLanguage ;# language used to construct the dialog # global spSettingArray ;# contains the settings before OK is completed # global spArrayName ;# values are environmentArray or spSettingArray # global hostName ;# banon-pc # global domainName ;# dpi.inpe.br # global homePath ;# ex: /home/URLib # global col # global URLibServiceRepository # global zipRepository # global englishRepository # global citationKeyRepository # global tclRepository # global tclExec ;# ex: bin/tclsh81.exe # global apacheRepository # global apacheExec ;# ex: apache # global searchRepository # global compileWordsRepository # global bib2referRepository # global ddSearchResult ;# contains a repository list; search result done dd form # global ddSelectedkeyRepList ;# list of selected identification keys and repositories # global loCoInRep ;# == environmentArray(localCollectionIndexRepository) # global loBiMiRep ;# == environmentArray(localBibliographicMirrorRepository) # global commonWordsRepList ;# contains a repository list # global commonWords ;# contains a list of common words # global localURLibClientSocketId # global localURLibServer ;# array # The URLib service needs the following repositories: # ../../../../../../col/dpi.inpe.br/banon/1999/07.11.21.09 \ (citationKeyRepository - Creating the citation key - CreateKey) # ../../../../../../col/dpi.inpe.br/banon/1999/04.21.17.06 \ (searchRepository - Fast lookup in bibliography data bases - Search) # ../../../../../../col/dpi.inpe.br/banon/1999/07.17.00.02 \ (bib2referRepository - Converting BibTeX to Refer) # ../../../../../../col/dpi.inpe.br/banon/1999/04.25.14.34 \ (compileWordsRepository - Common words compiler) # ../../../../../../col/dpi.inpe.br/banon/1998/05.03.10.10 \ (englishRepository - English version of the URLib Service) # ../../../../../../col/dpi.inpe.br/banon/1999/04.25.10.22 \ (englishWordsRepository - English common words) # ../../../../../../col/dpi.inpe.br/banon/1999/05.03.22.11 \ (English version of the mirror pages) # For Windows platform it needs: # ../../../../../dpi.inpe.br/banon/1998/05.17.16.22 \ (tclRepository - Tcl/Tk 8.1.1 for Windows, Binary Distribution) # ../../../../../dpi.inpe.br/banon/1999/01.02.16.35 \ (apacheRepository - Apache HTTP Server Version 1.3 for Windows) # ../../../../../dpi.inpe.br/banon/1998/03.07.08.57 \ (zipRepository - Zip 2.2 - Windows 95 version) # For UNIX platform it needs: # ../../../../../dpi.inpe.br/banon/1997/10.21.17.24 \ (tclRepository - Tcl/Tk 8.1.1 for SunOS 5.5.1) # ../../../../../dpi.inpe.br/vagner/1999/07.16.16.29 \ (apacheRepository - Apache HTTP Server Version 1.3 for Solaris) # ../../../../../dpi.inpe.br/vagner/1999/07.22.16.12 \ (zipRepository - Zip 2.2 - Solaris/SunOS version) # set some global variables set URLibServiceRepository dpi.inpe.br/banon/1998/08.02.08.56 set citationKeyRepository dpi.inpe.br/banon/1999/07.11.21.09 set searchRepository dpi.inpe.br/banon/1999/04.21.17.06 set bib2referRepository dpi.inpe.br/banon/1999/07.17.00.02 set compileWordsRepository dpi.inpe.br/banon/1999/04.25.14.34 set englishRepository dpi.inpe.br/banon/1998/05.03.10.10 set englishWordsRepository dpi.inpe.br/banon/1999/04.25.10.22 if ![regexp "(^.*)/col/$URLibServiceRepository/doc" [pwd] m homePath] { # starting from home cd col/$URLibServiceRepository/doc regexp "(^.*)/col/$URLibServiceRepository/doc" [pwd] m homePath } # homePath, ex: /home/URLib set pwd [pwd] set col ../../../../.. if {$tcl_platform(platform) == "windows"} { set tclRepository dpi.inpe.br/banon/1998/05.17.16.22 set tclExec bin/tclsh80.exe # set tclExec bin/tclsh81.exe set apacheRepository dpi.inpe.br/banon/1999/01.02.16.35 set apacheExec apache set zipRepository dpi.inpe.br/banon/1998/03.07.08.57 } if {$tcl_platform(platform) == "unix"} { set tclRepository dpi.inpe.br/banon/1997/10.21.17.24 set tclExec tcl8.0/unix/tclsh set apacheRepository dpi.inpe.br/vagner/1999/07.16.16.29 set apacheExec src/httpd-solaris26 set zipRepository dpi.inpe.br/vagner/1999/07.22.16.12 } # set some global variables - end file mkdir ../$col/clipboard ;# used by LoadMetadata # The command below should be run only during developement process pkg_mkIndex . \ definition.tcl \ StartExtraDialog.tcl UtilitiesExtraDialog.tcl \ DDDialog.tcl SPDialog.tcl \ DDHelp.tcl SPHelp.tcl \ DDExtraDialog.tcl SPExtraDialog.tcl \ StartServer.tcl ServerExtraDialog.tcl \ utilitiesStart.tcl \ utilitiesMirror.tcl \ utilities.tcl package require http 2.0 lappend auto_path $pwd package require $URLibServiceRepository if [file exists $col/$englishRepository] { source $col/$englishRepository/doc/EnglishLanguage.tcl } if {$tcl_platform(platform) == "windows"} { console show # console hide } # tkwait is to start the console display # catch {tkwait visibility .} # after 4000 exit wm withdraw . file mkdir ../auxdoc ;# for installation # Load variables # environmentArray if [file exists ../auxdoc/.environmentArray.tcl] { catch {source ../auxdoc/.environmentArray.tcl} } # repositoryProperties if [file exists ../auxdoc/.repositoryProperties.tcl] { catch {source ../auxdoc/.repositoryProperties.tcl} } else { # Create repositoryList cd $homePath/col set repositoryList [glob -nocomplain */*/*/*] cd $pwd # Create repositoryList - end foreach rep $repositoryList { if [file exists $col/$rep/service/targetFile] { Load $col/$rep/service/targetFile targetFile set targetFile [string trim $targetFile \n] set repositoryProperties($rep,targetfile) $targetFile } if [file exists $col/$rep/service/history] { Load $col/$rep/service/history history set repositoryProperties($rep,history) $history } } StoreArray repositoryProperties ../auxdoc/.repositoryProperties.tcl } # referenceTable if [file exists ../auxdoc/.referenceTable.tcl] { catch {source ../auxdoc/.referenceTable.tcl} } else { # Create repositoryList if ![info exists repositoryList] { cd $homePath/col set repositoryList [glob -nocomplain */*/*/*] cd $pwd } # Create repositoryList - end foreach rep $repositoryList { UpdateReferenceTable $rep } StoreArray referenceTable ../auxdoc/.referenceTable.tcl } # Load variables - end # Create languageList and languageTable # languageRepositories (list of language repositories) if ![info exists environmentArray(spLanguageEntry)] { set environmentArray(spLanguageEntry) English } set languageRepositories $englishRepository foreach index [array names referenceTable *,$englishRepository] { regsub {,.*} $index {} rep if {[info exists repositoryProperties($rep,targetfile)] && \ [regexp {Language.tcl} \ $repositoryProperties($rep,targetfile)]} { lappend languageRepositories $rep } } if [info exists repositoryProperties] { set languageList "" foreach languageRepository $languageRepositories { set pathFile [glob -nocomplain \ $homePath/col/$languageRepository/doc/*Language.tcl] regexp {.*/(.*)Language.tcl} $pathFile m language lappend languageList $language set languageTable($language) $languageRepository } } else { set languageList English set languageTable(English) $englishRepository } if {[lsearch -exact $languageList $environmentArray(spLanguageEntry)] \ == -1} { set environmentArray(spLanguageEntry) English } # puts $languageList SourceLanguage environmentArray # Create languageList and languageTable - end # Create browserList if {$tcl_platform(platform) == "windows"} { set browserList {Netscape {Internet Explorer}} } if {$tcl_platform(platform) == "unix"} { set browserList Netscape } # Create browserList - end # about port if ![info exists environmentArray(spPortEntry)] { set environmentArray(spPortEntry) 1905 } if ![info exists environmentArray(spPortList)] { set environmentArray(spPortList) 1905 } # about port - end # Make the cgi scripts # ---------------------------------------------------------------------- # MakeCgiScript proc MakeCgiScript {rep cgiScriptName procFileName procName} { global tclRepository global URLibServiceRepository global tclExec global col global homePath global tcl_platform if {$tcl_platform(platform) == "windows"} { set script "#!$col/$tclRepository/doc/$tclExec source ../$col/$URLibServiceRepository/doc/cgi/$procFileName $procName" Store script $col/$rep/auxdoc/cgi/$cgiScriptName } if {$tcl_platform(platform) == "unix"} { set script "#!/bin/sh # \\ exec $homePath/col/$tclRepository/doc/$tclExec \"\$0\" \${1+\"\$@\"} source $homePath/col/$URLibServiceRepository/doc/cgi/$procFileName $procName" Store script $col/$rep/auxdoc/cgi/$cgiScriptName # exec chmod -f +x $col/$rep/auxdoc/cgi/$cgiScriptName exec chmod +x $col/$rep/auxdoc/cgi/$cgiScriptName } } # MakeCgiScript - end # ---------------------------------------------------------------------- file mkdir ../auxdoc/cgi MakeCgiScript $URLibServiceRepository get- get-.tcl Get- MakeCgiScript $URLibServiceRepository from from.tcl From MakeCgiScript $URLibServiceRepository mirror.cgi mirror.tcl CreateMirror MakeCgiScript $URLibServiceRepository mirrorsearch.cgi mirrorsearch.tcl MirrorSearch MakeCgiScript $URLibServiceRepository mirrorfind-.cgi mirrorfind-.tcl Find- # Make the cgi scripts - end # Check if the httpd.pid exists # Only one start program should be running at the same time # if [file exists ../auxdoc/running_indicator] { if [file exists $col/$apacheRepository/auxdoc/serverDir/logs/httpd.pid] { set choice "" set choice $choice[Dialog \ {Yes No} {disabled active} {0 0} Start \ {URLib service running}] if {$choice == 1} { exit } else { StopApacheServer } # } else { # if [catch {open ../auxdoc/running_indicator w} fileId] { # puts stderr $fileId # } else { # puts $fileId {The start command is running.} # close $fileId # } # } # Check if the httpd.pid exists - end # ---------------------------------- # Set window set w .window toplevel $w wm title $w "URLib Service" set backgroundColor [lindex [$w configure -background] 3] # puts $backgroundColor # => SystemButtonFace # Create a frame for the menu bar. frame $w.menubar frame $w.sp -height .47c -relief raised -borderwidth 1 pack $w.menubar -side top -fill x pack $w.sp -side top -fill x -expand true # Create the command buttons. set width .7 set height .9 # Quit button frame $w.menubar.quit -width [format "%si" $width] \ -height [format "%sc" $height] pack propagate $w.menubar.quit false pack $w.menubar.quit -side right set qui [button $w.menubar.quit.1 -command { # SAVE StoreArray environmentArray ../auxdoc/.environmentArray.tcl if $saveMetadata { set metadataArrayPath \ $col/$URLibServiceRepository/auxdoc/.metadataArray.tcl set repArrayPath \ $col/$URLibServiceRepository/auxdoc/.repArray.tcl # set metadataRepListPath \ $col/$URLibServiceRepository/auxdoc/.metadataRepList.tcl StoreArray metadataArray $metadataArrayPath w list StoreArray repArray $repArrayPath w list # StoreList metadataRepList $metadataRepListPath } # SAVE - end # SAVE log Store textLog ../auxdoc/textLog # SAVE log - end # file delete ../auxdoc/running_indicator if [info exists localURLibServer(socketId)] { close $localURLibServer(socketId) } StopApacheServer exit } -borderwidth 2 -cursor hand2] ConfigText $qui Quit pack $qui -fill both -expand true # DD button frame $w.menubar.dd -width [format "%si" $width] \ -height [format "%sc" $height] pack propagate $w.menubar.dd false set wdd [button $w.menubar.dd.1 -command Run-dd -borderwidth 2 \ -cursor hand2] ConfigText $wdd DD pack $wdd -fill both -expand true # RR button frame $w.menubar.rr -width [format "%si" $width] \ -height [format "%sc" $height] pack propagate $w.menubar.rr false set wrr [button $w.menubar.rr.1 -text rr -command Run-rr -borderwidth 2 \ -cursor hand2] pack $wrr -fill both -expand true frame $w.menubar.gr -width [format "%si" $width] \ -height [format "%sc" $height] pack propagate $w.menubar.gr false # GR button set wgr [button $w.menubar.gr.1 -text gr -command Run-gr -borderwidth 2 \ -cursor hand2] pack $wgr -fill both -expand true # SP button frame $w.menubar.sp -width [format "%si" $width] \ -height [format "%sc" $height] pack propagate $w.menubar.sp false set wsp [button $w.menubar.sp.1 -command Run-sp -borderwidth 2 \ -cursor hand2] ConfigText $wsp SP pack $wsp -fill both -expand true $wdd config -state disabled $wrr config -state disabled $wgr config -state disabled $wsp config -state disabled pack $w.menubar.dd $w.menubar.rr $w.menubar.gr $w.menubar.sp -side left # Create a text widget to log the output frame $w.output set log [text $w.output.log -width 80 -height 40\ -borderwidth 2 -relief raised -setgrid true \ -yscrollcommand "$w.output.scroll set" -bg gray85 \ -wrap word] scrollbar $w.output.scroll -command "$w.output.log yview" TextStyles $log # load log if [file exists ../auxdoc/textLog] { if [catch {open ../auxdoc/textLog r} fileId] { puts stderr $fileId } else { set textLog [read $fileId] close $fileId } set length [llength $textLog] set j [expr $length - 200] ;# 200 == maximum number of log lines set textLog [lreplace $textLog 0 $j] foreach cmd $textLog {eval [join $cmd \n]} $log yview moveto 1.0 } else { set textLog "" } set seconds [clock seconds] set weekday [clock format $seconds -format %a] set month [clock format $seconds -format %b] set day [clock format $seconds -format %d] set time [clock format $seconds -format %T] set year [clock format $seconds -format %Y] LogInsert [list [list $log insert end \n]] LogInsert [list [list Insert $log end \ {login time: $var1 $var2 $var3 $var4 $var5} \ {} $weekday $month $day $time $year] \ [list $log insert insert \n]] $log yview moveto 1.0 # load log - end pack $w.output.scroll -side right -fill y pack $w.output.log -side left -fill both -expand true pack $w.output -side top -fill both -expand true wm geometry $w 80x39+0+0 # Place dialog windows # DD dialog label $w.sp.dd -bg #ffffcc \ -relief solid -borderwidth 1 ConfigText $w.sp.dd " Depositing a Document " bind $w.menubar.dd \ "DisplayMessage $w.sp.dd $w.sp nw 0 0 [format "%si" 0]" bind $w.menubar.dd "DeleteMessage" bind $wdd