- <%= 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") %>
diff --git a/app/views/users/_user_at_message.html.erb b/app/views/users/_user_at_message.html.erb
index 343741cd4..d8649cabe 100644
--- a/app/views/users/_user_at_message.html.erb
+++ b/app/views/users/_user_at_message.html.erb
@@ -1,33 +1,33 @@
-<% if AtMessage === ma && ma.at_valid? %>
-
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb
index 244951dfa..841fd9377 100644
--- a/app/views/users/_user_blog.html.erb
+++ b/app/views/users/_user_blog.html.erb
@@ -1,147 +1,147 @@
-
+
diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb
index 8503b564c..a196ee6c0 100644
--- a/app/views/users/_user_homework_detail.html.erb
+++ b/app/views/users/_user_homework_detail.html.erb
@@ -360,7 +360,7 @@
<%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %>
<% end%>
diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb
index f49a65262..dde4f34ce 100644
--- a/app/views/users/_user_journalsformessage.html.erb
+++ b/app/views/users/_user_journalsformessage.html.erb
@@ -1,152 +1,152 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
-
-
-
- <%= link_to activity.user.show_name, user_path(activity.user_id), :class => "newsBlue mr15" %>
- TO
- <% if activity.jour %>
- <%= link_to activity.jour.show_name+"("+(activity.jour.login ? activity.jour.login : activity.jour.show_name ).to_s+")的"+ (activity.private == 1? "私信":"留言"),
- feedback_path(activity.jour, :host=> Setting.host_user), :class => "newsBlue ml15" %>
- <% if activity.private == 1 %>
- 私信
- <% end %>
- <% end %>
-
- <% if is_activity.to_i == 1 %>
-
- <% if activity.parent %>
- <%= link_to activity.parent.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
- <% else %>
- <%= link_to activity.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
- <% end %>
-
- <% else %>
- <% if activity.parent %>
- <% content = activity.parent.notes %>
- <% else %>
- <% content = activity.notes %>
- <% end %>
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
- <% end %>
-
- 留言时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
-
-
- <% if activity.user == User.current || User.current.admin?%>
-
-
-
-
-
- <%= link_to(l(:label_bid_respond_delete),
- {:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id,:is_activity=>is_activity},
- :confirm => l(:text_are_you_sure), :method => 'delete',
- :class => "postOptionLink", :title => l(:button_delete)) %>
-
-
-
-
-
- <% end%>
-
-
-
- <% count=fetch_user_leaveWord_reply(activity).count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.user == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %>
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:user).try(:realname) == ' ' %>
- <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
- <%= comment.notes.html_safe %>
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id},:method => "post", :remote => true) do |f|%>
- <%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %>
- <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %>
- <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
- <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
- <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
- <%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %>
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
+
+
+
+ <%= link_to activity.user.show_name, user_path(activity.user_id), :class => "newsBlue mr15" %>
+ TO
+ <% if activity.jour %>
+ <%= link_to activity.jour.show_name+"("+(activity.jour.login ? activity.jour.login : activity.jour.show_name ).to_s+")的"+ (activity.private == 1? "私信":"留言"),
+ feedback_path(activity.jour, :host=> Setting.host_user), :class => "newsBlue ml15" %>
+ <% if activity.private == 1 %>
+ 私信
+ <% end %>
+ <% end %>
+
+ <% if is_activity.to_i == 1 %>
+
+ <% if activity.parent %>
+ <%= link_to activity.parent.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
+ <% else %>
+ <%= link_to activity.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
+ <% end %>
+
+ <% else %>
+ <% if activity.parent %>
+ <% content = activity.parent.notes %>
+ <% else %>
+ <% content = activity.notes %>
+ <% end %>
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
+ <% end %>
+
+ 留言时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
+
+
+ <% if activity.user == User.current || User.current.admin?%>
+
+
+
+
+
+ <%= link_to(l(:label_bid_respond_delete),
+ {:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id,:is_activity=>is_activity},
+ :confirm => l(:text_are_you_sure), :method => 'delete',
+ :class => "postOptionLink", :title => l(:button_delete)) %>
+
+
+
+
+
+ <% end%>
+
+
+
+ <% count=fetch_user_leaveWord_reply(activity).count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.user == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %>
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:user).try(:realname) == ' ' %>
+ <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+ <%= comment.notes.html_safe %>
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id},:method => "post", :remote => true) do |f|%>
+ <%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %>
+ <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %>
+ <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
+ <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
+ <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
+ <%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %>
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb
index bb9fc1174..62568d505 100644
--- a/app/views/users/_user_message_course.html.erb
+++ b/app/views/users/_user_message_course.html.erb
@@ -1,692 +1,692 @@
-<% if ma.class == CourseMessage %>
- <% if ma.course_message_type == "News" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author) %>
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">发布了通知:
-
- <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
标题: <%= ma.course_message.title %>
- <% unless ma.course_message.description.nil? %>
-
内容:
-
<%= ma.course_message.description.html_safe %>
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "Comment" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">评论了通知:
-
- <%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
评论对象: <%= ma.course_message.commented.title %>
- <% unless ma.course_message.comments.nil? %>
-
评论内容:
-
<%= ma.course_message.comments.html_safe %>
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil?%>
-
- <%=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.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">发布了课程作业:
-
-
- <% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
- <%= link_to "作业标题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
- <% else %>
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
- <% end %>
-
-
- <% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
-
- <%= User.current.lastname + User.current.firstname %>老师您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
-
-
- 课程名称:<%= ma.course_message.course.name %>
- (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 发布时间:<%= DateTime.parse(ma.course_message.created_at.to_s).strftime('%Y-%m-%d %H:%M').to_s %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_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.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
-
-
- 请抓紧时间提交您的作品,谢谢!
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% 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.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"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
-
- <%= 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.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
- 请抓紧时间提交您的作品,谢谢!
-
- <% end %>
-
- 截止时间快到啦
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
-
-
- <%= 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.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">启动了作业匿评:
-
-
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师' : '同学' %>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>开启了匿评,作业详情如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
- 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
-
- <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
-
请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。
-
例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分
- <% end%>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
-
- <%=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.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">关闭了作业匿评:
-
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))"%>
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- 该作业已经关闭了匿评。作业信息如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
-
-
-
注:缺省情况下,系统将在作业提交截止日期后14天自动关闭匿评。
-
- <% if User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
-
祝您的教学活动高效、顺利、愉快!
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
-
-
- <%= 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.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">启动作业匿评失败
-
-
- <%= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因:提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败啦
-
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time%> 23:59
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "Poll" %>
-
- <%=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 format_activity_title(" #{ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name}"), poll_path(ma.course_message.id),
- :class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
- <%= ma.course_message.polls_name %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "Message" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
-
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">
- <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %>
- <% if ma.course_message.parent_id.nil? %>
-
- <%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
主题: <%= ma.course_message.subject %>
- <% unless ma.course_message.content.nil? %>
-
内容:
-
<%= ma.course_message.content.html_safe %>
- <% end %>
-
- <% else %>
-
- <%= link_to ma.course_message.content.html_safe, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
主题: <%= ma.course_message.subject %>
- <% unless ma.course_message.content.nil? %>
-
内容:
-
<%= ma.course_message.content.html_safe %>
- <% end %>
-
- <% end %>
- <%= time_tag(ma.created_at).html_safe %>
-
-
- <% end %>
- <% if ma.course_message_type == "StudentWorksScore" %>
-
-
- <% if ma.course_message.reviewer_role == 3 %>
- <%=link_to image_tag(url_to_avatar(""), :width => "30", :height => "30") %>
- <% else %>
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <% end %>
-
-
- <% if ma.course_message.reviewer_role == 3 %>
- 匿名用户
- <% else %>
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- <% end %>
- ">
- <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %>
-
-
-
- <% unless ma.content.nil? %>
- <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <%= User.current.show_name %>同学您好!
- <%= ma.course_message.reviewer_role == 3? "匿名用户" : (ma.course_message.user.show_name + "老师")%><%= ma.status == 0? "评阅了您的作品":"重新评阅了您的作品"%>。详情如下:
-
-
- 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
- 作业标题:<%=ma.course_message.student_work.homework_common.name %>
- <% content = ma.content.gsub("作业评分:","").split(" 评语:")%>
- 作品评分:<%= content[0] %>分
- <% if content.size > 1 %>
-
作品评语:
- <%= content[1] %>
- <% end %>
-
-
- 本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 23:59结束匿评,到时您将可以看到所有其他同学的作品啦!大家可以进一步互相学习。 期待您取得更大的进步!
-
-
- <% end %>
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "JournalsForMessage" %>
- <% if ma.course_message.jour_type == 'Course' %>
- <% if params[:type] != 'homework' %>
-
-
- <%= 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.notes.html_safe, course_feedback_path(:id => ma.course_id),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <%= ma.course_message.notes.html_safe %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% else %>
-
-
- <%= 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.lastname + ma.course_message.user.firstname +
- "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">回复了作品评论:
-
-
- <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.show_name %>老师您好!
- <%= ma.course_message.user.show_name%><%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"%>回复了您的作品评论。详情如下:
-
-
- 回复内容:<%= ma.course_message.notes %>
- 您的评论:<%= ma.course_message.jour.comment %>
- 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
- 作业标题:<%=ma.course_message.jour.student_work.homework_common.name %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% end %>
-
- <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? %>
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user) %>
-
- <%=link_to ma.course_message.homework_common.user.show_name+"老师", user_path(ma.course_message.homework_common.user), :class => "newsBlue homepageNewsPublisher" %>
- ">发布的作业:
-
-
- <%= link_to "作业标题:" + ma.course_message.homework_common.name, student_work_index_path(:homework => ma.course_message.homework_common_id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %>
- <%= User.current.allowed_to?(:as_teacher,ma.course_message.homework_common.course) ? '老师':'同学'%>您好!由于迟交作业,您及您的作品都不能参与以下作业的匿评。作业详情如下:
-
-
- 课程名称:<%= ma.course_message.homework_common.course.name %>(<%= ma.course_message.homework_common.course.time.to_s + '年' + ma.course_message.homework_common.course.term %>)
- 作业标题:<%= ma.course_message.homework_common.name %>
- 提交截止:<%= ma.course_message.homework_common.end_time %> 23:59
- 提交时间:<%= format_time(ma.course_message.created_at) %>
- 迟交扣分:<%= ma.course_message.homework_common.late_penalty %>分
-
-
如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!
-
- 您成功提交了作品(但被标记为迟交啦)
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "Course" %>
-
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
-
- 系统提示
- ">您成功创建了课程:
-
-
- <%= link_to "课程名称:" + ma.course_message.name, course_path(ma.course_message),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <%= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个课程,详情如下:
-
-
课程名称:<%= ma.course_message.name %>
-
开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %>
-
课程ID:<%= ma.course_message.id %>
-
课程密码:<%= ma.course_message.password %>
-
学时总数:<%= ma.course_message.class_period %>
-
创建时间:<%= format_time(ma.course_message.created_at) %>
-
您可以点击左上角的“配置”按钮,修改课程基本信息,添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员,让他们输入ID及密码加入课程。
- <% if ma.course_message.is_public %>
-
您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。
- <% else %>
-
您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "JoinCourseRequest" %>
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
- 系统提示
- ">您有了新的课程成员申请:
-
-
- <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %>老师您好!您有了新的课程成员申请,信息如下:
-
-
真实姓名:<%= User.find(ma.course_message_id).realname %>
-
申请课程:<%= Course.find(ma.course_id).name%>
-
课程描述:
-
<%= Course.find(ma.course_id).description.html_safe %>
-
申请职位:<%= ma.content == '9' ? "教师" : "教辅"%>
-
-
-
- <% if ma.status == 0 || ma.status.nil?%>
- <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%>
- |
- <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%>
- <% elsif ma.status == 1%>
- 您已经同意了该申请
- <% elsif ma.status == 2%>
- 您已经拒绝了该申请
- <%end %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "CourseRequestDealResult" %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
-
-
- <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
-
-
- <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
- ">将您加入了课程:
-
-
- <%= link_to ma.course.name, course_member_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
- <% teacher = User.find(ma.course_message_id) %>
-
<%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
-
课程ID:<%= ma.course.id %>
-
课时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
-
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
-
- 系统提示
- ">您增加了新的课程成员:
-
-
- <%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
-
您增加了新的课程成员,详情如下:
-
成员:<%= User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")" %>
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
-
课程ID:<%= ma.course.id %>
-
课时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "RemoveFromCourse" %>
-
-
- <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
-
-
- <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
- ">将您移出了课程:
-
-
- <%= link_to ma.course.name, member_course_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
-
您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
- <% if !ma.content.nil? %>
-
担任角色:<%= ma.content %>
- <% end %>
-
学时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "Exercise" && ma.status == 2 %>
-
- <%=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.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布了课程测验 :
-
- <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))"%>
-
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布了课程测验 ,测验详情如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 测验标题:<%= ma.course_message.exercise_name %>
-
-
-
-
-
- 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
- 答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
- <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
- 请记得在截止时间前完成测验噢,辛苦啦!
- <% end %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "Exercise" && ma.status == 3 %>
-
- <%=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.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布的测验:
-
- <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))"%>
-
-
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布的课程测验截止时间快到了,测验详情如下:
-
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 测验标题:<%= ma.course_message.exercise_name %>
- 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
- 答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
- 请及时完成课程测验,辛苦啦!
-
-
- 截止时间快到啦
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
+<% if ma.class == CourseMessage %>
+ <% if ma.course_message_type == "News" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author) %>
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">发布了通知:
+
+ <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
标题: <%= ma.course_message.title %>
+ <% unless ma.course_message.description.nil? %>
+
内容:
+
<%= ma.course_message.description.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Comment" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">评论了通知:
+
+ <%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
评论对象: <%= ma.course_message.commented.title %>
+ <% unless ma.course_message.comments.nil? %>
+
评论内容:
+
<%= ma.course_message.comments.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil?%>
+
+ <%=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.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">发布了课程作业:
+
+
+ <% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
+ <%= link_to "作业标题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+ <% else %>
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
+ :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+ <% end %>
+
+
+ <% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
+
+
+ 课程名称:<%= ma.course_message.course.name %>
+ (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 发布时间:<%= DateTime.parse(ma.course_message.created_at.to_s).strftime('%Y-%m-%d %H:%M').to_s %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_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.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+
+
+ 请抓紧时间提交您的作品,谢谢!
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% 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.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"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
+
+ <%= 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.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+ 请抓紧时间提交您的作品,谢谢!
+
+ <% end %>
+
+ 截止时间快到啦
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
+
+
+ <%= 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.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">启动了作业匿评:
+
+
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师' : '同学' %>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>开启了匿评,作业详情如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+ 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+
+ <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
+
请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。
+
例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分
+ <% end%>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
+
+ <%=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.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">关闭了作业匿评:
+
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))"%>
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ 该作业已经关闭了匿评。作业信息如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+
+
+
注:缺省情况下,系统将在作业提交截止日期后14天自动关闭匿评。
+
+ <% if User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
+
祝您的教学活动高效、顺利、愉快!
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
+
+
+ <%= 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.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">启动作业匿评失败
+
+
+ <%= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因:提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败啦
+
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time%> 23:59
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "Poll" %>
+
+ <%=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 format_activity_title(" #{ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name}"), poll_path(ma.course_message.id),
+ :class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+ <%= ma.course_message.polls_name %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Message" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
+
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">
+ <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %>
+ <% if ma.course_message.parent_id.nil? %>
+
+ <%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
主题: <%= ma.course_message.subject %>
+ <% unless ma.course_message.content.nil? %>
+
内容:
+
<%= ma.course_message.content.html_safe %>
+ <% end %>
+
+ <% else %>
+
+ <%= link_to ma.course_message.content.html_safe, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
主题: <%= ma.course_message.subject %>
+ <% unless ma.course_message.content.nil? %>
+
内容:
+
<%= ma.course_message.content.html_safe %>
+ <% end %>
+
+ <% end %>
+ <%= time_tag(ma.created_at).html_safe %>
+
+
+ <% end %>
+ <% if ma.course_message_type == "StudentWorksScore" %>
+
+
+ <% if ma.course_message.reviewer_role == 3 %>
+ <%=link_to image_tag(url_to_avatar(""), :width => "30", :height => "30") %>
+ <% else %>
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+ <% end %>
+
+
+ <% if ma.course_message.reviewer_role == 3 %>
+ 匿名用户
+ <% else %>
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ <% end %>
+ ">
+ <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %>
+
+
+
+ <% unless ma.content.nil? %>
+ <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <%= User.current.show_name %>同学您好!
+ <%= ma.course_message.reviewer_role == 3? "匿名用户" : (ma.course_message.user.show_name + "老师")%><%= ma.status == 0? "评阅了您的作品":"重新评阅了您的作品"%>。详情如下:
+
+
+ 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
+ 作业标题:<%=ma.course_message.student_work.homework_common.name %>
+ <% content = ma.content.gsub("作业评分:","").split(" 评语:")%>
+ 作品评分:<%= content[0] %>分
+ <% if content.size > 1 %>
+
作品评语:
+ <%= content[1] %>
+ <% end %>
+
+
+ 本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 23:59结束匿评,到时您将可以看到所有其他同学的作品啦!大家可以进一步互相学习。 期待您取得更大的进步!
+
+
+ <% end %>
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "JournalsForMessage" %>
+ <% if ma.course_message.jour_type == 'Course' %>
+ <% if params[:type] != 'homework' %>
+
+
+ <%= 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.notes.html_safe, course_feedback_path(:id => ma.course_id),
+ :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <%= ma.course_message.notes.html_safe %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% else %>
+
+
+ <%= 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.lastname + ma.course_message.user.firstname +
+ "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">回复了作品评论:
+
+
+ <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.show_name %>老师您好!
+ <%= ma.course_message.user.show_name%><%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"%>回复了您的作品评论。详情如下:
+
+
+ 回复内容:<%= ma.course_message.notes %>
+ 您的评论:<%= ma.course_message.jour.comment %>
+ 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
+ 作业标题:<%=ma.course_message.jour.student_work.homework_common.name %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% end %>
+
+ <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? %>
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user) %>
+
+ <%=link_to ma.course_message.homework_common.user.show_name+"老师", user_path(ma.course_message.homework_common.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">发布的作业:
+
+
+ <%= link_to "作业标题:" + ma.course_message.homework_common.name, student_work_index_path(:homework => ma.course_message.homework_common_id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.lastname + User.current.firstname %>
+ <%= User.current.allowed_to?(:as_teacher,ma.course_message.homework_common.course) ? '老师':'同学'%>您好!由于迟交作业,您及您的作品都不能参与以下作业的匿评。作业详情如下:
+
+
+ 课程名称:<%= ma.course_message.homework_common.course.name %>(<%= ma.course_message.homework_common.course.time.to_s + '年' + ma.course_message.homework_common.course.term %>)
+ 作业标题:<%= ma.course_message.homework_common.name %>
+ 提交截止:<%= ma.course_message.homework_common.end_time %> 23:59
+ 提交时间:<%= format_time(ma.course_message.created_at) %>
+ 迟交扣分:<%= ma.course_message.homework_common.late_penalty %>分
+
+
如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!
+
+ 您成功提交了作品(但被标记为迟交啦)
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "Course" %>
+
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+
+ 系统提示
+ ">您成功创建了课程:
+
+
+ <%= link_to "课程名称:" + ma.course_message.name, course_path(ma.course_message),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个课程,详情如下:
+
+
课程名称:<%= ma.course_message.name %>
+
开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %>
+
课程ID:<%= ma.course_message.id %>
+
课程密码:<%= ma.course_message.password %>
+
学时总数:<%= ma.course_message.class_period %>
+
创建时间:<%= format_time(ma.course_message.created_at) %>
+
您可以点击左上角的“配置”按钮,修改课程基本信息,添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员,让他们输入ID及密码加入课程。
+ <% if ma.course_message.is_public %>
+
您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。
+ <% else %>
+
您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "JoinCourseRequest" %>
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+ 系统提示
+ ">您有了新的课程成员申请:
+
+
+ <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!您有了新的课程成员申请,信息如下:
+
+
真实姓名:<%= User.find(ma.course_message_id).realname %>
+
申请课程:<%= Course.find(ma.course_id).name%>
+
课程描述:
+
<%= Course.find(ma.course_id).description.html_safe %>
+
申请职位:<%= ma.content == '9' ? "教师" : "教辅"%>
+
+
+
+ <% if ma.status == 0 || ma.status.nil?%>
+ <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%>
+ |
+ <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%>
+ <% elsif ma.status == 1%>
+ 您已经同意了该申请
+ <% elsif ma.status == 2%>
+ 您已经拒绝了该申请
+ <%end %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "CourseRequestDealResult" %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
+
+
+ <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
+
+
+ <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
+ ">将您加入了课程:
+
+
+ <%= link_to ma.course.name, course_member_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
+ <% teacher = User.find(ma.course_message_id) %>
+
<%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+
课程ID:<%= ma.course.id %>
+
课时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
+
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+
+ 系统提示
+ ">您增加了新的课程成员:
+
+
+ <%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
+
您增加了新的课程成员,详情如下:
+
成员:<%= User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")" %>
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+
课程ID:<%= ma.course.id %>
+
课时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "RemoveFromCourse" %>
+
+
+ <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
+
+
+ <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
+ ">将您移出了课程:
+
+
+ <%= link_to ma.course.name, member_course_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
+
您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+ <% if !ma.content.nil? %>
+
担任角色:<%= ma.content %>
+ <% end %>
+
学时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "Exercise" && ma.status == 2 %>
+
+ <%=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.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布了课程测验 :
+
+ <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))"%>
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布了课程测验 ,测验详情如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 测验标题:<%= ma.course_message.exercise_name %>
+
+
+
+
+
+ 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
+ 答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
+ <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
+ 请记得在截止时间前完成测验噢,辛苦啦!
+ <% end %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "Exercise" && ma.status == 3 %>
+
+ <%=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.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布的测验:
+
+ <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))"%>
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布的课程测验截止时间快到了,测验详情如下:
+
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 测验标题:<%= ma.course_message.exercise_name %>
+ 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
+ 答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
+ 请及时完成课程测验,辛苦啦!
+
+
+ 截止时间快到啦
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_message_userfeedaback.html.erb b/app/views/users/_user_message_userfeedaback.html.erb
index 23a0774c3..6bc169f21 100644
--- a/app/views/users/_user_message_userfeedaback.html.erb
+++ b/app/views/users/_user_message_userfeedaback.html.erb
@@ -1,30 +1,30 @@
-<% if ma.class == UserFeedbackMessage %>
- <% if ma.journals_for_message_type == "JournalsForMessage" %>
-
-
- <%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user) %>
-
-
- <%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher" %>
- "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
-
-
- <%= 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))" %>
-
-
- <% if ma.journals_for_message.reply_id == 0 %>
- <%= ma.journals_for_message.notes.html_safe %>
- <% else %>
-
您的留言:
-
<%= JournalsForMessage.find(ma.journals_for_message.m_reply_id).notes.html_safe %>
-
回复内容:
-
<%= ma.journals_for_message.notes.html_safe %>
- <% end %>
-
- <%= time_tag(ma.journals_for_message.created_on).html_safe %>
-
-
- <% end %>
+<% if ma.class == UserFeedbackMessage %>
+ <% if ma.journals_for_message_type == "JournalsForMessage" %>
+
+
+ <%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user) %>
+
+
+ <%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
+
+
+ <%= 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))" %>
+
+
+ <% if ma.journals_for_message.reply_id == 0 %>
+ <%= ma.journals_for_message.notes.html_safe %>
+ <% else %>
+
您的留言:
+
<%= JournalsForMessage.find(ma.journals_for_message.m_reply_id).notes.html_safe %>
+
回复内容:
+
<%= ma.journals_for_message.notes.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.journals_for_message.created_on).html_safe %>
+
+
+ <% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/welcome/_search_attachment_results.html.erb b/app/views/welcome/_search_attachment_results.html.erb
index 21ba68336..e51706085 100644
--- a/app/views/welcome/_search_attachment_results.html.erb
+++ b/app/views/welcome/_search_attachment_results.html.erb
@@ -21,6 +21,6 @@
<% end %>
<% end %>
\ No newline at end of file
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 2bed45103..3da533eb7 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1520,6 +1520,9 @@ en:
label_submit_comments: Submit_comments
label_course_empty_select: You have not selected course!
label_enterprise_page_made: enterprise_page
+ label_excellent_courses_list: excellent_courses
+ label_course_resource_list: course_resource_list
+ label_project_resource_list: project_resource_list
#api
label_recently_updated_notification: Recently updated notification
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 114e67370..37d26dbd8 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -483,6 +483,9 @@ zh:
label_requirement: 需求
label_new_course: 课程列表
label_course_all: 课程列表
+ label_excellent_courses_list: 精品课程列表
+ label_course_resource_list: 课程资源列表
+ label_project_resource_list: 項目资源列表
label_teacher_all: 所有教师
label_requirement_enterprise_list: 众包列表
label_new_homework: 作业
diff --git a/config/routes.rb b/config/routes.rb
index 2730fac3e..bde12fa59 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -939,6 +939,9 @@ RedmineApp::Application.routes.draw do
match 'admin', :to => 'admin#index', :via => :get
match 'admin/projects', :via => :get
get 'admin/courses'
+ get 'admin/excellent_courses'
+ get 'admin/course_resource_list'
+ get 'admin/project_resource_list'
match 'admin/users', :via => :get
match 'admin/messages', :via => :get
match 'admin/first_page_made', as: :first_page_made
diff --git a/db/migrate/20160309024051_update_homework_common_updated_at.rb b/db/migrate/20160309024051_update_homework_common_updated_at.rb
index 89a0e992d..37accdc6e 100644
--- a/db/migrate/20160309024051_update_homework_common_updated_at.rb
+++ b/db/migrate/20160309024051_update_homework_common_updated_at.rb
@@ -1,18 +1,18 @@
-class UpdateHomeworkCommonUpdatedAt < ActiveRecord::Migration
- def up
- count = HomeworkCommon.all.count / 30 + 2
- transaction do
- for i in 1 ... count do i
- HomeworkCommon.page(i).per(30).each do |hw|
- ca = CourseActivity.where("course_act_type = 'HomeworkCommon' and course_act_id = #{hw.id}").first
- unless ca.nil?
- hw.update_attributes(:updated_at => ca.updated_at)
- end
- end
- end
- end
- end
-
- def down
- end
-end
+class UpdateHomeworkCommonUpdatedAt < ActiveRecord::Migration
+ def up
+ count = HomeworkCommon.all.count / 30 + 2
+ transaction do
+ for i in 1 ... count do i
+ HomeworkCommon.page(i).per(30).each do |hw|
+ ca = CourseActivity.where("course_act_type = 'HomeworkCommon' and course_act_id = #{hw.id}").first
+ unless ca.nil?
+ hw.update_attributes(:updated_at => ca.updated_at)
+ end
+ end
+ end
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20160309072649_update_contributor_after_delete.rb b/db/migrate/20160309072649_update_contributor_after_delete.rb
index 33d89b113..01f91105a 100644
--- a/db/migrate/20160309072649_update_contributor_after_delete.rb
+++ b/db/migrate/20160309072649_update_contributor_after_delete.rb
@@ -1,50 +1,50 @@
-class UpdateContributorAfterDelete < ActiveRecord::Migration
- def up
- Course.all.each do |course|
- if course.course_activities.count > 1
- course.members.each do |s|
- puts course.id
- puts course.name
- puts s.user_id
- # board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2
- # 发帖数
- board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is null;").count
- # 回帖数
- message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is not null").count * 1
- # 新闻回复
- common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.user_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
- # 通知
- common_count = News.find_by_sql("select n.* from news n where n.author_id = #{s.user_id} and n.course_id = #{course.id} ").count * 1
- # attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5
- # 附件数
- attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.user_id} and container_type ='Course'").count
- # 课程留言数
- journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "Course").count * 1
- # 作业留言
- journal_homework_count = JournalsForMessage.find_by_sql("SELECT jfm.* FROM `journals_for_messages` jfm, homework_commons hc where hc.id = jfm.jour_id and hc.course_id =#{course.id} and jfm.user_id =#{s.user_id} and jfm.jour_type ='HomeworkCommon';").count * 1
- # journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
- # journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
- total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count
- course_contributor = CourseContributorScore.where("course_id =? and user_id =?", course.id, s.user_id).first
- if course_contributor.nil?
- CourseContributorScore.create(:course_id => course.id, :user_id => s.user_id, :message_num => board_count, :message_reply_num => message_reply_count,
- :news_reply_num => common_reply_count, :news_num => common_count, :resource_num => attachment_count, :journal_num => journal_count,
- :homework_journal_num => journal_homework_count, :journal_reply_num => 0, :total_score => total)
- else
- course_contributor.message_num = board_count
- course_contributor.message_reply_num = message_reply_count
- course_contributor.news_reply_num = common_reply_count
- course_contributor.news_num = common_count
- course_contributor.resource_num = attachment_count
- course_contributor.journal_num = journal_count
- course_contributor.homework_journal_num = journal_homework_count
- course_contributor.save
- end
- end
- end
- end
- end
-
- def down
- end
-end
+class UpdateContributorAfterDelete < ActiveRecord::Migration
+ def up
+ Course.all.each do |course|
+ if course.course_activities.count > 1
+ course.members.each do |s|
+ puts course.id
+ puts course.name
+ puts s.user_id
+ # board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2
+ # 发帖数
+ board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is null;").count
+ # 回帖数
+ message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is not null").count * 1
+ # 新闻回复
+ common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.user_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
+ # 通知
+ common_count = News.find_by_sql("select n.* from news n where n.author_id = #{s.user_id} and n.course_id = #{course.id} ").count * 1
+ # attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5
+ # 附件数
+ attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.user_id} and container_type ='Course'").count
+ # 课程留言数
+ journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "Course").count * 1
+ # 作业留言
+ journal_homework_count = JournalsForMessage.find_by_sql("SELECT jfm.* FROM `journals_for_messages` jfm, homework_commons hc where hc.id = jfm.jour_id and hc.course_id =#{course.id} and jfm.user_id =#{s.user_id} and jfm.jour_type ='HomeworkCommon';").count * 1
+ # journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
+ # journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
+ total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count
+ course_contributor = CourseContributorScore.where("course_id =? and user_id =?", course.id, s.user_id).first
+ if course_contributor.nil?
+ CourseContributorScore.create(:course_id => course.id, :user_id => s.user_id, :message_num => board_count, :message_reply_num => message_reply_count,
+ :news_reply_num => common_reply_count, :news_num => common_count, :resource_num => attachment_count, :journal_num => journal_count,
+ :homework_journal_num => journal_homework_count, :journal_reply_num => 0, :total_score => total)
+ else
+ course_contributor.message_num = board_count
+ course_contributor.message_reply_num = message_reply_count
+ course_contributor.news_reply_num = common_reply_count
+ course_contributor.news_num = common_count
+ course_contributor.resource_num = attachment_count
+ course_contributor.journal_num = journal_count
+ course_contributor.homework_journal_num = journal_homework_count
+ course_contributor.save
+ end
+ end
+ end
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20160310033019_delete_student_work_data.rb b/db/migrate/20160310033019_delete_student_work_data.rb
index a7ce60953..9cb952064 100644
--- a/db/migrate/20160310033019_delete_student_work_data.rb
+++ b/db/migrate/20160310033019_delete_student_work_data.rb
@@ -1,8 +1,8 @@
-class DeleteStudentWorkData < ActiveRecord::Migration
- def up
- StudentWork.where("homework_common_id = 2604 AND user_id = 10763 AND final_score = 0").destroy_all
- end
-
- def down
- end
-end
+class DeleteStudentWorkData < ActiveRecord::Migration
+ def up
+ StudentWork.where("homework_common_id = 2604 AND user_id = 10763 AND final_score = 0").destroy_all
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20160311072540_add_visits_to_user.rb b/db/migrate/20160311072540_add_visits_to_user.rb
new file mode 100644
index 000000000..2169a4b0b
--- /dev/null
+++ b/db/migrate/20160311072540_add_visits_to_user.rb
@@ -0,0 +1,5 @@
+class AddVisitsToUser < ActiveRecord::Migration
+ def change
+ add_column :users, :visits, :integer, :default => 0
+ end
+end
diff --git a/db/migrate/20160311072622_add_visits_to_project.rb b/db/migrate/20160311072622_add_visits_to_project.rb
new file mode 100644
index 000000000..1e67d9409
--- /dev/null
+++ b/db/migrate/20160311072622_add_visits_to_project.rb
@@ -0,0 +1,5 @@
+class AddVisitsToProject < ActiveRecord::Migration
+ def change
+ add_column :projects, :visits, :integer, :default => 0
+ end
+end
diff --git a/db/migrate/20160311072718_add_visits_to_course.rb b/db/migrate/20160311072718_add_visits_to_course.rb
new file mode 100644
index 000000000..4d4b682cf
--- /dev/null
+++ b/db/migrate/20160311072718_add_visits_to_course.rb
@@ -0,0 +1,5 @@
+class AddVisitsToCourse < ActiveRecord::Migration
+ def change
+ add_column :courses, :visits, :integer, :default => 0
+ end
+end
diff --git a/db/migrate/20160311072819_add_visits_to_organization.rb b/db/migrate/20160311072819_add_visits_to_organization.rb
new file mode 100644
index 000000000..74bbcb5c9
--- /dev/null
+++ b/db/migrate/20160311072819_add_visits_to_organization.rb
@@ -0,0 +1,5 @@
+class AddVisitsToOrganization < ActiveRecord::Migration
+ def change
+ add_column :organizations, :visits, :integer, :default => 0
+ end
+end
diff --git a/db/migrate/20160317070611_update_course_lead.rb b/db/migrate/20160317070611_update_course_lead.rb
new file mode 100644
index 000000000..0c68fa40f
--- /dev/null
+++ b/db/migrate/20160317070611_update_course_lead.rb
@@ -0,0 +1,8 @@
+class UpdateCourseLead < ActiveRecord::Migration
+ def up
+ Message.where("status =? ", 1).update_all(:author_id => 1)
+ end
+
+ def down
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index abaafdf80..af5fe2197 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,8 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20160310033019) do
-
+ActiveRecord::Schema.define(:version => 20160225031230) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
t.string "act_type", :null => false
@@ -508,6 +507,7 @@ ActiveRecord::Schema.define(:version => 20160310033019) do
t.integer "is_excellent", :default => 0
t.integer "excellent_option", :default => 0
t.integer "is_copy", :default => 0
+ t.integer "visits", :default => 0
end
create_table "custom_fields", :force => true do |t|
@@ -1284,6 +1284,7 @@ ActiveRecord::Schema.define(:version => 20160310033019) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "allow_guest_download", :default => true
+ t.integer "visits", :default => 0
end
create_table "phone_app_versions", :force => true do |t|
@@ -1443,6 +1444,7 @@ ActiveRecord::Schema.define(:version => 20160310033019) do
t.integer "acts_count", :default => 0
t.integer "journals_count", :default => 0
t.integer "boards_reply_count", :default => 0
+ t.integer "visits", :default => 0
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@@ -1902,6 +1904,7 @@ ActiveRecord::Schema.define(:version => 20160310033019) do
t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64
t.integer "gid"
+ t.integer "visits", :default => 0
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb
index 682714b9b..6b22496b6 100644
--- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb
+++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb
@@ -99,6 +99,13 @@ module Redmine
result
end
+ def save_attachmentsex_public(attachments, author=User.current,attachment_type, is_public)
+ @curattachment_type = attachment_type
+ @is_public = true
+ result = save_attachments(attachments,author)
+ result
+ end
+
def save_attachments(attachments, author=User.current)
# 清除临时文件
if attachments
@@ -142,7 +149,11 @@ module Redmine
end
if a && !attachment['is_public_checkbox']
- a.is_public = false
+ if @is_public
+ a.is_public = true
+ else
+ a.is_public = false
+ end
elsif a && attachment['is_public_checkbox']
a.is_public = true
end
diff --git a/lib/redmine.rb b/lib/redmine.rb
index 8ebdacfa6..47ee3d38f 100644
--- a/lib/redmine.rb
+++ b/lib/redmine.rb
@@ -391,6 +391,9 @@ Redmine::MenuManager.map :admin_menu do |menu|
menu.push :messages_list, {:controller => 'admin', :action => 'messages_list'}, :caption => :label_message_plural
menu.push :notices, {:controller => 'admin', :action => 'notices'}, :caption => :label_notification_list
menu.push :latest_login_users, {:controller => 'admin', :action => 'latest_login_users'}, :caption => :label_latest_login_user_list
+ menu.push :excellent_courses, {:controller => 'admin', :action => 'excellent_courses'}, :caption => :label_excellent_courses_list
+ menu.push :course_resource_list, {:controller => 'admin', :action => 'course_resource_list'}, :caption => :label_course_resource_list
+ menu.push :project_resource_list, {:controller => 'admin', :action => 'project_resource_list'}, :caption => :label_project_resource_list
menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework
end
diff --git a/lib/trustie/gitlab/helper.rb b/lib/trustie/gitlab/helper.rb
index 9fb1f5735..c9cbcee26 100644
--- a/lib/trustie/gitlab/helper.rb
+++ b/lib/trustie/gitlab/helper.rb
@@ -1,73 +1,78 @@
-#coding=utf-8
-
-module Trustie
- module Gitlab
- module Helper
- GUEST = 10
- REPORTER = 20
- DEVELOPER = 30
- MASTER = 40
- OWNER = 50
- # 项目公开和私有
- PUBLIC = 20
- PRIVATE = 0
-
- def change_password(uid, en_pwd, salt)
- return unless uid
- options = {:encrypted_password=>en_pwd, :password_salt=>salt}
- self.g.put("/users/ext/#{uid}", :body => options)
- # g.edit_user(uid, :encrypted_password=>en_pwd, :password_salt=>salt)
- end
-
- def find_user(user)
- us = self.g.get("/users?search=#{user.mail}")
- if Array === us
- us.each do |u|
- return u if u.email == user.mail
- end
- end
- return nil
- end
-
- def add_user(user)
- u = nil
- begin
- u = find_user(user)
- unless u
- u = self.g.create_user(user.mail,
- user.hashed_password,
- name: user.show_name,
- username: user.login,
- confirm: "true")
- user.gid = u.id
- end
- change_password(u.id, user.hashed_password, user.salt)
- rescue => e
- puts e
- end
- return u
- end
-
- def del_user(user)
- return unless user.gid
- self.g.delete_user(user.gid)
- end
-
- def get_gitlab_role m
- case m.roles.first.position
- when 1,2
- GUEST
- when 5
- REPORTER
- when 4
- DEVELOPER
- when 3
- MASTER
- else
- GUEST
- end
- end
-
- end
- end
+#coding=utf-8
+
+module Trustie
+ module Gitlab
+ module Helper
+ GUEST = 10
+ REPORTER = 20
+ DEVELOPER = 30
+ MASTER = 40
+ OWNER = 50
+ # 项目公开和私有
+ PUBLIC = 20
+ PRIVATE = 0
+
+ def change_password(uid, en_pwd, salt)
+ return unless uid
+ options = {:encrypted_password=>en_pwd, :password_salt=>salt}
+ self.g.put("/users/ext/#{uid}", :body => options)
+ # g.edit_user(uid, :encrypted_password=>en_pwd, :password_salt=>salt)
+ end
+
+ def find_user(user)
+ us = self.g.get("/users?search=#{user.mail}")
+ if Array === us
+ us.each do |u|
+ return u if u.email == user.mail
+ end
+ end
+ return nil
+ end
+
+ def add_user(user)
+ u = nil
+ begin
+ u = find_user(user)
+ unless u
+ u = self.g.create_user(user.mail,
+ user.hashed_password,
+ name: user.show_name,
+ username: user.login,
+ confirm: "true")
+ user.gid = u.id
+ user.save
+ end
+ if user.gid.nil?
+ user.gid = u.id
+ user.save
+ end
+ change_password(u.id, user.hashed_password, user.salt)
+ rescue => e
+ puts e
+ end
+ return u
+ end
+
+ def del_user(user)
+ return unless user.gid
+ self.g.delete_user(user.gid)
+ end
+
+ def get_gitlab_role m
+ case m.roles.first.position
+ when 1,2
+ GUEST
+ when 5
+ REPORTER
+ when 4
+ DEVELOPER
+ when 3
+ MASTER
+ else
+ GUEST
+ end
+ end
+
+ end
+ end
end
\ No newline at end of file
diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js
index 6065a563f..060898b88 100644
--- a/public/assets/kindeditor/kindeditor.js
+++ b/public/assets/kindeditor/kindeditor.js
@@ -1,6094 +1,6136 @@
-//function dump_obj(myObject) {
-// var s = "";
-// for (var property in myObject) {
-// s = s + "\n "+property +": " + myObject[property] ;
-// }
-// alert(s);
-//}
-/*******************************************************************************
-* KindEditor - WYSIWYG HTML Editor for Internet
-* Copyright (C) 2006-2013 kindsoft.net
-*
-* @author Roddy
-* @website http://www.kindsoft.net/
-* @licence http://www.kindsoft.net/license.php
-* @version 4.1.10 (2013-11-23)
-*******************************************************************************/
-(function (window, undefined) {
- if (window.KindEditor) {
- return;
- }
-if (!window.console) {
- window.console = {};
-}
-if (!console.log) {
- console.log = function () {};
-}
-var _VERSION = '4.1.10 (2013-11-23)',
- _ua = navigator.userAgent.toLowerCase(),
- _IE = _ua.indexOf('msie') > -1 && _ua.indexOf('opera') == -1,
- _NEWIE = _ua.indexOf('msie') == -1 && _ua.indexOf('trident') > -1,
- _GECKO = _ua.indexOf('gecko') > -1 && _ua.indexOf('khtml') == -1,
- _WEBKIT = _ua.indexOf('applewebkit') > -1,
- _OPERA = _ua.indexOf('opera') > -1,
- _MOBILE = _ua.indexOf('mobile') > -1,
- _IOS = /ipad|iphone|ipod/.test(_ua),
- _QUIRKS = document.compatMode != 'CSS1Compat',
- _IERANGE = !window.getSelection,
- _matches = /(?:msie|firefox|webkit|opera)[\/:\s](\d+)/.exec(_ua),
- _V = _matches ? _matches[1] : '0',
- _TIME = new Date().getTime();
-function _isArray(val) {
- if (!val) {
- return false;
- }
- return Object.prototype.toString.call(val) === '[object Array]';
-}
-function _isFunction(val) {
- if (!val) {
- return false;
- }
- return Object.prototype.toString.call(val) === '[object Function]';
-}
-function _inArray(val, arr) {
- for (var i = 0, len = arr.length; i < len; i++) {
- if (val === arr[i]) {
- return i;
- }
- }
- return -1;
-}
-function _each(obj, fn) {
- if (_isArray(obj)) {
- for (var i = 0, len = obj.length; i < len; i++) {
- if (fn.call(obj[i], i, obj[i]) === false) {
- break;
- }
- }
- } else {
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- if (fn.call(obj[key], key, obj[key]) === false) {
- break;
- }
- }
- }
- }
-}
-function _trim(str) {
- return str.replace(/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g, '');
-}
-function _inString(val, str, delimiter) {
- delimiter = delimiter === undefined ? ',' : delimiter;
- return (delimiter + str + delimiter).indexOf(delimiter + val + delimiter) >= 0;
-}
-function _addUnit(val, unit) {
- unit = unit || 'px';
- return val && /^\d+$/.test(val) ? val + unit : val;
-}
-function _removeUnit(val) {
- var match;
- return val && (match = /(\d+)/.exec(val)) ? parseInt(match[1], 10) : 0;
-}
-function _escape(val) {
- return val.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"');
-}
-function _unescape(val) {
- return val.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/&/g, '&');
-}
-function _toCamel(str) {
- var arr = str.split('-');
- str = '';
- _each(arr, function(key, val) {
- str += (key > 0) ? val.charAt(0).toUpperCase() + val.substr(1) : val;
- });
- return str;
-}
-function _toHex(val) {
- function hex(d) {
- var s = parseInt(d, 10).toString(16).toUpperCase();
- return s.length > 1 ? s : '0' + s;
- }
- return val.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/ig,
- function($0, $1, $2, $3) {
- return '#' + hex($1) + hex($2) + hex($3);
- }
- );
-}
-function _toMap(val, delimiter) {
- delimiter = delimiter === undefined ? ',' : delimiter;
- var map = {}, arr = _isArray(val) ? val : val.split(delimiter), match;
- _each(arr, function(key, val) {
- if ((match = /^(\d+)\.\.(\d+)$/.exec(val))) {
- for (var i = parseInt(match[1], 10); i <= parseInt(match[2], 10); i++) {
- map[i.toString()] = true;
- }
- } else {
- map[val] = true;
- }
- });
- return map;
-}
-function _toArray(obj, offset) {
- return Array.prototype.slice.call(obj, offset || 0);
-}
-function _undef(val, defaultVal) {
- return val === undefined ? defaultVal : val;
-}
-function _invalidUrl(url) {
- return !url || /[<>"]/.test(url);
-}
-function _addParam(url, param) {
- return url.indexOf('?') >= 0 ? url + '&' + param : url + '?' + param;
-}
-function _extend(child, parent, proto) {
- if (!proto) {
- proto = parent;
- parent = null;
- }
- var childProto;
- if (parent) {
- var fn = function () {};
- fn.prototype = parent.prototype;
- childProto = new fn();
- _each(proto, function(key, val) {
- childProto[key] = val;
- });
- } else {
- childProto = proto;
- }
- childProto.constructor = child;
- child.prototype = childProto;
- child.parent = parent ? parent.prototype : null;
-}
-function _json(text) {
- var match;
- if ((match = /\{[\s\S]*\}|\[[\s\S]*\]/.exec(text))) {
- text = match[0];
- }
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
- if (/^[\],:{}\s]*$/.
- test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
- replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
- replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
- return eval('(' + text + ')');
- }
- throw 'JSON parse error';
-}
-var _round = Math.round;
-var K = {
- DEBUG : false,
- VERSION : _VERSION,
- IE : _IE,
- GECKO : _GECKO,
- WEBKIT : _WEBKIT,
- OPERA : _OPERA,
- V : _V,
- TIME : _TIME,
- each : _each,
- isArray : _isArray,
- isFunction : _isFunction,
- inArray : _inArray,
- inString : _inString,
- trim : _trim,
- addUnit : _addUnit,
- removeUnit : _removeUnit,
- escape : _escape,
- unescape : _unescape,
- toCamel : _toCamel,
- toHex : _toHex,
- toMap : _toMap,
- toArray : _toArray,
- undef : _undef,
- invalidUrl : _invalidUrl,
- addParam : _addParam,
- extend : _extend,
- json : _json
-};
-var _INLINE_TAG_MAP = _toMap('a,abbr,acronym,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,img,input,ins,kbd,label,map,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'),
- _BLOCK_TAG_MAP = _toMap('address,applet,blockquote,body,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,head,hr,html,iframe,ins,isindex,li,map,menu,meta,noframes,noscript,object,ol,p,pre,script,style,table,tbody,td,tfoot,th,thead,title,tr,ul'),
- _SINGLE_TAG_MAP = _toMap('area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed'),
- _STYLE_TAG_MAP = _toMap('b,basefont,big,del,em,font,i,s,small,span,strike,strong,sub,sup,u'),
- _CONTROL_TAG_MAP = _toMap('img,table,input,textarea,button'),
- _PRE_TAG_MAP = _toMap('pre,style,script'),
- _NOSPLIT_TAG_MAP = _toMap('html,head,body,td,tr,table,ol,ul,li'),
- _AUTOCLOSE_TAG_MAP = _toMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'),
- _FILL_ATTR_MAP = _toMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'),
- _VALUE_TAG_MAP = _toMap('input,button,textarea,select');
-// Begining of modification by Macrow
-function _getBasePath() {
- var refPath = '/assets/kindeditor/';
- var els = document.getElementsByTagName('script'), src;
- for (var i = 0, len = els.length; i < len; i++) {
- src = els[i].src || '';
- if (/(kindeditor|application)[\w\-\.]*\.js/.test(src)) {
- return src.substring(0, src.indexOf('assets')) + refPath;
- }
- }
- return refPath;
-}
-// End of modification by Macrow
-K.basePath = _getBasePath();
-K.options = {
- designMode : true,
- fullscreenMode : false,
- filterMode : true,
- wellFormatMode : true,
- shadowMode : true,
- loadStyleMode : true,
- basePath : K.basePath,
- emotionsBasePath: 'http://forge.trustie.net', //TODO
- themesPath : K.basePath + 'themes/',
- langPath : K.basePath + 'lang/',
- pluginsPath : K.basePath + 'plugins/',
- themeType : 'default',
- langType : 'zh_CN',
- urlType : '',
- newlineTag : 'p',
- resizeType : 2,
- syncType : 'form',
- pasteType : 2,
- dialogAlignType : 'page',
- useContextmenu : true,
- fullscreenShortcut : false,
- bodyClass : 'ke-content',
- indentChar : '\t',
- cssPath : K.basePath +'plugins/code/previewcode.css',
- cssData : 'font{color:black;}',
- minWidth : 650,
- minHeight : 100,
- minChangeSize : 1,
- zIndex : 811213,
- items : ['code','emoticons','fontname',
- 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
- 'formatblock', 'fontsize', '|','indent', 'outdent',
- '|','imagedirectupload','table', 'media', 'preview',"more"
- ],
- noDisableItems : ['source', 'fullscreen'],
- colorTable : [
- ['#E53333', '#E56600', '#FF9900', '#64451D', '#DFC5A4', '#FFE500'],
- ['#009900', '#006600', '#99BB00', '#B8D100', '#60D978', '#00D5FF'],
- ['#337FE5', '#003399', '#4C33E5', '#9933E5', '#CC33E5', '#EE33EE'],
- ['#FFFFFF', '#CCCCCC', '#999999', '#666666', '#333333', '#000000']
- ],
- fontSizeTable : ['选中的字体大小:','9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px'],
- htmlTags : {
- font : ['id', 'class', 'color', 'size', 'face', '.background-color'],
- span : [
- 'id', 'class', '.color', '.background-color', '.font-size', '.font-family', '.background',
- '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.line-height', 'data-user-id'
- ],
- div : [
- 'id', 'class', 'align', '.border', '.margin', '.padding', '.text-align', '.color',
- '.background-color', '.font-size', '.font-family', '.font-weight', '.background',
- '.font-style', '.text-decoration', '.vertical-align', '.margin-left'
- ],
- table: [
- 'id', 'class', 'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align', 'bordercolor',
- '.padding', '.margin', '.border', 'bgcolor', '.text-align', '.color', '.background-color',
- '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.background',
- '.width', '.height', '.border-collapse'
- ],
- 'td,th': [
- 'id', 'class', 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor',
- '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight',
- '.font-style', '.text-decoration', '.vertical-align', '.background', '.border'
- ],
- a : ['id', 'class', 'href', 'target', 'name'],
- embed : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'],
- img : ['id', 'class', 'src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'],
- 'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [
- 'id', 'class', 'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background',
- '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left'
- ],
- pre : ['id', 'class'],
- hr : ['id', 'class', '.page-break-after'],
- 'br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del' : ['id', 'class'],
- iframe : ['id', 'class', 'src', 'frameborder', 'width', 'height', '.width', '.height']
- },
- layout : ''
-};
-var _useCapture = false;
-var _INPUT_KEY_MAP = _toMap('8,9,13,32,46,48..57,59,61,65..90,106,109..111,188,190..192,219..222');
-var _CURSORMOVE_KEY_MAP = _toMap('33..40');
-var _CHANGE_KEY_MAP = {};
-_each(_INPUT_KEY_MAP, function(key, val) {
- _CHANGE_KEY_MAP[key] = val;
-});
-_each(_CURSORMOVE_KEY_MAP, function(key, val) {
- _CHANGE_KEY_MAP[key] = val;
-});
-function _bindEvent(el, type, fn) {
- if (el.addEventListener){
- el.addEventListener(type, fn, _useCapture);
- } else if (el.attachEvent){
- el.attachEvent('on' + type, fn);
- }
-}
-function _unbindEvent(el, type, fn) {
- if (el.removeEventListener){
- el.removeEventListener(type, fn, _useCapture);
- } else if (el.detachEvent){
- el.detachEvent('on' + type, fn);
- }
-}
-var _EVENT_PROPS = ('altKey,attrChange,attrName,bubbles,button,cancelable,charCode,clientX,clientY,ctrlKey,currentTarget,' +
- 'data,detail,eventPhase,fromElement,handler,keyCode,metaKey,newValue,offsetX,offsetY,originalTarget,pageX,' +
- 'pageY,prevValue,relatedNode,relatedTarget,screenX,screenY,shiftKey,srcElement,target,toElement,view,wheelDelta,which').split(',');
-function KEvent(el, event) {
- this.init(el, event);
-}
-_extend(KEvent, {
- init : function(el, event) {
- var self = this, doc = el.ownerDocument || el.document || el;
- self.event = event;
- _each(_EVENT_PROPS, function(key, val) {
- self[val] = event[val];
- });
- if (!self.target) {
- self.target = self.srcElement || doc;
- }
- if (self.target.nodeType === 3) {
- self.target = self.target.parentNode;
- }
- if (!self.relatedTarget && self.fromElement) {
- self.relatedTarget = self.fromElement === self.target ? self.toElement : self.fromElement;
- }
- if (self.pageX == null && self.clientX != null) {
- var d = doc.documentElement, body = doc.body;
- self.pageX = self.clientX + (d && d.scrollLeft || body && body.scrollLeft || 0) - (d && d.clientLeft || body && body.clientLeft || 0);
- self.pageY = self.clientY + (d && d.scrollTop || body && body.scrollTop || 0) - (d && d.clientTop || body && body.clientTop || 0);
- }
- if (!self.which && ((self.charCode || self.charCode === 0) ? self.charCode : self.keyCode)) {
- self.which = self.charCode || self.keyCode;
- }
- if (!self.metaKey && self.ctrlKey) {
- self.metaKey = self.ctrlKey;
- }
- if (!self.which && self.button !== undefined) {
- self.which = (self.button & 1 ? 1 : (self.button & 2 ? 3 : (self.button & 4 ? 2 : 0)));
- }
- switch (self.which) {
- case 186 :
- self.which = 59;
- break;
- case 187 :
- case 107 :
- case 43 :
- self.which = 61;
- break;
- case 189 :
- case 45 :
- self.which = 109;
- break;
- case 42 :
- self.which = 106;
- break;
- case 47 :
- self.which = 111;
- break;
- case 78 :
- self.which = 110;
- break;
- }
- if (self.which >= 96 && self.which <= 105) {
- self.which -= 48;
- }
- },
- preventDefault : function() {
- var ev = this.event;
- if (ev.preventDefault) {
- ev.preventDefault();
- } else {
- ev.returnValue = false;
- }
- },
- stopPropagation : function() {
- var ev = this.event;
- if (ev.stopPropagation) {
- ev.stopPropagation();
- } else {
- ev.cancelBubble = true;
- }
- },
- stop : function() {
- this.preventDefault();
- this.stopPropagation();
- }
-});
-var _eventExpendo = 'kindeditor_' + _TIME, _eventId = 0, _eventData = {};
-function _getId(el) {
- return el[_eventExpendo] || null;
-}
-function _setId(el) {
- el[_eventExpendo] = ++_eventId;
- return _eventId;
-}
-function _removeId(el) {
- try {
- delete el[_eventExpendo];
- } catch(e) {
- if (el.removeAttribute) {
- el.removeAttribute(_eventExpendo);
- }
- }
-}
-function _bind(el, type, fn) {
- if (type.indexOf(',') >= 0) {
- _each(type.split(','), function() {
- _bind(el, this, fn);
- });
- return;
- }
- var id = _getId(el);
- if (!id) {
- id = _setId(el);
- }
- if (_eventData[id] === undefined) {
- _eventData[id] = {};
- }
- var events = _eventData[id][type];
- if (events && events.length > 0) {
- _unbindEvent(el, type, events[0]);
- } else {
- _eventData[id][type] = [];
- _eventData[id].el = el;
- }
- events = _eventData[id][type];
- if (events.length === 0) {
- events[0] = function(e) {
- var kevent = e ? new KEvent(el, e) : undefined;
- _each(events, function(i, event) {
- if (i > 0 && event) {
- event.call(el, kevent);
- }
- });
- };
- }
- if (_inArray(fn, events) < 0) {
- events.push(fn);
- }
- _bindEvent(el, type, events[0]);
-}
-function _unbind(el, type, fn) {
- if (type && type.indexOf(',') >= 0) {
- _each(type.split(','), function() {
- _unbind(el, this, fn);
- });
- return;
- }
- var id = _getId(el);
- if (!id) {
- return;
- }
- if (type === undefined) {
- if (id in _eventData) {
- _each(_eventData[id], function(key, events) {
- if (key != 'el' && events.length > 0) {
- _unbindEvent(el, key, events[0]);
- }
- });
- delete _eventData[id];
- _removeId(el);
- }
- return;
- }
- if (!_eventData[id]) {
- return;
- }
- var events = _eventData[id][type];
- if (events && events.length > 0) {
- if (fn === undefined) {
- _unbindEvent(el, type, events[0]);
- delete _eventData[id][type];
- } else {
- _each(events, function(i, event) {
- if (i > 0 && event === fn) {
- events.splice(i, 1);
- }
- });
- if (events.length == 1) {
- _unbindEvent(el, type, events[0]);
- delete _eventData[id][type];
- }
- }
- var count = 0;
- _each(_eventData[id], function() {
- count++;
- });
- if (count < 2) {
- delete _eventData[id];
- _removeId(el);
- }
- }
-}
-function _fire(el, type) {
- if (type.indexOf(',') >= 0) {
- _each(type.split(','), function() {
- _fire(el, this);
- });
- return;
- }
- var id = _getId(el);
- if (!id) {
- return;
- }
- var events = _eventData[id][type];
- if (_eventData[id] && events && events.length > 0) {
- events[0]();
- }
-}
-function _ctrl(el, key, fn) {
- var self = this;
- key = /^\d{2,}$/.test(key) ? key : key.toUpperCase().charCodeAt(0);
- _bind(el, 'keydown', function(e) {
- if (e.ctrlKey && e.which == key && !e.shiftKey && !e.altKey) {
- fn.call(el);
- e.stop();
- }
- });
-}
-var _readyFinished = false;
-function _ready(fn) {
- if (_readyFinished) {
- fn(KindEditor);
- return;
- }
- var loaded = false;
- function readyFunc() {
- if (!loaded) {
- loaded = true;
- fn(KindEditor);
- _readyFinished = true;
- }
- }
- function ieReadyFunc() {
- if (!loaded) {
- try {
- document.documentElement.doScroll('left');
- } catch(e) {
- setTimeout(ieReadyFunc, 100);
- return;
- }
- readyFunc();
- }
- }
- function ieReadyStateFunc() {
- if (document.readyState === 'complete') {
- readyFunc();
- }
- }
- if (document.addEventListener) {
- _bind(document, 'DOMContentLoaded', readyFunc);
- } else if (document.attachEvent) {
- _bind(document, 'readystatechange', ieReadyStateFunc);
- var toplevel = false;
- try {
- toplevel = window.frameElement == null;
- } catch(e) {}
- if (document.documentElement.doScroll && toplevel) {
- ieReadyFunc();
- }
- }
- _bind(window, 'load', readyFunc);
-}
-if (_IE) {
- window.attachEvent('onunload', function() {
- _each(_eventData, function(key, events) {
- if (events.el) {
- _unbind(events.el);
- }
- });
- });
-}
-K.ctrl = _ctrl;
-K.ready = _ready;
-function _getCssList(css) {
- var list = {},
- reg = /\s*([\w\-]+)\s*:([^;]*)(;|$)/g,
- match;
- while ((match = reg.exec(css))) {
- var key = _trim(match[1].toLowerCase()),
- val = _trim(_toHex(match[2]));
- list[key] = val;
- }
- return list;
-}
-function _getAttrList(tag) {
- var list = {},
- reg = /\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g,
- match;
- while ((match = reg.exec(tag))) {
- var key = (match[1] || match[2] || match[4] || match[6]).toLowerCase(),
- val = (match[2] ? match[3] : (match[4] ? match[5] : match[7])) || '';
- list[key] = val;
- }
- return list;
-}
-function _addClassToTag(tag, className) {
- if (/\s+class\s*=/.test(tag)) {
- tag = tag.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/, function($0, $1, $2, $3) {
- if ((' ' + $2 + ' ').indexOf(' ' + className + ' ') < 0) {
- return $2 === '' ? $1 + className + $3 : $1 + $2 + ' ' + className + $3;
- } else {
- return $0;
- }
- });
- } else {
- tag = tag.substr(0, tag.length - 1) + ' class="' + className + '">';
- }
- return tag;
-}
-function _formatCss(css) {
- var str = '';
- _each(_getCssList(css), function(key, val) {
- str += key + ':' + val + ';';
- });
- return str;
-}
-function _formatUrl(url, mode, host, pathname) {
- mode = _undef(mode, '').toLowerCase();
- if (url.substr(0, 5) != 'data:') {
- url = url.replace(/([^:])\/\//g, '$1/');
- }
- if (_inArray(mode, ['absolute', 'relative', 'domain']) < 0) {
- return url;
- }
- host = host || location.protocol + '//' + location.host;
- if (pathname === undefined) {
- var m = location.pathname.match(/^(\/.*)\//);
- pathname = m ? m[1] : '';
- }
- var match;
- if ((match = /^(\w+:\/\/[^\/]*)/.exec(url))) {
- if (match[1] !== host) {
- return url;
- }
- } else if (/^\w+:/.test(url)) {
- return url;
- }
- function getRealPath(path) {
- var parts = path.split('/'), paths = [];
- for (var i = 0, len = parts.length; i < len; i++) {
- var part = parts[i];
- if (part == '..') {
- if (paths.length > 0) {
- paths.pop();
- }
- } else if (part !== '' && part != '.') {
- paths.push(part);
- }
- }
- return '/' + paths.join('/');
- }
- if (/^\//.test(url)) {
- url = host + getRealPath(url.substr(1));
- } else if (!/^\w+:\/\//.test(url)) {
- url = host + getRealPath(pathname + '/' + url);
- }
- function getRelativePath(path, depth) {
- if (url.substr(0, path.length) === path) {
- var arr = [];
- for (var i = 0; i < depth; i++) {
- arr.push('..');
- }
- var prefix = '.';
- if (arr.length > 0) {
- prefix += '/' + arr.join('/');
- }
- if (pathname == '/') {
- prefix += '/';
- }
- return prefix + url.substr(path.length);
- } else {
- if ((match = /^(.*)\//.exec(path))) {
- return getRelativePath(match[1], ++depth);
- }
- }
- }
- if (mode === 'relative') {
- url = getRelativePath(host + pathname, 0).substr(2);
- } else if (mode === 'absolute') {
- if (url.substr(0, host.length) === host) {
- url = url.substr(host.length);
- }
- }
- return url;
-}
-function _formatHtml(html, htmlTags, urlType, wellFormatted, indentChar) {
- if (html == null) {
- html = '';
- }
- urlType = urlType || '';
- wellFormatted = _undef(wellFormatted, false);
- indentChar = _undef(indentChar, '\t');
- var fontSizeList = 'xx-small,x-small,small,medium,large,x-large,xx-large'.split(',');
- html = html.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig, function($0, $1, $2, $3) {
- return $1 + $2.replace(/<(?:br|br\s[^>]*)>/ig, '\n') + $3;
- });
- html = html.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/ig, '');
- html = html.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/ig, '$1 $2');
- html = html.replace(/\u200B/g, '');
- html = html.replace(/\u00A9/g, '©');
- html = html.replace(/\u00AE/g, '®');
- html = html.replace(/<[^>]+/g, function($0) {
- return $0.replace(/\s+/g, ' ');
- });
- var htmlTagMap = {};
- if (htmlTags) {
- _each(htmlTags, function(key, val) {
- var arr = key.split(',');
- for (var i = 0, len = arr.length; i < len; i++) {
- htmlTagMap[arr[i]] = _toMap(val);
- }
- });
- if (!htmlTagMap.script) {
- html = html.replace(/(<(?:script|script\s[^>]*)>)([\s\S]*?)(<\/script>)/ig, '');
- }
- if (!htmlTagMap.style) {
- html = html.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig, '');
- }
- }
- var re = /(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g;
- var tagStack = [];
- html = html.replace(re, function($0, $1, $2, $3, $4, $5, $6) {
- var full = $0,
- startNewline = $1 || '',
- startSlash = $2 || '',
- tagName = $3.toLowerCase(),
- attr = $4 || '',
- endSlash = $5 ? ' ' + $5 : '',
- endNewline = $6 || '';
- if (htmlTags && !htmlTagMap[tagName]) {
- return '';
- }
- if (endSlash === '' && _SINGLE_TAG_MAP[tagName]) {
- endSlash = ' /';
- }
- if (_INLINE_TAG_MAP[tagName]) {
- if (startNewline) {
- startNewline = ' ';
- }
- if (endNewline) {
- endNewline = ' ';
- }
- }
- if (_PRE_TAG_MAP[tagName]) {
- if (startSlash) {
- endNewline = '\n';
- } else {
- startNewline = '\n';
- }
- }
- if (wellFormatted && tagName == 'br') {
- endNewline = '\n';
- }
- if (_BLOCK_TAG_MAP[tagName] && !_PRE_TAG_MAP[tagName]) {
- if (wellFormatted) {
- if (startSlash && tagStack.length > 0 && tagStack[tagStack.length - 1] === tagName) {
- tagStack.pop();
- } else {
- tagStack.push(tagName);
- }
- startNewline = '\n';
- endNewline = '\n';
- for (var i = 0, len = startSlash ? tagStack.length : tagStack.length - 1; i < len; i++) {
- startNewline += indentChar;
- if (!startSlash) {
- endNewline += indentChar;
- }
- }
- if (endSlash) {
- tagStack.pop();
- } else if (!startSlash) {
- endNewline += indentChar;
- }
- } else {
- startNewline = endNewline = '';
- }
- }
- if (attr !== '') {
- var attrMap = _getAttrList(full);
- if (tagName === 'font') {
- var fontStyleMap = {}, fontStyle = '';
- _each(attrMap, function(key, val) {
- if (key === 'color') {
- fontStyleMap.color = val;
- delete attrMap[key];
- }
- if (key === 'size') {
- fontStyleMap['font-size'] = fontSizeList[parseInt(val, 10) - 1] || '';
- delete attrMap[key];
- }
- if (key === 'face') {
- fontStyleMap['font-family'] = val;
- delete attrMap[key];
- }
- if (key === 'style') {
- fontStyle = val;
- }
- });
- if (fontStyle && !/;$/.test(fontStyle)) {
- fontStyle += ';';
- }
- _each(fontStyleMap, function(key, val) {
- if (val === '') {
- return;
- }
- if (/\s/.test(val)) {
- val = "'" + val + "'";
- }
- fontStyle += key + ':' + val + ';';
- });
- attrMap.style = fontStyle;
- }
- _each(attrMap, function(key, val) {
- if (_FILL_ATTR_MAP[key]) {
- attrMap[key] = key;
- }
- if (_inArray(key, ['src', 'href']) >= 0) {
- attrMap[key] = _formatUrl(val, urlType);
- }
- if (htmlTags && key !== 'style' && !htmlTagMap[tagName]['*'] && !htmlTagMap[tagName][key] ||
- tagName === 'body' && key === 'contenteditable' ||
- /^kindeditor_\d+$/.test(key)) {
- delete attrMap[key];
- }
- if (key === 'style' && val !== '') {
- var styleMap = _getCssList(val);
- _each(styleMap, function(k, v) {
- if (htmlTags && !htmlTagMap[tagName].style && !htmlTagMap[tagName]['.' + k]) {
- delete styleMap[k];
- }
- });
- var style = '';
- _each(styleMap, function(k, v) {
- style += k + ':' + v + ';';
- });
- attrMap.style = style;
- }
- });
- attr = '';
- _each(attrMap, function(key, val) {
- if (key === 'style' && val === '') {
- return;
- }
- val = val.replace(/"/g, '"');
- attr += ' ' + key + '="' + val + '"';
- });
- }
- if (tagName === 'font') {
- tagName = 'span';
- }
- return startNewline + '<' + startSlash + tagName + attr + endSlash + '>' + endNewline;
- });
- html = html.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig, function($0, $1, $2, $3) {
- return $1 + $2.replace(/\n/g, '\n') + $3;
- });
- html = html.replace(/\n\s*\n/g, '\n');
- html = html.replace(/\n/g, '\n');
- return _trim(html);
-}
-function _clearMsWord(html, htmlTags) {
- html = html.replace(/ /ig, '')
- .replace(//ig, '')
- .replace(/'
- ];
- if (!_isArray(cssPath)) {
- cssPath = [cssPath];
- }
- _each(cssPath, function(i, path) {
- if (path) {
- arr.push(' ');
- }
- });
- if (cssData) {
- arr.push('');
- }
- arr.push('