OSDN Git Service

Adds sbgy without layout
[dianzhuhui/site.git] / hanMorph / app / views / sbgy / xiaoyun.html.erb
diff --git a/hanMorph/app/views/sbgy/xiaoyun.html.erb b/hanMorph/app/views/sbgy/xiaoyun.html.erb
new file mode 100644 (file)
index 0000000..4731044
--- /dev/null
@@ -0,0 +1,71 @@
+<% content_for :head do %>廣韻 小韻<% end %>
+
+<% require 'cgi' %>
+<% unihan_g = "http://www.unicode.org/cgi-bin/refglyph?24-" %>
+<% unihan_r = "http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=" %>
+<% def print_note(note)
+    doc = REXML::Document.new note
+    doc.elements.each("//original_text") do |original|
+      original.elements.each("//rewrite_text") do |rewrite|
+        if rewrite then
+          rtext = rewrite.text
+          relem = REXML::Element.new("font")
+          relem.add_attribute("color", "red")
+          relem.add_text(rtext)
+          original.parent.insert_after(original, relem)
+        end
+      end
+      otext = original.text
+      replace = REXML::Element.new("del")
+      replace.add_text(otext)
+      original.parent.replace_child(original, replace)
+    end
+    return doc.to_s
+  end
+%>
+<% unihan_g = "http://www.unicode.org/cgi-bin/refglyph?24-" %>
+<% unihan_r = "http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=" %>
+
+<p>
+  <% form_tag(:controller => "sbgy", :action => "xiaoyun", :method => "get") do %>
+  <%= link_to("Index", :controller => 'kanjidb', :action => "index") %>
+  <%= link_to("Show", :action => "show") %>
+  <!-- %= select_tag(:vol, '<option value="1">上平聲</option>
+      <option value="2">下平聲</option>
+      <option value="3">上聲</option>
+      <option value="4">去聲</option>
+      <option value="5">入聲</option>') % -->
+  <!--
+  <%= label_tag(:xiaoyun, "小韻:") %>
+  <%= text_field_tag(:xiaoyun, "", :size => "5") %>
+  -->
+    <%= label_tag(:fanqie, "反切:") %>
+    <%= text_field_tag(:fanqie, "", :size => "5") %>
+    <input name="id" type="hidden" />
+    <%= submit_tag("Search") %>
+  <% end %>
+</p>
+
+<% if @voice then %>
+  <p>
+    <p>
+      <%= link_to(@volume.name + @rhyme.name,
+          :action => "rhyme", :id => @rhyme.id) %>
+      <span style="font-size:150%">小韻「<%= @voice.name %>」</span>
+      <%= @voice.fanqie %>
+      <%= @voice.ipa %>
+    </p>
+    <% @wordheads.each do |wordhead| %>
+      <% point = wordhead.name.unpack("U")[0] %>
+      <%= link_to("<span style='font-size:180%'>" + wordhead.name + "</span>", :controller => "kanjidb", :action => "index", :char => wordhead.name) %>
+      <!--
+      <% unihan_glyph = format("%s%x", unihan_g, point) %>
+      <%= link_to("<img align='middle' src='" + unihan_glyph + "'/>",
+               :action => "index", :char => wordhead.name)%>
+      -->
+      <!-- %= wordhead.name % -->
+      <!-- %= print_note(wordhead.note) % -->
+      <%= wordhead.note %>
+    <% end %>
+  </p>
+<% end %>