diff --git a/app/controllers/discusses_controller.rb b/app/controllers/discusses_controller.rb index 37f3bb165..e434eaef9 100644 --- a/app/controllers/discusses_controller.rb +++ b/app/controllers/discusses_controller.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 class DiscussesController < ApplicationController include ApplicationHelper before_filter :find_dis_object, :except => [:destroy] @@ -6,10 +7,40 @@ class DiscussesController < ApplicationController def create if @model if params[:reply_id].blank? + notes = User.current.show_name.to_s + " 评论了你发布的实训:#{params[:content]}" @model.discusses << Discuss.new(:content => params[:content], :user_id => User.current.id, :praise_count => 0, :challenge_id => params[:challenge_id]) + JournalsForMessage.create( + :jour_id => @model.user_id, + :jour_type => "Principal", + :user_id => User.current.id, + :reply_id => 0, + :is_readed => 0, + :private => 1, + :notes => notes + ) else - @model.discusses << Discuss.new(:content => params[:content], :user_id => User.current.id, :parent_id => params[:reply_id], :root_id => params[:reply_id], :praise_count => 0, :challenge_id => params[:challenge_id]) + notes = User.current.show_name.to_s + " 评论了你的回复:#{params[:content]}" + user_id = Discuss.find(params[:reply_id]).try(:user_id) + @model.discusses << Discuss.new( + :content => params[:content], + :user_id => User.current.id, + :parent_id => params[:reply_id], + :root_id => params[:reply_id], + :praise_count => 0, + :challenge_id => params[:challenge_id] + ) + JournalsForMessage.create( + :jour_id => user_id, + :jour_type => "Principal", + :user_id => User.current.id, + :reply_id => 0, + :is_readed => 0, + :private => 1, + :notes => notes + ) end + + if params[:dis_type] == "Shixun" redirect_to shixun_discuss_shixun_path(@model, :challenge_id => params[:challenge_id]) end diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 117217c1a..0d9dd4446 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -434,7 +434,7 @@ end @menu_type = 6 @sub_type = 2 @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] - @department = ApplyAddDepartment.where(:status => 1) + @department = Department.where(:is_auth => 1) search=params[:search] if search.blank? @department = @department @@ -557,24 +557,28 @@ end def upload_logo @menu_type = 6 @sub_type = 1 + @next_type = 1 @school = School.find(params[:school]) - apply_schools = ApplyAddSchools.where("status = 0") - apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")" - if !params[:search].nil? - search = "%#{params[:search].to_s.strip.downcase}%" - @schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p", :p => search) - else - @schools = School.where("id not in #{apply_school_ids}") - end end # 修改单位名称为其他 def school_upload_logo school = School.where(:id => params[:applied_id]).first - UserExtensions.where(:school_id => params[:applied_id]).update_all(:school_id => params[:school_id]) - Department.where(:school_id => params[:applied_id]).update_all(:school_id => params[:school_id]) ApplyAddSchools.where(:school_id => params[:applied_id]).destroy_all - ApplyAddDepartment.where(:school_id => params[:applied_id]).destroy_all + before_apply_departments = Department.where(:school_id => params[:applied_id]) + after_apply_deparments = Department.where(:school_id => params[:school_id]) + before_apply_departments.each do |department| + after_dep = Department.where(:school_id => params[:school_id], :name => department.name).first + if after_dep + UserExtensions.where(:school_id => params[:applied_id], :department_id => department.id).update_all(:department_id => after_dep.id) + else + new_department = Department.create(:name => department.name,:school_id =>params[:school_id], :is_auth => 1) + UserExtensions.where(:school_id => params[:applied_id]).update_all(:department_id => new_department.id) + end + ApplyAddDepartment.where(:department_id => department.id).destroy_all + department.destroy + end + UserExtensions.where(:school_id => params[:applied_id]).update_all(:school_id => params[:school_id]) school.destroy redirect_to departments_part_managements_path end @@ -583,8 +587,7 @@ end def school_message_update school = School.where(:name =>params[:schoolname]).first school_id = school.id - School.where(:id => school_id).update_all(:province => params[:province],:city =>params[:city],:address => params[:address]) - ApplyAddSchools.where(:school_id => school_id).update_all(:province => params[:province],:city =>params[:city],:address => params[:address]) + School.where(:id => school_id).update_all(:province => params[:province],:city =>params[:city],:address => params[:address],:shool_code => params[:school_code]) redirect_to departments_part_managements_path end @@ -654,6 +657,9 @@ end applied_department = ApplyAddDepartment.find(params[:id]) applied_message = AppliedMessage.where(:applied_id => applied_department.id, :applied_type => "ApplyAddDepartment") applied_message.update_all(:status => 1) + if applied_department.department + applied_department.department.update_attributes(:is_auth => 1) + end applied_department.update_attribute(:status, 1) unless applied_department.nil? AppliedMessage.create(:user_id => applied_department.user_id, :status => 1, :viewed => 0, :applied_id => applied_department.id, :applied_type => "ApplyAddDepartment", :name => applied_department.name ) UserExtensions.where(:user_id => applied_department.user_id).update_all(:department_id => applied_department.department_id) @@ -804,12 +810,12 @@ end # 单位审批修改 def all_schools apply_schools = ApplyAddSchools.where("status = 0") - apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")" + apply_school_ids = apply_schools.empty? ? "(#{params[:school_id].to_i})" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")" if !params[:search].nil? search = "%#{params[:search].to_s.strip.downcase}%" - @schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p", :p => search) + @schools = School.where("id not in #{apply_school_ids} and id != #{params[:school_id].to_i} and #{School.table_name}.name like :p", :p => search) else - @schools = School.where("id not in #{apply_school_ids}") + @schools = School.where("id not in #{apply_school_ids} and id != #{params[:school_id].to_i}") end @edit_id = params[:school_id] @search = params[:search] @@ -835,6 +841,9 @@ end users.update_all(:school_id => school.id) ApplyAddDepartment.where(:school_id => aas.school_id).update_all(:school_id => school.id) + + + Department.where(:school_id => aas.school_id).update_all(:school_id => school.id) aas.school.destroy aas.update_attribute(:school_id, school.id) @@ -1251,6 +1260,7 @@ end @menu_type = 7 @sub_type = 3 @apply_action = School.where(:auto_users_trial => 1).order('updated_at desc') + @auto_school_ids = @apply_action.empty? ? "(-1)" : "(" + @apply_action.map(&:id).join(",") + ")" @apply_action_count = @apply_action.count limit = 20 @is_remote = true diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index d2e431a16..208cadae3 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -126,12 +126,22 @@ class SchoolController < ApplicationController chinese << char end end - if(condition == '') - @school = School.reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100) - @school_count = School.count + if params[:no_school_ids] + if(condition == '') + @school = School.where("id not in #{params[:no_school_ids]}").reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100) + @school_count = School.count + else + @school = School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100) + @school_count = School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count + end else - @school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100) - @school_count = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count + if(condition == '') + @school = School.reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100) + @school_count = School.count + else + @school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100) + @school_count = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count + end end result = [] @@ -171,6 +181,8 @@ class SchoolController < ApplicationController school.name = params[:name].strip school.pinyin = Pinyin.t(params[:name].strip, splitter: '') school.province = params[:province] + school.city = params[:city] + school.address = params[:address] #status 0未处理 1通过 2拒绝 applyschool = ApplyAddSchools.new diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 14deb6c65..c7a2dd605 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -803,15 +803,20 @@ class ShixunsController < ApplicationController end def shixun_discuss - @discusses = @shixun.discusses.where(:parent_id => nil).reorder("created_at desc") + @discusses = @shixun.discusses.reorder("created_at desc") @discusses_count = @discusses.count - @limit = 15 - @is_remote = true - @discusses_pages = Paginator.new @discusses_count, @limit, params['page'] || 1 - @offset ||= @discusses_pages.offset - @discusses = paginateHelper @discusses, @limit + #@limit = 15 + #@is_remote = true + #@discusses_pages = Paginator.new @discusses_count, @limit, params['page'] || 1 + # @offset ||= @discusses_pages.offset + #@discusses = paginateHelper @discusses, @limit #@game_challenge = params[:challenge_id].blank? ? Challenge.find(@discusses.challenge_id) : Challenge.find(params[:challenge_id]) - @game_challenge = Challenge.find(params[:challenge_id].to_i) + challenge_id = params[:challenge_id].nil? ? @shixun.challenges.first.try(:id) : params[:challenge_id].to_i + @game_challenge = Challenge.find(challenge_id) + respond_to do |format| + format.js + format.html + end end def destroy diff --git a/app/models/school.rb b/app/models/school.rb index d07303e09..ab0b697c9 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -1,6 +1,6 @@ class School < ActiveRecord::Base default_scope :order => 'created_at desc' - attr_accessible :name, :province, :pinyin, :city, :address, :logo_link,:auto_users_trial + attr_accessible :name, :province, :pinyin, :city, :address, :logo_link,:auto_users_trial,:shool_code has_many :courses has_many :departments, :dependent => :destroy diff --git a/app/views/contestant_works/_contestant_work_attachment.html.erb b/app/views/contestant_works/_contestant_work_attachment.html.erb index ae88d4565..01344d163 100644 --- a/app/views/contestant_works/_contestant_work_attachment.html.erb +++ b/app/views/contestant_works/_contestant_work_attachment.html.erb @@ -1,56 +1,56 @@ -
- - <% if defined?(container) && container && container.saved_attachments %> - <% container.attachments.each_with_index do |attachment, i| %> - - <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%> - <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> - <%= l(:field_is_public)%>: - <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> - <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> - <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> - -
- <% end %> - <% container.saved_attachments.each_with_index do |attachment, i| %> - - <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> - <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> - <%= l(:field_is_public)%>: - <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> - <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> - <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> - -
- <% end %> - <% end %> -
- <%= file_field_tag 'attachments[dummy][file]', - :id => '_file', - :class => ie8? ? '' : 'file_selector', - :multiple => true, - :onchange => 'addInputFiles(this);', - :style => ie8? ? '' : 'display:none', - :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_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, - :upload_path => uploads_path(:format => 'js',:project =>nil), - :description_placeholder => l(:label_optional_description), - :field_is_public => l(:field_is_public), - :are_you_sure => l(:text_are_you_sure), - :file_count => l(:label_file_count), - :lebel_file_uploding => l(:lebel_file_uploding), - :delete_all_files => l(:text_are_you_sure_all) - } %> -
-
- -
- - 上传附件 -
- -<% content_for :header_tags do %> - <%= javascript_include_tag 'attachments' %> +
+ + <% if defined?(container) && container && container.saved_attachments %> + <% container.attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> + <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
+ <% end %> + <% container.saved_attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> + <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
+ <% end %> + <% end %> +
+ <%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => ie8? ? '' : 'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this);', + :style => ie8? ? '' : 'display:none', + :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_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js',:project =>nil), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all) + } %> +
+
+ +
+ + 上传附件 +
+ +<% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> <% end %> \ No newline at end of file diff --git a/app/views/discusses/_dis_praise.html.erb b/app/views/discusses/_dis_praise.html.erb index 5cbb6c287..529ff0f81 100644 --- a/app/views/discusses/_dis_praise.html.erb +++ b/app/views/discusses/_dis_praise.html.erb @@ -2,14 +2,14 @@ - + 赞 <%= discuss.praise_tread_cache ? (discuss.praise_tread_cache.praise_num == 0 ? "" : discuss.praise_tread_cache.praise_num ) : "" %> <% else %> - + 赞 <%= discuss.praise_tread_cache ? (discuss.praise_tread_cache.praise_num == 0 ? "" : discuss.praise_tread_cache.praise_num ) : "" %> <% end %> \ No newline at end of file diff --git a/app/views/forums/_file_form.html.erb b/app/views/forums/_file_form.html.erb index 93c2e089f..94e7a1ce7 100644 --- a/app/views/forums/_file_form.html.erb +++ b/app/views/forums/_file_form.html.erb @@ -77,7 +77,7 @@ - + 上传附件 diff --git a/app/views/forums/forum_form_add.html b/app/views/forums/forum_form_add.html index 78240dfaa..1464fb5ec 100644 --- a/app/views/forums/forum_form_add.html +++ b/app/views/forums/forum_form_add.html @@ -49,7 +49,7 @@
  • - + 上传附件 diff --git a/app/views/games/_code_actions.html.erb b/app/views/games/_code_actions.html.erb index 374dbb179..67af98a91 100644 --- a/app/views/games/_code_actions.html.erb +++ b/app/views/games/_code_actions.html.erb @@ -42,6 +42,7 @@ <% end %> // 渲染用户的HTML的CODE。 function tpi_html_show(){ + $($(".blacktab_con")[0]).trigger("click"); var contents = editor_CodeMirror.getValue(); $("#data_param").val(contents); $("#html_form").attr("action", "/iframes/html_content"); @@ -197,8 +198,10 @@ data.language, data.compile_success ); - $("#blacktab_nav_1").trigger("click"); if(data.status == 2){ + if(data.language == "Html"){ + tpi_html_show(); + } clearInterval(cm); clearInterval(intId); var icon = $("#game_status_<%= @game_challenge.id %>"); // 实训列表的icon diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index 373521c14..f47e82a37 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -74,19 +74,25 @@
    + <% end %> + <% end %> + <% end %> - \ No newline at end of file diff --git a/app/views/homework_common/_reference_answers_attachments.html.erb b/app/views/homework_common/_reference_answers_attachments.html.erb index 8344f1b0a..5e6f84d0b 100644 --- a/app/views/homework_common/_reference_answers_attachments.html.erb +++ b/app/views/homework_common/_reference_answers_attachments.html.erb @@ -1,58 +1,58 @@ -
    - - <% if defined?(container) && container && container.saved_attachments %> - <% container.attachments.each_with_index do |attachment, i| %> - - <%= text_field_tag("ref_attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%> - <%= text_field_tag("ref_attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> - <%= l(:field_is_public)%>: - <%= check_box_tag("ref_attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> - <%= link_to(''.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> - <%= hidden_field_tag "ref_attachments[p#{i}][token]", "#{attachment.token}" %> - -
    - <% end %> - <% container.saved_attachments.each_with_index do |attachment, i| %> - - <%= text_field_tag("ref_attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> - <%= text_field_tag("ref_attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> - <%= l(:field_is_public)%>: - <%= check_box_tag("ref_attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> - <%= link_to(''.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> - <%= hidden_field_tag "ref_attachments[p#{i}][token]", "#{attachment.token}" %> - -
    - <% end %> - <% end %> -
    - <%= file_field_tag 'ref_attachments[dummy][file]', - :id => 'ref_file', - :class => ie8? ? '' : 'file_selector', - :multiple => true, - :onchange => 'addInputFiles(this);', - :style => ie8? ? '' : 'display:none', - :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_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, - :upload_path => uploads_path(:format => 'js',:project =>nil), - :description_placeholder => l(:label_optional_description), - :field_is_public => l(:field_is_public), - :are_you_sure => l(:text_are_you_sure), - :file_count => l(:label_file_count), - :lebel_file_uploding => l(:lebel_file_uploding), - :delete_all_files => l(:text_are_you_sure_all) - } %> -
    -
    - -
    - - - 上传附件 - -
    - -<% content_for :header_tags do %> - <%= javascript_include_tag 'attachments' %> +
    + + <% if defined?(container) && container && container.saved_attachments %> + <% container.attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("ref_attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%> + <%= text_field_tag("ref_attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("ref_attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> + <%= link_to(''.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> + <%= hidden_field_tag "ref_attachments[p#{i}][token]", "#{attachment.token}" %> + +
    + <% end %> + <% container.saved_attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("ref_attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + <%= text_field_tag("ref_attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("ref_attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> + <%= link_to(''.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> + <%= hidden_field_tag "ref_attachments[p#{i}][token]", "#{attachment.token}" %> + +
    + <% end %> + <% end %> +
    + <%= file_field_tag 'ref_attachments[dummy][file]', + :id => 'ref_file', + :class => ie8? ? '' : 'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this);', + :style => ie8? ? '' : 'display:none', + :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_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js',:project =>nil), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all) + } %> +
    +
    + +
    + + + 上传附件 + +
    + +<% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> <% end %> \ No newline at end of file diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index 57d2fc743..1f3deff18 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -34,13 +34,16 @@ <% when 5 %> 竞赛 <% when 6 %> - <%= @sub_type == 1 ? "单位列表" :"单位部门列表" %> + <% if @sub_type == 1%> + <%= link_to '单位列表',departments_part_managements_path() %> + <% if @next_type ==1 %> + > <%= @school.name %> + <% end %> + <% else %> + 单位部门列表 + <% end %> <% when 7 %> <%= @sub_type == 1 ? "用户列表" :(@sub_type == 2? "试用授权列表" : "自动授权列表") %> - - - - <% when 8 %> <%= @sub_type == 1 ? "作业回复":(@sub_type == 2? "实训反馈" : "课堂讨论区") %> <% when 9 %> diff --git a/app/views/layouts/base_shixun.html.erb b/app/views/layouts/base_shixun.html.erb index 345153daf..22815eb02 100644 --- a/app/views/layouts/base_shixun.html.erb +++ b/app/views/layouts/base_shixun.html.erb @@ -39,8 +39,11 @@
  • <% end %>
  • ">合作者
  • + <% if @shixun.discusses.present? %> +
  • ">评论
  • + <% end %> <% if @shixun.shixun_status == "已发布" %> -
  • ">学员统计
  • +
  • ">学员统计
  • <% end %> <% if User.current.manager_of_shixun?(@shixun) %>
  • ">配置
  • diff --git a/app/views/managements/_add_auto_users_trial.html.erb b/app/views/managements/_add_auto_users_trial.html.erb index c6aeb80e0..6e854b688 100644 --- a/app/views/managements/_add_auto_users_trial.html.erb +++ b/app/views/managements/_add_auto_users_trial.html.erb @@ -41,10 +41,11 @@ d_lastSearchCondition = $(e.target).val().trim(); page = 1; //有新的搜索,页面重置为1 $.ajax({ - url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value + '&school_id=' + $("input[name='occupation']").val() + '&page=' + d_page, + url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value + '&school_id=' + $("input[name='occupation']").val() + '&page=' + d_page+"&no_school_ids=<%= @auto_school_ids %>", type: 'post', success: function (data) { d_schoolsResult = data.schools; + console.log(d_schoolsResult) count = data.count; maxPage = Math.ceil(count / 100); //最大页码值 if (d_schoolsResult.length != undefined && d_schoolsResult.length != 0) { diff --git a/app/views/managements/_departments_list.html.erb b/app/views/managements/_departments_list.html.erb index 992731543..87d3226a4 100644 --- a/app/views/managements/_departments_list.html.erb +++ b/app/views/managements/_departments_list.html.erb @@ -11,21 +11,21 @@ - <% @department.each_with_index do |department,index| %> + <% @department.each_with_index do |department,index| %> <%= index + 1 %> <%= department.name %> <%= School.where(:id => department.school_id).first %> - <%= UserExtensions.where(:department_id => department.department_id, :school_id => department.school_id ).count %> - <%= ApplyUserAuthentication.where(:auth_type => 2, :status => 1, :user_id => UserExtensions.where(:department_id => department.department_id,:school_id => department.school_id).map(&:user_id)).count%> + <%= UserExtensions.where(:department_id => department.id, :school_id => department.school_id ).count %> + <%= ApplyUserAuthentication.where(:auth_type => 2, :status => 1, :user_id => UserExtensions.where(:department_id => department.id,:school_id => department.school_id).map(&:user_id)).count%> <%= format_time department.created_at %> - <% if UserExtensions.where(:department_id => department.department_id,:school_id => department.school_id ).count == 0 %> - 删除  + <% if UserExtensions.where(:department_id => department.id,:school_id => department.school_id ).count == 0 %> + 删除  <% else %> -- <% end %> - <%= link_to '更改', update_department_managements_path(:school_id=> department.school_id,:department_id => department.department_id), :remote => true, :class => "application-default-link" %> + <%= link_to '更改', update_department_managements_path(:school_id=> department.school_id,:department_id => department.id), :remote => true, :class => "application-default-link" %> <% end %> diff --git a/app/views/managements/_departments_part_list.html.erb b/app/views/managements/_departments_part_list.html.erb index 3d74c33d7..4d2c35df7 100644 --- a/app/views/managements/_departments_part_list.html.erb +++ b/app/views/managements/_departments_part_list.html.erb @@ -3,13 +3,14 @@ ID LOGO - 单位名称 - 地区 + 单位名称 + 地区 详细地址 用户数 部门数 - 创建于 color-light-green ml5"> - 修改时间 color-light-green ml5"> + 创建于 color-light-green ml5"> + 修改时间 color-light-green ml5"> + 学校标识码 @@ -31,7 +32,8 @@ <%= schools.departments.count %> <%= format_time schools.created_at %> <%= format_time schools.updated_at %> - + <%= schools.shool_code %> + 删除  <%#= link_to("修改", upload_logo_school_path(schools.id,:schools_name => @schools_name), :class => 'icon icon-copy') %> diff --git a/app/views/managements/upload_logo.html.erb b/app/views/managements/upload_logo.html.erb index 612ce17e6..1dec4cacf 100644 --- a/app/views/managements/upload_logo.html.erb +++ b/app/views/managements/upload_logo.html.erb @@ -70,10 +70,15 @@
  • - "> +
    请填写单位的详细地址
  • +
  • + + +
    +
  • 取消 确定 diff --git a/app/views/praise_tread/_edu_praise.html.erb b/app/views/praise_tread/_edu_praise.html.erb index 26a8dc3be..014e1c73f 100644 --- a/app/views/praise_tread/_edu_praise.html.erb +++ b/app/views/praise_tread/_edu_praise.html.erb @@ -6,9 +6,7 @@ 赞 <%# num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %> - <% unless get_praise_num(activity)==0 %> - <%= get_praise_num(activity) %> - <% end %> + <%= get_praise_num(activity)>0 ? get_praise_num(activity):"" %> <% else %> 赞 - <% unless get_praise_num(activity)==0 %> - <%= get_praise_num(activity) %> - <% end %> + <%= get_praise_num(activity)>0 ? get_praise_num(activity):"" %> <%# num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %> diff --git a/app/views/praise_tread/praise_minus.js.erb b/app/views/praise_tread/praise_minus.js.erb index 3b974fe5c..f9906e82d 100644 --- a/app/views/praise_tread/praise_minus.js.erb +++ b/app/views/praise_tread/praise_minus.js.erb @@ -8,7 +8,7 @@ <% elsif @type.to_s == 'Memo' %> $('#praise_count_<%= @obj.id %>').html('<%= j(render :partial => 'praise_tread/activity_praise', :locals => {:activity => @obj, :user_activity_id => @obj.id, :type => "Memo"})%>'); <% else @type.to_s == 'reply' %> - <% if ((@obj_type == 'JournalsForMessage' && @obj.jour_type == 'HomeworkCommon') || @obj_type == 'Message') && @obj_id == @user_activity_id %> + <% if ((@obj_type == 'JournalsForMessage' && @obj.jour_type == 'HomeworkCommon') || @obj_type == 'Message' || @obj_type == 'Discuss') && @obj_id == @user_activity_id %> $('.reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/edu_praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); <% else %> $('.reply_praise_count_<%=@obj_id %>').html('<%=j(render :partial=> "praise_tread/praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); diff --git a/app/views/praise_tread/praise_plus.js.erb b/app/views/praise_tread/praise_plus.js.erb index fe1c72c29..56af5cd45 100644 --- a/app/views/praise_tread/praise_plus.js.erb +++ b/app/views/praise_tread/praise_plus.js.erb @@ -12,6 +12,8 @@ $('.reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/edu_praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); <% elsif @obj_type == 'Memo' %> $('.reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/edu_praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); + <% elsif @obj_type == 'Discuss' %> + $('.reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/edu_praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); <% else %> $('.reply_praise_count_<%=@obj_id %>').html('<%=j(render :partial=> "praise_tread/praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); <% end %> diff --git a/app/views/shixuns/_shixun_reply.html.erb b/app/views/shixuns/_shixun_reply.html.erb new file mode 100644 index 000000000..40d9244ba --- /dev/null +++ b/app/views/shixuns/_shixun_reply.html.erb @@ -0,0 +1,8 @@ +
    + <% unless comment.parent.nil? %> +
    + <%= render :partial => 'shixuns/shixun_reply', :locals => {:comment => comment.parent, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %> +
    + <% end %> + <%= render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => comment, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %> +
    \ No newline at end of file diff --git a/app/views/shixuns/_shixun_reply_detail.html.erb b/app/views/shixuns/_shixun_reply_detail.html.erb new file mode 100644 index 000000000..57bd65674 --- /dev/null +++ b/app/views/shixuns/_shixun_reply_detail.html.erb @@ -0,0 +1,44 @@ +
    +
    + <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "32", :height => "32"), user_path(comment.creator_user), :target => "_blank", :alt => "用户头像" %> +
    + +
    +
    +
    + <%= comment.content_detail.html_safe %> +
    +
    + <%= link_to comment.creator_user.show_real_name, user_path(comment.creator_user), :class => "content-username hide fl" %> + <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %> +
    +
    + <%= link_to('回复'.html_safe, + {:controller => 'users', + :action => 'reply_to_comment', + :reply_id => comment.id, + :type => type, + :user_activity_id => user_activity_id, + :parent_id => parent_id}, + :remote => true, + :method => 'get',:class=>"color-grey", + :title => l(:button_reply)) %>| + + <%=render :partial=> "praise_tread/edu_praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + +
    +
    +
    + + +
    + +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/shixuns/shixun_discuss.html.erb b/app/views/shixuns/shixun_discuss.html.erb new file mode 100644 index 000000000..dad31e9bb --- /dev/null +++ b/app/views/shixuns/shixun_discuss.html.erb @@ -0,0 +1,18 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> +
    +
    +
    +

    评论

    +
    +
    + <%= render :partial => "games/shixun_comment_list" %> +
    +
    +
    + \ No newline at end of file diff --git a/app/views/shixuns/shixun_discuss.js.erb b/app/views/shixuns/shixun_discuss.js.erb index 81a34c89f..39af37924 100644 --- a/app/views/shixuns/shixun_discuss.js.erb +++ b/app/views/shixuns/shixun_discuss.js.erb @@ -2,7 +2,9 @@ $("#shixun_comment_block").replaceWith("<%= j(render :partial => "games/shixun_c $(".-tab-nav li").removeClass("tab_hover"); $('#tab_nav_4').addClass("tab_hover"); $(".tab-info").hide(); -$('#tab_con_4').show().html("<%= j(render :partial => "games/shixun_comment_list") %>"); +$('#tab_con_4').show(); +$("#game_comment_show").html("<%= j(render :partial => "games/shixun_comment_list") %>"); + <% if @discusses_count > 0 %> $("#discusses_count").html("<%= @discusses_count %>"); <% end %> diff --git a/app/views/student_work/_revise_attachment.html.erb b/app/views/student_work/_revise_attachment.html.erb index 362070b3b..6b07ecf07 100644 --- a/app/views/student_work/_revise_attachment.html.erb +++ b/app/views/student_work/_revise_attachment.html.erb @@ -1,38 +1,38 @@ -<% revise_attachment = work.attachments.where("attachtype = 7").first %> -<% if @homework.end_time < Time.now %> - <% if revise_attachment && work.user != User.current %> -
    - 作业修订附件 -
    -
    - 追加附件: - <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %> - <% unless revise_attachment.description == "" %> - 追加理由:

    <%=revise_attachment.description %>

    - <% end %> -
    -
    -
    注意:此处的附件是在作业截止日期过后提交的
    -
    - <% end %> - <% if work.user == User.current && !User.current.allowed_to?(:as_teacher, @homework.course) %> -
    - 作业修订附件 -
    - <% if revise_attachment %> -
    - 追加附件: - <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %> - <% unless revise_attachment.description == "" %> - 追加理由:

    <%=revise_attachment.description %>

    - <% end %> -
    -
    注意:此处的附件是在作业截止日期过后提交的
    -
    - <% end %> -
    -
    - 上传附件 -
    - <% end %> -<% end %> +<% revise_attachment = work.attachments.where("attachtype = 7").first %> +<% if @homework.end_time < Time.now %> + <% if revise_attachment && work.user != User.current %> +
    + 作业修订附件 +
    +
    + 追加附件: + <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %> + <% unless revise_attachment.description == "" %> + 追加理由:

    <%=revise_attachment.description %>

    + <% end %> +
    +
    +
    注意:此处的附件是在作业截止日期过后提交的
    +
    + <% end %> + <% if work.user == User.current && !User.current.allowed_to?(:as_teacher, @homework.course) %> +
    + 作业修订附件 +
    + <% if revise_attachment %> +
    + 追加附件: + <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %> + <% unless revise_attachment.description == "" %> + 追加理由:

    <%=revise_attachment.description %>

    + <% end %> +
    +
    注意:此处的附件是在作业截止日期过后提交的
    +
    + <% end %> +
    +
    + 上传附件 +
    + <% end %> +<% end %> diff --git a/app/views/users/_reply_to.html.erb b/app/views/users/_reply_to.html.erb index 0696d0755..2a735b062 100644 --- a/app/views/users/_reply_to.html.erb +++ b/app/views/users/_reply_to.html.erb @@ -109,7 +109,7 @@

    <% end%> - <% else @type == 'Memo' %> + <% else %> <%= form_for('discuss', :url => {:controller => 'discusses', :action => 'create', :dis_id => reply.dis_id, :dis_type => "Shixun", :challenge_id => reply.try(:challenge_id)}, :method => "post", :remote => true, :html => {:id => 'new_comment_form'}) do |f| %>
    @@ -117,7 +117,8 @@ 发送

    - <% end%> <% end %> + <% end%> + <% end %>
    @@ -125,4 +126,4 @@ <%= render :partial => "users/show_unlogged_reply" %> <% end %>
    - \ No newline at end of file + diff --git a/app/views/users/_reply_to_comment.html.erb b/app/views/users/_reply_to_comment.html.erb index d6bd8cb3e..ef28747d3 100644 --- a/app/views/users/_reply_to_comment.html.erb +++ b/app/views/users/_reply_to_comment.html.erb @@ -1,4 +1,4 @@ -
    +
    <% if User.current.logged? %>
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
    diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index fc530a086..6d7250fa5 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -53,7 +53,7 @@
    - + 上传附件 diff --git a/app/views/users/reply_to.js.erb b/app/views/users/reply_to.js.erb index 00bceece4..81f588d25 100644 --- a/app/views/users/reply_to.js.erb +++ b/app/views/users/reply_to.js.erb @@ -1,13 +1,13 @@ if($("#reply_message_<%= @reply.id%>").html() == "") { $(".reply_to_message").html(""); <% if params[:is_project] %> - $("#reply_message_<%= @reply.id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/reply_to', :locals => {:reply => @reply}) %>"); + $("#reply_message_<%= @reply.id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/reply_to', :locals => {:reply => @reply}) %>"); <% else %> - $("#reply_message_<%= @reply.id%>").html("<%= escape_javascript(render :partial => 'users/reply_to', :locals => {:reply => @reply}) %>"); + $("#reply_message_<%= @reply.id%>").html("<%= escape_javascript(render :partial => 'users/reply_to', :locals => {:reply => @reply}) %>"); <% end %> $("#reply_iconup_<%=@reply.id %>").show(); $(function(){ - sd_create_editor_from_data(<%= @reply.id%>,null,"100%", "<%=@reply.class.to_s%>"); + sd_create_editor_from_data(<%= @reply.id%>,null,"100%", "<%= @reply.class.to_s%>"); }); }else { $("#reply_message_<%= @reply.id%>").html(""); diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index c94bb062c..98fe4b9ce 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -273,7 +273,7 @@
    diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index 001cfec7a..c7d9c5121 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -367,7 +367,7 @@ zh: label_feedback_tips: "在此输入对平台的问题和建议,您也可以通过QQ、微信留言,谢谢!" label_technical_support: "QQ 在线支持:" label_feedback_success: "您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!" - label_feedback_value: "该帖来自用户反馈:)" + label_feedback_value: "来自用户反馈" label_email_feedback_tips: "请留下您的联系方式(注册邮箱除外),否则我们无法及时联系到您。请管理员尽快帮我解决邮箱激活问题" diff --git a/db/migrate/20171011084944_modify_content_for_memos.rb b/db/migrate/20171011084944_modify_content_for_memos.rb new file mode 100644 index 000000000..0ef42aa14 --- /dev/null +++ b/db/migrate/20171011084944_modify_content_for_memos.rb @@ -0,0 +1,10 @@ +#encoding: utf-8 +class ModifyContentForMemos < ActiveRecord::Migration + def up + memos = Memo.where("content like '该帖来自用户反馈%'") + memos.update_all(:content => "来自用户反馈") if memos.present? + end + + def down + end +end diff --git a/public/javascripts/edu/edu_tpi.js b/public/javascripts/edu/edu_tpi.js index 4afdd76a5..0609d2608 100644 --- a/public/javascripts/edu/edu_tpi.js +++ b/public/javascripts/edu/edu_tpi.js @@ -167,6 +167,7 @@ function choice_answer(st, nThis){ // 评测区域点击TAB切换样式 function check_tab(allClassName,addClassName,item){ + console.log(editor_CodeMirror); //点击tab添加样式 $("."+allClassName).removeClass(addClassName); $(item).addClass(addClassName); diff --git a/public/stylesheets/css/edu-common.css b/public/stylesheets/css/edu-common.css index d37444981..755dc112f 100644 --- a/public/stylesheets/css/edu-common.css +++ b/public/stylesheets/css/edu-common.css @@ -197,7 +197,7 @@ a.course-bth-blue{cursor: pointer;background-color:#199ed8 ;color: #ffffff !impo .break_word_firefox{white-space: pre-wrap !important;word-break: break-all;} .pre_word{white-space: pre-wrap;word-wrap: break-word;word-break: normal;} .pr {position:relative;} -.df {display:flex;} +.df {display:flex;display: -webkit-flex;display: -ms-flex;} .w100{width: 100px;} .w150{width: 150px;} .w200{width: 200px;}