diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 380baab0c..69a3b5e8b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -496,12 +496,14 @@ class ApplicationController < ActionController::Base def render_403(options={}) @project = nil - render_error({:message => :notice_not_authorized, :status => 403}.merge(options)) + #render_error({:message => :notice_not_authorized, :status => 403}.merge(options)) + render :template => 'common/403' return false end def render_404(options={}) - render_error({:message => :notice_file_not_found, :status => 404}.merge(options)) + #render_error({:message => :notice_file_not_found, :status => 404}.merge(options)) + render :template => 'common/404' return false end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 945b8c514..a9a02045f 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -544,7 +544,6 @@ class CoursesController < ApplicationController def finishcourse yesterday = Date.today.prev_day.to_time - @course_prefs.endup_time = yesterday @save_flag = @course_prefs.save get_courses diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index dee79bc31..6cc565863 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -62,11 +62,12 @@ class WelcomeController < ApplicationController def course @course_page = FirstPage.where("page_type = 'course'").first - if params[:school_id] - @school_id = params[:school_id] - elsif User.current.logged? && User.current.user_extensions.try(:school) - @school_id = User.current.user_extensions.school.try(:id) - end + #if params[:school_id] + # @school_id = params[:school_id] + #elsif User.current.logged? && User.current.user_extensions.try(:school) + # @school_id = User.current.user_extensions.school.try(:id) + #end + @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) @logoLink ||= logolink() end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index f2502e03e..1a7feae2c 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -236,7 +236,7 @@ class WordsController < ApplicationController #modify by nwb #添加对课程留言的支持 referer = request.headers["Referer"] - obj_id = referer.match(%r(/([0-9]{1,})(/|$)))[1] + obj_id = referer.match(%r(/([0-9]{1,})(/|\?|$)))[1] if referer.match(/project/) obj = Project.find_by_id(obj_id) elsif referer.match(/course/) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index a7d804321..df834f13c 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -31,7 +31,8 @@ class ZipdownController < ApplicationController end send_file zipfile, :filename => obj.name+".zip", :type => detect_content_type(zipfile) if zipfile - #rescue NameError, ActiveRecord::RecordNotFound => e + rescue Exception => e + render file: 'public/no_file_found.html' , :layout => 'course_base' #logger.error "[ZipDown] ===> #{e}" #@error = e end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 1139deb35..2399179b8 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -136,31 +136,33 @@ module WelcomeHelper #获取课程列表 # add by nwb - def find_miracle_course(sum=10, max_rate=7, school_id) + def find_miracle_course(sum=10, max_rate=7, school_id, time,term) if User.current.user_extensions.nil? && User.current.user_extensions.school.nil? and school_id.nil? Course.active.visible. joins(:memberships). + where("courses.time = #{time} and courses.term = #{term}"). group('members.course_id'). reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum else if school_id.nil? Course.active.visible. joins(:memberships). - where("#{Course.table_name}.school_id = ?", User.current.user_extensions.school.id). + where("#{Course.table_name}.school_id = ? and courses.time = ? and courses.term = ?", User.current.user_extensions.school.id, time, term). group('members.course_id'). - reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum + reorder("COUNT(members.course_id) DESC").take sum else if school_id == "0" Course.active.visible. joins(:memberships). + where("courses.time = #{time} and courses.term = #{term}"). group('members.course_id'). - reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum + reorder("COUNT(members.course_id) DESC").take sum else Course.active.visible. joins(:memberships). - where("#{Course.table_name}.school_id = ?", school_id). + where("#{Course.table_name}.school_id = ? and courses.time = ? and courses.term = ?", school_id, time, term). group('members.course_id'). - reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum + reorder("COUNT(members.course_id) DESC").take sum end end end @@ -229,16 +231,28 @@ module WelcomeHelper end # modif by nwb - def find_all_new_hot_course limit = 9 ,school_id = 0 + def find_all_new_hot_course limit = 9 ,school_id = nil, year_now, course_term #sort_project_by_hot_rails 1, 'course_ac_para DESC', limit - time_now = Time.new.strftime("%Y") - if school_id - courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <> - ?", school_id).order("course_ac_para DESC").limit(limit).all - else - courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL - ").order("course_ac_para DESC").limit(limit).all - end + #time_now = Time.new.strftime("%Y") + #if school_id + #courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <> + # ?", school_id).order("course_ac_para DESC").limit(limit).all + #else + # courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL + # ").order("course_ac_para DESC").limit(limit).all + # end + school_id.nil? ? + courses = Course.includes(:school, :members).visible. + joins(:memberships). + where("courses.time = ? and courses.term = ? and courses.school_id is not NULL", year_now, course_term). + group('members.course_id'). + reorder("COUNT(members.course_id) DESC").limit(limit).all + : + courses = Course.includes(:school, :members).visible. + joins(:course_status). + where("courses.time = ? and courses.term = ? and courses.school_id <> ?",year_now, course_term, school_id). + group('members.course_id'). + reorder("COUNT(members.course_id) DESC").limit(limit).all courses end diff --git a/app/views/bids/_fork_form.html.erb b/app/views/bids/_fork_form.html.erb index 3fcf0f02e..7a7010794 100644 --- a/app/views/bids/_fork_form.html.erb +++ b/app/views/bids/_fork_form.html.erb @@ -10,13 +10,13 @@

<%= f.text_area :description, :rows => 8, :value => @bid.description, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>

- -

<%= f.text_field :deadline, :value => nil,:required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%> +

<%= f.text_field :deadline, :value => nil,:required => true, :size => 60, :style => "width:150px;" , :readonly => true %><%= calendar_for('bid_deadline')%>

<%= f.select :is_evaluation, is_evaluation_option %> diff --git a/app/views/bids/_form.html.erb b/app/views/bids/_form.html.erb index c5c284d85..98277d315 100644 --- a/app/views/bids/_form.html.erb +++ b/app/views/bids/_form.html.erb @@ -30,6 +30,6 @@

-

<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%> +

<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}", :readonly => true %><%= calendar_for('bid_deadline')%>

diff --git a/app/views/bids/_form_contest.html.erb b/app/views/bids/_form_contest.html.erb index 448af2e8e..e2dba9271 100644 --- a/app/views/bids/_form_contest.html.erb +++ b/app/views/bids/_form_contest.html.erb @@ -33,4 +33,4 @@

-

<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%>

+

<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%>

diff --git a/app/views/bids/_history.html.erb b/app/views/bids/_history.html.erb index 00a497e78..b67421823 100644 --- a/app/views/bids/_history.html.erb +++ b/app/views/bids/_history.html.erb @@ -19,41 +19,48 @@ <% if journals.size >0 %> - <% end %> diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index 226eae650..145e01f1c 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -29,17 +29,21 @@

<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>

-

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;", :onchange => "regexDeadLine();") %> +

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :onchange => "regexDeadLine();") %> <%= calendar_for('bid_deadline')%>

-

<%= f.select :is_evaluation, is_evaluation_option %> +

+ <%= f.select :is_evaluation, is_evaluation_option %>

-

<%= f.select :proportion, proportion_option %> +

+ <%= f.select :proportion, proportion_option %>

-

<%= hidden_field_tag 'course_id', @course.id %> +

+ <%= hidden_field_tag 'course_id', @course.id %>

-
<%= l(:label_attachment_plural) %> -

<%= render :partial => 'attachments/form', :locals => {:container => @homework} %>

+
+ <%= l(:label_attachment_plural) %> +

<%= render :partial => 'attachments/form', :locals => {:container => @bid} %>

\ No newline at end of file diff --git a/app/views/bids/_new_bid.html.erb b/app/views/bids/_new_bid.html.erb index afce79577..db1387a00 100644 --- a/app/views/bids/_new_bid.html.erb +++ b/app/views/bids/_new_bid.html.erb @@ -69,7 +69,7 @@ border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-top: 30p <%= text_field_tag 'bid_deadline', "#{l(:label_deadline)}", :class => 'noline', :required => true, - :onfocus => "clearInfo('bid_deadline', '#{l(:label_deadline)}')", :onblur => "showInfo('bid_deadline', '#{l(:label_deadline)}')"%> + :onfocus => "clearInfo('bid_deadline', '#{l(:label_deadline)}')", :readonly => true, :onblur => "showInfo('bid_deadline', '#{l(:label_deadline)}')"%> <%= calendar_for('bid_deadline')%> diff --git a/app/views/bids/edit.html.erb b/app/views/bids/edit.html.erb index fe92977ae..b02898353 100644 --- a/app/views/bids/edit.html.erb +++ b/app/views/bids/edit.html.erb @@ -55,6 +55,6 @@
<%#= render :partial => 'homework_form', :locals => { :f => f } %> <%= render :partial => 'homework_form', :locals => { :f => f } %> - + <% end %>
\ No newline at end of file diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 35e066d45..26576195d 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -17,7 +17,7 @@ <%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'messages/form', :locals => {:f => f} %>

<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link(preview_board_message_path(@board), 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%> | + <%#= preview_link(preview_board_message_path(@board), 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%> <%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'whiteButton m3p10' %>

<% end %>
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 199155838..d615c877c 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -18,8 +18,8 @@ <%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'messages/form', :locals => {:f => f} %>

<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link(preview_board_message_path(@board), 'message-form', target='preview', {:class => 'whiteButton m3p10'}) %> - | + <%#= preview_link(preview_board_message_path(@board), 'message-form', target='preview', {:class => 'whiteButton m3p10'}) %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;', :class => 'whiteButton m3p10' %>

<% end %>
diff --git a/app/views/common/403.html b/app/views/common/403.html new file mode 100644 index 000000000..8462570e4 --- /dev/null +++ b/app/views/common/403.html @@ -0,0 +1,41 @@ + + + + +没有访问权限 + + + + + +
+
403
+
+

ERROR FORBIDDEN
+ 没有访问权限!建议您

+ +
+ +
+ + diff --git a/app/views/common/404.html b/app/views/common/404.html new file mode 100644 index 000000000..5a3eaec9f --- /dev/null +++ b/app/views/common/404.html @@ -0,0 +1,41 @@ + + + + +页面不见了 + + + + + +
+
404
+
+

ERROR PAGE
+ 页面不见了!建议您

+ +
+ +
+ + diff --git a/app/views/common/_preview.html.erb b/app/views/common/_preview.html.erb index 90d83ce8c..cf26d78ab 100644 --- a/app/views/common/_preview.html.erb +++ b/app/views/common/_preview.html.erb @@ -1,3 +1,3 @@
<%= l(:label_preview) %> -<%= textilizable @text, :attachments => @attachments, :object => @previewed %> + <%= textilizable @text, :attachments => @attachments, :object => @previewed %>
diff --git a/app/views/contestnotifications/edit.html.erb b/app/views/contestnotifications/edit.html.erb index 27e38f999..22f484724 100644 --- a/app/views/contestnotifications/edit.html.erb +++ b/app/views/contestnotifications/edit.html.erb @@ -7,7 +7,7 @@ :method => :put } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> -<%= preview_link preview_contestnotifications_path(id: @contestnotification), +<%#= preview_link preview_contestnotifications_path(id: @contestnotification), 'contestnotifications-form' %> <% end %> diff --git a/app/views/contests/_form_contest.html.erb b/app/views/contests/_form_contest.html.erb index 513419668..ffd273db9 100644 --- a/app/views/contests/_form_contest.html.erb +++ b/app/views/contests/_form_contest.html.erb @@ -68,6 +68,7 @@ :required => true, :size => 60, :style => "width:150px;", + :readonly => true, :placeholder => "#{l(:label_deadline)}" %> <%= calendar_for('contest_deadline')%> diff --git a/app/views/contests/_new_softapplication.html.erb b/app/views/contests/_new_softapplication.html.erb index 3e4c0c9e0..fb16e9351 100644 --- a/app/views/contests/_new_softapplication.html.erb +++ b/app/views/contests/_new_softapplication.html.erb @@ -4,7 +4,7 @@ //验证作品名称 function regexName() { - var name = $("#softapplication_name").val(); + var name = $.trim($("#softapplication_name").val()); if(name.length == 0) { $("#spane_name_notice").text("<%= l(:label_no_softapplication_name) %>"); @@ -31,7 +31,7 @@ //验证作品简介 function regexDescription() { - var name = $("#softapplication_description").val(); + var name = $.trim($("#softapplication_description").val()); if(name.length ==0) { $("#span_sofapplication_description").text("<%= l(:label_no_softapplication_description) %>"); @@ -56,7 +56,7 @@ //验证运行平台 function regexWorkdescription() { - var workDescription = $("#softapplication_android_min_version_available").val(); + var workDescription = $.trim($("#softapplication_android_min_version_available").val()); if(workDescription.length ==0) { $("#spane_workdescription_notice").text("<%= l(:label_no_softapplication_platform) %>"); @@ -80,7 +80,7 @@ //验证开发人员 function regexDevelopers() { - var workDescription = $("#softapplication_application_developers").val(); + var workDescription = $.trim($("#softapplication_application_developers").val()); if(workDescription.length ==0) { $("#span_softapplication_application_developers").text("<%= l(:label_no_softapplication_developers) %>"); diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb index 4b63b8852..b397b8d8f 100644 --- a/app/views/courses/_homework_form.html.erb +++ b/app/views/courses/_homework_form.html.erb @@ -34,7 +34,7 @@ <%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>

--> <% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %> -

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();") %> +

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();", :readonly => true) %> <%= calendar_for('bid_deadline')%> diff --git a/app/views/courses/finishcourse.js.erb b/app/views/courses/finishcourse.js.erb index 75c2b774d..46bc57e32 100644 --- a/app/views/courses/finishcourse.js.erb +++ b/app/views/courses/finishcourse.js.erb @@ -1,12 +1,12 @@ <% if @save_flag %> -<% if Rails.env.development? %> -console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@course.extra).try(:endup_time)%>'); -<% end %> -$('#content-title-top-div').html("<%= j(render partial: 'users/my_course_ex', :locals => {:memberships => @memberships,:user=>@user, -:memberships_doing=>@memberships_doing,:memberships_done=>@memberships_done} )%>") -$('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>") + <% if Rails.env.development? %> + console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@course.extra).try(:endup_time)%>'); + <% end %> + $('#content-title-top-div').html("<%= j(render partial: 'users/my_course_ex', :locals => {:memberships => @memberships,:user=>@user, + :memberships_doing=>@memberships_doing,:memberships_done=>@memberships_done} )%>"); + $('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>"); <% else %> -alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); + alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); <% end %> diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index 24eefd4cb..907be64a4 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -56,9 +56,9 @@

<% end %> -<% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> -<% end %> +<%# other_formats_links do |f| %> + <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> +<%# end %> <% content_for :sidebar do %> <%= form_tag({}, :method => :get) do %> diff --git a/app/views/courses/search.html.erb b/app/views/courses/search.html.erb index 25b45e0db..e25cd5349 100644 --- a/app/views/courses/search.html.erb +++ b/app/views/courses/search.html.erb @@ -45,13 +45,13 @@ <% if User.current.logged? %>

- <%= l(:label_my_projects) %> + <%= l(:label_my_course) %>

<% end %> -<% other_formats_links do |f| %> -<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> -<% end %> +<%# other_formats_links do |f| %> +<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> +<%# end %> <% content_for :sidebar do %> <%= form_tag({}, :method => :get) do %> diff --git a/app/views/issues/bulk_edit.html.erb b/app/views/issues/bulk_edit.html.erb index 281c7a309..2924ad927 100644 --- a/app/views/issues/bulk_edit.html.erb +++ b/app/views/issues/bulk_edit.html.erb @@ -107,14 +107,14 @@ <% if @safe_attributes.include?('start_date') %>

- <%= text_field_tag 'issue[start_date]', '', :size => 10 %><%= calendar_for('issue_start_date') %> + <%= text_field_tag 'issue[start_date]', '', :size => 10, :readonly => true %><%= calendar_for('issue_start_date') %>

<% end %> <% if @safe_attributes.include?('due_date') %>

- <%= text_field_tag 'issue[due_date]', '', :size => 10 %><%= calendar_for('issue_due_date') %> + <%= text_field_tag 'issue[due_date]', '', :size => 10, :readonly => true %><%= calendar_for('issue_due_date') %>

<% end %> diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index b0daf8c88..c3b06759c 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -42,48 +42,25 @@ @@ -98,7 +75,7 @@ \ No newline at end of file diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb index 4eab5658c..2cfeea80e 100644 --- a/app/views/messages/_form.html.erb +++ b/app/views/messages/_form.html.erb @@ -5,12 +5,22 @@
<% unless replying %> -


+

+ +
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :maxlength => 254 %>

<% else %> -


- <%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %> +

+ +
+ <%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %>

<% end %>

@@ -31,7 +41,8 @@

<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %> - <%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content' %> + <%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content', :onblur => "regexContent();" %> +

diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index ea94244d5..f66def486 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -74,9 +74,9 @@ <%= labelled_form_for @news, :url => course_news_index_path(@course), :html => {:id => 'news-form', :multipart => true} do |f| %> <%= render :partial => 'news/course_form', :locals => {:f => f, :is_new => true} %> - <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'whiteButton m3p10' %>| - <%= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> - | + <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'whiteButton m3p10' %> + <%#= preview_link preview_news_path, 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'whiteButton m3p10' %> <% end if @course %>
diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 6e03e8e34..6f13c28c7 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -70,7 +70,7 @@ <%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %> <%#= submit_tag l(:button_save) %> <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'whiteButton m3p10' %> - <%= preview_link preview_news_path(:course_id => @course, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> | + <%#= preview_link preview_news_path(:course_id => @course, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'whiteButton m3p10' %> <% end %>
diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb index 75f33d1d3..79217f1fe 100644 --- a/app/views/news/_project_news.html.erb +++ b/app/views/news/_project_news.html.erb @@ -84,8 +84,8 @@ <%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %> <%= link_to l(:button_create), "#", :onclick => 'submitNews();',:onmouseover => 'submitFocus(this);', :class => 'whiteButton m3p10' %> | - <%= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> - | + <%#= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'whiteButton m3p10' %> <% end if @project %>
diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 665094cc8..7b4c209b0 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -70,7 +70,7 @@ <%= render :partial => 'form', :locals => { :f => f } %> <%#= submit_tag l(:button_save) %> <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'whiteButton m3p10' %> - <%= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> | + <%#= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'whiteButton m3p10' %> <% end %>
diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb index e5e5221b9..3225f8031 100644 --- a/app/views/news/edit.html.erb +++ b/app/views/news/edit.html.erb @@ -3,7 +3,7 @@ <%= labelled_form_for @news, :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> -<%= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form' %> +<%#= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form' %> <% end %>
diff --git a/app/views/news/new.html.erb b/app/views/news/new.html.erb index 836d3b6ed..03c1d3ee7 100644 --- a/app/views/news/new.html.erb +++ b/app/views/news/new.html.erb @@ -4,14 +4,14 @@ :html => {:id => 'news-form', :multipart => true} do |f| %> <%= render :partial => 'news/form', :locals => {:f => f} %> <%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> + <%#= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> <% end %> <% elsif @course %> <%= labelled_form_for @news, :url => course_news_index_path(@course), :html => {:id => 'news-form', :multipart => true} do |f| %> <%= render :partial => 'news/form', :locals => {:f => f} %> <%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> + <%#= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> <% end %> <% end %>
diff --git a/app/views/projects/_new_homework.html.erb b/app/views/projects/_new_homework.html.erb index 1da188f3b..64a76aa0f 100644 --- a/app/views/projects/_new_homework.html.erb +++ b/app/views/projects/_new_homework.html.erb @@ -68,7 +68,7 @@ border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-top: 30p
- <%= text_field_tag 'bid_deadline', "#{l(:label_deadline)}", :class => 'noline', :required => true, + <%= text_field_tag 'bid_deadline', "#{l(:label_deadline)}", :class => 'noline', :readonly => true, :required => true, :onfocus => "clearInfo('bid_deadline', '#{l(:label_deadline)}')", :onblur => "showInfo('bid_deadline', '#{l(:label_deadline)}')"%> <%= calendar_for('bid_deadline')%> diff --git a/app/views/timelog/_form.html.erb b/app/views/timelog/_form.html.erb index 3256feaac..a3c0fa81b 100644 --- a/app/views/timelog/_form.html.erb +++ b/app/views/timelog/_form.html.erb @@ -13,7 +13,7 @@ <%= f.text_field :issue_id, :size => 6 %> <%= h("#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}") if @time_entry.issue %>

-

<%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %>

+

<%= f.text_field :spent_on, :size => 10, :required => true, :readonly => true %><%= calendar_for('time_entry_spent_on') %>

<%= f.text_field :hours, :size => 6, :required => true %>

<%= f.text_field :comments, :size => 100, :maxlength => 255 %>

<%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %>

diff --git a/app/views/timelog/bulk_edit.html.erb b/app/views/timelog/bulk_edit.html.erb index caabc18a2..a7ccc36fc 100644 --- a/app/views/timelog/bulk_edit.html.erb +++ b/app/views/timelog/bulk_edit.html.erb @@ -18,7 +18,7 @@

- <%= text_field :time_entry, :spent_on, :size => 10 %><%= calendar_for('time_entry_spent_on') %> + <%= text_field :time_entry, :spent_on, :size => 10, :readonly => true %><%= calendar_for('time_entry_spent_on') %>

diff --git a/app/views/versions/_form.html.erb b/app/views/versions/_form.html.erb index d852b3dab..d0729c720 100644 --- a/app/views/versions/_form.html.erb +++ b/app/views/versions/_form.html.erb @@ -2,15 +2,40 @@ <%= error_messages_for 'version' %>

-

<%= f.text_field :name, :size => 60, :required => true %>

-

<%= f.text_field :description, :size => 60, :style => "margin-left:10px;" %>

-

<%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %>

-

<%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %>

-

<%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %>

-

<%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %>

+

+ <%= f.text_field :name, :size => 60, :required => true %> +

+

+ <%= f.text_field :description, :size => 60, :style => "margin-left:10px;" %> +

+

+ + <%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %> + +

+

+ + <%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %> + +

+

+ + <%= f.text_field :effective_date, :size => 10, :readonly => true %> + <%= calendar_for('version_effective_date') %> + +

+

+ + <%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %> + +

<% @version.custom_field_values.each do |value| %> -

<%= custom_field_tag_with_label :version, value %>

+

+ + <%= custom_field_tag_with_label :version, value %> + +

<% end %>
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index d28c89aa8..ea8963f7e 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -78,29 +78,28 @@

<%= l(:lable_hot_course)%>

- <% if @school_id %> - <% school_course = find_miracle_course(10,7, @school_id) %> - <% else %> - <%school_course=[]%> - <% end %> - <% if (school_course.count == 0) %> - <%= render :partial => 'more_course', :locals => {:school_id => nil}%> + <% month_now = Time.now.strftime("%m").to_i %> + <% year_now = Time.new.strftime("%Y") %> + + <% (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %> + <% @school_id.nil? ? cur_school_course = [] : cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term) %> + + <% if cur_school_course.count == 0 %> + <%= render :partial => 'more_course', :locals => {:school_id => nil}%>
    - <% if User.current.logged? %>
  • <%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_no_course)} %>
  • - <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9, @school_id)} %> - <% else %> - <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(10, @school_id)} %> <% end %> + <% User.current.logged? ? course_count = 9 : course_count = 10 %> + <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(course_count, @school_id, year_now, course_term)} %>
<% else %> - <% if school_course.count < 9 %> + <% if cur_school_course.count < 9 %> <%= render :partial => 'more_course', :locals => {:school_id => nil}%> @@ -111,12 +110,12 @@ <% end %>
    - <%= render :partial => 'course_list', :locals => {:course_list => school_course} %> - <% if school_course.count < 9 %> + <%= render :partial => 'course_list', :locals => {:course_list => cur_school_course} %> + <% if cur_school_course.count < 9 %>
  • <%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_less_course)} %>
  • - <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9 - school_course.count, @school_id)} %> + <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9-cur_school_course.count, @school_id, year_now, course_term)} %> <% end %>
@@ -136,19 +135,26 @@ <% find_new_forum_topics(10).each do |topic| %>
  • -       - <%= link_to '['+topic.forum.name + ']', forum_path(topic.forum), :class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray", :style => "font-size: 10pt !important;" %> + +       + <%= link_to '['+topic.forum.name + ']', forum_path(topic.forum), :class => 'memo_Bar_title' %> + <%= link_to topic.subject, topic.event_url, :class => "gray", :style => "font-size: 10pt !important;" %>
    <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> - - <%= l(:label_question_sponsor)%>: <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> + + <%= l(:label_question_sponsor)%>: + <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> - - <%= l(:label_final_reply)%>:<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %><%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%><% end %> + + <%= l(:label_final_reply)%>: + <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> + <%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%> + <% end %> <%= l(:label_reply)%>(<%= link_to topic.try(:replies_count), topic.event_url %>) diff --git a/app/views/wiki/edit.html.erb b/app/views/wiki/edit.html.erb index 3a1abdd83..ba82865ad 100644 --- a/app/views/wiki/edit.html.erb +++ b/app/views/wiki/edit.html.erb @@ -44,7 +44,7 @@

    <%= submit_tag l(:button_save) %> - <%= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %>

    + <%#= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %>

    <%= wikitoolbar_for 'content_text' %> <% end %> diff --git a/app/views/words/_new_respond.html.erb b/app/views/words/_new_respond.html.erb index d3f4145a8..64b83d777 100644 --- a/app/views/words/_new_respond.html.erb +++ b/app/views/words/_new_respond.html.erb @@ -1,13 +1,15 @@ <%= form_tag({:controller => 'words', :action => 'create_reply'}, :remote => true) do %> -<%= text_area_tag 'user_notes', "", :class => 'noline', - :style => "resize: none;", :rows => 4, - :placeholder => l(:label_projects_feedback_respond_content), - :maxlength => 250 %> + <%= text_area_tag 'user_notes', "", :class => 'noline', + :style => "resize: none;", :rows => 4, + :placeholder => l(:label_projects_feedback_respond_content), + :maxlength => 250 %> -<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> -<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> -<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> -<%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "enterprise", :style => "float: right; margin-top: 1px; margin-right: 4px;"%> + <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> + <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> + <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> + <%= submit_tag l(:button_projects_feedback_respond), :name => nil , + :class => "enterprise", + :style => "float: right; margin-top: 1px; margin-right: 4px;"%> <% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f61e61f9d..dedf15dfe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -100,7 +100,6 @@ RedmineApp::Application.routes.draw do #resources :contestnotifications, :only => [:index, :show, :edit, :update, :destroy] # match '/contestnotifications/:id/notificationcomments', :to => 'notificationcomments#create', :via => :post # match '/contestnotifications/:id/notificationcomments/:notificationcomment_id', :to => 'notificationcomments#destroy', :via => :delete - match '/contestnotifications/preview', :to => 'previews#contestnotification', :as => 'preview_contestnotifications', :via => [:get, :post, :put] ## new added by linchun #新竞赛相关 resources :contests, only: [:index] do resources :contestnotifications do @@ -136,6 +135,19 @@ RedmineApp::Application.routes.draw do end end + match '/news/preview', :to => 'previews#news', :as => 'preview_news', :via => [:get, :post, :put] + match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] + match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put] + match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put] + match '/contestnotifications/preview', :to => 'previews#contestnotification', :as => 'preview_contestnotifications', :via => [:get, :post, :put] + + #resource :previews, only: [] do + # collection do + # match 'news', :via => [:get, :post, :put] + # match 'issue', :via => [:get, :post, :put] + # end + #end + resources :stores do collection do match 'search', :via => [:get, :post] @@ -188,11 +200,6 @@ RedmineApp::Application.routes.draw do match 'account/activate', :via => :get match 'account/valid_ajax', :via => :get - match '/news/preview', :to => 'previews#news', :as => 'preview_news', :via => [:get, :post, :put] - match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] - match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put] - match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put] - match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] diff --git a/public/404.html b/public/404.html index 8f2a53fe2..5b3280ccb 100644 --- a/public/404.html +++ b/public/404.html @@ -1,23 +1,41 @@ - - -Trustie 404 error - + + + + + 页面不见了 + + + -

    Page not found

    -

    The page you were trying to access doesn't exist or has been removed.

    -

    Back

    + +
    +
    404
    +
    +

    ERROR PAGE
    + 页面不见了!建议您

    + +
    + +