Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
huang 2016-05-16 11:14:12 +08:00
commit 9088d11fed
11 changed files with 55 additions and 39 deletions

View File

@ -123,7 +123,9 @@ class StudentWorkController < ApplicationController
#-1 默认值 0全部正确并结束 2 超时 -2 编译错误
resultObj[:status] = -1
resultObj[:results] = result["results"].first #本次测试结果
result["error_msg"] = result["error_msg"][0..2047]
if result["status"].to_i == -2 #编译错误
result["error_msg"] = result["error_msg"][0..2047]
end
resultObj[:error_msg] = result["error_msg"] #编译错误时的信息
#该状态用于存入CodeTests

View File

@ -2618,9 +2618,6 @@ class UsersController < ApplicationController
# 获取我的资源
def get_my_resources author_id, user_course_ids, user_project_ids, order, score
unless author_id.to_i.to_s == author_id
author_id = User.find_by_login(author_id).id
end
attachments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('OrgSubfield','Principal','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
@ -2628,7 +2625,6 @@ class UsersController < ApplicationController
# 获取我的资源查询结果
def get_my_resources_search (author_id, user_course_ids, user_project_ids, order, score, search)
author_id = User.find_by_login(author_id).id
@attachments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)" ,:p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
@ -2636,7 +2632,6 @@ class UsersController < ApplicationController
# 获取我的课程资源
def get_course_resources author_id, user_course_ids, order, score
author_id = User.find_by_login(author_id).id
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})
and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
@ -2644,7 +2639,6 @@ class UsersController < ApplicationController
# 获取我的课程资源中搜索结果
def get_course_resources_search author_id, user_course_ids, order, score, search
author_id = User.find_by_login(author_id).id
attchments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})
and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
@ -2662,7 +2656,6 @@ class UsersController < ApplicationController
# 获取我的项目资源
def get_project_resources author_id, user_project_ids, order, score
author_id = User.find_by_login(author_id).id
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Project') "+
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')})
and is_publish = 1 and container_id is not null)").order("#{order.nil? ? 'created_on' : order} #{score}")
@ -2670,7 +2663,6 @@ class UsersController < ApplicationController
# 获取我的项目资源搜索
def get_project_resources_search author_id, user_project_ids, order, score, search
author_id = User.find_by_login(author_id).id
attchments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Project') "+
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')})
and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
@ -2688,14 +2680,12 @@ class UsersController < ApplicationController
# 获取我上传的附件
def get_attch_resources author_id, order, score
author_id = User.find_by_login(author_id).id
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
'Document','Message','News','StudentWorkScore','HomewCommon'))").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我上传的附件搜索结果
def get_attch_resources_search author_id, order, score, search
author_id = User.find_by_login(author_id).id
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
'Document','Message','News','StudentWorkScore','HomewCommon')) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
@ -2714,13 +2704,11 @@ class UsersController < ApplicationController
# 获取我的用户类型资源
def get_principal_resources author_id, order, score
author_id = User.find_by_login(author_id).id
attchments = Attachment.where("author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal'").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源搜索
def get_principal_resources_search author_id, order, score, search
author_id = User.find_by_login(author_id).id
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end

View File

@ -166,7 +166,7 @@ class WechatsController < ActionController::Base
raise "非法操作, code不存在" unless params[:code]
openid = get_openid_from_code(params[:code])
raise "无法获取到openid" unless openid
raise "此微信号已绑定用户, 不能复绑定" if user_binded?(openid)
raise "此微信号已绑定用户, 不能复绑定" if user_binded?(openid)
user, last_login_on = User.try_to_login(params[:username], params[:password])
raise "用户名或密码错误,请重新登录" unless user

View File

@ -34,13 +34,6 @@ module ApplicationHelper
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
def user_path(resource, parameters = {})
if Fixnum === resource
resource = User.find(resource)
end
super
end
# def user_blogs_path(resource,parameters={})
# super
# end

View File

@ -1103,9 +1103,6 @@ class User < Principal
# super
end
def to_param
login
end
# Salts all existing unsalted passwords
# It changes password storage scheme from SHA1(password) to SHA1(salt + SHA1(password))
# This method is used in the SaltPasswords migration and is to be kept as is

View File

@ -36,7 +36,7 @@
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_' name="new_form[course_message]"></textarea>
<p nhname='contentmsg_'></p>
<a id="new_message_cancel_btn_" href="javascript:void(0)" class="grey_btn fr mt10">取消</a>
<a href="javascript:void(0);" class="blue_btn fr ml10 mt10" id="new_message_submit_btn_" >留言</a>
<a href="javascript:void(0);" class="blue_btn fr ml10 mt10" id="submit_feedback_course" >留言</a>
<% end %>
</div>
<% end %>
@ -55,6 +55,9 @@
<script type="text/javascript">
$(function(){
$("#submit_feedback_course").one('click',function() {
$("#course_feedback_new").submit();
});
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
@ -65,7 +68,6 @@
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.submit_btn = $("input[nhname='submit_btn']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
params.height = 55;
if(params.textarea.data('init') == undefined){
@ -74,9 +76,6 @@
params.cancel_btn.click(function(){
nh_reset_form(params);
});
params.submit_btn.one('click', function () {
params.form.submit();
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);

View File

@ -12,8 +12,8 @@
<%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %>
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<input nhname="submit_btn" type="button" class="reply_btn" value="<%=l(:button_feedback_respond) %>"/>
<%#= submit_tag l(:button_feedback_respond), :name => nil ,
<!--<input nhname="submit_btn" type="button" class="reply_btn" value="<%#=l(:button_feedback_respond) %>"/>-->
<%= submit_tag l(:button_feedback_respond), :name => nil ,
:class => "reply_btn"%>
<input nhname="cancel_btn" type="button" style="display:none;"/>
<% end %>

View File

@ -53,6 +53,11 @@ module RedmineApp
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
#disable [deprecated] I18n.enforce_available_locales will default to true in the future.
# If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false
# to avoid this message.
#I18n.config.enforce_available_locales = false
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]

View File

@ -0,0 +1,18 @@
class DeleteEmptyApplyHomework < ActiveRecord::Migration
def up
count = ApplyHomework.all.count / 30 + 2
transaction do
for i in 1 ... count do i
ApplyHomework.page(i).per(30).each do |ah|
homework = HomeworkCommon.where("id = ?",ah.homework_common_id)
if homework.empty?
ah.destroy
end
end
end
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160511055221) do
ActiveRecord::Schema.define(:version => 20160513120002) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1107,6 +1107,23 @@ ActiveRecord::Schema.define(:version => 20160511055221) do
t.integer "viewed_count", :default => 0
end
create_table "mess", :id => false, :force => true do |t|
t.string "课程名"
t.integer "课程ID", :default => 0, :null => false
t.string "教师姓", :default => "", :null => false
t.string "教师名", :limit => 30, :default => "", :null => false
t.string "主贴名", :default => "", :null => false
t.integer "主贴或回帖ID", :default => 0, :null => false
t.integer "回帖对应主贴ID"
t.integer "帖子点赞数"
t.integer "主贴回复数", :default => 0, :null => false
t.text "主贴或回帖内容"
t.datetime "发帖时间", :null => false
t.integer "发帖或回帖用户ID", :default => 0, :null => false
t.string "发帖或回帖用户姓", :default => "", :null => false
t.string "发帖或回帖用户名", :limit => 30, :default => "", :null => false
end
create_table "message_alls", :force => true do |t|
t.integer "user_id"
t.integer "message_id"
@ -1328,6 +1345,7 @@ ActiveRecord::Schema.define(:version => 20160511055221) do
t.boolean "allow_guest_download", :default => true
t.integer "visits", :default => 0
t.integer "show_mode", :default => 0
t.integer "allow_teacher", :default => 0
end
create_table "phone_app_versions", :force => true do |t|
@ -2043,6 +2061,7 @@ ActiveRecord::Schema.define(:version => 20160511055221) do
t.string "salt", :limit => 64
t.integer "gid"
t.integer "visits", :default => 0
t.integer "excellent_teacher", :default => 0
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"

View File

@ -49,9 +49,6 @@ function nh_check_field(params){
if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
params.submit_btn.one('click', function(){
params.form.submit();
});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
@ -71,9 +68,7 @@ function init_form(params){
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea,
submit_btn:params.submit_btn,
form:params.form
textarea:params.textarea
});
if(is_checked){
if(flag){
@ -120,7 +115,7 @@ function init_KindEditor_data(id){
params.cancel_btn.click(function () {
nh_reset_form(params);
});
params.submit_btn.one('click', function () {
params.submit_btn.click(function () {
params.form.submit();
});
params.textarea.data('init', 1);