Merge branch 'shaproup' into szzh

Conflicts:
	app/models/course.rb
	app/models/project.rb
	app/views/contests/show_attendingcontest.html.erb
	app/views/files/_course_file.html.erb
	app/views/files/_course_new.html.erb
	app/views/layouts/_base_footer.html.erb

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2014-11-13 09:59:20 +08:00
commit b7a89d6108
7 changed files with 403 additions and 351 deletions

View File

@ -1,3 +1,4 @@
class Course < ActiveRecord::Base class Course < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
@ -33,10 +34,10 @@ class Course < ActiveRecord::Base
acts_as_attachable :view_permission => :view_files, acts_as_attachable :view_permission => :view_files,
:delete_permission => :manage_files :delete_permission => :manage_files
validates :password, presence: true validates_presence_of :password, :term,:name,:description
validates :term, presence: true validates_format_of :class_period, :with =>/^[1-9]\d*$/
validates :name, presence: true validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
validates :class_period, presence: true,format: {:with =>/^\d*$/} validates_length_of :description, :maximum => 10000
before_save :self_validate before_save :self_validate
after_create :create_board_sync after_create :create_board_sync
before_destroy :delete_all_members before_destroy :delete_all_members
@ -309,3 +310,5 @@ class Course < ActiveRecord::Base
# read_attribute('name') || Project.find_by_identifier(self.extra).try(:name) # read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)
#end #end
end end

View File

@ -29,6 +29,7 @@ class News < ActiveRecord::Base
validates_presence_of :title, :description validates_presence_of :title, :description
validates_length_of :title, :maximum => 60 validates_length_of :title, :maximum => 60
validates_length_of :summary, :maximum => 255 validates_length_of :summary, :maximum => 255
validates_length_of :description, :maximum => 10000
acts_as_attachable :delete_permission => :manage_news acts_as_attachable :delete_permission => :manage_news
acts_as_searchable :columns => ['title', 'summary', "#{table_name}.description"], :include => :project acts_as_searchable :columns => ['title', 'summary', "#{table_name}.description"], :include => :project

View File

@ -41,7 +41,7 @@ class Project < ActiveRecord::Base
has_many :principals, :through => :member_principals, :source => :principal has_many :principals, :through => :member_principals, :source => :principal
has_many :enabled_modules, :dependent => :delete_all has_many :enabled_modules, :dependent => :delete_all
has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position" has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position"
has_many :issues, :dependent => :destroy, :include => [:status, :tracker] has_many :issues, :dependent => :destroy, :include => [:status, :tracker],:order => "id ASC"
has_many :issue_changes, :through => :issues, :source => :journals has_many :issue_changes, :through => :issues, :source => :journals
has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC" has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC"
has_many :time_entries, :dependent => :delete_all has_many :time_entries, :dependent => :delete_all
@ -1151,3 +1151,4 @@ class Project < ActiveRecord::Base
end end

View File

@ -313,3 +313,4 @@
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div> </div>
<% html_title(l(:label_contest_joincontest)) -%> <% html_title(l(:label_contest_joincontest)) -%>

View File

@ -1,4 +1,3 @@
<% attachmenttypes = @course.attachmenttypes %> <% attachmenttypes = @course.attachmenttypes %>
<% sufixtypes = @course.contenttypes %> <% sufixtypes = @course.contenttypes %>
@ -10,40 +9,12 @@
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @course) %> <%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @course) %>
<div class="clearfix"></div> <div class="clearfix"></div>
<div id="file_buttons" class="nhidden"> <div id="file_buttons" class="nhidden">
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %> <%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %>
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %> <%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %>
<p></p> <p></p>
<div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'course_new', locals: {course: @course} %>
</div>
<div id="relation_file_div" class="relation_file_div hidden">
<fieldset>
<legend>搜索</legend>
<%= form_tag(
attachments_autocomplete_path(:format => 'js'),
:remote => true,
:method => :post) do %>
<%= label_tag(:attach_search, "按关键字搜索:") %>
<%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %>
<% end -%>
<%= form_tag course_attach_relation_path(:format => 'js'),
method: :post,
remote: true,
id: "relation_file_form",
:class => 'hidden' do %>
<%= hidden_field_tag(:class_name, 'course') %>
<%= hidden_field_tag(:class_id, params[:course_id]) %>
<div id="relation_file">
</div>
<div class="kclearfix" style='margin-top: 10px;'>
<%= submit_tag(l(:button_add)) -%>
</div>
<% end -%>
</fieldset>
<div class="line_under" style="margin:20px 0px;"></div>
</div>
</div> </div>
<div class="box" id="files-box"> <div class="box" id="files-box">
<label for="files-box" style="font-weight:bold;">&nbsp;&nbsp;<%= l(:label_files_filter) %></label> <label for="files-box" style="font-weight:bold;">&nbsp;&nbsp;<%= l(:label_files_filter) %></label>

View File

@ -20,6 +20,28 @@
<% end %> <% end %>
<div class="line_under" style="margin:20px 0px;"></div> <div class="line_under" style="margin:20px 0px;"></div>
<fieldset>
<legend><%=l(:label_attachment_new)%></legend>
<% attachmenttypes = course.attachmenttypes %>
<%= error_messages_for 'attachment' %>
<%= form_tag(course_files_path(course), :multipart => true,:remote => true,:method => :post,:name=>"upload_form", :class => "tabular") do %>
<p>
<% if attachmenttypes.any? %>
<%= l(:attachment_type) %></label>
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName", 2), {style: 'width:100px'} %>
<% end %>
</p>
<p><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
<%= submit_tag l(:button_add) %>
<% end %>
</fieldset>
<script type='text/javascript'> <script type='text/javascript'>
function tagAddClick(id,objId,objTag) function tagAddClick(id,objId,objTag)
{ {

View File

@ -56,3 +56,56 @@
</div> </div>
</div> </div>
<!--add by huang-->
<% cache "footer" do %>
<div class="clearfix"></div>
<div id="footer" style="margin-left:-5px;padding-top: 20px;clear: both;font-size: 12px;">
<div style="border-top:solid 1px #C6E9F1;"></div>
<div class="base_footer">
<div align="center">
<!--gcm-->
<p>
<span><%=l(:label_organizers)%></span>
<span class="footer_text_link"><%= link_to l(:label_organizers_information),"http://www.nudt.edu.cn/ArticleShow.asp?ID=47",:target=>"_blank"%></span>
<span class="footer_text_link"><%= link_to l(:label_organizers_information_institute), "http://www.nudt.edu.cn/ArticleShow.asp?ID=41", :target => "_blank" %></span>
<span id="copyright"><%=l(:label_copyright)%>©2007~2014</span>
<span id="contact_us" class="footer_text_link"><%= link_to l(:label_contact_us),"http://" + Setting.host_name + "/projects/2/member", :target=>"_blank" %></span>
<span id="record"class="footer_text_link"><%= link_to l(:label_record),"http://www.miibeian.gov.cn/", :target => "_blank" %></span>
</p>
<div id="logo_link">
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>"国防科学技术大学计算机学院"),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>"北京大学信息科学技术学院软件研究所"), "http://eecs.pku.edu.cn", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>"北京航空航天大学计算机学院"), "http://scse.buaa.edu.cn/", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/iscas.png',:size=>'100x30',:alt=>"中国科学院软件研究所"), "http://www.iscas.ac.cn", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/inforbus.png',:size=>'100x30',:alt=>"山东中创软件商用中间件股份有限公司"), "http://www.inforbus.com", :target => "_blank" %></span>
</div>
<!--gcm-->
</div>
</div>
</div>
</div>
<div class="debug hidden">
<%= debug(params) if Rails.env.development? %>
</div>
<div class="hidden">
<script src="http://s4.cnzz.com/z_stat.php?id=1000482288&web_id=1000482288" language="JavaScript">
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-46523987-1', 'trustie.net');
ga('send', 'pageview');
</script>
</div>
<% end %>