上传图片

This commit is contained in:
huang 2016-04-01 23:56:05 +08:00
parent 0459856a2c
commit 86aecd21b9
9 changed files with 128 additions and 15 deletions

View File

@ -608,7 +608,7 @@ private
@attachment.container.board.course)
@course = @attachment.container.board.course
else
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork'
unless @attachment.container_type == 'Bid'|| @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork'
@project = @attachment.project
end
end
@ -660,8 +660,10 @@ private
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

View File

@ -0,0 +1,34 @@
<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 %>">
<%= l(:label_no_file_uploaded)%>
</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>
<span id="attachments_fields<%= container.id %>" data-containerid="<%= container.id %>" xmlns="http://www.w3.org/1999/html">
</span>
</div>

View File

@ -2,12 +2,11 @@
<div class="upload_con">
<h2 style="text-align: center">更换Logo</h2>
<div class="upload_box">
<p>尺寸最好55*33</p>
<%= 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], :logo => true), :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_subfield_upload_attachment_list', :locals => {:container => org}%>
<%= render :partial => 'files/org_upload_attachment_list', :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>

View File

@ -12,7 +12,7 @@
<%= stylesheet_link_tag 'org_new_style','jquery/jquery-ui-1.9.2' %>
<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'attachments' %>
<%= call_hook :view_layouts_base_html_head %>
<%#= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
@ -77,14 +77,24 @@
<div class="container">
<div class="header">
<div class="header-con">
<a href="javascript:void(0);" class="fl logo" onclick="orge_new_files_upload();">
<!--"/files/uploads/image#{iamge_path}"-->
<% if @org_logo_attchment.nil? %>
<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>
<% if User.current.admin_of_org?(@organization) %>
<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>
<% else %>
<% if @org_logo_attchment.blank? %>
<a><img src="/images/org_new_style/logo.jpg" height="52" alt=""/></a>
<% else %>
<a><img src="/attachments/<%= @org_logo_attchment.id %>/<%= @org_logo_attchment.filename %>" height="52"></a>
<% end %>
<% end %>
<%# 登录 %>
<%= render :partial => 'organizations/org_logined_header' %>
</div>
@ -382,7 +392,7 @@
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<%#= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -679,6 +679,7 @@ zh:
label_repository: 版本库
label_course_repository: 代码库
label_browse: 上传文件
label_browse_org: 上传图片
label_branch: 分支
label_tag: 标签
label_revision: 修订

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@ -192,6 +192,73 @@ a:hover.more-btn-center{ background:#29146f; color:#fff;}
.note-box p{display:block; width:515px; color:#888; font-size:12px; line-height:2.5;}
.right-info2{background:url(../images/org_new_style/icons.png) no-repeat -41px -540px ; width:15px; line-height:1.9; height:16px; padding-left:20px; color:#888; margin-top:5px;}
.upload_con h2 {
display: block;
background: #eaeaea;
font-size: 14px;
color: #343333;
height: 31px;
width: auto;
margin-top: 25px;
padding-left: 20px;
padding-top: 5px;
}
a.blue_btn {
background: #64bdd9;
color: #fff;
font-size: 14px;
font-weight: normal;
padding: 2px 8px;
text-align: center;
cursor: pointer;
}
a.grey_btn {
background: #d9d9d9;
color: #656565;
font-size: 14px;
font-weight: normal;
text-align: center;
margin-left: 10px;
margin-bottom: 10px;
padding: 2px 10px;
}
span.add_attachment {
font-size: 80%;
line-height: 2.5em;
}
.c_dark {
color: #2d2d2d;
}
.upload_filename {
background: url(../images/pic_file.png) 0 -20px no-repeat;
color: #7f7f7f;
width: 270px;
border: none;
padding-left: 20px;
margin-right: 10px;
margin-bottom: 5px;
white-space: nowrap;
text-overflow: ellipsis;
}
.profiler-results.profiler-left {
left: 0px;
}
.profiler-results {
z-index: 2147483643;
position: fixed;
top: 0px;
}
.filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;}
.ajax-waiting input.upload_filename {background:url(../images/hourglass.png) no-repeat 0px 50%;}
.ajax-loading input.upload_filename {background:url(../images/loading.gif) no-repeat 0px 50%;}
div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; }
.upload_filename{ background: url(../images/pic_file.png) 0 -20px no-repeat;color: #7f7f7f;width: 270px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;}
.evaluation{position: relative;}
.evaluation_submit{position: absolute;right: 0px;bottom: 0px;}
.student_work_search{background-color: #64bdd9;color: white !important;padding: 2px 7px;margin-left: 10px;cursor: pointer; }