From 6a5b79cf6dbcb543cf206dcea3994331f7a9fcdf Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 31 Mar 2016 09:44:21 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=9A=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=A1=B5=E9=9D=A2=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/homework.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/admin/homework.html.erb b/app/views/admin/homework.html.erb index 7260d68ff..331806293 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 %> @@ -54,6 +55,7 @@ <%=format_date(homework.end_time) %> + <% end %> <% end %> From 73297230d12a1cfd1939169e3c2e33cd8998f523 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 2 Apr 2016 00:31:36 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_org_newstyle.html.erb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/base_org_newstyle.html.erb b/app/views/layouts/base_org_newstyle.html.erb index d9b49b074..f646c437f 100644 --- a/app/views/layouts/base_org_newstyle.html.erb +++ b/app/views/layouts/base_org_newstyle.html.erb @@ -77,7 +77,16 @@
- + <% if User.current.admin_of_org?(@organization) %> + + <% else %> + <% end %> <%# 登录 %> From 6a8a82e85af36fec491d847a1e4382e333f32001 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 5 Apr 2016 11:23:50 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=91=A8=E6=B5=B7?= =?UTF-8?q?=E8=8A=B3=E8=80=81=E5=B8=882882=E4=BD=9C=E4=B8=9A=E7=9A=84?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=8C=BF=E8=AF=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20160405021915_delete_anonymous_work.rb | 19 +++++++++++++++++++ db/schema.rb | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20160405021915_delete_anonymous_work.rb 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 8041b347b..d6c454cb0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160328022623) do +ActiveRecord::Schema.define(:version => 20160405021915) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1289,6 +1289,7 @@ ActiveRecord::Schema.define(:version => 20160328022623) do t.datetime "updated_at", :null => false t.string "field_type" t.integer "hide", :default => 0 + t.integer "status", :default => 1 end create_table "organizations", :force => true do |t| From c3ee4dadfb92c75e8649cad7e0ed57c2ec02ec00 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 5 Apr 2016 11:24:13 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E6=A1=86=E7=9A=84=E9=AB=98=E5=BA=A6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_work_edit_information.html.erb | 4 ++-- app/views/student_work/_work_information.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 %>

From 2162d7d4b82e948ac1f7b906e1eafdf63cd200de Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 6 Apr 2016 10:40:38 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E7=BB=84=E7=BB=87banner=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 6 ++-- app/helpers/application_helper.rb | 2 ++ .../_upload_org_new_files_banner.html.erb | 25 +++++++++++++ app/views/layouts/base_org_newstyle.html.erb | 36 +++++++++++++++++-- .../lib/acts_as_attachable.rb | 1 + public/stylesheets/org_new_style.css | 11 ++++-- 6 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 app/views/files/_upload_org_new_files_banner.html.erb diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 63e823063..19e85bdc4 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.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/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..cf044e089 --- /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', :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 f646c437f..a5f41081c 100644 --- a/app/views/layouts/base_org_newstyle.html.erb +++ b/app/views/layouts/base_org_newstyle.html.erb @@ -71,6 +71,16 @@ $('#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"); + }
@@ -97,7 +107,6 @@ <% end %> - <%# 登录 %> <%= render :partial => 'organizations/org_logined_header' %>
@@ -131,7 +140,30 @@
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: + + From a6f6f63d6d3bbe7b450853f9778ceabb70dd64da Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 6 Apr 2016 11:05:13 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- .../_org_upload_attachment_list.html.erb | 4 +-- ...org_upload_attachment_list_banner.html.erb | 32 +++++++++++++++++++ .../_upload_org_new_files_banner.html.erb | 2 +- 4 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 app/views/files/_org_upload_attachment_list_banner.html.erb diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 19e85bdc4..1dacffb6f 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -660,7 +660,7 @@ class AttachmentsController < ApplicationController end def has_login - unless @attachment.container_type == "Organization" + 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 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 index cf044e089..0cb767bf2 100644 --- a/app/views/files/_upload_org_new_files_banner.html.erb +++ b/app/views/files/_upload_org_new_files_banner.html.erb @@ -6,7 +6,7 @@ <%= 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', :locals => {:container => org}%> + <%= render :partial => 'files/org_upload_attachment_list_banner', :locals => {:container => org}%>
<%= l(:button_cancel)%> <%= l(:button_confirm)%>