diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 008a08f2f..73d1e357c 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -258,7 +258,7 @@ module Mobile requires :course_id,type: Integer,desc: '课程id' optional :name,type:String,desc:'课件名称可能包含的字符' end - get ":course_id/attachments" do + post ":course_id/attachments" do cs = CoursesService.new count = cs.course_attachments params present :data, count, with: Mobile::Entities::Attachment diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 147cbfda5..fa1856b3d 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -94,6 +94,33 @@ module Mobile present :status, 0 end + desc "用户留言" + params do + requires :token, type: String + requires :user_id, type: Integer,desc: '被留言的用户id' + end + get ':user_id/messages' do + us = UsersService.new + jours = us.get_all_messages params + present :data,jours,with:Mobile::Entities::Jours + present :status,0 + end + + desc "给用户留言或回复用户留言" + params do + requires :token, type: String + requires :user_id, type: Integer,desc: '被留言的用户id' + requires :content,type:String,desc:'留言内容' + requires :ref_user_id,type:Integer,desc:'被回复的用户id' + requires :parent_id,type:Integer,desc:'留言父id' + requires :ref_message_id,type:Integer,desc:'引用消息id' + end + post ':user_id/leave_message' do + us = UsersService.new + jours = us.reply_user_messages params,current_user + present :status,0 + end + end end end diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 7ccfb0e10..4a27f02ff 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -32,13 +32,17 @@ class BoardsController < ApplicationController #modify by nwb @flag = params[:flag] || false if @project - @boards = @project.boards.includes(:last_message => :author).all - @boards = [] << @boards[0] if @boards.any? - if @boards.size == 1 - @board = @boards.first - show and return + if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin? + render_403 + else + @boards = @project.boards.includes(:last_message => :author).all + @boards = [] << @boards[0] if @boards.any? + if @boards.size == 1 + @board = @boards.first + show and return + end + render :layout => false if request.xhr? end - render :layout => false if request.xhr? elsif @course if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) @boards = @course.boards.includes(:last_message => :author).all diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index d616daadc..be69b1777 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -342,10 +342,15 @@ class CoursesController < ApplicationController def export_course_member_excel @all_members = student_homework_score(0,0,0,"desc") + filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}"; + # 如果是ie11 需要转码 + if(/rv\:11\.0/.match(request.env["HTTP_USER_AGENT"]) != nil) + filename= URI::encode(filename) + end respond_to do |format| format.xls { send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", - :filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}.xls") + :filename => "#{filename}.xls") } end end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 69e7105aa..aa2c9574b 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -23,7 +23,7 @@ class FilesController < ApplicationController before_filter :auth_login1, :only => [:index] before_filter :logged_user_by_apptoken,:only => [:index] before_filter :find_project_by_project_id#, :except => [:getattachtype] - before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search,:search_project,:quote_resource_show_project,:search_tag_attachment] + before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,:search_tag_attachment] helper :sort include SortHelper @@ -46,6 +46,13 @@ class FilesController < ApplicationController @obj_attachments = paginateHelper @all_attachments,10 end + def searchone4reload + attachment = Attachment.find_by_id(params[:fileid]); + respond_to do |format| + format.html{render :layout => nil,:locals=>{:file=>attachment,:course=>@course}} + end + end + def search sort = "" @sort = "" diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b6035ca51..8acca7f81 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -84,15 +84,10 @@ class IssuesController < ApplicationController @issue_pages = Paginator.new @issue_count, @limit, params['page'] @offset ||= @issue_pages.offset @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], - :order => sort_clause, - :offset => @offset, - :limit => @limit) + :order => sort_clause, + :offset => @offset, + :limit => @limit) @issue_count_by_group = @query.issue_count_by_group - - - - - respond_to do |format| format.js format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 96807d2dc..536ea6bba 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -31,7 +31,7 @@ class ProjectsController < ApplicationController before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] - before_filter :file, :statistics, :watcherlist + before_filter :file, :statistics #:watcherlist # 除非项目内人员,不可查看成员, TODO: 完了写报表里去 before_filter :memberAccess, only: :member @@ -247,9 +247,9 @@ class ProjectsController < ApplicationController # 1、自动注册 # 2、加入项目、创建角色 # 3、用户得分 - if params[:email] - user = User.find_by_mail(params[:email].to_s) - Member.create(:role_ids => [4], :user_id => user.id,:project_id => @project.id) + if params[:mail] + Member.create(:role_ids => [4], :user_id => params[:user],:project_id => params[:id]) + UserGrade.create(:user_id =>params[:user], :project_id => params[:id]) end if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) return @@ -417,10 +417,14 @@ class ProjectsController < ApplicationController @members = @project.member_principals.includes(:roles, :principal).all.sort end else - roles = Role.find_all_givable - @subPage_title = l :label_member_list - @members = @project.member_principals.includes(:roles, :principal).joins("LEFT JOIN #{OptionNumber.table_name} ON #{OptionNumber.table_name}.user_id = #{Member.table_name}.user_id and #{OptionNumber.table_name}.score_type = 2 AND #{Member.table_name}.project_id = #{OptionNumber.table_name}.project_id").order("#{OptionNumber.table_name}.total_score DESC").all - @applied_members = appied_project_members(@project, @members) + if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin? + render_403 + else + roles = Role.find_all_givable + @subPage_title = l :label_member_list + @members = @project.member_principals.includes(:roles, :principal).joins("LEFT JOIN #{OptionNumber.table_name} ON #{OptionNumber.table_name}.user_id = #{Member.table_name}.user_id and #{OptionNumber.table_name}.score_type = 2 AND #{Member.table_name}.project_id = #{OptionNumber.table_name}.project_id").order("#{OptionNumber.table_name}.total_score DESC").all + @applied_members = appied_project_members(@project, @members) + end end @members = paginateHelper @members render :layout => 'base_courses' if @project.project_type == 1 @@ -676,11 +680,13 @@ class ProjectsController < ApplicationController true end - # added by huang - def watcherlist - if @watched - @users -= watched.watcher_users + unless @project.nil? + if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin? + render_403 + else + @users -= watched.watcher_users if @watched + end end end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 3d6772ea8..cc6c4f47e 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -85,6 +85,9 @@ class WordsController < ApplicationController elsif @journal_destroyed.jour_type == "Course" @course = Course.find @journal_destroyed.jour_id @jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count + elsif @journal_destroyed.jour_type == "Principal" + @user = User.find(@journal_destroyed.jour_id) + @jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count end respond_to do |format| format.js diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb index 7ad6fe65b..827557a40 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -47,6 +47,18 @@ module AccountHelper user end + # 自动创建一个新用户,但是初始状态是锁定的 + def automatically_register_lock(user, &block) + user.lock + user.last_login_on = Time.now + if user.save + UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) + else + yield if block_given? + end + user + end + def administrator_manually__register(user, &block) if user.save UserStatus.create(:user_id => user.id ,:changsets_count => 0, :watchers_count => 0) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index b72a191db..aae150728 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -67,29 +67,33 @@ module IssuesHelper s.html_safe end - #获取跟踪类型 - #REDO:时间紧需要优化,两个方法可以综合成一个 + #获取跟踪类型及样式 + #REDO:时间紧可以优化. def get_issue_type(value) + issuetype = [] if value == "缺陷" || value == 1 - class_type = "red_btn_cir ml10" + issuetype << "red_btn_cir ml10" + issuetype << "缺陷" elsif value == "功能" || value == 2 - class_type = "blue_btn_cir ml10" + issuetype << "blue_btn_cir ml10" + issuetype << "功能" elsif value == "支持" || value == 3 - class_type = "green_btn_cir ml10" + issuetype << "green_btn_cir ml10" + issuetype << "支持" + elsif value == "任务" || value == 4 + issuetype << "orange_btn_cir ml10" + issuetype << "任务" else - class_type = "orange_btn_cir ml10" + issuetype << "bgreen_btn_cir ml10" + issuetype << "周报" end end - def get_issue_typevalue(value) - if value == "缺陷" || value == 1 - assign = "缺陷" - elsif value == "功能" || value == 2 - assign = "功能" - elsif value == "支持" || value == 3 - assign = "支持" + def principals_options_for_isuue_list(project) + if User.current.member_of?(project) + project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0]) else - assign = "任务" + project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0]) end end diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index d9d910a66..1347c3026 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -255,7 +255,7 @@ 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[:f] = %w(subject status_id priority_id author_id assigned_to_id created_on) unless params[:status_id].nil? params[:op] = {'subject' => "~" , 'status_id' => ( params[:status_id] == '0' ? "!":"=" ), 'priority_id' => ( params[:priority_id] == '0' ? "!":"=" ), @@ -266,6 +266,19 @@ module QueriesHelper 'priority_id' => [params[:priority_id]], 'author_id' => [params[:author_id]], 'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil? + if(params[:status_id] != nil) + if( params[:issue_create_date_start]!=nil && params[:issue_create_date_start]!='' && + params[:issue_create_date_end]!=nil && params[:issue_create_date_end]!='' ) + params[:op][:created_on]='><' + params[:v][:created_on]=[params[:issue_create_date_start],params[:issue_create_date_end]] + elsif(params[:issue_create_date_start]!=nil && params[:issue_create_date_start]!='') + params[:op][:created_on]='>=' + params[:v][:created_on]=[params[:issue_create_date_start]] + elsif(params[:issue_create_date_end]!=nil && params[:issue_create_date_end]!='') + params[:op][:created_on]='<=' + params[:v][:created_on]=[params[:issue_create_date_end]] + end + end @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} # else diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 7756b7e27..2c3a94874 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -58,14 +58,10 @@ class Mailer < ActionMailer::Base us = UsersService.new # 自动激活用户 user = us.register_auto(login, @email, @password) - - Member.create(:role_ids => [4], :user_id => user.id,:project_id => project.id) - UserGrade.create(:user_id => user.id, :project_id => project.id) User.current = user unless User.current.nil? @user = user @token = Token.get_token_from_user(user, 'autologin') - @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id,:user => user, :token => @token.value - ) + @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user => user.id, :mail => true, :token => @token.value) mail :to => email, :subject => @subject end @@ -77,7 +73,7 @@ class Mailer < ActionMailer::Base @project_name = "#{project.name}" @user = user @token = Token.get_token_from_user(user, 'autologin') - @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :email => email, :token => @token.value) + @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user => user.id, :mail => true, :token => @token.value) mail :to => email, :subject => @subject end diff --git a/app/models/project.rb b/app/models/project.rb index f257058ea..47878dbec 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -114,7 +114,7 @@ class Project < ActiveRecord::Base validates_presence_of :name, :identifier validates_uniqueness_of :identifier - validates_uniqueness_of :name + # validates_uniqueness_of :name validates_associated :wiki#, :repository # validates_length_of :description, :maximum => 255 validates_length_of :name, :maximum => 255 diff --git a/app/services/users_service.rb b/app/services/users_service.rb index afefc6ff1..a8aacb095 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -4,6 +4,7 @@ class UsersService include AvatarHelper include CoursesHelper include ApiHelper + include WordsHelper #将用户注册的功能函数写这里 #参数约定 #成功返回注册后的User实例,失败直接抛异常 @@ -154,6 +155,34 @@ class UsersService @user end + # 获取某个用户的所有留言信息 + def get_all_messages params + user = User.find(params[:user_id]) + jours = user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + jours.update_all(:is_readed => true, :status => false) + jours.each do |journal| + fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) + end + jours + end + + # 回复用户 + def reply_user_messages params,current_user + user = User.find(params[:user_id]) + parent_id = params[:parent_id] + author_id = current_user.id + reply_user_id = params[:ref_user_id] + reply_id = params[:ref_message_id] + content = params[:content] + options = {:user_id => author_id, + :status => true, + :m_parent_id => parent_id, + :m_reply_id => reply_id, + :reply_id => reply_user_id, + :notes => content, + :is_readed => false} + user.add_jour(nil, nil,nil,options) + end diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb index a18d819da..fe0e9ab97 100644 --- a/app/views/attachments/_project_file_links.html.erb +++ b/app/views/attachments/_project_file_links.html.erb @@ -28,7 +28,8 @@
<% is_float ||= false %> <% for attachment in attachments %> -

+

+

<%if is_float%>

<% end%> @@ -50,9 +51,10 @@ :id => attachment, :filename => attachment.filename%> <% end %> - - <%= h(truncate(" - #{attachment.description}", length: options[:length] ? options[:length]:15, omission: '...')) unless attachment.description.blank? %> - +
+
+ <%= h(" - #{attachment.description}") unless attachment.description.blank? %> +
( <%= number_to_human_size attachment.filesize %>) diff --git a/app/views/attachments/add_exist_file_to_courses.js.erb b/app/views/attachments/add_exist_file_to_courses.js.erb index eec1e255a..c84a89184 100644 --- a/app/views/attachments/add_exist_file_to_courses.js.erb +++ b/app/views/attachments/add_exist_file_to_courses.js.erb @@ -4,4 +4,5 @@ $("#error_show").html("<%= @message.html_safe %>"); <% else %> closeModal(); + searchone4reload('<%=params[:file_id]%>'); <% end %> diff --git a/app/views/bids/_new_homework_form.html.erb b/app/views/bids/_new_homework_form.html.erb index 7a5f628f9..5958fccff 100644 --- a/app/views/bids/_new_homework_form.html.erb +++ b/app/views/bids/_new_homework_form.html.erb @@ -15,10 +15,10 @@ <% if edit_mode %> - <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID %> + <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID,:resizeType => 0 %> <% else %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor' %> + <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:resizeType => 0 %> <% end %>
diff --git a/app/views/contests/index.html.erb b/app/views/contests/index.html.erb index 170f11037..26e9e2114 100644 --- a/app/views/contests/index.html.erb +++ b/app/views/contests/index.html.erb @@ -46,9 +46,7 @@ <%= text_field_tag 'name', params[:name], :size => 30, :onkeyup => 'regexName1();', :width => "125px" %> <%= hidden_field_tag 'project_type', params[:project_type] %> <%#= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %> - - <%= l(:label_search)%> - + <%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb index 222d90458..420a22f8a 100644 --- a/app/views/courses/_course.html.erb +++ b/app/views/courses/_course.html.erb @@ -39,8 +39,8 @@

<%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %> - <%= content_tag "div", course.short_description, :class => "brief_introduction", :title => course.short_description %>

+ <%= content_tag "div", course.short_description, :class => "brief_introduction",:style=>'float:left;', :title => course.short_description %>
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 1769b1a45..ebccfcaf4 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -1,4 +1,15 @@ - <%= form_tag(projects_search_path, :method => :get, :id => "project_search_form") do %> - <%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();", :style => "float:left" %> - <%= hidden_field_tag 'project_type', params[:project_type] %> - <%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %> - - <%= l(:label_search)%> - -
- - <% end %> - - <%= link_to request.host()+"/forums", forums_path %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 71975c5c3..beade0a7a 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -1,247 +1,245 @@ <% @nav_dispaly_project_label = 1 -@nav_dispaly_forum_label = 1 %> + @nav_dispaly_forum_label = 1 %> <%#@nav_dispaly_project_label = 1 %> - - - <%= h html_title %> - - - <%= csrf_meta_tag %> - <%= favicon %> - <%= javascript_heads %> - <%= heads_for_theme %> - <%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %> - <%= javascript_include_tag 'cookie','project', 'header','select_list_move' %> - <%= call_hook :view_layouts_base_html_head %> - - <%= yield :header_tags -%> + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= javascript_heads %> + <%= heads_for_theme %> + <%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %> + <%= javascript_include_tag 'cookie','project', 'header','select_list_move' %> + <%= call_hook :view_layouts_base_html_head %> + + <%= yield :header_tags -%> - - - - - -
- <%= render :partial => 'layouts/new_header'%> + else if($("#friend_organization").attr("checked") == "checked"){ + project_type = 3; + } + $.get( + url, + { project_type: project_type}, + function (data) { + if(data == 1) + { + $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>"); + $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group')) %>'); + $("#close_light").attr("onClick","close_window('development_group');"); + } + else if(data == 2) + { + $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>"); + $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team')) %>'); + $("#close_light").attr("onClick","close_window('research_group');"); + } + else if(data == 3) + { + $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>"); + $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group')) %>'); + $("#close_light").attr("onClick","close_window('friend_organization');"); + } + else + { + alert("服务器异常,请与管理员联系"); + } + } + ); + } + + + + +
+ <%= render :partial => 'layouts/new_header'%> +
+ + +
+
+

+ + <%= l(:label_projects_community) %> + +

+ +
+ +
+
+
+
+ +
+ <%= l(:label_project_id)%><%= @project.id %> +
+ +
+ <% text = @project.project_new_type == 1 ? l(:label_development_team) : (@project.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%> + <% typeclass = @project.project_new_type == 1 ? "pr_kafa" : (@project.project_new_type == 2 ? "pr_keyan" : "pr_friend")%> + <%= render 'layouts/join_exit_project',{:text => text, :typeclass => typeclass} %> +
+ +
+
+ <%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %> + <% if @project.is_public? %> + <%= l(:label_public)%> + <% else %> + <%= l(:label_private)%> + <% end %> +
+
+ <% if @project.project_type == 0 %> + <%= l(:label_project_score)%> : + <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', + :action => 'show_projects_score', + :remote => true, + :id => @project.id}, :class => "c_orange f14" ) %> + <% end %> +
- -
-
-

- - <%= l(:label_projects_community) %> - -

- -
- - <%= form_tag(projects_search_path, :method => :get, :id => "project_search_form", :class => "search_form") do %> - <%= text_field_tag 'name', params[:name], :placeholder => "项目名称", :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %> - - <%= l(:label_search)%> - -
- + + -
-
-
-
- -
- <%= l(:label_project_id)%><%= @project.id %> -
- -
- <% text = @project.project_new_type == 1 ? l(:label_development_team) : (@project.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%> - <% typeclass = @project.project_new_type == 1 ? "pr_kafa" : (@project.project_new_type == 2 ? "pr_keyan" : "pr_friend")%> - <%= render 'layouts/join_exit_project',{:text => text, :typeclass => typeclass} %> -
- -
-
- <%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %> - <% if @project.is_public? %> - <%= l(:label_public)%> - <% else %> - <%= l(:label_private)%> - <% end %> -
-
-
- <% if @project.project_type == 0 %> - <%= l(:label_project_score)%> : - <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', - :action => 'show_projects_score', - :remote => true, - :id => @project.id - }, :class => "c_orange f14" ) %> - <% end %> -
- - -
- <%= l(:label_member) %>(<%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue' %>) - - <%= l(:label_user_watcher) %>(<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>) - - <%= l(:project_module_attachments) %>( - <% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> - <%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue' %>) -
-
-
- - - -
- - -
-
-

<%= l(:label_project_overview)%>:

-
- <%= textilizable(@project.description) if @project.description && !@project.description.blank? %> -
-
-
- - - - -
-
+ + <% end %> + + +
+ <% if @project.project_new_type == 1 || @project.project_new_type.nil? %> + <%= render :partial => 'projects/development_group', :locals => {:project => @project}%> + <% elsif @project.project_new_type == 2 %> + <%= render :partial => 'projects/research_team', :locals => {:project => @project}%> + <% else %> + <%= render :partial => 'projects/friend_group', :locals => {:project => @project}%> + <% end %> +
+ +
+
- -
-

<%= l(:label_tag)%>:

-
-
- <%= render :partial => 'tags/project_tag', :locals => {:obj => @project,:object_flag => "2"}%> -
-
-
-
-
-
+ +
+
+

<%= l(:label_project_overview)%>:

+
+ <%= textilizable(@project.description) if @project.description && !@project.description.blank? %> +
+
+
+ + + + +
+
-
- <%= render_flash_messages %> - <%= yield %> - <%= call_hook :view_layouts_base_content %> -
-
-
-
- <%= render :partial => 'layouts/new_footer'%> + +
+

<%= l(:label_tag)%>:

+
+
+ <%= render :partial => 'tags/project_tag', :locals => {:obj => @project,:object_flag => "2"}%> +
+
-
-
- - <% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%> -
-
-

请选择项目类型:

-
    -
  • id="development_group"/>
  • -
  • id="research_group"/>
  • -
  • id="friend_organization"/>
  • -
- 确定 - -
+
-
123
- <%= render :partial => 'layouts/new_feedback' %> - - - <%= call_hook :view_layouts_base_body_bottom %> - +
+ +
+ <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %> +
+
+
+
+ <%= render :partial => 'layouts/new_footer'%> +
+
+
+ + <% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%> +
+
+

请选择项目类型:

+
    +
  • id="development_group"/>
  • +
  • id="research_group"/>
  • +
  • id="friend_organization"/>
  • +
+ 确定 + +
+
+
123
+<%= render :partial => 'layouts/new_feedback' %> + + +<%= call_hook :view_layouts_base_body_bottom %> + diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb new file mode 100644 index 000000000..676761831 --- /dev/null +++ b/app/views/projects/_development_group.html.erb @@ -0,0 +1,52 @@ +<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> + +<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> + +<% end %> +<% unless @project.enabled_modules.where("name = 'boards'").empty? %> + +<% end%> +<% unless @project.enabled_modules.where("name = 'files'").empty? %> + +<% end %> +<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %> +<% if visible_repository?(@project) %> + +<% end %> + + + \ No newline at end of file diff --git a/app/views/projects/_friend_group.html.erb b/app/views/projects/_friend_group.html.erb new file mode 100644 index 000000000..dca5473f7 --- /dev/null +++ b/app/views/projects/_friend_group.html.erb @@ -0,0 +1,29 @@ +<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> + +<% unless @project.enabled_modules.where("name = 'boards'").empty? %> + +<% end%> +<% unless @project.enabled_modules.where("name = 'files'").empty? %> + +<% end %> \ No newline at end of file diff --git a/app/views/projects/_research_team.html.erb b/app/views/projects/_research_team.html.erb new file mode 100644 index 000000000..b2b0e3c33 --- /dev/null +++ b/app/views/projects/_research_team.html.erb @@ -0,0 +1,40 @@ +<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> + +<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> + +<% end %> +<% unless @project.enabled_modules.where("name = 'boards'").empty? %> + +<% end%> +<% unless @project.enabled_modules.where("name = 'files'").empty? %> + +<% end%> \ No newline at end of file diff --git a/app/views/projects/invite_members.html.erb b/app/views/projects/invite_members.html.erb index d30ecd8e4..97b36406e 100644 --- a/app/views/projects/invite_members.html.erb +++ b/app/views/projects/invite_members.html.erb @@ -1,4 +1,3 @@ -

<%= l(:label_invite_join) %>

@@ -68,5 +67,32 @@ var text=$(label).text(); $(label).attr("title",text); } + + function nh_show_err_message(msg){ + $("#RSide>.flash").remove(); + $("#RSide").prepend('
'+msg+'
'); + } + $('#new_membership').submit(function(){ + var user_ischeck=false; + $("input[name='membership[user_ids][]']").each(function(){ + if($(this).prop('checked')){ + user_ischeck=true; + } + }); + if(user_ischeck==false){ + nh_show_err_message('请选择用户!'); + return false; + } + var role_ischeck=false; + $("input[name='membership[role_ids][]']").each(function(){ + if($(this).prop('checked')){ + role_ischeck=true; + } + }); + if(role_ischeck==false){ + nh_show_err_message('请选择角色!'); + return false; + } + }); }); \ No newline at end of file diff --git a/app/views/projects/settings.html.erb b/app/views/projects/settings.html.erb index 25ec1c4d5..e70e20cef 100644 --- a/app/views/projects/settings.html.erb +++ b/app/views/projects/settings.html.erb @@ -1,6 +1,6 @@
@@ -21,7 +21,7 @@
-
+