Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq

This commit is contained in:
whimlex 2015-04-21 15:11:15 +08:00
commit 84d7e63d54
17 changed files with 156 additions and 97 deletions

View File

@ -145,10 +145,14 @@ class FilesController < ApplicationController
ids += version.id.to_s
end
end
resultSet = Attachment.where("((attachments.container_type = 'Project' And attachments.container_id = '#{project.id}') OR (container_type = 'Version' AND container_id IN (#{ids}))) AND filename LIKE :like ", like: "%#{keywords}%").
reorder(sort)
#resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC")
end
if ids.blank?
resultSet = Attachment.where("attachments.container_type = 'Project' And attachments.container_id = '#{project.id}' AND filename LIKE :like ", like: "%#{keywords}%").
reorder(sort)
else
resultSet = Attachment.where("((attachments.container_type = 'Project' And attachments.container_id = '#{project.id}') OR (container_type = 'Version' AND container_id IN (#{ids}))) AND filename LIKE :like ", like: "%#{keywords}%").
reorder(sort)
end
end
def find_public_attache keywords,sort = ""
# StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map

View File

@ -95,6 +95,7 @@ class IssuesController < ApplicationController
format.api {
Issue.load_visible_relations(@issues) if include_in_api_response?('relations')
}
# format.json { render :json => @issues.map { |issue| issue.to_json}} #:json => @issues.map { |issue| issue.to_json}
format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") }
format.csv { send_data(query_to_csv(@issues, @query, params), :type => 'text/csv; header=present', :filename => 'issues.csv') }
format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'issues.pdf') }

View File

@ -340,17 +340,18 @@ module IssuesHelper
if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key)
# Link to the attachment if it has not been removed
if options[:token].nil?
value = link_to_attachment(atta, :download => true, :only_path => options[:only_path], :class=> "info_foot_num c_blue")
value = atta.filename
else
value = link_to_attachment(atta, :download => true, :only_path => options[:only_path], :token => options[:token], :class=> "info_foot_num c_blue")
end
if options[:only_path] != false && atta.is_text?
value += link_to(
image_tag('magnifier.png'),
:controller => 'attachments', :action => 'show',
:id => atta, :filename => atta.filename
)
value = atta.filename
end
# 放大镜搜索功能
# if options[:only_path] != false && atta.is_text?
# value += link_to(
# image_tag('magnifier.png'),
# :controller => 'attachments', :action => 'show',
# :id => atta, :filename => atta.filename
# )
# end
else
value = content_tag("i", h(value)) if value
end

View File

@ -255,8 +255,19 @@ module QueriesHelper
# Give it a name, required to be valid
@query = IssueQuery.new(:name => "_")
@query.project = @project
params[:f] = %w(subject status_id priority_id author_id assigned_to_id) unless params[:status_id].nil?
params[:op] = {'subject' => "~" ,
'status_id' => ( params[:status_id] == '0' ? "!":"=" ),
'priority_id' => ( params[:priority_id] == '0' ? "!":"=" ),
'author_id' => ( params[:author_id] == '0' ? "!":"=" ),
'assigned_to_id' => ( params[:assigned_to_id] == '0' ? "!":"=" )} unless params[:status_id].nil?
params[:v] = {'subject' => [params[:subject]],
'status_id' => [params[:status_id]],
'priority_id' => [params[:priority_id]],
'author_id' => [params[:author_id]],
'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil?
@query.build_from_params(params)
session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
#session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
else
# retrieve from session
@query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id]

View File

@ -1,8 +1,3 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:lable_file_sharingarea) %></h2>
</div>
<!--<%#= stylesheet_link_tag 'resource', :media => 'all' %> -->
<script>
function show_upload()

View File

@ -27,4 +27,7 @@
<% end %>
<div class="cl"></div>
</div>
<% end -%>
<% end -%>
<ul class="wlist">
<%= pagination_links_full issue_pages, issue_count, :per_page_links => false, :remote => false, :flag => true %>
</ul>

View File

@ -1,15 +1,70 @@
<script>
function remote_function() {
$.ajax({
url:'<%= project_issues_path(@project)%>',
data:{
subject:$("#v_subject").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
status_id: $("#status_id").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
assigned_to_id: $("#assigned_to_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
priority_id: $("#priority_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
author_id: $("#author_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, "")
},
success: function(data){
},
error: function(data){
}
});
}
</script>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_issue_tracking) %></h2>
</div>
<div class="problem_top">
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<span>
<%= link_to l(:label_query), '#',
:onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %>
</span>
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
<%= hidden_field_tag 'set_filter', '1' %>
<div class="problem_search" >
<input class="problem_search_input fl" id="v_subject" type="text" name="v[subject]" value="">
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_function();" >搜索</a>
</div><!--problem_search end-->
<div id="filter_form" class="fr" >
<%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给",0]),
{ :include_blank => false,:selected=>0
},
{:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"v[assigned_to_id]",:class=>"w90"}
)
%>
<%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]),
{ :include_blank => false,:selected=>0
},
{:onchange=>"remote_function();",:id=>"priority_id",:name=>"v[priority_id]",:class=>"w90"}
)
%>
<%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]),
{ :include_blank => false,:selected=>0
},
{:onchange=>"remote_function();",:id=>"status_id",:name=>"v[status_id]",:class=>"w90"}
)
%>
<%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]),
{ :include_blank => false,:selected=>0
},
{:onchange=>"remote_function();",:id=>"author_id",:name=>"v[author_id]",:class=>"w90"}
)
%>
</div><!--filter_form end-->
<div class="cl"></div>
<% end %>
<p class="problem_p fl" ><%= l(:label_issues_sum) %><a href="javascript:void(0)" class="c_red"><%= @project.issues.count %></a>
<%= l(:lable_issues_undo) %><a href="javascript:void(0)" class="c_red"><%= @project.issues.where('status_id in (1,2,4,6)').count %> </a>
</p>
<div class="cl"></div>
<% end %>
<span class="problem_p fr"><%= l(:label_issues_sum) %><span><%= @project.issues.count %></span> <%= l(:lable_issues_undo) %><span><%= @project.issues.where('status_id in (1,2,4,6)').count %></span></span>
</div>
<div class="contextual">
<% if !@query.new_record? && @query.editable_by?(User.current) %>
@ -20,49 +75,6 @@
<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
<div style="clear:right; ">
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %>
<%= hidden_field_tag 'set_filter', '1' %>
<div id="custom_query" class="custom_query" style="display: <%= !params[:utf8].blank? ? 'block' : 'none' %>;">
<span>---<%= l :label_query_new %>---</span>
<div id="query_form_content" class="hide-when-print">
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
<legend onclick="toggleFieldset(this);">
<%= l(:label_issue_query_condition) %>
</legend>
<div style="<%= @query.new_record? ? "" : "display: none;" %>">
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
</div>
</fieldset>
<!-- 选项,暂不需要
<fieldset class="collapsible collapsed">
<legend onclick="toggleFieldset(this);">
<%#= l(:label_options) %>
</legend>
<div style="display: none;">
<table>
<tr>
<td><%#= l(:field_column_names) %></td>
<td><%#= render_query_columns_selection(@query) %></td>
</tr>
<tr>
<td><label for='group_by'><%#= l(:field_group_by) %></label></td>
<td><%#= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect { |c| [c.caption, c.name.to_s] }, @query.group_by)) %></td>
</tr>
<tr>
<td><%#= l(:button_show) %></td>
<td><%#= available_block_columns_tags(@query) %></td>
</tr>
</table>
</div>
</fieldset>
-->
<div class="buttons hide-when-print">
<%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %>
<%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %>
</div>
</div>
</div>
<% end %>
</div>
<%= error_messages_for 'query' %>
@ -73,10 +85,10 @@
<%= l(:label_no_data) %>
</p>
<% else %>
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
<ul class="wlist">
<%= pagination_links_full @issue_pages, @issue_count, :per_page_links => false, :remote => false, :flag => true %>
</ul>
<div id="issue_list">
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count} %>
</div>
<% end %>

View File

@ -0,0 +1 @@
$("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>");

View File

@ -113,12 +113,13 @@
<div id="update">
<%= render :partial => 'edit' %>
</div>
<!--留言-->
<p style="padding-top: 5px"></p>
<a remote="true" href="javascript:void(0)" class="blue_btn fr mr80" onclick="$('#issue-form').submit();">
<%= l(:button_submit) %>
</a>
<% end %>
<!--留言-->
<p style="padding-top: 5px"></p>
<a remote="true" href="javascript:void(0)" class="blue_btn fr mr80" onclick="$('#issue-form').submit();">
<%= l(:button_submit) %>
</a>
<%#= submit_tag l(:button_submit) %>
<%#= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' ,'preview',{:class => "blue_btn fr mr10"}%>
</div>

View File

@ -225,9 +225,9 @@
<div class=" mt10">
<h3 class="mb10 c_blue">请选择项目类型:</h3>
<ul class="mb10" id="project_type">
<li><input type="radio" name="project_type" <%= @project.project_new_type == 1 ? 'checked' : ''%> id="development_group"/><label >&nbsp;&nbsp;开发</label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 2 ? 'checked' : ''%> id="research_group"/><label >&nbsp;&nbsp;科研组</label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 3 ? 'checked' : ''%> id="friend_organization"/><label >&nbsp;&nbsp;朋友圈</label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 1 ? 'checked' : ''%> id="development_group"/><label >&nbsp;&nbsp;开发模式</label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 2 ? 'checked' : ''%> id="research_group"/><label >&nbsp;&nbsp;研讨模式</label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 3 ? 'checked' : ''%> id="friend_organization"/><label >&nbsp;&nbsp;圈子模式</label></li>
</ul>
<a href="javascript:void(0)" class="orange_btn" onclick="click_ok('<%= change_project_type_project_path @project%>');" >确定</a>

View File

@ -1,3 +1,4 @@
<%= error_messages_for 'project' %>
<%= labelled_form_for @project do |f| %>
<ul class="newpro_box ">
<li class="ml45 mb10">
@ -7,7 +8,9 @@
<li >
<label class="label02"><span class="c_red">*</span>&nbsp;名称&nbsp;&nbsp;</label>
<input id="project_name" name="project[name]" class=" w543" type="text" value="<%= @project.name%>">
<!--<input id="project_name" name="project[name]" class=" w543" type="text" value="<%#= @project.name%>">-->
<input type="text" name="project[name]" id="project_name" class="w543" maxlength="100" onkeyup="regex_project_name();" value="<%= @project.name %>">
<span class="c_red ml110" id="project_name_notice" style="display: none;">项目名称不能为空!</span>
</li>
<div class="cl"></div>
@ -32,6 +35,6 @@
<div class="cl"></div>
</li>
</ul>
<a href="javascript:void(0)" class="blue_btn ml110" onclick="$('#edit_project_<%= @project.id%>').submit();">保存</a>
<a href="javascript:void(0)" class="blue_btn ml110" onclick="submit_edit_project(<%= @project.id %>);" >保存</a>
<% end %>
<div class="cl"></div>

View File

@ -24,7 +24,7 @@
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
) do |f| %>
<% roles.each do |role| %>
<ul class="m120" style="text-align: left;" >
<ul class="ml80" style="text-align: left;" >
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
<label ><%= h role %></label>
@ -32,7 +32,7 @@
<!--<br/>-->
<% end %>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
<div class="m130">
<div class="ml80">
<a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
<%= l(:button_change)%>
</a>

View File

@ -22,15 +22,15 @@
<td >
<a class="c_blue02"><%= 'shared' if version.project != @project %> <%= link_to_version version %></a>
</td>
<td class="c_grey"><%= format_date(version.effective_date) %></td>
<td class="description"><%= format_date(version.effective_date) %></td>
<td class="description" style="word-break:break-all;"><%=h version.description %></td>
<td class="status"><%= l("version_status_#{version.status}") %></td>
<td class="sharing"><%=h format_version_sharing(version.sharing) %></td>
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="">
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="">
<%= link_to_if_authorized(h(truncate(version.wiki_page_title,:length=>20)), {:controller => 'wiki',
:action => 'show',
:project_id => version.project,
:id => Wiki.titleize(version.wiki_page_title)}) || h(version.wiki_page_title) unless version.wiki_page_title.blank? || version.project.wiki.nil? %>
:id => Wiki.titleize(version.wiki_page_title)},:class=>"c_blue02") || h(version.wiki_page_title) unless version.wiki_page_title.blank? || version.project.wiki.nil? %>
</td>
<td >
<% if version.project == @project && User.current.allowed_to?(:manage_versions, @project) %>

View File

@ -1,9 +1,10 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_roadmap) %></h2>
</div>
<!--<div class="content-title-top">-->
<!--<%#= link_to l(:label_version_new), new_project_version_path(@project), :class => 'icon icon-add' if User.current.allowed_to?(:manage_versions, @project) %>-->
<!--</div>-->
<div class="content-title-top">
<%= link_to l(:label_version_new), new_project_version_path(@project), :class => 'orange_u_btn fl' if User.current.allowed_to?(:manage_versions, @project) %>
</div>
<br/><br/>
<div class="roadmap">
<fieldset id="filters" class="collapsible collapsed" >
<legend><%= l(:label_version_display_settings)%></legend>

View File

@ -55,9 +55,9 @@ zh:
label_apply_project_waiting: 已处理申请,请等待管理员审核
label_unapply_project: 取消申请
lable_sure_exit_project: 是否确认退出该项目
label_friend_organization: 朋友
label_research_group: 科研组
label_development_team: 开发
label_friend_organization: 子模式
label_research_group: 研讨模式
label_development_team: 开发模式
label_member: 成员
project_module_attachments: 资源

View File

@ -90,7 +90,7 @@ function regexContent() {
return false;
}
// 项目编辑和提交
// 项目讨论区编辑和提交
function submitProjectsBoard() {
if (regexSubject() && regexContent()) {
$("#message-form").submit();
@ -161,7 +161,7 @@ function course_setting(id) {
$('#tbc_0' + (3 - id)).removeClass().addClass("undis");
}
//项目类型
//项目类型(朋友圈、开发组、科研组)
function show_window() {
$('#light').css('display', 'block');
$('#fade').css('display', 'block');
@ -189,6 +189,32 @@ function project_setting(n) {
}
}
}
//配置-验证项目名称
function regex_project_name()
{
var name = $.trim($("#project_name").val());
if(name.length == 0)
{
$("#project_name_notice").show();
return false;
}
else
{
$("#project_name_notice").hide();
return true;
}
}
//配置-信息提交
function submit_edit_project(id)
{
if(regex_project_name())
{
$("#edit_project_"+id).submit();
}
}
//配置--成员---申请列表--拒绝
function refusal_applied_member() {
$('#new_membership').append("<input name = 'refusal_button' style='display: none;'>");

View File

@ -72,7 +72,7 @@ a:hover.problem_pic{border:1px solid #64bdd9;}
a.problem_name{ color:#ff5722; }
a:hover.problem_name{ color:#d33503;}
a.problem_tit{ color:#0781b4; max-width:430px; font-weight:bold; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
a.problem_tit02{ color:#0781b4; font-weight:bold;width:400px; }
a.problem_tit02{ color:#0781b4; font-weight:bold;max-width:400px;}
a:hover.problem_tit,a:hover.problem_tit02{ color:#09658c; }
.problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;}
a.pro_mes{ float:left; color:#a0a0a0; display:block; width:100px; height:20px; }