Merge branch 'hjq_beidou' into develop

wuhao v20160402_01
huang 9 years ago
commit 1e2d151152

@ -608,7 +608,7 @@ private
@attachment.container.board.course) @attachment.container.board.course)
@course = @attachment.container.board.course @course = @attachment.container.board.course
else else
unless @attachment.container_type == 'Bid' || @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 @project = @attachment.project
end end
end end
@ -660,8 +660,10 @@ private
end end
def has_login def has_login
unless @attachment && @attachment.container_type == "PhoneAppVersion" unless@attachment.container_type == "Organization"
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 == "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 end
end end

@ -623,6 +623,36 @@ class FilesController < ApplicationController
@attachtype = 0 @attachtype = 0
@contenttype = 0 @contenttype = 0
respond_to do |format|
format.js
# format.html {
# redirect_to org_subfield_files_url(@org_subfield)
# }
end
# 组织添加附件,为了修改图片
elsif params[:organization_id]
@organization = Organization.find(params[:organization_id])
@addTag=false
# atttchment_type = 0为logo 1为banner
if params[:logo]
attachments = Attachment.attach_filesex(@organization, params[:attachments], false)
else
attachments = Attachment.attach_filesex(@organization, params[:attachments], true)
end
# TODO: 临时用 nyan
sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
@containers = [Organization.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@organization.id)]
show_attachments @containers
@tag_list = attachment_tag_list @all_attachments
@attachtype = 0
@contenttype = 0
respond_to do |format| respond_to do |format|
format.js format.js
# format.html { # format.html {

@ -78,6 +78,10 @@ class OrganizationsController < ApplicationController
# 组织新类型 show_mode判断标准 1为新类型0为旧 # 组织新类型 show_mode判断标准 1为新类型0为旧
if @organization.show_mode == 1 && params[:org_subfield_id].nil? && params[:list] .nil? if @organization.show_mode == 1 && params[:org_subfield_id].nil? && params[:list] .nil?
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
# REDO:时间紧,暂时先这样
@org_logo_attchment = Attachment.where("container_id =? and container_type =? and attachtype =?", @organization, "Organization", 0).order("created_on desc").first
@org_banner_attchment = Attachment.where("container_id =? and container_type =? and attachtype =?", @organization, "Organization", 1).order("created_on desc").first
@subfield_content = @organization.org_subfields.order("priority") @subfield_content = @organization.org_subfields.order("priority")
@organization = Organization.find(params[:id]) @organization = Organization.find(params[:id])
# 统计访问量 # 统计访问量
@ -136,7 +140,7 @@ class OrganizationsController < ApplicationController
@org_activities = OrgActivity.where("(container_id =? and container_type =?) " + @org_activities = OrgActivity.where("(container_id =? and container_type =?) " +
"or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+ "or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+
"or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))", "or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))",
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
when 'project_issue' when 'project_issue'
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) @org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
when 'project_message' when 'project_message'
@ -251,10 +255,10 @@ class OrganizationsController < ApplicationController
if @organization.show_mode == 1 if @organization.show_mode == 1
format.html { redirect_to organization_path(@organization)} format.html { redirect_to organization_path(@organization)}
else else
format.html { redirect_to setting_organization_path(@organization)} format.html { redirect_to setting_organization_path(@organization)}
end
end end
end end
end
def check_uniq def check_uniq
@check = false; @check = false;

@ -23,6 +23,7 @@ class Attachment < ActiveRecord::Base
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'" belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'" belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'"
belongs_to :org_subfield, foreign_key: 'container_id', conditions: "attachements.container_type = 'OrgSubfield'" belongs_to :org_subfield, foreign_key: 'container_id', conditions: "attachements.container_type = 'OrgSubfield'"
belongs_to :organization, foreign_key: 'container_id', conditions: "attachements.container_type = 'Organization'"
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'" belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
belongs_to :author, :class_name => "User", :foreign_key => "author_id" belongs_to :author, :class_name => "User", :foreign_key => "author_id"
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"

@ -8,6 +8,8 @@ class Organization < ActiveRecord::Base
has_many :org_courses, :dependent => :destroy has_many :org_courses, :dependent => :destroy
has_many :org_subfields, :dependent => :destroy has_many :org_subfields, :dependent => :destroy
has_many :users, :through => :org_members has_many :users, :through => :org_members
has_many :files
acts_as_attachable
validates_uniqueness_of :name validates_uniqueness_of :name
after_create :save_as_org_activity, :add_default_subfields after_create :save_as_org_activity, :add_default_subfields

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

@ -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">更换Logo</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], :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_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>
<% end %>
</div>
</div>
</div>
<script>
function submit_resource()
{
$('#submit_org_resource').parent().submit();
}
</script>

@ -1,71 +1,75 @@
<% if @addTag%> <% if @addTag%>
<% if @obj_flag == '3'%> <% if @obj_flag == '3'%>
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
//$('#put-tag-form-issue').hide(); //$('#put-tag-form-issue').hide();
$('#name-issue').val(""); $('#name-issue').val("");
<% elsif @obj_flag == '6'%> <% elsif @obj_flag == '6'%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name', $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
$("#put-tag-form- <%=@obj.class%>- <%=@obj.id%>").hide(); $("#put-tag-form- <%=@obj.class%>- <%=@obj.id%>").hide();
$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val(""); $("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val("");
<% else %> <% else %>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
$('#tags_show').html('<%=render_attachments_tag_save(@project, nil)%>'); $('#tags_show').html('<%=render_attachments_tag_save(@project, nil)%>');
$('#put-tag-form #name').val(""); $('#put-tag-form #name').val("");
//$('#put-tag-form').hide(); //$('#put-tag-form').hide();
<% end %> <% end %>
<% else %> <% else %>
$("#attachments_fields").children().remove(); $("#attachments_fields").children().remove();
$("#upload_file_count").text("未上传文件"); $("#upload_file_count").text("未上传文件");
$('#upload_file_div').slideToggle('slow'); $('#upload_file_div').slideToggle('slow');
<% if @project %> <% if @project %>
hideModal(); hideModal();
<% if @in_project_toolbar %> <% if @in_project_toolbar %>
window.location.href = '<%= project_files_path(@project) %>' window.location.href = '<%= project_files_path(@project) %>'
<% else %> <% else %>
$("#resource_list").html('<%= j(render partial:"project_file", locals: {project: @project}) %>'); $("#resource_list").html('<%= j(render partial:"project_file", locals: {project: @project}) %>');
$("#project_files_count_info").html("<%= @all_attachments.count %>"); $("#project_files_count_info").html("<%= @all_attachments.count %>");
$("#project_files_count_nav").html("(<%= @all_attachments.count %>)") $("#project_files_count_nav").html("(<%= @all_attachments.count %>)")
// 添加文件上传成功提示 // 添加文件上传成功提示
<% unless params[:attachments].nil? %> <% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>'); var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#course_list").prepend(div); $("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000) setTimeout( function(){div.remove();},3000)
<% end %> <% end %>
<% end %> <% end %>
<%elsif @course%> <%elsif @course%>
hideModal(); hideModal();
<%if @in_course_toolbar %> <%if @in_course_toolbar %>
window.location.href='<%= course_files_path(@course)%>' window.location.href='<%= course_files_path(@course)%>'
<%else%> <%else%>
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>'); $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
$("#courses_files_count_info").html("<%= @all_attachments.count%>"); $("#courses_files_count_info").html("<%= @all_attachments.count%>");
$("#courses_files_count_nav").html("(<%= @all_attachments.count%>)") $("#courses_files_count_nav").html("(<%= @all_attachments.count%>)")
// 添加文件上传成功提示, // 添加文件上传成功提示,
<% unless params[:attachments].nil? %> <% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>'); var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#course_list").prepend(div); $("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000) setTimeout( function(){div.remove();},3000)
<% end %> <% end %>
<%end%> <%end%>
<% elsif @org_subfield %> <% elsif @org_subfield %>
<% if params[:in_org] %> <% if params[:in_org] %>
window.location.href = '<%= org_subfield_files_path @org_subfield %>'; window.location.href = '<%= org_subfield_files_path @org_subfield %>';
<%else %> <%else %>
hideModal(); hideModal();
$("#resource_list").html('<%= j(render partial: "subfield_files" ,locals: {org_subfield: @org_subfield}) %>'); $("#resource_list").html('<%= j(render partial: "subfield_files" ,locals: {org_subfield: @org_subfield}) %>');
// 添加文件上传成功提示, // 添加文件上传成功提示,
<% unless params[:attachments].nil? %> <% unless params[:attachments].nil? %>
// var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>'); // var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
// $("#org_subfield_list").prepend(div); // $("#org_subfield_list").prepend(div);
// setTimeout( function(){div.remove();},3000); // setTimeout( function(){div.remove();},3000);
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% elsif @organization %> //组织单独处理
hideModal();
window.location.href = '<%= organization_path @organization %>';
<% end %>
<% end %> <% end %>
$(document).ready(img_thumbnails); $(document).ready(img_thumbnails);

@ -9,10 +9,10 @@
<%= favicon %> <%= favicon %>
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= stylesheet_link_tag 'org_new_style' %> <%= stylesheet_link_tag 'org_new_style','jquery/jquery-ui-1.9.2' %>
<%= javascript_include_tag 'org' %> <%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'attachments' %> <%= javascript_include_tag 'attachments' %>
<%= call_hook :view_layouts_base_html_head %> <%#= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
<!-- MathJax的配置 --> <!-- MathJax的配置 -->
@ -59,13 +59,35 @@
</script> </script>
</head> </head>
<!--add by huang--> <!--add by huang-->
<script type="text/javascript">
function orge_new_files_upload()
{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files',: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>
<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">
<span class="fl logo"><img src="/images/org_new_style/logo.jpg" alt=""/></span>
<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>
<%# 登录 %> <%# 登录 %>
<%= render :partial => 'organizations/org_logined_header' %> <%= render :partial => 'organizations/org_logined_header' %>
</div> </div>
@ -363,7 +385,7 @@
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>
</div> </div>
<%#= call_hook :view_layouts_base_body_bottom %>
</body> </body>
</html> </html>

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

@ -46,6 +46,14 @@ RedmineApp::Application.routes.draw do
end end
end end
resources :organizations do resources :organizations do
resource :files do
member do
end
collection do
end
end
resources :org_document_comments do resources :org_document_comments do
member do member do

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

@ -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;} .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;} .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; }

Loading…
Cancel
Save