X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.main.git;a=blobdiff_plain;f=pctb%2Fdictionary-manager;h=aab8b66d097703ffc7f1474d20fd9abc83576879;hp=b6f87a6c856b0259508b2fd5098d3af3d1a7fe14;hb=e1678818393f23b138a4ef8c7c247de8cb97d741;hpb=3d80a86a8c77e29a26e70aa810ebb2dea607208e diff --git a/pctb/dictionary-manager b/pctb/dictionary-manager index b6f87a6..aab8b66 100755 --- a/pctb/dictionary-manager +++ b/pctb/dictionary-manager @@ -25,6 +25,10 @@ # sponsored by Three Rings. +# ./dictionary-manager --approve-updates ijackson@login.chiark.greenend.org.uk /home/ijackson/things/ypp-sc-tools.pctb-dict-test/pctb /home/ftp/users/ijackson/pctb/test +# ./dictionary-manager --approve-updates ijackson@login.chiark.greenend.org.uk /home/ijackson/things/ypp-sc-tools.pctb-dict/pctb /home/ftp/users/ijackson/pctb + + # invocation: # OUT OF DATE # run this without args @@ -270,6 +274,11 @@ proc required/char {} { startup_cursor } +proc approve_showentry_xinfo/char {w def} { + set unic [string2unicodenames $def] + label $w -text $unic +} + #========== PIXMAPS ========== #---------- pixmap database read and write ---------- @@ -402,6 +411,10 @@ proc required/pixmap {} { } } +proc approve_showentry_xinfo/pixmap {w def} { + label $w -image image/empty +} + #========== UPLOADS TO DICTIONARY SERVER ========== proc upload_init {} { @@ -484,7 +497,7 @@ proc maybe_upload_entry {im def} { set query [eval ::http::formatQuery $pl] regsub -all {%0d} $query {} query - debug "DB-UPDATE QUERY [string range $query 0 200]..." + debug "DB-UPDATE QUERY $query" if {[regexp {^\.?/} $url]} { set cmd [list $url $query] @@ -912,14 +925,7 @@ proc remote-serv/take {yesno file dict} { must_gets_exactly stdin confirmed - if {![string compare pixmap $dict]} { - set reqkind pixmap - debug "DICT PIXMAP" - } elseif {[regexp {^(char)([1-9]\d*)$} $dict dummy reqkind rows]} { - debug "DICT CHAR rqk=$reqkind r=$rows." - } else { - error "$dict ?" - } + manyset [dict2_reqkind_rows reqkind rows] if {$yesno} { read_database $dictdir/master-$dict.txt @@ -980,6 +986,18 @@ proc regsub-data {exp subspec args} { } } +proc dict2_reqkind_rows {dict} { + if {![string compare pixmap $dict]} { + return {pixmap {}} + debug "DICT PIXMAP" + } elseif {[regexp {^(char)([1-9]\d*)$} $dict dummy reqkind rows]} { + debug "DICT CHAR rqk=$reqkind r=$rows." + return [list $reqkind rows] + } else { + error "$dict ?" + } +} + proc chop_counted {var} { upvar 1 $var val global data @@ -1014,8 +1032,18 @@ proc approve_compare {fd1 fd2} { return [string compare $sv1 $sv2] } +proc string2unicodenames {str} { + return [exec perl -e { + use Unicode::CharName qw(uname); + $ARGV[0] =~ s/^ //; + foreach $_ (split //,$ARGV[0]) { + print uname(ord),"\n" or die $! + } + } " $str"] +} + proc approve_showentry {ix file specdata} { - global approve_ixes + global approve_ixes reqkind approve_decompose_data $specdata @@ -1039,11 +1067,19 @@ proc approve_showentry {ix file specdata} { image create photo approve/$ix -data $ppm label $wb-image -image approve/$ix -bd 2 -relief sunken + manyset [dict2_reqkind_rows $dict] reqkind + approve_showentry_xinfo/$reqkind $wb-xinfo $def + + if {$ix} { + label $wb-div -bd 1 -relief sunken -image image/empty + grid configure $wb-div -columnspan 5 -sticky ew -padx 5 + } + frame $wb-act button $wb-act.rej -text Reject -command [list approve_reject $ix] pack $wb-act.rej - grid $wb-def $wb-image $wb-act $wb-inf -padx 3 + grid $wb-def $wb-image $wb-xinfo $wb-act $wb-inf -padx 3 grid configure $wb-image -ipadx 3 -ipady 3 -sticky w lappend approve_ixes $ix @@ -1112,14 +1148,18 @@ proc main/approve {} { if {[llength $argv] != 3} { error "wrong # args" } manyset $argv userhost directory dictdir + debug "APPROVER FOR $userhost $directory $dictdir" + set cmd [list tclsh $directory/dictionary-manager] if {$debug} { lappend cmd --debug-server } lappend cmd --remote-server-1 $directory $dictdir switch -glob $userhost { {} { } {* *} { set cmd $userhost } - * { set cmd [append [list ssh $userhost] $cmd] } + * { set cmd [concat [list ssh $userhost] $cmd] } } + debug "APPROVER RUNS $cmd" + lappend cmd 2>@ stderr set server [open |$cmd r+] must_gets_exactly_server $remoteserv_banner @@ -1135,6 +1175,8 @@ proc main/approve {} { pack .right -side right pack .ok -side bottom + image create bitmap image/empty + set approve_page 0 approve_fetch_list }