diff --git a/0) b/0) deleted file mode 100644 index 70d77d63e..000000000 --- a/0) +++ /dev/null @@ -1 +0,0 @@ -终止批处理操作吗(Y/N)? 终止批处理操作吗(Y/N)? 终止批处理操作吗(Y/N)? 终止批处理操作吗(Y/N)? \ No newline at end of file diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 87ab7e683..e76fa31dc 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -500,7 +500,8 @@ class CoursesController < ApplicationController end end - def course + def + course @school_id = params[:school_id] per_page_option = 10 if @school_id == "0" or @school_id.nil? diff --git a/app/controllers/poll_answer_controller.rb b/app/controllers/poll_answer_controller.rb new file mode 100644 index 000000000..521f7ed3f --- /dev/null +++ b/app/controllers/poll_answer_controller.rb @@ -0,0 +1,2 @@ +class PollAnswerController < ApplicationController +end \ No newline at end of file diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb new file mode 100644 index 000000000..a21fdb549 --- /dev/null +++ b/app/controllers/poll_controller.rb @@ -0,0 +1,2 @@ +class PollController < ApplicationController +end \ No newline at end of file diff --git a/app/controllers/poll_question_controller.rb b/app/controllers/poll_question_controller.rb new file mode 100644 index 000000000..46a75c0ab --- /dev/null +++ b/app/controllers/poll_question_controller.rb @@ -0,0 +1,2 @@ +class PollQuestionController < ApplicationController +end \ No newline at end of file diff --git a/app/controllers/poll_user_controller.rb b/app/controllers/poll_user_controller.rb new file mode 100644 index 000000000..0373fe085 --- /dev/null +++ b/app/controllers/poll_user_controller.rb @@ -0,0 +1,2 @@ +class PollUserController < ApplicationController +end \ No newline at end of file diff --git a/app/controllers/poll_vote_controller.rb b/app/controllers/poll_vote_controller.rb new file mode 100644 index 000000000..e77bdc622 --- /dev/null +++ b/app/controllers/poll_vote_controller.rb @@ -0,0 +1,2 @@ +class PollVoteController < ApplicationController +end \ No newline at end of file diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index fa0beb311..0fcf35aff 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -129,7 +129,7 @@ class UsersController < ApplicationController end def show_new_score - render :layout => false + render :layout => 'users_base' end # end @@ -188,9 +188,9 @@ class UsersController < ApplicationController for user in @watcher events << Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 30) end - - - + + + @events_by_day = events.group_by(&:event_date) unless User.current.admin? diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 3612bf7a4..12637e2fb 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -75,16 +75,21 @@ class ZipdownController < ApplicationController def zip_homework_by_user(homeattach) homeworks_attach_path = [] + not_exist_file = [] # 闇瑕佸皢鎵鏈塰omework.attachments閬嶅巻鍔犲叆zip # 骞朵笖杩斿洖zip璺緞 homeattach.attachments.each do |attach| - homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1) + if File.exist?(attach.diskfile) + homeworks_attach_path << attach.diskfile + else + not_exist_file << attach.filename + end end - zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{((homeattach.user.user_extensions.nil? || homeattach.user.user_extensions.student_id.nil?) ? "" : homeattach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true) + zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{((homeattach.user.user_extensions.nil? || homeattach.user.user_extensions.student_id.nil?) ? "" : homeattach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file) end - def zipping(zip_name_refer, files_paths, output_path, is_attachment=false) + def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[]) # 杈撳叆寰呮墦鍖呯殑鏂囦欢鍒楄〃锛屽凡缁忔墦鍖呮枃浠跺畾浣嶅埌ouput_path ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE') input_filename = files_paths @@ -101,9 +106,11 @@ class ZipdownController < ApplicationController zipfile.add(rename_file, filename) end - #zipfile.get_output_stream('ReadMe') do |os| - # os.write 'Homeworks' - #end + unless not_exist_file.empty? + zipfile.get_output_stream('FILE_LOST.txt') do |os| + os.write l(:label_file_lost) + not_exist_file.join(',').to_s + end + end end zipfile_name rescue Errno => e @@ -119,4 +126,4 @@ class ZipdownController < ApplicationController attach = Attachment.find_by_disk_filename(name) attach.filename end -end +end \ No newline at end of file diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 096ce7ad8..a862753ef 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -20,7 +20,7 @@ module CoursesHelper # 杩斿洖鏁欏笀鏁伴噺锛屽嵆roles琛ㄤ腑瀹氫箟鐨凪anager def teacherCount project - searchTeacherAndAssistant(project).count + project.members.count - studentCount(project).to_i # or # searchTeacherAndAssistant(project).count end @@ -114,7 +114,7 @@ module CoursesHelper # 瀛︾敓浜烘暟璁$畻 # add by nwb def studentCount course - searchStudent(course).count.to_s#course.student.count + course.student.count.to_s#course.student.count end #璇剧▼鎴愬憳鏁拌绠 diff --git a/app/models/course.rb b/app/models/course.rb index 196e7168d..c11f66d49 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -38,7 +38,7 @@ class Course < ActiveRecord::Base validates_presence_of :password, :term,:name validates_format_of :class_period, :with =>/^[1-9]\d*$/ - validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/ + validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/ validates_length_of :description, :maximum => 10000 before_save :self_validate after_create :create_board_sync diff --git a/app/models/poll.rb b/app/models/poll.rb new file mode 100644 index 000000000..803ee6ac6 --- /dev/null +++ b/app/models/poll.rb @@ -0,0 +1,9 @@ +class Poll < ActiveRecord::Base + #attr_accessible :closed_at, :polls_group_id, :polls_name, :polls_status, :polls_type, :published_at, :user_id + include Redmine::SafeAttributes + + belongs_to :user + has_many :poll_questions, :dependent => :destroy + has_many :poll_users, :dependent => :destroy + has_many :users, :through => :poll_users #璇ユ枃浠惰鍝簺鐢ㄦ埛鎻愪氦绛旀杩 +end diff --git a/app/models/poll_answer.rb b/app/models/poll_answer.rb new file mode 100644 index 000000000..93c75da97 --- /dev/null +++ b/app/models/poll_answer.rb @@ -0,0 +1,7 @@ +class PollAnswer < ActiveRecord::Base + # attr_accessible :answer_position, :answer_text, :poll_questions_id + include Redmine::SafeAttributes + + belongs_to :poll_question + has_many :poll_votes, :dependent => :destroy +end diff --git a/app/models/poll_question.rb b/app/models/poll_question.rb new file mode 100644 index 000000000..66dcea67e --- /dev/null +++ b/app/models/poll_question.rb @@ -0,0 +1,8 @@ +class PollQuestion < ActiveRecord::Base + # attr_accessible :is_necessary, :polls_id, :question_title, :question_type + include Redmine::SafeAttributes + + belongs_to :poll + has_many :poll_answers, :dependent => :destroy + has_many :poll_votes, :dependent => :destroy +end diff --git a/app/models/poll_user.rb b/app/models/poll_user.rb new file mode 100644 index 000000000..e7a122da9 --- /dev/null +++ b/app/models/poll_user.rb @@ -0,0 +1,7 @@ +class PollUser < ActiveRecord::Base + # attr_accessible :poll_id, :user_id + include Redmine::SafeAttributes + + belongs_to :poll + belongs_to :user +end diff --git a/app/models/poll_vote.rb b/app/models/poll_vote.rb new file mode 100644 index 000000000..550563e38 --- /dev/null +++ b/app/models/poll_vote.rb @@ -0,0 +1,8 @@ +class PollVote < ActiveRecord::Base + # attr_accessible :poll_answers_id, :poll_questions_id, :user_id, :vote_text + include Redmine::SafeAttributes + + belongs_to :poll_answer + belongs_to :poll_question + belongs_to :user +end diff --git a/app/models/user.rb b/app/models/user.rb index e966742f1..735b80762 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -77,6 +77,13 @@ class User < Principal has_many :homework_attaches, :through => :homework_users has_many :homework_evaluations + #闂嵎鐩稿叧鍏冲叧绯 + has_many :poll_users, :dependent => :destroy + has_many :poll_votes, :dependent => :destroy + has_many :poll, :dependent => :destroy #鐢ㄦ埛鍒涘缓鐨勯棶鍗 + has_many :answers, :source => :poll, :through => :poll_users, :dependent => :destroy #鐢ㄦ埛宸茬粡瀹屾垚闂瓟鐨勯棶鍗 + # end + has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)}, :after_remove => Proc.new {|user, group| group.user_removed(user)} has_many :changesets, :dependent => :nullify diff --git a/app/views/contests/index.html.erb b/app/views/contests/index.html.erb index 75b892461..170f11037 100644 --- a/app/views/contests/index.html.erb +++ b/app/views/contests/index.html.erb @@ -10,7 +10,7 @@ <%= l(:label_user_location) %> : - + <% if User.current.logged? %> <% unless User.current.user_extensions.identity == 1 %> <%= link_to(l(:label_newtype_contest), new_contest_contests_path, :class => 'icon icon-add', :target => "_blank") %> diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index d199097be..2599760ad 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,21 +1,21 @@ diff --git a/app/views/courses/search.html.erb b/app/views/courses/search.html.erb index e2c701932..661feb3c9 100644 --- a/app/views/courses/search.html.erb +++ b/app/views/courses/search.html.erb @@ -13,7 +13,7 @@ <%= l(:label_user_location) %> : - + <% if User.current.logged?%> <% if User.current.user_extensions.identity == 0 %> <%= link_to(l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_course, nil, :global => true) %> diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb index 2ddd59266..661e15d5b 100644 --- a/app/views/homework_attach/new.html.erb +++ b/app/views/homework_attach/new.html.erb @@ -78,8 +78,8 @@   浣滃搧鎻忚堪    锛  - <%= f.text_area "description", :class => "w620", :maxlength => 3000, :placeholder => "鏈澶3000涓眽瀛", :onkeyup => "regexDescription();"%> - + <%= f.text_area "description", :class => "w620", :style=>"width:432px;", :maxlength => 3000, :placeholder => "鏈澶3000涓眽瀛", :onkeyup => "regexDescription();"%> +

diff --git a/app/views/layouts/base_contest.html.erb b/app/views/layouts/base_contest.html.erb index 6e980957b..d28456329 100644 --- a/app/views/layouts/base_contest.html.erb +++ b/app/views/layouts/base_contest.html.erb @@ -41,11 +41,14 @@

diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index fc3484b0a..a79914f61 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -2,6 +2,8 @@ @nav_dispaly_forum_label = 1 @nav_dispaly_course_label = nil @nav_dispaly_store_all_label = 1 %> +<% teacher_num = teacherCount(@course) %> +<% student_num = studentCount(@course) %> @@ -46,9 +48,13 @@ @@ -120,19 +126,19 @@ <% if User.current.member_of_course?(@course) %> - <%= link_to "#{teacherCount(@course)}", course_member_path(@course, :role => 1), :course => '1' %> + <%= link_to "#{teacher_num}", course_member_path(@course, :role => 1), :course => '1' %> <% else %> - <%= teacherCount(@course)%> + <%= teacher_num %> <% end%> <% if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) %> - <%= link_to "#{studentCount(@course)}", course_member_path(@course, :role => 2), :course => '1' %> + <%= link_to "#{student_num}", course_member_path(@course, :role => 2), :course => '1' %> <% else %> - <%= studentCount(@course)%> + <%= student_num %> <% end %> @@ -141,10 +147,10 @@ - <%= l(:label_x_base_courses_teacher, :count => teacherCount(@course)) %> + <%= l(:label_x_base_courses_teacher, :count => teacher_num) %> - <%= l(:label_x_base_courses_student, :count => studentCount(@course)) %> + <%= l(:label_x_base_courses_student, :count => student_num) %> <%= l(:label_x_course_data, :count => files_count) %> diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index 61df29620..707a6e69c 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -61,14 +61,14 @@ if(regexName1()){$("#contst_search_form").submit();} } -