diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a6554075f..86c220bd2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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? diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 17f179492..85c01bcbd 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -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 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 055c59f06..3de491421 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index f6b083b4d..2935d018a 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -68,8 +68,14 @@ module UsersHelper '课程讨论' when 'course_news' '课程通知' + when 'poll' + '课程问卷' when 'issue' '项目任务' + when 'forge_message' + '项目讨论' + when 'forge_news' + '项目新闻' when 'forum' '贴吧帖子' when 'user_feedback' diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index e2e1dcfc2..44b72868d 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -94,7 +94,7 @@ $('#reply_content_<%= activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); }); - <% if activity %> + <% if activity && activity.course_act%> <% act = activity.course_act %> <% case activity.course_act_type.to_s %> <% when 'HomeworkCommon' %> diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index bdf581baa..41ae5f335 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -1,7 +1,9 @@ +<% if course && tag_list.empty? == false%> - 全部 +<% end %> <% unless tag_list.nil?%> <% tag_list.each do |k,v|%> <% if tag_name && tag_name == k%> diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 656baaf63..782efbb22 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -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(''); + 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(''); - domEle.parent().css("border","1px solid #ffffff"); - $("#renameTagName").focus(); } //监听所有的单击事件 $(function(){ diff --git a/app/views/forums/_forum_tag_list.html.erb b/app/views/forums/_forum_tag_list.html.erb index b074cbca3..1cae58619 100644 --- a/app/views/forums/_forum_tag_list.html.erb +++ b/app/views/forums/_forum_tag_list.html.erb @@ -1,6 +1,6 @@ -<% forum.tag_list.each do |tag|%> +<% forum.reload.tag_list.each do |tag|%> - <%= tag %> + <%= tag %> <%if forum.creator.id == User.current.id%> × <% end %> diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 714d364a4..8314c3902 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -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; } diff --git a/app/views/layouts/base_forums.html.erb b/app/views/layouts/base_forums.html.erb index 8677bc705..d32fbf4ed 100644 --- a/app/views/layouts/base_forums.html.erb +++ b/app/views/layouts/base_forums.html.erb @@ -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('您确定要删除么?')){ diff --git a/app/views/memos/edit.html.erb b/app/views/memos/edit.html.erb index 1ac86cf55..7ab460555 100644 --- a/app/views/memos/edit.html.erb +++ b/app/views/memos/edit.html.erb @@ -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() != "" ){ diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 4224d0987..d6acabd9e 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -86,15 +86,15 @@
回复(<%=@reply_count %>)
-
- <% if @reply_count > 2%> - 点击展开更多回复 - <% end %> -
+ + + + +
<% @replies.each_with_index do |reply,i| %> -
+
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index c7f1d45c4..09544d004 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -21,6 +21,19 @@ ""); $('#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() + ) + } + }
diff --git a/app/views/users/_homework_ref_resources_list.html.erb b/app/views/users/_homework_ref_resources_list.html.erb new file mode 100644 index 000000000..356e412e7 --- /dev/null +++ b/app/views/users/_homework_ref_resources_list.html.erb @@ -0,0 +1,25 @@ + +<% if attachments.nil? || attachments.empty? %> + + + +<% else %> + <% attachments.each do |attach| %> +
    +
  • + value="<%= attach.id%>" class="resourcesCheckbox" /> +
  • +
  • + + <%= link_to truncate(attach.filename,:length=>30), download_named_attachment_path(attach.id, attach.filename), + :title => attach.filename,:class=>'resourcesBlack'%> +
  • +
  • <%= number_to_human_size(attach.filesize) %>
  • +
  • <%= get_resource_type(attach.container_type)%>
  • +
  • <%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %>
  • +
  • <%= attach.author_id %>
  • +
  • <%= format_date(attach.created_on) %>
  • +
  • <%= attach.id %>
  • +
+ <% end %> +<% end %> diff --git a/app/views/users/_selector_for_messages.html.erb b/app/views/users/_selector_for_messages.html.erb new file mode 100644 index 000000000..e7884fc60 --- /dev/null +++ b/app/views/users/_selector_for_messages.html.erb @@ -0,0 +1,41 @@ +
+
<%= title_for_message(params[:type]) %>
+
    +
  • +
      +
    • +
        +
      • 课程消息
      • +
      • <%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "homepagePostTypeAssignment postTypeGrey" %>
      • +
      • <%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "homepagePostTypeForum postTypeGrey" %>
      • +
      • <%= link_to "课程通知",user_message_path(User.current, :type => 'course_news'), :class => "homepagePostTypeNotice postTypeGrey" %>
      • +
      • <%= link_to "课程问卷", user_message_path(User.current, :type => 'poll'), :class => "homepagePostTypeQuiz postTypeGrey" %>
      • +
      +
    • + +
    • +
        +
      • 项目消息
      • +
      • <%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "homepageTypePTask postTypeGrey" %>
      • +
      • <%= link_to "项目讨论", user_message_path(User.current, :type => 'forge_message'), :class => "homepagePostTypeForum postTypeGrey" %>
      • +
      • <%= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "homepageTypePNews postTypeGrey" %>
      • +
      • <%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "homepageTypeUApply postTypeGrey" %>
      • +
      +
    • + +
      +
    • +
        +
      • 更多
      • +
      • <%= link_to "全部",user_message_path(User.current), :class => "resourcesTypeAll postTypeGrey" %>
      • +
      • <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "homepageTypeUnread postTypeGrey" %>
      • +
      • <%= link_to "系统消息", user_system_messages_path(User.current), :class => "homepageTypeSystem postTypeGrey" %>
      • +
      • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "homepageTypePost postTypeGrey" %>
      • +
      • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %>
      • +
      +
    • + +
    +
  • +
+
\ No newline at end of file diff --git a/app/views/users/_show_user_resource.html.erb b/app/views/users/_show_user_resource.html.erb index 929cea75b..6d985687c 100644 --- a/app/views/users/_show_user_resource.html.erb +++ b/app/views/users/_show_user_resource.html.erb @@ -51,10 +51,10 @@ <%= form_tag(import_resources_to_homework_user_path(user),:method => 'post',:remote=>'true') do %>
- <%= render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments} %> + <%= render :partial => 'homework_ref_resources_list' ,:locals=>{ :attachments => @attachments,:seleted_resources=>seleted_resources} %>
-
    +
      <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index fee28f761..1b9b175ea 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -84,7 +84,9 @@ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
  • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
  • -
  • <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">发布的作业:
  • +
  • <%=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}老师" %> + ">发布的作业:
  • <%= 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 @@

    课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)

    作业标题:<%= ma.course_message.name %>

    -

    提交截止:<%= ma.course_message.end_time %>@nbsp; 24点

    -

    匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %>@nbsp;@nbsp;24点

    +

    提交截止:<%= ma.course_message.end_time %>  24点

    +

    匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> @ 24点

    迟交扣分:<%= ma.course_message.late_penalty %>分

    请同学们抓紧时间提交自己的作品,谢谢!

    <% else %>

    <%= User.current.lastname + User.current.firstname %>老师您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:

    课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)

    作业标题:<%= ma.course_message.name %>

    -

    提交截止:<%= ma.course_message.end_time %>@nbsp;@nbsp;24点

    -

    匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %>@nbsp;@nbsp;24点

    -

    匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %>@nbsp;@nbsp;24点

    +

    提交截止:<%= ma.course_message.end_time %>  24点

    +

    匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %>  24点

    +

    匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %>  24点

    迟交扣分:<%= ma.course_message.late_penalty %>分

    缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分

    您可以修改作业内容、评分规则、匿评过程等,谢谢!

    diff --git a/app/views/users/_user_message_userfeedaback.html.erb b/app/views/users/_user_message_userfeedaback.html.erb index 672dfda64..23a0774c3 100644 --- a/app/views/users/_user_message_userfeedaback.html.erb +++ b/app/views/users/_user_message_userfeedaback.html.erb @@ -9,7 +9,7 @@ "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
  • - <%= 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("

    ","").gsub("

    ","").gsub("
    ","").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))" %>
  • diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb index 7b212101c..8b9f4cb0a 100644 --- a/app/views/users/user_homeworks.html.erb +++ b/app/views/users/user_homeworks.html.erb @@ -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() + ) + } + }
    作业
    diff --git a/app/views/users/user_import_resource.js.erb b/app/views/users/user_import_resource.js.erb index 0e35acd95..87324669e 100644 --- a/app/views/users/user_import_resource.js.erb +++ b/app/views/users/user_import_resource.js.erb @@ -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(); diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index d0f7bb9bb..f83e5617c 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -1,37 +1,4 @@ -
    -
    <%= title_for_message(params[:type]) %>
    -
      -
    • -
        -
      • -
          -
        • <%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %>
        • -
        • <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "resourcesGrey" %>
        • -
        • <%= link_to "系统消息", user_system_messages_path(User.current), :class => "resourcesGrey" %>
        • - -
        • <%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %>
        • -
        • <%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %>
        • -
        • <%= link_to "课程通知",user_message_path(User.current, :type => 'course_news'), :class => "resourcesGrey" %>
        • -
        • <%= link_to "课程问卷", user_message_path(User.current, :type => 'poll'), :class => "resourcesGrey" %>
        • -
        -
      • - -
      • -
          -
        • <%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "resourcesGrey" %>
        • -
        • <%= link_to "项目讨论", user_message_path(User.current, :type => 'forge_message'), :class => "resourcesGrey" %>
        • -
        • <%= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "resourcesGrey" %>
        • -
        • <%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %>
        • - -
        • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %>
        • - <%# 系统贴吧 %> -
        • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %>
        • -
        -
      • -
      -
    • -
    -
    +<%= render :partial => 'users/selector_for_messages'%>
    <% if (!@message_alls.nil? && @message_alls.count >0) %> diff --git a/app/views/users/user_ref_resource_search.js.erb b/app/views/users/user_ref_resource_search.js.erb index 52f54bee4..8651768a5 100644 --- a/app/views/users/user_ref_resource_search.js.erb +++ b/app/views/users/user_ref_resource_search.js.erb @@ -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 %>'); \ No newline at end of file diff --git a/app/views/users/user_resource_type.js.erb b/app/views/users/user_resource_type.js.erb index 52f54bee4..8651768a5 100644 --- a/app/views/users/user_resource_type.js.erb +++ b/app/views/users/user_resource_type.js.erb @@ -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 %>'); \ No newline at end of file diff --git a/app/views/users/user_system_messages.html.erb b/app/views/users/user_system_messages.html.erb index 899cd7a8f..64b0dff0c 100644 --- a/app/views/users/user_system_messages.html.erb +++ b/app/views/users/user_system_messages.html.erb @@ -1,35 +1,4 @@ -
    -
    系统消息
    -
      -
    • -
        -
      • <%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %>
      • -
      • <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "resourcesGrey" %>
      • -
      • <%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %>
      • - <%# 课程相关消息 %> -
      • <%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %>
      • -
      • <%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %>
      • -
      • <%= link_to "课程通知",user_message_path(User.current, :type => 'course_news'), :class => "resourcesGrey" %>
      • - - - - - <%# 项目相关消息 %> -
      • <%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "resourcesGrey" %>
      • - - - - - <%# 项目相关消息 %> -
      • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %>
      • - <%# 系统贴吧 %> -
      • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %>
      • - <%# 系统消息 %> -
      • <%= link_to "系统消息", user_system_messages_path(User.current), :class => "resourcesGrey" %>
      • -
      -
    • -
    -
    +<%= render :partial => 'users/selector_for_messages'%> <% @sytem_messages.each do |system_message| %>
    diff --git a/config/routes.rb b/config/routes.rb index d6c36212a..2e02cd3d2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 8cc69e7f1..2beeba5f2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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| diff --git a/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb b/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb index d7d5948d4..0e1177563 100644 --- a/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb +++ b/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb @@ -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 diff --git a/public/assets/kindeditor/pasteimg.js b/public/assets/kindeditor/pasteimg.js index c413bbcb9..767cefb09 100644 --- a/public/assets/kindeditor/pasteimg.js +++ b/public/assets/kindeditor/pasteimg.js @@ -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); - } - } -}; + +}); diff --git a/public/assets/kindeditor/plugins/paste/paste.js b/public/assets/kindeditor/plugins/paste/paste.js index 943c0bbe7..767cefb09 100644 --- a/public/assets/kindeditor/plugins/paste/paste.js +++ b/public/assets/kindeditor/plugins/paste/paste.js @@ -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); - } - } + }); diff --git a/public/images/homepage_icon.png b/public/images/homepage_icon.png index a8548b1bc..9f2212ff0 100644 Binary files a/public/images/homepage_icon.png and b/public/images/homepage_icon.png differ diff --git a/public/javascripts/init_activity_KindEditor.js b/public/javascripts/init_activity_KindEditor.js index decbbb341..ac914ca19 100644 --- a/public/javascripts/init_activity_KindEditor.js +++ b/public/javascripts/init_activity_KindEditor.js @@ -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(); } diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 5b187fa2d..ee284683f 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -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;} diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index b64e60831..b476210b1 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -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; diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 89073a8f8..c6ce61251 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -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;}