module Simplebbs
module View
module Board
def footer(arg=nil,io='')
  io << "<hr>\n<p align=right>\n  Generated by "
  io << (h version).to_s
  io << "<br>\n  Powered by Ruby version "
  io << ( ::VERSION ).to_s
  io << "\n</p>\n"
  io
end
def form(arg=nil,io='')
  io << "<form method=\"POST\">\r\n  <input type=\"HIDDEN\" name=\"rm\" value=\"post\">\r\n  <table>\r\n    <tr>\r\n      <td>\245\277\245\244\245\310\245\353:</td>\r\n      <td><input type=\"text\" name=\"subject\" value=\""
  io << (h arg.subject).to_s
  io << "\" size=\"40\"></td>\r\n    </tr>\r\n    <tr>\r\n      <td>\314\276\301\260:</td>\r\n      <td>\r\n        <input type=\"text\" name=\"from\" value=\""
  io << (h arg.from).to_s
  io << "\" size=\"20\">\r\n        E-mail:<input type=\"text\" name=\"mail\" value=\""
  io << (h arg.mail).to_s
  io << "\" size=\"30\">\r\n      </td>\r\n    </tr>\r\n    <tr>\r\n      <td>\306\342\315\306:</td>\r\n      <td><textarea name=\"text\" cols=60 rows=10 wrap=\"off\">"
  io << (h arg.text).to_s
  io << "</textarea></td>\r\n    </tr>\r\n  </table>\r\n  <input type=\"submit\" value=\"\275\361\244\255\271\376\244\340\">\r\n</form>\r\n"
  io
end
def message(arg=nil,io='')
  io << "<p class=\"message\">\n"
  io << (arg.msg_id).to_s
  io << "\n<span class=\"subject\">"
  io << (h arg.subject ).to_s
  io << "</span>\nby "
 if arg.mail.empty? 
  io << "\n     "
  io << (h arg.name).to_s
  io << "\n   "
 else 
  io << "\n     <a href=\"mailto:"
  io << (h arg.mail).to_s
  io << "\">"
  io << (h arg.name).to_s
  io << "</a>\n   "
 end 
  io << "\non "
  io << (h arg.msgdate ).to_s
  io << "\n<br>\n<span class=\"text\">"
  io << (msg2html(arg.message) ).to_s
  io << "</span>\n</p>\n"
  io
end
def top(arg=nil,io='')
  io << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n<head>\n  <title>"
  io << (board_name).to_s
  io << "</title>\n  <meta http-equiv=\"content-type\" content=\"text/html; charset=EUC-JP\">\n  <meta name=\"author\" content=\"MoonWolf\">\n  <meta name=\"description\" content=\"simplebbs\">\n  <link rel=\"stylesheet\" type=\"text/css\" href=\"simplebbs.css\">\n</head>\n<body>\n<h1>"
  io << (board_name).to_s
  io << "</h1>\n<p>"
  io << (form(arg)).to_s
  io << "</p>\n"

  arg.msglist.each {|msg|
    message(msg, io)
  }
  if arg.id_to > 1

  io << "\n    <a href=\""
  io << (qs 'from'=>arg.id_to-1).to_s
  io << "\">\301\260\244\31620\267\357</a>\n"

  end

  io << "\n<hr width=\"100%\" size=\"2\">"
  io << (footer).to_s
  io << "<br>\n</body>\n</html>\n"
  io
end
end # Board
end # View
end # Simplebbs
