系统冲突

This commit is contained in:
txz 2016-05-19 13:47:08 +08:00
commit 278ee66368
54 changed files with 342 additions and 167 deletions

View File

@ -1 +0,0 @@
{"access_token":"bFlabz0uBcoIBfWL7nBJkgpl26aOWDy-dyCOvH_MjUo_hMOOKG83WV1cCL1MG6H-AE-6eMI0iyLoOoAMv9Y3pFFsLYD-GAGr3UH9fT8OqeHMDlFhXyRTvHv9l2QPHGpcARUcCGANEH","expires_in":7200,"got_token_at":1462934760}

View File

@ -79,7 +79,7 @@ class OrgDocumentCommentsController < ApplicationController
def add_reply
@document = OrgDocumentComment.find(params[:id]).root
@act = OrgActivity.find(params[:id])
@act = OrgActivity.find(params[:act_id])
@comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id])
@comment.content = params[:org_content]
@document.children << @comment

View File

@ -164,6 +164,7 @@ class OrganizationsController < ApplicationController
return
end
q = params[:search].nil? ? "" : "#{params[:search].strip}"
@field = OrgSubfield.find(params[:org_subfield_id])
@type = params[:type]
if @type == "courses" || @type.nil?
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count

View File

@ -27,8 +27,10 @@ class SsosController < ApplicationController
## 加入组织
@organization = Organization.find(82)
unless @organization.org_members.exists?(user_id: sso.user_id)
member = OrgMember.new(:user_id => sso.user_id)
member = OrgMember.create(:user_id => sso.user_id, :created_at => Time.now)
# member = OrgMember.new(:user_id => sso.user_id)
@organization.org_members << member
OrgMemberRole.create(:org_member_id => member.id, :role_id => 12)
end
## 选择性跳转
@ -55,10 +57,7 @@ class SsosController < ApplicationController
end
def parse(auth)
crypted_str = Base64.decode64(base64_safe(auth))
pkey = OpenSSL::PKey::RSA.new(File.new(File.join(Rails.root,"config/private.key")))
content = pkey.private_decrypt(crypted_str,OpenSSL::PKey::RSA::PKCS1_PADDING)
# content = pkey.private_decrypt(crypted_str)
content = decrypt(auth)
ActiveSupport::JSON.decode(content)
end
@ -68,4 +67,20 @@ class SsosController < ApplicationController
sso
end
def decrypt(auth)
crypted_str = Base64.decode64(base64_safe(auth))
pkey = OpenSSL::PKey::RSA.new(File.new(File.join(Rails.root,"config/private.key")))
#to large
max_dec_len = 1024/8
size = (crypted_str.size + max_dec_len-1) / max_dec_len
content = ''
size.times do |time|
tmps = crypted_str[time*max_dec_len, max_dec_len]
content += pkey.private_decrypt(tmps,OpenSSL::PKey::RSA::PKCS1_PADDING)
end
content
end
end

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
@ -500,6 +502,7 @@ class StudentWorkController < ApplicationController
render_403
return
end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name).count
end
@score = @b_sort == "desc" ? "asc" : "desc"

View File

@ -509,7 +509,7 @@ class UsersController < ApplicationController
def choose_user_course
homework = HomeworkCommon.find params[:send_id].to_i
if homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course)
if homework.user != User.current && homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course)
ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:send_id].to_i)
if ah.empty?
@status = 2
@ -630,9 +630,9 @@ class UsersController < ApplicationController
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
elsif params[:type] == "2" #我的题库
courses = @user.courses.where("is_delete = 0")
courses = @user.courses.where("is_delete = 1")
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and course_id in #{course_ids}").order("#{@order} #{@b_sort}")
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and course_id not in #{course_ids}").order("#{@order} #{@b_sort}")
elsif params[:type] == "3" #申请题库
none_visible_course = Course.where("is_delete = 1")
none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")"
@ -672,7 +672,7 @@ class UsersController < ApplicationController
def show_homework_detail
homework = HomeworkCommon.find params[:homework].to_i
if homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course)
if homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course) && User.current != homework.user
ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:homework].to_i)
if ah.empty?
@status = 2
@ -719,15 +719,15 @@ class UsersController < ApplicationController
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and homework_type in #{type_ids} and (name like '%#{search}%' or user_id in #{user_ids})").order("#{@order} #{@b_sort}")
end
elsif params[:type] == "2" #我的题库
courses = @user.courses.where("is_delete = 0")
courses = @user.courses.where("is_delete = 1")
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
if @order == "course_name"
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_commons.course_id in #{course_ids} and homework_commons.user_id = #{@user.id} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_commons.course_id not in #{course_ids} and homework_commons.user_id = #{@user.id} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
@homeworks = HomeworkCommon.find_by_sql(sql)
elsif @order == "user_name"
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id in #{course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
else
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id in #{course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%') and homework_type in #{type_ids}").order("#{@order} #{@b_sort}")
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%') and homework_type in #{type_ids}").order("#{@order} #{@b_sort}")
end
elsif params[:type] == "3" #申请题库
apply_homeworks = ApplyHomework.where("user_id = ?",@user.id)
@ -2780,13 +2780,13 @@ class UsersController < ApplicationController
# 导入资源
def import_resources
# 别人的资源库是没有权限去看的
if User.current.id.to_i != params[:id].to_i
@user = User.find_by_login(params[:id])
if User.current != @user
render_403
return
end
@resource_id = params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id]
@resource_type = params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"
@user = User.find(params[:id])
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@score = @b_sort == "desc" ? "asc" : "desc"
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}

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
@ -95,11 +88,13 @@ module ApplicationHelper
# 获取组织成员中文名字
def get_org_member_role_name member
case member.roles[0].name
when 'orgManager'
'管理人员'
when 'orgMember'
'组织成员'
unless member.roles[0].nil?
case member.roles[0].name
when 'orgManager'
'管理人员'
when 'orgMember'
'组织成员'
end
end
end
@ -3094,6 +3089,10 @@ def host_with_protocol
return Setting.protocol + "://" + Setting.host_name
end
def secdomain_with_protocol secdomain
return Setting.protocol + "://" + secdomain + ".trustie.net"
end
#获取回复的所有父节点
def get_reply_parents parents_rely, comment

View File

@ -183,7 +183,8 @@ module OrganizationsHelper
end
def excellent_teachers
User.where("excellent_teacher =?",true).first(5)
User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and u.excellent_teacher =1 order by course_count desc").first(5)
end
end

View File

@ -29,8 +29,8 @@ class HomeworkCommon < ActiveRecord::Base
:description => :description,
:author => :author,
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
after_create :act_as_activity, :send_mail, :act_as_course_message
after_update :update_activity, :wechat_message
after_create :act_as_activity, :send_mail
after_update :update_activity
after_save :act_as_course_activity
after_destroy :delete_kindeditor_assets
@ -60,11 +60,11 @@ class HomeworkCommon < ActiveRecord::Base
self.course.members.each do |m|
# if m.user_id != self.user_id
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0
ws = WechatService.new
ws.homework_template(m.user_id, "homework", self.id, "#{l(:label_new_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59")
end
#count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
#if count == 0
# ws = WechatService.new
# ws.homework_template(m.user_id, "homework", self.id, "#{l(:label_new_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59")
#end
# end
end
end

View File

@ -262,7 +262,7 @@ class Issue < ActiveRecord::Base
# set default values for new records only
self.status ||= IssueStatus.default
self.priority ||= IssuePriority.default
self.watcher_user_ids = []
# self.watcher_user_ids = []
end
end

View File

@ -30,4 +30,8 @@ class Organization < ActiveRecord::Base
def allow_set_teachers
self.allow_teacher.to_i == 1 ? true : false
end
def secdomain_name
Secdomain.where("sub_type=2 and pid=?", self.id).first.try(:subname)
end
end

View File

@ -1,3 +1,7 @@
#coding=utf-8
require 'base64'
class Sso < ActiveRecord::Base
belongs_to :user
attr_accessible :email, :name, :openid, :password, :school, :sex, :user, :user_id

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

@ -87,10 +87,19 @@
var standard_ans = $.trim($("#question_standard_ans").val());
if(title.length == 0 || score.length == 0){
alert("题目标题/分数不能为空");
doc.one('click', function(){
add_poll_question($(this),quest_type);
});
}else if(!/^[1-9][0-9]*$/.test(score)) {
alert("分数必须是非零开头的数字");
doc.one('click', function(){
add_poll_question($(this),quest_type);
});
}else if(quest_type !=3 && standard_ans.length == 0) {
alert("标准答案不能为空");
doc.one('click', function(){
add_poll_question($(this),quest_type);
});
}else{
doc.parent().parent().parent().submit();}
}

View File

@ -54,9 +54,16 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),1);"> 保存 </a>
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question"> 保存 </a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<script type="text/javascript">
$(function(){
$("#add_new_question").one('click', function(){
add_poll_question($(this),1);
});
});
</script>

View File

@ -54,9 +54,16 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),2);"> 保存 </a>
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question"> 保存 </a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<script type="text/javascript">
$(function(){
$("#add_new_question").one('click', function(){
add_poll_question($(this),2);
});
});
</script>

View File

@ -42,9 +42,16 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),3);"> 保存 </a>
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question"> 保存 </a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<script type="text/javascript">
$(function(){
$("#add_new_question").one('click', function(){
add_poll_question($(this),3);
});
});
</script>

View File

@ -90,7 +90,7 @@
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),1);">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
'保存'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
@ -102,6 +102,9 @@
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this),1);
});
}
}
else {

View File

@ -89,7 +89,7 @@
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),2);">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
'保存'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
@ -101,6 +101,9 @@
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this),2);
});
}
}else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");

View File

@ -65,7 +65,7 @@
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),3);">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
'保存'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
@ -77,6 +77,9 @@
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this),3);
});
}
} else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");

View File

@ -46,7 +46,7 @@
scrollPic.speed = 10; //移动速度(单位毫秒,越小越快)
scrollPic.space = 10; //每次移动像素(单位px越大越快)
scrollPic.autoPlay = true; //自动播放
scrollPic.autoPlay = false; //自动播放
scrollPic.autoPlayTime = 3; //自动播放间隔时间(秒)
scrollPic.initialize(); //初始化
@ -60,13 +60,12 @@
<!--内容开始-->
<header>
<div class="sn-header">
<%= render :partial => 'organizations/org_logined_header' %>
<div class="sn-row sn-bg-white">
<div class="sn-logo">
<% if @org_logo_attchment.blank? %>
<img src="/images/org_new_style/logo.jpg" width="367" height="63" class="sn-mt13" alt=""/>
<% if @org_logo_attchment.blank? || !User.current.logged? %>
<img src="/images/org_new_style/logo.jpg" width="367" height="63" class="sn-mt13 sn-fl" alt=""/>
<% else %>
<img src="/attachments/<%= @org_logo_attchment.id %>/<%= @org_logo_attchment.filename %>" width="367" height="63" class="sn-mt13" alt="">
<img src="/attachments/<%= @org_logo_attchment.id %>/<%= @org_logo_attchment.filename %>" width="367" height="63" class="sn-mt13 sn-fl" alt="">
<% end %>
<% if User.current.admin_of_org?(@organization) %>
<a href="#" class="sn-logo-add" title="点击替换LOGO" onclick="org_new_files_upload();"></a>
@ -74,6 +73,7 @@
<!--<a href="javascript:void(0);" class="sn-search-button sn-mt28"></a>-->
<!--<input type="text" class="sn-search-input sn-mt28" placeholder="搜索" />-->
<%= render :partial => 'organizations/org_logined_header' %>
</div>
</div>
<!--导航-->

View File

@ -1,2 +1,2 @@
$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document,:flag => params[:flag], :act => @act}) %>");
$("#organization_document_<%= @document.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document,:flag => params[:flag], :act => @act}) %>");
sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>");

View File

@ -210,9 +210,9 @@
<div class="mr10 mb10 mt10 fl w100 fontGrey2" style="text-align: center;">
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_url_in_org(project.id),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_url_in_org(project.id),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
<% end %>
<% com_time = project.project_score.commit_time %>
<% time=project.updated_on %>

View File

@ -102,7 +102,7 @@
<% end %>
<% else %>
<% if field.field_type == "Comptec" %>
<%= link_to "#{field.name}", teachers_organization_path(organization), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% else %>
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% end %>

View File

@ -1,37 +1,31 @@
<% if User.current.logged? %>
<div class="sn-row sn-bg-grey">
<div class="sn-login2">
<div class="navHomepageProfile sn-mt4" id="navHomepageProfile">
<ul>
<li class="homepageProfileMenuIcon fr" id="homepageProfileMenuIcon">
<%= link_to "<div class='mt5 mb8 user-img' id='user_avatar'>#{image_tag(url_to_avatar(User.current), :class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe, user_activities_path(User.current.id) %>
<%#= link_to image_tag(url_to_avatar(User.current)), user_url_in_org(User.current.id), :alt => '用户头像', :target => '_blank', :class => "fr user-img" %>
<ul class="topnav_login_list none sn-f12" id="topnav_login_list" style="text-align:left;">
<li>
<%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
</li>
<li>
<%= link_to "我的组织", user_organizations_user_path(:id => User.current.id), :class => "menuGrey"%>
</li>
<li>
<%= link_to "新建组织", new_organization_path, :class => "menuGrey"%>
</li>
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
<li>
<%= link_to "退出", logout_url_without_domain, :class => "menuGrey", :method => "post"%>
</li>
</ul>
<div class="navHomepageProfile" id="navHomepageProfile">
<ul>
<li class="homepageProfileMenuIcon fr sn-mt23" id="homepageProfileMenuIcon">
<%= link_to "<div class='user-img' id='user_avatar'>#{image_tag(url_to_avatar(User.current), :class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe, user_activities_path(User.current.id) %>
<%#= link_to image_tag(url_to_avatar(User.current)), user_url_in_org(User.current.id), :alt => '用户头像', :target => '_blank', :class => "fr user-img" %>
<ul class="topnav_login_list none sn-f12" id="topnav_login_list" style="text-align:left;">
<li>
<%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
</li>
<li>
<%= link_to "我的组织", user_organizations_user_path(:id => User.current.id), :class => "menuGrey"%>
</li>
<li>
<%= link_to "新建组织", new_organization_path, :class => "menuGrey"%>
</li>
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
<li>
<%= link_to "退出", logout_url_without_domain, :class => "menuGrey", :method => "post"%>
</li>
</ul>
</div>
</div>
</li>
</ul>
</div>
<% else %>
<div class="sn-row sn-bg-grey">
<div class="sn-login">
<a href="<%= signin_url_without_domain %>" class="sn-link-blue">登录</a>&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="<%= register_url_without_domain %>" class="sn-link-blue">注册</a>
</div>
<div class="sn-fr">
<a href="<%= signin_url_without_domain %>" class="sn-link-blue">登录</a>&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="<%= register_url_without_domain %>" class="sn-link-blue">注册</a>
</div>
<% end %>

View File

@ -1,4 +1,3 @@
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
@ -26,7 +25,7 @@
<div class="sn-news-txt">
<div class="sn-news-wrap"><%= activity.description.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", activity.name.to_s, student_work_index_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
<div class="sn-read-more"><%=link_to "查看全文>>", student_work_index_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
@ -44,7 +43,7 @@
<div class="sn-news-txt">
<div class="sn-news-wrap"><%= activity.content.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", activity.parent_id.nil? ? activity.subject.to_s.html_safe : activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
<div class="sn-read-more"><%=link_to "查看全文>>", board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
@ -63,7 +62,7 @@
<div class="sn-news-wrap"><%= activity.description.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", activity.title.to_s, news_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
<div class="sn-read-more"><%=link_to "查看全文>>", news_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% elsif act.org_act_type == "Poll" %>
<% activity = Poll.find(act.org_act_id) %>
@ -88,7 +87,7 @@
<div class="sn-news-txt">
<div class="sn-news-wrap"><%= activity.polls_description.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
<div class="sn-read-more"><%=link_to "查看全文>>", Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% end %>
<% end %>
@ -119,7 +118,7 @@
<div class="sn-news-txt">
<div class="sn-news-wrap"><%= activity.description.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", activity.subject.to_s, issue_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
<div class="sn-read-more"><%=link_to "查看全文>>", issue_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
@ -137,7 +136,7 @@
<div class="sn-news-txt">
<div class="sn-news-wrap"><%= activity.content.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", activity.parent_id.nil? ? activity.subject.to_s.html_safe : activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
<div class="sn-read-more"><%=link_to "查看全文>>", board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
@ -217,7 +216,7 @@
<div class="sn-news-txt">
<div class="sn-news-wrap"><%= content.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", message.parent_id.nil? ? message.subject.to_s.html_safe : message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
<div class="sn-read-more"><%=link_to "查看全文>>", board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% else %>
<div class="sn-news-bigbox fl">
@ -239,9 +238,9 @@
</div>
<div class="sn-read-more">
<% if message.parent_id.nil? %>
<%=link_to "查看全文>>", message.subject.to_s.html_safe, board_message_path(message.board,message), :target => "_blank", :class => "sn-link-grey2 sn-fr" %>
<%=link_to "查看全文>>", board_message_path(message.board,message), :target => "_blank", :class => "sn-link-grey2 sn-fr" %>
<% else %>
<%=link_to "查看全文>>", message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :target => "_blank", :class => "sn-link-grey2 sn-fr" %>
<%=link_to "查看全文>>", board_message_path(message.board,activity), :target => "_blank", :class => "sn-link-grey2 sn-fr" %>
<% end %>
</div>
</div>
@ -263,7 +262,7 @@
<div class="sn-news-txt">
<div class="sn-news-wrap"><%= news.description.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", news.title.to_s, news_path(news), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
<div class="sn-read-more"><%=link_to "查看全文>>", news_path(news), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% end %>
<% end %>

View File

@ -1,11 +1,11 @@
<% unless excellent_teachers.count == 0 %>
<div class="sn-teacher-wrap" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title sn-mb5"><%= field.name %>
<%= link_to "更多", teachers_organization_path(@organization, :type => "famous"), :target => "_blank", :class => "more" %>
<%= link_to "更多", teachers_organization_path(@organization, :type => "famous", :org_subfield_id => field.id), :target => "_blank", :class => "more" %>
</h2>
<% excellent_teachers.each do |teacher| %>
<div class="sn-teacher-list">
<%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sn-fl", :style => "display:block;"), user_path(teacher), :alt => "用户头像", :target => '_blank' %>
<%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sn-fl sn-avatar-circle", :style => "display:block;"), user_path(teacher), :alt => "用户头像", :target => '_blank' %>
<!--<a href="javascript:void(0);" target="_blank"><img src="images/avatar_default.png" width="60" height="60" style="display:block;" class="sn-fl" /></a>-->
<div class="sn-teacher-info">
<%=link_to teacher.try(:realname) ? teacher.try(:realname) :teacher.try(:login), user_path(teacher), :class => "sn-teacher-name sn-hidden", :title => '', :target => '_blank' %></a>

View File

@ -92,7 +92,7 @@
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkGrey fr ml5 mr5" %>
<span class="fr">|</span>
<a href="javascript:void(0);" class="linkGrey fr ml5 mr5" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a>
<% unless field.field_type == "Resource" %>
<% unless field.field_type == "Resource" || field.field_type == "Comptec" %>
<span class="fr">|</span>
<!--escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (Setting.cross_project_issue_relations? ? 'all' : nil)-->
<!--<a href="javascript:void(0);" class="linkGrey fr mr5" onclick="org_submain_new('<%#= escape_javascript new_org_subfield_sub_domain_path(:org_subfield_id => field.id, :field => field) %>');">添加二级目录</a>-->

View File

@ -109,9 +109,14 @@
<div class="fr orgMemContainer">
<div class="orgMemberAdd">
<p class="fontBlue fb mb5">添加成员</p>
<%= form_tag url_for(:controller => 'org_member',:action => 'create',:org=>@organization),:id=>'org_member_add_form',:remote=>true do |f|%>
<%= form_tag url_for(:controller => 'org_member', :action => 'create', :org => @organization),:id=>'org_member_add_form',:remote=>true do |f|%>
<input type="text" id="not_org_member_search" name="orgAddSearch" placeholder="支持姓名、邮箱、登录名搜索" class="orgAddSearch mb20" />
<%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript host_with_protocol + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
<%# if @organization.secdomain_name.nil? %>
<%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript host_with_protocol + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
<%# else %>
<%#= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript secdomain_with_protocol(@organization.secdomain_name) + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
<%# end %>
<div id="principals_for_new_member">
<%= find_user_not_in_current_org_by_name(@project) %>
</div>

View File

@ -1,3 +1,12 @@
<div class="homepageRightBanner">
<div class="f16 fontGrey3">
<% if @type == "famous" %>
名师列表
<% else %>
<%= @field.name %>
<% end %>
</div>
</div>
<div class="resources mt10">
<div class="function-row" id="org_teacher_search">
<%= form_tag( url_for(:controller => 'organizations', :action => 'teachers', :type => @type),
@ -15,7 +24,7 @@
<!--<option value="3">资源数</option>-->
<!--</select>-->
<div class="sn-font-grey fr">
<%= link_to "名师列表", teachers_organization_path(@organization, :type => "famous"), :class => "fontGrey" %>
<%= link_to "名师列表", teachers_organization_path(@organization, :type => "famous", :org_subfield_id => @field.id), :class => "fontGrey2" %>
</div>
<div class="cl"></div>
</div>

View File

@ -5,7 +5,7 @@
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="1"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题标题"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入单选题标题"/>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label>必答</label>
</div>
@ -35,7 +35,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
@ -45,4 +45,11 @@
<div class="cl"></div>
</div>
<!--编辑单选 end-->
<% end%>
<% end%>
<script type="text/javascript">
$(function(){
$("#add_new_question_new").one('click', function(){
add_poll_question_new($(this));
});
});
</script>

View File

@ -3,7 +3,7 @@
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="2"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题标题"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入多选题标题"/>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label>必答</label>
</div>
@ -33,7 +33,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
@ -42,4 +42,11 @@
</div>
<div class="cl"></div>
</div>
<% end%><!--编辑多选 end-->
<% end%><!--编辑多选 end-->
<script type="text/javascript">
$(function(){
$("#add_new_question_new").one('click', function(){
add_poll_question_new($(this));
});
});
</script>

View File

@ -3,7 +3,7 @@
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="4"/>
<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观标题"/>
<input maxlength="250" id="poll_questions_title_new" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观标题"/>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label>必答</label>
</div>
@ -13,7 +13,7 @@
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
</div>
<div class="ur_editor_footer">
<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
<a class="btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
@ -22,4 +22,11 @@
</div>
<div class="cl"></div>
</div><!--编辑多行文字end-->
<% end%>
<% end%>
<script type="text/javascript">
$(function(){
$("#add_new_question_new").one('click', function(){
add_poll_question_new($(this));
});
});
</script>

View File

@ -3,12 +3,12 @@
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="3"/>
<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观标题"/>
<input maxlength="250" id="poll_questions_title_new" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观标题"/>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label for="ur_question_require">必答</label>
</div>
<div class="ur_editor_footer">
<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
<a class="btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
@ -17,4 +17,11 @@
</div>
<div class="cl"></div>
</div><!--编辑单行文字end-->
<% end%>
<% end%>
<script type="text/javascript">
$(function(){
$("#add_new_question_new").one('click', function(){
add_poll_question_new($(this));
});
});
</script>

View File

@ -51,8 +51,8 @@ function chooseQuestionType(quest_type,quest_id){
}
function add_MC(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
$("#poll_questions_title").focus();
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_MC') %>");
$("#poll_questions_title_new").focus();
}
function insert_MC(quest_type,quest_num,quest_id){
@ -94,7 +94,7 @@ function add_MC(){
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
@ -106,11 +106,14 @@ function add_MC(){
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
}
function add_MCQ(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
$("#poll_questions_title").focus();
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
$("#poll_questions_title_new").focus();
}
function insert_MCQ(quest_type,quest_num,quest_id){
@ -152,7 +155,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
@ -164,11 +167,14 @@ function insert_MCQ(quest_type,quest_num,quest_id){
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
}
function add_single(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>");
$("#poll_questions_title").focus();
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_single') %>");
$("#poll_questions_title_new").focus();
}
function insert_SINGLE(quest_type,quest_num,quest_id){
@ -185,7 +191,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
'<label for="ur_question_require">必答</label>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<a class="btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
@ -197,10 +203,13 @@ function insert_MCQ(quest_type,quest_num,quest_id){
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
}
function add_mulit(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
$("#poll_questions_title").focus();
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
$("#poll_questions_title_new").focus();
}
function insert_MULIT(quest_type,quest_num,quest_id){
@ -219,7 +228,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
'<div class="ur_editor_toolbar">'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<a class="btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
@ -231,6 +240,9 @@ function insert_MCQ(quest_type,quest_num,quest_id){
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
}
//选择导入调查问卷
@ -262,8 +274,28 @@ function insert_MCQ(quest_type,quest_num,quest_id){
function add_poll_question(doc)
{
var title = $.trim($("#poll_questions_title").val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
if(title.length == 0){
alert("标题不能为空");
doc.one('click', function(){
add_poll_question($(this));
});
}else{
doc.parent().parent().parent().submit();
}
}
function add_poll_question_new(doc)
{
var title = $.trim($("#poll_questions_title_new").val());
if(title.length == 0){
alert("标题不能为空");
doc.one('click', function(){
add_poll_question($(this));
});
}else{
doc.parent().parent().parent().submit();
}
}
//修改标题时确定按钮
function edit_poll_question(doc,id)
{
@ -373,7 +405,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
</div><!--选项 end-->
<!-- 新增问题 -->
<div id="new_poll_question">
<div id="new_poll_question_new">
</div>
<div class="ur_buttons">

View File

@ -1,7 +1,7 @@
<% if @is_insert %>
$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>');
<% else %>
$("#new_poll_question").html("");
$("#new_poll_question_new").html("");
$("#poll_content").append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +

View File

@ -1,7 +1,7 @@
<%= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
<div class="project_r_h">
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
<a href="javascript:void(0);" class="btn_zipdown fr" >ZIP下载</a>
<!--<a href="javascript:void(0);" class="btn_zipdown fr" onclick="">ZIP下载</a>-->
</div>
<div class="repository_con" style="line-height:1.9;">

View File

@ -7,7 +7,7 @@
<% if @homework.homework_type != 3 %>
<!--<span class="c_dark f14 fb fl mr50">姓名</span>-->
<li class="<%=@homework.anonymous_comment == 1 ? 'hworkList100' : 'hworkList60'%> hworkH30 mr10">
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml18" ,:remote => true%>
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl #{@homework.anonymous_comment == 1 ? 'ml35' : 'ml18'}" ,:remote => true%>
<% if @show_all && @order == "lastname"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%>
<% end%>

View File

@ -216,9 +216,9 @@
<div class="mr10 mb10 mt10 fl w100 fontGrey2" style="text-align: center;">
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
<% end %>
<% com_time = project.project_score.commit_time %>
<% time=project.updated_on %>

View File

@ -37,7 +37,8 @@
<li class="subject-list-publisher fl hidden"><%= homework.user.show_name %></li>
<li class="subject-list-count fl" id="subject_count_homework_<%=homework.id %>"><%= homework.quotes %></li>
<li class="fl subject-list-date"><%=format_date homework.publish_time %></li>
<% if homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course) %> <li class="fl subject-list-option" id="homework_apply_status_<%=homework.id %>">
<% if homework.user != User.current && (homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course)) %>
<li class="fl subject-list-option" id="homework_apply_status_<%=homework.id %>">
<% ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, homework.id).first %>
<% if ah.nil? %>
<%= link_to("请求分享", apply_homework_user_path(User.current.id,:homework_id => homework.id), :class => 'green_btn_share c_white', :remote => true) %>

View File

@ -219,9 +219,9 @@
<div class="mr10 mb10 mt10 fl w100 fontGrey2" style="text-align: center;">
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像" %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像" %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %>
<% end %>
<% com_time = project.project_score.commit_time %>
<% time=project.updated_on %>

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,8 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160513021204) do
ActiveRecord::Schema.define(:version => 20160513120002) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1107,6 +1108,23 @@ ActiveRecord::Schema.define(:version => 20160513021204) 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"

View File

@ -416,9 +416,11 @@ function uploadpic(piclist,myself) {
that.attr("src", str[tIndex]);
that.attr("data-ke-src", str[tIndex]);
//复制过来带的链接class等都要去掉 和视频图片有关系
that.removeAttr("class");
that.parent().removeAttr("class");
that.parent().removeAttr("href");
that.parents().removeAttr("href"); //删除所有父节点的href
// that.parent().removeAttr("href");
that.parent().removeAttr("data-ke-src");
tIndex = tIndex + 1;
}

View File

@ -1039,15 +1039,19 @@ function showNormalImage(id) {
var image=$(description_images[i]);
var _path = getRootPath();
//如果图片是视频图片,不处理。
if($(image).hasClass("mediaIco")){
var _src = _path+"/"+$(image).attr('src');
$(image).attr('src',_src);
return;
}
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
$(image).parent().colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
//无格式的图片不让点击显示大图,显示的话会有问题
var tmpsrc = image.attr('src');
if (tmpsrc.indexOf('.gif') >= 0 || tmpsrc.indexOf('.jpg') >= 0 || tmpsrc.indexOf('.jpeg') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.bmp') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.BMP') >= 0 || tmpsrc.indexOf('.JPEG') >= 0 || tmpsrc.indexOf('.JPG') >= 0 || tmpsrc.indexOf('.PNG') >= 0 || tmpsrc.indexOf('.GIF') >= 0) {
var element = $("<a></a>").attr("href", image.attr('src'));
image.wrap(element);
$(image).parent().colorbox({rel: 'nofollow', close: "关闭", returnFocus: false});
}
}
//$('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); //有图片才将链接变为弹出框
}

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);

View File

@ -1247,7 +1247,8 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
.hworkPrName {width:160px; max-width:160px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.mr150 {margin-right:150px;}
.relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;}
.captainName {max-width:75px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}
.captainName {max-width:65px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}
.relatePImage {display:block; margin:0 auto;}
/*上传资源弹窗*/
.resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;}

View File

@ -1410,13 +1410,15 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
.proHelp {background:url(/images/course/hwork_icon.png) -5px -124px no-repeat; display:inline-block; width:15px; height:15px; display:inline-block;}
.hworkPrName {width:110px; max-width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;}
.mr150 {margin-right:150px;}
.captainName {max-width:75px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}
.captainName {max-width:65px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}
/* @功能 定义 */
span.at {color:#269ac9;}
span.at a{color:#269ac9;text-decoration: none;}
.relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;}
.relatePImage {display:block; margin:0 auto;}
/*问题状态图片*/
.issues{ background:url(../images/public_icon.png) -66px 5px no-repeat; width:18px; height:21px;}
.duty{ background:url(../images/public_icon.png) -66px -18px no-repeat; width:18px; height:21px;}

View File

@ -122,7 +122,7 @@ div.flash {margin-top :0px !important}
.w80{ width:80px;}
.relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;}
.captainName {max-width:40px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}
.captainName {max-width:65px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}
.researchBox { width:240px; height:24px; border:1px solid #dddddd; color:#666666; outline:none;}
.blueBtn{ width:60px; height:26px; color:#FFF; border:none; background-color:#269ac9; cursor:pointer; padding-left:0px; text-align:center;}
.blueBtn:hover {background-color:#298fbd;}

View File

@ -47,6 +47,7 @@ a.sn-link-select {color:#809df9;}
.sn-mt10 {margin-top:10px;}
.sn-mt13 {margin-top:13px;}
.sn-mt15 {margin-top:15px;}
.sn-mt23 {margin-top:23px;}
.sn-mt28 {margin-top:28px;}
.sn-mb20 {margin-bottom:20px;}
.sn-mb40 {margin-bottom:40px;}
@ -65,7 +66,6 @@ a.sn-link-select {color:#809df9;}
.sn-bg-white {background-color:#fff;}
.sn-bg-blue {background-color:#24366e;}
.sn-login {width:1200px; height:45px; line-height:45px; margin:0 auto; font-size:14px; color:#24366e; vertical-align:middle; text-align:right;}
.sn-login2 {width:1200px; height:54px; line-height:54px; margin:0 auto; font-size:14px; color:#24366e; vertical-align:middle; text-align:right;}
.sn-logo {width:1200px; height:90px; line-height:90px; margin:0 auto; vertical-align:middle;position:relative;}
.sn-search-input {width:328px; height:40px; font-size:16px; color:#ccc; padding-left:10px; border:1px solid #ccc; border-right:none; float:right; background-color:#fff; outline:none;}
a.sn-search-button {width:53px; height:40px; border:1px solid #ccc; border-left:none; float:right; outline:none; background:url(../images/sn_search_icon.jpg) 0 3px no-repeat;}
@ -241,8 +241,8 @@ ul.sn-inner-pages li a:hover{ background-color:#24366e; color:#fff; text-decorat
/*名师榜*/
.sn-teacher-list {margin:0 20px; padding:15px 0; border-bottom:1px solid #e9e9e9;}
a.sn-teacher-name {width:75px; font-size:18px; color:#777; float:left;}
.sn-teacher-unit {width:154px; font-size:14px; color:#999; float:left; margin-left:15px; margin-top:3px;}
a.sn-teacher-name {width:60px; font-size:18px; color:#777; float:left;}
.sn-teacher-unit {width:169px; font-size:14px; color:#999; float:left; margin-left:15px; margin-top:3px;}
.sn-teacher-info {height:30px; line-height:30px; vertical-align:middle; float:left; margin-left:15px;}
.sn-teacher-social {height:30px; line-height:30px; vertical-align:middle; float:left; color:#999; font-size:12px; margin-left:15px;}
.sn-border-none {border:none;}
@ -250,6 +250,7 @@ a.sn-teacher-name {width:75px; font-size:18px; color:#777; float:left;}
.sn-teacher-avatar2 {margin:0 18px; padding:18px 0;}
.sn-teacher-info2 {color:#666; text-align:center; font-size:16px;}
.sn-info2-hidden {width:153px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin:0 auto;}
.sn-avatar-circle {border-radius:50%;}
/*弹框*/
.upload_con h2 {