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 @@
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 @@
- <%= l(:label_user_joinin) %>锛 + | + <%= l(:label_user_joinin) %>锛 | <%= format_time(@user.created_on) %> | |
- <%= l(:label_user_login) %>锛 + | + <%= l(:label_user_login) %>锛 | <%= format_time(@user.last_login_on) %> @@ -239,8 +239,8 @@ <% unless @user.user_extensions.nil? %> <% if @user.user_extensions.identity == 0 || @user.user_extensions.identity == 1 %> | |
- <%= l(:field_occupation) %>锛 + | + <%= l(:field_occupation) %>锛 | <% unless @user.user_extensions.school.nil? %> @@ -250,8 +250,8 @@ | |
- <%= l(:field_occupation) %>锛 + | + <%= l(:field_occupation) %>锛 | <%= @user.user_extensions.occupation %> @@ -259,8 +259,8 @@ | |
- <%= l(:label_company_name) %>锛 + | + <%= l(:label_company_name) %>锛 | <%= @user.firstname %> @@ -268,8 +268,8 @@ | |
- <%= l(:label_location) %>锛 + | + <%= l(:label_location) %>锛 | <%= @user.user_extensions.location %> @@ -278,8 +278,8 @@ | |
- <%= l(:label_technical_title) %>锛 + | + <%= l(:label_technical_title) %>锛 | @@ -289,8 +289,8 @@ <% if @user.user_extensions.identity == 1 %> <% if(is_watching?(@user) ) %> | |
- <%= l(:label_bidding_user_studentcode)%>锛 + | + <%= l(:label_bidding_user_studentcode)%>锛 | <%= @user.user_extensions.student_id %> @@ -298,7 +298,7 @@ | |
+ | <%= l(:label_identity)%>锛 | @@ -309,7 +309,7 @@ <% end %> <% elsif @user.user_extensions.identity == 3 %> | |
+ | <%= l(:label_identity)%>锛 |
diff --git a/app/views/layouts/users_base.html.erb b/app/views/layouts/users_base.html.erb
index d98ef3f46..b34609471 100644
--- a/app/views/layouts/users_base.html.erb
+++ b/app/views/layouts/users_base.html.erb
@@ -1,7 +1,7 @@
<% @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_user_label = 1
+ @nav_dispaly_store_all_label = 1
+ %>
<% @nav_dispaly_forum_label = 1%>
@@ -39,12 +39,12 @@
- <%= l(:label_loading) %>
-
+<%= call_hook :view_layouts_base_body_bottom %>
diff --git a/app/views/projects/search.html.erb b/app/views/projects/search.html.erb
index 8e810b087..7a91082ca 100644
--- a/app/views/projects/search.html.erb
+++ b/app/views/projects/search.html.erb
@@ -10,7 +10,7 @@
|
+ |
<%= l(:label_course_practice) %> | <%= l(:label_user_location) %> : | -+ | <% if User.current.logged?%> <% if User.current.user_extensions.identity == 0 %> <%= link_to(l(:label_course_new), {:controller => 'projects', :action => 'new', :course => 1, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> | @@ -35,7 +35,7 @@
<%= l(:label_project_deposit) %> | <%= l(:label_user_location) %> : | -+ | <% if User.current.logged? %> <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> <% end %> diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb index c08a3b553..21aefa511 100644 --- a/app/views/tags/_tag.html.erb +++ b/app/views/tags/_tag.html.erb @@ -77,10 +77,10 @@ <%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%> <%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%> - + <%= l(:button_project_tags_add)%> - <%= link_to_function l(:button_cancel), '$("#put-tag-form").slideUp();',:class=>'ButtonColor m3p10'%> + <%= link_to_function l(:button_cancel), '$("#put-tag-form").slideUp();',:class=>'ButtonColor m3p10' ,:style=>"padding:3px 6px"%> <% end %> <% end %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index e23a563a6..d6e7815f9 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2239,4 +2239,5 @@ zh: label_course_prompt: 璇剧▼锛 label_contain_resource: 宸插寘鍚祫婧愶細 label_quote_resource_failed: ",姝よ祫婧愬紩鐢ㄥけ璐! " + label_file_lost: 浠ヤ笅鏂囦欢鍦ㄦ湇鍔″櫒涓㈠け锛岃鑱旂郴鐩稿叧浜哄憳閲嶆柊涓婁紶锛 diff --git a/db/migrate/20150108034148_create_polls.rb b/db/migrate/20150108034148_create_polls.rb new file mode 100644 index 000000000..454f73b21 --- /dev/null +++ b/db/migrate/20150108034148_create_polls.rb @@ -0,0 +1,19 @@ +class CreatePolls < ActiveRecord::Migration + def up + create_table :polls do |t| + t.string :polls_name + t.string :polls_type + t.integer :polls_group_id + t.integer :polls_status + t.integer :user_id + t.datetime :published_at + t.datetime :closed_at + + t.timestamps + end + end + + def down + drop_table :polls + end +end diff --git a/db/migrate/20150108034253_create_poll_questions.rb b/db/migrate/20150108034253_create_poll_questions.rb new file mode 100644 index 000000000..2fa586dd5 --- /dev/null +++ b/db/migrate/20150108034253_create_poll_questions.rb @@ -0,0 +1,16 @@ +class CreatePollQuestions < ActiveRecord::Migration + def up + create_table :poll_questions do |t| + t.string :question_title + t.integer :question_type + t.integer :is_necessary + t.integer :poll_id + + t.timestamps + end + end + + def down + drop_table :poll_questions + end +end diff --git a/db/migrate/20150108034414_create_poll_answers.rb b/db/migrate/20150108034414_create_poll_answers.rb new file mode 100644 index 000000000..b6276fad0 --- /dev/null +++ b/db/migrate/20150108034414_create_poll_answers.rb @@ -0,0 +1,15 @@ +class CreatePollAnswers < ActiveRecord::Migration + def up + create_table :poll_answers do |t| + t.integer :poll_question_id + t.text :answer_text + t.integer :answer_position + + t.timestamps + end + end + + def down + drop_table :poll_answers + end +end diff --git a/db/migrate/20150108035301_create_poll_votes.rb b/db/migrate/20150108035301_create_poll_votes.rb new file mode 100644 index 000000000..0b7192ab8 --- /dev/null +++ b/db/migrate/20150108035301_create_poll_votes.rb @@ -0,0 +1,16 @@ +class CreatePollVotes < ActiveRecord::Migration + def up + create_table :poll_votes do |t| + t.integer :user_id + t.integer :poll_question_id + t.integer :poll_answer_id + t.text :vote_text + + t.timestamps + end + end + + def down + drop_table :poll_votes + end +end diff --git a/db/migrate/20150108035338_create_poll_users.rb b/db/migrate/20150108035338_create_poll_users.rb new file mode 100644 index 000000000..73d155890 --- /dev/null +++ b/db/migrate/20150108035338_create_poll_users.rb @@ -0,0 +1,14 @@ +class CreatePollUsers < ActiveRecord::Migration + def up + create_table :poll_users do |t| + t.integer :user_id + t.integer :poll_id + + t.timestamps + end + end + + def down + drop_table :poll_users + end +end diff --git a/db/schema.rb b/db/schema.rb index 04a2e54c8..00d308293 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20141231085350) do +ActiveRecord::Schema.define(:version => 20150108035338) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -790,6 +790,51 @@ ActiveRecord::Schema.define(:version => 20141231085350) do t.integer "project_id" end + create_table "poll_answers", :force => true do |t| + t.integer "poll_question_id" + t.text "answer_text" + t.integer "answer_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_questions", :force => true do |t| + t.string "question_title" + t.integer "question_type" + t.integer "is_necessary" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_users", :force => true do |t| + t.integer "user_id" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_votes", :force => true do |t| + t.integer "user_id" + t.integer "poll_question_id" + t.integer "poll_answer_id" + t.text "vote_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "polls", :force => true do |t| + t.string "polls_name" + t.string "polls_type" + t.integer "polls_group_id" + t.integer "polls_status" + t.integer "user_id" + t.datetime "published_at" + t.datetime "closed_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "praise_tread_caches", :force => true do |t| t.integer "object_id", :null => false t.string "object_type" diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 282b760b2..54e2a17aa 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2912,7 +2912,7 @@ input[class~='ButtonClolr'],.ButtonColor{ input[class~='m3p10'], .m3p10 { margin-top: 5px; - padding: 5px 10px !important; + padding: 5px 10px; height: 20px; display: inline-block; color: #ffffff; diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index b6d61c865..444d0d383 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -149,7 +149,7 @@ a:hover.tijiao{ background:#0f99a9 !important;} .ni_con p{ color:#808181;} .ni_con a:hover{ text-decoration:none;} -.ui-widget-header{display: none;} + diff --git a/test/unit/poll_answers_test.rb b/test/unit/poll_answers_test.rb new file mode 100644 index 000000000..ce8f558f4 --- /dev/null +++ b/test/unit/poll_answers_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PollAnswersTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/poll_questions_test.rb b/test/unit/poll_questions_test.rb new file mode 100644 index 000000000..bbe79ea40 --- /dev/null +++ b/test/unit/poll_questions_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PollQuestionsTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/poll_user_test.rb b/test/unit/poll_user_test.rb new file mode 100644 index 000000000..7dab4b63f --- /dev/null +++ b/test/unit/poll_user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PollUserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/poll_votes_test.rb b/test/unit/poll_votes_test.rb new file mode 100644 index 000000000..77ab9121e --- /dev/null +++ b/test/unit/poll_votes_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PollVotesTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/polls_test.rb b/test/unit/polls_test.rb new file mode 100644 index 000000000..5217817bb --- /dev/null +++ b/test/unit/polls_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PollsTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end |