diff --git a/app/assets/javascripts/org_document_comment.js.coffee b/app/assets/javascripts/org_document_comment.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/org_document_comment.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/org_member.js.coffee b/app/assets/javascripts/org_member.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/org_member.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/org_projects.js.coffee b/app/assets/javascripts/org_projects.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/org_projects.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/organizations.js.coffee b/app/assets/javascripts/organizations.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/organizations.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/org_document_comment.css.scss b/app/assets/stylesheets/org_document_comment.css.scss new file mode 100644 index 000000000..9359415ae --- /dev/null +++ b/app/assets/stylesheets/org_document_comment.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the org_document_comment controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/org_member.css.scss b/app/assets/stylesheets/org_member.css.scss new file mode 100644 index 000000000..4bab7e008 --- /dev/null +++ b/app/assets/stylesheets/org_member.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the OrgMember controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/org_projects.css.scss b/app/assets/stylesheets/org_projects.css.scss new file mode 100644 index 000000000..12f4fef6a --- /dev/null +++ b/app/assets/stylesheets/org_projects.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the org_projects controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/organizations.css.scss b/app/assets/stylesheets/organizations.css.scss new file mode 100644 index 000000000..39819880e --- /dev/null +++ b/app/assets/stylesheets/organizations.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the organizations controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index dd8dc84c4..cbbf36ea8 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -374,30 +374,29 @@ class FilesController < ApplicationController if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') Mailer.run.attachments_added(attachments[:files]) end - - if params[:course_attachment_type] && params[:course_attachment_type] != "5" - case params[:course_attachment_type] - when "1" - tag_name = l(:label_courseware) - when "2" - tag_name = l(:label_software) - when "3" - tag_name = l(:label_media) - when "4" - tag_name = l(:label_code) - when "6" - tag_name = "论文" - else - tag_name = "" + if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) + params[:course_attachment_type].each do |type| + tag_name = get_tag_name_by_type_number type + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.save + end + end end - if !attachments.empty? && attachments[:files] && tag_name != "" - attachments[:files].each do |attachment| - attachment.tag_list.add(tag_name) - attachment.save + else + if params[:course_attachment_type] && params[:course_attachment_type] != "5" + tag_name = get_tag_name_by_type_number params[:course_attachment_type] + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.save + end end end end + # TODO: 临时用 nyan sort_init 'created_on', 'desc' sort_update 'created_on' => "#{Attachment.table_name}.created_on", @@ -424,6 +423,23 @@ class FilesController < ApplicationController end end + def get_tag_name_by_type_number type + case type + when "1" + tag_name = l(:label_courseware) + when "2" + tag_name = l(:label_software) + when "3" + tag_name = l(:label_media) + when "4" + tag_name = l(:label_code) + when "6" + tag_name = "论文" + else + tag_name = "" + end + end + def tag_saveEx @tags = params[:tag_name][:name] @obj_id = params[:object_id] diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 5d83c1320..be2b44c06 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -74,10 +74,10 @@ class NewsController < ApplicationController @q = params[:subject] if params[:subject].nil? || params[:subject].blank? scope_order = scope.all(:include => [:author, :course], - :order => "#{News.table_name}.created_on DESC") + :order => "#{News.table_name}.sticky DESC, #{News.table_name}.created_on DESC") else scope_order = scope.where("#{News.table_name}.title like '#{'%' << params[:subject].to_s << '%'}'").all(:include => [:author, :course], - :order => "#{News.table_name}.created_on DESC") + :order => "#{News.table_name}.sticky DESC, #{News.table_name}.created_on DESC") end # :offset => @offset, diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb new file mode 100644 index 000000000..60522dc3f --- /dev/null +++ b/app/controllers/org_document_comments_controller.rb @@ -0,0 +1,63 @@ +class OrgDocumentCommentsController < ApplicationController + before_filter :find_organization, :only => [:new, :create, :show, :index] + + layout 'base_org' + + def new + @org_document_comment = OrgDocumentComment.new + end + + def create + @org_document_comment = OrgDocumentComment.new(:organization_id => @organization.id, :creator_id => User.current.id) + @org_document_comment.title = params[:org_document_comment][:title] + @org_document_comment.content = params[:org_document_comment][:content] + if @org_document_comment.save + #flash[:notice] = 'success' + OrgActivity + redirect_to organization_org_document_comments_path(@organization) + else + redirect_to new_org_document_comment_path(:organization_id => @organization.id) + end + end + def show + + end + + def index + @documents = @organization.org_document_comments.where("parent_id is null").order("created_at desc") + end + def update + @org_document = OrgDocumentComment.find(params[:id]) + @org_document.update_attributes(:title => params[:org_document_comment][:title], :content => params[:org_document_comment][:content]) + respond_to do |format| + format.html {redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id)} + end + end + + def edit + @org_document = OrgDocumentComment.find(params[:id]) + @organization = Organization.find(params[:organization_id]) + end + + def add_reply + @document = OrgDocumentComment.find(params[:id]).root + @comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id]) + @comment.content = params[:org_content] + @document.children << @comment + @document.save + end + + def find_organization + @organization = Organization.find(params[:organization_id]) + end + + def destroy + @org_document_comment = OrgDocumentComment.find(params[:id]) + org = @org_document_comment.organization + if @org_document_comment.destroy + if @org_document_comment.id == org.id + org.home_id == nil + end + end + end +end diff --git a/app/controllers/org_member_controller.rb b/app/controllers/org_member_controller.rb new file mode 100644 index 000000000..642a100c3 --- /dev/null +++ b/app/controllers/org_member_controller.rb @@ -0,0 +1,57 @@ +class OrgMemberController < ApplicationController + + def org_member_autocomplete + @org = Organization.find(params[:org]) + @flag = params[:flag] || false + respond_to do |format| + format.js + end + end + + def create + @org = Organization.find(params[:org]) + if params[:membership].nil? + @fail_hint = l(:label_blank_user_lists_for_org) + else + member_ids = params[:membership][:user_ids] + role_id = params[:orgRole] + member_ids.each do |user_id| + member = OrgMember.create(:user_id=>user_id, :created_at => Time.now) + @org.org_members << member + OrgMemberRole.create(:org_member_id => member.id, :role_id => role_id) + end + end + respond_to do |format| + format.js + end + end + + def update + @member = OrgMember.find(params[:id]) + #@member.change_role params[:org_member][:role_ids] + @member_role = @member.org_member_roles[0] + @member_role.role_id = params[:org_member][:role_ids][0] + @member_role.save + @org = @member.organization + respond_to do |format| + format.js + end + end + + def new + + end + + def destroy + member = OrgMember.find(params[:id]) + @org = member.organization + member.destroy + respond_to do |format| + format.js + end + end + + def index + + end +end diff --git a/app/controllers/org_projects_controller.rb b/app/controllers/org_projects_controller.rb new file mode 100644 index 000000000..733df95b7 --- /dev/null +++ b/app/controllers/org_projects_controller.rb @@ -0,0 +1,31 @@ +class OrgProjectsController < ApplicationController + def create + org_ids = params[:orgNames] + @project = Project.find(params[:project_id]) + org_ids.each do |org_id| + OrgProject.create(:organization_id => org_id.to_i, :project_id => params[:project_id].to_i, :created_at => Time.now) + p 1 + end + respond_to do |format| + format.js + end + end + def destroy + @project = Project.find(params[:project_id]) + @org_project = OrgProject.find(params[:id]) + @org_project.destroy + + condition = '%%' + project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:project_id]}").map(&:organization_id) + if project_org_ids.empty? + @orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page( 1).per(10) + @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count + else + project_org_ids = "(" + project_org_ids.join(',') + ")" + @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page( 1).per(10) + @org_count = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count + end + # @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count + @orgs_page = Paginator.new @org_count, 10,1 + end +end diff --git a/app/controllers/organization_controller.rb b/app/controllers/organization_controller.rb deleted file mode 100644 index 748fc1732..000000000 --- a/app/controllers/organization_controller.rb +++ /dev/null @@ -1,55 +0,0 @@ -class OrganizationController < ApplicationController - # layout 'base_projects' - before_filter :require_admin, :except => [:index] - - def index - #@projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)") - @organizations = Organization.all - respond_to do |format| - format.html - end - end - - def new - @organizations = Organization.new - respond_to do |format| - format.html - end - end - - def create - @organizations = Organization.new - @organizations.name = params[:organization][:name] - if @organizations.save - redirect_to admin_organization_url - end - end - - def edit - @organization = Organization.find params[:id] - respond_to do |format| - format.html - end - rescue Exception => e - render_404 - end - - def update - @organization = Organization.find params[:id] - @organization.name = params[:organization][:name] - if @organization.save - redirect_to admin_organization_url - end - rescue Exception => e - render_404 - end - - def destroy - @organization = Organization.find params[:id] - if @organization.destroy - redirect_to admin_organization_url - end - rescue Exception => e - render_404 - end -end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb new file mode 100644 index 000000000..6a1030adc --- /dev/null +++ b/app/controllers/organizations_controller.rb @@ -0,0 +1,149 @@ +# encoding: utf-8 +class OrganizationsController < ApplicationController + + + helper :sort + include SortHelper + helper :custom_fields + include CustomFieldsHelper + include AvatarHelper + include WordsHelper + include GitlabHelper + include UserScoreHelper + + include PollHelper + helper :user_score + helper :journals + + # added by liuping 关注 + + helper :watchers + helper :activities + + ### added by william + include ActsAsTaggableOn::TagsHelper + + # fq + helper :words + helper :project_score + helper :issues + include UsersHelper + before_filter :find_organization, :only => [:show, :members] + layout 'base_org' + def index + + end + def new + @organization = Organization.new + render :layout => 'new_base' + end + def create + @organization = Organization.new + @organization.name = params[:organization][:name] + @organization.description = params[:organization][:description] + @organization.is_public = params[:organization][:is_public] + @organization.creator_id = User.current.id + member = OrgMember.new(:user_id => User.current.id) + + @organization.org_members << member + if @organization.save + OrgMemberRole.create(:org_member_id => member.id, :role_id => 11) + redirect_to organization_path(@organization) + end + end + + def show + if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) + @organization = Organization.find(params[:id]) + project_ids = @organization.projects.map(&:id) << 0 + @org_activities = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))", + @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) + @org_activities_count = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))" , + @organization.id, 'Organization ').count + # @org_project_activties = ForgeActivity.where("project_id in (#{project_ids.join(',')}) and forge_act_type in('Issue','Message','ProjectCreateInfo')").order("updated_at desc").page(params[:page] || 1).per(10) + # @org_project_activties_count = ForgeActivity.where('project_id in (?)',project_ids.join(',')).count + #@org_activities = paginateHelper @org_activities, 10 + @page = params[:page] + respond_to do |format| + format.html + format.js + end + else + render_403 + end + end + + def update + @organization = Organization.find(params[:id]) + @organization.name = params[:organization][:name] + @organization.description = params[:organization][:description] + @organization.domain = params[:organization][:domain] + @organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0 + #@organization.name = params[:organization][:name] + @organization.save + respond_to do |format| + format.html { redirect_to setting_organization_path(@organization)} + end + end + + def check_uniq + @check = false; + @org_name = params[:org_name].strip + @config_page = params[:config_page] + sameName = @config_page ? Organization.where('name = ? and id != ?',params[:org_name],params[:org_id].to_i).count == 0 : Organization.where('name = ?',params[:org_name]).count == 0 + if sameName == true + @check = true + end + respond_to do |format| + format.js + end + end + + def find_organization + @organization = Organization.find(params[:id]) + end + + def setting + @organization = Organization.find(params[:id]) + + if User.current.admin? || User.current.admin_of_org?(@organization) + else + render_403 + end + end + + + def clear_org_avatar_temp + + end + + def set_homepage + @org = Organization.find(params[:id]) + @org.home_id = params[:home_id] + @org.save + # respond_to do |format| + # format.html {redirect_to organization_path(org)} + # end + end + + def autocomplete_search + @project = Project.find(params[:project_id]) + #@flag = params[:flag] || false + respond_to do |format| + format.js + end + end + + def members + @members = OrgMember.where("organization_id =?", @organization.id) + end + + def more_org_projects + @organization = Organization.find params[:id] + @page = params[:page] + @org_projects = @organization.org_projects.reorder('created_at').page((params[:page].to_i || 1) +1).per(5) + respond_to do |format| + format.js + end + end +end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index d26e465ba..baa7db060 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -69,6 +69,29 @@ class ProjectsController < ApplicationController ### added by william include ActsAsTaggableOn::TagsHelper + #查找组织 + def search_public_orgs_not_in_project + condition = '%%' + if !params[:name].nil? + condition = "%#{params[:name].strip}%".gsub(" ","") + end + project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:id]}").map(&:organization_id) + if project_org_ids.empty? + @orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(10) + @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count + else + project_org_ids = "(" + project_org_ids.join(',') + ")" + @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(10) + @org_count = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count + end + # @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count + @orgs_page = Paginator.new @org_count, 10,params[:page] + #render :json => {:orgs => @orgs_not_in_project, :count => @org_count}.to_json + respond_to do |format| + format.js + end + end + def index render_404 end @@ -338,6 +361,15 @@ class ProjectsController < ApplicationController @wiki ||= @project.wiki @select_tab = params[:tab] + #找出所有不属于项目的公共组织 + project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{@project.id}") + if project_org_ids.empty? + @orgs_not_in_project = Organization.where("is_public = 1") + else + project_org_ids = "(" + project_org_ids.join(',') + ")" + @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and is_public = 1") + end + # 处理从新建版本库返回来的错误信息 if !params[:repository_error_message].to_s.blank? html = "" @@ -607,6 +639,13 @@ class ProjectsController < ApplicationController @project.organization_id = params[:organization_id] params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0 params[:project][:hidden_repo] ? @project.hidden_repo = 1 : @project.hidden_repo = 0 + # 更新公开私有时同步gitlab公开私有 + unless @project.gpid.nil? + g = Gitlab.client + gproject = g.project(@project.gpid) + params[:project][:is_public] ? g.edit_project(gproject.id, 20) : g.edit_project(gproject.id, 0) + end + # end if validate_parent_id && @project.save @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') if params[:project][:is_public] == '0' @@ -826,5 +865,4 @@ class ProjectsController < ApplicationController end #gcmend - end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index c36877092..9ad46cd69 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -221,24 +221,36 @@ class StudentWorkController < ApplicationController def update if params[:student_work] + @submit_result = true @work.name = params[:student_work][:name] @work.description = params[:student_work][:description] @work.project_id = params[:student_work][:project] @work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@work) if @work.save +=begin respond_to do |format| format.html { flash[:notice] = l(:notice_successful_edit) redirect_to student_work_index_url(:homework => @homework.id) } +=end + @student_work = @work + respond_to do |format| + format.js end return end end +=begin respond_to do |format| format.html{redirect_to edit_student_work_url(@work)} end +=end + @submit_result = false + respond_to do |format| + format.js + end end def show diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0d9588d24..776e6b7d5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1910,6 +1910,28 @@ class UsersController < ApplicationController end end + def user_organizations + @user = User.current + @orgs = @user.organizations + respond_to do |format| + format.html {render :layout => 'static_base'} + end + end + + def search_user_orgs + name="" + if !params[:search_orgs].nil? + name = params[:search_orgs].strip + end + name = "%"+name+"%" + @orgs = User.current.organizations.where("name like ?", name) + @user = User.current + respond_to do |format| + format.html {render :layout => 'static_base'} + format.js + end + end + private def find_user diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 8590b836a..6cc622c49 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -60,6 +60,11 @@ class WordsController < ApplicationController course_activity.updated_at = Time.now course_activity.save end + principal_activity = PrincipalActivity.where("principal_act_type='JournalsForMessage' and principal_act_id =#{parent_id}").first + if principal_activity + principal_activity.updated_at = Time.now + principal_activity.save + end user_activity = UserActivity.where("act_type='JournalsForMessage' and act_id =#{parent_id}").first if user_activity user_activity.updated_at = Time.now diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e5cd9b52b..f4e0f88ff 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -48,6 +48,15 @@ module ApplicationHelper end end end + # 获取组织成员中文名字 + def get_org_member_role_name member + case member.roles[0].name + when 'orgManager' + '管理人员' + when 'orgMember' + '组织成员' + end + end # Time 2015-03-24 16:38:05 # Author lizanle @@ -2365,8 +2374,10 @@ module ApplicationHelper link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" else #学生显示提交作品、修改作品等按钮 work = cur_user_works_for_homework homework - if work.nil? + if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") + link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red' else if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前 link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" diff --git a/app/helpers/org_document_comment_helper.rb b/app/helpers/org_document_comment_helper.rb new file mode 100644 index 000000000..b430114f2 --- /dev/null +++ b/app/helpers/org_document_comment_helper.rb @@ -0,0 +1,2 @@ +module OrgDocumentCommentHelper +end diff --git a/app/helpers/org_member_helper.rb b/app/helpers/org_member_helper.rb new file mode 100644 index 000000000..fd70a0516 --- /dev/null +++ b/app/helpers/org_member_helper.rb @@ -0,0 +1,16 @@ +module OrgMemberHelper + include ApplicationHelper + def find_user_not_in_current_org_by_name org + if params[:q] && params[:q].lstrip.rstrip != "" + scope = Principal.active.sorted.not_member_of_org(org).like(params[:q]) + else + scope = [] + end + principals = paginateHelper scope,10 + s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') + links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| + link_to text, org_member_autocomplete_org_member_index_path(parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js')), :remote => true + } + s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) + end +end diff --git a/app/helpers/org_projects_helper.rb b/app/helpers/org_projects_helper.rb new file mode 100644 index 000000000..f3a7025bd --- /dev/null +++ b/app/helpers/org_projects_helper.rb @@ -0,0 +1,2 @@ +module OrgProjectsHelper +end diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 10321ba16..607d2af5c 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -1,2 +1,22 @@ -module EnterprisesHelper +# encoding: utf-8 +module OrganizationsHelper + include ApplicationHelper + + + def find_user_not_in_current_org_by_name org + if params[:q] && params[:q].lstrip.rstrip != "" + scope = Principal.active.sorted.not_member_of_org(org).like(params[:q]) + else + scope = [] + end + principals = paginateHelper scope,10 + s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') + links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| + link_to text, org_member_autocomplete_org_member_index_path( parameters.merge(:q => params[:q],:flag => true,:org=>org, :format => 'js')), :remote => true + } + s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) + end + + + end diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb index c4f13c6d0..8a94f1019 100644 --- a/app/models/forge_activity.rb +++ b/app/models/forge_activity.rb @@ -20,7 +20,7 @@ class ForgeActivity < ActiveRecord::Base validates :forge_act_id,presence: true validates :forge_act_type, presence: true has_many :user_acts, :class_name => 'UserAcivity',:as =>:act - after_save :add_user_activity + after_save :add_user_activity, :add_org_activity before_destroy :destroy_user_activity #在个人动态里面增加当前动态 @@ -45,6 +45,16 @@ class ForgeActivity < ActiveRecord::Base end end + def add_org_activity + OrgActivity.create(:user_id => self.user_id, + :org_act_id => self.forge_act_id, + :org_act_type => self.forge_act_type, + :container_id => self.project_id, + :container_type => 'Project', + :created_at => self.created_at, + :updated_at => self.updated_at) + end + def destroy_user_activity user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'") user_activity.destroy_all diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index faab129a6..5e40267cb 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -136,10 +136,8 @@ class JournalsForMessage < ActiveRecord::Base #用户动态公共表记录 def act_as_principal_activity - if self.jour_type == 'Principal' - unless self.user_id == self.jour.id && self.user_id != self.reply_id && self.reply_id != 0 - self.principal_acts << PrincipalActivity.new(:user_id => self.user_id, :principal_id => self.jour_id) - end + if self.jour_type == 'Principal' && self.m_parent_id.nil? + self.principal_acts << PrincipalActivity.new(:user_id => self.user_id, :principal_id => self.jour_id) end end diff --git a/app/models/news.rb b/app/models/news.rb index a9e9d1d18..e9b8b5314 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -66,7 +66,7 @@ class News < ActiveRecord::Base scope :course_visible, lambda {|*args| includes(:course).where(Course.allowed_to_condition(args.shift || User.current, :view_course_news, *args)) } - safe_attributes 'title', 'summary', 'description' + safe_attributes 'title', 'summary', 'description', 'sticky' def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_news, project) diff --git a/app/models/org_activity.rb b/app/models/org_activity.rb new file mode 100644 index 000000000..c48ebdf8e --- /dev/null +++ b/app/models/org_activity.rb @@ -0,0 +1,5 @@ +class OrgActivity < ActiveRecord::Base + # attr_accessible :title, :body + belongs_to :org_act ,:polymorphic => true + belongs_to :container,:polymorphic => true +end diff --git a/app/models/org_document_comment.rb b/app/models/org_document_comment.rb new file mode 100644 index 000000000..2b3c9132a --- /dev/null +++ b/app/models/org_document_comment.rb @@ -0,0 +1,16 @@ +class OrgDocumentComment < ActiveRecord::Base + attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title,:sticky,:locked + include Redmine::SafeAttributes + belongs_to :organization + belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id' + + acts_as_tree :order => "#{OrgDocumentComment.table_name}.sticky asc, #{OrgDocumentComment.table_name}.created_at desc" + has_many :org_acts, :class_name => 'OrgActivity',:as =>:org_act ,:dependent => :destroy + after_create :document_save_as_org_activity + + def document_save_as_org_activity + if(self.parent().nil?) + self.org_acts << OrgActivity.new(:user_id => User.current.id, :container_id => self.organization.id, :container_type => 'Organization') + end + end +end diff --git a/app/models/org_member.rb b/app/models/org_member.rb new file mode 100644 index 000000000..a1c61f99d --- /dev/null +++ b/app/models/org_member.rb @@ -0,0 +1,8 @@ +class OrgMember < ActiveRecord::Base + attr_accessible :organization_id, :role, :user_id + belongs_to :organization + belongs_to :user + has_many :roles ,:through => :org_member_roles,:foreign_key => 'role_id' + has_many :org_member_roles,:dependent => :destroy + +end diff --git a/app/models/org_member_role.rb b/app/models/org_member_role.rb new file mode 100644 index 000000000..0ce4f8141 --- /dev/null +++ b/app/models/org_member_role.rb @@ -0,0 +1,5 @@ +class OrgMemberRole < ActiveRecord::Base + # attr_accessible :title, :body + belongs_to :org_member + belongs_to :role +end diff --git a/app/models/org_project.rb b/app/models/org_project.rb new file mode 100644 index 000000000..ec01013fc --- /dev/null +++ b/app/models/org_project.rb @@ -0,0 +1,5 @@ +class OrgProject < ActiveRecord::Base + # attr_accessible :title, :body + belongs_to :organization + belongs_to :project +end diff --git a/app/models/organization.rb b/app/models/organization.rb index 5f52dee98..7778da477 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -1,5 +1,14 @@ class Organization < ActiveRecord::Base - attr_accessible :logo_link, :name + attr_accessible :name, :description, :creator_id, :home_id, :domain, :is_public + has_many :org_members, :dependent => :destroy + has_many :org_projects ,:dependent => :destroy + has_many :projects,:through => :org_projects + has_many :org_document_comments, :dependent => :destroy + has_many :users, :through => :org_members + validates_uniqueness_of :name + after_create :save_as_org_activity - has_many :projects + def save_as_org_activity + OrgActivity.create(:user_id => User.current.id, :org_act_id => self.id, :org_act_type => 'CreateOrganization', :container_id => self.id, :container_type => 'Organization') + end end diff --git a/app/models/principal.rb b/app/models/principal.rb index 0f0746f78..dd376f609 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -87,6 +87,16 @@ class Principal < ActiveRecord::Base end } + scope :not_member_of_org, lambda {|org| + orgs = [org] unless org.is_a?(Array) + if orgs.empty? + where("1=0") + else + ids = orgs.map(&:id) + where("#{Principal.table_name}.id NOT IN (SELECT DISTINCT user_id FROM #{OrgMember.table_name} WHERE organization_id IN (?))", ids) + end + } + scope :sorted, lambda { order(*Principal.fields_for_order_statement)} scope :applied_members, lambda {|project| diff --git a/app/models/project.rb b/app/models/project.rb index fd1012fa0..0b0420920 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -69,6 +69,7 @@ class Project < ActiveRecord::Base has_many :applied_projects, :dependent => :destroy has_many :invite_lists, :dependent => :destroy has_one :dts + has_many :organizations,:through => :org_projects # end #ADDED BY NIE @@ -96,7 +97,8 @@ class Project < ActiveRecord::Base # 关联虚拟表 has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy - belongs_to :organization + has_many :org_projects,:dependent => :destroy + has_many :organization,:through => :org_projects # has_many :journals diff --git a/app/models/role.rb b/app/models/role.rb index 8bf5ebc05..f6a24a27f 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -55,6 +55,8 @@ class Role < ActiveRecord::Base has_many :member_roles, :dependent => :destroy has_many :members, :through => :member_roles + has_many :org_member_roles, :dependent => :destroy + has_many :org_members,:through => :org_member_roles acts_as_list serialize :permissions, ::Role::PermissionsAttributeCoder diff --git a/app/models/user.rb b/app/models/user.rb index edc29c015..85b9e2591 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -94,8 +94,11 @@ class User < Principal has_one :preference, :dependent => :destroy, :class_name => 'UserPreference' has_one :rss_token, :class_name => 'Token', :conditions => "action='feeds'" has_one :blog, :class_name => 'Blog', :foreign_key => "author_id" + has_many :org_document_comments, :dependent =>:destroy has_one :api_token, :class_name => 'Token', :conditions => "action='api'" belongs_to :auth_source + has_many :org_members + has_many :organizations, :through => :org_members belongs_to :ucourse, :class_name => 'Course', :foreign_key => :id #huang ## added by xianbo for delete # has_many :biding_projects, :dependent => :destroy @@ -769,6 +772,21 @@ class User < Principal courses.to_a.include?(course) end + def member_of_org?(org) + OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count > 0 + end + + def admin_of_org?(org) + if OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count == 0 + return false + end + role = OrgMember.where("user_id =? and organization_id =?", self.id, org.id)[0].roles[0] + unless role.nil? + role.name == 'orgManager' ? true : false + else + false + end + end def member_of_course_group?(course_group) course_groups.to_a.include?(course_group) end diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index fadf5e465..b316aa406 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -128,6 +128,11 @@ }); $mail.blur(function (event) { + if (/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){ + $('#mail_req').html( '邮件格式不对').show(); + $mail_correct = false; + return ; + } if ($(this).is('#user_mail')) { $.get('<%=account_valid_ajax_path%>', { valid: "mail", diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 3dbc8d8ba..ab8b80dcb 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -62,6 +62,7 @@ :field_is_public => l(:field_is_public), :are_you_sure => l(:text_are_you_sure), :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), :delete_all_files => l(:text_are_you_sure_all) } %> diff --git a/app/views/attachments/_form_course.html.erb b/app/views/attachments/_form_course.html.erb index b66632c7f..ef5385647 100644 --- a/app/views/attachments/_form_course.html.erb +++ b/app/views/attachments/_form_course.html.erb @@ -60,7 +60,9 @@ :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) + :delete_all_files => l(:text_are_you_sure_all), + :lebel_file_uploding => l(:lebel_file_uploding), + :containerid => "#{container.id}" } %> <% if container.nil? %> <%= l(:label_no_file_uploaded)%> diff --git a/app/views/attachments/_form_project.html.erb b/app/views/attachments/_form_project.html.erb index d1cdf8cc9..a9cb068ad 100644 --- a/app/views/attachments/_form_project.html.erb +++ b/app/views/attachments/_form_project.html.erb @@ -60,7 +60,9 @@ :field_is_public => l(:field_is_public), :are_you_sure => l(:text_are_you_sure), :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), :delete_all_files => l(:text_are_you_sure_all), + :lebel_file_uploding => l(:lebel_file_uploding), :containerid => "#{container.id}" } %> <%= l(:label_no_file_uploaded)%> diff --git a/app/views/attachments/_new_form.html.erb b/app/views/attachments/_new_form.html.erb index 47f6fd202..75efb448e 100644 --- a/app/views/attachments/_new_form.html.erb +++ b/app/views/attachments/_new_form.html.erb @@ -42,6 +42,7 @@ :field_is_public => l(:field_is_public), :are_you_sure => l(:text_are_you_sure), :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), :delete_all_files => l(:text_are_you_sure_all) } %> diff --git a/app/views/blog_comments/_blog_attachments.erb b/app/views/blog_comments/_blog_attachments.erb index 48fe91099..dd8be659b 100644 --- a/app/views/blog_comments/_blog_attachments.erb +++ b/app/views/blog_comments/_blog_attachments.erb @@ -62,6 +62,7 @@ :field_is_public => l(:field_is_public), :are_you_sure => l(:text_are_you_sure), :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), :delete_all_files => l(:text_are_you_sure_all) } %> diff --git a/app/views/blog_comments/_edit.html.erb b/app/views/blog_comments/_edit.html.erb index d56557ce7..375c948d4 100644 --- a/app/views/blog_comments/_edit.html.erb +++ b/app/views/blog_comments/_edit.html.erb @@ -3,7 +3,7 @@
- +

diff --git a/app/views/blog_comments/_new.html.erb b/app/views/blog_comments/_new.html.erb index 2a2281a40..48f152c4e 100644 --- a/app/views/blog_comments/_new.html.erb +++ b/app/views/blog_comments/_new.html.erb @@ -3,7 +3,7 @@
- +

+
<%= render :partial=>"projects/settings/new_versions" if User.current.allowed_to?(:manage_versions, @project)%>
@@ -70,6 +73,9 @@ +
+ <%= render :partial=>"projects/settings/join_org" %> +
<%= render :partial=>"projects/settings/new_repositories" if User.current.allowed_to?(:manage_repository, @project)%> diff --git a/app/views/projects/settings/_added_orgs.html.erb b/app/views/projects/settings/_added_orgs.html.erb new file mode 100644 index 000000000..d07ead277 --- /dev/null +++ b/app/views/projects/settings/_added_orgs.html.erb @@ -0,0 +1,9 @@ +
    +
  • 名称操作
  • + <% orgs.each do |org| %> +
  • <%= org.name %> + <%= link_to "取消关联", org_project_path(:id => OrgProject.where(:organization_id => org.id, :project_id => project_id).first.id, :project_id => project_id), + :method => 'delete',:remote => true, :class => "relatedListOption fl linkGrey3" %> +
  • + <% end %> +
\ No newline at end of file diff --git a/app/views/projects/settings/_join_org.html.erb b/app/views/projects/settings/_join_org.html.erb new file mode 100644 index 000000000..589bed1b9 --- /dev/null +++ b/app/views/projects/settings/_join_org.html.erb @@ -0,0 +1,108 @@ + + + + + + + +<%= stylesheet_link_tag 'org' %> + +
    +
  • 组织
  • +
  • +
    +
+
+
+ 关联组织 +
+ <%= form_tag url_for(:controller => 'org_projects', :action => 'create', :project_id => @project.id), :id => 'join_orgs_for_project', :remote => true do %> + +
+
    + 关联 + 取消 + <% end %> +
    +
    +
    + 已关联组织 +
    + <%= render :partial => 'projects/settings/added_orgs', :locals => {:orgs => @project.organizations, :project_id => params[:id]} %> +
    +
    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index 961f351de..0258b3b83 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -16,7 +16,7 @@ <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
    <%end%> - 提交 + 提交
    <% end%> \ No newline at end of file diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index 02e73aaab..2a0962244 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -5,7 +5,7 @@
  • <%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(student_work.user)) %>
  • -
    +
  • <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
    @@ -25,7 +25,7 @@
  • -
  • +
  • <% if student_work.created_at && @homework.end_time%> <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>  <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %> @@ -80,5 +80,15 @@
  • <% end%> + + diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index 78114d62b..e336b0282 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -1,62 +1,70 @@ - -
      - <% is_my_work = student_work.user == User.current%> -
    • -
        - <% if is_my_work%> -
      • - <%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %> -
      • -
      • - <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> -
        - <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%> -
        -
      • -
      • -
          -
        • - <%= student_work.user.show_name%> -
        • -
        • - <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> -
        • -
        -
      • - <% else%> -
      • - <%= image_tag(url_to_avatar(""),width:"40", height: "40") %> -
      • -
      • -
        - <%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%> -
        -
      • -
      • -
          -
        • - 匿名 -
        • -
        • - -- -
        • -
        -
      • - <% end%> - -
      -
    • -
    • - <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>  - <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %> - [迟交] - <% end %> -
    • - - - <% my_score = student_work_score(student_work,User.current) %> -
    • - <%= my_score.nil? ? "--" : format("%.1f",my_score.score)%> -
    • -
    - + +
      + <% is_my_work = student_work.user == User.current%> +
    • +
        + <% if is_my_work%> +
      • + <%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %> +
      • +
      • + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> +
        + <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%> +
        +
      • +
      • +
          +
        • + <%= student_work.user.show_name%> +
        • +
        • + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> +
        • +
        +
      • + <% else%> +
      • + <%= image_tag(url_to_avatar(""),width:"40", height: "40") %> +
      • +
      • +
        + <%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%> +
        +
      • +
      • +
          +
        • + 匿名 +
        • +
        • + -- +
        • +
        +
      • + <% end%> + +
      +
    • +
    • + <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>  + <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %> + [迟交] + <% end %> +
    • + + + <% my_score = student_work_score(student_work,User.current) %> +
    • + <%= my_score.nil? ? "--" : format("%.1f",my_score.score)%> +
    • + +
    + + diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 286d5eb39..1b0202536 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -9,10 +9,10 @@ <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
  • - <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> + <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %>
  • -
  • - <%= link_to "",edit_student_work_path(work),:class => "pic_edit"%> +
  • + <%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%>
  • <% end%> <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> diff --git a/app/views/student_work/_student_work_attachment_form.html.erb b/app/views/student_work/_student_work_attachment_form.html.erb index 265ff9be7..d82aea7f9 100644 --- a/app/views/student_work/_student_work_attachment_form.html.erb +++ b/app/views/student_work/_student_work_attachment_form.html.erb @@ -19,6 +19,7 @@ :field_is_public => l(:field_is_public), :are_you_sure => l(:text_are_you_sure), :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), :delete_all_files => l(:text_are_you_sure_all), :containerid => "#{work.id}" } %> diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index d834bc845..c18ec4c73 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -2,10 +2,14 @@ 作品 - (<%= @student_work_count%>) + (<%= @student_work_count%>人已交) <% if !@is_teacher && @stundet_works.empty?%> - 未提交 + 您尚未提交作品 + <% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%> + 您已提交且不可再修改,因为截止日期已过 + <% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%> + 您已提交,您还可以修改 <% end %> <%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%> diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index 25a65f039..517a238b0 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -26,7 +26,7 @@
    - <%= labelled_form_for @work,:html => { :multipart => true } do |f|%> + <%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%>
    提示:作品名称和描述中不要出现真实的姓名信息
    @@ -52,7 +52,7 @@
    - 确定 + 确定 <%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%>
    @@ -60,3 +60,12 @@ <% end%>
    + \ No newline at end of file diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index db83fd432..fdf1e31a3 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -111,11 +111,20 @@
    - 确定 + 确定 <%= link_to "取消", user_homeworks_user_path(User.current.id), :class => "fr mr10 mt3"%>
    <% end%>
    -
    \ No newline at end of file +
    + \ No newline at end of file diff --git a/app/views/student_work/update.js.erb b/app/views/student_work/update.js.erb new file mode 100644 index 000000000..79733db31 --- /dev/null +++ b/app/views/student_work/update.js.erb @@ -0,0 +1,16 @@ +<% if @submit_result%> +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); +showModal('ajax-modal', '500px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("anonymos"); +<% else %> +window.location.href = '<%= edit_student_work_url(@work)%>'; +<% end %> + +function clickCanel() { + hideModal('#popbox02'); + window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; +} \ No newline at end of file diff --git a/app/views/users/_attachment_list.html.erb b/app/views/users/_attachment_list.html.erb index 33e944498..939513627 100644 --- a/app/views/users/_attachment_list.html.erb +++ b/app/views/users/_attachment_list.html.erb @@ -7,7 +7,7 @@ :id => '_file', :class => ie8? ? '':'file_selector', :multiple => true, - :onchange => 'addInputFiles(this);', + :onchange => 'addInputFiles(this,"'+'upload_files_submit_btn'+'");', :style => ie8? ? '': 'display:none', :data => { :max_file_size => Setting.attachment_max_size.to_i.kilobytes, @@ -18,6 +18,7 @@ :field_is_public => l(:field_is_public), :are_you_sure => l(:text_are_you_sure), :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), :delete_all_files => l(:text_are_you_sure_all) } %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 38a4d6edd..d02cea104 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -23,7 +23,11 @@ <% else %> 匿评已禁用 <% end %> - 作品提交中 + <% if Time.parse(activity.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%> + 作品提交中 + <% elsif Time.parse(activity.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %> + 作品补交中 + <% end %> <% elsif activity.homework_detail_manual.comment_status == 2%> <% if activity.anonymous_comment == 0%> 匿评中 diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index f9087f057..475a982e5 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -12,9 +12,13 @@ <% end %> TO <%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %> -
    + + <% if activity.sticky == 1%> + 置顶 + <% end%> +
    发布时间:<%= format_time(activity.created_on) %>
    diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 6f47e3535..156da0f07 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -7,7 +7,7 @@ <% attachments.each do |attach| %>
    • - +
    • diff --git a/app/views/users/_show_user_org.html.erb b/app/views/users/_show_user_org.html.erb new file mode 100644 index 000000000..e753092fa --- /dev/null +++ b/app/views/users/_show_user_org.html.erb @@ -0,0 +1,39 @@ +<%= stylesheet_link_tag 'pleft','header','new_user','repository','org', 'project' %> +<%#= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','org' %> +
      +
      +
      +
      + 组织列表 + + <%= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %> + + + + 搜索 + <% end %> +
      +
      +
      + <% orgs.each do |org| %> +
      +
      + <%= link_to image_tag(url_to_avatar(org), :width => '78', :height => '78', :alt => '组织logo'), organization_path(org), :class => "linkGrey2" %> +
      +
      +
      + <%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %> +
      +
      <%= org.description %>
      +
      创建者:<%= link_to User.find(org.creator_id), user_path(org.creator_id), :class => 'linkGrey2', :target => '_blank' %>
      + +
      您的身份:<%= User.current.admin_of_org?(org) ? "组织管理员" : "组织成员" %>
      +
      + +
      +
      + <% end %> +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/users/_special_user_homework_attachment.html.erb b/app/views/users/_special_user_homework_attachment.html.erb new file mode 100644 index 000000000..2f5a4e8e3 --- /dev/null +++ b/app/views/users/_special_user_homework_attachment.html.erb @@ -0,0 +1,61 @@ +
      + + <% if defined?(container) && container && container.saved_attachments %> + <% container.attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> + <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
      + <% end %> + <% container.saved_attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> + <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
      + <% end %> + <% end %> +
      + <%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => ie8? ? '' : 'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this,"'+'upload_files_submit_btn'+'");', + :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',:project =>nil), + :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), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all) + } %> +
      +
      + +
      + + 上传附件 + <%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr20",:remote => true%> + <% if defined?(has_program) && has_program %> + 编程 + + <% end %> +
      + +<% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> +<% end %> \ No newline at end of file diff --git a/app/views/users/_upload_resource.html.erb b/app/views/users/_upload_resource.html.erb index d73b2986a..c973217f6 100644 --- a/app/views/users/_upload_resource.html.erb +++ b/app/views/users/_upload_resource.html.erb @@ -45,9 +45,9 @@
      - <%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:class=>'sendSourceText' %> + <%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
      - +
      <% end %>
      diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 9b7c6c06a..24d37ae63 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -40,6 +40,7 @@ :field_is_public => l(:field_is_public), :are_you_sure => l(:text_are_you_sure), :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), :delete_all_files => l(:text_are_you_sure_all) } %>
    diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 0c2a28e5c..539b8b603 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -23,7 +23,11 @@ <% else %> 匿评已禁用 <% end %> - 作品提交中 + <% if Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%> + 作品提交中 + <% elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %> + 作品补交中 + <% end %> <% elsif homework_common.homework_detail_manual.comment_status == 2%> <% if homework_common.anonymous_comment == 0%> 匿评中 diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 6d929ac5f..efaed2d9d 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -17,11 +17,17 @@
    <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%> -
    + <% if edit_mode %> + + <% end %> +
    <%= calendar_for('homework_end_time')%>
    -
    + <% if edit_mode %> + + <% end %> +
    <%= calendar_for('homework_publish_time')%>
    diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index da649663d..3e4576b47 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -126,7 +126,7 @@ <% end %>
    -
  •    截止时间快到了!
  • +
  •    截止时间快到了.
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -158,7 +158,7 @@
  • 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %>  23:59
  • <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%> -

    请您尽早完成匿评!如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。

    +

    请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。

    例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分

    <% end%>
    @@ -209,7 +209,7 @@ <% end %> @@ -404,14 +404,16 @@

    如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!

    -
  •   您迟交了作品!
  • +
  •   您迟交了作品
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> <% if ma.course_message_type == "Course" %>
      -
    • +
    • + +
    • 系统提示 ">您成功创建了课程: @@ -443,7 +445,9 @@ <% end %> <% if ma.course_message_type == "JoinCourseRequest" %>
        -
      • +
      • + +
      • 系统提示 ">您有了新的课程成员申请: @@ -482,7 +486,9 @@ <% end %> <% if ma.course_message_type == "CourseRequestDealResult" %>
          -
        • +
        • + +
        • 系统提示 "> @@ -548,7 +554,7 @@ <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
          • - +
          • 系统提示 diff --git a/app/views/users/search_user_orgs.html.erb b/app/views/users/search_user_orgs.html.erb new file mode 100644 index 000000000..1a921d38e --- /dev/null +++ b/app/views/users/search_user_orgs.html.erb @@ -0,0 +1 @@ +<%= render :partial => 'show_user_org', :locals => {:orgs => @orgs} %> \ No newline at end of file diff --git a/app/views/users/search_user_orgs.js.erb b/app/views/users/search_user_orgs.js.erb new file mode 100644 index 000000000..7184a29c5 --- /dev/null +++ b/app/views/users/search_user_orgs.js.erb @@ -0,0 +1,2 @@ + +//$("#org_list").replaceWith("<%#= escape_javascript(render :partial => 'show_user_org', :locals => {:orgs => @orgs}) %>") \ No newline at end of file diff --git a/app/views/users/user_organizations.html.erb b/app/views/users/user_organizations.html.erb new file mode 100644 index 000000000..e2a24b2aa --- /dev/null +++ b/app/views/users/user_organizations.html.erb @@ -0,0 +1,39 @@ +<%= stylesheet_link_tag 'pleft','header','new_user','repository','org', 'project' %> +<%#= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','org' %> +
            +
            +
            +
            + 组织列表 + + <%= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %> + + + + 搜索 + <% end %> +
            +
            +
            + <% @orgs.each do |org| %> +
            +
            + <%= link_to image_tag(url_to_avatar(org), :width => '78', :height => '78', :alt => '组织logo'), organization_path(org), :class => "linkGrey2" %> +
            +
            +
            + <%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %> +
            +
            <%= org.description %>
            +
            创建者:<%= link_to User.find(org.creator_id), user_path(org.creator_id), :class => 'linkGrey2', :target => '_blank' %>
            + +
            您的身份:<%= User.current.admin_of_org?(org) ? "组织管理员" : "组织成员" %>
            +
            + +
            +
            + <% end %> +
            +
            +
            +
            \ No newline at end of file diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index f6bb3c8cb..4fd4d0cb9 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -287,7 +287,11 @@ //批量删除 function batch_delete(){ var data = $("#resources_list_form").serialize(); - if(data != "" && confirm('您删不掉这其中上传者不是您的资源,确认要删除这些资源吗?')) { + if($("input[type=checkbox][data-deleteble=N]:checked").length != 0){ + alert("您只能删除自己上传的资源,请重新选择后再删除。"); + return; + } + if(data != "" && confirm('确认要删除这些资源吗?')) { $.post( '<%= user_resource_delete_user_path(@user)%>', $("#resources_list_form").serialize(),//只会对选中的控件进行序列化提交 diff --git a/app/views/users/user_resource_create.js.erb b/app/views/users/user_resource_create.js.erb index 2d6c4f4d8..f69057273 100644 --- a/app/views/users/user_resource_create.js.erb +++ b/app/views/users/user_resource_create.js.erb @@ -2,6 +2,6 @@ closeModal(); $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); //这里不能将翻页的更新 -$("#res_all_count").html(parseInt($("#res_all_count").html())+1); +$("#res_all_count").html('<%= @atta_count%>'); $("#res_count").html(0); $("#checkboxAll").attr('checked',false); \ No newline at end of file diff --git a/app/views/users/user_resource_delete.js.erb b/app/views/users/user_resource_delete.js.erb index a956ed212..e16abf28d 100644 --- a/app/views/users/user_resource_delete.js.erb +++ b/app/views/users/user_resource_delete.js.erb @@ -1,2 +1,5 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); -$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); \ No newline at end of file +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); +$("#res_all_count").html('<%= @atta_count%>') +$("#res_count").html(0); +$("#checkboxAll").attr('checked',false); \ No newline at end of file diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index ee361cc2f..d65606678 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -288,6 +288,10 @@ zh: label_tags_project_name: "项目名称:" label_projects_new_name: "项目名称" label_tags_project_description: "项目描述" + + label_organization_name: "组织名称" + label_organization_description: "组织描述" + label_organization_new: "新建组织" label_tags_user_mail: "用户邮箱:" label_tags_user_name: "用户名:" diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 88a710633..1a18e5a14 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -183,6 +183,7 @@ zh: label_optional_description: 可选的描述 label_file_count: "个文件已上传" + lebel_file_uploding: "个文件正在上传" # diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 12c1b9258..4563944c8 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2090,5 +2090,7 @@ zh: label_forums: 贴吧交流 label_language: 语言 label_license: 湘ICP备09019772 + label_org_name: 组织名称: + label_blank_user_lists_for_org: 用户不能为空 diff --git a/config/routes.rb b/config/routes.rb index 6cf872180..69134e666 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,6 +31,56 @@ RedmineApp::Application.routes.draw do # Enable Grack support # mount Trustie::Grack.new, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post] + resources :organizations do + member do + get 'setting'#, :action => 'settings', :as => 'settings' + get 'clear_org_avatar_temp' + put 'set_homepage' + get 'members' + get 'more_org_projects' + end + collection do + get 'check_uniq' + get 'autocomplete_search' + end + resources :org_document_comments do + member do + + end + collection do + + end + end + end + + resources :org_member do + member do + + end + collection do + get 'org_member_autocomplete' + end + end + + resources :org_document_comments do + member do + post 'add_reply' + end + collection do + + end + end + + resources :org_projects do + member do + + end + collection do + + end + end + #match '/organizations/:organization_id/org_document_comments/new', :to => 'org_document_comments#new', :as => 'new_org_documents', :via => [:get, :post] + #match '/organizations/:organization_id/org_document_comments/create', :to => 'org_document_comments#create', :as => 'create_org_documents', :via => [:post] resources :homework_users resources :no_uses delete 'no_uses', :to => 'no_uses#delete' @@ -38,9 +88,9 @@ RedmineApp::Application.routes.draw do resources :apply_project_masters delete 'apply_project_masters', :to => 'apply_project_masters#delete' - resources :organization, :except => [:show] do - - end + # resources :organization, :except => [:show] do + # + # end resources :school, :except => [:show] do collection do @@ -393,6 +443,8 @@ RedmineApp::Application.routes.draw do post 'import_resources_to_homework' get 'dealwith_apply_request' get 'store_selected_resource' + get 'user_organizations' + get 'search_user_orgs' # end end #resources :blogs @@ -439,7 +491,7 @@ RedmineApp::Application.routes.draw do ################# added by william match 'users/tag_save', :via => :post, :as => 'tag' match 'users/tag_saveEx', :via => [:get, :post] - + #get 'users/:id/user_organizations', :to => 'users#user_organizations', :as => 'user_organizations' post 'watchers/watch', :to => 'watchers#watch', :as => 'watch' delete 'watchers/watch', :to => 'watchers#unwatch' get 'watchers/new', :to => 'watchers#new' @@ -477,6 +529,7 @@ RedmineApp::Application.routes.draw do post 'unarchive' post 'close' post 'reopen' + get 'search_public_orgs_not_in_project' match 'copy', :via => [:get, :post] end diff --git a/db/migrate/20151102090519_create_org_members.rb b/db/migrate/20151103011119_create_org_members.rb similarity index 76% rename from db/migrate/20151102090519_create_org_members.rb rename to db/migrate/20151103011119_create_org_members.rb index 037d8a3c6..6ef208794 100644 --- a/db/migrate/20151102090519_create_org_members.rb +++ b/db/migrate/20151103011119_create_org_members.rb @@ -1,14 +1,11 @@ class CreateOrgMembers < ActiveRecord::Migration - def up + def change create_table :org_members do |t| t.integer :user_id t.integer :organization_id t.string :role + t.timestamps end end - - def down - drop_table :org_members - end end diff --git a/db/migrate/20151104020233_create_org_document_comments.rb b/db/migrate/20151104020233_create_org_document_comments.rb new file mode 100644 index 000000000..e300785aa --- /dev/null +++ b/db/migrate/20151104020233_create_org_document_comments.rb @@ -0,0 +1,13 @@ +class CreateOrgDocumentComments < ActiveRecord::Migration + def change + create_table :org_document_comments do |t| + t.string :title + t.text :content + t.integer :organization_id + t.integer :creator_id + t.integer :parent_id + t.integer :reply_id + t.timestamps + end + end +end diff --git a/db/migrate/20151104024335_add_locked_and_sticky_column_to_entity_org_document_comments.rb b/db/migrate/20151104024335_add_locked_and_sticky_column_to_entity_org_document_comments.rb new file mode 100644 index 000000000..313800985 --- /dev/null +++ b/db/migrate/20151104024335_add_locked_and_sticky_column_to_entity_org_document_comments.rb @@ -0,0 +1,6 @@ +class AddLockedAndStickyColumnToEntityOrgDocumentComments < ActiveRecord::Migration + def change + add_column :org_document_comments,:locked,:boolean,:default => false + add_column :org_document_comments,:sticky,:integer,:default => 0 + end +end diff --git a/db/migrate/20151104032831_create_org_activity.rb b/db/migrate/20151104032831_create_org_activity.rb new file mode 100644 index 000000000..8d78102b3 --- /dev/null +++ b/db/migrate/20151104032831_create_org_activity.rb @@ -0,0 +1,16 @@ +class CreateOrgActivity < ActiveRecord::Migration + def up + create_table :org_activities do |t| + t.integer :user_id + t.integer :act_id + t.string :act_type + t.integer :container_id + t.string :container_type + + t.timestamps + end + end + + def down + end +end diff --git a/db/migrate/20151104070007_create_org_projects.rb b/db/migrate/20151104070007_create_org_projects.rb new file mode 100644 index 000000000..db83f9632 --- /dev/null +++ b/db/migrate/20151104070007_create_org_projects.rb @@ -0,0 +1,11 @@ +class CreateOrgProjects < ActiveRecord::Migration + def up + create_table :org_projects do |t| + t.integer :organization_id + t.integer :project_id + end + end + + def down + end +end diff --git a/db/migrate/20151104070455_delete_column_role_from_org_members.rb b/db/migrate/20151104070455_delete_column_role_from_org_members.rb new file mode 100644 index 000000000..2e986dd9b --- /dev/null +++ b/db/migrate/20151104070455_delete_column_role_from_org_members.rb @@ -0,0 +1,8 @@ +class DeleteColumnRoleFromOrgMembers < ActiveRecord::Migration + def up + remove_column :org_members, :role + end + + def down + end +end diff --git a/db/migrate/20151104073902_rename_column_for_org_activity.rb b/db/migrate/20151104073902_rename_column_for_org_activity.rb new file mode 100644 index 000000000..e644c16cb --- /dev/null +++ b/db/migrate/20151104073902_rename_column_for_org_activity.rb @@ -0,0 +1,6 @@ +class RenameColumnForOrgActivity < ActiveRecord::Migration + def change + rename_column :org_activities,:act_id,:org_act_id + rename_column :org_activities,:act_type,:org_act_type + end +end diff --git a/db/migrate/20151104090032_create_org_member_roles.rb b/db/migrate/20151104090032_create_org_member_roles.rb new file mode 100644 index 000000000..d97d6eda7 --- /dev/null +++ b/db/migrate/20151104090032_create_org_member_roles.rb @@ -0,0 +1,11 @@ +class CreateOrgMemberRoles < ActiveRecord::Migration + def up + create_table :org_member_roles do |t| + t.integer :org_member_id + t.integer :role_id + end + end + + def down + end +end diff --git a/db/migrate/20151109073857_delete_journals_activity.rb b/db/migrate/20151109073857_delete_journals_activity.rb new file mode 100644 index 000000000..ae7074c9c --- /dev/null +++ b/db/migrate/20151109073857_delete_journals_activity.rb @@ -0,0 +1,40 @@ +class DeleteJournalsActivity < ActiveRecord::Migration + def up + UserActivity.all.each do |activity| + if activity.act_type == 'JournalsForMessage' + if activity.act + unless activity.act.m_parent_id.nil? + parent_act = UserActivity.where("act_id = #{activity.act.m_parent_id} and act_type='JournalsForMessage' and container_type='Principal'").first + if parent_act + parent_act.created_at = activity.act.parent.children.maximum("created_on") + parent_act.save + activity.destroy + end + end + else + activity.destroy + end + end + end + + PrincipalActivity.all.each do |activity| + if activity.principal_act_type == 'JournalsForMessage' + if activity.principal_act + unless activity.principal_act.m_parent_id.nil? + parent_act = PrincipalActivity.where("principal_act_id = #{activity.principal_act.m_parent_id} and principal_act_type='JournalsForMessage'").first + if parent_act + parent_act.created_at = activity.principal_act.parent.children.maximum("created_on") + parent_act.save + activity.destroy + end + end + else + activity.destroy + end + end + end + end + + def down + end +end diff --git a/db/migrate/20151109080256_alter_user_activities_update.rb b/db/migrate/20151109080256_alter_user_activities_update.rb new file mode 100644 index 000000000..6e77c411f --- /dev/null +++ b/db/migrate/20151109080256_alter_user_activities_update.rb @@ -0,0 +1,16 @@ +class AlterUserActivitiesUpdate < ActiveRecord::Migration + def up + count = UserActivity.all.count / 30 + 2 + transaction do + for i in 1 ... count do i + UserActivity.page(i).per(30).each do |activity| + activity.updated_at = activity.created_at + activity.save + end + end + end + end + + def down + end +end diff --git a/db/migrate/20151110011003_add_time_to_org_project.rb b/db/migrate/20151110011003_add_time_to_org_project.rb new file mode 100644 index 000000000..dfe370103 --- /dev/null +++ b/db/migrate/20151110011003_add_time_to_org_project.rb @@ -0,0 +1,5 @@ +class AddTimeToOrgProject < ActiveRecord::Migration + def change + add_column :org_projects, :created_at, :timestamp + end +end diff --git a/db/migrate/20151112072948_add_news_sticky.rb b/db/migrate/20151112072948_add_news_sticky.rb new file mode 100644 index 000000000..85001debe --- /dev/null +++ b/db/migrate/20151112072948_add_news_sticky.rb @@ -0,0 +1,9 @@ +class AddNewsSticky < ActiveRecord::Migration + def up + add_column :news, :sticky, :integer, :default => 0 + end + + def down + remove_column :news, :sticky + end +end diff --git a/db/migrate/20151116020842_copy_forge_activities_to_org_activities.rb b/db/migrate/20151116020842_copy_forge_activities_to_org_activities.rb new file mode 100644 index 000000000..95c4ed5bf --- /dev/null +++ b/db/migrate/20151116020842_copy_forge_activities_to_org_activities.rb @@ -0,0 +1,16 @@ +class CopyForgeActivitiesToOrgActivities < ActiveRecord::Migration + def up + ForgeActivity.all.each do |forge_act| + OrgActivity.create(:user_id => forge_act.user_id, + :org_act_id => forge_act.forge_act_id, + :org_act_type => forge_act.forge_act_type, + :container_id => forge_act.project_id, + :container_type => 'Project', + :created_at => forge_act.created_at, + :updated_at => forge_act.updated_at) + end + end + + def down + end +end diff --git a/db/migrate/20151116070906_add_created_at_to_org_members.rb b/db/migrate/20151116070906_add_created_at_to_org_members.rb new file mode 100644 index 000000000..33d3a2817 --- /dev/null +++ b/db/migrate/20151116070906_add_created_at_to_org_members.rb @@ -0,0 +1,5 @@ +class AddCreatedAtToOrgMembers < ActiveRecord::Migration + def change + add_column :org_members, :created_at, :timestamp + end +end diff --git a/db/migrate/20151116071721_set_time_for_org_member.rb b/db/migrate/20151116071721_set_time_for_org_member.rb new file mode 100644 index 000000000..f9e78dff5 --- /dev/null +++ b/db/migrate/20151116071721_set_time_for_org_member.rb @@ -0,0 +1,13 @@ +class SetTimeForOrgMember < ActiveRecord::Migration + def up + OrgMember.all.each do |member| + if(member.created_at.nil?) + member.created_at = Time.now - 5.days + member.save + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 6c0bf931b..8658c302b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,6 @@ # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended to check this file into your version control system. - ActiveRecord::Schema.define(:version => 20151117075939) do create_table "activities", :force => true do |t| @@ -529,23 +528,26 @@ ActiveRecord::Schema.define(:version => 20151117075939) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :force => true do |t| - t.string "IPLineCode" - t.string "Description" - t.string "Num" - t.string "Variable" - t.string "TraceInfo" - t.string "Method" + create_table "dts", :primary_key => "Num", :force => true do |t| + t.string "Defect", :limit => 50 + t.string "Category", :limit => 50 t.string "File" - t.string "IPLine" - t.string "Review" - t.string "Category" - t.string "Defect" - t.string "PreConditions" - t.string "StartLine" + t.string "Method" + t.string "Module", :limit => 20 + t.string "Variable", :limit => 50 + t.integer "StartLine" + t.integer "IPLine" + t.string "IPLineCode", :limit => 200 + t.string "Judge", :limit => 15 + t.integer "Review", :limit => 1 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false end create_table "enabled_modules", :force => true do |t| @@ -570,6 +572,60 @@ ActiveRecord::Schema.define(:version => 20151117075939) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + create_table "exercise_answers", :force => true do |t| + t.integer "user_id" + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_choices", :force => true do |t| + t.integer "exercise_question_id" + t.text "choice_text" + t.integer "choice_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_questions", :force => true do |t| + t.string "question_title" + t.integer "question_type" + t.integer "question_number" + t.integer "exercise_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_standard_answers", :force => true do |t| + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_users", :force => true do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "score" + t.datetime "start_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercises", :force => true do |t| + t.string "exercise_name" + t.text "exercise_description" + t.integer "course_id" + t.integer "exercise_status" + t.integer "user_id" + t.integer "time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "first_pages", :force => true do |t| t.string "web_title" t.string "title" @@ -815,16 +871,6 @@ ActiveRecord::Schema.define(:version => 20151117075939) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" diff --git a/lib/gitlab-cli/lib/gitlab/client/projects.rb b/lib/gitlab-cli/lib/gitlab/client/projects.rb index 04ea682aa..6247294f3 100644 --- a/lib/gitlab-cli/lib/gitlab/client/projects.rb +++ b/lib/gitlab-cli/lib/gitlab/client/projects.rb @@ -72,6 +72,23 @@ class Gitlab::Client post(url, :body => {:name => name}.merge(options)) end + # Updates a project team member to a specified access level. + # id (required) - The ID of a project + # name (optional) - project name + # path (optional) - repository name for project + # description (optional) - short project description + # default_branch (optional) + # issues_enabled (optional) + # merge_requests_enabled (optional) + # wiki_enabled (optional) + # snippets_enabled (optional) + # public (optional) - if true same as setting visibility_level = 20 + # visibility_level (optional) + + def edit_project(id, visibility_level) + put("/projects/#{id}", :body => {:visibility_level => visibility_level}) + end + # Deletes a project. # # @example diff --git a/lib/tasks/gitlab_to_git.rake b/lib/tasks/gitlab_to_git.rake deleted file mode 100644 index c7b97e00d..000000000 --- a/lib/tasks/gitlab_to_git.rake +++ /dev/null @@ -1,22 +0,0 @@ -#coding=utf-8 - -namespace :rep_fault do - desc "set ossean's type value" - task :rep_update => :environment do - rep = Repository.find(400) - rep.type = "Repository::Git" - rep.save - end - - desc "forge and ossean's members" - task :sync_members => :environment do - projects = [] - projects << Project.where("id =? ",2) - projects << Project.where("id =? ",299) - puts projects - s = Trustie::Gitlab::Sync.new - projects.each do |project| - s.only_members(project.first) - end - end -end \ No newline at end of file diff --git a/lib/tasks/homework_publishtime.rake b/lib/tasks/homework_publishtime.rake index 4d79086d4..8e231fafd 100644 --- a/lib/tasks/homework_publishtime.rake +++ b/lib/tasks/homework_publishtime.rake @@ -1,7 +1,7 @@ #coding=utf-8 namespace :homework_publishtime do - desc "start publish homework" + desc "start publish homework and end homework" task :publish => :environment do homework_commons = HomeworkCommon.where("publish_time = '#{Date.today}'") homework_commons.each do |homework| @@ -20,4 +20,16 @@ namespace :homework_publishtime do end end end + + task :end => :environment do + homework_commons = HomeworkCommon.where("end_time < '#{Date.today}'") + homework_commons.each do |homework| + if homework.anonymous_comment == 1 + homework_detail_manual = homework.homework_detail_manual + if homework_detail_manual.comment_status == 1 + homework_detail_manual.update_column('comment_status', 3) + end + end + end + end end \ No newline at end of file diff --git a/lib/tasks/sync_gitlab_user.rake b/lib/tasks/sync_gitlab_user.rake new file mode 100644 index 000000000..c932ca36c --- /dev/null +++ b/lib/tasks/sync_gitlab_user.rake @@ -0,0 +1,39 @@ +#coding=utf-8 + +namespace :gitlab do + desc "sync gitlab's users which lost in last sync" + task :add_gid => :environment do + users = User.find_by_sql("select * from users where gid is null") + s = Trustie::Gitlab::Sync.new + g = Gitlab.client + users.each do |user| + us = g.get("/users?search=#{user.mail}") + puts user.mail + if us.blank? + puts "55555555555555555" + s.sync_user(user) + else + # 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com + puts "66666666666666666666" + puts user.id + if Array === us + us.each do |u| + if u.email == user.mail + user.gid = u.id + user.save + end + end + end + end + end + end + + task :sync_members => :environment do + projects = Project.all + s = Trustie::Gitlab::Sync.new + projects.each do |project| + puts project.id + s.only_members(project.first) + end + end +end \ No newline at end of file diff --git a/lib/trustie/gitlab/helper.rb b/lib/trustie/gitlab/helper.rb index 57c333875..61c1fbd17 100644 --- a/lib/trustie/gitlab/helper.rb +++ b/lib/trustie/gitlab/helper.rb @@ -3,46 +3,46 @@ module Trustie module Gitlab module Helper - def change_password(uid, en_pwd, salt) - return unless uid - options = {:encrypted_password=>en_pwd, :password_salt=>salt} - self.g.put("/users/ext/#{uid}", :body => options) - # g.edit_user(uid, :encrypted_password=>en_pwd, :password_salt=>salt) - end + def change_password(uid, en_pwd, salt) + return unless uid + options = {:encrypted_password=>en_pwd, :password_salt=>salt} + self.g.put("/users/ext/#{uid}", :body => options) + # g.edit_user(uid, :encrypted_password=>en_pwd, :password_salt=>salt) + end - def find_user(user) - us = self.g.get("/users?search=#{user.mail}") - if Array === us - us.each do |u| - return u if u.email == user.mail - end + def find_user(user) + us = self.g.get("/users?search=#{user.mail}") + if Array === us + us.each do |u| + return u if u.email == user.mail end - return nil end + return nil + end - def add_user(user) - u = nil - begin - u = find_user(user) - unless u - u = self.g.create_user(user.mail, - user.hashed_password, - name: user.show_name, - username: user.login, - confirm: "true") - user.gid = u.id - end - change_password(u.id, user.hashed_password, user.salt) - rescue => e - puts e - end - return u + def add_user(user) + u = nil + begin + u = find_user(user) + unless u + u = self.g.create_user(user.mail, + user.hashed_password, + name: user.show_name, + username: user.login, + confirm: "true") + user.gid = u.id + end + change_password(u.id, user.hashed_password, user.salt) + rescue => e + puts e end + return u + end - def del_user(user) - return unless user.gid - self.g.delete_user(user.gid) - end + def del_user(user) + return unless user.gid + self.g.delete_user(user.gid) + end end end diff --git a/lib/trustie/gitlab/sync.rb b/lib/trustie/gitlab/sync.rb index a303b22fb..ac01a44ec 100644 --- a/lib/trustie/gitlab/sync.rb +++ b/lib/trustie/gitlab/sync.rb @@ -10,6 +10,9 @@ module Trustie DEVELOPER = 30 MASTER = 40 OWNER = 50 + # 项目公开和私有 + PUBLIC = 20 + PRIVATE = 0 end class Sync @@ -45,7 +48,8 @@ module Trustie issues_enabled: false, snippets_enabled: false, public: false, - user_id: gid + user_id: gid, + visibility_level: project.is_public? ? UserLevel::PUBLIC : UserLevel::PRIVATE ) project.gpid = gproject.id project.save! @@ -84,7 +88,8 @@ module Trustie merge_requests_enabled: true, public: false, user_id: gid, - import_url: import_url + import_url: import_url, + visibility_level: project.is_public? ? UserLevel::PUBLIC : UserLevel::PRIVATE ) puts "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" project.gpid = gproject.id diff --git a/public/images/org_default.jpg b/public/images/org_default.jpg new file mode 100644 index 000000000..ad1b4f007 Binary files /dev/null and b/public/images/org_default.jpg differ diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index 813c10dee..d7b49c8be 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -22,7 +22,7 @@ function reload(fileSpan) { } -function addFile_board(inputEl, file, eagerUpload, id) { +function addFile_board(inputEl, file, eagerUpload, id,btnId) { var attachments_frame = '#attachments_fields' + id; if ($(attachments_frame).children().length < 30) { @@ -80,7 +80,7 @@ function addFile_board(inputEl, file, eagerUpload, id) { ).appendTo(attachments_frame); if (eagerUpload) { - ajaxUpload(file, attachmentId, fileSpan, inputEl); + ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId); } return attachmentId; @@ -88,7 +88,7 @@ function addFile_board(inputEl, file, eagerUpload, id) { return null; } -function addFile(inputEl, file, eagerUpload) { +function addFile(inputEl, file, eagerUpload,btnId) { var attachments_frame = '#attachments_fields'; if ($(attachments_frame).children().length < 30) { @@ -145,7 +145,7 @@ function addFile(inputEl, file, eagerUpload) { ).appendTo('#attachments_fields'); if (eagerUpload) { - ajaxUpload(file, attachmentId, fileSpan, inputEl); + ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId); } return attachmentId; @@ -154,21 +154,21 @@ function addFile(inputEl, file, eagerUpload) { } addFile.nextAttachmentId = 1; -function ajaxUpload(file, attachmentId, fileSpan, inputEl) { - +function ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId) { + //上传开始调用函数 function onLoadstart(e) { fileSpan.removeClass('ajax-waiting'); fileSpan.addClass('ajax-loading'); $('input:submit', $(this).parents('form')).attr('disabled', 'disabled'); } - + //更改progressbar的值 function onProgress(e) { if (e.lengthComputable) { this.progressbar('value', e.loaded * 100 / e.total); } } - function actualUpload(file, attachmentId, fileSpan, inputEl) { + function actualUpload(file, attachmentId, fileSpan, inputEl,btnId) { ajaxUpload.uploading++; @@ -177,23 +177,43 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) { progressEventHandler: onProgress.bind(progressSpan) }) .done(function(result) { - progressSpan.progressbar('value', 100).remove(); + progressSpan.progressbar('value', 100).remove(); //上传完成就去掉该文件名后的进度条 fileSpan.find('input.description, a').css('display', 'inline-block'); fileSpan.find('input.is_public_checkbox, a').css('display', 'inline-block'); }) .fail(function(result) { - progressSpan.text(result.statusText); - if ($("#network_issue")) { + progressSpan.text("网络错误"); + if ($("#network_issue")) { //在上传处都要给出一个network_issue的div用来显示错误 $("#network_issue").show(); } }).always(function() { ajaxUpload.uploading--; fileSpan.removeClass('ajax-loading'); + var containerid = $(inputEl).data('containerid');//多个上传控件需要的容器id + if(containerid == undefined ){ + var count = 1;//同步上传参数为1,所以不需要去获取正在上传的文件就知道是1 + $('#upload_file_count').html("" + count + "" + $(inputEl).data('lebelFileUploding')); + } + else{ + var count = 1; + $('#upload_file_count' + containerid).html("" + count + "" + $(inputEl).data('lebelFileUploding')); + } var form = fileSpan.parents('form'); - if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) { + if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) { //所有文件上传完毕,更改状态 $('input:submit', form).removeAttr('disabled'); + $('#' + btnId).removeAttr("disabled"); + $('#' + btnId).val('确定') + $('#' + btnId).css('background-color', '#269ac9') + if(containerid == undefined ){ + var count = $('#attachments_fields>span').length; + $('#upload_file_count').html("" + count + "" + $(inputEl).data('fileCount')); + }else{ + var count = $('#attachments_fields' + containerid + '>span').length; + $('#upload_file_count'+containerid).html("" + count + "" + $(inputEl).data('fileCount')); + } + } - form.dequeue('upload'); + form.dequeue('upload');//上传完成一个就退出一个 }); //gcm files count and add delete_all link @@ -202,7 +222,10 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) { var containerid = $(inputEl).data('containerid'); if (containerid == undefined) { var count = $('#attachments_fields>span').length; - $('#upload_file_count').html("" + count + "" + $(inputEl).data('fileCount')); + $('#'+btnId).attr("disabled",true); + $('#'+btnId).val('提交中'); + $('#'+btnId).css('background-color','#c1c1c1') + $('#upload_file_count').html("1" + $(inputEl).data('lebelFileUploding'));//目前肯定是穿一个文件 if (count >= 1) { var add_attachs = $('.add_attachment'); var delete_all = $('.remove_all'); @@ -216,7 +239,10 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) { } } else { var count = $('#attachments_fields' + containerid + '>span').length; - $('#upload_file_count' + containerid).html("" + count + "" + $(inputEl).data('fileCount')); + $('#'+btnId).attr("disabled",true); + $('#'+btnId).val('提交中'); + $('#'+btnId).css('background-color','#c1c1c1') + $('#upload_file_count' + containerid).html("1" + $(inputEl).data('lebelFileUploding'));//目前肯定是穿一个文件 if (count >= 1) { var add_attachs = $('.add_attachment').filter(function(index) { return $(this).data('containerid') == containerid; @@ -239,17 +265,25 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) { //gcm } - - var progressSpan = $('
            ').insertAfter(fileSpan.find('input.filename')); - progressSpan.progressbar(); - fileSpan.addClass('ajax-waiting'); - - var maxSyncUpload = $(inputEl).data('max-concurrent-uploads'); - + //在插入文件名的后边插入div + var progressSpan = $('
            ').insertAfter(fileSpan.find('input.upload_filename')); + progressSpan.progressbar(); //将div处理成progress bar + fileSpan.addClass('ajax-waiting'); //添加文件正在上传的状态 + var containerid = $(inputEl).data('containerid');//多个上传控件需要的容器id + if(containerid == undefined ){ //选择了多少个文件也要显示,因为有时候文件过大,一时半会传不完,但还是显示文件没有选择 + var count = $('#attachments_fields>span').length; + $('#upload_file_count').html("" + count + "" + '个文件被选择'); + }else{ + var count = $('#attachments_fields' + containerid + '>span').length; + $('#upload_file_count'+containerid).html("" + count + "" + '个文件被选择'); + } + //最大的同步上传参数 + var maxSyncUpload = 1 //$(inputEl).data('max-concurrent-uploads'); + //如果没有指定同步上传参数 或者参数不对,或者需要上传的文件已经小于同步上传的个数,那么直接上传 if (maxSyncUpload == null || maxSyncUpload <= 0 || ajaxUpload.uploading < maxSyncUpload) - actualUpload(file, attachmentId, fileSpan, inputEl); - else - $(inputEl).parents('form').queue('upload', actualUpload.bind(this, file, attachmentId, fileSpan, inputEl)); + actualUpload(file, attachmentId, fileSpan, inputEl,btnId); + else //否则就进行队列上传 + $(inputEl).parents('form').queue('upload', actualUpload.bind(this, file, attachmentId, fileSpan, inputEl,btnId)); } ajaxUpload.uploading = 0; @@ -312,11 +346,15 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) { }); } -function addInputFiles(inputEl) { +function addInputFiles(inputEl,btnId) { // var clearedFileInput = $(inputEl).clone().val(''); if (inputEl.files) { +// if(inputEl.files.length >= 5){ +// alert('一次选择的文件不能超过5个') +// return; +// } // upload files using ajax - uploadAndAttachFiles(inputEl.files, inputEl); + uploadAndAttachFiles(inputEl.files, inputEl,btnId); // $(inputEl).remove(); } else { // browser not supporting the file API, upload on form submission @@ -338,12 +376,16 @@ function addInputFiles(inputEl) { //clearedFileInput.insertAfter('#attachments_fields'); } -function addInputFiles_board(inputEl, id) { +function addInputFiles_board(inputEl, id,btnId) { // var clearedFileInput = $(inputEl).clone().val(''); if (inputEl.files) { +// if(inputEl.files.length >= 5){ +// alert('一次选择的文件不能超过5个') +// return; +// } // upload files using ajax - uploadAndAttachFiles_board(inputEl.files, inputEl, id); + uploadAndAttachFiles_board(inputEl.files, inputEl, id,btnId); // $(inputEl).remove(); } else { // browser not supporting the file API, upload on form submission @@ -363,7 +405,7 @@ function addInputFiles_board(inputEl, id) { //clearedFileInput.insertAfter('#attachments_fields'); } -function uploadAndAttachFiles(files, inputEl) { +function uploadAndAttachFiles(files, inputEl,btnId) { var maxFileSize = $(inputEl).data('max-file-size'); var maxFileSizeExceeded = $(inputEl).data('max-file-size-message'); @@ -378,12 +420,12 @@ function uploadAndAttachFiles(files, inputEl) { window.alert(maxFileSizeExceeded); } else { $.each(files, function() { - addFile(inputEl, this, true); + addFile(inputEl, this, true,btnId); }); } } -function uploadAndAttachFiles_board(files, inputEl, id) { +function uploadAndAttachFiles_board(files, inputEl, id,btnId) { var maxFileSize = $(inputEl).data('max-file-size'); var maxFileSizeExceeded = $(inputEl).data('max-file-size-message'); @@ -398,7 +440,7 @@ function uploadAndAttachFiles_board(files, inputEl, id) { window.alert(maxFileSizeExceeded); } else { $.each(files, function() { - addFile_board(inputEl, this, true, id); + addFile_board(inputEl, this, true, id,btnId); }); } } @@ -471,10 +513,15 @@ $(function() { //课程课件 function addInputFilesCourseSource(inputEl) { checkBox = arguments[1] == 'public' ? false : true; + btnId = arguments[2]; // var clearedFileInput = $(inputEl).clone().val(''); if (inputEl.files) { +// if(inputEl.files.length >= 5){ +// alert('一次选择的文件不能超过5个') +// return; +// } // upload files using ajax - uploadAndAttachFilesCourseSource(inputEl.files, inputEl,checkBox); + uploadAndAttachFilesCourseSource(inputEl.files, inputEl,checkBox,btnId); // $(inputEl).remove(); } else { // browser not supporting the file API, upload on form submission @@ -496,7 +543,7 @@ function addInputFilesCourseSource(inputEl) { //clearedFileInput.insertAfter('#attachments_fields'); } -function uploadAndAttachFilesCourseSource(files, inputEl,checkBox) { +function uploadAndAttachFilesCourseSource(files, inputEl,checkBox,btnId) { var maxFileSize = $(inputEl).data('max-file-size'); var maxFileSizeExceeded = $(inputEl).data('max-file-size-message'); @@ -511,12 +558,12 @@ function uploadAndAttachFilesCourseSource(files, inputEl,checkBox) { window.alert(maxFileSizeExceeded); } else { $.each(files, function() { - addFileCourseSource(inputEl, this, true,checkBox); + addFileCourseSource(inputEl, this, true,checkBox,btnId); }); } } -function addFileCourseSource(inputEl, file, eagerUpload,checkBox) { +function addFileCourseSource(inputEl, file, eagerUpload,checkBox,btnId) { var attachments_frame = '#attachments_fields'; if ($(attachments_frame).children().length < 30) { @@ -595,7 +642,7 @@ function addFileCourseSource(inputEl, file, eagerUpload,checkBox) { } if (eagerUpload) { - ajaxUpload(file, attachmentId, fileSpan, inputEl); + ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId); } return attachmentId; diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 0c7f4156f..84e087c49 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -954,13 +954,19 @@ function regexStudentWorkDescription() function new_student_work() { if(regexStudentWorkName()&®exStudentWorkDescription()) - {$("#new_student_work").submit();} + { + $("#new_student_work").submit(); + $("#ajax-indicator").hide(); + } } function edit_student_work(id) { if(regexStudentWorkName()&®exStudentWorkDescription()) - {$("#edit_student_work_" + id).submit();} + { + $("#edit_student_work_" + id).submit(); + $("#ajax-indicator").hide(); + } } // diff --git a/public/javascripts/feedback.js b/public/javascripts/feedback.js index b30c8f91d..97209131e 100644 --- a/public/javascripts/feedback.js +++ b/public/javascripts/feedback.js @@ -1,5 +1,10 @@ (function($){ $.fn.fix = function(options){ + var u = navigator.userAgent; + if((u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 ||u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1)){ + $("#scrollsidebar").css("display","none"); + return; + } var defaults = { float : 'right', minStatue : true, @@ -73,6 +78,11 @@ function cookieget(n) $(function(){ + var u = navigator.userAgent; + if((u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 ||u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1)){ + $("#scrollsidebar").css("display","none"); + return; + } $(".closeSidebar").click(function(){ $(".show_btn").css("display","none"); $("#scrollsidebar").css("display","none"); @@ -109,4 +119,30 @@ $(function(){ $("#textCount").text(50-$("#subject").val().length) } }); -}); \ No newline at end of file +}); + +//var browser={ +// versions:function(){ +// var u = navigator.userAgent, app = navigator.appVersion; +// return {//移动终端浏览器版本信息 +// trident: u.indexOf('Trident') > -1, //IE内核 +// presto: u.indexOf('Presto') > -1, //opera内核 +// webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 +// gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核 +// mobile: !!u.match(/AppleWebKit.*Mobile.*/)||!!u.match(/AppleWebKit/), //是否为移动终端 +// ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 +// android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 +// iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 +// iPad: u.indexOf('iPad') > -1, //是否iPad +// webApp: u.indexOf('Safari') == -1 //是否web应该程序,没有头部与底部 +// }; +// }(), +// language:(navigator.browserLanguage || navigator.language).toLowerCase() +//} +//document.writeln("语言版本: "+browser.language); +//document.writeln(" 是否为移动终端: "+browser.versions.mobile); +//document.writeln(" ios终端: "+browser.versions.ios); +//document.writeln(" android终端: "+browser.versions.android); +//document.writeln(" 是否为iPhone: "+browser.versions.iPhone); +//document.writeln(" 是否iPad: "+browser.versions.iPad); +//document.writeln(navigator.userAgent); \ No newline at end of file diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index ca7b28ee7..a0647b592 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -250,13 +250,19 @@ function regex_evaluation_num(){ function new_student_work() { if(regexStudentWorkName()&®exStudentWorkDescription()) - {$("#new_student_work").submit();} + { + $("#new_student_work").submit(); + $("#ajax-indicator").hide(); + } } function edit_student_work(id) { if(regexStudentWorkName()&®exStudentWorkDescription()) - {$("#edit_student_work_" + id).submit();} + { + $("#edit_student_work_" + id).submit(); + $("#ajax-indicator").hide(); + } } //验证作品名称 diff --git a/public/javascripts/org.js b/public/javascripts/org.js new file mode 100644 index 000000000..e26995931 --- /dev/null +++ b/public/javascripts/org.js @@ -0,0 +1,45 @@ +//�����֯��Ա���ύ���� +function submit_add_org_members(){ + $("#org_member_add_form").submit(); +} + +function observeSearchfield(fieldId, targetId, url) { + $('#'+fieldId).each(function() { + var $this = $(this); + $this.addClass('autocomplete'); + $this.attr('data-value-was', $this.val()); + var check = function() { + var val = $this.val(); + if ($this.attr('data-value-was') != val){ + $this.attr('data-value-was', val); + $.ajax({ + url: url, + type: 'get', + data: {q: $this.val()}, + success: function(data){ if(targetId) $('#'+targetId).html(data); }, + beforeSend: function(){ $this.addClass('ajax-loading'); }, + complete: function(){ $this.removeClass('ajax-loading'); } + }); + } + }; + var reset = function() { + if (timer) { + clearInterval(timer); + timer = setInterval(check, 300); + } + }; + var timer = setInterval(check, 300); + $this.bind('keyup click mousemove', reset); + }); +} + +//显示更多的项目 +function show_more_org_project(url){ + $.get( + url, + { page: $("#org_project_page_num").val() }, + function (data) { + + } + ); +} \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 342833981..5469078a5 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -43,10 +43,13 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} .pingBackTit{ float:left; width:573px; margin-left:10px; } .hworkUl{ height:30px; border-bottom:1px solid #eaeaea; line-height:30px; vertical-align:middle; background-color: #f6f6f6;} .hworkH30 {height:30px !important; line-height:30px !important;} -.hworkListRow {height:65px; border-bottom:1px dashed #eaeaea; line-height:65px; vertical-align:middle;} +.hworkListRow {height:65px; border-bottom:1px dashed #eaeaea; line-height:65px; vertical-align:middle; position: relative;} .hworkListRow:hover {background-color:#f6f6f7;} .hworkUl li{ float:left;} .hworkListRow li{ float:left;} +.hworkTip{position:absolute; padding:3px 5px; border:1px solid #eaeaea; display:block; right:-108px; top:20px; background-color:#ffffff; line-height:20px; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);} +.hworkTip em {display:block; border-width:8px; position:absolute; bottom:4px; left:-16px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;} +.hworkTip span {display:block; border-width:8px; position:absolute; bottom:4px; left:-15px; border-style:dashed solid dashed dashed; border-color:transparent #FFF transparent transparent; font-size:0; line-height:0;} .hworkList340 {width:335px; text-align:left; height:50px; line-height:50px;padding-left:5px;} .hworkList80 {width:80px; text-align:center;} .hworkList50 {width:50px; text-align:center;} @@ -179,6 +182,7 @@ a.f_grey:hover {color:#000000;} /*.upbtn{ margin:42px 0 0 10px; border:none; color:#999; width:150px;}*/ .red_btn_cir{ background:#e74c3c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .green_btn_cir{ background:#28be6c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} +.red_homework_btn_cir{ background:#e74c3c; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .green_homework_btn_cir{ background:#28be6c; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .grey_btn_cir{ background:#b2b2b2; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} .grey_homework_btn_cir{ background:#b2b2b2; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} @@ -492,6 +496,13 @@ a:hover.tijiao{ background:#0f99a9;} .ni_con_work p{ color:#808181; } a.xls{ margin-left:5px; color:#136b3b;} .grey_c{ color:#808181;} + +.disable_btn { height:46px; display:block; width:90px; color:#fff; background:#d0d2d0; text-align:center; padding-top:4px; margin-right:15px;} +a.term_btn{ height:38px; display:block; width:90px; color:#fff; background:#269ac9; text-align:center; padding-top:12px; margin-right:15px;} +a:hover.term_btn{ background:#297fb8;} +p.c_black{ color:#000000;} +a.exit { height:24px; display:block; width:80px; color:#000000; background:#c3c3c3; text-align:center; padding-top:4px;} +.lh22{ line-height: 22px;} /* 学生列表*/ .st_list{ width:670px;} .st_search{ } @@ -545,7 +556,6 @@ a:hover.st_add{ color:#ff8e15;} a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; } a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;} -.r_txt_tit{width:510px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;} blockquote {background: #e8e8e8;padding: 10px;margin-bottom: 5px;word-break: break-all;word-wrap: break-word;} .respond-form{display: none;margin: auto;clear: both;} @@ -895,7 +905,8 @@ a.work_list_tit{width:580px; display:block; overflow:hidden; font-size:14px; f .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%;} -.upload_filename{ background: url(../images/pic_file.png) 0 -20px no-repeat;color: #7f7f7f;width: 370px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} +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; } @@ -976,6 +987,7 @@ a:hover.icon_remove{background:url(../images/course/icons.png) -20px -338px no-r .m_w505{max-width: 505px;} .m_w500{max-width: 500px;} .m_w530{max-width: 530px;} +.m_w600{max-width: 600px;} .ProResultTable{ color:#888888;} .T_C{ text-align:center;} .SearchIcon{background:url(../images/homepage_icon2.png) 676px -393px no-repeat; } @@ -1117,3 +1129,15 @@ a.postRouteLink:hover {text-decoration:underline;} .syllabusSettingIcon:hover {cursor: pointer} .pic_files{display:block; background:url(../images/public_icon.png) 0px -578px no-repeat; width:20px; height:15px;} + +/*确定按钮*/ +input.sendSourceText { + font-size: 14px; + color: #ffffff; + background-color: #269ac9; + cursor: pointer; + outline: none; + border: none; + width: 50px; + height: 25px; +} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index f21a4b1fd..6ccfc47f6 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -131,6 +131,7 @@ a.linkGrey6:hover {color:#ffffff !important;} .w350{ width:350px;} .w610{ width:610px;} .w600{ width:600px;} +.w713{width: 713px;} .h22{ height:22px;} .h26{ height:26px;} .h50{ height:50px;} @@ -260,7 +261,7 @@ a:hover.grey_n_btn{ background:#717171; color:#fff;} .green_btn{ background:#28be6c; color:#fff; font-weight:normal;padding:2px 10px; text-align:center;} a.green_btn{background:#28be6c;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;} a:hover.green_btn{ background:#14ad5a;} -.blue_btn{ background:#64bdd9; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;} +.blue_btn{ background:#64bdd9; color:#fff; font-weight:normal;padding:2px 8px; text-align:center;} a.blue_btn{background:#64bdd9;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;} a:hover.blue_btn{ background:#329cbd;} a.orange_btn{ background:#ff5722;color:#fff; font-weight:normal; padding:2px 10px; text-align:center; } @@ -298,6 +299,7 @@ a:hover.bgreen_n_btn{background:#08a384;} .green_btn_cir{ background:#28be6c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .green_homework_btn_cir{ background:#28be6c; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .grey_btn_cir{ background:#b2b2b2; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} +.red_homework_btn_cir{ background:#e74c3c; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .grey_homework_btn_cir{ background:#b2b2b2; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} .blue_btn_cir{ background:#3498db; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .orange_btn_cir{ background:#e67e22; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} @@ -1081,6 +1083,7 @@ a:hover.icon_remove{background:url(../images/course/icons.png) -20px -338px no-r .m_w460{max-width: 460px;} .m_w505{max-width: 505px;} .m_w530{max-width: 530px;} +.m_w600{max-width: 600px;} .ProResultTable{ color:#888888;} .T_C{ text-align:center;} .SearchIcon{background:url(../images/homepage_icon2.png) 676px -393px no-repeat; } @@ -1155,7 +1158,8 @@ img.ui-datepicker-trigger { } .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%;} -.upload_filename{ background: url(../images/pic_file.png) 0 -25px no-repeat;color: #7f7f7f;width: 370px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} +div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; } +.upload_filename{ background: url(../images/pic_file.png) 0 -25px no-repeat;color: #7f7f7f;width: 270px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} .message_title{border: 1px solid #9C9C9C;padding: 0.6em;margin-left: 1.4em;margin-right: 0.4em;border-radius: 4px;font-family: "Microsoft YaHei";background-size: 100% 100%;margin-bottom: 5px;background-color: #fff; max-width:400px;word-wrap:break-word; word-break:break-all;} .message_title_red{border: 1px solid #484848;padding: 0.6em;margin-left: 1.4em;margin-right: 0.4em;border-radius: 4px;font-family: "Microsoft YaHei";background-size: 100% 100%;margin-bottom: 5px;background-color: #fff;background-image: -moz-linear-gradient(top, #fff, #E0E0E0);} diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css new file mode 100644 index 000000000..c8116003e --- /dev/null +++ b/public/stylesheets/org.css @@ -0,0 +1,52 @@ +@charset "utf-8"; +/* CSS Document */ + +.orgName {width:130px; color:#484848;} +.organization_r_h02{ width:970px; height:40px; background:#eaeaea; margin-bottom:10px;} +.organization_h2{ background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;} + +.orgSettingOp {width:45px; height:21px; color:#269ac9; text-align:center; border-bottom:3px solid #e4e4e4; float:left; font-weight:bold; cursor:pointer;} +.orgBorder {width:628px; height:21px; border-bottom:3px solid #e4e4e4; float:left;} +.orgOpActive {border-bottom:3px solid #269ac9 !important; color:#444444;} +.logoBorder {border:1px solid #eaeaea; padding:2px;} +.logoBorder:hover {border:1px solid #269ac9;} +.logoEnter {border:1px solid #eaeaea; padding:2px 5px; margin-top:37px;} +.orgNameInput {width:600px; outline:none; border:1px solid #eaeaea; float:right; height:22px;} +.orgRow {font-size:14px; color:#484848;} +.orgDes {width:600px; height:150px; outline:none; border:1px solid #eaeaea; float:right; resize:none;} +.w607 {width:607px;} +.orgUrlInput {width:200px; outline:none; border:1px solid #eaeaea; height:22px;} +a.saveBtn {padding:3px 5px; background-color:#269ac9; color:#ffffff;} +a.saveBtn:hover {background-color:#297fb8;} +.orgMemberList {width:410px; float:left;} +.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px;} +.orgListUser {width:119px; float:left;} +.orgListRole {width:180px; float:left;} +.orgMemContainer {width:278px;} +.orgMemberAdd {float:right; width:240px;} +.orgAddSearch {border:1px solid #dddddd; outline:none; width:180px; height:22px; color:#9b9b9b;} +.undis {display:none;} +.dis {display:inline-block;} +.upbtn { margin: 40px 0px 0px 15px; + display: block; + padding: 2px 5px; + border: 1px solid #EAEAEA;} + +a.org_member_btn{ padding:1px 5px; background:#15bccf; color:#fff;} + +/*项目关联css*/ +.relateOrg {width:335px;} +.relatedList {width:335px;} +.searchOrg {height:24px; width:200px; color:#9b9b9b9; border:1px solid #15bccf;} +a.cancelBtn {padding:3px 5px; background-color:#D9D9D9; color:#656565;} +a.cancelBtn:hover {background-color:#717171; color:#ffffff;} +.relatedList ul li {border-bottom:1px solid #e4e4e4; width:320px; height:22px; vertical-align:middle; line-height:22px;} +.relatedListName {width:240px; text-align:left; max-width:240px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;} +.relatedListOption {width:80px; text-align:center;} +.relateOrgName {width:240px; max-width:240px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;color:#656565;} + +/*组织列表*/ +.mt28 {margin-top:28px;} +.orgWrap {width:880px; float:left;} +.orgTitle {width:880px; max-width:880px; margin-bottom:5px;word-break: break-all; word-wrap:break-word; } +.orgIntro {width:880px; max-width:880px; margin-bottom:6px; color:#484848;} \ No newline at end of file diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index e7a24b151..3dedf1396 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -371,10 +371,10 @@ span.add_attachment {font-size: 80%;line-height: 2.5em;} .reply_btn:hover{ background:#999; color:#fff; } .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%;} -.upload_filename{ background: url(../images/pic_file.png) 0 -22px no-repeat;color: #7f7f7f;width: 370px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} +.upload_filename{ background: url(../images/pic_file.png) 0 -22px no-repeat;color: #7f7f7f;width: 270px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} .attachments_fields input.description {margin-left:4px; width:100px; } .attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';} -.attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; } +div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; } a.remove-upload:hover {text-decoration:none !important;} .attachments_fields input.is_public_checkbox {width:20px;} diff --git a/spec/controllers/org_document_comment_controller_spec.rb b/spec/controllers/org_document_comment_controller_spec.rb new file mode 100644 index 000000000..016416264 --- /dev/null +++ b/spec/controllers/org_document_comment_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrgDocumentCommentController, :type => :controller do + +end diff --git a/spec/controllers/org_member_controller_spec.rb b/spec/controllers/org_member_controller_spec.rb new file mode 100644 index 000000000..a116db00f --- /dev/null +++ b/spec/controllers/org_member_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrgMemberController, :type => :controller do + +end diff --git a/spec/controllers/org_projects_controller_spec.rb b/spec/controllers/org_projects_controller_spec.rb new file mode 100644 index 000000000..8adc91d66 --- /dev/null +++ b/spec/controllers/org_projects_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrgProjectsController, :type => :controller do + +end diff --git a/spec/controllers/organizations_controller_spec.rb b/spec/controllers/organizations_controller_spec.rb new file mode 100644 index 000000000..cf00f4cf9 --- /dev/null +++ b/spec/controllers/organizations_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrganizationsController, :type => :controller do + +end diff --git a/spec/factories/org_activities.rb b/spec/factories/org_activities.rb new file mode 100644 index 000000000..552ea70f9 --- /dev/null +++ b/spec/factories/org_activities.rb @@ -0,0 +1,6 @@ +FactoryGirl.define do + factory :org_activity do + + end + +end diff --git a/spec/factories/org_document_comments.rb b/spec/factories/org_document_comments.rb new file mode 100644 index 000000000..206c471aa --- /dev/null +++ b/spec/factories/org_document_comments.rb @@ -0,0 +1,11 @@ +FactoryGirl.define do + factory :org_document_comment do + title "MyString" +content "MyText" +organization_id 1 +creator_id 1 +parent_id 1 +reply_id 1 + end + +end diff --git a/spec/factories/org_members.rb b/spec/factories/org_members.rb new file mode 100644 index 000000000..90997fd30 --- /dev/null +++ b/spec/factories/org_members.rb @@ -0,0 +1,8 @@ +FactoryGirl.define do + factory :org_member do + user_id 1 +organization_id 1 +role "MyString" + end + +end diff --git a/spec/models/org_activity_spec.rb b/spec/models/org_activity_spec.rb new file mode 100644 index 000000000..e452fe172 --- /dev/null +++ b/spec/models/org_activity_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrgActivity, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/org_document_comment_spec.rb b/spec/models/org_document_comment_spec.rb new file mode 100644 index 000000000..ba5dd15a4 --- /dev/null +++ b/spec/models/org_document_comment_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrgDocumentComment, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/org_member_spec.rb b/spec/models/org_member_spec.rb new file mode 100644 index 000000000..e7058e5b3 --- /dev/null +++ b/spec/models/org_member_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrgMember, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end