Merge branch 'develop' into hjq_beidou

dev_wuhao
huang 9 years ago
commit dd68969c8b

@ -660,8 +660,10 @@ class AttachmentsController < ApplicationController
end end
def has_login def has_login
unless @attachment && @attachment.container_type == "Organization"
unless @attachment && @attachment.container_type == "PhoneAppVersion" 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) 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
end end
end

@ -2104,6 +2104,8 @@ module ApplicationHelper
attachment.container.board.course attachment.container.board.course
course = attachment.container.board.course course = attachment.container.board.course
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1) 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" elsif attachment.container.class.to_s=="HomeworkAttach"
candown = true candown = true
elsif attachment.container.class.to_s=="StudentWorksScore" elsif attachment.container.class.to_s=="StudentWorksScore"

@ -29,6 +29,7 @@
<tbody> <tbody>
<%@count=@page*30 %> <%@count=@page*30 %>
<% for homework in @homework do %> <% for homework in @homework do %>
<% unless homework.nil? %>
<% @count+=1 %> <% @count+=1 %>
<tr> <tr>
<td align="center"> <td align="center">
@ -57,6 +58,7 @@
</td> </td>
</tr> </tr>
<% end %> <% end %>
<% end %>
</tbody> </tbody>
</table> </table>
</div> </div>

@ -23,10 +23,8 @@
<!--<input type="submit" name="" value="上传文件" class="f_l ml10" style="width:80px; height:26px;">--> <!--<input type="submit" name="" value="上传文件" class="f_l ml10" style="width:80px; height:26px;">-->
<span id="upload_file_count<%=container.id %>"> <span id="upload_file_count<%=container.id %>">
<%= l(:label_no_file_uploaded)%> 建议上传高度不超过52px的图片
</span> </span>
(<%= l(:label_max_size) %>:<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
<p style="padding-left: 68px;">建议上传高度不超过52px的图片</p>
<div class="cl"></div> <div class="cl"></div>
<div> <div>
<span id="attachments_fields<%= container.id %>" data-containerid="<%= container.id %>" xmlns="http://www.w3.org/1999/html"> <span id="attachments_fields<%= container.id %>" data-containerid="<%= container.id %>" xmlns="http://www.w3.org/1999/html">

@ -0,0 +1,32 @@
<span class="add_attachment" data-containerid="<%= container.id %>">
<button name="button" class="sub_btn" onclick="_file<%=container.id %>.click()" onmouseover="this.focus()" style="<%= ie8? ? 'display:none' : ''%>" type="button" ><%= l(:label_browse_org) %></button>
<%= 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}"
} %>
</span>
<!--<input type="submit" name="" value="上传文件" class="f_l ml10" style="width:80px; height:26px;">-->
<span id="upload_file_count<%=container.id %>">
建议上传 长度为1452px/高度为304px 的图片
</span>
<div class="cl"></div>
<div>
<span id="attachments_fields<%= container.id %>" data-containerid="<%= container.id %>" xmlns="http://www.w3.org/1999/html">
</span>
</div>

@ -0,0 +1,25 @@
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
<div class="upload_con">
<h2 style="text-align: center">更换背景图片</h2>
<div class="upload_box">
<%= error_messages_for 'attachment' %>
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
<%= form_tag(organization_files_path(org, :in_org => params[:in_org]), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<!--<input type="hidden" name="org_subfield_attachment_type" value="<%#= org_subfield_attachment_type%>">-->
<%= render :partial => 'files/org_upload_attachment_list_banner', :locals => {:container => org}%>
<div class="cl"></div>
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
<a id="submit_org_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
<% end %>
</div>
</div>
</div>
<script>
function submit_resource()
{
$('#submit_org_resource').parent().submit();
}
</script>

@ -71,13 +71,23 @@
$('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#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("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
}
</script> </script>
<body onload="prettyPrint();"> <body onload="prettyPrint();">
<div class="cl"></div> <div class="cl"></div>
<div class="container"> <div class="container">
<div class="header"> <div class="header">
<div class="header-con"> <div class="header-con">
<% if User.current.admin_of_org?(@organization) %>
<a href="javascript:void(0);" class="fl logo" onclick="orge_new_files_upload();"> <a href="javascript:void(0);" class="fl logo" onclick="orge_new_files_upload();">
<!--"/files/uploads/image#{iamge_path}"--> <!--"/files/uploads/image#{iamge_path}"-->
<% if @org_logo_attchment.blank? %> <% if @org_logo_attchment.blank? %>
@ -86,7 +96,16 @@
<img src="/attachments/<%= @org_logo_attchment.id %>/<%= @org_logo_attchment.filename %>" height="52"> <img src="/attachments/<%= @org_logo_attchment.id %>/<%= @org_logo_attchment.filename %>" height="52">
<% end %> <% end %>
</a> </a>
<% else %>
<a href="javascript:void(0);" class="fl logo" onclick="orge_new_files_upload();">
<!--"/files/uploads/image#{iamge_path}"-->
<% if @org_logo_attchment.blank? %>
<img src="/images/org_new_style/logo.jpg" height="52" alt=""/>
<% else %>
<img src="/attachments/<%= @org_logo_attchment.id %>/<%= @org_logo_attchment.filename %>" height="52">
<% end %>
</a>
<% end %>
<%# 登录 %> <%# 登录 %>
<%= render :partial => 'organizations/org_logined_header' %> <%= render :partial => 'organizations/org_logined_header' %>
@ -121,7 +140,30 @@
</div><!--nav end--> </div><!--nav end-->
<div class="banner"> <div class="banner">
<h2><%= @organization.name %></h2> <div class="banner-inner">
<% if User.current.admin_of_org?(@organization) %>
<a href="javascript:void(0);" onclick="orge_new_files_banner_upload();">
<!--"/files/uploads/image#{iamge_path}"-->
<% if @org_banner_attchment.blank? %>
<img class="banner-img" src="/images/org_new_style/banner.jpg" alt=""/>
<% else %>
<img src="/attachments/<%= @org_banner_attchment.id %>/<%= @org_banner_attchment.filename %>" class="banner-img">
<% end %>
</a>
<% else %>
<a href="javascript:void(0);" onclick="orge_new_files_banner_upload();">
<!--"/files/uploads/image#{iamge_path}"-->
<% if @org_banner_attchment.blank? %>
<img class="banner-img" src="/images/org_new_style/banner.jpg" alt=""/>
<% else %>
<img src="/attachments/<%= @org_banner_attchment.id %>/<%= @org_banner_attchment.filename %>" class="banner-img">
<% end %>
</a>
<% end %>
<div class="banner-txt">
<h1><%= @organization.name %></h1>
</div>
</div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

@ -4,9 +4,9 @@
<p class="f14 mt5"> <p class="f14 mt5">
<span class="fb">作品名称:</span><%=@student_work.name%> <span class="fb">作品名称:</span><%=@student_work.name%>
</p> </p>
<div class="f14 mt5" style="max-width: 425px; color:#808181"> <div class="f14 mt5" style="max-width: 425px; color:#808181; max-height:300px; overflow: auto;">
<div class="fb fl dis">作品描述:</div> <div class="fb fl dis">作品描述:</div>
<div class="upload_img fl" style="max-width: 350px;"><%=@student_work.description.html_safe %></div> <div class="upload_img fl" style="max-width: 330px;"><%=@student_work.description.html_safe %></div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<p class="mt5"> <p class="mt5">

@ -4,9 +4,9 @@
<p class="f14 mt5"> <p class="f14 mt5">
<span class="fb">作品名称:</span><%=@student_work.name%> <span class="fb">作品名称:</span><%=@student_work.name%>
</p> </p>
<div class="f14 mt5" style="max-width: 425px; color:#808181"> <div class="f14 mt5" style="max-width: 425px; color:#808181; max-height:300px; overflow: auto;">
<div class="fb fl dis">作品描述:</div> <div class="fb fl dis">作品描述:</div>
<div class="upload_img fl" style="max-width: 350px;"><%=@student_work.description.html_safe %></div> <div class="upload_img fl" style="max-width: 330px;"><%=@student_work.description.html_safe %></div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<p class="mt5"> <p class="mt5">

@ -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

@ -11,7 +11,11 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
<<<<<<< HEAD
ActiveRecord::Schema.define(:version => 20160331063938) do ActiveRecord::Schema.define(:version => 20160331063938) do
=======
ActiveRecord::Schema.define(:version => 20160405021915) do
>>>>>>> c3ee4dadfb92c75e8649cad7e0ed57c2ec02ec00
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false

@ -140,6 +140,7 @@ module Redmine
if file && file.size > 0 if file && file.size > 0
a = Attachment.create(:file => file, :author => author) a = Attachment.create(:file => file, :author => author)
elsif token elsif token
# 通过token值找到对应的attachment
a = Attachment.find_by_token_only(token) a = Attachment.find_by_token_only(token)
if a if a
a.filename = attachment['filename'] unless attachment['filename'].blank? a.filename = attachment['filename'] unless attachment['filename'].blank?

@ -40,8 +40,13 @@ a:hover.search-icon{ background:url(../images/org_new_style/icons.png) -387px -8
.searchbox:hover{ background:#999999; color:#fff;} .searchbox:hover{ background:#999999; color:#fff;}
/* banner */ /* 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{ width:100%; height:304px; background:#070317; color:#fff; text-align:center; line-height:2.4;}
.banner h2{ font-size:42px; } .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 p{ font-size:18px;}
.banner span{ font-size:16px;} .banner span{ font-size:16px;}
@ -274,3 +279,5 @@ div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display:

Loading…
Cancel
Save