-
+
+
diff --git a/Gemfile.lock b/Gemfile.lock
index 4ba8ecf6c..6916219a9 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -125,6 +125,7 @@ GEM
mocha (1.1.0)
metaclass (~> 0.0.1)
multi_json (1.10.1)
+ mysql2 (0.3.11)
mysql2 (0.3.11-x86-mingw32)
net-ldap (0.3.1)
nokogiri (1.6.3)
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index b5975e452..2e9ac74c5 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -66,7 +66,7 @@ class AccountController < ApplicationController
if @user.save
@token.destroy
flash[:notice] = l(:notice_account_password_updated)
- redirect_to signin_url
+ redirect_to signin_path
return
end
end
@@ -92,7 +92,7 @@ class AccountController < ApplicationController
Mailer.lost_password(token).deliver
end
flash[:notice] = l(:notice_account_lost_email_sent)
- redirect_to signin_url
+ redirect_to signin_path
return
end
end
@@ -103,7 +103,7 @@ class AccountController < ApplicationController
def register
# @root_path="/home/pdl/redmine-2.3.2-0/apache2/"
#
- #@cache_identityy = params[:identity]||"" #身份
+ @cache_identityy = params[:identity]||"" #身份
@cache_no = params[:no]||"" #学号
@cache_technical_title = params[:technical_title]||"" #教师职称
@cache_province = params[:province]||"" #省份
@@ -144,7 +144,22 @@ class AccountController < ApplicationController
@user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation]
end
-
+ if(@cache_identityy == "")
+ if params[:identity] == "2"
+ @user.firstname = firstname_code
+ @user.lastname = lastname_code
+ end
+ flash.now[:error]= l(:label_identity)+l(:'activerecord.errors.messages.empty')
+ return
+ end
+ if(@cache_city == "")
+ if params[:identity] == "2"
+ @user.firstname = firstname_code
+ @user.lastname = lastname_code
+ end
+ flash.now[:error]= l(:label_location)+l(:'activerecord.errors.messages.empty')
+ return
+ end
case Setting.self_registration
when '1'
@@ -189,7 +204,7 @@ class AccountController < ApplicationController
token.destroy
flash[:notice] = l(:notice_account_activated)
end
- redirect_to signin_url
+ redirect_to signin_path
end
def valid_ajax
@@ -219,10 +234,6 @@ class AccountController < ApplicationController
render :json => req
end
- def email_valid
-
- end
-
private
def authenticate_user
@@ -234,7 +245,7 @@ class AccountController < ApplicationController
end
def password_authentication
- user, last_login_on = User.try_to_login(params[:username], params[:password])
+ user = User.try_to_login(params[:username], params[:password])
if user.nil?
invalid_credentials
@@ -244,7 +255,7 @@ class AccountController < ApplicationController
onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id })
else
# Valid user
- successful_authentication(user, last_login_on)
+ successful_authentication(user)
end
end
@@ -291,7 +302,7 @@ class AccountController < ApplicationController
end
end
- def successful_authentication(user, last_login_on)
+ def successful_authentication(user)
logger.info "Successful authentication for '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}"
# Valid user
self.logged_user = user
@@ -304,18 +315,13 @@ class AccountController < ApplicationController
code = /\d*/
#根据home_url生产正则表达式
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
- if code=~params[:back_url] && last_login_on != ''
+ if code=~params[:back_url]
redirect_to user_activities_path(user)
else
- if last_login_on == ''
- redirect_to my_account_url
- else
#by young
#redirect_back_or_default my_page_path
- #sredirect_back_or_default User.current
- redirect_to my_account_url
+ redirect_back_or_default User.current
#redirect_to User.current
- end
end
end
@@ -357,7 +363,7 @@ class AccountController < ApplicationController
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
Mailer.register(token).deliver
flash[:notice] = l(:notice_account_register_done)
- render action: 'email_valid', locals: {:mail => user.mail}
+ redirect_to signin_path
else
yield if block_given?
end
@@ -374,7 +380,7 @@ class AccountController < ApplicationController
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
self.logged_user = user
flash[:notice] = l(:notice_account_activated)
- redirect_to my_account_url
+ redirect_to my_account_path
else
yield if block_given?
end
@@ -396,6 +402,6 @@ class AccountController < ApplicationController
def account_pending
flash[:notice] = l(:notice_account_pending)
- redirect_to signin_url
+ redirect_to signin_path
end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d1465574f..cab5ada7c 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -124,7 +124,7 @@ class ApplicationController < ActionController::Base
else
# HTTP Basic, either username/password or API key/random
authenticate_with_http_basic do |username, password|
- user = User.try_to_login(username, password)[0] || User.find_by_api_key(username)
+ user = User.try_to_login(username, password) || User.find_by_api_key(username)
end
end
# Switch user if requested by an admin user
@@ -267,6 +267,8 @@ class ApplicationController < ActionController::Base
end
when "contest"
return true
+ when "Course"
+ allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false)
else
return true
end
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index a57b5f8a5..5c3503718 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -76,7 +76,7 @@ class AttachmentsController < ApplicationController
candown = User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
elsif (@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) && @attachment.container.course
course = @attachment.container.course
- candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
+ candown = User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
elsif @attachment.container.is_a?(Course)
course = @attachment.container
candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
@@ -366,7 +366,7 @@ class AttachmentsController < ApplicationController
end
rescue NoMethodError
@save_flag = false
- @save_message = [] << l(:error_attachment_empty)
+ @save_message = [] << l(:label_course_empty_select)
respond_to do |format|
format.js
end
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 6de800efc..251496e30 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -26,13 +26,15 @@ class FilesController < ApplicationController
helper :sort
include SortHelper
+ include FilesHelper
helper :project_score
def show_attachments obj
- @all_attachments = []
+ @attachments = []
obj.each do |container|
- @all_attachments += container.attachments
+ @attachments += container.attachments
end
+ @all_attachments = visable_attachemnts(@attachments)
@limit = 10
@feedback_count = @all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@@ -48,9 +50,11 @@ class FilesController < ApplicationController
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
if params[:insite]
@result = find_public_attache q
+ @result = visable_attachemnts @result
@searched_attach = paginateHelper @result,10
else
@result = find_course_attache q,@course
+ @result = visable_attachemnts @result
@searched_attach = paginateHelper @result,10
end
@@ -69,7 +73,7 @@ class FilesController < ApplicationController
# StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map
# 此时内容不多速度还可,但文件增长,每条判断多则进行3-4次表连接。
# 现在还木有思路 药丸
- resultSet = Attachment.where("attachments.container_type IS NOT NULL AND (is_public = 1 OR author_id = #{User.current.id}) AND filename LIKE :like ", like: "%#{keywords}%").
+ resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{keywords}%").
reorder("created_on DESC")
end
diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb
index 61760f462..0286fcad6 100644
--- a/app/controllers/homework_attach_controller.rb
+++ b/app/controllers/homework_attach_controller.rb
@@ -382,42 +382,22 @@ class HomeworkAttachController < ApplicationController
if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first)
# 打分统计
stars_reates = @homework. rates(:quality)
- #stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count
- #stars_status = stars_reates.select("stars, count(*) as scount").group("stars")
- #@stars_status_map = Hash.new(0.0)
- #stars_status.each do |star_status|
- # percent = (star_status.scount * 1.0/ stars_reates_count) * 100.to_f
- # percent_m = format("%.2f", percent)
- # @stars_status_map["star#{star_status.stars.to_i}".to_sym] =
- # percent_m.to_s + "%"
- #end
#是否已经进行过评价
temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{@homework.id} AND rater_id = #{User.current.id}").first
@m_score = temp.nil? ? 0:temp.stars
@has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0
- #是否开启互评功能
- #@is_evaluation = @homework.bid.is_evaluation == 1 || @homework.bid.is_evaluation == nil
- #@limit = 10
#@jours留言 is null条件用以兼容历史数据
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
@cur_page = params[:cur_page] || 1
@cur_type = params[:cur_type] || 5
@jour = paginateHelper @jours,5
- #@feedback_count = @jours.count
- #@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
- #@offset ||= @feedback_pages.offset
- #@jour = @jours[@offset, @limit]
- #@comprehensive_evaluation教师评论
- #@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1").order("created_on DESC")
+
teachers = searchTeacherAndAssistant @course
@comprehensive_evaluation = []
teachers.each do|teacher|
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
@comprehensive_evaluation << temp if temp
end
- #@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id in #{convert_array(teachers)}").order("created_on DESC")
- #@anonymous_comments 匿评
- #@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2").order("created_on DESC")
annymous_users = @homework.homework_evaluations.map(&:user)
unless annymous_users.nil? || annymous_users.count == 0
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC")
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index d73b8de3a..0b7cbbb5f 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -843,7 +843,10 @@ class ProjectsController < ApplicationController
end
def show_projects_score
- render :layout => false
+ respond_to do |format|
+ format.html { render :layout => "project_base"}
+ format.js
+ end
end
def issue_score_index
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index 2a5792e36..94717a4ce 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -163,7 +163,7 @@ class WelcomeController < ApplicationController
return 0
elsif url.include?(Setting.host_user.gsub('/',''))
- redirect_to(:controller => "users", :action => "index")
+ #redirect_to(:controller => "users", :action => "index")
end
diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb
index 4f3f401c9..cd7603c65 100644
--- a/app/helpers/files_helper.rb
+++ b/app/helpers/files_helper.rb
@@ -72,5 +72,20 @@ module FilesHelper
result
end
+ def visable_attachemnts attachments
+ result = []
+ attachments.each do |attachment|
+ if attachment.is_public? || attachment.author_id == User.current.id
+ result << attachment
+ end
+ end
+ result
+ end
+ def get_qute_number attachment
+ if attachment.copy_from.nil?
+ return 0
+ end
+ count = Attachment.find_by_sql("select count(*) from attachments where copy_from = #{attachment.copy_from}")
+ end
end
\ No newline at end of file
diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb
index 750a71f6a..6965eca07 100644
--- a/app/helpers/homework_attach_helper.rb
+++ b/app/helpers/homework_attach_helper.rb
@@ -60,7 +60,7 @@ module HomeworkAttachHelper
memberships = User.current.memberships.all(:conditions => cond)
projects = memberships.map(&:project)
not_have_project = []
- not_have_project << "< <%= f.text_field :login, :size => 25, :required => true %>
- <%= l(:label_max_number) %>
- <%= f.password_field :password, :size => 25, :required => true %>
- <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %>
- <%= f.password_field :password_confirmation, :size => 25, :required => true %>
- <%= f.text_field :mail,:size => 25, :required => true %>
-
-
-
- <%= "#{l(:label_mail_attention)} " %> <%= "#{l(:label_mail_attention1)} " %>
-
diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb
index 0bebfdf5f..21c8c11b9 100644
--- a/app/views/account/register.html.erb
+++ b/app/views/account/register.html.erb
@@ -1,127 +1,490 @@
-<% @nav_dispaly_home_path_label = 1
- @nav_dispaly_main_course_label = 1
- @nav_dispaly_main_project_label = 1
- @nav_dispaly_main_contest_label = 1 %>
-<% @nav_dispaly_forum_label = 1%>
-
-
-
-
-
-
-
-
-
-
+
<%= text_field_tag 'username', params[:username], :tabindex => '1' , :value => "#{l(:label_login_prompt)}",
:onfocus => "clearInfo('username','#{l(:label_login_prompt)}')",
@@ -39,48 +35,33 @@
-
<% if Setting.openid? %>
-
-
-
- <%= password_field_tag 'password', nil, :tabindex => '2' %>
-
+
+ <%= password_field_tag 'password', nil, :tabindex => '2' %>
-
<% end %>
-
-
-
- <%= text_field_tag "openid_url", nil, :tabindex => '3' %>
-
+
+ <%= text_field_tag "openid_url", nil, :tabindex => '3' %>
<% if Setting.autologin? %>
-
+
<% end %>
-
- <% if Setting.lost_password? %>
+ <% if Setting.lost_password? %>
<%= link_to l(:label_password_lost), lost_password_path %>
<% end %>
+
<%= l(:label_register) %> <%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>
-
-<%= labelled_form_for @user, :url => register_path do |f| %>
- <%= error_messages_for 'user' %>
-
-
-
-
- <%= submit_tag l(:button_submit) %>
-
<%= f.text_field :identity_url %>
-<% end %> -<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %> -<%= custom_field_tag_with_label :user, value %>
-<% end %> - -<% password_min_length = Setting.password_min_length %> - + + + + + ++
+ <%= l(:label_identity) %> * | ++ + | ++ | + + +<% else %> +<%= text_field_tag :no, nil, :placeholder => "请输入学号" %> +<% end %> +
<%= f.text_field :login, :size => 25, :required => true %> + <%= l(:label_max_number) %>
+ +<%= f.password_field :password, :size => 25, :required => true %> + <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %>
+ +<%= f.password_field :password_confirmation, :size => 25, :required => true %>
+ <% end %> + + + +<%= f.text_field :mail, :required => true %>
+ ++ <%= "#{l(:label_mail_attention)} " %>
+ +<%= f.select :language, lang_options_for_select, :required => true %>
+ + + + + + ++
+ <%= l(:label_location) %> * + | ++ + | ++ + | +
+
<%= submit_tag l(:button_submit) %> | +
<%= f.text_field :identity_url %>
+<% end %> + + +<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %> +<%= custom_field_tag_with_label :user, value %>
+<% end %> + + + + + \ No newline at end of file diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index aadc93fa4..107ee5bba 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -27,8 +27,7 @@ background: #15bccf; color: #fff; text-align: center; - padding-top: 3px; - padding-left: 3px; + padding: 5px !important; } .span_wping a:hover{ background-color:#03a1b3;} @@ -76,7 +75,7 @@ <% end %> <% end %> <% if (User.current.admin?||User.current.id==bid.author_id) %> - <% if bid.open_anonymous_evaluation == 1%> + <% if bid.open_anonymous_evaluation == 1 && bid.homeworks.count >= 2%> <% case bid.comment_status %> <% when 0 %> diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index cd682deb0..12393c558 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -40,7 +40,7 @@+
diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 036289b0a..23f7070b2 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -22,7 +22,7 @@ <%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%> (<%= @jours_count %>) -
+
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 49747ae11..04ce917c8 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -18,6 +18,20 @@ hideModal($("#popbox_upload")); } + function presscss(id) + { + if(id == "incourse") + { + $('#incourse').attr("class", "re_schbtn b_dblue"); + $('#insite').attr("class", "re_schbtn b_lblue"); + } + else + { + $('#incourse').attr("class", "re_schbtn b_lblue"); + $('#insite').attr("class", "re_schbtn b_dblue"); + } + } +
共有 <%= User.current.member_of_course?(course) ? all_attachments.count : 0 %> 个资源
- + <#% end %>--> + 资源列表的多样化排序将在下周上线... +文件大小:<%= number_to_human_size(file.filesize) %>
+文件大小:<%= number_to_human_size(file.filesize) %>
<%= link_to( l(:button_delete), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%> -<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用0
+<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %>
-
diff --git a/app/views/homework_attach/show.html.erb b/app/views/homework_attach/show.html.erb index 5f631c26a..d2f096bae 100644 --- a/app/views/homework_attach/show.html.erb +++ b/app/views/homework_attach/show.html.erb @@ -1,175 +1,2 @@ -<%= render :partial => 'layouts/base_homework_attach', :locals => {:homework_attach => @homework} %> - -<% is_student = is_cur_course_student @homework.bid.courses.first %> -<% is_teacher = is_course_teacher User.current,@homework.bid.courses.first %> -
<%= notice %>
-作业基础信息<%=@count %> | -|
- 发布人员:<%= link_to @homework.user, user_path(@homework.user)%> - | -- 所属任务:<%= link_to(@homework.bid.name, course_for_bid_path(@homework.bid))%> - | -
- 作业下载: - <% if @is_evaluation || is_teacher%> - <% options = {:author => true } %> - <%= render :partial => 'app_link', :locals => {:attachments => @homework.attachments, :options => options} %> - <% else %> - <%= l(:label_cant_download) %> - <% end %> - | -
- 参与人员:
- <% @homework.users.each do |homework_user| %>
- <%= link_to homework_user, user_path(homework_user)%>
- <% if @homework.users.count > 1 && homework_user != @homework.users.last %>
- - <% end %> - <% end %> - |
-
平均评分: - <%= render :partial => 'show_score', :locals => {:stars => @totle_score} %> - | -发布时间:<%=format_time @homework.created_at %> | -
作业描述: |
- |
-
- <% if @homework.description != nil && @homework.description != "" %>
- <%= @homework.description %>
- <% else %>
-
-
- 该作业无任何描述!
-
- <% end %>
- |
-
- - <%= l(:label_attachment) %> : - - | -|||||
- <% if @bid.attachments.any?%>
+ <% unless @bid.attachments.empty? %>
+
+
+
|
<%=link_to @memo.author.name, user_path(@memo.author) %>
++ <%=link_to @memo.author.name, user_path(@memo.author) %> +
+ <%= f.text_field :login, :required => true, :name => "login"%>
+ <%= l(:label_max_number) %>
+
+
+ <% if User.current.user_extensions.school.nil? %> + <%= l(:field_occupation) %> * + + + + <% else %> + <%= l(:field_occupation) %> * + + + + <% end %> +
+ ++ <%= f.text_field :mail, :required => true %> +
+ ++ <%= f.select :language, :Chinese => :zh, :English => :en %> +
+ + + + <% province = User.current.user_extensions.location %> + <% city = User.current.user_extensions.location_city %> + <% identity = User.current.user_extensions.identity %> + <% title = User.current.user_extensions.technical_title %> + + +<%= l(:label_location) %> + + +
+ + + + <% unless @user.user_extensions.identity == 2 %> ++ <%= l(:label_identity) %> + +
+ <% end %> + + + <% end %> + + + <% else %> + +<%= f.text_field :identity_url %>
+ <% end %> + + <% @user.custom_field_values.select(&:editable?).each do |value| %> +<%= custom_field_tag_with_label :user, value %>
+ <% end %> + <%= call_hook(:view_my_account, :user => @user, :form => f) %> ++ <%= render :partial => 'users/mail_notifications' %> +