diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 5cb646c8e..9319c4db2 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -649,7 +649,8 @@ class StudentWorkController < ApplicationController if revise_attachments.count == 2 revise_attachments.last.destroy end - #@attachment = @work.attachments.where("attachtype = 7").order("created_on desc").first + attachment = @work.attachments.where("attachtype = 7").first + attachment.update_attributes(:description => params[:description]) respond_to do |format| format.js end diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 2a4430935..d66c6a30d 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -17,6 +17,7 @@ class ZipdownController < ApplicationController begin if params[:base64file] file = Base64.decode64(params[:base64file]) + file = file.sub('*', '+') send_file "#{OUTPUT_FOLDER}/#{file}", :filename => filename_for_content_disposition(file), :type => detect_content_type(file) else send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(params[:filename]), :type => detect_content_type(params[:file]) @@ -118,11 +119,15 @@ class ZipdownController < ApplicationController [{files:[out_file.file_path], count: 1, index: 1, real_file: out_file.file_path, file: File.basename(out_file.file_path), - base64file: Base64.encode64(File.basename(out_file.file_path)), + base64file: encode64(File.basename(out_file.file_path)), size:(out_file.pack_size / 1024.0 / 1024.0).round(2) }] end + def encode64(str) + Base64.encode64(str).sub('+', '*') + end + def zip_homework_common homework_common bid_homework_path = [] digests = [] @@ -142,7 +147,7 @@ class ZipdownController < ApplicationController [{files:[out_file.file_path], count: 1, index: 1, real_file: out_file.file_path, file: File.basename(out_file.file_path), - base64file: Base64.encode64(File.basename(out_file.file_path)), + base64file: encode64(File.basename(out_file.file_path)), size:(out_file.pack_size / 1024.0 / 1024.0).round(2) }] end diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 5945fece4..52f6570da 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -41,7 +41,7 @@ <% end %> <% if issues.count == 10%> - <%= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> + <%= link_to "点击展开更多",project_issues_path({:project_id => project.id,:page => issue_pages.page}.merge(params)),:id => "show_more_issues",:remote => "true",:class => "loadMore mt10 f_grey"%> <% end%> diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 880be0ffa..f7ecb0ccf 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -115,8 +115,20 @@ $('#ajax-modal').parent().addClass("resourceUploadPopup"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); } - function submit_files(){ - $("#upload_form").submit(); + function regex_des() { + if ($.trim($("#attachment_des").val()) == "") { + $("#hint_message").text("附件描述不能为空"); + $("#hint_message").css('color','#ff0000'); + return false; + } else { + $("#hint_message").text(""); + return true; + } + } + function submit_revise_files(){ + if (regex_des()) { + $("#upload_form").submit(); + } } function closeModal(){ hideModal($(".uploadBoxContainer")); diff --git a/app/views/student_work/_revise_attachment.html.erb b/app/views/student_work/_revise_attachment.html.erb index 4d85b1813..2279856da 100644 --- a/app/views/student_work/_revise_attachment.html.erb +++ b/app/views/student_work/_revise_attachment.html.erb @@ -7,8 +7,12 @@
追加附件: <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %> - 追加时间:<%=format_time revise_attachment.created_on.to_s %>  (<%=revise_attachment_status @homework,revise_attachment %>) + 追加时间:<%=format_time revise_attachment.created_on.to_s %>  (<%=revise_attachment_status @homework,revise_attachment %>)
+ <% unless revise_attachment.description == "" %> + 附件描述:

<%=revise_attachment.description %>

+ <% end %>
+
<% end %> <% if work.user == User.current %>
@@ -18,10 +22,14 @@
追加附件: <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %> - 追加时间:<%=format_time revise_attachment.created_on.to_s %> + 追加时间:<%=format_time revise_attachment.created_on.to_s %>
+ <% unless revise_attachment.description == "" %> + 附件描述:

<%=revise_attachment.description %>

+ <% end %>
<% end %> -
+
+ <% end %> diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index f92614e10..662ddece4 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -113,8 +113,20 @@ $('#ajax-modal').parent().addClass("resourceUploadPopup"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); } - function submit_files(){ - $("#upload_form").submit(); + function regex_des() { + if ($.trim($("#attachment_des").val()) == "") { + $("#hint_message").text("附件描述不能为空"); + $("#hint_message").css('color','#ff0000'); + return false; + } else { + $("#hint_message").text(""); + return true; + } + } + function submit_revise_files(){ + if (regex_des()) { + $("#upload_form").submit(); + } } function closeModal(){ hideModal($(".uploadBoxContainer")); diff --git a/app/views/student_work/_upload_attachment.html.erb b/app/views/student_work/_upload_attachment.html.erb index d9c69fc17..02f05c4df 100644 --- a/app/views/student_work/_upload_attachment.html.erb +++ b/app/views/student_work/_upload_attachment.html.erb @@ -9,7 +9,7 @@
- + 选择文件 <%= file_field_tag 'attachments[dummy][file]', :id => '_file', @@ -37,9 +37,16 @@
最多只能上传一个小于50MB的附件
+
+ +
+
+

+
- <%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %> + 确定 + <%#= submit_tag '确定',:onclick=>'submit_revise_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
取消 diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 7767fedc7..cd9704186 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -81,6 +81,7 @@ <%= format_time(attachment.created_on) %>
+
<% end %> <% end %>
diff --git a/config/routes.rb b/config/routes.rb index d82a9de8a..fb381e8ea 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -439,6 +439,7 @@ RedmineApp::Application.routes.draw do post '/courses/:id/course_activity', :to => 'courses#show', :as => 'course_activity' get '/boards/:id/boards_topic', :to =>'boards#show', :as => 'boards_topic' match 'courses/:course_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_course_news' + match 'courses/:course_id/news/new', :to => 'news#new', :via => [:get, :post] #added by young resources :users do diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index b07e93701..86586243d 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1227,6 +1227,7 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; .mb10 {margin-bottom: 10px} .mb15 {margin-bottom: 15px} div.disable_link {background-color: #c1c1c1 !important;} +.reUploadDetail{border:1px solid #dddddd; float:left; resize:none; width:400px; height:80px; overflow-y:auto;outline: none;} /*新课程资源库*/ .reCon{ margin:5px; width:710px;}