Merge branch 'szzh' into develop

Homework v20141023
sw 11 years ago
commit be0eddd304

@ -125,7 +125,6 @@ GEM
mocha (1.1.0)
metaclass (~> 0.0.1)
multi_json (1.10.1)
mysql2 (0.3.11)
mysql2 (0.3.11-x86-mingw32)
net-ldap (0.3.1)
nokogiri (1.6.3)

@ -88,3 +88,12 @@ bundle exec rake db:migrate:down VERSION=20140811022947
bundle exec rake db:migrate:up VERSION=20140811022947
bundle exec rake db:migrate
bundle exec rake project_score:calculate
=================================[2014-10-17]====================================
kw:数据迁移web_footer_oranizers表已存在
bundle exec rake db:migrate:down VERSION=20141013014908
bundle exec rake db:migrate:up VERSION=20141013014908
bundle exec rake db:migrate
kw:数据迁移web_footer_companies表已存在
bundle exec rake db:migrate:down VERSION=20141013023400
bundle exec rake db:migrate:up VERSION=20141013023400
bundle exec rake db:migrate

@ -159,7 +159,7 @@ class AdminController < ApplicationController
respond_to do |format|
flash[:notice] = l(:notice_successful_update)
format.html {
redirect_to admin_first_page_made_url
redirect_to first_page_made_url
}
format.api { render_api_ok }
#format.json { render json: @first_page, status: :created, location: @first_page }
@ -194,7 +194,7 @@ class AdminController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_course_page_made_url
redirect_to course_page_made_url
}
format.api { render_api_ok }
end
@ -217,25 +217,21 @@ class AdminController < ApplicationController
if request.get?
@contest_page = FirstPage.find_by_page_type('contest')
@first_page = FirstPage.find_by_page_type('project')
@notification = ContestNotification.first;
elsif request.post?
@first_page = FirstPage.find_by_page_type('project')
@contest_page = FirstPage.find_by_page_type('contest')
@notification = ContestNotification.first;
@first_page.web_title = params[:web_title]
@contest_page.web_title = params[:web_title]
@contest_page.title = params[:contest_title]
@contest_page.image_width = params[:image_width]
@contest_page.image_height = params[:image_height]
@contest_page.description = params[:contest_description]
@notification.title = params[:contest_notification_title]
@notification.content = params[:contest_notification][:content]
if @first_page.save && @contest_page.save && @notification.save
if @first_page.save && @contest_page.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_contest_page_made_url
redirect_to contest_page_made_url
}
format.api { render_api_ok }
end
@ -270,7 +266,7 @@ class AdminController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_web_footer_made_url
redirect_to web_footer_made_url
}
format.api { render_api_ok }
end

@ -499,19 +499,19 @@ class ApplicationController < ActionController::Base
def render_403(options={})
@project = nil
#render_error({:message => :notice_not_authorized, :status => 403}.merge(options))
render :template => 'common/403'
render_error({:message => :notice_not_authorized, :status => 403}.merge(options),'common/403')
#render :template => 'common/403'
return false
end
def render_404(options={})
#render_error({:message => :notice_file_not_found, :status => 404}.merge(options))
render :template => 'common/404'
render_error({:message => :notice_file_not_found, :status => 404}.merge(options),'common/404')
#render :template => 'common/404'
return false
end
# Renders an error response
def render_error(arg)
def render_error(arg,template = 'common/error')
arg = {:message => arg} unless arg.is_a?(Hash)
@message = arg[:message]
@lay = arg[:layout]
@ -521,9 +521,9 @@ class ApplicationController < ActionController::Base
respond_to do |format|
format.html {
if @lay
render :template => 'common/error', :layout => @lay,:status => @status
render :template => template, :layout => @lay,:status => @status
else
render :template => 'common/error', :layout => use_layout, :status => @status
render :template => template, :layout => use_layout, :status => @status
end
}
@ -766,7 +766,7 @@ class ApplicationController < ActionController::Base
end
def find_web_footer
@organize = WebFooterOranizer.first
@organizer = WebFooterOranizer.first
@companies = WebFooterCompany.all
end
end

@ -84,7 +84,10 @@ class AttachmentsController < ApplicationController
candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
elsif @attachment.container.class.to_s=="HomeworkAttach" && @attachment.container.bid.reward_type == 3
candown = true
elsif @attachment.container_type == "Bid" && @attachment.container && @attachment.container.courses
candown = User.current.member_of_course?(@attachment.container.courses.first) || (course.is_public == 1 && @attachment.is_public == 1)
else
candown = @attachment.is_public == 1
end
if candown || User.current.admin? || User.current.id == @attachment.author_id

@ -21,12 +21,18 @@ class CoursesController < ApplicationController
before_filter :toggleCourse, only: [:finishcourse, :restartcourse]
before_filter :require_login, :only => [:join, :unjoin]
before_filter :allow_join, :only => [:join]
#before_filter :allow_join, :only => [:join]
def join
if User.current.logged?
course = Course.find(params[:object_id])
unless User.current.member_of_course? course
course = Course.find_by_id params[:object_id]
if course
if course_endTime_timeout? course
@state = 2
else
if User.current.member_of_course?(course)
@state = 3
else
if params[:course_password] == course.password
members = []
members << Member.new(:role_ids => [10], :user_id => User.current.id)
@ -36,15 +42,16 @@ class CoursesController < ApplicationController
else
@state = 1
end
else
@state = 3
end
end
else
@state = 4
end
else
@state = 5
end
respond_to do |format|
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Course.find(params[:object_id]), :object_id => params[:object_id]} }
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => course, :object_id => params[:object_id]} }
end
rescue Exception => e
@state = 4
@ -424,9 +431,7 @@ class CoursesController < ApplicationController
@course_type = params[:course_type]
@school_id = params[:school_id]
per_page_option = 10
if @school_id == "0" or @school_id.nil?
if @school_id == "0" || @school_id.nil?
@courses_all = Course.active.visible.
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id")
else
@ -434,49 +439,37 @@ class CoursesController < ApplicationController
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id").
where("#{Course.table_name}.school_id = ?", @school_id)
end
@course_count = @courses_all.count
@course_pages = Paginator.new @course_count, per_page_option, params['page']
@course_activity_count=Hash.new
@courses_all.each do |course|
@course_activity_count[course.id]=0
end
case params[:course_sort_type]
when '0'
@courses = @courses_all.order("created_at desc")
@s_type = 0
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
@course_activity_count=get_course_activity @courses, @course_activity_count
when '1'
@courses = @courses_all.order("course_ac_para desc")
@s_type = 1
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
@course_activity_count=get_course_activity @courses, @course_activity_count
when '2'
@courses = @courses_all.order("watchers_count desc")
@s_type = 2
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
@course_activity_count=get_course_activity @courses, @course_activity_count
when '3'
@course_activity_count=get_course_activity @courses_all, @course_activity_count
@courses=handle_course @courses_all, @course_activity_count
@s_type = 3
@courses = @courses[@course_pages.offset, @course_pages.per_page]
else
@s_type = 0
@courses = @courses_all.order("created_at desc")
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
@course_activity_count=get_course_activity @courses, @course_activity_count
end
@ -518,18 +511,14 @@ class CoursesController < ApplicationController
# 新建作业
def new_homework
@homework = Bid.new
@homework.proportion
@homework.safe_attributes = params[:bid]
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
render :layout => 'base_courses'
else
render_403
end
end
def toggleCourse
@course_prefs = Course.find_by_extra(@course.extra)
unless (@course_prefs.teacher == User.current || User.current.admin?)
@ -697,8 +686,8 @@ class CoursesController < ApplicationController
private
def allow_join
if course_endTime_timeout? Course.find(params[:object_id])
def allow_join course
if course_endTime_timeout? course
respond_to do |format|
format.js {
@state = 2
@ -719,7 +708,4 @@ class CoursesController < ApplicationController
render_404
end
end
end

@ -113,7 +113,7 @@ class FilesController < ApplicationController
end
if order_by.count == 1
sort += "#{Attachment.table_name}.#{attribute} desc "
sort += "#{Attachment.table_name}.#{attribute} asc "
elsif order_by.count == 2
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
end

@ -130,7 +130,7 @@ class MyController < ApplicationController
@user.pref.save
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
set_language_if_valid @user.language
flash.now[:notice] = l(:notice_account_updated)
flash[:notice] = l(:notice_account_updated)
redirect_to user_url(@user)
return
else

@ -113,7 +113,7 @@ class RepositoriesController < ApplicationController
@root_path=RepositoriesHelper::ROOT_PATH
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
@project_path=@root_path+"htdocs/"+@repository_name
@repository_tag=params[:repository][:upassword]
@repository_tag=params[:repository][:upassword] || params[:repository][:password]
@repo_name=User.current.login.to_s+"_"+params[:repository][:identifier]
logger.info "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+": "+@repository_tag
logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name

@ -33,15 +33,16 @@ class UsersController < ApplicationController
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info,
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities]
:activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index]
#edit has been deleted by huang, 2013-9-23
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
:watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index]
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index]
before_filter :auth_user_extension, only: :show
before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
#william
@ -80,6 +81,21 @@ class UsersController < ApplicationController
end
end
def user_projects_index
if User.current.admin?
memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first
else
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
memberships = @user.memberships.all(:conditions => cond).first
end
watch_projects = Project.joins(:watchers).where("project_type <>? and watchable_type = ? and `watchers`.user_id = ?", '1','Project', @user.id).first
if memberships.nil? && watch_projects
redirect_to(:watch_projects_user) and return
else
redirect_to(:user_projects_user) and return
end
end
#added by young
def user_projects
@ -92,8 +108,6 @@ class UsersController < ApplicationController
#events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20)
#@events_by_day = events.group_by(&:event_date)
@state = 0
#add by huang
unless User.current.admin?
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)

@ -10,7 +10,7 @@ class WebFooterCompaniesController < ApplicationController
end
def new
@company = WebFooterCompany.new
@company ||= WebFooterCompany.new
end
def create
@ -20,8 +20,11 @@ class WebFooterCompaniesController < ApplicationController
redirect_to web_footer_companies_url
else
flash[:error] = "#{l :web_footer_company_create_fail}: #{@company.errors.full_messages[0]}"
new
render :action => 'new'
respond_to do |format|
format.html { render :action => 'new'}
format.api { render_validation_errors(@company) }
end
end
end
@ -42,7 +45,6 @@ class WebFooterCompaniesController < ApplicationController
redirect_to web_footer_companies_url
else
flash[:error] = "#{l :web_footer_company_update_fail}: #{@company.errors.full_messages[0]}"
edit
render :action => 'edit'
end
end

@ -143,16 +143,19 @@ module AttachmentsHelper
params[:q] ||= ""
filename_condition = params[:q].strip
attachAll = Attachment.scoped
# 除去当前课程的所有资源
nobelong_attach = Attachment.where("!(container_type = '#{course.class}' and container_id = #{course.id})") unless course.blank?
#attachAll = Attachment.where("author_id = #{User.current.id}")
#
## 除去当前课程的所有资源
#nobelong_attach =
# 搜索域确定
domain = course.nil? ? attachAll : nobelong_attach
course.nil? ?
domain=Attachment.where("author_id = #{User.current.id}")
:
domain=Attachment.where("author_id = #{User.current.id} and container_type = 'Course' and container_id <> #{course.id}") unless course.blank?
# 搜索到的资源
searched_attach = domain.where("is_public=1 and filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
searched_attach = domain.where("filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
#searched_attach = private_filter searched_attach
searched_attach = paginateHelper(searched_attach, 10)

@ -479,7 +479,6 @@ module CoursesHelper
type << option2
type
end
#获取课程动态
def get_course_activity courses, activities
@course_ids=activities.keys()
@ -504,20 +503,8 @@ module CoursesHelper
activities[news.course_id]+=1
end
#feedbackc_count
JournalsForMessage.where(jour_id: @course_ids, jour_type: Course).each do |jourformess|
activities[jourformess.jour_id]+=1
end
#activities!=0
i=0;
courses.each do |course|
id=course.id
if activities[id]==0
activities[id]=1
end
end
# 动态数 + 1 ( 某某创建了该课程 )
activities.each_pair { |key, value| activities[key] = value + 1 }
return activities
end

@ -8,8 +8,9 @@ class ContestingProject < ActiveRecord::Base
DESCRIPTION_LENGTH_LIMIT = 500
validates :description, length: {maximum:DESCRIPTION_LENGTH_LIMIT }
validates :user_id, presence: true
validates :contest_id, presence: true, uniqueness: {:scope => :project_id}
validates :contest_id, presence: true, uniqueness: {scope: :project_id}
validates :project_id, presence: true
validate :validate_user
validate :validate_contest
validate :validate_project

@ -0,0 +1,8 @@
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'}, class: "#{current_page?(first_page_made_path)? 'selected' : nil }" %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'}, class: "#{current_page?(course_page_made_path)? 'selected' : nil }" %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'}, class: "#{current_page?(contest_page_made_path)? 'selected' : nil }" %></li>
<li><%= link_to l(:label_web_footer_page), {:action => 'web_footer_made'}, class: "#{current_page?(web_footer_made_path)? 'selected' : nil }" %></li>
</ul>
</div>

@ -5,14 +5,7 @@
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} , :class => 'selected'%></li>
<li><%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} %></li>
</ul>
</div>
<%= render 'tab_partial' %>
<h4><%=l(:label_contest_first_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;">
@ -38,26 +31,7 @@
<label for='contest_description' style="vertical-align: top">&nbsp;&nbsp;&nbsp;<%= l(:label_site_description)%>:</label>
<%= text_area_tag 'contest_description',@contest_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<p style="margin-left:60px;padding-right: 20px;">
<label>&nbsp;&nbsp;&nbsp;<%= link_to l(:label_notification), '#',
:onclick => '$("#notification").slideToggle(400); ' %></label>
</p>
<div style="margin-left:60px;padding-right: 20px;" id="notification">
<label for='contest_notification_title'>&nbsp;&nbsp;&nbsp;<%= l(:label_contest_notification_title) %>:</label>
<p style="margin-left:70px;padding-right: 20px;">
<%= text_field_tag 'contest_notification_title', params[:label_contest_notification_title], :value => @notification.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<label for='contest_notification' style="vertical-align: top">&nbsp;&nbsp;&nbsp;<%= l(:label_contest_notification_content)%>:</label>
<%= text_area 'contest_notification', 'content', :value => @notification.content,:cols => 80, :rows => 15, :class => 'wiki-edit' %>
<%= wikitoolbar_for 'contest_notification_content' %>
<!-- <script src="/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
<p><#%= text_area 'contest_notification', 'content', :value => @notification.content,:required => true, :size => 80,:class => 'wiki-edit', id: 'editor01' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script> -->
</div>
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>
<div>

@ -5,14 +5,7 @@
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'}, :class => 'selected' %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %></li>
<li><%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} %></li>
</ul>
</div>
<%= render 'tab_partial' %>
<h4><%=l(:label_course_first_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_image) %>:</label>

@ -5,14 +5,7 @@
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'}, :class => 'selected' %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %></li>
<li><%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} %></li>
</ul>
</div>
<%= render 'tab_partial' %>
<h4><%=l(:label_project_first_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_image) %>:</label>

@ -5,14 +5,7 @@
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'}%></li>
<li><%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} , :class => 'selected' %></li>
</ul>
</div>
<%= render 'tab_partial' %>
<div style="float:right"><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %></div>
<h4><%=l(:label_web_footer_page)%></h4>

@ -33,7 +33,6 @@
<% end %>
<% end %>
<% if options[:author] %>
<!-- modified by zjc author添加超链接 -->
<span class="author" title="attachment.author">
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %>,
<%= format_time(attachment.created_on) %>

@ -21,15 +21,18 @@
</script>
<%= error_messages_for 'bid' %>
<p><%= l(:label_homeworks_form_new_description) %></p>
<p>
<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :onblur => "regexName();" %>
</p>
<p><span id="bid_name_span"></span></p>
<p>
<span id="bid_name_span"></span>
</p>
<p><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %></p>
<p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :onchange => "regexDeadLine();") %>
<p>
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>
</p>
<p>
<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :onchange => "regexDeadLine();") %>
<%= calendar_for('bid_deadline')%>
<span id="bid_deadline_span">
</span>
@ -44,6 +47,10 @@
<%= hidden_field_tag 'course_id', @course.id %>
</p>
<fieldset>
<legend><%= l(:label_attachment_plural) %></legend>
<p><%= render :partial => 'attachments/form', :locals => {:container => @bid} %></p>
<legend>
<%= l(:label_attachment_plural) %>
</legend>
<p>
<%= render :partial => 'attachments/form', :locals => {:container => @bid} %>
</p>
</fieldset>

@ -31,8 +31,8 @@ a:hover{ }
没有访问权限!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="javascript:history.back()" target="_blank">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback" target="_blank">给我留言</a>
<a href="javascript:history.back()">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback">给我留言</a>
</div>
</div>

@ -31,8 +31,8 @@ a:hover{ }
页面不见了!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="javascript:history.back()" target="_blank">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback" target="_blank">给我留言</a>
<a href="javascript:history.back()">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback">给我留言</a>
</div>
</div>

@ -1,28 +0,0 @@
<div class="top-content">
<table width="940px">
<tr>
<td class="info_font" style="width: 220px; color: #15bccf" ><%= l(:label_contest_innovate ) %></td>
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
<td rowspan="2">
</td>
<td rowspan="2" >
</td>
</tr>
<tr>
<td style="padding-left: 8px">
<a href="http://contest.trustie.net/">contest.trustie.net</a>
</td>
<td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:label_contest_innovate), welcome_contest_path %> > l(:label_details)</td>
</tr>
</table>
</div>
<!-- end -->
<div class="notification-content">
<p class="title"><%= @notification.title %></p>
<hr />
<p class="content"><%= @notification.content.html_safe %></p>
<hr />
</div>

@ -1,4 +1,55 @@
<%= error_messages_for @contestnotifications %>
<script type="text/javascript">
function regexTitle()
{
var title = $.trim($("#contestnotification_title").val());
if(title.length ==0)
{
$("#title_span").text("<%= l(:label_no_contest_news_title) %>");
$("#title_span").css('color','#ff0000');
$("#title_span").focus();
return false;
}
else if(title.length <= 254)
{
$("#title_span").text("<%= l(:label_field_correct) %>");
$("#title_span").css('color','#008000');
return true;
}
else
{
$("#title_span").text("<%= l(:label_contest_news_title_condition) %>");
$("#title_span").css('color','#ff0000');
$("#title_span").focus();
return false;
}
}
//验证描述不能为空不能多余5000个字符
function regexDescription()
{
var description = $.trim($("#contestnotification_description").val());
if(description.length ==0)
{
$("#description_span").text("<%= l(:label_no_contest_news_description) %>");
$("#description_span").css('color','#ff0000');
$("#description_span").focus();
return false;
}
else if(description.length <= 5000)
{
$("#description_span").text("<%= l(:label_field_correct) %>");
$("#description_span").css('color','#008000');
return true;
}
else
{
$("#description_span").text("<%= l(:label_contest_news_condition) %>");
$("#description_span").css('color','#ff0000');
$("#description_span").focus();
return false;
}
}
</script>
<div class="add_frame_header" >
<%= l(:bale_news_notice) %>
</div>
@ -8,19 +59,22 @@
:required => true,
:size => 60,
:maxlength => 60,
:style => "width:488px;"
:style => "width:488px;",
:onblur => "regexTitle();"
%>
</p>
<span id="title_span" style="padding-left: 100px;"></span>
<p>
<%= f.text_area :description,
:required => true,
:cols => 60,
:rows => 11,
:class => 'wiki-edit',
:style => "width:490px;"
:style => "width:490px;",
:onblur => "regexDescription();"
%>
</p>
<span id="description_span" style="padding-left: 100px;"></span>
</div>
<%= wikitoolbar_for 'news_description' %>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save