|
From: <si...@us...> - 2006-04-05 17:28:25
|
Revision: 624 Author: sickpig Date: 2006-04-05 10:28:15 -0700 (Wed, 05 Apr 2006) ViewCVS: http://svn.sourceforge.net/yaacs/?rev=624&view=rev Log Message: ----------- * more love adapting yacati and yadmin to new db design Modified Paths: -------------- trunk/yacati.tcl trunk/yadmin.tcl Modified: trunk/yacati.tcl =================================================================== --- trunk/yacati.tcl 2006-04-05 17:25:31 UTC (rev 623) +++ trunk/yacati.tcl 2006-04-05 17:28:15 UTC (rev 624) @@ -307,7 +307,7 @@ -state disabled -command { ::yacati::onPressNew_contact $db } ::yatk_balloon::balloon .g6.btnew_contact [mc "Get a new contact"] button .g6.btsave -image $::yatk_icons::save -text [mc "Save"] -compound left \ - -state disabled -command { yacati::onPressSave $db $db} + -state disabled -command { yacati::onPressSave $db} ::yatk_balloon::balloon .g6.btsave [mc "Save the contact"] button .g6.btfinish -image $::yatk_icons::exit -text [mc "Finish"] -compound left \ -state disabled -command { yacati::onPressFinish $db } @@ -611,8 +611,8 @@ array set survey [array get yacati::survey] if {$yacati::call==0} { - yalog::debug "Button newcontact pressed..." - set risu [yacati::get_contact $db] + ::yalog::debug "Button newcontact pressed..." + set risu [::yacati::get_contact $db] if {$yacati::survey(listed)=="t"} {::yacati::incWdjState normal} else {::yacati::popWdjState normal} set yacati::disabledPhones [list] @@ -620,7 +620,7 @@ if {($risu==0)} { if { $survey(freq_mon)!=0 && $survey(freq_att)==0 } { - set ::yacati::perfIdxs [cati::perfIdxCalc $db $survey(proj) $yacati::session(inizio_turno) $yacati::user(id)] + set ::yacati::perfIdxs [cati::perfIdxCalc $db $survey(proj) $yacati::session(inizio_turno) $yacati::user(uid)] } ::yacati::perfIdxDisplay $::yacati::perfIdxs @@ -695,7 +695,7 @@ if {$ouid==8} { - if { $survey(azienda) == "f" } { + if { $survey(listed) == "f" } { if {$::yacati::age} { set year [::yacati::getWdjValue birthday]; if { $year == "" } { @@ -755,7 +755,7 @@ return [::yatk_dlg::error [mc "You must specify the sex."]] } } else { set sex "N"} - + #MOVE SQL set sql "Select projects.ins_respondent( $contact(uid),$contact(com_sql),$survey(proj),$year,$atti,$studi,'$sex',$vol_str)" ::yadb::execl $db $sql } else { @@ -854,8 +854,8 @@ proc yacati::onPauseUnlock {db userid} { ::yalog::debug "Close pause session" ::cati::closeSessionActivity $db $yacati::p_session -1 - - set sql_note_user "select note from intervistatore where id=$userid" + # MOVE SQL + set sql_note_user "select note from interviewers.interviewers where uid=$userid" set note_user [lindex [::yadb::getTuple $db $sql_note_user 0] 0] regsub -all \\n $note_user "" note_user @@ -918,7 +918,7 @@ if { $contact(com_sql) == "NULL" } { set com_ms -1 } - set f [open "|$cati_exe $url?action=display&numint=$contact(id)&codcom=$com_ms"] + set f [open "|$cati_exe $url?action=display&numint=$contact(rid)&codcom=$com_ms"] fconfigure $f -blocking 0 fileevent $f readable [list yacati::lazy_reader $f] @@ -959,7 +959,7 @@ yacati::clearCombo con_state array set ret [::yacati::callBack $db $survey(proj) $survey(pjstart) $survey(pjend) \ - $survey(azienda) [array get contact]] + $survey(listed) [array get contact]] if {[array size ret] == 0} { yalog::debug "Operators press cancel on Call Back GUI"; return } @@ -1086,7 +1086,7 @@ if {("$fromaddr" == "") || ("$modello_testo" == "")} { yalog::error "Problem with yaacs configuration, check MAIL_SERVER, MAIL_SENDER values or field 'mail_path' on table 'projects.projects'" return [yatk_dlg::error [mc "Problem with yaacs configuration, check \ - MAIL_SERVER, MAIL_SENDER values or field 'percorso_mail' on table 'indagini'."]] + MAIL_SERVER, MAIL_SENDER values or field 'mail_path' on table 'projects.projects'."]] } set fd_m [open $modello_testo] @@ -1373,7 +1373,7 @@ if {[array size ::yacati::contact]>0} { - set yacati::contact(s_activity) [::cati::getSessionActivity $dbt $::yacati::user(uid) \ + set yacati::contact(s_activity) [::cati::getSessionActivity $db $::yacati::user(uid) \ $survey(proj) $::yacati::contact(com_sql) $::yacati::contact(rid)] if { $::yacati::contact(s_activity) == -1 } { ::yalog::error "There's some nasty problem getSessionActivity returned -1" @@ -1381,51 +1381,49 @@ } ::yalog::debug "Open session activity: $yacati::contact(s_activity)" ::yalog::debug "Now i fill interface fields." - incr ::yacati::contact(tentativo) + incr ::yacati::contact(retry) set ::yacati::nome_usato 0 ::yacati::configureWdj ctel1 state normal ::yacati::configureWdj ctel2 state normal - if { $::yacati::contact(tel_disabled1) == 1 } { + if { $::yacati::contact(dis_phone1) == 1 } { ::yacati::configureWdj ctel1 state disabled ::yacati::configureWdj tel1 disabledbackground black } - if { $::yacati::contact(tel_disabled2) == 1 } { + if { $::yacati::contact(dis_phone2) == 1 } { ::yacati::configureWdj ctel2 state disabled ::yacati::configureWdj tel2 disabledbackground black } - if { $::yacati::contact(tel_attivo) == "" } { + if { $::yacati::contact(active_phone) == "" } { set ::yacati::CkTel 1 } else { - set ::yacati::CkTel $yacati::contact(tel_attivo) + set ::yacati::CkTel $yacati::contact(active_phone) } ::yacati::setWdjValue company_name $yacati::contact(name) disabled - ::yacati::setWdjValue tel1 [string trim $yacati::contact(tel1)] disabled - ::yacati::setWdjValue tel2 [string trim $yacati::contact(tel2)] disabled - ::yacati::setWdjValue tel3 [string trim $yacati::contact(tel3)] normal - ::yacati::setWdjValue tel4 [string trim $yacati::contact(tel4)] normal + ::yacati::setWdjValue tel1 [string trim $yacati::contact(phone1)] disabled + ::yacati::setWdjValue tel2 [string trim $yacati::contact(phone2)] disabled + ::yacati::setWdjValue tel3 [string trim $yacati::contact(phone3)] normal + ::yacati::setWdjValue tel4 [string trim $yacati::contact(phone4)] normal - if {[string length [string trim $yacati::contact(tel2)]]==0} {[::yacati::getWdj ctel2] configure -state disabled } - if {[string length [string trim $yacati::contact(tel3)]]==0} {[::yacati::getWdj ctel3] configure -state disabled } - if {[string length [string trim $yacati::contact(tel4)]]==0} {[::yacati::getWdj ctel4] configure -state disabled } + if {[string length [string trim $yacati::contact(phone2)]]==0} {[::yacati::getWdj ctel2] configure -state disabled } + if {[string length [string trim $yacati::contact(phone3)]]==0} {[::yacati::getWdj ctel3] configure -state disabled } + if {[string length [string trim $yacati::contact(phone4)]]==0} {[::yacati::getWdj ctel4] configure -state disabled } - yacati::setWdjValue fax $yacati::contact(fax) normal - - yacati::setWdjValue num_int $yacati::contact(id) disabled - - yacati::setWdjValue retry $yacati::contact(tentativo) disabled + ::yacati::setWdjValue fax $yacati::contact(fax) normal + ::yacati::setWdjValue num_int $yacati::contact(rid) disabled + ::yacati::setWdjValue retry $yacati::contact(retry) disabled - if { $survey(azienda) == "t" } { - yacati::setWdjValue ref $yacati::contact(referente) normal + if { $survey(listed) == "t" } { + yacati::setWdjValue ref $yacati::contact(reference) normal } - if { $yacati::contact(mailAddr) != "" } { + if { $yacati::contact(email_addr) != "" } { set email $yacati::contact(mailAddr) } else { set email "" } @@ -1438,18 +1436,18 @@ yacati::configureWdj bt_replay state normal; yacati::configureWdj bt_email state normal; - if {$yacati::contact(tentativo)<$survey(tentativi)} { + if {$yacati::contact(retry)<$survey(max_retry)} { yacati::configureWdj bt_appointment state normal;} - if {$yacati::contact(tentativo)<$survey(tentativi) && $survey(azienda) == "t" } { + if {$yacati::contact(retry)<$survey(max_retry) && $survey(listed) == "t" } { yacati::configureWdj bt_fax state normal;} - set contact(note) [string trimright $yacati::contact(note)] - set lenStory [string length $yacati::contact(note)] + set contact(note) [string trimright $yacati::contact(history)] + set lenStory [string length $yacati::contact(history)] - set noteDisplay $yacati::contact(note) + set noteDisplay $yacati::contact(history) yacati::setWdjValue contact_state $noteDisplay disabled - yacati::setWdjValue note $yacati::contact(note2) normal + yacati::setWdjValue note $yacati::contact(note) normal if { [lindex [[yacati::getWdj contact_state] xview] 1] < 1 } { [yacati::getWdj contact_state] xview scroll 100 unit @@ -1457,7 +1455,7 @@ yacati::setWdjValue cod_com $yacati::contact(com_display) disabled yacati::configureWdj msg text $yacati::contact(str_msg) - yacati::configureWdj sugg2 text $yacati::contact(msg_q) + yacati::configureWdj sugg2 text $yacati::contact(label) set yacati::app_preso 0; set yacati::stato_fax 0; @@ -1499,11 +1497,11 @@ return [list err -3] } - set contact(note) [string trim $contact(note)] - set contact(note) "$contact(note) $contact(tentativo) [lindex $survey(statox) $ouid]\(tel$edata(active_phone),$user_name\) " + set contact(note) [string trim $contact(history)] + set contact(note) "$contact(note) $contact(retry) [lindex $survey(statox) $ouid]\(tel$edata(active_phone),$user_name\) " set lenNote [string length $contact(note)] if { $lenNote > 300 } { - set contact(note) [string range $contact(note) [expr {$lenNote - 300}] end] + set contact(note) [string range $contact(history) [expr {$lenNote - 300}] end] } set edata(note) $contact(note) @@ -1616,7 +1614,7 @@ ::yacati::setWdjValue voip_static [mc "idle"] disabled set ::yavoip::status [mc "idle"] } - if {$yacati::survey(azienda)=="t"} {::yacati::incWdjState disabled} else {::yacati::popWdjState disabled} + if {$yacati::survey(listed)=="t"} {::yacati::incWdjState disabled} else {::yacati::popWdjState disabled} set yacati::call 0 yacati::setWdjText bt_new [mc "New contact"] normal set yacati::nome_usato 1 @@ -2115,13 +2113,13 @@ proc ::yacati::callBack {db pj start stop com contact_a} { package require Iwidgets - set ::yacati::cb_male 0 - set ::yacati::cb_female 0 - set ::yacati::cb_proj $pj - set ::yacati::cb_myStart $start - set ::yacati::cb_myStop $stop - set ::yacati::cb_myCom $com - set ::yacati::cb_myDb $db + set ::yacati::bc_male 0 + set ::yacati::bc_female 0 + set ::yacati::bc_proj $pj + set ::yacati::bc_myStart $start + set ::yacati::bc_myStop $stop + set ::yacati::bc_myCom $com + set ::yacati::bc_myDb $db array set ::yacati::bc_myData [list] array set contact $contact_a @@ -2271,13 +2269,13 @@ set bounded 0 #MOVE SQL to a proper place - pg_select $::yacati::bc_myDb "select idt from log.tupjs where proj=$::yacati::bc_proj and giorno='$date_setted'::date" rec { - if { ("$rec(idturno)" == "") } { + pg_select $::yacati::bc_myDb "select idt from projects.tupjs where proj=$::yacati::bc_proj and day='$date_setted'::date" rec { + if { $rec(idt) eq "" } { set bounded 0 break } - set sql_bound "select tstart,tend from turns where idt=$rec(idt)" + set sql_bound "select tstart,tend from projects.turns where idt=$rec(idt)" set res [yadb::getTuple $::yacati::bc_myDb $sql_bound 0] set i [lindex $res 0] set f [lindex $res 1] Modified: trunk/yadmin.tcl =================================================================== --- trunk/yadmin.tcl 2006-04-05 17:25:31 UTC (rev 623) +++ trunk/yadmin.tcl 2006-04-05 17:28:15 UTC (rev 624) @@ -81,6 +81,9 @@ puts [::cmdline::usage $opts $usage] } +#load sample namespace +::sample::init + set parg [list "p.arg" "" [mc "project's id"]] set oarg [list "c.arg" "/etc/yaacs/yaacs.conf" [mc "config file"]] set larg [list "l.arg" "" [mc "log level"]] @@ -2285,11 +2288,11 @@ if {$idPj == ""} { - set createPj [admin::newUpPj 0 $db $name $desc $duration $wtime \ + set createPj [::admin::newUpPj 0 $db $name $desc $duration $wtime \ $isActive $is4company $fax $mail $invite $nint \ $samplet $soglia $pausep $freqm "" $url] } else { - set createPj [admin::newUpPj 1 $db $name $desc $duration $wtime \ + set createPj [::admin::newUpPj 1 $db $name $desc $duration $wtime \ $isActive $is4company $fax $mail $invite $nint \ $samplet $soglia $pausep $freqm "" $url $passedIdPj] } @@ -2962,8 +2965,6 @@ set sampleRes -2 - ::sample::init - if {$sampleType == $::sample::COD_PROV_CAPOLUO} { set sampleRes [::sample::codProvCapoluo $db $idPj $mult] } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |