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

Conflicts:
	app/views/files/_org_subfield_list.html.erb
	db/schema.rb
This commit is contained in:
huang 2016-03-17 16:06:05 +08:00
commit 28cb1755d8
45 changed files with 3132 additions and 2669 deletions

View File

@ -91,8 +91,12 @@ class BlogCommentsController < ApplicationController
def edit
@article = BlogComment.find(params[:id])
if User.current.admin? || User.current.id == @article.author_id
respond_to do |format|
format.html {render :layout=>'new_base_user'}
format.html { render :layout => 'new_base_user' }
end
else
render_403
end
end

View File

@ -73,9 +73,11 @@ class HomeworkCommonController < ApplicationController
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
homework_detail_manual.comment_status = 1
end
homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? @homework.end_time + 7 : params[:evaluation_start]
homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end]
eval_start = homework_detail_manual.evaluation_start
if eval_start <= @homework.end_time && homework_detail_manual.comment_status <= 1
homework_detail_manual.evaluation_start = @homework.end_time + 7
homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7
end
@homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@homework)

View File

@ -388,12 +388,12 @@ class UsersController < ApplicationController
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
end
@type = params[:type]
@limit = 15
@limit = 25
@is_remote = true
@hw_count = @homeworks.count
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
@offset ||= @hw_pages.offset
@homeworks = paginateHelper @homeworks,15
@homeworks = paginateHelper @homeworks,25
respond_to do |format|
format.js
format.html {render :layout => 'static_base'}
@ -547,13 +547,13 @@ class UsersController < ApplicationController
end
@type = params[:type]
@property = params[:property]
@limit = 15
@is_import = params[:is_import]
@limit = params[:is_import].to_i == 1 ? 15 : 25
@is_remote = true
@hw_count = @homeworks.count
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
@offset ||= @hw_pages.offset
@homeworks = paginateHelper @homeworks,15
@is_import = params[:is_import]
@homeworks = paginateHelper @homeworks,@limit
respond_to do |format|
format.js
end
@ -573,6 +573,7 @@ class UsersController < ApplicationController
@r_sort = @b_sort == "desc" ? "asc" : "desc"
@user = User.current
search = params[:name].to_s.strip.downcase
type_ids = params[:property] ? "(" + params[:property] + ")" : "(1, 2, 3)"
if(params[:type].blank? || params[:type] == "1") #全部
visible_course = Course.where("is_public = 1 && is_delete = 0")
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
@ -580,24 +581,40 @@ class UsersController < ApplicationController
all_user_ids = all_homeworks.map{|hw| hw.user_id}
user_str_ids = search_user_by_name all_user_ids, search
user_ids = user_str_ids.empty? ? "(-1)" : "(" + user_str_ids.join(",") + ")"
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%' or user_id in #{user_ids})").order("#{@order} #{@b_sort}")
if @order == "course_name"
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_type in #{type_ids} and course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%' or homework_commons.user_id in #{user_ids}) 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("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})").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("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" #课程资源
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("#{@order} #{@b_sort}")
if @order == "course_name"
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where 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 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 publish_time <= '#{Date.today}' and (name like '%#{search}%') and homework_type in #{type_ids}").order("#{@order} #{@b_sort}")
end
end
=begin
if params[:property] && params[:property] == "1"
@homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}")
@homeworks = @homeworks.where("homework_type = 1")
elsif params[:property] && params[:property] == "2"
@homeworks = @homeworks.where("homework_type = 2").reorder("#{@order} #{@b_sort}")
@homeworks = @homeworks.where("homework_type = 2")
elsif params[:property] && params[:property] == "3"
@homeworks = @homeworks.where("homework_type = 3").reorder("#{@order} #{@b_sort}")
@homeworks = @homeworks.where("homework_type = 3")
end
=end
@type = params[:type]
@limit = 15
@limit = params[:is_import].to_i == 1 ? 15 : 25
@is_remote = true
@hw_count = @homeworks.count
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
@offset ||= @hw_pages.offset
@homeworks = paginateHelper @homeworks,15
@homeworks = paginateHelper @homeworks,@limit
@is_import = params[:is_import]
@property = params[:property]
@search = search

View File

@ -1044,9 +1044,9 @@ module ApplicationHelper
elsif @organization
title << @organization.name
elsif @user
title << @user.login
title << @user.try(:realname)
else
title << User.current.login
title << User.current.try(:realname)
end
if first_page.nil? || first_page.web_title.nil?
title << Setting.app_title unless Setting.app_title == title.last
@ -2945,20 +2945,16 @@ end
def user_url_in_org(user_id)
if Rails.env.development?
return "http://localhost:3000/users/" + user_id.to_s
elsif Rails.env.test?
return "https://www.test.forge.trustie.net/users/" + user_id.to_s
else
return "https://www.trustie.net/users/" + user_id.to_s
return "https://" + Setting.host_name + "/users/" + user_id.to_s
end
end
def logout_url_without_domain
if Rails.env.development?
return "http://localhost:3000/logout"
elsif Rails.env.test?
return "https://test.forge.trustie.net/logout"
else
return "https://www.trustie.net/logout"
return "https://" + Setting.host_name + "/logout"
end
end

View File

@ -71,7 +71,8 @@ class CourseActivity < ActiveRecord::Base
name = lead_message.subject
content = lead_message.content
# message的status状态为0为正常为1表示创建课程时发送的message
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true )
# author_id 默认为课程使者创建
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => 1 , :sticky => true, :status => true )
# 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直
message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) if message.course_acts.first
end

View File

@ -1,6 +1,5 @@
<% if User.current.logged? && User.current.id == @user.id %>
<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT',
<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT',
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %>
<% end %>
<% end %>

View File

@ -38,7 +38,7 @@
<%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
</div>
<div class="postThemeWrap">
<% if @article.author.id == User.current.id%>
<% if @article.author.id == User.current.id || User.current.admin? %>
<div class="homepagePostSetting" id="message_setting_<%= @article.id%>" style="display: none">
<ul>
<li class="homepagePostSettingIcon">
@ -48,7 +48,7 @@
l(:button_edit),
{:action => 'edit', :id => @article.id,:in_act => params[:in_act]},
:class => 'postOptionLink'
) if User.current && User.current.id == @article.author.id %>
) if User.current.admin? || User.current.id == @article.author.id %>
</li>
<li>
<%= link_to(
@ -57,7 +57,7 @@
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if User.current && User.current.id == @article.author.id %>
) if User.current.admin? || User.current.id == @article.author.id %>
</li>
<li>
<% if @article.id == @article.blog.homepage_id %>

View File

@ -4,7 +4,7 @@
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
</div>
<div class="homepagePostDes">
<% if activity.author.id == User.current.id%>
<% if activity.author.id == User.current.id || User.current.admin? %>
<div class="homepagePostSetting" id="message_setting_<%= activity.id%>" style="display: none">
<ul>
<li class="homepagePostSettingIcon">
@ -14,7 +14,7 @@
l(:button_edit),
{:controller => 'blog_comments',:action => 'edit',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
:class => 'postOptionLink'
) if User.current && User.current.id == activity.author.id %>
) if User.current.admin? || User.current.id == activity.author.id %>
</li>
<li>
<%= link_to(
@ -23,7 +23,7 @@
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if User.current && User.current.id == activity.author.id %>
) if User.current.admin? || User.current.id == activity.author.id %>
</li>
<li>
<% if activity.id == activity.blog.homepage_id %>

View File

@ -43,6 +43,8 @@
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.content} %>
<div class="cl"></div>
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
</div>
<div class="cl"></div>
</div>

View File

@ -1,7 +1,123 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true, prettify: false) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
<% end %>
<script type="text/javascript">
function nh_check_field(params){
var result=true;
if(!regexTopicSubject()) {
result=false;
return result;
}
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
if(params.content.isEmpty())
{
params.contentmsg.text("描述不能为空");
params.contentmsg.css('color','#ff0000');
}
else if(params.content.html().length >=20000){
params.contentmsg.text("描述最多20000个汉字(或40000个英文字符)");
params.contentmsg.css('color','#ff0000');
result=false;
}
else
{
params.contentmsg.text("填写正确");
params.contentmsg.css('color','#008000');
}
}
}
return result;
}
function init_homework_form(params){
params.form.submit(function(){
params.textarea.html(params.editor.html());
params.editor.sync();
var flag = false;
if(params.form.attr('data-remote') != undefined ){
flag = true
}
var is_checked = false;
is_checked = nh_check_field({
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(flag){
return true;
}else{
$(this)[0].submit();
return false;
}
}
return false;
});
}
function init_homework_editor(params){
params.textarea.removeAttr('placeholder');
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px",
items : ['code','emoticons','fontname',
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
'formatblock', 'fontsize', '|','indent', 'outdent',
'|','imagedirectupload','table', 'media', 'preview',"more"
],
afterChange:function(){//按键事件
var edit = this.edit;
var body = edit.doc.body;
//paramsHeight = params.kindutil.removeUnit(this.height);
edit.iframe.height(150);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150));
},
afterCreate:function(){
//init
var edit = this.edit;
var body = edit.doc.body;
edit.iframe[0].scroll = 'no';
body.style.overflowY = 'hidden';
//reset height
var edit = this.edit;
var body = edit.doc.body;
edit.html(params.textarea.innerHTML);
//paramsHeight = params.kindutil.removeUnit(this.height);
edit.iframe.height(150);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150));
elocalStorage(message_content_editor,'topic_course_<%=course.id %>');
}
}).loadPlugin('paste');
return editor;
}
KindEditor.ready(function(K){
$("div[nhname='topic_form']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[nhname='topic_textarea']",params.div_form);
params.contentmsg = $("#message_content_span");
params.submit_btn = $("#new_message_submit_btn");
if(params.textarea.data('init') == undefined) {
params.editor = init_homework_editor(params);
message_content_editor = params.editor;
init_homework_form(params);
params.submit_btn.click(function () {
params.form.submit();
});
params.textarea.data('init', 1);
}
});
});
</script>
<%= error_messages_for 'message' %>
<div class="resources mt10">
<div id="new_course_topic">
@ -25,7 +141,7 @@
<%= text_area :quote,:quote,:style => 'display:none' %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
<%#= f.kindeditor :content, :editor_id => 'message_content_editor',
:owner_id => topic.nil? ? 0: topic.id,
:owner_type => OwnerTypeHelper::MESSAGE,
:width => '100%',
@ -37,8 +153,11 @@
:maxlength => 5000 },
at_id: topic.id, at_type: topic.class.to_s
%>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='topic_textarea' name="message[content]"><%=topic.content %></textarea>
<div class="cl"></div>
<p id="message_content_span"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
</div>
<div class="cl"></div>
<div class="mt10">
@ -49,11 +168,11 @@
<div class="cl"></div>
<div class="mt5">
<%if !edit_mode %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_topic();">确定</a>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn">确定</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_topic();">取消</a>
<% else %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_topic();">确定</a>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn" onclick="submit_topic();">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%>
<% end %>

View File

@ -25,11 +25,13 @@
课程问答区
</div>
</div>
<div nhname="topic_form">
<% if User.current.logged? %>
<%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'course_new', :locals => {:f => f, :topic => @message, :edit_mode => false, :course => @board.course} %>
<% end %>
<% end %>
</div>
<%= render :partial=> 'course_show_detail',:locals =>{:topics => @topics, :page => 0} %>
</div>

View File

@ -11,7 +11,7 @@
<div class="homepagePostTitle break_word mt-4">
<%# 如果有历史版本则提供历史版本下载 %>
<% if file.attachment_histories.count == 0 %>
<%= link_to truncate(file.filename,length: 35, omission: '...'),
<%= link_to file.is_public? ? truncate(file.filename, length: 45) : truncate(file.filename,length: 35, omission: '...'),
download_named_attachment_path(file.id, file.filename),
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
<% else %>

View File

@ -34,11 +34,7 @@
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @topic.id%>').show();" onmouseout="$('#message_setting_<%= @topic.id%>').hide();">
<div class="postThemeContainer">
<div class="postDetailPortrait">
<% if @topic.status == 1 %>
<%= image_tag("/images/trustie_logo1.png", width: "50px", height: "50px") %>
<% else %>
<%= link_to image_tag(url_to_avatar(@topic.author), :width => 50, :height => 50,:alt=>'图像' ), user_path(@topic.author) %>
<% end %>
</div>
<div class="postThemeWrap">
<% if User.current.logged? %>
@ -74,17 +70,12 @@
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @topic.subject%></a>
</div>
<div class="cl"></div>
<div class="postDetailCreater">
<% if @topic.status == 1 %>
<span class="fontBlue2">确实团队</span>
<% else %>
<% if @topic.try(:author).try(:realname) == ' ' %>
<%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% else %>
<%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% end %>
<% end %>
</div>
<div class="postDetailDate mb5"><%= format_time( @topic.created_on)%></div>
<div class="cl"></div>

View File

@ -12,6 +12,7 @@
<% end %>
<% elsif @message.course %>
<div nhname="topic_form">
<%= form_for @message, {
:as => :message,
:url => {:action => 'edit',:is_course=>@is_course,:is_board=>@is_board},
@ -22,7 +23,7 @@
<%= render :partial => 'boards/course_message_edit',
:locals => {:f => f, :edit_mode => true, :topic => @message, :course => @message.course} %>
<% end %>
</div>
<% elsif @message.board.org_subfield %>
<%= form_for @message, {
:as => :message,

View File

@ -50,6 +50,8 @@
</div>
<div class="cl"></div>
<p id="homework_course_id_span" class="c_red mt5"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
<div class="cl"></div>
<div class="mt10">
<div class="fl" id="topic_attachments">

View File

@ -39,6 +39,8 @@
<div class="cl"></div>
<p id="homework_course_id_span" class="c_red mt5"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
<div class="cl"></div>
<div class="mt10">

View File

@ -46,6 +46,8 @@
</div>
<div class="cl"></div>
<p id="homework_course_id_span" class="c_red mt5"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
<div class="cl"></div>
<div class="mt10">
<div class="fl" id="topic_attachments">

View File

@ -25,7 +25,7 @@
<li >
<span class="tit_fb ">编程代码:</span>
<div class="showHworkP break_word"><pre id="work-src" style="display: none;"><%= work.description if work.description%></pre><div class="fontGrey2 font_cus" id="work-code_<%= work.id%>">
<div class="showHworkP break_word"><pre id="work-src_<%= work.id%>" style="display: none;"><%= work.description if work.description%></pre><div class="fontGrey2 font_cus" id="work-code_<%= work.id%>">
</div>
</div>
<div class="cl"></div>

View File

@ -59,8 +59,8 @@
<li >
<span class="tit_fb ">内容:</span>
<div class="showHworkP break_word">
<%= text_format(work.description) if work.description%>
<div class="showHworkP break_word upload_img" id="student_work_img_<%=work.id %>">
<%= work.description.html_safe if work.description%>
</div>
<div class="cl"></div>
</li>
@ -105,6 +105,9 @@
<div class="cl"></div>
</div>
<script type="text/javascript">
$(function(){
showNormalImage('student_work_img_<%=work.id %>');
});
function show_upload(){
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');
showModal('ajax-modal', '452px');

View File

@ -71,7 +71,7 @@
indentUnit: 2,
matchBrackets: true,
readOnly: true,
value: $("#work-src").text()
value: $("#work-src_<%= work.id%>").text()
});
<% elsif @homework.homework_type == 1 %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");

View File

@ -4,9 +4,11 @@
<p class="f14 mt5">
<span class="fb">作品名称:</span><%=@student_work.name%>
</p>
<p class="f14 mt5">
<span class="fb">作品描述:</span><%=@student_work.description%>
</p>
<div class="f14 mt5" style="max-width: 425px; color:#808181">
<div class="fb fl dis">作品描述:</div>
<div class="upload_img fl" style="max-width: 350px;"><%=@student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
<% if @student_work.attachments.empty? %>

View File

@ -4,9 +4,11 @@
<p class="f14 mt5">
<span class="fb">作品名称:</span><%=@student_work.name%>
</p>
<p class="f14 mt5">
<span class="fb">作品描述:</span><%=@student_work.description%>
</p>
<div class="f14 mt5" style="max-width: 425px; color:#808181">
<div class="fb fl dis">作品描述:</div>
<div class="upload_img fl" style="max-width: 350px;"><%=@student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
<% if @student_work.attachments.empty? %>

View File

@ -1,3 +1,7 @@
<% content_for :header_tags do %>
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
<%= javascript_include_tag 'homework','baiduTemplate' %>
<% end %>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">编辑作品</div>
</div>
@ -25,7 +29,7 @@
</div><!----HomeWorkBox end-->
<div class="cl"></div>
<div class="HomeWorkCon mt15">
<div class="HomeWorkCon mt15" nhname='student_work_form'>
<%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%>
<div class=" c_red mb10">
提示:作品名称和描述中不要出现真实的姓名信息
@ -46,13 +50,16 @@
<p id="student_work_name_span" class="c_red mb10"></p>
</div>
<div class="mt10">
<textarea name="student_work[description]" id="student_work_description" placeholder="请输入作品描述" class="InputBox W700 H150" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%= @work.description%></textarea>
<script>
<textarea placeholder="请输入作品描述" style="display: none" nhname='student_work_textarea' name="student_work[description]"><%= @work.description%></textarea>
<!--<textarea name="student_work[description]" id="student_work_description" placeholder="请输入作品描述" class="InputBox W700 H150" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%#= @work.description%></textarea>-->
<!--<script>
var text = document.getElementById("student_work_description");
autoTextarea(text);// 调用
</script>
</script>-->
<div class="cl"></div>
<p id="student_work_description_textarea" class="c_red mb10"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
</div>
<div id="homework_attachments">
@ -66,7 +73,7 @@
<% end %>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();edit_student_work(<%= @work.id%>);">确定</a>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%>
</div>
@ -96,8 +103,6 @@
}
function popupRegex(){
if(regexStudentWorkName()&&regexStudentWorkDescription())
{
if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
@ -114,5 +119,114 @@
$('#ajax-modal').parent().addClass("anonymos");
}
}
function nh_check_field(params){
var result=true;
if(!regexStudentWorkName()) {
result=false;
return result;
}
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
if(params.content.isEmpty()){
params.contentmsg.html('作品描述不能为空');
}else{
params.contentmsg.html('');
}
}
}
return result;
}
function init_homework_form(params){
params.form.submit(function(){
params.textarea.html(params.editor.html());
params.editor.sync();
var flag = false;
if(params.form.attr('data-remote') != undefined ){
flag = true
}
var is_checked = nh_check_field({
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(flag){
popupRegex();
return true;
}else{
$(this)[0].submit();
$("#ajax-indicator").hide();
return false;
}
}
return false;
});
}
function init_homework_editor(params){
params.textarea.removeAttr('placeholder');
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px",
items : ['code','emoticons','fontname',
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
'formatblock', 'fontsize', '|','indent', 'outdent',
'|','imagedirectupload','table', 'media', 'preview',"more"
],
afterChange:function(){//按键事件
var edit = this.edit;
var body = edit.doc.body;
//paramsHeight = params.kindutil.removeUnit(this.height);
edit.iframe.height(150);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150));
},
afterCreate:function(){
//init
var edit = this.edit;
var body = edit.doc.body;
edit.iframe[0].scroll = 'no';
body.style.overflowY = 'hidden';
//reset height
var edit = this.edit;
var body = edit.doc.body;
edit.html(params.textarea.innerHTML);
//paramsHeight = params.kindutil.removeUnit(this.height);
edit.iframe.height(150);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150));
elocalStorage(editor2,'student_work_<%=@work.id %>');
}
}).loadPlugin('paste');
return editor;
}
KindEditor.ready(function(K){
$("div[nhname='student_work_form']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[nhname='student_work_textarea']",params.div_form);
params.contentmsg = $("#student_work_description_textarea");
params.submit_btn = $("#new_message_submit_btn");
if(params.textarea.data('init') == undefined) {
params.editor = init_homework_editor(params);
editor2 = params.editor;
init_homework_form(params);
params.submit_btn.click(function () {
params.form.submit();
$("#ajax-indicator").hide();
});
params.textarea.data('init', 1);
}
});
});
</script>

View File

@ -172,7 +172,7 @@
<div class="mt5">
<% if @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status < 2 %>
<div class="fontGrey2 db fl">提交截止时间:<%= @homework.end_time %>&nbsp;23:59</div>
<% elsif @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status >= 2 %>
<% elsif @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status >= 2 && @homework.anonymous_comment == 0 %>
<div class="fontGrey2 db fl">匿评截止时间:<%= @homework.homework_detail_manual.evaluation_end %>&nbsp;23:59</div>
<% end %>
<% if @homework.homework_detail_manual.comment_status == 0 %>

View File

@ -1,4 +1,9 @@
<!-- 此界面只用来新建匿评作业作品 -->
<% content_for :header_tags do %>
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
<%= javascript_include_tag 'homework','baiduTemplate' %>
<% end %>
<script type="text/javascript">
<%if @homework.homework_detail_manual.comment_status != 1%>
$(function(){
@ -57,8 +62,6 @@
}
// 作品校验
function popupRegex(){
if(regexStudentWorkName()&&regexStudentWorkDescription())
{
if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
@ -75,8 +78,120 @@
$('#ajax-modal').parent().addClass("anonymos");
}
}
}
var KE = {
MDU: "1234455",//当前文章标识符
};
function nh_check_field(params){
var result=true;
if(!regexStudentWorkName()) {
result=false;
return result;
}
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
if(params.content.isEmpty()){
params.contentmsg.html('作品描述不能为空');
}else{
params.contentmsg.html('');
}
}
}
return result;
}
function init_homework_form(params){
params.form.submit(function(){
params.textarea.html(params.editor.html());
params.editor.sync();
var flag = false;
if(params.form.attr('data-remote') != undefined ){
flag = true
}
var is_checked = nh_check_field({
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(flag){
popupRegex();
return true;
}else{
$(this)[0].submit();
$("#ajax-indicator").hide();
return false;
}
}
return false;
});
}
function init_homework_editor(params){
params.textarea.removeAttr('placeholder');
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px",
items : ['code','emoticons','fontname',
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
'formatblock', 'fontsize', '|','indent', 'outdent',
'|','imagedirectupload','table', 'media', 'preview',"more"
],
afterChange:function(){//按键事件
var edit = this.edit;
var body = edit.doc.body;
//paramsHeight = params.kindutil.removeUnit(this.height);
edit.iframe.height(150);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150));
},
afterCreate:function(){
//init
var edit = this.edit;
var body = edit.doc.body;
edit.iframe[0].scroll = 'no';
body.style.overflowY = 'hidden';
//reset height
var edit = this.edit;
var body = edit.doc.body;
edit.html(params.textarea.innerHTML);
//paramsHeight = params.kindutil.removeUnit(this.height);
edit.iframe.height(150);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150));
elocalStorage(editor2,'student_work_<%=@homework.id %>');
}
}).loadPlugin('paste');
return editor;
}
KindEditor.ready(function(K){
$("div[nhname='student_work_form']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[nhname='student_work_textarea']",params.div_form);
params.contentmsg = $("#student_work_description_textarea");
params.submit_btn = $("#new_message_submit_btn");
if(params.textarea.data('init') == undefined) {
params.editor = init_homework_editor(params);
editor2 = params.editor;
init_homework_form(params);
params.submit_btn.click(function () {
params.form.submit();
$("#ajax-indicator").hide();
});
params.textarea.data('init', 1);
}
});
});
</script>
<div class="homepageRightBanner mb10">
@ -110,7 +225,7 @@
</div><!----HomeWorkBox end-->
<div class="cl"></div>
<div class="HomeWorkCon mt15">
<div class="HomeWorkCon mt15" nhname='student_work_form'>
<%= form_for(@student_work,
:html => { :multipart => true },
:url => {:controller => 'student_work',
@ -127,18 +242,21 @@
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %>
<% end %>
<div>
<%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请输入作品名称", :onkeyup => "regexStudentWorkName();" %>
<%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请输入作品名称",:value=>"#{@homework.name}的作品提交", :onkeyup => "regexStudentWorkName();" %>
<div class="cl"></div>
<p id="student_work_name_span" class="c_red mb10"></p>
</div>
<div class="mt10">
<%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请输入作品描述", :onkeyup => "regexStudentWorkDescription();"%>
<script>
<textarea placeholder="请输入作品描述" style="display: none" nhname='student_work_textarea' name="student_work[description]"></textarea>
<%#= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请输入作品描述", :onkeyup => "regexStudentWorkDescription();"%>
<!--<script>
var text = document.getElementById("student_work_description");
autoTextarea(text);// 调用
</script>
</script>-->
<div class="cl"></div>
<p id="student_work_description_textarea" class="c_red mb10"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
</div>
<div id="homework_attachments">
@ -167,9 +285,9 @@
</div>-->
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();new_student_work();">提交</a>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn">提交</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%>
<%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id),:id => 'new_message_cancel_btn', :class => "fr mr10 mt3"%>
</div>
<div class="cl"></div>
<% end%>

View File

@ -25,7 +25,7 @@ else{
indentUnit: 2,
matchBrackets: true,
readOnly: true,
value: $("#work-src").text()
value: $("#work-src_<%= @work.id%>").text()
}
);

View File

@ -1,24 +1,16 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" onmouseover="$('#message_setting_<%= user_activity_id%>').show();" onmouseout="$('#message_setting_<%= user_activity_id%>').hide();">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<% if activity.status == 1 %>
<%= image_tag("/images/trustie_logo1.png", width: "50px", height: "50px") %>
<% else %>
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
<% end %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4">
<% if activity.status == 1 %>
<span class="fontBlue2">确实团队</span>
<% else %>
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<% end %>
<% end %>
TO
<%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
</div>

View File

@ -1,7 +1,17 @@
<div class="subject-pop-info">题目信息</div>
<div class="subject-pop-wrap">
<% if homework.nil? %>
<span class="c_red" id="homework_notice_span">请先在左侧选择作业</span>
<span id="homework_notice_span">本题库遵循创作共用许可证<br/><br/>
教师给学生出题本质上是一种创作行为,题目的作者通常为此付出大量时间和精力。好的题目不仅能加深学生对知识点的理解,还能激发学生兴趣,提升学习效率。为此,本网站的题库许可证基于创作共用许可证( Creative Commons License )建立,其核心条款包括:<br/><br/>
1. 署名:必须提到原作者。<br/><br/>
2. 非商业用途:不得用于盈利性目的。<br/><br/>
3. 相同方式共享:允许修改原作品,但必须使用相同的许可证发布。<br/><br/>
对此许可证的支持或反对,请在网站中留言,我们不断完善,谢谢!</span>
<% else %>
<div class="subject-pop-intro mb15">标题:<%=homework.name %><br />
来源:<%=homework.course.name %><br />

View File

@ -2,7 +2,18 @@
<div class="subjectInfo">题目信息</div>
<div class="subject-content-wrapper">
<% if homework.nil? %>
<span class="c_red" id="homework_notice_span">请先在左侧选择作业</span>
<span id="homework_notice_span"><span class="center db">本题库遵循创作共用许可证</span><br>
教师给学生出题本质上是一种创作行为,题目的作者通常为此付出大量时间和精力。好的题目不仅能加深学生对知识点的理解,还能激发学生兴趣,提升学习效率。为此,本网站的题库许可证基于创作共用许可证( Creative Commons License )建立,其核心条款包括:<br/><br/>
1. 署名:必须提到原作者。<br/><br/>
2. 非商业用途:不得用于盈利性目的。<br/><br/>
3. 相同方式共享:允许修改原作品,但必须使用相同的许可证发布。<br/><br/>
对此许可证的支持或反对,请在网站中留言,我们不断完善,谢谢!
</span>
<% else %>
<div class="subjectIntro mb15">标题:<%=homework.name %><br />
来源:<%=homework.course.name %><br />

View File

@ -1,18 +1,33 @@
<ul class="subject-list-banner">
<li class="subject-list-name fl hidden"><span style="padding-left:15px;">作业名称</span></li>
<li class="subject-list-from fl">来源</li>
<li class="subject-list-type fl">类别</li>
<li class="subject-list-publisher fl">贡献者</li>
<li class="subject-list-from fl">
<%= link_to "来源",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "course_name", :sort => @r_sort),:class => "fl ml30",:remote => true%>
<% if @order == "course_name"%>
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "course_name", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%>
<% end%>
</li>
<li class="subject-list-type fl">
<%= link_to "类别",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "homework_type", :sort => @r_sort),:class => "fl ml10",:remote => true%>
<% if @order == "homework_type"%>
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "homework_type", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%>
<% end%>
</li>
<li class="subject-list-publisher fl">
<%= link_to "贡献者",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "user_name", :sort => @r_sort),:class => "fl ml20",:remote => true%>
<% if @order == "user_name"%>
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "user_name", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%>
<% end%>
</li>
<li class="subject-list-count fl">
<%= link_to "引用数",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort),:class => "fl",:remote => true%>
<%= link_to "引用数",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort),:class => "fl ml5",:remote => true%>
<% if @order == "quotes"%>
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12" ,:remote => true%>
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%>
<% end%>
</li>
<li class="fl subject-list-date">
<%= link_to "发布时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "fl",:remote => true%>
<% if @order == "created_at"%>
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12" ,:remote => true%>
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%>
<% end%>
</li>
</ul>

View File

@ -1,6 +1,6 @@
<div class="userCard boxShadow" style="<%= User.current == user ? 'top:-153px;':'' %>">
<div class="userAvatarWrap fl">
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像", :target => '_blank' %>
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user.id), :alt => "用户头像", :target => '_blank' %>
<%#= image_tag(url_to_avatar(user), :width => "50", :height => "50") %>
<!--<img src="images/homepageImage.jpg" width="50" height="50" alt="个人头像" />-->
</div>

View File

@ -30,7 +30,7 @@
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal()">取消</a>
</div>
<div >
<ul class="wlist" id="homewrok_ref_pages" style="margin-top: 5px;margin-right: 20px">
<ul class="wlist" id="homewrok_ref_pages" style="margin-top: 5px">
<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
</div>

View File

@ -16,7 +16,6 @@
$("#GroupPopupBox a.group_save_btn").click();
<% end %>
});
var homework_description_editor;
function checked_val() {
if ($("#anonymous_comment").is(":checked")) {
$("#anonymous_comment").val(1);
@ -106,7 +105,7 @@
//paramsHeight = params.kindutil.removeUnit(this.height);
edit.iframe.height(150);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150));
elocalStorage(homework_description_editor,'homework_<%=User.current.id %>');
}
}).loadPlugin('paste');
return editor;
@ -150,7 +149,7 @@
<div class="cl"></div>
<div class=" mt10">
<%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
<%= link_to("从题库选用", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
<% unless edit_mode %>
<input type="hidden" name="quotes" id="ref_homework_id" value=""/>
<% end %>
@ -159,7 +158,7 @@
<% end %>
<div class="calendar_div fl mr10">
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
<% if homework.homework_detail_manual.comment_status.to_i < 3 %>
<% if homework.homework_detail_manual.comment_status.to_i < 2 %>
<%= calendar_for('homework_end_time')%>
<% end %>
</div>
@ -199,6 +198,8 @@
<%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
</div>
<p id="homework_course_id_span" class="c_red mt5"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
<div class="cl"></div>
<div id="homework_attachments">

View File

@ -85,7 +85,7 @@
<span data-language=<%=@homework.language%> style="display-hidden" id="data-language"></span>
</div>
<div class="mt10">
<%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %>
<%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能", value:"#{@homework.name}的作品提交" %>
</div>
<div class="mt10">
<%= f.text_area :description, id: 'program-src', class:"InputBox W700 H150", placeholder:"请贴入你的代码", rows: 10 %>

View File

@ -33,7 +33,7 @@
<div class="homepageContentContainer">
<div class="homepageContent">
<div class="resource-wrapper mt10">
<div class="resource-wrapper">
<ul class="resource-banner">
<li class="fl resource-switch">
<a href="<%= user_homework_type_user_path(@user,:is_import => 0) %>" id="public_homeworks_choose" class="resource-tab resource-tab-active" data-remote="true">公共题库</a>
@ -46,7 +46,7 @@
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="resourcesType">
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 0) %>" id="homework_type_all" class="resourcesTypeAll resourcesGrey" data-method="get" data-remote="true">全部</a> </li>
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0) %>" id="homework_type_all" class="resourcesTypeAll resourcesGrey" data-method="get" data-remote="true">全部</a> </li>
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 1) %>" id="homework_type_nor" class="homepagePostTypeAssignment postTypeGrey" data-method="get" data-remote="true">普通作业</a> </li>
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 2) %>" id="homework_type_pro" class="program-btn postTypeGrey" data-method="get" data-remote="true" style="white-space:nowrap;">编程作业</a> </li>
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 3) %>" id="homework_type_gro" class="group-btn resourcesGrey" data-method="get" data-remote="true">分组作业</a> </li>
@ -61,7 +61,7 @@
<%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => @property} %>
</div>
<div class="cl"></div>
<div class="w583 fl mr10 mt10" id="homework_repository_list">
<div class="w683 fl mr10 mt10" id="homework_repository_list">
<%=render :partial => 'homework_repository_list', :locals => {:homeworks => @homeworks,:type=>@type,:is_import => 0,:property => @property,:search=>''} %>
</div>
<div id="homework_repository_detail">
@ -69,7 +69,7 @@
</div>
<div class="cl"></div>
<div>
<ul class="wlist mt10" id="homework_pository_ref_pages" style="margin-top: 5px;margin-right: 395px">
<ul class="wlist mt10" id="homework_pository_ref_pages" style="margin-top: 5px;margin-right: 295px">
<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
</div>

View File

@ -0,0 +1,8 @@
class UpdateCourseLead < ActiveRecord::Migration
def up
Message.where("status =? ", 1).update_all(:author_id => 1)
end
def down
end
end

View File

@ -1174,4 +1174,49 @@ function getRootPath(){
var projectName="";
return(localhostPaht+projectName);
}
//自动保存草稿
var editor2;
function elocalStorage(editor,mdu){
if (window.sessionStorage){
editor2 = editor;
var oc = window.sessionStorage.getItem('content'+mdu);
if(oc !== null ){
var h = '您上次有已保存的数据,是否<a onclick="rec_data(\'content\',\''+ mdu + '\')">恢复</a> ? / <a onclick="clear_data(\'content\',\''+ mdu + '\')">不恢复</a>';
$('#e_tips').html(h);
}
setInterval(function() {
d = new Date();
var h = d.getHours();
var m = d.getMinutes();
var s = d.getSeconds();
h = h < 10 ? '0' + h : h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
if(!editor.isEmpty()){
add_data("content",mdu,editor.html());
$('#e_tip').html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 ");
$('#e_tips').html("");
}
},10000);
}else{
$('.ke-edit').after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
}
}
function add_data(k,mdu,d){
window.sessionStorage.setItem(k+mdu,d);
}
function rec_data(k,mdu){
if(window.sessionStorage.getItem(k+mdu) !== null){
editor2.html(window.sessionStorage.getItem(k+mdu));
clear_data(k,mdu);
}
}
function clear_data(k,mdu){
window.sessionStorage.removeItem(k+mdu);
if(k == 'content'){
$("#e_tips").html("");
}else{
$("#e_tip").html("");
}
}

View File

@ -1,3 +1,4 @@
var editor2;
function init_des_editor(params){
// var minHeight; //最小高度
var paramsHeight = params.height; //设定的高度
@ -32,7 +33,7 @@ function init_des_editor(params){
paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight;
edit.iframe.height(paramsHeight);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight), paramsHeight));
elocalStorage(editor2,'org_document');
}
}).loadPlugin('paste');
return editor;
@ -123,6 +124,7 @@ function init_des_data(){
params.width = width;
if (params.textarea.data('init') == undefined) {
params.editor = init_des_editor(params);
editor2 = params.editor;
init_form(params);
params.cancel_btn.click(function () {
nh_reset_form(params);

View File

@ -98,7 +98,7 @@ input.c_white { color:#fff !important;}
.w520{ width:520px;}
.w543{ width:543px;}
.w557{ width:557px;}
.w583{ width:583px;}
.w683{ width:683px;}
.w350{ width:350px;}
.w610{ width:610px;}
.w600{ width:600px;}

View File

@ -1267,7 +1267,7 @@ div.disable_link {background-color: #c1c1c1 !important;}
/*导入题库样式*/
.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.subjectList {width:585px;}
.subjectDetail {width:385px;}
.subjectDetail {width:285px;}
a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;}
a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
@ -1278,7 +1278,7 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectRow {width:585px; height:40px; color:#7a7a7a; font-size:12px;}
.subjectRow li {height:40px; line-height:40px; vertical-align:middle;}
.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;}
.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectInfo {width:285px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;}
.subjectIntro {color:#585858; line-height:18px; font-size:12px;}
.subjectContent {color:#888888; line-height:18px; font-size:12px;}

View File

@ -135,7 +135,7 @@ a.linkGrey6:hover {color:#ffffff !important;}
.w520{ width:520px;}
.w543{ width:543px;}
.w557{ width:557px;}
.w583{ width:583px;}
.w683{ width:683px;}
.w350{ width:350px;}
.w610{ width:610px;}
.w600{ width:600px;}
@ -1440,46 +1440,46 @@ span.at a{color:#269ac9;text-decoration: none;}
/*导入题库样式*/
.popup-wrapper {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.subject-list {width:585px;}
.subject-detail {width:385px;}
.subject-list {width:685px;}
.subject-detail {width:285px;}
a.subject-choose {padding:8px 20px; background-color:#f1f1f1; color:#888888;}
a.choose-active {background-color:#269ac9; color:#ffffff;}
.subject-pop-banner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.subject-pop-banner {width:685px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.subject-pop-banner li {height:40px; line-height:40px; vertical-align:middle;}
.subject-pop-name {width:200px; padding-left:10px; padding-right:10px;}
.subject-pop-name {width:260px; padding-left:10px; padding-right:10px;}
.subject-pop-publisher {width:80px; text-align:center;}
.subject-pop-date {width:75px; text-align:center;}
.subject-pop-row {width:585px; height:30px; color:#7a7a7a; font-size:12px;}
.subject-pop-row {width:685px; height:30px; color:#7a7a7a; font-size:12px;}
.subject-pop-row li {height:30px; line-height:30px; vertical-align:middle;}
.subject-pop-search {border:1px solid #dddddd; height:32px; width:250px;}
.subject-pop-info {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subject-pop-wrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:475px; overflow-y:auto;}
.subject-pop-info {width:285px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subject-pop-wrap {border:1px solid #dddddd; border-top:none; padding:10px; width:265px; height:475px; overflow-y:auto;}
.subject-pop-intro {color:#585858; line-height:18px; font-size:12px;}
.subject-pop-content {color:#888888; line-height:18px; font-size:12px;}
.popup-close {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;}
.subject-pop-type {width:50px; text-align:center;}
.subject-pop-count {width:60px; text-align:center;}
.subject-pop-from {width:100px; text-align:center;}
.subject-pop-from {width:140px; text-align:center;}
.subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;}
.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;}
.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
/*20160301新题库样式*/
.subject-list-banner {width:585px; height:34px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.subject-list-banner li {height:34px; line-height:34px; vertical-align:middle;}
.subject-list-name {width:200px; padding-left:10px; padding-right:10px;}
.subject-list-banner {width:685px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.subject-list-banner li {height:40px; line-height:40px; vertical-align:middle;}
.subject-list-name {width:260px; padding-left:10px; padding-right:10px;}
.subject-list-publisher {width:80px; text-align:center;}
.subject-list-date {width:70px; text-align:center;}
.subject-list-row {width:585px; height:30px; color:#7a7a7a; font-size:12px;}
.subject-list-row li {height:30px; line-height:30px; vertical-align:middle;}
.subject-list-row {width:685px; height:40px; color:#7a7a7a; font-size:12px;}
.subject-list-row li {height:40px; line-height:40px; vertical-align:middle;}
.subject-list-search {border:1px solid #dddddd; height:32px; width:250px;}
.subject-list-info {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subject-list-wrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;}
.subject-content-wrapper {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:430px; overflow-y:auto;}
.subject-content-wrapper {border:1px solid #dddddd; border-top:none; padding:10px; width:265px; height:430px; overflow-y:auto;}
.subject-list-type {width:50px; text-align:center;}
.subject-list-count {width:60px; text-align:center;}
.subject-list-from {width:105px; text-align:center;}
.subject-list-from {width:145px; text-align:center;}
/*视频播放默认图标*/
.mediaIco{margin: 30px 0 30px 20px;}

View File

@ -121,7 +121,7 @@ a.link_file_a2{ background:url(../images/pic_file.png) 0 -15px no-repeat; paddin
/*导入题库样式*/
.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.subjectList {width:585px;}
.subjectDetail {width:385px;}
.subjectDetail {width:285px;}
a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;}
a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
@ -132,7 +132,7 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectRow {width:585px; height:40px; color:#7a7a7a; font-size:12px;}
.subjectRow li {height:40px; line-height:40px; vertical-align:middle;}
.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;}
.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectInfo {width:285px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;}
.subjectIntro {color:#585858; line-height:18px; font-size:12px;}
.subjectContent {color:#888888; line-height:18px; font-size:12px;}

View File

@ -1182,7 +1182,7 @@ div.disable_link {background-color: #c1c1c1 !important;}
/*导入题库样式*/
.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.subjectList {width:585px;}
.subjectDetail {width:385px;}
.subjectDetail {width:285px;}
a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;}
a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
@ -1193,7 +1193,7 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectRow {width:585px; height:40px; color:#7a7a7a; font-size:12px;}
.subjectRow li {height:40px; line-height:40px; vertical-align:middle;}
.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;}
.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectInfo {width:285px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;}
.subjectIntro {color:#585858; line-height:18px; font-size:12px;}
.subjectContent {color:#888888; line-height:18px; font-size:12px;}

View File

@ -165,7 +165,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.w543{ width:543px;}
.w557{ width:557px;}
.w576{ width:576px;}
.w583{ width:583px;}
.w683{ width:683px;}
.w350{ width:350px;}
.w610{ width:610px;}
.w600{ width:600px !important;}
@ -1034,26 +1034,26 @@ a:hover.userCancel{border:1px solid #888888; }
/*导入题库样式*/
.popup-wrapper {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.subject-list {width:585px;}
.subject-detail {width:385px;}
.subject-list {width:685px;}
.subject-detail {width:285px;}
a.subject-choose {padding:8px 20px; background-color:#f1f1f1; color:#888888;}
a.choose-active {background-color:#269ac9; color:#ffffff;}
.subject-pop-banner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.subject-pop-banner {width:685px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.subject-pop-banner li {height:40px; line-height:40px; vertical-align:middle;}
.subject-pop-name {width:200px; padding-left:10px; padding-right:10px;}
.subject-pop-name {width:260px; padding-left:10px; padding-right:10px;}
.subject-pop-publisher {width:80px; text-align:center;}
.subject-pop-date {width:75px; text-align:center;}
.subject-pop-row {width:585px; height:30px; color:#7a7a7a; font-size:12px;}
.subject-pop-row {width:685px; height:30px; color:#7a7a7a; font-size:12px;}
.subject-pop-row li {height:30px; line-height:30px; vertical-align:middle;}
.subject-pop-search {border:1px solid #dddddd; height:32px; width:250px;}
.subject-pop-info {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subject-pop-wrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:475px; overflow-y:auto;}
.subject-pop-info {width:285px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subject-pop-wrap {border:1px solid #dddddd; border-top:none; padding:10px; width:265px; height:475px; overflow-y:auto;}
.subject-pop-intro {color:#585858; line-height:18px; font-size:12px;}
.subject-pop-content {color:#888888; line-height:18px; font-size:12px;}
.popup-close {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;}
.subject-pop-type {width:50px; text-align:center;}
.subject-pop-count {width:60px; text-align:center;}
.subject-pop-from {width:100px; text-align:center;}
.subject-pop-from {width:140px; text-align:center;}
.subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;}
.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;}
@ -1086,7 +1086,7 @@ a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px s
/*导入资源样式*/
.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.resoure-list {width:705px;}
.subjectDetail {width:385px;}
.subjectDetail {width:285px;}
.resource-pop-banner {width:705px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.resource-pop-banner li {height:40px; line-height:40px; vertical-align:middle;}
.resource-pop-name {width:270px; padding-left:10px; padding-right:10px;}
@ -1095,7 +1095,7 @@ a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px s
.resource-pop-row {width:705px; height:40px; color:#7a7a7a; font-size:12px;}
.resource-pop-row li {height:40px; line-height:40px; vertical-align:middle;}
.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;}
.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectInfo {width:285px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;}
.subjectIntro {color:#585858; line-height:18px; font-size:12px;}
.subjectContent {color:#888888; line-height:18px; font-size:12px;}

View File

@ -95,7 +95,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.w520{ width:520px;}
.w543{ width:543px;}
.w557{ width:557px;}
.w583{ width:583px;}
.w683{ width:683px;}
.w350{ width:350px;}
.w610{ width:610px;}
.w600{ width:600px;}