diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index aae33e52a..f9b5b7d32 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -162,7 +162,7 @@ class MessagesController < ApplicationController
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
@topic.children << @reply
user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first
- user_activity.updated_at = @reply.created_on
+ user_activity.updated_at = Time.now
user_activity.save
#@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record?
diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb
index 693ddba65..2e680d6ea 100644
--- a/app/views/homework_common/index.html.erb
+++ b/app/views/homework_common/index.html.erb
@@ -78,11 +78,7 @@
<%= l('userscore.skill.tramples')%> * (-2) = <%= option_num.tread %> * (-2) = <%= option_num.tread * (-2) %>
<%= l('userscore.skill.like.level1')%> * 4 = <%= option_num.praise_by_one %> * 4 = <%= option_num.praise_by_one * 4 %>
<%= l('userscore.skill.like.level2')%> * 6 = <%= option_num.praise_by_two %> * 6 = <%= option_num.praise_by_two * 6 %>
diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb
index 5ba83401c..366473b52 100644
--- a/app/views/users/_course_homework.html.erb
+++ b/app/views/users/_course_homework.html.erb
@@ -36,11 +36,7 @@
<% if activity.homework_type == 2%>
语言:
- <% if activity.homework_detail_programing.language.to_i == 1%>
- C
- <% elsif activity.homework_detail_programing.language.to_i == 2%>
- C++
- <% end%>
+ <%= activity.language_name%>
<% end %>
diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb
index e7addad97..6bc03e33d 100644
--- a/app/views/users/_user_homework_list.html.erb
+++ b/app/views/users/_user_homework_list.html.erb
@@ -34,11 +34,7 @@
<% if homework_common.homework_type == 2%>
语言:
- <% if homework_common.homework_detail_programing.language.to_i == 1%>
- C
- <% elsif homework_common.homework_detail_programing.language.to_i == 2%>
- C++
- <% end%>
+ <%= homework_common.language_name%>
<% end %>
diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb
index 19a971ece..c8998fd55 100644
--- a/app/views/users/new_user_commit_homework.html.erb
+++ b/app/views/users/new_user_commit_homework.html.erb
@@ -1,6 +1,8 @@
<% content_for :header_tags do %>
- <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
+ <%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
<%= javascript_include_tag 'homework','baiduTemplate' %>
+ <%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
+
<% end %>
@@ -75,6 +77,7 @@
请使用 <%= @homework.language_name %> 语言编写
+ style="display-hidden" id="data-language">
<%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %>
diff --git a/app/views/users/user_system_messages.html.erb b/app/views/users/user_system_messages.html.erb
index 3b8bd9fb6..899cd7a8f 100644
--- a/app/views/users/user_system_messages.html.erb
+++ b/app/views/users/user_system_messages.html.erb
@@ -43,9 +43,11 @@
<%= system_message.subject.nil? ? "系统消息" : system_message.subject %>
-
- <%= system_message.content.nil? ? system_message.description.html_safe : system_message.content.html_safe %>
-
+
+
+ <%= system_message.content.nil? ? system_message.description.html_safe : system_message.content.html_safe %>
+
+
截止时间:<%= format_time(system_message.created_at) %>
diff --git a/config/configuration.yml b/config/configuration.yml
index 87a54a976..ef39f6493 100644
--- a/config/configuration.yml
+++ b/config/configuration.yml
@@ -103,7 +103,7 @@ default:
# autologin_cookie_name: the name of the cookie (default: autologin)
# autologin_cookie_path: the cookie path (default: /)
# autologin_cookie_secure: true sets the cookie secure flag (default: false)
- autologin_cookie_name:
+ autologin_cookie_name: "autologin_trustie"
autologin_cookie_path:
autologin_cookie_secure:
@@ -197,11 +197,17 @@ default:
#max_concurrent_ajax_uploads: 2
#pic_types: "bmp,jpeg,jpg,png,gif"
+ repository_root_path: '/tmp/htdocs'
+ judge_server: 'http://judge.trustie.net/'
+
# specific configuration options for production environment
# that overrides the default ones
production:
# CJK support
rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf
+ judge_server: 'http://192.168.80.21:8080/'
+ repository_root_path: '/home/pdl/redmine-2.3.2-0/apache2/htdocs'
+ cookie_domain: ".trustie.net"
email_delivery:
delivery_method: :smtp
smtp_settings:
diff --git a/db/schema.rb b/db/schema.rb
index 43357f44f..1c6760345 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20150918005722) do
+ActiveRecord::Schema.define(:version => 20150918134804) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -572,6 +572,7 @@ ActiveRecord::Schema.define(:version => 20150918005722) do
t.integer "viewed"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.string "secret_key"
end
create_table "forums", :force => true do |t|
@@ -683,6 +684,7 @@ ActiveRecord::Schema.define(:version => 20150918005722) do
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.string "mail"
end
create_table "issue_categories", :force => true do |t|
@@ -1304,9 +1306,9 @@ ActiveRecord::Schema.define(:version => 20150918005722) do
create_table "student_work_tests", :force => true do |t|
t.integer "student_work_id"
- t.integer "status"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "status", :default => 9
t.text "results"
t.text "src"
end
@@ -1359,8 +1361,10 @@ ActiveRecord::Schema.define(:version => 20150918005722) do
create_table "system_messages", :force => true do |t|
t.integer "user_id"
t.string "content"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.text "description"
+ t.string "subject"
end
create_table "taggings", :force => true do |t|
@@ -1552,7 +1556,6 @@ ActiveRecord::Schema.define(:version => 20150918005722) do
t.string "identity_url"
t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64
- t.integer "gid"
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
diff --git a/public/assets/codemirror/clike.js b/public/assets/codemirror/clike.js
new file mode 100644
index 000000000..e13b79c14
--- /dev/null
+++ b/public/assets/codemirror/clike.js
@@ -0,0 +1,604 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode("clike", function(config, parserConfig) {
+ var indentUnit = config.indentUnit,
+ statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
+ dontAlignCalls = parserConfig.dontAlignCalls,
+ keywords = parserConfig.keywords || {},
+ types = parserConfig.types || {},
+ builtin = parserConfig.builtin || {},
+ blockKeywords = parserConfig.blockKeywords || {},
+ defKeywords = parserConfig.defKeywords || {},
+ atoms = parserConfig.atoms || {},
+ hooks = parserConfig.hooks || {},
+ multiLineStrings = parserConfig.multiLineStrings,
+ indentStatements = parserConfig.indentStatements !== false,
+ indentSwitch = parserConfig.indentSwitch !== false,
+ namespaceSeparator = parserConfig.namespaceSeparator;
+ var isOperatorChar = /[+\-*&%=<>!?|\/]/;
+
+ var curPunc, isDefKeyword;
+
+ function tokenBase(stream, state) {
+ var ch = stream.next();
+ if (hooks[ch]) {
+ var result = hooks[ch](stream, state);
+ if (result !== false) return result;
+ }
+ if (ch == '"' || ch == "'") {
+ state.tokenize = tokenString(ch);
+ return state.tokenize(stream, state);
+ }
+ if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
+ curPunc = ch;
+ return null;
+ }
+ if (/\d/.test(ch)) {
+ stream.eatWhile(/[\w\.]/);
+ return "number";
+ }
+ if (ch == "/") {
+ if (stream.eat("*")) {
+ state.tokenize = tokenComment;
+ return tokenComment(stream, state);
+ }
+ if (stream.eat("/")) {
+ stream.skipToEnd();
+ return "comment";
+ }
+ }
+ if (isOperatorChar.test(ch)) {
+ stream.eatWhile(isOperatorChar);
+ return "operator";
+ }
+ stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+ if (namespaceSeparator) while (stream.match(namespaceSeparator))
+ stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+
+ var cur = stream.current();
+ if (keywords.propertyIsEnumerable(cur)) {
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+ if (defKeywords.propertyIsEnumerable(cur)) isDefKeyword = true;
+ return "keyword";
+ }
+ if (types.propertyIsEnumerable(cur)) return "variable-3";
+ if (builtin.propertyIsEnumerable(cur)) {
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+ return "builtin";
+ }
+ if (atoms.propertyIsEnumerable(cur)) return "atom";
+ return "variable";
+ }
+
+ function tokenString(quote) {
+ return function(stream, state) {
+ var escaped = false, next, end = false;
+ while ((next = stream.next()) != null) {
+ if (next == quote && !escaped) {end = true; break;}
+ escaped = !escaped && next == "\\";
+ }
+ if (end || !(escaped || multiLineStrings))
+ state.tokenize = null;
+ return "string";
+ };
+ }
+
+ function tokenComment(stream, state) {
+ var maybeEnd = false, ch;
+ while (ch = stream.next()) {
+ if (ch == "/" && maybeEnd) {
+ state.tokenize = null;
+ break;
+ }
+ maybeEnd = (ch == "*");
+ }
+ return "comment";
+ }
+
+ function Context(indented, column, type, align, prev) {
+ this.indented = indented;
+ this.column = column;
+ this.type = type;
+ this.align = align;
+ this.prev = prev;
+ }
+ function isStatement(type) {
+ return type == "statement" || type == "switchstatement" || type == "namespace";
+ }
+ function pushContext(state, col, type) {
+ var indent = state.indented;
+ if (state.context && isStatement(state.context.type) && !isStatement(type))
+ indent = state.context.indented;
+ return state.context = new Context(indent, col, type, null, state.context);
+ }
+ function popContext(state) {
+ var t = state.context.type;
+ if (t == ")" || t == "]" || t == "}")
+ state.indented = state.context.indented;
+ return state.context = state.context.prev;
+ }
+
+ function typeBefore(stream, state) {
+ if (state.prevToken == "variable" || state.prevToken == "variable-3") return true;
+ if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, stream.start))) return true;
+ }
+
+ function isTopScope(context) {
+ for (;;) {
+ if (!context || context.type == "top") return true;
+ if (context.type == "}" && context.prev.type != "namespace") return false;
+ context = context.prev;
+ }
+ }
+
+ // Interface
+
+ return {
+ startState: function(basecolumn) {
+ return {
+ tokenize: null,
+ context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+ indented: 0,
+ startOfLine: true,
+ prevToken: null
+ };
+ },
+
+ token: function(stream, state) {
+ var ctx = state.context;
+ if (stream.sol()) {
+ if (ctx.align == null) ctx.align = false;
+ state.indented = stream.indentation();
+ state.startOfLine = true;
+ }
+ if (stream.eatSpace()) return null;
+ curPunc = isDefKeyword = null;
+ var style = (state.tokenize || tokenBase)(stream, state);
+ if (style == "comment" || style == "meta") return style;
+ if (ctx.align == null) ctx.align = true;
+
+ if ((curPunc == ";" || curPunc == ":" || curPunc == ","))
+ while (isStatement(state.context.type)) popContext(state);
+ else if (curPunc == "{") pushContext(state, stream.column(), "}");
+ else if (curPunc == "[") pushContext(state, stream.column(), "]");
+ else if (curPunc == "(") pushContext(state, stream.column(), ")");
+ else if (curPunc == "}") {
+ while (isStatement(ctx.type)) ctx = popContext(state);
+ if (ctx.type == "}") ctx = popContext(state);
+ while (isStatement(ctx.type)) ctx = popContext(state);
+ }
+ else if (curPunc == ctx.type) popContext(state);
+ else if (indentStatements &&
+ (((ctx.type == "}" || ctx.type == "top") && curPunc != ";") ||
+ (isStatement(ctx.type) && curPunc == "newstatement"))) {
+ var type = "statement";
+ if (curPunc == "newstatement" && indentSwitch && stream.current() == "switch")
+ type = "switchstatement";
+ else if (style == "keyword" && stream.current() == "namespace")
+ type = "namespace";
+ pushContext(state, stream.column(), type);
+ }
+
+ if (style == "variable" &&
+ ((state.prevToken == "def" ||
+ (parserConfig.typeFirstDefinitions && typeBefore(stream, state) &&
+ isTopScope(state.context) && stream.match(/^\s*\(/, false)))))
+ style = "def";
+
+ if (hooks.token) {
+ var result = hooks.token(stream, state, style);
+ if (result !== undefined) style = result;
+ }
+
+ if (style == "def" && parserConfig.styleDefs === false) style = "variable";
+
+ state.startOfLine = false;
+ state.prevToken = isDefKeyword ? "def" : style || curPunc;
+ return style;
+ },
+
+ indent: function(state, textAfter) {
+ if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
+ var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
+ if (isStatement(ctx.type) && firstChar == "}") ctx = ctx.prev;
+ var closing = firstChar == ctx.type;
+ var switchBlock = ctx.prev && ctx.prev.type == "switchstatement";
+ if (isStatement(ctx.type))
+ return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
+ if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
+ return ctx.column + (closing ? 0 : 1);
+ if (ctx.type == ")" && !closing)
+ return ctx.indented + statementIndentUnit;
+
+ return ctx.indented + (closing ? 0 : indentUnit) +
+ (!closing && switchBlock && !/^(?:case|default)\b/.test(textAfter) ? indentUnit : 0);
+ },
+
+ electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{\}?|\})$/ : /^\s*[{}]$/,
+ blockCommentStart: "/*",
+ blockCommentEnd: "*/",
+ lineComment: "//",
+ fold: "brace"
+ };
+});
+
+ function words(str) {
+ var obj = {}, words = str.split(" ");
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+ return obj;
+ }
+ var cKeywords = "auto if break case register continue return default do sizeof " +
+ "static else struct switch extern typedef float union for " +
+ "goto while enum const volatile";
+ var cTypes = "int long char short double float unsigned signed void size_t ptrdiff_t";
+
+ function cppHook(stream, state) {
+ if (!state.startOfLine) return false;
+ for (;;) {
+ if (stream.skipTo("\\")) {
+ stream.next();
+ if (stream.eol()) {
+ state.tokenize = cppHook;
+ break;
+ }
+ } else {
+ stream.skipToEnd();
+ state.tokenize = null;
+ break;
+ }
+ }
+ return "meta";
+ }
+
+ function pointerHook(_stream, state) {
+ if (state.prevToken == "variable-3") return "variable-3";
+ return false;
+ }
+
+ function cpp11StringHook(stream, state) {
+ stream.backUp(1);
+ // Raw strings.
+ if (stream.match(/(R|u8R|uR|UR|LR)/)) {
+ var match = stream.match(/"([^\s\\()]{0,16})\(/);
+ if (!match) {
+ return false;
+ }
+ state.cpp11RawStringDelim = match[1];
+ state.tokenize = tokenRawString;
+ return tokenRawString(stream, state);
+ }
+ // Unicode strings/chars.
+ if (stream.match(/(u8|u|U|L)/)) {
+ if (stream.match(/["']/, /* eat */ false)) {
+ return "string";
+ }
+ return false;
+ }
+ // Ignore this hook.
+ stream.next();
+ return false;
+ }
+
+ function cppLooksLikeConstructor(word) {
+ var lastTwo = /(\w+)::(\w+)$/.exec(word);
+ return lastTwo && lastTwo[1] == lastTwo[2];
+ }
+
+ // C#-style strings where "" escapes a quote.
+ function tokenAtString(stream, state) {
+ var next;
+ while ((next = stream.next()) != null) {
+ if (next == '"' && !stream.eat('"')) {
+ state.tokenize = null;
+ break;
+ }
+ }
+ return "string";
+ }
+
+ // C++11 raw string literal is