Internal Server Error

undefined method `to_a' for "# encoding: sjis\n#\n# Copyright (C) 2003-2005 Kouichirou Eto\n# All rights reserved.\n# This is free software with ABSOLUTELY NO WARRANTY.\n#\n# You can redistribute it and/or modify it under the terms of \n# the GNU General Public License version 2.\n#\n\n$LOAD_PATH << '..' unless $LOAD_PATH.include?('..')\n\nmodule Qwik\n class Action\n D_comment = {\n :dt => 'Comment plugin',\n :dd => 'You can show comment field.',\n :dc => \"\n* Multiline comment plugin\n{{mcomment}}\n {{mcomment}}\nYou can show a multi line comment field.\n {{mcomment(1)}}\nIf you specify (1) as the argment, the newest comment is placed on the top.\n* Hiki like comment plugin\n {{hcomment}}\n{{hcomment}}\nYou can show a comment field almost like Hiki's one.\nThe usage of this plugin is almost same as Hiki comment plugin.\n* Old comment plugin\n {{comment}}\n{{comment}}\nThis plugin is obsolete. Please use 'mcomment' plugin instead.\n\" }\n\n # http://colinux:9190/HelloQwik/ActMComment.html\n def plg_mcomment(style='0', cols='50', rows='4')\n # @mcomment_num is global for an action.\n @mcomment_num = 0 if !defined?(@mcomment_num)\n @mcomment_num += 1\n num = @mcomment_num\n style = style.to_i\n style = 0 if style != 1\n action = \"\#{@req.base}.\#{num}.\#{style}.mcomment\"\n\n content = ''\n content = yield if block_given?\n messages = []\n content.each {|line|\n\tline.chomp!\n\tdummy, date, user, msg = line.split('|', 4)\n\tdate = Time.at(date.to_i).ymd\n\tmsg ||= ''\n\tmsg.gsub!(/\\\\n/, \"\\n\")\n\tmm = []\n\tmsg.each {|m|\n\t mm << m\n\t mm << [:br]\n\t}\n\tmessages << [:div, {:class=>'msg'},\n\t [:dl, [:dt, [:span, {:class=>'date'}, date],\n\t [:span, {:class=>'user'}, user]], [:dd, *mm]]]\n }\n\n div = [:div, {:class=>'mcomment'}]\n div += messages if style == 0\n\n form = [:form, {:method=>'POST', :action=>action},\n\t[:p, _('Name'), ': ', [:input, {:name=>'u', :size=>'30'}]],\n\t[:p, _('Comment'), ': ',\n\t [:textarea, {:name=>'m', :cols=>cols, :rows=>rows}, '']],\n\t[:input, {:type=>'submit', :value=>_('Submit')}]]\n\n form = [:form, {:method=>'POST', :action=>action},\n\t[:table,\n\t [:tr,\n\t [:th, _('Name')],\n\t [:td, [:input, {:name=>'u', :size=>'30'}]]],\n\t [:tr,\n\t [:th, _('Comment')],\n\t [:td, [:textarea, {:name=>'m', :cols=>cols, :rows=>rows}, '']]],\n\t [:tr,\n\t [:th, ''],\n\t [:td, [:input, {:type=>'submit', :value=>_('Submit')}]]]]]\n\n div << form\n\n div += messages if style == 1\n return div\n end\n\n def ext_mcomment\n #c_require_login\t# Guest can also post comment.\n c_require_post\n c_require_page_exist\n\n date = @req.start_time.to_i\n\n num = @req.ext_args[0].to_i\n return c_nerror(_('Error')) if num < 1\n\n style = @req.ext_args[1].to_i\n style = 0 if style != 1\n\n user = @req.query['u']\n user = _('Anonymous') if user.nil? || user.empty?\n\n msg = @req.query['m']\n return c_nerror(_('No message')) if msg.nil? || msg.empty?\n msg = msg.normalize_newline\n msg.gsub!(\"\\n\", \"\\\\n\")\n\n comment = \"|\#{date}|\#{user}|\#{msg}\\n\"\n\n begin\n\tplugin_edit(:mcomment, num) {|content|\n\t if style == 0\n\t content += comment\n\t else\n\t content = comment + content\n\t end\n\t content\n\t}\n rescue NoCorrespondingPlugin\n\treturn c_nerror(_('Failed'))\n rescue PageCollisionError\n\treturn mcomment_error(_('Page collision detected.'))\n end\n\n c_make_log('mcomment')\t# COMMENT\n\n url = \"\#{@req.base}.html\"\n return c_notice(_('Add a comment.'), url){\n\t[[:h2, _('Message is added.')],\n\t [:p, [:a, {:href=>url}, _('Go back')]]]\n }\n end\n\n def mcomment_error(msg, url)\n\treturn c_nerror(msg){\n\t [[:h2, msg],\n\t [:p, msg],\n\t [:p, _('Go back and input again.')],\n\t [:dl,\n\t [:dt, _('Name')], [:dd, user],\n\t [:dt, _('Comment')], [:dd, msg],\n\t [:p, [:a, {:href=>url}, _('Go back')]]]]\n }\n end\n end\nend\n\nif $0 == __FILE__\n require 'qwik/test-common'\n $test = true\nend\n\nif defined?($test) && $test\n class TestActMcomment < Test::Unit::TestCase\n include TestSession\n\n def test_plg_mcomment\n ok_wi([:div, {:class=>'mcomment'},\n\t [:form, {:method=>'POST', :action=>'1.1.0.mcomment'},\n\t\t[:table,\n\t\t [:tr, [:th, 'Name'],\n\t\t [:td, [:input, {:size=>'30', :name=>'u'}]]],\n\t\t [:tr,\n\t\t [:th, 'Comment'],\n\t\t [:td, [:textarea,\n\t\t\t{:cols=>'50', :rows=>'4', :name=>'m'}, '']]],\n\t\t [:tr, [:th, ''],\n\t\t [:td, [:input, {:value=>'Submit', :type=>'submit'}]]]]]],\n\t \"{{mcomment}}\")\n ok_wi([:div, {:class=>'mcomment'},\n\t [:div, {:class=>'msg'},\n\t\t[:dl, [:dt,\n\t\t [:span, {:class=>'date'}, '1970-01-01'],\n\t\t [:span, {:class=>'user'}, 'u']],\n\t\t [:dd, 'm', [:br]]]],\n\t [:form, {:method=>'POST', :action=>'1.1.0.mcomment'},\n\t\t[:table,\n\t\t [:tr, [:th, 'Name'],\n\t\t [:td, [:input, {:size=>'30', :name=>'u'}]]],\n\t\t [:tr,[:th, 'Comment'],\n\t\t [:td, [:textarea,\n\t\t\t{:cols=>'50', :rows=>'4', :name=>'m'}, '']]],\n\t\t [:tr, [:th, ''],\n\t\t [:td, [:input, {:value=>'Submit', :type=>'submit'}]]]]]],\n\t \"{{mcomment\n|0|u|m\n}}\")\n ok_wi([:div, {:class=>'mcomment'},\n\t [:form, {:method=>'POST', :action=>'1.1.1.mcomment'},\n\t\t[:table,\n\t\t [:tr, [:th, 'Name'],\n\t\t [:td, [:input, {:size=>'30', :name=>'u'}]]],\n\t\t [:tr, [:th, 'Comment'],\n\t\t [:td, [:textarea,\n\t\t\t{:cols=>'50', :rows=>'4', :name=>'m'}, '']]],\n\t\t [:tr, [:th, ''],\n\t\t [:td, [:input, {:value=>'Submit', :type=>'submit'}]]]]],\n\t [:div, {:class=>'msg'},\n\t\t[:dl, [:dt,\n\t\t [:span, {:class=>'date'}, '1970-01-01'],\n\t\t [:span, {:class=>'user'}, 'u']],\n\t\t [:dd, 'm', [:br]]]]],\n\t \"{{mcomment(1)\n|0|u|m\n}}\")\n end\n\n def test_ext_mcomment\n t_add_user\n\n page = @site.create_new\n page.store(\"{{mcomment}}\\n\")\n res = session('POST /test/1.html')\n ok_xp([:div, {:class=>'mcomment'},\n\t [:form, {:method=>'POST', :action=>'1.1.0.mcomment'},\n\t\t[:table,\n\t\t [:tr, [:th, 'Name'],\n\t\t [:td, [:input, {:size=>'30', :name=>'u'}]]],\n\t\t [:tr, [:th, 'Comment'],\n\t\t [:td, [:textarea,\n\t\t\t{:cols=>'50', :rows=>'4', :name=>'m'}, '']]],\n\t\t [:tr, [:th, ''],\n\t\t [:td, [:input, {:value=>'Submit', :type=>'submit'}]]]]]],\n\t \"//div[@class='mcomment']\")\n\n res = session(\"POST /test/1.1.0.mcomment?u=u&m=m\")\n ok_eq(\"{{mcomment\n|0|u|m\n}}\n\", page.load)\n\n res = session(\"POST /test/1.1.0.mcomment?u=u2&m=m2\")\n ok_eq(\"{{mcomment\n|0|u|m\n|0|u2|m2\n}}\n\", page.load)\n\n page.store(\"{{mcomment(1)}}\n\")\n res = session(\"POST /test/1.1.1.mcomment?u=u&m=m\")\n ok_eq(\"{{mcomment(1)\n|0|u|m\n}}\n\", page.load)\n\n res = session(\"POST /test/1.1.1.mcomment?u=u2&m=m2\")\n ok_eq(\"{{mcomment(1)\n|0|u2|m2\n|0|u|m\n}}\n\", page.load)\n\n page.store(\"{{mcomment}}\n{{mcomment}}\n\")\n res = session(\"POST /test/1.1.0.mcomment?u=u&m=m\")\n ok_eq(\"{{mcomment\n|0|u|m\n}}\n{{mcomment}}\n\", page.load)\n\n res = session(\"POST /test/1.2.0.mcomment?u=u2&m=m2\")\n ok_eq(\"{{mcomment\n|0|u|m\n}}\n{{mcomment\n|0|u2|m2\n}}\n\", page.load)\n end\n\n def test_ext_mcomment2\n t_add_user\n\n page = @site.create_new\n page.store(\"{{mcomment}}\\n\")\n res = session(\"POST /test/1.1.0.mcomment?u=u&m=m\\n\")\n ok_eq('{{mcomment\n|0|u|m\\n\n}}\n', page.load)\n\n page.store(\"{{mcomment}}\\n\")\n res = session(\"POST /test/1.1.0.mcomment?u=u&m=m\\r\\n\")\n ok_eq('{{mcomment\n|0|u|m\\n\n}}\n', page.load)\n\n page.store(\"{{mcomment}}\\n\")\n res = session(\"POST /test/1.1.0.mcomment?u=u&m=m\\r\")\n ok_eq('{{mcomment\n|0|u|m\\n\n}}\n', page.load)\n\n page.store(\"{{mcomment}}\\n\")\n res = session(\"POST /test/1.1.0.mcomment?u=u&m=m\\n\\r\")\n ok_eq('{{mcomment\n|0|u|m\\n\\n\n}}\n', page.load)\n end\n end\nend\n":String ar = str.to_a[b, margin*2+1] ^^^^^ Did you mean? to_c to_f to_r to_i to_s
qwikWeb/0.8.1+20060201 at localhost:9190