This commit is contained in:
Tim 2015-10-12 16:08:51 +08:00
commit 752494e35e
22 changed files with 186 additions and 126 deletions

View File

@ -121,49 +121,37 @@ class UsersController < ApplicationController
messages = MessageAll.where("user_id =?", @user).order("created_at desc") messages = MessageAll.where("user_id =?", @user).order("created_at desc")
messages.each do |message_all| messages.each do |message_all|
# 在点击或者刷新消息列表后未读的消息存放在数组 # 在点击或者刷新消息列表后未读的消息存放在数组
if message_all.message.viewed == 0 if message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0
@message_alls << message_all.message @message_alls << message_all.message
end end
end end
# when 'system_messages'
# @message_alls = SystemMessage.order("created_at desc").all #课程相关消息
when 'apply'
@message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject') and user_id =?", @user).order("created_at desc")
when 'homework' when 'homework'
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage') and user_id =?", @user).order("created_at desc") @message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage') and user_id =?", @user).order("created_at desc")
when 'course_message' when 'course_message'
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
when 'forge_message'
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
# @message_alls_count = @message_alls.count
when 'course_news' when 'course_news'
# 课程通知包含发布的通知和回复的通知 # 课程通知包含发布的通知和回复的通知
@message_alls = CourseMessage.where("course_message_type =? or course_message_type =?", "News", "Comment").where("user_id =?", @user).order("created_at desc") @message_alls = CourseMessage.where("course_message_type =? or course_message_type =?", "News", "Comment").where("user_id =?", @user).order("created_at desc")
#@user_course_messages_count = @user_course_messages.count when 'poll'
# when 'forge_news' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
# @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc")
# @message_alls_count = @message_alls.count #项目相关消息
# when 'course_news_reply'
# @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
# when 'forge_news_reply'
# @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
# @message_alls_count = @message_alls.count
# when 'poll'
# @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
# @message_alls_count = @message_alls.count
# when 'works_reviewers'
# @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc")
# @message_alls_count = @message_alls.count
# when 'works_reply'
# @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
# @message_alls_count = @message_alls.count
when 'issue' when 'issue'
@message_alls = ForgeMessage.where("forge_message_type =? or forge_message_type =?" , "Issue", "Journal").where("user_id=?", @user).order("created_at desc") @message_alls = ForgeMessage.where("forge_message_type =? or forge_message_type =?" , "Issue", "Journal").where("user_id=?", @user).order("created_at desc")
# when 'issue_update' # 缺陷状态更新、留言 when 'forge_message'
# @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc") @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
# @message_alls_count = @message_alls.count when 'forge_news'
@message_alls = ForgeMessage.where("forge_message_type in (?,?) and user_id =?", "News", "Comment", @user).order("created_at desc")
when 'apply'
@message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject') and user_id =?", @user).order("created_at desc")
#贴吧消息
when 'forum' when 'forum'
@message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc") @message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc")
#用户留言
when 'user_feedback' when 'user_feedback'
@message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") @message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
else else
@ -534,6 +522,7 @@ class UsersController < ApplicationController
@atta_count = @attachments.count @atta_count = @attachments.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset @offset ||= @atta_pages.offset
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
#@curse_attachments_all = @all_attachments[@offset, @limit] #@curse_attachments_all = @all_attachments[@offset, @limit]
@attachments = paginateHelper @attachments,7 @attachments = paginateHelper @attachments,7
respond_to do |format| respond_to do |format|
@ -567,6 +556,7 @@ class UsersController < ApplicationController
@atta_count = @attachments.count @atta_count = @attachments.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset @offset ||= @atta_pages.offset
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
#@curse_attachments_all = @all_attachments[@offset, @limit] #@curse_attachments_all = @all_attachments[@offset, @limit]
@attachments = paginateHelper @attachments,7 @attachments = paginateHelper @attachments,7
respond_to do |format| respond_to do |format|
@ -598,6 +588,7 @@ class UsersController < ApplicationController
@atta_count = @attachments.count @atta_count = @attachments.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset @offset ||= @atta_pages.offset
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
#@curse_attachments_all = @all_attachments[@offset, @limit] #@curse_attachments_all = @all_attachments[@offset, @limit]
@attachments = paginateHelper @attachments,7 @attachments = paginateHelper @attachments,7
respond_to do |format| respond_to do |format|
@ -608,8 +599,8 @@ class UsersController < ApplicationController
#将资源批量引入 #将资源批量引入
def import_resources_to_homework def import_resources_to_homework
@attachments = [] @attachments = []
unless params[:checkbox1].nil? || params[:checkbox1].blank? unless session[:seleted_resource_ids].nil? || session[:seleted_resource_ids].blank?
params[:checkbox1].each do |id| session[:seleted_resource_ids].each do |id|
atta = Attachment.find(id) atta = Attachment.find(id)
att_copy = atta.copy att_copy = atta.copy
att_copy.container_id = nil att_copy.container_id = nil
@ -620,11 +611,23 @@ class UsersController < ApplicationController
@attachments << att_copy @attachments << att_copy
end end
end end
session[:seleted_resource_ids] = [] #保存后清空
respond_to do |format| respond_to do |format|
format.js format.js
end end
end end
# ajax 用session保存选择的资源id
def store_selected_resource
session[:seleted_resource_ids] = [] if session[:seleted_resource_ids].nil?
if params[:save] == 'y'
session[:seleted_resource_ids] << params[:res_id]
else
session[:seleted_resource_ids].delete( params[:res_id])
end
render :nothing => true
end
include CoursesHelper include CoursesHelper
def user_courses def user_courses

View File

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

View File

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

View File

@ -224,13 +224,15 @@
<%= link_to issues_journal.user, user_activities_url(issues_journal.user,:token => @token.value), :class => "wmail_name", <%= link_to issues_journal.user, user_activities_url(issues_journal.user,:token => @token.value), :class => "wmail_name",
:style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_project_issue_update) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_project_issue_update) %></span>
<% if issues_journal.notes.blank? || issues_journal.notes.nil? %> <%= link_to truncate(issues_journal.issue.subject, length:30,omission:'...'),issue_url(issues_journal.issue, :token => @token.value),
<%= link_to truncate(issues_journal.issue.subject.html_safe, length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), :style => "color:#2E8DD7;float:left;font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;",
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :onmouseover =>"message_titile_show($(this),event)",
<% else %> :onmouseout => "message_titile_hide($(this))"
<%= link_to truncate(issues_journal.notes.html_safe, length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), %>
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <div style="display: none">
<% end %> <div class="fl"><strong>更新内容:</strong></div>
<div class="ml60"><%= issues_journal.notes.html_safe %></div>
</div>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(issues_journal.created_on) %></span> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(issues_journal.created_on) %></span>
</li> </li>
<% end %> <% end %>
@ -290,9 +292,9 @@
:style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_wiki_mail_notification) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_wiki_mail_notification) %></span>
<% unless wikicontent.page.nil? %> <% unless wikicontent.page.nil? %>
<%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value), <%= link_to wikicontent.text.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe, project_wiki_url(wikicontent.page.wiki,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style => "color:#2E8DD7;float:left; max-width:400px;height:23px;font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<% end %> <% end %>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(wikicontent.updated_on) %></span> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(wikicontent.updated_on) %></span>
</li> </li>
@ -405,9 +407,9 @@
:style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_send_course_journals_for_messages) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_send_course_journals_for_messages) %></span>
<%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value), <%= link_to project_journal_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe, project_feedback_url(project_journal_message.project,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#2E8DD7;float:left; max-width:400px; max-height:30px;font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(project_journal_message.created_on) %></span> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(project_journal_message.created_on) %></span>
</li> </li>
@ -437,9 +439,9 @@
:style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_show_your_message) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_show_your_message) %></span>
<%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value), <%= link_to user_journal_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe,feedback_url(@user,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#2E8DD7;float:left; max-width:400px; max-height:30px;font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(user_journal_message.created_on) %></span></li> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(user_journal_message.created_on) %></span></li>
@ -520,3 +522,15 @@
</div> </div>
</div> </div>
<script>
function message_titile_show(obj,e)
{
obj.next("div").show();
obj.next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute");
}
function message_titile_hide(obj)
{
obj.next("div").hide();
}
</script>

View File

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

View File

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

View File

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

View File

@ -99,17 +99,17 @@
</p> </p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p> <p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p> <p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>@nbsp;&nbsp;24点</span></p> <p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p>
<p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>@nbsp;@nbsp;24点</span></p> <p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;@&nbsp;24点</span></p>
<p>迟交扣分:<span style="color:Red;"><%= ma.course_message.late_penalty %>分</span></p> <p>迟交扣分:<span style="color:Red;"><%= ma.course_message.late_penalty %>分</span></p>
<p>请同学们抓紧时间提交自己的作品,谢谢!</p> <p>请同学们抓紧时间提交自己的作品,谢谢!</p>
<% else %> <% else %>
<p><%= User.current.lastname + User.current.firstname %>老师您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:</p> <p><%= User.current.lastname + User.current.firstname %>老师您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:</p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p> <p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p> <p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>@nbsp;@nbsp;24点</span></p> <p>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;24点</span></p>
<p>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>@nbsp;@nbsp;24点</span></p> <p>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>&nbsp;&nbsp;24点</span></p>
<p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>@nbsp;@nbsp;24点</span></p> <p>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点</span></p>
<p>迟交扣分:<span style="color:Red;"><%= ma.course_message.late_penalty %>分</span></p> <p>迟交扣分:<span style="color:Red;"><%= ma.course_message.late_penalty %>分</span></p>
<p>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></p> <p>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></p>
<p>您可以修改作业内容、评分规则、匿评过程等,谢谢!</p> <p>您可以修改作业内容、评分规则、匿评过程等,谢谢!</p>

View File

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

View File

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

View File

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

View File

@ -1,38 +1,7 @@
<div class="homepageRightBanner"> <%= render :partial => 'users/selector_for_messages'%>
<div class="NewsBannerName"><%= title_for_message(params[:type]) %></div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="newsType">
<li><%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %></li>
<li><%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "resourcesGrey" %></li>
<li><%= link_to "加入项目", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %></li>
<%# 课程相关消息 %>
<li><%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %></li>
<li><%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %></li>
<li><%= link_to "课程通知",user_message_path(User.current, :type => 'course_news'), :class => "resourcesGrey" %></li>
<!--<li><%#= link_to "通知回复", user_message_path(User.current, :type => 'course_news_reply'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "课程问卷", user_message_path(User.current, :type => 'poll'), :class => "resourcesGrey" %></a></li>-->
<!--<li><%#= link_to "作品评阅", user_message_path(User.current, :type => 'works_reviewers'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "作品讨论", user_message_path(User.current, :type => 'works_reply'), :class => "resourcesGrey" %></li>-->
<%# 项目相关消息 %>
<li><%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "resourcesGrey" %></li>
<!--<li><%#= link_to "问题更新", user_message_path(User.current, :type => 'issue_update'), :class => "resourcesGrey" %></li>-->
<li><%= link_to "项目讨论区", user_message_path(User.current, :type => 'forge_message'), :class => "resourcesGrey" %></li>
<!--<li><%#= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "resourcesGrey" %></li>-->
<!--<li><%#= link_to "新闻回复", user_message_path(User.current, :type => 'forge_news_reply'), :class => "resourcesGrey" %></li>-->
<%# 项目相关消息 %>
<li><%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %></li>
<%# 系统贴吧 %>
<li><%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %></li>
<%# 系统消息 %>
<li><%= link_to "系统消息", user_system_messages_path(User.current), :class => "resourcesGrey" %></li>
</ul>
</li>
</ul>
</div>
<div class="resources mt10" id="users_setting"> <div class="resources mt10" id="users_setting">
<div> <div>
<% if @message_alls.count >0 || @user_system_messages.count >0 %> <% if (!@message_alls.nil? && @message_alls.count >0) %>
<% if params[:type].nil? || params[:type] == "unviewed" %> <% if params[:type].nil? || params[:type] == "unviewed" %>
<div class="newsReadSetting"> <div class="newsReadSetting">
有&nbsp;<span class="c_red"><%= unviewed_message(@user) %></span>&nbsp;条未读 有&nbsp;<span class="c_red"><%= unviewed_message(@user) %></span>&nbsp;条未读

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,8 @@ module RailsKindeditor
output << text_area_tag(name, content, input_html) output << text_area_tag(name, content, input_html)
output << javascript_tag(js_replace(id, options.merge(window_onload: 'true', output << javascript_tag(js_replace(id, options.merge(window_onload: 'true',
:autoHeightMode=>true, :autoHeightMode=>true,
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})' afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})',
emotionsBasePath: 'http://' + Setting.host_name
))) )))
end end
@ -21,7 +22,8 @@ module RailsKindeditor
output_buffer << build_text_area_tag(name, method, self, options, input_html) output_buffer << build_text_area_tag(name, method, self, options, input_html)
output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true', output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true',
:autoHeightMode=>true, :autoHeightMode=>true,
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})' afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})',
emotionsBasePath: 'http://' + Setting.host_name
))) )))
end end

View File

@ -243,6 +243,7 @@ K.options = {
shadowMode : true, shadowMode : true,
loadStyleMode : true, loadStyleMode : true,
basePath : K.basePath, basePath : K.basePath,
emotionsBasePath: 'http://forge.trustie.net', //TODO
themesPath : K.basePath + 'themes/', themesPath : K.basePath + 'themes/',
langPath : K.basePath + 'lang/', langPath : K.basePath + 'lang/',
pluginsPath : K.basePath + 'plugins/', pluginsPath : K.basePath + 'plugins/',
@ -5459,6 +5460,7 @@ function _editor(options) {
_instances = []; _instances = [];
function _create(expr, options) { function _create(expr, options) {
options = options || {}; options = options || {};
options.emotionsBasePath = _undef(options.emotionsBasePath,'http://forge.trustie.net') // TODO
options.basePath = _undef(options.basePath, K.basePath); options.basePath = _undef(options.basePath, K.basePath);
options.themesPath = _undef(options.themesPath, options.basePath + 'themes/'); options.themesPath = _undef(options.themesPath, options.basePath + 'themes/');
options.langPath = _undef(options.langPath, options.basePath + 'lang/'); options.langPath = _undef(options.langPath, options.basePath + 'lang/');
@ -5623,7 +5625,9 @@ _plugin('core', function(K) {
url:K.addParam('/kindeditor/upload', 'dir=image'), url:K.addParam('/kindeditor/upload', 'dir=image'),
afterUpload : function(data) { afterUpload : function(data) {
if (data.error === 0) { if (data.error === 0) {
var url = K.formatUrl(data.url, 'absolute');
var url = data.url//K.formatUrl(data.url, 'absolute');
// console.log(url)
self.exec('insertimage', url, 'image','','','1',''); self.exec('insertimage', url, 'image','','','1','');
//self.exec('insertimage', url, 'image','','','1','left'); //self.exec('insertimage', url, 'image','','','1','left');
//self.insertHtml('<img src="'+url+'"/>'); //self.insertHtml('<img src="'+url+'"/>');

View File

@ -9,7 +9,8 @@
KindEditor.plugin('emoticons', function(K) { KindEditor.plugin('emoticons', function(K) {
var self = this, name = 'emoticons', var self = this, name = 'emoticons',
path = (self.emoticonsPath || self.pluginsPath + 'emoticons/images/'),
path = self.emotionsBasePath + (self.emoticonsPath || self.pluginsPath + 'emoticons/images/'),
allowPreview = self.allowPreviewEmoticons === undefined ? true : self.allowPreviewEmoticons, allowPreview = self.allowPreviewEmoticons === undefined ? true : self.allowPreviewEmoticons,
currentPageNum = 1; currentPageNum = 1;
self.clickToolbar(name, function() { self.clickToolbar(name, function() {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -624,6 +624,15 @@ a.homepagePostTypeQuiz {background:url(../images/homepage_icon.png) -90px -124px
a.homepagePostTypeQuestion {background:url(../images/homepage_icon.png) -10px -273px no-repeat; padding-left:23px;} a.homepagePostTypeQuestion {background:url(../images/homepage_icon.png) -10px -273px no-repeat; padding-left:23px;}
a.homepagePostTypeMine {background:url(../images/homepage_icon.png) -187px -277px no-repeat; padding-left:23px;} a.homepagePostTypeMine {background:url(../images/homepage_icon.png) -187px -277px no-repeat; padding-left:23px;}
a.homepagePostTypeAll {background:url(../images/homepage_icon.png) -185px -308px no-repeat; padding-left:23px;} a.homepagePostTypeAll {background:url(../images/homepage_icon.png) -185px -308px no-repeat; padding-left:23px;}
.homepagePostTypeMore {width:180px; border-top:1px dashed #dddddd; margin-top:5px;}
.w100 {width:100px;}
a.homepageTypeUnread {background:url(../images/homepage_icon.png) -6px -579px no-repeat; padding-left:23px;}
a.homepageTypePTask {background:url(../images/homepage_icon.png) -176px -523px no-repeat; padding-left:23px;}
a.homepageTypeSystem {background:url(../images/homepage_icon.png) -88px -552px no-repeat; padding-left:23px;}
a.homepageTypePNews {background:url(../images/homepage_icon.png) -5px -553px no-repeat; padding-left:23px;}
a.homepageTypePost {background:url(../images/homepage_icon.png) -178px -553px no-repeat; padding-left:23px;}
a.homepageTypeUMessage {background:url(../images/homepage_icon.png) -4px -519px no-repeat; padding-left:23px;}
a.homepageTypeUApply {background:url(../images/homepage_icon.png) -91px -582px no-repeat; padding-left:23px;}
a.postTypeGrey {color:#888888;} a.postTypeGrey {color:#888888;}
a.postTypeGrey:hover {color:#269ac9;} a.postTypeGrey:hover {color:#269ac9;}
.homepagePostBrief {width:710px; margin:0px auto; position:relative;} .homepagePostBrief {width:710px; margin:0px auto; position:relative;}