Masato Taruishi
taru****@users*****
2004年 9月 21日 (火) 17:56:01 JST
=================================================================== RCS file: projects/yubin/gui/yubin.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- projects/yubin/gui/yubin.rb 2004/09/21 06:34:26 1.5 +++ projects/yubin/gui/yubin.rb 2004/09/21 08:56:01 1.6 @@ -39,11 +39,12 @@ end def create( filter ) - puts "ldapsearch -LLL -x -h #{@host} -b #{@base} #{filter}" if $DEBUG + $stderr.puts "ldapsearch -LLL -x -h #{@host} -b #{@base} #{filter}" if $DEBUG open("|ldapsearch -LLL -x -h #{@host} -b #{@base} #{filter}") { |io| postalCode = nil postalAddress = nil each_entry(io) do |entry| + $stderr.puts entry if $DEBUG each_attr(entry) do |attr| case attr when /^o::(.*)$/ @@ -84,11 +85,18 @@ def on_filterentry_changed key = @widgets["filterentry"].text.delete("-") - if key != "" + filter = nil + case key + when /[0-9\-]+/ + filter = "postalCode=#{key}*" if key.size > 1 + else + filter = "st=*#{key}*" if key.size > 3 + end + if ! filter.nil? visible = {} - filter = "postalCode=#{key}*" @postalfactory.create(filter) do |code, addr| - puts "#{code}: #{addr}" if $DEBUG + $stderr.puts "#{code}: #{addr}" if $DEBUG + $stderr.puts "postalCode not found for #{addr}" if code.nil? if @row[addr].nil? @row[addr] = [ @list.append, code ] end