This commit is contained in:
guange 2015-10-14 17:26:51 +08:00
commit 716f0f31b3
34 changed files with 256 additions and 207 deletions

View File

@ -756,7 +756,7 @@ class ApplicationController < ActionController::Base
# Returns a string that can be used as filename value in Content-Disposition header
def filename_for_content_disposition(name)
request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name
request.env['HTTP_USER_AGENT'] =~ %r{MSIE|Trident} ? ERB::Util.url_encode(name) : name
end
def api_request?

View File

@ -133,8 +133,9 @@ class StudentWorkController < ApplicationController
format.js
format.html
format.xls {
filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_homework_list)}.xls"
send_data(homework_to_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_homework_list)}.xls")
:filename => filename_for_content_disposition(filename))
}
end
end
@ -386,8 +387,9 @@ class StudentWorkController < ApplicationController
end
respond_to do |format|
format.xls {
filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_absence_list)}.xls"
send_data(absence_penalty_list_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_absence_list)}.xls")
:filename => filename_for_content_disposition(filename))
}
end
end
@ -396,8 +398,9 @@ class StudentWorkController < ApplicationController
def evaluation_list
respond_to do |format|
format.xls {
filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_evaluation_list)}.xls"
send_data(evaluation_list_xls(@homework.student_works), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_evaluation_list)}.xls")
:filename => filename_for_content_disposition(filename))
}
end
end

View File

@ -121,7 +121,7 @@ class UsersController < ApplicationController
messages = MessageAll.where("user_id =?", @user).order("created_at desc")
messages.each do |message_all|
# 在点击或者刷新消息列表后未读的消息存放在数组
if message_all.message_type != "SystemMessage" && message_all.message.viewed == 0
if message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0
@message_alls << message_all.message
end
end
@ -522,6 +522,7 @@ class UsersController < ApplicationController
@atta_count = @attachments.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
#@curse_attachments_all = @all_attachments[@offset, @limit]
@attachments = paginateHelper @attachments,7
respond_to do |format|
@ -555,6 +556,7 @@ class UsersController < ApplicationController
@atta_count = @attachments.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
#@curse_attachments_all = @all_attachments[@offset, @limit]
@attachments = paginateHelper @attachments,7
respond_to do |format|
@ -586,6 +588,7 @@ class UsersController < ApplicationController
@atta_count = @attachments.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
#@curse_attachments_all = @all_attachments[@offset, @limit]
@attachments = paginateHelper @attachments,7
respond_to do |format|
@ -596,8 +599,8 @@ class UsersController < ApplicationController
#将资源批量引入
def import_resources_to_homework
@attachments = []
unless params[:checkbox1].nil? || params[:checkbox1].blank?
params[:checkbox1].each do |id|
unless session[:seleted_resource_ids].nil? || session[:seleted_resource_ids].blank?
session[:seleted_resource_ids].each do |id|
atta = Attachment.find(id)
att_copy = atta.copy
att_copy.container_id = nil
@ -608,11 +611,23 @@ class UsersController < ApplicationController
@attachments << att_copy
end
end
session[:seleted_resource_ids] = [] #保存后清空
respond_to do |format|
format.js
end
end
# ajax 用session保存选择的资源id
def store_selected_resource
session[:seleted_resource_ids] = [] if session[:seleted_resource_ids].nil?
if params[:save] == 'y'
session[:seleted_resource_ids] << params[:res_id]
else
session[:seleted_resource_ids].delete( params[:res_id])
end
render :nothing => true
end
include CoursesHelper
def user_courses

View File

@ -68,8 +68,14 @@ module UsersHelper
'课程讨论'
when 'course_news'
'课程通知'
when 'poll'
'课程问卷'
when 'issue'
'项目任务'
when 'forge_message'
'项目讨论'
when 'forge_news'
'项目新闻'
when 'forum'
'贴吧帖子'
when 'user_feedback'

View File

@ -94,7 +94,7 @@
$('#reply_content_<%= activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
});
</script>
<% if activity %>
<% if activity && activity.course_act%>
<% act = activity.course_act %>
<% case activity.course_act_type.to_s %>
<% when 'HomeworkCommon' %>

View File

@ -1,7 +1,9 @@
<% if course && tag_list.empty? == false%>
<span class="files_tag_icon" >
<a title="双击可编辑"
<a title=""
onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(course)%>','','<%= @q%>','<%= course.id%>');"
>全部</a></span>
<% end %>
<% unless tag_list.nil?%>
<% tag_list.each do |k,v|%>
<% if tag_name && tag_name == k%>

View File

@ -234,21 +234,23 @@
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id就是第一种情况。如果没有id。就是第二种情况
function rename_tag(domEle,name,id,type){
isdb = true; //这是双击
//clearTimeout(clickFunction);
if(domEle.children().get(0) != undefined ){ //已经是编辑框的情况下不要动
return;
if(String(id) != '' || '<%=User.current.allowed_to?(:as_teacher,@course)%>' == 'true' ) { //如果有id 或者是老师就都能编辑否则没有id不是老师就不能编辑
isdb = true; //这是双击
//clearTimeout(clickFunction);
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
return;
}
tagNameHtml = domEle.parent().html()
tagName = name;
parentCssBorder = domEle.parent().css("border");
ele = domEle;
tagId = id;
taggableType = type;
width = parseInt(domEle.css('width').replace('px', '')) >= 100 ? parseInt(domEle.css('width').replace('px', '')) : 100
domEle.html('<input name="" id="renameTagName" maxlength="<%=Setting.tags_max_length%>" minlength="<%= Setting.tags_min_length%>" style="width:' + width + 'px;" value="' + name + '"/>');
domEle.parent().css("border", "1px solid #ffffff");
$("#renameTagName").focus();
}
tagNameHtml = domEle.parent().html()
tagName = name;
parentCssBorder = domEle.parent().css("border");
ele = domEle;
tagId = id;
taggableType = type;
width = parseInt(domEle.css('width').replace('px','')) >=100 ? parseInt(domEle.css('width').replace('px','')) : 100
domEle.html('<input name="" id="renameTagName" maxlength="<%=Setting.tags_max_length%>" minlength="<%= Setting.tags_min_length%>" style="width:'+width +'px;" value="'+name+'"/>');
domEle.parent().css("border","1px solid #ffffff");
$("#renameTagName").focus();
}
//监听所有的单击事件
$(function(){

View File

@ -1,6 +1,6 @@
<% forum.tag_list.each do |tag|%>
<% forum.reload.tag_list.each do |tag|%>
<span class="postlabel mr10">
<a href="javascript:void(0);" ondblclick="rename_tag($(this),<%= tag %>,<%= forum.id%>,5);" style="cursor: default" class="fontGrey2 mr5"><%= tag %></a>
<a title="双击可编辑" ondblclick="rename_tag($(this),'<%= tag %>',<%= forum.id%>,5);" style="cursor: pointer" class="fontGrey2 mr5"><%= tag %></a>
<%if forum.creator.id == User.current.id%>
<a href="javascript:void(0);" class="fontGrey2" onclick="delete_forum_tag($(this));">×</a>
<% end %>

View File

@ -76,10 +76,10 @@
$("#error").html("主题 过长(最长为 50 个字符)").show();
return false;
}
if(memo_content.html().trim().length > 5000){
$("#error").html("内容 过长(最长为 5000 个字符)").show();
return false;
}
// if(memo_content.html().trim().length > 5000){
// $("#error").html("内容 过长(最长为 5000 个字符)").show();
// return false;
// }
return true;
}

View File

@ -98,13 +98,8 @@
domEle.parent().css("border","1px solid #ffffff");
$("#renameTagName").focus();
}
//监听所有的单击事件
$(document).click(function(e){
node = document.elementFromPoint(e.clientX, e.clientY);
if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了
return;
}
if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
$("#renameTagName").live('blur',function(){
if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态
ele.parent().css("border","");
ele.parent().html(tagNameHtml);
@ -122,6 +117,30 @@
}
}
});
//监听所有的单击事件
// $(document).click(function(e){
// node = document.elementFromPoint(e.clientX, e.clientY);
// if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了
// return;
// }
// if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
// if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态
// ele.parent().css("border","");
// ele.parent().html(tagNameHtml);
//
// }else{ //否则就要更新tag名称了
// if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){
// $.post(
// '<%#= update_tag_name_path %>',
// {"taggableId": taggableId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim()}
// )
// }else{
// ele.parent().css("border","");
// ele.parent().html(tagNameHtml);
// }
// }
// }
// });
function del_forum_confirm(){
if(confirm('您确定要删除么?')){

View File

@ -7,10 +7,10 @@
$("#error").html('主题不能超过50个字符').show();
return;
}
if(memo_content.html().trim().length > 5000 ){
$("#error").html('内容不能超过5000个字符').show();
return;
}
// if(memo_content.html().trim().length > 5000 ){
// $("#error").html('内容不能超过5000个字符').show();
// return;
// }
memo_content.sync();
$("#edit_memo").submit();
}else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.html().trim() != "" ){

View File

@ -86,15 +86,15 @@
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复(<%=@reply_count %></div>
<div class="homepagePostReplyBannerTime"></div>
<div class="homepagePostReplyBannerMore">
<% if @reply_count > 2%>
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%= @memo.id%>" onclick="expand_reply('#reply_div_<%= @memo.id %>','#reply_btn_<%= @memo.id%>')" data-count="<%= @reply_count %>" data-init="0" >点击展开更多回复</a>
<% end %>
</div>
<!--<div class="homepagePostReplyBannerMore">-->
<!--<%# if @reply_count > 2%>-->
<!--<a# href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @memo.id%>" onclick="expand_reply('#reply_div_<%#= @memo.id %>','#reply_btn_<%#= @memo.id%>')" data-count="<%= @reply_count %>" data-init="0" >点击展开更多回复</a>-->
<!--<%# end %>-->
<!--</div>-->
</div>
<div class="" id="reply_div_<%= @memo.id %>">
<% @replies.each_with_index do |reply,i| %>
<div class="homepagePostReplyContainer" style="display: <%= i >= 2 ? 'none':''%>">
<div class="homepagePostReplyContainer" >
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>

View File

@ -21,6 +21,19 @@
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","30%").css("left","20%").css("position","fixed");
}
// 点击 checkbox选中引用的资源的时候保存该资源的id到session里去
function store_seleted_resource(dom){
if(dom.attr('checked') == 'checked' ){
$.get(
'<%= store_selected_resource_user_path(User.current) %>'+'?save=y&res_id='+dom.val()
)
}else {
$.get(
'<%= store_selected_resource_user_path(User.current) %>'+'?save=n&res_id='+dom.val()
)
}
}
</script>
<div class="homepageRightBanner mb10">

View File

@ -0,0 +1,25 @@
<% if attachments.nil? || attachments.empty? %>
<!--<p class="nodata">-->
<!--<%#= l(:label_no_data) %>-->
<!--</p>-->
<% else %>
<% attachments.each do |attach| %>
<ul class="resourcesList">
<li class="resourcesListCheckbox fl">
<input name="checkbox1[]" type="checkbox" onclick="store_seleted_resource($(this));" <%=seleted_resources.include?(attach.id.to_s) ? 'checked':'' %> value="<%= attach.id%>" class="resourcesCheckbox" />
</li>
<li class="resourcesListName fl">
<!--<a href="javascript:void(0);" class="resourcesBlack"><%#=truncate(attach.filename,:length=>18)%></a>-->
<%= link_to truncate(attach.filename,:length=>30), download_named_attachment_path(attach.id, attach.filename),
:title => attach.filename,:class=>'resourcesBlack'%>
</li>
<li class="resourcesListSize fl"><%= number_to_human_size(attach.filesize) %></li>
<li class="resourcesListType fl"><%= get_resource_type(attach.container_type)%></li>
<li class="resourcesListUploader fl"><%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %></li>
<li style="display: none"><%= attach.author_id %></li>
<li class="resourcesListTime fl"><%= format_date(attach.created_on) %></li>
<li style="display: none"><%= attach.id %></li>
</ul>
<% end %>
<% end %>

View File

@ -0,0 +1,41 @@
<div class="homepageRightBanner">
<div class="NewsBannerName"><%= title_for_message(params[:type]) %></div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14"><strong>课程消息</strong></li>
<li><%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "homepagePostTypeAssignment postTypeGrey" %></li>
<li><%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "homepagePostTypeForum postTypeGrey" %></li>
<li><%= link_to "课程通知",user_message_path(User.current, :type => 'course_news'), :class => "homepagePostTypeNotice postTypeGrey" %></li>
<li><%= link_to "课程问卷", user_message_path(User.current, :type => 'poll'), :class => "homepagePostTypeQuiz postTypeGrey" %></a></li>
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14"><strong>项目消息</strong></li>
<li><%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "homepageTypePTask postTypeGrey" %></li>
<li><%= link_to "项目讨论", user_message_path(User.current, :type => 'forge_message'), :class => "homepagePostTypeForum postTypeGrey" %></li>
<li><%= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "homepageTypePNews postTypeGrey" %></li>
<li><%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "homepageTypeUApply postTypeGrey" %></li>
</ul>
</li>
<div class="cl"></div>
<li>
<ul class="homepagePostTypeMore">
<li class="f14"><strong>更多</strong></li>
<li class="fl w100"><%= link_to "全部",user_message_path(User.current), :class => "resourcesTypeAll postTypeGrey" %></li>
<li class="fl"><%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "homepageTypeUnread postTypeGrey" %></li>
<li class="fl w100"><%= link_to "系统消息", user_system_messages_path(User.current), :class => "homepageTypeSystem postTypeGrey" %></li>
<li class="fl"><%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "homepageTypePost postTypeGrey" %></li>
<li class="fl w100"><%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>

View File

@ -51,10 +51,10 @@
<%= form_tag(import_resources_to_homework_user_path(user),:method => 'post',:remote=>'true') do %>
<input type="hidden" name="homework_id" value="<%= homework_id%>"/>
<div style="height: 300px" id="user_ref_resources">
<%= render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments} %>
<%= render :partial => 'homework_ref_resources_list' ,:locals=>{ :attachments => @attachments,:seleted_resources=>seleted_resources} %>
</div>
<div >
<ul class="wlist" id="resource_ref_pages" style="margin-top: 5px;">
<ul class="wlist" id="resource_ref_pages" style="margin-top: 5px;margin-right: 20px">
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
</div>

View File

@ -84,7 +84,9 @@
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布的作业:</span></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + '老师',
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :title => "#{ma.course_message.user.lastname + ma.course_message.user.firstname}老师" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布的作业:</span></li>
<li class="homepageHomeworkContent fl">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
@ -99,17 +101,17 @@
</p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>@nbsp;&nbsp;24点</span></p>
<p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>@nbsp;@nbsp;24点</span></p>
<p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p>
<p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;@&nbsp;24点</span></p>
<p>迟交扣分:<span style="color:Red;"><%= ma.course_message.late_penalty %>分</span></p>
<p>请同学们抓紧时间提交自己的作品,谢谢!</p>
<% else %>
<p><%= User.current.lastname + User.current.firstname %>老师您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:</p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>@nbsp;@nbsp;24点</span></p>
<p>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>@nbsp;@nbsp;24点</span></p>
<p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>@nbsp;@nbsp;24点</span></p>
<p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p>
<p>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>&nbsp;&nbsp;24点</span></p>
<p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点</span></p>
<p>迟交扣分:<span style="color:Red;"><%= ma.course_message.late_penalty %>分</span></p>
<p>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></p>
<p>您可以修改作业内容、评分规则、匿评过程等,谢谢!</p>

View File

@ -9,7 +9,7 @@
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %></span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.journals_for_message.notes.html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
<%= link_to ma.journals_for_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a>
</li>

View File

@ -7,6 +7,19 @@
homework_description_editor.html("");
$("#homework_editor").toggle();
}
// 点击 checkbox选中引用的资源的时候保存该资源的id到session里去
function store_seleted_resource(dom){
if(dom.attr('checked') == 'checked' ){
$.get(
'<%= store_selected_resource_user_path %>'+'?save=y&res_id='+dom.val()
)
}else {
$.get(
'<%= store_selected_resource_user_path %>'+'?save=n&res_id='+dom.val()
)
}
}
</script>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">作业</div>

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_resource',:locals => {:user => @user,:homework_id=>@homework_id}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_resource',:locals => {:user => @user,:homework_id=>@homework_id,:seleted_resources=>@seleted_resources}) %>');
showModal('ajax-modal', '730px');
$('#ajax-modal').css('height','500px').css("width","730px");
$('#ajax-modal').siblings().remove();

View File

@ -1,37 +1,4 @@
<div class="homepageRightBanner">
<div class="NewsBannerName"><%= title_for_message(params[:type]) %></div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<li><%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %></li>
<li><%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "resourcesGrey" %></li>
<li><%= link_to "系统消息", user_system_messages_path(User.current), :class => "resourcesGrey" %></li>
<li><%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %></li>
<li><%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %></li>
<li><%= link_to "课程通知",user_message_path(User.current, :type => 'course_news'), :class => "resourcesGrey" %></li>
<li><%= link_to "课程问卷", user_message_path(User.current, :type => 'poll'), :class => "resourcesGrey" %></a></li>
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li><%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "resourcesGrey" %></li>
<li><%= link_to "项目讨论", user_message_path(User.current, :type => 'forge_message'), :class => "resourcesGrey" %></li>
<li><%= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "resourcesGrey" %></li>
<li><%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %></li>
<li><%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %></li>
<%# 系统贴吧 %>
<li><%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<%= render :partial => 'users/selector_for_messages'%>
<div class="resources mt10" id="users_setting">
<div>
<% if (!@message_alls.nil? && @message_alls.count >0) %>

View File

@ -1,2 +1,2 @@
$("#user_ref_resources").html('<%= escape_javascript(render :partial => 'resources_list',:locals=>{:attachments => @attachments})%>');
$("#user_ref_resources").html('<%= escape_javascript(render :partial => 'homework_ref_resources_list',:locals=>{:attachments => @attachments,:seleted_resources=>@seleted_resources})%>');
$("#resource_ref_pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');

View File

@ -1,2 +1,2 @@
$("#user_ref_resources").html('<%= escape_javascript(render :partial => 'resources_list',:locals=>{:attachments => @attachments})%>');
$("#user_ref_resources").html('<%= escape_javascript(render :partial => 'homework_ref_resources_list',:locals=>{:attachments => @attachments,:seleted_resources=>@seleted_resources})%>');
$("#resource_ref_pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');

View File

@ -1,35 +1,4 @@
<div class="homepageRightBanner">
<div class="NewsBannerName">系统消息</div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="newsType">
<li><%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %></li>
<li><%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "resourcesGrey" %></li>
<li><%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %></li>
<%# 课程相关消息 %>
<li><%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %></li>
<li><%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %></li>
<li><%= link_to "课程通知",user_message_path(User.current, :type => 'course_news'), :class => "resourcesGrey" %></li>
<!--<li><%#= link_to "通知回复", user_message_path(User.current, :type => 'course_news_reply'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "课程问卷", user_message_path(User.current, :type => 'poll'), :class => "resourcesGrey" %></a></li>-->
<!--<li><%#= link_to "作品评阅", user_message_path(User.current, :type => 'works_reviewers'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "作品讨论", user_message_path(User.current, :type => 'works_reply'), :class => "resourcesGrey" %></li>-->
<%# 项目相关消息 %>
<li><%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "resourcesGrey" %></li>
<!--<li><%#= link_to "问题更新", user_message_path(User.current, :type => 'issue_update'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "项目讨论区", user_message_path(User.current, :type => 'forge_message'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "新闻回复", user_message_path(User.current, :type => 'forge_news_reply'), :class => "resourcesGrey" %></li>-->
<%# 项目相关消息 %>
<li><%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %></li>
<%# 系统贴吧 %>
<li><%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %></li>
<%# 系统消息 %>
<li><%= link_to "系统消息", user_system_messages_path(User.current), :class => "resourcesGrey" %></li>
</ul>
</li>
</ul>
</div>
<%= render :partial => 'users/selector_for_messages'%>
<% @sytem_messages.each do |system_message| %>
<div class="resources mt10">

View File

@ -386,6 +386,7 @@ RedmineApp::Application.routes.draw do
get 'user_resource_type'
get 'user_ref_resource_search'
post 'import_resources_to_homework'
get 'store_selected_resource'
# end
end
end

View File

@ -517,6 +517,24 @@ ActiveRecord::Schema.define(:version => 20150930011457) do
t.datetime "created_at"
t.datetime "updated_at"
t.integer "id", :null => false
=======
create_table "dts", :force => true do |t|
t.string "IPLineCode"
t.string "Description"
t.string "Num"
t.string "Variable"
t.string "TraceInfo"
t.string "Method"
t.string "File"
t.string "IPLine"
t.string "Review"
t.string "Category"
t.string "Defect"
t.string "PreConditions"
t.string "StartLine"
t.integer "project_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "enabled_modules", :force => true do |t|

View File

@ -13,7 +13,7 @@ class Kindeditor::AssetsController < ApplicationController
logger.warn '========= Warning: the owner_id is 0, "delete uploaded files automatically" will not work. =========' if defined?(logger) && @asset.owner_id == 0
@asset.asset_type = @dir
if @asset.save
render :text => ({:error => 0, :url => "http://"+Setting.host_name + "/" + @asset.asset.url,:asset_id => @asset.id}.to_json)
render :text => ({:error => 0, :url => @asset.asset.url,:asset_id => @asset.id}.to_json)
else
show_error(@asset.errors.full_messages)
end

View File

@ -277,7 +277,10 @@ https://github.com/layerssss/paste.js
if (!img["_paste_marked_" + timespan]) {
cb(img.src);
}
_results.push($(img).remove());
//firefox问题处理因为采用了 pastableContenteditable 模式,故只需要删除默认的粘贴
if ($(img).attr('src').startsWith('data:image/')) {
_results.push($(img).remove());
};
}
return _results;
};
@ -290,10 +293,9 @@ https://github.com/layerssss/paste.js
}).call(this);
function enablePasteImg(_editor) {
var editor = _editor,
KindEditor.plugin('paste', function(K) {
var editor = this,
name = 'paste';
//这样貌似多编辑器就不会冲突了
if(editor.edit == undefined || editor.edit.iframe == undefined){
return;
}
@ -303,7 +305,7 @@ function enablePasteImg(_editor) {
var nodeBody = contentWindow.document.getElementsByTagName('body')[0];
console.log(nodeBody);
$(nodeBody).pastableContenteditable();
dataURItoBlob = function(dataURI) {
// convert base64/URLEncoded data component to raw binary data held in a string
var byteString;
@ -329,7 +331,6 @@ function enablePasteImg(_editor) {
console.log("dataURL: " + data.dataURL);
console.log("width: " + data.width);
console.log("height: " + data.height);
console.log(data.blob);
var blob = dataURItoBlob(data.dataURL);
if (data.blob !== null) {
var data = new FormData();
@ -342,6 +343,7 @@ function enablePasteImg(_editor) {
data: data,
processData: false,
success: function(data) {
console.log(data);
editor.exec('insertimage', JSON.parse(data).url);
}
});
@ -349,37 +351,5 @@ function enablePasteImg(_editor) {
});
return;
contentWindow.document.getElementsByTagName('body')[0].onpaste = function(event) {
// use event.originalEvent.clipboard for newer chrome versions
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
console.log(JSON.stringify(items)); // will give you the mime types
// find pasted image among pasted items
var blob = null;
for (var i = 0; i < items.length; i++) {
if (items[i].type.indexOf("image") === 0) {
blob = items[i].getAsFile();
}
}
// load image if there is a pasted image
if (blob !== null) {
var reader = new FileReader();
reader.onload = function(event) {
console.log(event.target.result); // data url!
var data = new FormData();
data.append("imgFile", blob, "imageFilename.png");
console.log(blob);
$.ajax({
url: '/kindeditor/upload?dir=image',
contentType: false,
type: 'POST',
data: data,
processData: false,
success: function(data) {
editor.exec('insertimage', JSON.parse(data).url);
}
});
};
reader.readAsDataURL(blob);
}
}
};
});

View File

@ -277,7 +277,10 @@ https://github.com/layerssss/paste.js
if (!img["_paste_marked_" + timespan]) {
cb(img.src);
}
_results.push($(img).remove());
//firefox问题处理因为采用了 pastableContenteditable 模式,故只需要删除默认的粘贴
if ($(img).attr('src').startsWith('data:image/')) {
_results.push($(img).remove());
};
}
return _results;
};
@ -293,7 +296,6 @@ https://github.com/layerssss/paste.js
KindEditor.plugin('paste', function(K) {
var editor = this,
name = 'paste';
//这样貌似多编辑器就不会冲突了
if(editor.edit == undefined || editor.edit.iframe == undefined){
return;
}
@ -303,7 +305,7 @@ KindEditor.plugin('paste', function(K) {
var nodeBody = contentWindow.document.getElementsByTagName('body')[0];
console.log(nodeBody);
$(nodeBody).pastableContenteditable();
dataURItoBlob = function(dataURI) {
// convert base64/URLEncoded data component to raw binary data held in a string
var byteString;
@ -329,7 +331,6 @@ KindEditor.plugin('paste', function(K) {
console.log("dataURL: " + data.dataURL);
console.log("width: " + data.width);
console.log("height: " + data.height);
console.log(data.blob);
var blob = dataURItoBlob(data.dataURL);
if (data.blob !== null) {
var data = new FormData();
@ -342,6 +343,7 @@ KindEditor.plugin('paste', function(K) {
data: data,
processData: false,
success: function(data) {
console.log(data);
editor.exec('insertimage', JSON.parse(data).url);
}
});
@ -349,37 +351,5 @@ KindEditor.plugin('paste', function(K) {
});
return;
contentWindow.document.getElementsByTagName('body')[0].onpaste = function(event) {
// use event.originalEvent.clipboard for newer chrome versions
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
console.log(JSON.stringify(items)); // will give you the mime types
// find pasted image among pasted items
var blob = null;
for (var i = 0; i < items.length; i++) {
if (items[i].type.indexOf("image") === 0) {
blob = items[i].getAsFile();
}
}
// load image if there is a pasted image
if (blob !== null) {
var reader = new FileReader();
reader.onload = function(event) {
console.log(event.target.result); // data url!
var data = new FormData();
data.append("imgFile", blob, "imageFilename.png");
console.log(blob);
$.ajax({
url: '/kindeditor/upload?dir=image',
contentType: false,
type: 'POST',
data: data,
processData: false,
success: function(data) {
editor.exec('insertimage', JSON.parse(data).url);
}
});
};
reader.readAsDataURL(blob);
}
}
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -26,7 +26,7 @@ function init_editor(params){
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){
params.submit_btn.hide();
this.resize("95%", null);
}else if(edit.html().val().trim() != ""){
}else if(this.edit.html().trim() != ""){
params.submit_btn.show();
}

View File

@ -624,6 +624,15 @@ a.homepagePostTypeQuiz {background:url(../images/homepage_icon.png) -90px -124px
a.homepagePostTypeQuestion {background:url(../images/homepage_icon.png) -10px -273px no-repeat; padding-left:23px;}
a.homepagePostTypeMine {background:url(../images/homepage_icon.png) -187px -277px no-repeat; padding-left:23px;}
a.homepagePostTypeAll {background:url(../images/homepage_icon.png) -185px -308px no-repeat; padding-left:23px;}
.homepagePostTypeMore {width:180px; border-top:1px dashed #dddddd; margin-top:5px;}
.w100 {width:100px;}
a.homepageTypeUnread {background:url(../images/homepage_icon.png) -6px -579px no-repeat; padding-left:23px;}
a.homepageTypePTask {background:url(../images/homepage_icon.png) -176px -523px no-repeat; padding-left:23px;}
a.homepageTypeSystem {background:url(../images/homepage_icon.png) -88px -552px no-repeat; padding-left:23px;}
a.homepageTypePNews {background:url(../images/homepage_icon.png) -5px -553px no-repeat; padding-left:23px;}
a.homepageTypePost {background:url(../images/homepage_icon.png) -178px -553px no-repeat; padding-left:23px;}
a.homepageTypeUMessage {background:url(../images/homepage_icon.png) -4px -519px no-repeat; padding-left:23px;}
a.homepageTypeUApply {background:url(../images/homepage_icon.png) -91px -582px no-repeat; padding-left:23px;}
a.postTypeGrey {color:#888888;}
a.postTypeGrey:hover {color:#269ac9;}
.homepagePostBrief {width:710px; margin:0px auto; position:relative;}
@ -738,8 +747,8 @@ ul.list_watch{
.w450{width: 450px;}
/*引用资源库弹窗*/
.referenceResourcesPopup {width:710px; height:500px !important; border:3px solid #269ac9 !important; padding-left:20px; padding-right:20px; padding-bottom:35px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-375px; z-index:1000;}
.referenceText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight:bold;}
.referenceResourcesPopup {width:750px !important; height:500px !important; overflow: hidden !important; border:3px solid #269ac9 !important; padding-left:20px; padding-right:20px; padding-bottom:35px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-375px; z-index:1000;}
.referenceText {font-size:16px; color:#269ac9; line-height:16px; display:inline-block; font-weight:bold;}
.referenceSearchBox {border:1px solid #e6e6e6; width:235px; height:32px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;}
.searchReferencePopup {border:none; outline:none; background-color:#ffffff; width:190px; height:32px; padding-left:10px; display:inline-block; float:left;}
.referenceSearchIcon{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon2.png) -180px -270px no-repeat; display:inline-block; float:left;}

View File

@ -724,6 +724,10 @@ div.actions input[type="text"] {
word-wrap: break-word;
}
.memo-content li {
list-style-type: decimal;
}
.memo-timestamp {
position: absolute;
bottom: 0px;

View File

@ -624,8 +624,8 @@ a.loginChooseTab {color:#484848; height:30px; display:block;}
/*引用资源库弹窗*/
.popbox{position:fixed !important;left:50%;top:50%;margin:-100px 0 0 -150px; -moz-border-radius:5px;}
.referenceResourcesPopup {width:710px; height:500px !important; border:3px solid #269ac9 !important; padding-left:16px !important; padding-right:16px !important; padding-bottom:16px !important; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-375px; z-index:1000;}
.referenceText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight:bold;}
.referenceResourcesPopup {width:750px !important; height:500px !important; border:3px solid #269ac9 !important; padding-left:16px !important; padding-right:16px !important; padding-bottom:16px !important; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-375px; z-index:1000;}
.referenceText {font-size:16px; color:#269ac9; line-height:16px; display:inline-block; font-weight:bold;}
.referenceSearchBox {border:1px solid #e6e6e6; width:235px; height:32px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;}
.searchReferencePopup {border:none; outline:none; background-color:#ffffff; width:190px; height:32px; padding-left:10px; display:inline-block; float:left;}
.referenceSearchIcon{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon2.png) -180px -270px no-repeat; display:inline-block; float:left;}