commit
						2ba87477fa
					
				| @ -1,4 +1,4 @@ | ||||
| <%= javascript_include_tag "/assets/kindeditor/kindeditor" %> | ||||
| <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> | ||||
| <%= labelled_form_for @bid,:html => { :multipart => true } do |f| %> | ||||
|     <%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}",:f=>f,:edit_mode => true} %> | ||||
| <% end %> | ||||
| <% end %> | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| <!-- added by fq --> | ||||
| <h1>编辑讨论区</h1> | ||||
| <%= javascript_include_tag "/assets/kindeditor/kindeditor" %> | ||||
| <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'  %> | ||||
| <%= render 'form_edit_mode' %> | ||||
|  | ||||
| @ -1,5 +1,14 @@ | ||||
| <%= link_to h(@added_to), @added_to_url %><br /> | ||||
| 
 | ||||
| <ul><% @attachments.each do |attachment | %> | ||||
| <li><%=h attachment.filename %></li> | ||||
| <% end %></ul> | ||||
| <ul> | ||||
|   <% @attachments.each do |attachment | %> | ||||
|       <li> | ||||
|         <%= link_to attachment.author, user_activities_url(attachment.author), | ||||
|         :style => "color:#1B55A7; float:left;display:block; margin-right:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> | ||||
|         <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_project_mail_upload) %></span> | ||||
|         <%= link_to truncate(attachment.filename,length: 30,omission: '...'), project_files_url(attachment.project), | ||||
|         :style => "color:#1B55A7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" | ||||
|        %> | ||||
|       </li> | ||||
|   <% end %> | ||||
| </ul> | ||||
|  | ||||
| @ -1,344 +1,243 @@ | ||||
| <%= @subject %> | ||||
| <% if @attachments.first || @course_news.first || @bids.first || | ||||
|       @course_journal_messages.first|| @course_messages.first %> | ||||
| <%= l(:label_course_overview)%> | ||||
|   <% unless @course_news.first.nil? %> | ||||
|          <%= l(:label_course_news) %> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| <% if @attachments.first || @course_news.first || @course_news_comments.first || @bids.first || | ||||
|         @course_journal_messages.first|| @course_messages.first || @attachments.first %> | ||||
|     <%= l(:label_course_overview)%> | ||||
|     <% unless @course_news.first.nil? %> | ||||
|         <%= l(:label_course_news) %> | ||||
|         <% @course_news.each do |course_new|%> | ||||
| 
 | ||||
|            ▪ | ||||
|              [ | ||||
| 
 | ||||
|               <%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value)%> | ||||
|              ] | ||||
| 
 | ||||
|               <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value) | ||||
|                            %> | ||||
|              <%= l(:label_project_notice) %> | ||||
|             ▪[<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value)%> ] | ||||
| 
 | ||||
|               <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value) | ||||
| 
 | ||||
| 
 | ||||
|               %> <%= format_time(course_new.created_on) %> | ||||
|             <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value) %> | ||||
|             <%= l(:label_project_notice) %> | ||||
|             <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value) %> | ||||
|             <%= format_time(course_new.created_on) %> | ||||
|         <% end %> | ||||
|     <% end %> | ||||
| 
 | ||||
|     <% unless @course_news_comments.first.nil? %> | ||||
|         <%= l(:label_course_news) %> | ||||
|         <% @course_news_comments.each do |course_news_comment|%> | ||||
|             ▪[ <% unless course_news_comment.commented.nil? %> | ||||
|                 <%= link_to truncate(course_news_comment.commented.course.name,length: 30,omission: '...'), course_url(course_news_comment.commented.course, :token => @token.value) %> | ||||
|             <% end %> | ||||
|             ] | ||||
|             <%= link_to course_news_comment.author, user_activities_url(course_news_comment.author,:token => @token.value) %> | ||||
|             <%= l(:label_project_notice) %> | ||||
|             <%= link_to truncate(course_news_comment.comments,length: 30,omission: '...'), news_url(course_news_comment.commented,:token => @token.value) %> | ||||
|             <%= format_time(course_news_comment.created_on) %> | ||||
|         <% end %> | ||||
|     <% end %> | ||||
| 
 | ||||
|   <% end %> | ||||
|   <% unless  @bids.empty? %> | ||||
|     <%= l(:label_homework_overview) %> | ||||
|     <% unless  @bids.empty? %> | ||||
|         <%= l(:label_homework_overview) %> | ||||
|         <% unless @bids.first.nil?%> | ||||
|             <% @bids.each do |bid| %> | ||||
|                ▪ | ||||
|                 [ | ||||
| 
 | ||||
|                   <%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value) | ||||
| 
 | ||||
|                                 %> | ||||
|                  ] | ||||
| 
 | ||||
|                   <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value) | ||||
|                                %> | ||||
|                <%= l(:label_course_homework) %> | ||||
| 
 | ||||
|                   <%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value) | ||||
| 
 | ||||
| 
 | ||||
|                   %> | ||||
|                  <%= format_time(bid.created_at) %> | ||||
| 
 | ||||
|                 ▪[<%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value) %>] | ||||
|                 <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value) %> | ||||
|                 <%= l(:label_course_homework) %> | ||||
|                 <%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value) %> | ||||
|                 <%= format_time(bid.created_at) %> | ||||
|             <% end %> | ||||
|         <% end %> | ||||
|         <!--作业动态 end--> | ||||
|     <% end %> | ||||
| 
 | ||||
| 
 | ||||
|      <!--作业动态 end--> | ||||
|   <% end %> | ||||
| 
 | ||||
|   <% unless @course_journal_messages.first.nil? %> | ||||
| 
 | ||||
|           <%= l(:view_course_journals_for_messages) %> | ||||
| 
 | ||||
| 
 | ||||
|     <% unless @course_journal_messages.first.nil? %> | ||||
|         <%= l(:view_course_journals_for_messages) %> | ||||
|         <% @course_journal_messages.each do |course_journal_message|%> | ||||
| 
 | ||||
|               [ | ||||
| 
 | ||||
|               <%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value) | ||||
| 
 | ||||
|                             %> | ||||
|              ] | ||||
| 
 | ||||
|               <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value) | ||||
|                            %> | ||||
|             [ <%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value) %>] | ||||
|             <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value) %> | ||||
|             <%= l(:label_send_course_journals_for_messages) %> | ||||
| 
 | ||||
|               <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value) | ||||
| 
 | ||||
| 
 | ||||
|               %> | ||||
|               <%= format_time(course_journal_message.created_on) %> | ||||
| 
 | ||||
|             <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value) %> | ||||
|             <%= format_time(course_journal_message.created_on) %> | ||||
|         <% end %> | ||||
|     <% end %> | ||||
| 
 | ||||
| 
 | ||||
|   <% end %> | ||||
| 
 | ||||
|   <% unless @course_messages.first.nil? %> | ||||
| 
 | ||||
|           <%= l(:view_borad_course) %> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     <% unless @course_messages.first.nil? %> | ||||
|         <%= l(:view_borad_course) %> | ||||
|         <% @course_messages.each do |course_message|%> | ||||
| 
 | ||||
|               ▪ | ||||
|               [ | ||||
| 
 | ||||
|               <%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course, :token => @token.value) | ||||
| 
 | ||||
|                             %> | ||||
|               ] | ||||
| 
 | ||||
|               <%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value) | ||||
|                            %> | ||||
|               <%= l(:label_send_course_messages) %> | ||||
| 
 | ||||
|               <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value) | ||||
| 
 | ||||
| 
 | ||||
|               %> | ||||
|               <%= format_time(course_message.created_on) %> | ||||
| 
 | ||||
|             ▪[<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course, :token => @token.value)%>] | ||||
|             <%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value) %> | ||||
|             <%= l(:label_send_course_messages) %> | ||||
|             <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value) %> | ||||
|             <%= format_time(course_message.created_on) %> | ||||
|         <% end %> | ||||
|     <% end %> | ||||
| 
 | ||||
| 
 | ||||
|   <% end %> | ||||
| 
 | ||||
|   <% unless @attachments.first.nil? %> | ||||
| 
 | ||||
|           <%= l(:label_course_attendingcontestwork_download) %> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     <% unless @attachments.first.nil? %> | ||||
|         <%= l(:label_course_attendingcontestwork_download) %> | ||||
|         <% @attachments.each do |attachment|%> | ||||
|             ▪[ | ||||
| 
 | ||||
|               <%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value) | ||||
| 
 | ||||
|                             %> | ||||
|               ] | ||||
| 
 | ||||
|               <%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value) | ||||
|                            %> | ||||
|               <%= l(:label_course_file_upload) %> | ||||
| 
 | ||||
|               <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value) | ||||
| 
 | ||||
| 
 | ||||
|               %> | ||||
|               <%= format_time(attachment.created_on) %> | ||||
|             </li> | ||||
|             ▪[<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value) %>] | ||||
|             <%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value) %> | ||||
|             <%= l(:label_course_file_upload) %> | ||||
|             <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value) %> | ||||
|             <%= format_time(attachment.created_on) %> | ||||
|         <% end %> | ||||
| 
 | ||||
|       </ul><!--课件下载  end--> | ||||
|   <% end %> | ||||
|         <!--课件下载  end--> | ||||
|     <% end %> | ||||
| <% end %><!--课程动态  end--> | ||||
| 
 | ||||
| <% @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first %> | ||||
| <%= l(:label_project_overview_new)%> | ||||
|   <% unless @issues.first.nil? %> | ||||
| 
 | ||||
|           <%= l(:label_issue_tracking) %> | ||||
| 
 | ||||
| 
 | ||||
| <!-- 项目动态 --> | ||||
| <!--项目相关--> | ||||
| <% if @issues.first || @project_messages.first || @issues_journals.first || @wiki_contents.first || @project_news.first || @project_news_comments.first || @project_journal_messages.first || | ||||
|         @project_news_comments.first  %> | ||||
|     <%= l(:label_project_overview_new)%> | ||||
|     <% unless @issues.first.nil? %> | ||||
|         <%= l(:label_issue_tracking) %> | ||||
|         <% @issues.each do |issue|%> | ||||
|             ▪ | ||||
|              [ | ||||
| 
 | ||||
|               <%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value) | ||||
| 
 | ||||
|                             %> | ||||
|               ] | ||||
| 
 | ||||
|               <%= link_to issue.author, user_activities_url(issue.author,:token => @token.value) | ||||
|                            %> | ||||
|              <%= l(:label_project_issue) %> | ||||
| 
 | ||||
|               <%= link_to truncate(issue. subject,length: 30,omission: '...'),issue_url(issue,  :token => @token.value) | ||||
| 
 | ||||
| 
 | ||||
|               %> | ||||
|               <%= format_time(issue.created_on) %> | ||||
|             ▪[<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value) %>] | ||||
|             <%= link_to issue.author, user_activities_url(issue.author,:token => @token.value) %> | ||||
|             <%= l(:label_project_issue) %> | ||||
|             <%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue,  :token => @token.value) %> | ||||
|             <%= format_time(issue.created_on) %> | ||||
|         <% end %> | ||||
|         <!--问题跟踪 end--> | ||||
|     <% end %> | ||||
| 
 | ||||
|     <!-- issues回复 --> | ||||
|     <% unless @issues_journals.first.nil? %> | ||||
|         <%= l(:label_issue_tracking) %> | ||||
|         <% @issues_journals.each do |issues_journal| %> | ||||
|             ▪[<%= link_to truncate(issues_journal.issue.project.name,length: 30,omission: '...'), project_url(issues_journal.issue.project, :token => @token.value) %>] | ||||
|             <%= link_to issues_journal.user, user_activities_url(issues_journal.user,:token => @token.value) %> | ||||
|             <%= l(:label_project_issue) %> | ||||
|             <% if issues_journal.notes.nil? %> | ||||
|                 <%= link_to truncate(issues_journal.issue.subject,length: 30,omission: '...'),issue_url(issue,  :token => @token.value) %> | ||||
|             <% else %> | ||||
|                 <%= link_to truncate(issues_journal.notes,length: 30,omission: '...'),issue_url(issues_journal.issue,  :token => @token.value) %> | ||||
|             <% end %> | ||||
|             <%= format_time(issues_journal.created_on) %> | ||||
|         <% end %> | ||||
|     <% end %> | ||||
| 
 | ||||
|   <% end %> | ||||
| 
 | ||||
|   <% unless @project_messages.first.nil? %> | ||||
| 
 | ||||
|           <%= l(:project_moule_boards_show) %> | ||||
| 
 | ||||
| 
 | ||||
|     <!-- 讨论区 --> | ||||
|     <% unless @project_messages.first.nil? %> | ||||
|         <%= l(:project_moule_boards_show) %> | ||||
|         <% @project_messages.each do |project_message|%> | ||||
|           ▪[ | ||||
| 
 | ||||
|               <%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value) | ||||
| 
 | ||||
|                           %> | ||||
|         ] | ||||
| 
 | ||||
|               <%= link_to project_message.author, board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value) | ||||
|                            %> | ||||
|               <%= l(:label_send_course_messages) %> | ||||
| 
 | ||||
|               <%= link_to truncate(project_message. subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value) | ||||
| 
 | ||||
| 
 | ||||
|               %> | ||||
|               <%= format_time(project_message.created_on) %> | ||||
|             ▪[<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value) %>] | ||||
|             <%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value) %> | ||||
|             <%= l(:label_send_course_messages) %> | ||||
|             <%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value) %> | ||||
|             <%= format_time(project_message.created_on) %> | ||||
|         <% end %> | ||||
|         <!--项目论坛 end--> | ||||
|     <% end %> | ||||
| 
 | ||||
|     <!--项目wiki--> | ||||
|     <% unless @wiki_contents.first.nil? %> | ||||
| 
 | ||||
|               <%= l(:label_wiki) %> | ||||
| 
 | ||||
|           <% @wiki_contents.each do |wikicontent|%> | ||||
|               ▪[ | ||||
|                 <% unless wikicontent.page.nil? %> | ||||
|                     <%= link_to truncate(wikicontent.page.wiki.project.name,length: 30,omission: '...'), project_url(wikicontent.page.wiki.project, :token => @token.value) | ||||
|                                %> | ||||
|                 <% end %> | ||||
|                 ] | ||||
|                 <%= link_to wikicontent.author, user_activities_url(wikicontent.author,:token => @token.value) %> | ||||
|                 <%= l(:label_project_notice) %> | ||||
|                 <% unless wikicontent.page.nil? %> | ||||
|                     <%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value) %> | ||||
|                 <% end %> | ||||
|                 <%= format_time(wikicontent.updated_on) %> | ||||
| 
 | ||||
|           <% end %> | ||||
|         <%= l(:label_wiki) %> | ||||
|         <% @wiki_contents.each do |wikicontent|%> | ||||
|             ▪[<% unless wikicontent.page.nil? %> | ||||
|                 <%= link_to truncate(wikicontent.page.wiki.project.name,length: 30,omission: '...'), project_url(wikicontent.page.wiki.project, :token => @token.value) %> | ||||
|             <% end %> | ||||
|             ] | ||||
|             <%= link_to wikicontent.author, user_activities_url(wikicontent.author,:token => @token.value) %> | ||||
|             <%= l(:label_wiki_mail_notification) %> | ||||
|             <% unless wikicontent.page.nil? %> | ||||
|                 <%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value) %> | ||||
|             <% end %> | ||||
|             <%= format_time(wikicontent.updated_on) %> | ||||
|         <% end %> | ||||
|     <% end %> | ||||
| 
 | ||||
|     <!--项目新闻--> | ||||
|     <% unless @project_news.first.nil? %> | ||||
|         <%= l(:label_project_news) %> | ||||
|         <% @project_news.each do |project_new|%> | ||||
|             ▪[<%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value) %> ] | ||||
|             <%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value) %> | ||||
|             <%= l(:label_project_mail_notice) %> | ||||
|             <%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value) %> | ||||
|             <%= format_time(project_new.created_on) %> | ||||
|         <% end %> | ||||
|     <% end %> | ||||
| 
 | ||||
|               <%= l(:label_project_news) %> | ||||
| 
 | ||||
|           <% @project_news.each do |project_new|%> | ||||
|              ▪[ | ||||
| 
 | ||||
|                 <%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value) | ||||
|                             %> | ||||
|                ] | ||||
|                 <%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value) | ||||
|                            %> | ||||
|                 <%= l(:label_project_notice) %> | ||||
| 
 | ||||
|                 <%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value) | ||||
|                             %> | ||||
|                 <%= format_time(project_new.created_on) %> | ||||
|     <!-- 项目新闻回复 --> | ||||
|     <% unless @project_news_comments.first.nil? %> | ||||
|         <%= l(:label_project_news) %> | ||||
|         <% @project_news_comments.each do |project_news_comment|%> | ||||
|             ▪[ <% unless project_news_comment.commented.nil? %> | ||||
|                 <%= link_to truncate(project_news_comment.commented.project.name,length: 30,omission: '...'), project_url(project_news_comment.commented.project, :token => @token.value) %> | ||||
|             <% end %>] | ||||
|             <%= link_to project_news_comment.author, user_activities_url(project_news_comment.author,:token => @token.value) %> | ||||
|             <%= l(:label_project_mail_notice) %> | ||||
|             <%= link_to truncate(project_news_comment.comments.html_safe,length: 30,omission: '...'), news_url(project_news_comment.commented,:token => @token.value) %> | ||||
|             <%= format_time(project_news_comment.created_on) %> | ||||
|         <% end %> | ||||
|         <!-- 项目新闻回复end --> | ||||
|     <% end %> | ||||
| 
 | ||||
|           <% end %> | ||||
|     <!-- 项目上传资源 --> | ||||
|     <% unless @project_attachments.first.nil? %> | ||||
|         <%= l(:label_project_mail_attachments) %> | ||||
|          <% @project_attachments.each do |project_attachment|%> | ||||
|               ▪[<%= link_to truncate(project_attachment.project.name,length: 30,omission: '...'), project_url(project_attachment.project, :token => @token.value) %>] | ||||
|               <%= link_to project_attachment.author, user_activities_url(project_attachment.author,:token => @token.value) %> | ||||
|               <%= l(:label_project_mail_upload) %> | ||||
|               <%= link_to truncate(project_attachment.filename,length: 30,omission: '...'),project_files_url(project_attachment.project,:token => @token.value) %> | ||||
|               <%= format_time(project_attachment.created_on) %> | ||||
|           <% end %> <!-- 项目上传资源  end--> | ||||
|     <% end %> | ||||
| 
 | ||||
|     <!--项目留言--> | ||||
|     <% unless @project_journal_messages.first.nil? %> | ||||
|               <%= l(:label_project_mail_feedback) %> | ||||
| 
 | ||||
|           <% @project_journal_messages.each do |project_journal_message|%> | ||||
|               ▪[ | ||||
| 
 | ||||
|                 <%= link_to truncate(project_journal_message.project.name,length: 30,omission: '...'), project_url(project_journal_message.project, :token => @token.value) | ||||
|                             %> | ||||
|                 ] | ||||
| 
 | ||||
|                 <%= link_to project_journal_message.user, user_activities_url(project_journal_message.user,:token => @token.value) %> | ||||
|                 <%= l(:label_send_course_journals_for_messages) %> | ||||
| 
 | ||||
|                 <%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value) | ||||
|                 %> | ||||
|                 <%= format_time(project_journal_message.created_on) %> | ||||
|           <% end %> | ||||
|         <%= l(:label_project_mail_feedback) %> | ||||
|         <% @project_journal_messages.each do |project_journal_message|%> | ||||
|             ▪[<%= link_to truncate(project_journal_message.project.name,length: 30,omission: '...'), project_url(project_journal_message.project, :token => @token.value) %> ] | ||||
|             <%= link_to project_journal_message.user, user_activities_url(project_journal_message.user,:token => @token.value) %> | ||||
|             <%= l(:label_send_course_journals_for_messages) %> | ||||
|             <%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value) %> | ||||
|             <%= format_time(project_journal_message.created_on) %> | ||||
|         <% end %> | ||||
|         <!--项目留言 end--> | ||||
|     <% end %> | ||||
|     </div> | ||||
| <% end %><!-- 项目动态end --> | ||||
| 
 | ||||
|   <% end %> | ||||
| 
 | ||||
| 
 | ||||
| <% unless @user_journal_messages.first.nil? %> | ||||
| <%= l(:label_activities) %> | ||||
| 
 | ||||
| 
 | ||||
|           <%= l(:label_user_message) %> | ||||
|           (<%= @user_journal_messages.count %>) | ||||
| 
 | ||||
|         <% @user_journal_messages.each do |user_journal_message|%> | ||||
|            ▪ | ||||
| 
 | ||||
|               <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value) | ||||
| 
 | ||||
|                             %> | ||||
|               <%= l(:label_show_your_message) %> | ||||
| 
 | ||||
|               <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'), feedback_url(@user,:token => @token.value) | ||||
| 
 | ||||
| 
 | ||||
|               %> | ||||
|              <%= format_time(user_journal_message.created_on) %> | ||||
| 
 | ||||
|         <% end %> | ||||
| 
 | ||||
| 
 | ||||
|     <%= l(:label_activities) %> | ||||
|     <%= l(:label_user_message) %> | ||||
|     (<%= @user_journal_messages.count %>) | ||||
|     <% @user_journal_messages.each do |user_journal_message|%> | ||||
|         ▪ <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value)%> | ||||
|         <%= l(:label_show_your_message) %> | ||||
|         <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'), feedback_url(@user,:token => @token.value) %> | ||||
|         <%= format_time(user_journal_message.created_on) %> | ||||
|     <% end %> | ||||
| <% end %> | ||||
| 
 | ||||
| <% if @forums.first || @memos.first %> | ||||
|     <%= l(:lable_bar_active) %> | ||||
|       <% unless @forums.first.nil? %> | ||||
| 
 | ||||
|               <%= l(:label_user_forum) %> | ||||
| 
 | ||||
| 
 | ||||
|             <% @forums.each do |forum|%> | ||||
|                 ▪ | ||||
| 
 | ||||
|                   <%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value) %> | ||||
|                   <%= l(:label_forum_new) %> | ||||
| 
 | ||||
|                   <%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value) | ||||
|                              %> | ||||
|                   <%= format_time(forum.created_at) %> | ||||
| 
 | ||||
|             <% end %> | ||||
| 
 | ||||
|           <!-- 新建贴吧 end--> | ||||
|       <% end %> | ||||
|       <% unless @memos.first.nil? %> | ||||
| 
 | ||||
|               <%= l(:label_user_message_forum) %> | ||||
| 
 | ||||
| 
 | ||||
|             <% @memos.each do |memo|%> | ||||
|                 ▪ | ||||
| 
 | ||||
|                   <%= link_to memo.author, user_activities_url(memo.author,:token => @token.value)%> | ||||
|                   <%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %> | ||||
| 
 | ||||
|                   <%= link_to truncate(memo.subject,length: 30,omission: '...'),forum_memo_url(memo.forum, (memo.parent_id.nil? ? memo : memo.parent_id)) | ||||
|                               %> | ||||
|                   <%= format_time(memo.created_at) %> | ||||
| 
 | ||||
|             <% end %> | ||||
| 
 | ||||
| 
 | ||||
|          <!-- 新建贴吧 end--> | ||||
|       <% end %> | ||||
|     <% unless @forums.first.nil? %> | ||||
|         <%= l(:label_user_forum) %> | ||||
|         <% @forums.each do |forum|%> | ||||
|             ▪<%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value) %> | ||||
|             <%= l(:label_forum_new) %> | ||||
|             <%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value) %> | ||||
|             <%= format_time(forum.created_at) %> | ||||
|         <% end %> | ||||
|         <!-- 新建贴吧 end--> | ||||
|     <% end %> | ||||
|     <% unless @memos.first.nil? %> | ||||
|         <%= l(:label_user_message_forum) %> | ||||
|         <% @memos.each do |memo|%> | ||||
|             ▪<%= link_to memo.author, user_activities_url(memo.author,:token => @token.value)%> | ||||
|             <%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %> | ||||
|             <%= link_to truncate(memo.subject,length: 30,omission: '...'),forum_memo_url(memo.forum, (memo.parent_id.nil? ? memo : memo.parent_id))%> | ||||
|             <%= format_time(memo.created_at) %> | ||||
|         <% end %> | ||||
|      <!-- 新建贴吧 end--> | ||||
|     <% end %> | ||||
|     <!--贴吧动态 end--> | ||||
| <% end %> | ||||
| 
 | ||||
| <% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %> | ||||
|   <% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %> | ||||
|     <%= l(mail_option) %> | ||||
|   <% else %> | ||||
|     <%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %> | ||||
|   <% end %> | ||||
|     <% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %> | ||||
|         <%= l(mail_option) %> | ||||
|     <% else %> | ||||
|         <%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %> | ||||
|     <% end %> | ||||
| <% end %> | ||||
|  | ||||
| @ -0,0 +1,50 @@ | ||||
| <div class="project_r_h"> | ||||
|   <h2 class="project_h2"> | ||||
|     缺评情况 | ||||
|   </h2> | ||||
| </div> | ||||
| <div class="cl"></div> | ||||
| 
 | ||||
| <div class="st_box"> | ||||
|   <ul class="st_box_top"> | ||||
|     <li  class="ml10" style="padding-right: 15px;"> | ||||
|       <a href="javascript:void(0)">学号</a> | ||||
|     </li> | ||||
|     <li  class="ml90" style="padding-right: 5px;"> | ||||
|       <a href="javascript:void(0)">姓名</a> | ||||
|     </li> | ||||
|     <li class="ml320"> | ||||
|       <a href="javascript:void(0)">应评</a> | ||||
|     </li> | ||||
|     <li class="ml30"> | ||||
|       <a href="javascript:void(0)">实评</a> | ||||
|     </li> | ||||
|     <li class="ml30"> | ||||
|       <%= link_to "缺评",student_work_absence_penalty_student_work_index_path(:homework => @homework.id,:order => @order)%> | ||||
|       <a href="javascript:void(0);" class="<%= @order == 'desc' ? 'st_up' : 'st_down'%>" ></a> | ||||
|     </li> | ||||
|   </ul> | ||||
|   <div class="cl"></div><!--st_box_top end--> | ||||
| 
 | ||||
|   <% @stundet_works.each do |student_work|%> | ||||
|       <ul class="hwork_ul <%= cycle("b_grey", "") %>" id="student_work_<%= student_work.id%>"> | ||||
|         <li class="hwork_num_ab mr10 ml10"> | ||||
|             <span> | ||||
|               <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> | ||||
|             </span> | ||||
|         </li> | ||||
|         <li class=" hwork_name_ab "> | ||||
|           <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%> | ||||
|         </li> | ||||
|         <li class="absence c_grey"> | ||||
|           <%= student_work.all_count%> | ||||
|         </li> | ||||
|         <li class="absence c_grey"> | ||||
|           <%= student_work.has_count%> | ||||
|         </li> | ||||
|         <li class="absence <%= student_work.absence == 0 ? 'c_green' : 'c_red'%>"> | ||||
|           <%= student_work.absence%> | ||||
|         </li> | ||||
|       </ul> | ||||
|   <% end%> | ||||
| </div> | ||||
| @ -1,6 +1,9 @@ | ||||
| <style type="text/css"> | ||||
|   p.lablewidth>label{width:190px;} | ||||
| </style> | ||||
| <%= labelled_fields_for :pref, @user.pref do |pref_fields| %> | ||||
| <p><%= pref_fields.check_box :hide_mail %></p> | ||||
| <p style="width:520px;"><%= pref_fields.time_zone_select :time_zone, nil, :include_blank => true %></p> | ||||
| <p style="width:477px;"><%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %></p> | ||||
| <p class="lablewidth"><%= pref_fields.check_box :hide_mail %></p> | ||||
| <p class="lablewidth" style="width:520px;"><%= pref_fields.time_zone_select :time_zone, nil, :include_blank => true %></p> | ||||
| <p class="lablewidth" style="width:477px;"><%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %></p> | ||||
| 
 | ||||
| <% end %> | ||||
|  | ||||
| @ -0,0 +1,18 @@ | ||||
| class HomeworkCommonTime < ActiveRecord::Migration | ||||
|   def up | ||||
|     count = StudentWork.all.count / 100 + 1 | ||||
|     transaction do | ||||
|       for i in 1 ... count do i | ||||
|       StudentWork.page(i).per(100).each do |homework| | ||||
|         old_homework = HomeworkAttach.where(:user_id => homework.user_id, :name => homework.name, :description => homework.description).first | ||||
|         if old_homework | ||||
|           homework.update_column('created_at', old_homework.created_at) | ||||
|         end | ||||
|       end | ||||
|       end | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def down | ||||
|   end | ||||
| end | ||||
| @ -0,0 +1,32 @@ | ||||
| #coding=utf-8 | ||||
| 
 | ||||
| module Trustie | ||||
|   module Cache | ||||
|     module ClearCourseEvent | ||||
|       def self.included(base) | ||||
|         base.class_eval{ | ||||
|           after_create :clear_course_events | ||||
|           after_destroy :clear_course_events | ||||
|         } | ||||
|       end | ||||
| 
 | ||||
|       def clear_course_events | ||||
|         if Rails.env.production? && Setting.course_cahce_enabled? | ||||
|           Rails.cache.delete(cache_key)  | ||||
|         end | ||||
|       end | ||||
| 
 | ||||
|       def cache_key | ||||
|         course_id = nil | ||||
|         if Message === self.act | ||||
|           course_id = self.act.board.course_id | ||||
|         elsif self.act.respond_to?(:course_id) | ||||
|           course_id = self.act.course_id | ||||
|         end | ||||
|         "course_events_#{course_id}".to_sym | ||||
|       end | ||||
| 
 | ||||
|     end | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| @ -0,0 +1,385 @@ | ||||
| // Generated by CoffeeScript 1.9.0
 | ||||
| 
 | ||||
| /*  | ||||
| paste.js is an interface to read data ( text / image ) from clipboard in different browsers. It also contains several hacks. | ||||
| https://github.com/layerssss/paste.js
 | ||||
|  */ | ||||
| 
 | ||||
| (function() { | ||||
|     var $, Paste, createHiddenEditable, dataURLtoBlob; | ||||
| 
 | ||||
|     $ = window.jQuery; | ||||
| 
 | ||||
|     $.paste = function(pasteContainer) { | ||||
|         var pm; | ||||
|         if (typeof console !== "undefined" && console !== null) { | ||||
|             console.log("DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead."); | ||||
|         } | ||||
|         pm = Paste.mountNonInputable(pasteContainer); | ||||
|         return pm._container; | ||||
|     }; | ||||
| 
 | ||||
|     $.fn.pastableNonInputable = function() { | ||||
|         var el, _i, _len; | ||||
|         for (_i = 0, _len = this.length; _i < _len; _i++) { | ||||
|             el = this[_i]; | ||||
|             Paste.mountNonInputable(el); | ||||
|         } | ||||
|         return this; | ||||
|     }; | ||||
| 
 | ||||
|     $.fn.pastableTextarea = function() { | ||||
|         var el, _i, _len; | ||||
|         for (_i = 0, _len = this.length; _i < _len; _i++) { | ||||
|             el = this[_i]; | ||||
|             Paste.mountTextarea(el); | ||||
|         } | ||||
|         return this; | ||||
|     }; | ||||
| 
 | ||||
|     $.fn.pastableContenteditable = function() { | ||||
|         var el, _i, _len; | ||||
|         for (_i = 0, _len = this.length; _i < _len; _i++) { | ||||
|             el = this[_i]; | ||||
|             Paste.mountContenteditable(el); | ||||
|         } | ||||
|         return this; | ||||
|     }; | ||||
| 
 | ||||
|     dataURLtoBlob = function(dataURL, sliceSize) { | ||||
|         var b64Data, byteArray, byteArrays, byteCharacters, byteNumbers, contentType, i, m, offset, slice, _ref; | ||||
|         if (sliceSize == null) { | ||||
|             sliceSize = 512; | ||||
|         } | ||||
|         if (!(m = dataURL.match(/^data\:([^\;]+)\;base64\,(.+)$/))) { | ||||
|             return null; | ||||
|         } | ||||
|         _ref = m, m = _ref[0], contentType = _ref[1], b64Data = _ref[2]; | ||||
|         byteCharacters = atob(b64Data); | ||||
|         byteArrays = []; | ||||
|         offset = 0; | ||||
|         while (offset < byteCharacters.length) { | ||||
|             slice = byteCharacters.slice(offset, offset + sliceSize); | ||||
|             byteNumbers = new Array(slice.length); | ||||
|             i = 0; | ||||
|             while (i < slice.length) { | ||||
|                 byteNumbers[i] = slice.charCodeAt(i); | ||||
|                 i++; | ||||
|             } | ||||
|             byteArray = new Uint8Array(byteNumbers); | ||||
|             byteArrays.push(byteArray); | ||||
|             offset += sliceSize; | ||||
|         } | ||||
|         return new Blob(byteArrays, { | ||||
|             type: contentType | ||||
|         }); | ||||
|     }; | ||||
| 
 | ||||
|     createHiddenEditable = function() { | ||||
|         return $(document.createElement('div')).attr('contenteditable', true).css({ | ||||
|             width: 1, | ||||
|             height: 1, | ||||
|             position: 'fixed', | ||||
|             left: -100, | ||||
|             overflow: 'hidden' | ||||
|         }); | ||||
|     }; | ||||
| 
 | ||||
|     Paste = (function() { | ||||
|         Paste.prototype._target = null; | ||||
| 
 | ||||
|         Paste.prototype._container = null; | ||||
| 
 | ||||
|         Paste.mountNonInputable = function(nonInputable) { | ||||
|             var paste; | ||||
|             paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable); | ||||
|             $(nonInputable).on('click', (function(_this) { | ||||
|                 return function() { | ||||
|                     return paste._container.focus(); | ||||
|                 }; | ||||
|             })(this)); | ||||
|             paste._container.on('focus', (function(_this) { | ||||
|                 return function() { | ||||
|                     return $(nonInputable).addClass('pastable-focus'); | ||||
|                 }; | ||||
|             })(this)); | ||||
|             return paste._container.on('blur', (function(_this) { | ||||
|                 return function() { | ||||
|                     return $(nonInputable).removeClass('pastable-focus'); | ||||
|                 }; | ||||
|             })(this)); | ||||
|         }; | ||||
| 
 | ||||
|         Paste.mountTextarea = function(textarea) { | ||||
|             var ctlDown, paste; | ||||
|             if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) { | ||||
|                 return this.mountContenteditable(textarea); | ||||
|             } | ||||
|             paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea); | ||||
|             ctlDown = false; | ||||
|             $(textarea).on('keyup', function(ev) { | ||||
|                 var _ref; | ||||
|                 if ((_ref = ev.keyCode) === 17 || _ref === 224) { | ||||
|                     return ctlDown = false; | ||||
|                 } | ||||
|             }); | ||||
|             $(textarea).on('keydown', function(ev) { | ||||
|                 var _ref; | ||||
|                 if ((_ref = ev.keyCode) === 17 || _ref === 224) { | ||||
|                     ctlDown = true; | ||||
|                 } | ||||
|                 if (ctlDown && ev.keyCode === 86) { | ||||
|                     return paste._container.focus(); | ||||
|                 } | ||||
|             }); | ||||
|             $(paste._target).on('pasteImage', (function(_this) { | ||||
|                 return function() { | ||||
|                     return $(textarea).focus(); | ||||
|                 }; | ||||
|             })(this)); | ||||
|             $(paste._target).on('pasteText', (function(_this) { | ||||
|                 return function() { | ||||
|                     return $(textarea).focus(); | ||||
|                 }; | ||||
|             })(this)); | ||||
|             $(textarea).on('focus', (function(_this) { | ||||
|                 return function() { | ||||
|                     return $(textarea).addClass('pastable-focus'); | ||||
|                 }; | ||||
|             })(this)); | ||||
|             return $(textarea).on('blur', (function(_this) { | ||||
|                 return function() { | ||||
|                     return $(textarea).removeClass('pastable-focus'); | ||||
|                 }; | ||||
|             })(this)); | ||||
|         }; | ||||
| 
 | ||||
|         Paste.mountContenteditable = function(contenteditable) { | ||||
|             var paste; | ||||
|             paste = new Paste(contenteditable, contenteditable); | ||||
|             $(contenteditable).on('focus', (function(_this) { | ||||
|                 return function() { | ||||
|                     return $(contenteditable).addClass('pastable-focus'); | ||||
|                 }; | ||||
|             })(this)); | ||||
|             return $(contenteditable).on('blur', (function(_this) { | ||||
|                 return function() { | ||||
|                     return $(contenteditable).removeClass('pastable-focus'); | ||||
|                 }; | ||||
|             })(this)); | ||||
|         }; | ||||
| 
 | ||||
|         function Paste(_at__container, _at__target) { | ||||
|             this._container = _at__container; | ||||
|             this._target = _at__target; | ||||
|             this._container = $(this._container); | ||||
|             this._target = $(this._target).addClass('pastable'); | ||||
|             this._container.on('paste', (function(_this) { | ||||
|                 return function(ev) { | ||||
|                     var clipboardData, file, item, reader, text, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3, _results; | ||||
|                     if (((_ref = ev.originalEvent) != null ? _ref.clipboardData : void 0) != null) { | ||||
|                         clipboardData = ev.originalEvent.clipboardData; | ||||
|                         if (clipboardData.items) { | ||||
|                             _ref1 = clipboardData.items; | ||||
|                             for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||||
|                                 item = _ref1[_i]; | ||||
|                                 if (item.type.match(/^image\//)) { | ||||
|                                     reader = new FileReader(); | ||||
|                                     reader.onload = function(event) { | ||||
|                                         return _this._handleImage(event.target.result); | ||||
|                                     }; | ||||
|                                     reader.readAsDataURL(item.getAsFile()); | ||||
|                                 } | ||||
|                                 if (item.type === 'text/plain') { | ||||
|                                     item.getAsString(function(string) { | ||||
|                                         return _this._target.trigger('pasteText', { | ||||
|                                             text: string | ||||
|                                         }); | ||||
|                                     }); | ||||
|                                 } | ||||
|                             } | ||||
|                         } else { | ||||
|                             if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) { | ||||
|                                 text = clipboardData.getData('Text'); | ||||
|                                 _this._target.trigger('pasteText', { | ||||
|                                     text: text | ||||
|                                 }); | ||||
|                             } | ||||
|                             _this._checkImagesInContainer(function(src) { | ||||
|                                 return _this._handleImage(src); | ||||
|                             }); | ||||
|                         } | ||||
|                     } | ||||
|                     if (clipboardData = window.clipboardData) { | ||||
|                         if ((_ref2 = (text = clipboardData.getData('Text'))) != null ? _ref2.length : void 0) { | ||||
|                             return _this._target.trigger('pasteText', { | ||||
|                                 text: text | ||||
|                             }); | ||||
|                         } else { | ||||
|                             _ref3 = clipboardData.files; | ||||
|                             _results = []; | ||||
|                             for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { | ||||
|                                 file = _ref3[_j]; | ||||
|                                 _this._handleImage(URL.createObjectURL(file)); | ||||
|                                 _results.push(_this._checkImagesInContainer(function() {})); | ||||
|                             } | ||||
|                             return _results; | ||||
|                         } | ||||
|                     } | ||||
|                 }; | ||||
|             })(this)); | ||||
|         } | ||||
| 
 | ||||
|         Paste.prototype._handleImage = function(src) { | ||||
|             var loader; | ||||
|             loader = new Image(); | ||||
|             loader.onload = (function(_this) { | ||||
|                 return function() { | ||||
|                     var blob, canvas, ctx, dataURL; | ||||
|                     canvas = document.createElement('canvas'); | ||||
|                     canvas.width = loader.width; | ||||
|                     canvas.height = loader.height; | ||||
|                     ctx = canvas.getContext('2d'); | ||||
|                     ctx.drawImage(loader, 0, 0, canvas.width, canvas.height); | ||||
|                     dataURL = null; | ||||
|                     try { | ||||
|                         dataURL = canvas.toDataURL('image/png'); | ||||
|                         blob = dataURLtoBlob(dataURL); | ||||
|                     } catch (_error) {} | ||||
|                     if (dataURL) { | ||||
|                         return _this._target.trigger('pasteImage', { | ||||
|                             blob: blob, | ||||
|                             dataURL: dataURL, | ||||
|                             width: loader.width, | ||||
|                             height: loader.height | ||||
|                         }); | ||||
|                     } | ||||
|                 }; | ||||
|             })(this); | ||||
|             return loader.src = src; | ||||
|         }; | ||||
| 
 | ||||
|         Paste.prototype._checkImagesInContainer = function(cb) { | ||||
|             var img, timespan, _i, _len, _ref; | ||||
|             timespan = Math.floor(1000 * Math.random()); | ||||
|             _ref = this._container.find('img'); | ||||
|             for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||||
|                 img = _ref[_i]; | ||||
|                 img["_paste_marked_" + timespan] = true; | ||||
|             } | ||||
|             return setTimeout((function(_this) { | ||||
|                 return function() { | ||||
|                     var _j, _len1, _ref1, _results; | ||||
|                     _ref1 = _this._container.find('img'); | ||||
|                     _results = []; | ||||
|                     for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | ||||
|                         img = _ref1[_j]; | ||||
|                         if (!img["_paste_marked_" + timespan]) { | ||||
|                             cb(img.src); | ||||
|                         } | ||||
|                         _results.push($(img).remove()); | ||||
|                     } | ||||
|                     return _results; | ||||
|                 }; | ||||
|             })(this), 1); | ||||
|         }; | ||||
| 
 | ||||
|         return Paste; | ||||
| 
 | ||||
|     })(); | ||||
| 
 | ||||
| }).call(this); | ||||
| 
 | ||||
| function enablePasteImg(_editor) { | ||||
|     var editor = _editor, | ||||
|         name = 'paste'; | ||||
|     //这样貌似多编辑器就不会冲突了
 | ||||
|     if(editor.edit == undefined || editor.edit.iframe == undefined){ | ||||
|         return; | ||||
|     } | ||||
|     var contentWindow = editor.edit.iframe[0].contentWindow; | ||||
|     //var contentWindow = editor.iframeDoc;
 | ||||
|     //var contentWindow = document.getElementsByTagName('iframe')[0].contentWindow;
 | ||||
|     var nodeBody = contentWindow.document.getElementsByTagName('body')[0]; | ||||
|     console.log(nodeBody); | ||||
|     $(nodeBody).pastableContenteditable(); | ||||
| 
 | ||||
|     dataURItoBlob = function(dataURI) { | ||||
|       // convert base64/URLEncoded data component to raw binary data held in a string
 | ||||
|       var byteString; | ||||
|       if (dataURI.split(',')[0].indexOf('base64') >= 0) | ||||
|         byteString = atob(dataURI.split(',')[1]); | ||||
|       else | ||||
|         byteString = unescape(dataURI.split(',')[1]); | ||||
| 
 | ||||
|       // separate out the mime component
 | ||||
|       var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; | ||||
| 
 | ||||
|       // write the bytes of the string to a typed array
 | ||||
|       var ia = new Uint8Array(byteString.length); | ||||
|       for (var i = 0; i < byteString.length; i++) { | ||||
|         ia[i] = byteString.charCodeAt(i); | ||||
|       } | ||||
| 
 | ||||
|       return new Blob([ia], {type:mimeString}); | ||||
|     }; | ||||
| 
 | ||||
|     $(nodeBody).on('pasteImage', function(ev, data) { | ||||
|         console.log('pasteImage'); | ||||
|         console.log("dataURL: " + data.dataURL); | ||||
|         console.log("width: " + data.width); | ||||
|         console.log("height: " + data.height); | ||||
|         console.log(data.blob); | ||||
|         var blob = dataURItoBlob(data.dataURL); | ||||
|         if (data.blob !== null) { | ||||
|             var data = new FormData(); | ||||
|             data.append("imgFile",blob, "imageFilename.png"); | ||||
|             console.log(data); | ||||
|             $.ajax({ | ||||
|               url: '/kindeditor/upload?dir=image', | ||||
|               contentType: false, | ||||
|               type: 'POST', | ||||
|               data: data, | ||||
|               processData: false, | ||||
|               success: function(data) { | ||||
|                 editor.exec('insertimage', JSON.parse(data).url); | ||||
|               } | ||||
|             }); | ||||
|         } | ||||
| 
 | ||||
|     }); | ||||
|     return; | ||||
|     contentWindow.document.getElementsByTagName('body')[0].onpaste = function(event) { | ||||
|         // use event.originalEvent.clipboard for newer chrome versions
 | ||||
|         var items = (event.clipboardData || event.originalEvent.clipboardData).items; | ||||
|         console.log(JSON.stringify(items)); // will give you the mime types
 | ||||
|         // find pasted image among pasted items
 | ||||
|         var blob = null; | ||||
|         for (var i = 0; i < items.length; i++) { | ||||
|             if (items[i].type.indexOf("image") === 0) { | ||||
|                 blob = items[i].getAsFile(); | ||||
|             } | ||||
|         } | ||||
|         // load image if there is a pasted image
 | ||||
|         if (blob !== null) { | ||||
|             var reader = new FileReader(); | ||||
|             reader.onload = function(event) { | ||||
|                 console.log(event.target.result); // data url!
 | ||||
|                 var data = new FormData(); | ||||
|                 data.append("imgFile", blob, "imageFilename.png"); | ||||
|                 console.log(blob); | ||||
|                 $.ajax({ | ||||
|                     url: '/kindeditor/upload?dir=image', | ||||
|                     contentType: false, | ||||
|                     type: 'POST', | ||||
|                     data: data, | ||||
|                     processData: false, | ||||
|                     success: function(data) { | ||||
|                         editor.exec('insertimage', JSON.parse(data).url); | ||||
|                     } | ||||
|                 }); | ||||
|             }; | ||||
|             reader.readAsDataURL(blob); | ||||
|         } | ||||
|     } | ||||
| }; | ||||
					Loading…
					
					
				
		Reference in new issue