diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f47ba446e..178a82d17 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -725,6 +725,12 @@ class ApplicationController < ActionController::Base #查找首页相关信息 def find_first_page @first_page = FirstPage.where("page_type = 'project'").first + if @first_page.nil? + @first_page = FirstPage.new + @first_page.page_type = 'project' + @first_page.description = "" + @first_page.save() + end @show_course = @first_page.show_course @show_contest = @first_page.show_contest end diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index 94131a2e0..de686493b 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -17,7 +17,7 @@ class TrackersController < ApplicationController layout 'admin' - + helper "project_score" before_filter :require_admin, :except => :index before_filter :require_admin_or_api_request, :only => :index accept_api_auth :index @@ -38,6 +38,7 @@ class TrackersController < ApplicationController @tracker ||= Tracker.new(params[:tracker]) @trackers = Tracker.sorted.all @projects = Project.all + @courses = Course.all end def create diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index eaa96e82a..98b24bc12 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -295,8 +295,8 @@ class UsersController < ApplicationController # 活跃度排序, 就是所谓的得分情况 @s_type = 1 @users = scope. - joins("LEFT JOIN user_scores ON users.id = user_scores.user_id"). - reorder('user_scores.active DESC') + joins("LEFT JOIN option_numbers ON users.id = option_numbers.user_id and option_numbers.score_type = 1"). + reorder('option_numbers.total_score DESC') when '2' # 粉丝数排序 @s_type = 2 @@ -308,8 +308,8 @@ class UsersController < ApplicationController # 默认活跃度排序 @s_type = 1 @users = scope. - joins("LEFT JOIN user_scores ON users.id = user_scores.user_id"). - reorder('user_scores.active DESC') + joins("LEFT JOIN option_numbers ON users.id = option_numbers.user_id and option_numbers.score_type = 1"). + reorder('option_numbers.total_score DESC') end # limit and offset diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 80b4e3576..4e7cf0ce9 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -20,11 +20,12 @@ class WelcomeController < ApplicationController include WelcomeHelper helper :project_score caches_action :robots + before_filter :find_first_page, :only => [:index] # before_filter :fake, :only => [:index, :course] before_filter :entry_select, :only => [:index] def index - @first_page = FirstPage.where("page_type = 'project'").first + #@first_page = FirstPage.where("page_type = 'project'").first #@show_course = @first_page.show_course if @first_page.nil? || @first_page.sort_type.nil? @projects = find_miracle_project(10, 3,"score desc") @@ -76,7 +77,7 @@ class WelcomeController < ApplicationController logo = get_avatar?(@course_page) id = params[:school_id] logo_link = "" - if id.nil? && User.current.user_extensions.school.nil? + if id.nil? && (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) if logo logo_link = url_to_avatar(@course_page) else @@ -148,8 +149,8 @@ class WelcomeController < ApplicationController private # 判断网站的入口,是课程 course 则跳过index去渲染 course 方法 def entry_select - @first_page = FirstPage.where("page_type = 'project'").first - url = request.original_url + #@first_page = FirstPage.where("page_type = 'project'").first + url = request.original_url.gsub('/','') if url.include?(Setting.host_course) if @first_page.show_course == 1 course diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index a5506be93..10aa39df2 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -54,7 +54,7 @@ class ZipdownController < ApplicationController end rescue => e - render file: 'public/file_not_found.html' + render file: 'public/file_not_found.html' , :layout => 'course_base' end private diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index ecfb097e9..6c11199fb 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -31,6 +31,7 @@ module MembersHelper } s + content_tag('div', content_tag('ul', links), :class => 'pagination_new') + end # add by nwb diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb index 8e9e6bbb9..17b68c3f6 100644 --- a/app/helpers/tags_helper.rb +++ b/app/helpers/tags_helper.rb @@ -12,6 +12,8 @@ module TagsHelper @obj = Issue.find_by_id(obj_id) when '4' @obj = Bid.find_by_id(obj_id) + when '5' + @obj = Forum.find_by_id(obj_id) when '6' @obj = Attachment.find_by_id(obj_id) when '7' @@ -44,6 +46,8 @@ module TagsHelper if user.id == obj_id @result = true end + when '5' + @result = is_forum_manager?(user.id,obj_id) when '7' if user.id == obj_id @result = true @@ -56,6 +60,17 @@ module TagsHelper end +# 判断用户是否是贴吧的管理员 +# add by chenmin +def is_forum_manager?(user_id,forum_id) + @result = false + @user_id = Forum.find(forum_id).creator_id; + if @user_id == user.id + @result = true + end + return @result +end + def tagname_val ("#tag_name_name").value end \ No newline at end of file diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 06bf45012..0677d324b 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -13,16 +13,17 @@ <% end %> -<%= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> +<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> +<%= button_tag "浏览", :type=>"button", :onclick=>"_file.click()" %> <%= file_field_tag 'attachments[dummy][file]', :id => '_file', :class => 'file_selector', diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index cdd1fdd2f..b9d91d5b5 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -30,7 +30,7 @@ :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :class => 'delete', - :remote => true, + #:remote => true, #:id => "attachments_" + attachment.id.to_s, :title => l(:button_delete) %> <% end %> diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 3002cb769..1327f13e9 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -53,7 +53,7 @@ <% end %> -
+
<% if @topics.any? %>
@@ -56,8 +142,8 @@ <%= l(:label_softapplication_developers) %> * : - <%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:350px;" %> - (<%= l(:label_workdescription_lengthlimit) %>) + <%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:320px;", :onblur => 'regexDevelopers();' %> + (<%= l(:label_workdescription_lengthlimit) %>)

@@ -65,7 +151,7 @@ <%= l(:label_work_deposit_project) %>: - <%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2',:style => "width:358px;" %> + <%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2',:style => "width:328px;" %> <%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %>
@@ -90,7 +176,8 @@
- <%= submit_tag l(:button_create) %> + + <%#= submit_tag l(:button_create) %> <%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();", :type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -30px'" %> diff --git a/app/views/contests/show_contest.html.erb b/app/views/contests/show_contest.html.erb index c379bc668..91279b7bb 100644 --- a/app/views/contests/show_contest.html.erb +++ b/app/views/contests/show_contest.html.erb @@ -6,7 +6,7 @@

<%= l(:label_bids_reward_method) %><%= @contest.budget%>

-
+
<%= @contest.description %> <% unless @course.nil?%>

<%= l(:label_class_period) %> *   - <%= text_field_tag :class_period, @course.class_period, :placeholder => "在此输入课时" %>  <%= l(:label_class_hour)%> + <%= text_field_tag :class_period, @course.class_period, :placeholder => "在此输入课时",:maxlength=>5 %>  <%= l(:label_class_hour)%>

<% else %>

<%= l(:label_class_period) %> *   - <%= text_field_tag :class_period, nil, :placeholder => "在此输入课时" %><%= l(:label_class_hour)%> + <%= text_field_tag :class_period, nil, :placeholder => "在此输入课时",:maxlength=>5 %><%= l(:label_class_hour)%>

<% end %> diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index 86b6742d6..c19096f99 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -1,3 +1,11 @@ + <%= labelled_fields_for :issue, @issue do |f| %> <%= call_hook(:view_issues_form_details_top, { :issue => @issue, :form => f }) %> diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 4c2a63844..616e2323d 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -38,7 +38,7 @@ <% end -%>
    -
    +
    <%= textilizable issue, :description %>
    diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 67b3d46c4..804b52d68 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -37,21 +37,21 @@ -
    diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index d735e1013..8df19a280 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -153,7 +153,7 @@

    <%=l(:label_current_hot_contest)%>

    - <%= link_to l(:label_more_information), {:controller => 'contests', :action => 'index', :host => Setting.contest_domain}, :target => "_blank" %> + <%= link_to l(:label_more_information), {:controller => 'contests', :action => 'index'}, :target => "_blank" %>
    <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %> @@ -294,7 +294,7 @@

    <%=l(:label_current_attendingcontest_work)%>

    - <%= link_to l(:label_more_information), {:controller => 'softapplications', :action => 'index', :host => Setting.contest_domain}, :target => "_blank" %> + <%= link_to l(:label_more_information), {:controller => 'softapplications', :action => 'index'}, :target => "_blank" %>
    <% if Softapplication.count > 0%>
    diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index c979807b9..c46df7777 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -42,7 +42,7 @@
    - <% if @school_id.nil? and User.current.user_extensions.school.nil? %> + <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> <% else %> <% if @school_id == "0" %> <% else %> @@ -58,7 +58,7 @@ <% unless @course_page.nil? %> <%= @course_page.title %> - <% if @school_id.nil? and User.current.user_extensions.school.nil? %> + <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> , <%= @course_page.description %> <% else %> <% if @school_id == "0" %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 31fb0432a..997b583c3 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -79,7 +79,7 @@ <%=project.description.truncate(100, omission: '...')%>
    - <%= content_tag "span", l(:label_project_score)+ ":" + project_scores(project).to_s, + <%= content_tag "span", l(:label_project_score)+ ":" + red_project_scores(project).to_i.to_s, :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;", :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", :class => "tooltip", diff --git a/db/schema.rb b/db/schema.rb index 525cfb745..e39644b3b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -177,58 +177,6 @@ ActiveRecord::Schema.define(:version => 20140814062455) do add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true - create_table "code_review_assignments", :force => true do |t| - t.integer "issue_id" - t.integer "change_id" - t.integer "attachment_id" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.string "action_type" - t.integer "changeset_id" - end - - create_table "code_review_project_settings", :force => true do |t| - t.integer "project_id" - t.integer "tracker_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "updated_by" - t.boolean "hide_code_review_tab", :default => false - t.integer "auto_relation", :default => 1 - t.integer "assignment_tracker_id" - t.text "auto_assign" - t.integer "lock_version", :default => 0, :null => false - t.boolean "tracker_in_review_dialog", :default => false - end - - create_table "code_review_user_settings", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "mail_notification", :default => 0, :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "code_reviews", :force => true do |t| - t.integer "project_id" - t.integer "change_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "line" - t.integer "updated_by_id" - t.integer "lock_version", :default => 0, :null => false - t.integer "status_changed_from" - t.integer "status_changed_to" - t.integer "issue_id" - t.string "action_type" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.integer "attachment_id" - t.integer "file_count", :default => 0, :null => false - t.boolean "diff_all" - end - create_table "comments", :force => true do |t| t.string "commented_type", :limit => 30, :default => "", :null => false t.integer "commented_id", :default => 0, :null => false @@ -441,10 +389,10 @@ ActiveRecord::Schema.define(:version => 20140814062455) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.integer "sort_type" - t.integer "show_course", :default => 1 - t.integer "show_contest", :default => 1 t.integer "image_width", :default => 107 t.integer "image_height", :default => 63 + t.integer "show_course", :default => 1 + t.integer "show_contest", :default => 1 end create_table "forums", :force => true do |t| @@ -872,18 +820,18 @@ ActiveRecord::Schema.define(:version => 20140814062455) do create_table "relative_memos", :force => true do |t| t.integer "osp_id" t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :limit => 16777215, :null => false + t.string "subject", :null => false + t.text "content", :null => false t.integer "author_id" - t.integer "replies_count", :default => 0 + t.integer "replies_count", :default => 0 t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 t.string "url" t.string "username" t.string "userhomeurl" @@ -907,19 +855,6 @@ ActiveRecord::Schema.define(:version => 20140814062455) do add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" - create_table "rich_rich_files", :force => true do |t| - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "rich_file_file_name" - t.string "rich_file_content_type" - t.integer "rich_file_file_size" - t.datetime "rich_file_updated_at" - t.string "owner_type" - t.integer "owner_id" - t.text "uri_cache" - t.string "simplified_type", :default => "file" - end - create_table "roles", :force => true do |t| t.string "name", :limit => 30, :default => "", :null => false t.integer "position", :default => 1 @@ -970,11 +905,10 @@ ActiveRecord::Schema.define(:version => 20140814062455) do t.string "url" t.string "title" t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "project_id" t.integer "user_id" - t.string "description" end create_table "softapplications", :force => true do |t| @@ -1080,8 +1014,8 @@ ActiveRecord::Schema.define(:version => 20140814062455) do t.integer "zip_code" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.string "technical_title" t.integer "identity" + t.string "technical_title" t.string "student_id" t.string "teacher_realname" t.string "student_realname" @@ -1139,6 +1073,9 @@ ActiveRecord::Schema.define(:version => 20140814062455) do t.integer "active" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "level" + t.integer "file" + t.integer "issue" end create_table "user_statuses", :force => true do |t| diff --git a/lib/redmine.rb b/lib/redmine.rb index 4fa909325..64b39145e 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -408,7 +408,7 @@ Redmine::MenuManager.map :course_menu do |menu| end Redmine::MenuManager.map :user_menu do |menu| menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain } - menu.push :user_course, {:controller => 'users', :action => 'user_courses', :host => Setting.course_domain} + menu.push :user_course, {:controller => 'users', :action => 'user_courses'} #menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain} # menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index 03a2349a2..2467af7a0 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -656,7 +656,7 @@ input[class='nyan-clean-gray']:active, .nyan-clean-gray:active { } .tools li { - background: url("/images/sidebar/tool_tag_alpha.png") 10px 30% no-repeat transparent; + /*background: url("/images/sidebar/tool_tag_alpha.png") 10px 30% no-repeat transparent;*/ color: #3e3e3e; font-weight: 400; line-height: 1.5em;