diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 63e823063..1dacffb6f 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -660,8 +660,10 @@ class AttachmentsController < ApplicationController end def has_login - unless @attachment && @attachment.container_type == "PhoneAppVersion" - render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download) + unless @attachment && @attachment.container_type == "Organization" + unless @attachment && @attachment.container_type == "PhoneAppVersion" + render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download) + end end end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1d443610f..828123675 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2104,6 +2104,8 @@ module ApplicationHelper attachment.container.board.course course = attachment.container.board.course candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1) + elsif attachment.container.class.to_s=="Organization" + candown = true elsif attachment.container.class.to_s=="HomeworkAttach" candown = true elsif attachment.container.class.to_s=="StudentWorksScore" diff --git a/app/views/admin/homework.html.erb b/app/views/admin/homework.html.erb index a3a64b316..03472d0a0 100644 --- a/app/views/admin/homework.html.erb +++ b/app/views/admin/homework.html.erb @@ -29,6 +29,7 @@ <%@count=@page*30 %> <% for homework in @homework do %> + <% unless homework.nil? %> <% @count+=1 %> @@ -56,6 +57,7 @@ <%=format_date( homework.created_at ) %> + <% end %> <% end %> diff --git a/app/views/files/_org_upload_attachment_list.html.erb b/app/views/files/_org_upload_attachment_list.html.erb index 973aeddd6..06fa23387 100644 --- a/app/views/files/_org_upload_attachment_list.html.erb +++ b/app/views/files/_org_upload_attachment_list.html.erb @@ -23,10 +23,8 @@ - <%= l(:label_no_file_uploaded)%> + 建议上传高度不超过52px的图片 -(<%= l(:label_max_size) %>:<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) -

建议上传高度不超过52px的图片

diff --git a/app/views/files/_org_upload_attachment_list_banner.html.erb b/app/views/files/_org_upload_attachment_list_banner.html.erb new file mode 100644 index 000000000..5388afb5b --- /dev/null +++ b/app/views/files/_org_upload_attachment_list_banner.html.erb @@ -0,0 +1,32 @@ + + + <%= file_field_tag 'attachments[dummy][file]', + :id => "_file#{container.id}", + :class => ie8? ? '':'file_selector', + :multiple => true, + :onchange => "addInputFiles_board(this, '#{container.id}','"+"submit_resource"+"');", + :style => ie8? ? '': 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :delete_all_files => l(:text_are_you_sure_all), + :lebel_file_uploding => l(:lebel_file_uploding), + :containerid => "#{container.id}" + } %> + + + + + 建议上传 长度为1452px/高度为304px 的图片 + +
+
+ + +
\ No newline at end of file diff --git a/app/views/files/_upload_org_new_files_banner.html.erb b/app/views/files/_upload_org_new_files_banner.html.erb new file mode 100644 index 000000000..0cb767bf2 --- /dev/null +++ b/app/views/files/_upload_org_new_files_banner.html.erb @@ -0,0 +1,25 @@ +
+
+

更换背景图片

+
+ <%= error_messages_for 'attachment' %> + + <%= form_tag(organization_files_path(org, :in_org => params[:in_org]), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %> + + <%= render :partial => 'files/org_upload_attachment_list_banner', :locals => {:container => org}%> +
+ <%= l(:button_cancel)%> + <%= l(:button_confirm)%> + <% end %> +
+ +
+ +
+ + \ No newline at end of file diff --git a/app/views/layouts/base_org_newstyle.html.erb b/app/views/layouts/base_org_newstyle.html.erb index d9b49b074..a5f41081c 100644 --- a/app/views/layouts/base_org_newstyle.html.erb +++ b/app/views/layouts/base_org_newstyle.html.erb @@ -71,13 +71,23 @@ $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); } + + function orge_new_files_banner_upload() + { + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files_banner',:locals => {:org => @organization, :org_attachment_type => 1}) %>'); + showModal('ajax-modal', '513px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before(""); + $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); + $('#ajax-modal').parent().addClass("popbox_polls"); + }
- + <% if User.current.admin_of_org?(@organization) %> - + <% else %> + + <% end %> <%# 登录 %> <%= render :partial => 'organizations/org_logined_header' %> @@ -121,7 +140,30 @@
diff --git a/app/views/student_work/_work_edit_information.html.erb b/app/views/student_work/_work_edit_information.html.erb index 38e7e7c7e..057d305d5 100644 --- a/app/views/student_work/_work_edit_information.html.erb +++ b/app/views/student_work/_work_edit_information.html.erb @@ -4,9 +4,9 @@

作品名称:<%=@student_work.name%>

-
+
作品描述:
-
<%=@student_work.description.html_safe %>
+
<%=@student_work.description.html_safe %>

diff --git a/app/views/student_work/_work_information.html.erb b/app/views/student_work/_work_information.html.erb index 88684263a..1ced6c84c 100644 --- a/app/views/student_work/_work_information.html.erb +++ b/app/views/student_work/_work_information.html.erb @@ -4,9 +4,9 @@

作品名称:<%=@student_work.name%>

-
+
作品描述:
-
<%=@student_work.description.html_safe %>
+
<%=@student_work.description.html_safe %>

diff --git a/db/migrate/20160405021915_delete_anonymous_work.rb b/db/migrate/20160405021915_delete_anonymous_work.rb new file mode 100644 index 000000000..1677b248a --- /dev/null +++ b/db/migrate/20160405021915_delete_anonymous_work.rb @@ -0,0 +1,19 @@ +class DeleteAnonymousWork < ActiveRecord::Migration + def up + student_works = StudentWork.where("homework_common_id = 2882").map{|work| work.id} unless StudentWork.where("homework_common_id = 2882").empty? + student_work_ids = "(" + student_works.join(",") + ")" + student_work_scores = StudentWorksScore.where("student_work_id in #{student_work_ids}") + unless student_work_scores.empty? + student_work_scores.each do |sscore| + student_work = StudentWork.find sscore.student_work_id + student_work.student_score = 0 unless student_work.nil? + student_work.absence_penalty = 0 + sscore.destroy + student_work.save + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index a3fb50eca..4e4201050 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,11 @@ # # It's strongly recommended to check this file into your version control system. +<<<<<<< HEAD ActiveRecord::Schema.define(:version => 20160331063938) do +======= +ActiveRecord::Schema.define(:version => 20160405021915) do +>>>>>>> c3ee4dadfb92c75e8649cad7e0ed57c2ec02ec00 create_table "activities", :force => true do |t| t.integer "act_id", :null => false diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb index 6b22496b6..f5b48544d 100644 --- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb +++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb @@ -140,6 +140,7 @@ module Redmine if file && file.size > 0 a = Attachment.create(:file => file, :author => author) elsif token + # 通过token值找到对应的attachment a = Attachment.find_by_token_only(token) if a a.filename = attachment['filename'] unless attachment['filename'].blank? diff --git a/public/stylesheets/org_new_style.css b/public/stylesheets/org_new_style.css index 8fca32cb1..9155df3f1 100644 --- a/public/stylesheets/org_new_style.css +++ b/public/stylesheets/org_new_style.css @@ -40,8 +40,13 @@ a:hover.search-icon{ background:url(../images/org_new_style/icons.png) -387px -8 .searchbox:hover{ background:#999999; color:#fff;} /* banner */ -.banner{ width:100%; height:234px; background:#070317 url(../images/org_new_style/banner.jpg) 0 0 no-repeat; color:#fff; text-align:center; padding-top:70px; line-height:2.4;} -.banner h2{ font-size:42px; } +.banner{ width:100%; height:304px; background:#070317; color:#fff; text-align:center; line-height:2.4;} +.banner-inner{ width:1500px; margin:0 auto; position:relative; text-align:center;} +.banner-img{ height:304px;} +.banner-txt{position:absolute; top:30%; left:0%; width:1500px; margin:0 auto;} +.banner h1{ font-size:42px;} +.banner a{font-size:28px; color:#fff;} +.banner a:hover{ text-decoration:underline;} .banner p{ font-size:18px;} .banner span{ font-size:16px;} @@ -274,3 +279,5 @@ div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: + +