|
From: <bu...@us...> - 2006-03-23 16:26:53
|
Revision: 576 Author: bugant Date: 2006-03-23 08:26:42 -0800 (Thu, 23 Mar 2006) ViewCVS: http://svn.sourceforge.net/yaacs/?rev=576&view=rev Log Message: ----------- drop out INSTALL_DIR and BIN_DIR; assume that needed executable files are in PATH and that document's templates are installed in a common standard place (/usr/share/yaacs). Modified Paths: -------------- trunk/yaacs/yaconf.tcl trunk/yacco.tcl trunk/yadmin.tcl Modified: trunk/yaacs/yaconf.tcl =================================================================== --- trunk/yaacs/yaconf.tcl 2006-03-23 11:06:12 UTC (rev 575) +++ trunk/yaacs/yaconf.tcl 2006-03-23 16:26:42 UTC (rev 576) @@ -20,7 +20,10 @@ namespace eval ::yaconf { - namespace export checkLocalConf conf getHome getLogFile getUser logConf + namespace export checkLocalConf conf getHome getLogFile getUser logConf + +# filesystem layout settings + variable sharePath [file join "/usr" "share" "yaacs"] } # Read configuration file Modified: trunk/yacco.tcl =================================================================== --- trunk/yacco.tcl 2006-03-23 11:06:12 UTC (rev 575) +++ trunk/yacco.tcl 2006-03-23 16:26:42 UTC (rev 576) @@ -307,27 +307,29 @@ set bp [frame $info.r] button $bp.conv -text [mc "Contract"] -image $::yatk_icons::contract -compound top \ -relief flat -command { - if {[llength [array names ::yacco::config -exact "A2PS_CMD"]] == 0 || \ - [llength [array names ::yacco::config -exact "INSTALL_DIR"]] == 0} { - ::yatk_dlg::error [mc "Bad configuration! You need to proper configure \ - a2ps (A2PS_CMD) and install dir (INSTALL_DIR) on your config file."] + if {[llength [array names ::yacco::config -exact "A2PS_CMD"]] == 0} { + ::yatk_dlg::error [mc "Configuration error: a2ps is not configured."] return } + if {!([file exists $::yaconf::sharePath] && [file isdir $::yaconf::sharePath])} { + ::yatk_dlg::error [mc "Cannot find directory $::yaconf::sharePath."] + return + } - ::yacco::onPressContract $::yacco::config(A2PS_CMD) \ - $::yacco::config(INSTALL_DIR) + ::yacco::onPressContract $::yacco::config(A2PS_CMD) } button $bp.rit -text [mc "Invoice"] -image $::yatk_icons::invoice -compound top \ -relief flat -command { - if {[llength [array names ::yacco::config -exact "A2PS_CMD"]] == 0 || \ - [llength [array names ::yacco::config -exact "INSTALL_DIR"]] == 0} { - ::yatk_dlg::error [mc "Bad configuration! You need to proper configure \ - a2ps (A2PS_CMD) and install dir (INSTALL_DIR) on your config file."] + if {[llength [array names ::yacco::config -exact "A2PS_CMD"]] == 0} { + ::yatk_dlg::error [mc "Configuration error: a2ps is not configured."] return } + if {!([file exists $::yaconf::sharePath] && [file isdir $::yaconf::sharePath])} { + ::yatk_dlg::error [mc "Cannot find directory $::yaconf::sharePath."] + return + } - ::yacco::onPressInvoice $db_int $::yacco::config(A2PS_CMD) \ - $::yacco::config(INSTALL_DIR) + ::yacco::onPressInvoice $db_int $::yacco::config(A2PS_CMD) } grid $bp.conv $bp.rit -padx 3 -pady 3 @@ -917,7 +919,7 @@ # hadling for event 'press button Contract' # -proc ::yacco::onPressContract {a2ps instDir} { +proc ::yacco::onPressContract {a2ps} { if {$a2ps == ""} { yatk_dlg::error [mc "a2ps is not configured. Please verify your settings."] @@ -981,11 +983,10 @@ # read the contract template - set tmp "/share/yaacs/data/contract.txt" - set tmp "$instDir$tmp" + set tmp [file join $::yaconf::sharePath "contract.txt"] if {![file exists $tmp]} { - ::yalog::error "contract template file not found, we're searching for $tmp" - ::yatk_dlg::error [mc "Contract template file not found.\nPlease check your conf"] + ::yalog::error "contract template file not found: $tmp" + ::yatk_dlg::error [mc "Contract template file not found. Contact your system administrator."] return } set tmpF [open $tmp r] @@ -1003,12 +1004,12 @@ regsub -all "CITYXXXX" $tmpData $city tmpData regsub -all "DATAXXXX" $tmpData $allData tmpData - set out "/tmp/conve.txt" + set out [file join "/tmp" "conve.txt"] set outF [open $out w+] puts $outF $tmpData close $outF - set psOut "/tmp/conve.ps" + set psOut [file join "/tmp" "conve.ps"] set a2psCmd "$a2ps $psOut $out" eval exec $a2psCmd @@ -1020,12 +1021,11 @@ file delete $psOut file delete $out - } # hadling for event 'press button Contract' # -proc ::yacco::onPressInvoice {db a2ps instDir} { +proc ::yacco::onPressInvoice {db a2ps} { array set data [::yacco::get_fields 0] if {[array size data] == 0} { ::yacco::dbError @@ -1034,7 +1034,6 @@ set ::tk::db $db set ::tk::a2ps $a2ps - set ::tk::instDir $instDir array set ::tk::data [array get data] set ::yacco::pending [::op::getPendingInvoice $db $data(codfis)] @@ -1048,7 +1047,7 @@ Do you want to procede with a generic invoice printing?"]] == 1} { return } - ::yacco::invoiceForm .invform $a2ps $instDir $db $data(codfis) + ::yacco::invoiceForm .invform $a2ps $db $data(codfis) return } else { # choose what to pay @@ -1079,7 +1078,7 @@ frame $w.bts button $w.bts.ok -text [mc "Ok"] -image $::yatk_icons::ok -compound left \ -command { - ::yacco::invoiceForm .pays.invform $::tk::a2ps $::tk::instDir $::tk::db $::tk::data(codfis) + ::yacco::invoiceForm .pays.invform $::tk::a2ps $::tk::db $::tk::data(codfis) # by now we don't use any infos from the payment choosed [.pays.frLst.lstPay curselection] set ::yacco::iButton 1 } @@ -1113,7 +1112,6 @@ unset ::tk::db unset ::tk::a2ps - unset ::tk::instDir unset ::tk::data } @@ -1831,11 +1829,10 @@ return [array get ret] } -proc ::yacco::invoiceForm {w a2ps instDir db cod {pays ""}} { +proc ::yacco::invoiceForm {w a2ps db cod {pays ""}} { set ::yacco::wPath $w set ::yacco::tmpDb $db set ::yacco::a2ps $a2ps - set ::yacco::instDir $instDir set title [mc "Invoice form"] @@ -1987,8 +1984,8 @@ if {$extra == 0} {set extra ""} #hardcoded invoice template name..... bad guy - set tmp "/share/yaacs/data/invoice_in.txt" - set tmp "$::yacco::instDir$tmp" + set tmp [file join $::yaconf::sharePath "invoice_in.txt"] + #maybe we have to check for file existance if {![file exists $tmp]} { ::yalog::error "invoice template file not found. we're searching for $tmp" @@ -2037,12 +2034,12 @@ regsub -all "BANKCABXXXX" $tmpData $data(bank_cab) tmpData regsub -all "BANKOWNERXXXX" $tmpData $data(bank_owner) tmpData - set out "/tmp/invoice.txt" + set out [file join "/tmp" "invoice.txt"] set outF [open $out w+] puts $outF $tmpData close $outF - set psOut "/tmp/invoice.ps" + set psOut [file join "/tmp" "invoice.ps"] set a2psCmd "$::yacco::a2ps $psOut $out" eval exec $a2psCmd @@ -2055,8 +2052,7 @@ file delete $psOut file delete $out - set tmp "/share/yaacs/data/invoice_out.txt" - set tmp "$::yacco::instDir$tmp" + set tmp [file join $::yaconf::sharePath "invoice_out.txt"] set tmpF [open $tmp r] set tmpData [read $tmpF] close $tmpF @@ -2077,12 +2073,12 @@ regsub -all "EXTRAXXXX" $tmpData $extra tmpData regsub -all "TOTXXXX" $tmpData $tot tmpData - set out "/tmp/invoice.txt" + set out [file join "/tmp" "invoice.txt"] set outF [open $out w+] puts $outF $tmpData close $outF - set psOut "/tmp/invoice.ps" + set psOut [file join "/tmp" "invoice.ps"] set a2psCmd "$::yacco::a2ps $psOut $out" eval exec $a2psCmd @@ -2120,7 +2116,6 @@ update idletasks unset ::yacco::wPath unset ::yacco::a2ps - unset ::yacco::instDir unset ::yacco::tmpDb unset ::yacco::foButton Modified: trunk/yadmin.tcl =================================================================== --- trunk/yadmin.tcl 2006-03-23 11:06:12 UTC (rev 575) +++ trunk/yadmin.tcl 2006-03-23 16:26:42 UTC (rev 576) @@ -71,11 +71,9 @@ variable ::yadmin::ANSM_WTIME "01:00:00" variable ::yadmin::POP_NINT 6 variable ::yadmin::COM_NINT 12 -# graphics stuff - variable ::yadmin::theme "" - variable ::yadmin::allowChangeTheme 0 } + #command line options' handling proc cmderrmsg {msg opts usage} { @@ -263,11 +261,11 @@ # bbtools menu definition menu .mbar.mbbt -tearoff 0 -.mbar.mbbt add command -label [mc "Block..."] -command {::yadmin::doBbTools $db_sample $config(BIN_DIR) \ +.mbar.mbbt add command -label [mc "Block..."] -command {::yadmin::doBbTools $db_sample \ "" $gettedopts(c) $::yadmin::logLevel} .mbar.mbbt add command -image $::yatk_icons::bbt -label [mc "Block for this project"] -compound left \ -command {::yadmin::doBbTools $db_sample \ - $config(BIN_DIR) $yadmin::pj $gettedopts(c) $::yadmin::logLevel} + $yadmin::pj $gettedopts(c) $::yadmin::logLevel} # operators menu @@ -3053,11 +3051,10 @@ # call yabbt to check for blocks # # @param db sampling database connection handler -# @param binDir where's yaacs binary # @param id project's id # @param conf path to yaacs.conf # @param logLevel log level -proc ::yadmin::doBbTools {db binDir id conf logLevel} { +proc ::yadmin::doBbTools {db id conf logLevel} { if {$id == -1} { ::yatk_dlg::error [mc "You must connect to a project first."] @@ -3087,10 +3084,10 @@ #maybe we can use expcet::fork as we do in yachoo #anyway maybe it's useful to catch erros (if any;) - if {[catch {exec $binDir/yabbt -p $id -c $conf -l $logLevel} errb]} { + if {[catch {exec yabbt -p $id -c $conf -l $logLevel} errb]} { ::yalog::error "yabbt execution failed with msg:\n $errb" - ::yatk_dlg::error [mc "I'm not being able to execute yabbt.Please check your path conf (BIN_DIR)"] - } + ::yatk_dlg::error [mc "I'm not being able to execute yabbt.Please check your PATH"] + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |