diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 0900f0446..008a08f2f 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -274,6 +274,13 @@ module Mobile get ":course_id/members" do cs = CoursesService.new count = cs.course_members params + # 我如果在学生当中,那么我将放在第一位 + count.each do |m| + if m.user.id == current_user.id + count.delete m + count.unshift m + end + end present :data, count, with: Mobile::Entities::Member present :status, 0 end @@ -290,6 +297,20 @@ module Mobile present :data,homeworkscore,with: Mobile::Entities::Homeworkscore present :status,0 end + + desc '发布课程通知' + params do + requires :token,type:String + requires :course_id,type:Integer,desc:'课程id' + requires :title,type:String,desc:'通知标题' + requires :desc,type:String,desc:'通知描述' + end + post ':course_id/create_course_notice' do + cs = CoursesService.new + news = cs.create_course_notice params,current_user + present :data,news,with:Mobile::Entities::News + present :status,0 + end end end end diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 62c9c3926..147cbfda5 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -85,6 +85,7 @@ module Mobile requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名' optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教' optional :course_id,type:Integer,desc: '课程id,搜索注册用户不为该课程教师的其他用户' + optional :user_id,type:Integer,desc:'用户id' end get 'search/search_user' do us = UsersService.new diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index caa199a72..7976e1aa4 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -315,7 +315,7 @@ class AccountController < ApplicationController #根据home_url生产正则表达式 eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != '' - redirect_to user_activities_path(user,host: Setting.user_domain) + redirect_to user_activities_path(user,host: Setting.host_user) else if last_login_on == '' redirect_to my_account_url @@ -333,7 +333,7 @@ class AccountController < ApplicationController token = Token.get_or_create_permanent_login_token(user) cookie_options = { :value => token.value, - :expires => 7.days.from_now, + :expires => 1.month.from_now, :path => (Redmine::Configuration['autologin_cookie_path'] || '/'), :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), :httponly => true diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 1d1212bf1..d616daadc 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -852,7 +852,7 @@ class CoursesController < ApplicationController #验证是否显示课程 def can_show_course @first_page = FirstPage.find_by_page_type('project') - if @first_page.show_course == 2 + if @first_page.try(:show_course) == 2 render_404 end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b6329c676..506adceec 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -118,11 +118,11 @@ module ApplicationHelper end #if user.active? || (User.current.admin? && user.logged?) - # link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes + # link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => user.css_classes #else # name #end - link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes + link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => user.css_classes else h(user.to_s) end @@ -131,7 +131,7 @@ module ApplicationHelper def link_to_isuue_user(user, options={}) if user.is_a?(User) name = h(user.name(options[:format])) - link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => "pro_info_p" + link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "pro_info_p" else h(user.to_s) end @@ -140,7 +140,7 @@ module ApplicationHelper def link_to_settings_user(user, options={}) if user.is_a?(User) name = h(user.name(options[:format])) - link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => "w90 c_orange fl" + link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "w90 c_orange fl" else h(user.to_s) end @@ -155,7 +155,7 @@ module ApplicationHelper else name = user.login end - link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => options[:class] + link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => options[:class] else h(user.to_s) end @@ -2086,21 +2086,21 @@ module ApplicationHelper hidden_non_project = Setting.find_by_name("hidden_non_project") visiable = !(hidden_non_project && hidden_non_project.value == "0") - main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain} - main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain} - main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.contest_domain} + main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.host_course} + main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.host_name} + main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.host_contest} # course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'} - course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain} + course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.host_course} # courses_link = link_to l(:label_course_practice), {:controller => 'courses', :action => 'index'} - #users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain} + #users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.host_user} # contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'} bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'} forum_link = link_to l(:label_forum_all), {:controller => "forums", :action => "index"} stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'} school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'} - project_new_link = link_to l(:label_project_new), {:controller => 'projects', :action => 'new', :host => Setting.project_domain} - # project_mine_link = link_to l(:label_my_project), {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain} + project_new_link = link_to l(:label_project_new), {:controller => 'projects', :action => 'new', :host => Setting.host_name} + # project_mine_link = link_to l(:label_my_project), {:controller => 'users', :action => 'user_projects', :host => Setting.host_name} #@nav_dispaly_project_label nav_list = Array.new diff --git a/app/helpers/gitlab_helper.rb b/app/helpers/gitlab_helper.rb index ceaaf6d21..836a973a9 100644 --- a/app/helpers/gitlab_helper.rb +++ b/app/helpers/gitlab_helper.rb @@ -11,7 +11,7 @@ module GitlabHelper PROJECT_PATH_CUT = 40 # gitlab版本库所在服务器 # 注意REPO_IP_ADDRESS必须以http://开头,暂时只支持HTTP协议,未支持SSH - #REPO_IP_ADDRESS = "http://" + Setting.repository_domain + #REPO_IP_ADDRESS = "http://" + Setting.host_repository REPO_IP_ADDRESS = "http://192.168.137.100" GITLAB_API = "/api/v3" diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 9ee11e392..5cbc3af5a 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -24,7 +24,7 @@ module RepositoriesHelper ROOT_PATH="/home/pdl/redmine-2.3.2-0/apache2/" end PROJECT_PATH_CUT = 40 - REPO_IP_ADDRESS = Setting.repository_domain + REPO_IP_ADDRESS = Setting.host_repository def format_revision(revision) if revision.respond_to? :format_identifier diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 36d542d58..26d8df16f 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -508,6 +508,12 @@ class CoursesService end end + def create_course_notice params ,current_user + n = News.new(:course_id =>params[:course_id], :author_id => current_user.id,:title =>params[:title],:description=> params[:desc]) + n.save + {:id => n.id,:title => n.title,:author_name => n.author.name,:author_id => n.author.id, :description => n.description,:created_on => format_time(n.created_on),:comments_count => n.comments_count} + end + private def searchmember_by_name members, name #searchPeopleByRoles(project, StudentRoles) diff --git a/app/views/attachments/_form_project.html.erb b/app/views/attachments/_form_project.html.erb index 998766b27..d1cdf8cc9 100644 --- a/app/views/attachments/_form_project.html.erb +++ b/app/views/attachments/_form_project.html.erb @@ -125,9 +125,9 @@ :file_count => l(:label_file_count), :delete_all_files => l(:text_are_you_sure_all) } %> - <% if container.nil? %> - <%= l(:label_no_file_uploaded)%> - <% end %> + <% if defined?(container) %> + <%= l(:label_no_file_uploaded)%> + <% end %> (<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) diff --git a/app/views/avatar/_avatar_form.html.erb b/app/views/avatar/_avatar_form.html.erb index 43aaf9132..632ea5d4d 100644 --- a/app/views/avatar/_avatar_form.html.erb +++ b/app/views/avatar/_avatar_form.html.erb @@ -43,7 +43,7 @@
-<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %> +<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %> <%= l(:button_upload_photo) %> diff --git a/app/views/avatar/_new_avatar_form.html.erb b/app/views/avatar/_new_avatar_form.html.erb index 793252d3a..64abfbc30 100644 --- a/app/views/avatar/_new_avatar_form.html.erb +++ b/app/views/avatar/_new_avatar_form.html.erb @@ -9,8 +9,8 @@ :size => "1", :multiple => true, :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_file_size => Setting.upload_avatar_max_size, + :max_file_size_message => l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i)), :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, :file_type => Redmine::Configuration['pic_types'].to_s, :type_support_message => l(:error_pic_type), diff --git a/app/views/contests/_new_softapplication.html.erb b/app/views/contests/_new_softapplication.html.erb index 5849132ae..3bba3db41 100644 --- a/app/views/contests/_new_softapplication.html.erb +++ b/app/views/contests/_new_softapplication.html.erb @@ -187,7 +187,7 @@ <%= link_to l(:label_create_new_projects), - new_project_path(:course => 0, :project_type => 0, :host => Setting.project_domain), + new_project_path(:course => 0, :project_type => 0, :host => Setting.host_name), :target => '_blank' %> diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 69ce4f5dc..4ca8d3d43 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -23,6 +23,7 @@ +
  • diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index e61995ecc..9af8538ed 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -1,5 +1,4 @@ - - +
    共有 <%=link_to @forum.memos.count %> 个贴子
    <% if memos.any? %> diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 30bd06b9a..fa34ecb3b 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -31,5 +31,5 @@
    <% end -%> \ No newline at end of file diff --git a/app/views/layouts/_base_development_group.html.erb b/app/views/layouts/_base_development_group.html.erb index 6d6e0eed1..4b0692f9e 100644 --- a/app/views/layouts/_base_development_group.html.erb +++ b/app/views/layouts/_base_development_group.html.erb @@ -55,7 +55,7 @@ <% end %> <% end %> - + \ No newline at end of file diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index 540293a48..d9bd5e376 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -169,15 +169,15 @@ function cookieget(n)
    <% get_memo %> - <% if @public_forum %> - <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> - <%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> - <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> - <%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %> - - <%= l(:label_submit)%> - <% end %> - <% end %> + <% if @public_forum %> + <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> + <%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> + <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> + <%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %> + + <%= l(:label_submit)%> + <% end %> + <% end %>
    <%= l(:label_technical_support) %>白   羽 diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 9eaf7f6ed..7a25819ab 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -27,13 +27,13 @@ <% end %> <%= render :partial => 'layouts/user_project_list', :locals => {:hasCourse => hasCourse} %>
  • - <%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%> + <%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.host_user}%>
  • <%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', - { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain }, + { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user }, {:class => 'my-message'} if User.current.logged?%>
  • diff --git a/app/views/layouts/_bootstrap_base_header.html.erb b/app/views/layouts/_bootstrap_base_header.html.erb index a968ace94..b93d27f49 100644 --- a/app/views/layouts/_bootstrap_base_header.html.erb +++ b/app/views/layouts/_bootstrap_base_header.html.erb @@ -67,17 +67,17 @@ end <%=User.current%> diff --git a/app/views/layouts/_new_header.html.erb b/app/views/layouts/_new_header.html.erb index 489612c9a..e4d2658b1 100644 --- a/app/views/layouts/_new_header.html.erb +++ b/app/views/layouts/_new_header.html.erb @@ -18,15 +18,15 @@ <% if User.current.logged? -%>
  • - <%= link_to "#{User.current.login}".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.user_domain}, :class => "uses_name"%> + <%= link_to "#{User.current.login}".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, :class => "uses_name"%>
  • diff --git a/app/views/layouts/_user_project_list.html.erb b/app/views/layouts/_user_project_list.html.erb index 3170ff43f..b05a065c8 100644 --- a/app/views/layouts/_user_project_list.html.erb +++ b/app/views/layouts/_user_project_list.html.erb @@ -1,10 +1,10 @@ <% if User.current.projects.count>0 %>
  • - <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %> + <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 6923b17c2..6820ccaf3 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -52,7 +52,7 @@ <%= l(:label_search)%> -
    +
    <% end %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 51f8b9a80..71975c5c3 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -157,7 +157,7 @@