Merge branch 'szzh' into develop

This commit is contained in:
sw 2015-04-09 16:07:00 +08:00
commit a7a8a5cb54
69 changed files with 379 additions and 454 deletions

View File

@ -41,7 +41,7 @@ module Mobile
mount Apis::Comments
#add_swagger_documentation ({api_version: 'v1', base_path: 'http://u06.shellinfo.cn/trustie/api'})
add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
#add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
end
end

View File

@ -26,7 +26,7 @@ module Mobile
present :data, {token: key.access_token, user: api_user}, using: Entities::Auth
present :status, 0
else
raise 'Unauthorized.'
raise "无效的用户名或密码"
end
end

View File

@ -80,6 +80,10 @@ module Mobile
class_period: params[:class_period]
}
course = ::Course.find(params[:course_id])
# 如果没有传密码过来,那就把原来的密码给上,不然会不更新
if params[:password].nil? || params[:password].blank?
cs_params[:course][:password] = course[:password]
end
cs.edit_course_authorize(current_user,course)
course = cs.edit_course(cs_params, course,current_user)
present :data, course, with: Mobile::Entities::Course

View File

@ -58,6 +58,7 @@ module Mobile
end
course_expose :current_user_is_member
course_expose :current_user_is_teacher
course_expose :work_unit
end
end
end

View File

@ -27,11 +27,13 @@ class CommentsController < ApplicationController
raise Unauthorized unless @news.commentable?
@comment = Comment.new
@comment.comments = params[:comment]
@project ? @comment.comments = params[:comment][:comments] : @comment.comments = params[:comment]
@comment.author = User.current
if @news.comments << @comment
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@comment.id,OwnerTypeHelper::COMMENT
end
flash[:notice] = l(:label_comment_added)
end

View File

@ -681,9 +681,10 @@ class CoursesController < ApplicationController
"show_course_files" => true,
"show_course_news" => true,
"show_course_messages" => true,
"show_course_journals_for_messages" => true,
#"show_course_journals_for_messages" => true,
"show_bids" => true,
"show_homeworks" => true
"show_homeworks" => true,
#"show_polls" => true
}
@date_to ||= Date.today + 1
@date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date

View File

@ -1,42 +0,0 @@
class DiscussDemosController < ApplicationController
def index
@discuss_demo_list = DiscussDemo.where("body is not null").order("created_at desc").page(params[:page] || 1).per(10)
end
def new
@discuss_demo = DiscussDemo.create
@discuss_demo.save!
@discuss_demo
end
def create
end
def update
@discuss_demo = DiscussDemo.find(params[:id])
@discuss_demo.update_attributes(:title => params[:discuss_demo][:title],:body => params[:discuss_demo][:body])
redirect_to :controller=> 'discuss_demos',:action => 'show',:id => params[:id]
end
def delete
end
def destroy
asset = Kindeditor::Asset.find_by_owner_id(params[:id])
if !asset.nil?
filepath = File.join(Rails.root,"public","files","uploads",
asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s,
asset[:asset].to_s)
File.delete(filepath) if File.exist?filepath
end
DiscussDemo.destroy(params[:id])
redirect_to :controller=> 'discuss_demos',:action => 'index'
end
def show
@discuss_demo = DiscussDemo.find(params[:id])
end
end

View File

@ -63,8 +63,10 @@ class ForumsController < ApplicationController
respond_to do |format|
if @memo.save
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids ,@memo.id,OwnerTypeHelper::MEMO
end
#end
format.html { redirect_to (forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))), notice: "#{l :label_memo_create_succ}" }
format.json { render json: @memo, status: :created, location: @memo }
@ -170,8 +172,10 @@ class ForumsController < ApplicationController
# Author lizanle
# Description after save后需要进行资源记录的更新
# owner_type = 2 对应的是 forum
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids ,@forum.id,OwnerTypeHelper::FORUM
end
#end
respond_to do |format|

View File

@ -87,9 +87,10 @@ class MessagesController < ApplicationController
@message.save_attachments(params[:attachments])
if @message.save
# 更新kindeditor上传的图片资源所有者
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
end
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
redirect_to board_message_url(@board, @message)
@ -121,8 +122,10 @@ class MessagesController < ApplicationController
@topic.children << @reply
#@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record?
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE
end
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments])
render_attachment_warning_if_needed(@reply)
@ -189,7 +192,7 @@ class MessagesController < ApplicationController
@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
@temp = Message.new
@temp.content = "<blockquote>#{@message.content.html_safe}</blockquote>".html_safe
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, @message.author)} <br/>#{@message.content.html_safe}</blockquote>".html_safe
end
def preview

View File

@ -137,8 +137,10 @@ class NewsController < ApplicationController
@news.safe_attributes = params[:news]
@news.save_attachments(params[:attachments])
if @news.save
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
end
render_attachment_warning_if_needed(@news)
flash[:notice] = l(:notice_successful_create)
redirect_to course_news_index_url(@course)

View File

@ -29,6 +29,9 @@ class SettingsController < ApplicationController
end
def edit
hidden_non_project = Setting.find_by_name("hidden_non_project")
@text = (hidden_non_project && hidden_non_project.value == "0") ? l(:label_show_non_project) : l(:label_hidden_non_project)
@notifiables = Redmine::Notifiable.all
if request.post? && params[:settings] && params[:settings].is_a?(Hash)
settings = (params[:settings] || {}).dup.symbolize_keys
@ -70,4 +73,20 @@ class SettingsController < ApplicationController
rescue Redmine::PluginNotFound
render_404
end
#隐藏/显示非项目信息
def hidden_non_project
@notifiable = Setting.find_by_name("hidden_non_project")
if @notifiable
@notifiable.value == "1" ? @notifiable.value = 0 : @notifiable.value = 1
@notifiable.save
else
@notifiable = Setting.new()
@notifiable.name = "hidden_non_project"
@notifiable.value = 0
@notifiable.save
end
redirect_to settings_url
end
end

View File

@ -209,8 +209,10 @@ class WordsController < ApplicationController
message = params[:new_form][:course_message]
feedback = Course.add_new_jour(user, message, params[:id])
if(feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
end
redirect_to course_feedback_url(params[:id]), notice: l(:label_feedback_success)
else
flash[:error] = feedback.errors.full_messages[0]

View File

@ -132,9 +132,10 @@ module ApplicationHelper
def link_to_user_header user,canShowRealName=false,options={}
if user.is_a?(User)
if canShowRealName
name = h(user.realname(options[:format]))
name = user.show_name
name = user.login if name == ""
else
name = h(user.name(options[:format]))
name = user.login
end
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => options[:class]
else
@ -303,7 +304,7 @@ module ApplicationHelper
onclick = "$('##{id}').slideToggle(); "
onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ")
onclick << "return false;"
link_to(name, "#", :onclick => onclick,:class => options[:class])
link_to(name, "javascript:void(0)", :onclick => onclick,:class => options[:class])
end
def image_to_function(name, function, html_options = {})
@ -1947,6 +1948,8 @@ module ApplicationHelper
end
def bootstrap_render_dynamic_nav
hidden_non_project = Setting.find_by_name("hidden_non_project")
visiable = !(hidden_non_project && hidden_non_project.value == "0")
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain}
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain}
@ -1964,21 +1967,21 @@ module ApplicationHelper
#@nav_dispaly_project_label
nav_list = Array.new
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label && @show_course == 1
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label && @show_course == 1 && visiable
# nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label && @show_course == 1
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label && @show_course == 1
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label && @show_course == 1 && visiable
nav_list.push(main_project_link) if @nav_dispaly_main_project_label
nav_list.push(main_course_link) if @nav_dispaly_main_course_label && @show_course == 1
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label && @show_contest == 1
nav_list.push(main_course_link) if @nav_dispaly_main_course_label && @show_course == 1 && visiable
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label && @show_contest == 1 && visiable
nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1
nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1 && visiable
# nav_list.push(projects_link) if @nav_dispaly_project_label
#nav_list.push(users_link) if @nav_dispaly_user_label
# nav_list.push(contest_link) if @nav_dispaly_contest_label && @show_contest == 1
nav_list.push(bids_link) if @nav_dispaly_bid_label
nav_list.push(forum_link) if @nav_dispaly_forum_label
nav_list.push(stores_link) if @nav_dispaly_store_all_label
nav_list.push(bids_link) if @nav_dispaly_bid_label && visiable
nav_list.push(forum_link) if @nav_dispaly_forum_label && visiable
nav_list.push(stores_link) if @nav_dispaly_store_all_label && visiable
content_li = ''
nav_list.collect do |nav_item|

View File

@ -52,7 +52,7 @@ module CoursesHelper
end
def course_poll_count
Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}").count
Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status in (2,3)").count
end
def course_feedback_count
@ -632,48 +632,73 @@ module CoursesHelper
#获取课程动态
def get_course_activity courses, activities
@course_ids=activities.keys()
@bid_ids = []
days = Setting.activity_days_default.to_i
date_to ||= Date.today + 1
date_from = date_to - days-1.years
#原来课程动态计算当期时间前(一年+一月)的动态
# date_to ||= Date.today + 1
# #date_from = date_to - days-1.years
date_from = @course.created_at.to_date-days
#file_count
Attachment.where(container_id: @course_ids, container_type: Course).where("created_on>?", date_from).each do |attachment|
if attachment.is_public? || User.current.member_of_course?(@course) || User.current.admin?
activities[attachment.container_id]+=1
else
activities[attachment.container_id]
end
end
#message_count
#Board.where(course_id: @course_ids).each do |board|
# activities[board.course_id]+=board.messages.where("updated_on>?", date_from).count
#end
#message_count
Board.where(course_id: @course_ids).each do |board|
# activities[board.course_id]+=1
activities[board.course_id]+=board.messages.where("updated_on>?", date_from).count
countmessage = 0
# 课程人员退出课程后,之前在讨论区回帖不计入课程动态统计
board.messages.where("updated_on>?", date_from).each do |message|
if message.author.member_of_course?(@course)
countmessage+=1
end
end
activities[board.course_id]+=countmessage
end
#news
News.where(course_id: @course_ids).where("created_on>?",date_from).each do |news|
if news.author.member_of_course?(@course)
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
#homework_count
#HomeworkForCourse.where(course_id: @course_ids).each do |homework|
# @bid_ids<<homework.bid_id
# activities[homework.bid_id]+=Bid.where(id: @bid_ids).where("created_on>?",date_from).count
#feedback_count 留言目前有问题留待下一步处理
#JournalsForMessage.where(jour_id: @course_ids, jour_type: Course).each do |jourformess|
# activities[jourformess.jour_id]+=1
#end
#homework_count
HomeworkForCourse.where(course_id: @course_ids).each do |homework|
countbid=0
# @bid_ids<<homework.bid_id
Bid.where(id: homework.bid_id).where("created_on>?",date_from).each do |bid|
countbid+=1
end
activities[homework.course_id]+=countbid
end
#@bid_ids.each do |bid_id|
# activities[] +=Bid.where(id: bid_id ).where("created_on>?",date_from).count
#end
#poll_count
#Poll.where(polls_group_id: @course_ids, polls_type: Course, polls_status: 2||3).where("published_at>?",date_from).each do |poll|
# activities[poll.polls_group_id]+=1
#end
#end
# 动态数 + 1 ( 某某创建了该课程 )
# activities.each_pair { |key, value| activities[key] = value + 1 }
activities.each_pair { |key, value| activities[key] = value + 1 }
return activities
end
@ -759,7 +784,7 @@ module CoursesHelper
def visable_attachemnts_incourse course
result = []
course.attachments.each do |attachment|
if attachment.is_public? || User.current.member_of_course?(course)
if attachment.is_public? || User.current.member_of_course?(course) || User.current.admin?
result << attachment
end
end

View File

@ -44,7 +44,11 @@ module MembersHelper
# add by nwb
# 课程可添加的成员列表
def render_principals_for_new_course_members(course)
if params[:q] && params[:q] != ""
scope = Principal.active.sorted.not_member_of_course(course).like(params[:q])
else
scope = []
end
principals = paginateHelper scope,10
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals')

View File

@ -1,4 +0,0 @@
class DiscussDemo < ActiveRecord::Base
attr_accessible :title, :body
has_many_kindeditor_assets :assets, :dependent => :destroy
end

View File

@ -49,6 +49,7 @@ class JournalsForMessage < ActiveRecord::Base
acts_as_activity_provider :type => 'course_journals_for_messages',
:author_key => :user_id,
:permission => :view_course_journals_for_messages,
:timestamp => "#{self.table_name}.updated_on",
:find_options => {:include => :course }

View File

@ -6,4 +6,23 @@ class Poll < ActiveRecord::Base
has_many :poll_questions, :dependent => :destroy,:order => "#{PollQuestion.table_name}.question_number"
has_many :poll_users, :dependent => :destroy
has_many :users, :through => :poll_users #该文件被哪些用户提交答案过
# 添加课程的poll动态
# has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# after_create :act_as_activity
# acts_as_event :title => Proc.new {|o| "#{l(:label_my_message)} ##{o.id}: #{o.name}" },
# :description => :description,
# :author => :author,
# :url => Proc.new {|o| {:controller => 'poll', :action => 'show', :id => o.id}}
# acts_as_activity_provider :type => 'polls',
# :permission => :view_course_polls,
#:find_options => {:include => [:course, :author]},
#:timestamp => "#{self.table_name}.published_at",
# :author_key => :author_id
# def act_as_activity
# self.acts << Activity.new(:user_id => self.user_id)
# end
end

View File

@ -161,10 +161,15 @@ class CoursesService
#显示课程
def show_course(params,current_user)
course = Course.find(params[:id])
if course.school
work_unit = course.school.name
else
work_unit = get_user_work_unit course.teacher
end
unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?)
raise '403'
end
{:course => course,:img_url => url_to_avatar(course),:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course)}
{:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course)}
end
#创建课程
@ -373,6 +378,16 @@ class CoursesService
unless latest_bid.nil?
latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => l(:label_recently_updated_homework,:locale => get_user_language(current_user))}
end
# Time 2015-04-07 14:58:30
# Author lizanle
# Description 添加课程创建动态
if(User.find_by_id(CourseInfos.find_by_course_id(course.id).try(:user_id)))
create_user_name = User.find_by_id(CourseInfos.find_by_course_id(course.id).user_id).realname
latest_course_dynamics << {:type => 5,:time => course.created_at,:message =>l(:label_recently,:locale => get_user_language(current_user)) << create_user_name << l(:label_creat,:locale => get_user_language(current_user))}
end
#每个作业中的最新留言
messages = []
course.homeworks.each do |bid|

View File

@ -192,7 +192,7 @@ class UsersService
#raise @current_user.errors.full_message
#return @current_user
else
raise 'wrong password'
raise l(:notice_account_wrong_password,:locale => 'zh')
end
@current_user
end

View File

@ -17,23 +17,7 @@
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= 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;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
<%= if attachment.id.nil?
#待补充代码
else
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
end
%>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% end %>
</span>
<script type='text/javascript'>

View File

@ -25,13 +25,13 @@
</span>
<% project = project %>
<span class="add_attachment" style="font-weight:normal;">
<%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
<%= button_tag l(:button_browse), :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()',:class => 'sub_btn', :style => ie8? ? 'display:none' : '' %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',
:class => ie8? ? '' : 'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:style => 'display:none',
: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)),

View File

@ -11,7 +11,7 @@
<input type="text" name="bid[name]" id="bid_name" class="hwork_input" maxlength="<%= Bid::NAME_LENGTH_LIMIT%>" onkeyup="regex_bid_name();" value="<%= bid.name%>" >
<p id="bid_name_span" class="c_red" style="padding-left: 55px;"></p>
</li>
<li class="ml45">
<li class="ml45 mb10">
<label class="fl" >&nbsp;&nbsp;<%= l(:field_quote)%>&nbsp;&nbsp;</label>
<!--<textarea name="bid[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl"></textarea>-->
<% if edit_mode %>

View File

@ -1,4 +1,4 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= labelled_form_for @bid do |f| %>
<%= labelled_form_for @bid,:html => { :multipart => true } do |f| %>
<%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}",:f=>f,:edit_mode => true} %>
<% end %>

View File

@ -1,7 +1,6 @@
<% if @statue == 1%>
alert('启动成功');
$("#<%= @bid.id %>_start_anonymous_comment").remove();
$("#<%= @bid.id %>_anonymous_comment").append('<%= link_to "关闭匿评", alert_anonymous_comment_bid_path(@bid), remote: true, id:"#{@bid.id}_stop_anonymous_comment" %>');
$("#<%= @bid.id %>_start_anonymous_comment").replaceWith('<%= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_bid_path(@bid), remote: true, id:"#{@bid.id}_stop_anonymous_comment",:class => "fr mr10 work_edit")%>');
<% elsif @statue == 2 %>
alert('启动失败\n作业总数大于等于2份时才能启动匿评');
<% elsif @statue == 3%>

View File

@ -1,2 +1,2 @@
alert('关闭成功');
$("#<%= @bid.id %>_anonymous_comment").html('<a href="javascript:" style="background:#8e8e8e;">匿评结束</a>');
$("#<%= @bid.id %>_stop_anonymous_comment").replaceWith('<a class="fr pr_join_span mr10 span_wping_background" title="匿评结束">匿评结束</a>');

View File

@ -1,13 +1,7 @@
<script type="text/javascript">
function submitCoursesBoard()
{
if(regexSubject()&&regexContent()){$("#message-form").submit();}
}
</script>
<div id="add-message" class="add_frame" style="display:none;">
<% if User.current.logged? %>
<h3>
<%= link_to h(@board.name), course_board_path(@course, @board) %> &#187;
<%= link_to h(@board.name), course_board_path(@course, @board) %>
<%= l(:label_message_new) %>
</h3>
<div class="add_frame_header" >
@ -16,9 +10,8 @@
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => false, :id => 'message-form'} do |f| %>
<%= render :partial => 'messages/form_course', :locals => {:f => f} %>
<p>
<!--<input type="button" onclick="submitCoursesBoard();" class = "ButtonColor m3p10 h30" value="<%#= l(:button_submit)%>">-->
<a href="#" onclick="submitCoursesBoard();"class="ButtonColor m3p10"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'ButtonColor m3p10' %>
<a href="javascript:void(0)" onclick="submitCoursesBoard();"class="ButtonColor m3p10"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => '$("#add-message").hide(); return false;' ,:class => 'ButtonColor m3p10' %>
</p>
<% end %>
<div id="preview" class="wiki"></div>
@ -39,7 +32,11 @@
</div>
<% end %>
<div class="talk_top ml15">
<p class="fl"><%= l(:label_totle) %><span><%= @topic_count %></span><%= l(:label_course_momes_count) %></p>
<p class="fl">
<%= l(:label_totle) %>
<span><%= @topic_count %></span>
<%= l(:label_course_momes_count) %>
</p>
<%= link_to l(:label_message_new),
new_board_message_path(@board),
:class => 'problem_new_btn fl c_dorange' if User.current.logged? %>
@ -52,7 +49,7 @@
<div class="talk_txt fl">
<%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title: topic.subject.to_s,:class => "problem_tit fl fb c_dblue" %>
<% if topic.sticky? %>
<a href="#" class="talk_up fl c_red">置顶</a>
<a href="javascript:void(0)" class="talk_up fr c_red">置顶</a>
<% end %>
<br/>
<p>由<%= link_to topic.author,user_path(topic.author),:class => "problem_name" %>添加于<%= format_time(topic.created_on) %></p>

View File

@ -69,7 +69,7 @@
<span>添加于<%= format_time topic.created_on %></span>
</div>
</div>
<span class="talk_btn fr">回复<%= link_to (topic.replies_count), board_message_path(@board, topic), :style =>"color:#fff;" %></span>
<span class="talk_btn fr"><%= link_to (l(:label_reply) + topic.replies_count.to_s), board_message_path(@board, topic), :style =>"color:#fff;" %></span>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<% end %>

View File

@ -13,10 +13,12 @@
<%= form_for('new_form', :method => :post,
:url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor 'course_message',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;",
<%= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;",
:placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%>
<a href="#" class="grey_btn fr ml10">取&nbsp;&nbsp;消</a>
<a href="#" onclick='leave_message_editor.sync();$("#leave_message_form").submit();' class="blue_btn fr"> <%= l(:button_leave_meassge)%></a>
<a href="javascript:void(0)" class="grey_btn fr ml10 mt10">取&nbsp;&nbsp;消</a>
<a href="javascript:void(0)" onclick='leave_message_editor.sync();$("#leave_message_form").submit();' class="blue_btn fr mt10">
<%= l(:button_leave_meassge)%>
</a>
<% end %>
<% end %>
</div>

View File

@ -16,7 +16,7 @@
</span>
<div class="cl"></div>
<p>
<%= textilizable journal.notes%>
<%= journal.notes.html_safe %>
</p>
</div>
<div class="ping_disfoot">
@ -35,11 +35,6 @@
<% end %>
</div>
<div class="cl"></div>
<!--<span class="font_lighter" style="float: right">
<#%= l(:label_bids_published) %>&nbsp;
<#%= time_tag(journal.created_on).html_safe %>&nbsp;
<#%= l(:label_bids_published_ago) %>
</span>-->
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<% if reply_allow %>
<div id='<%= ids %>' class="respond-form">

View File

@ -1,6 +1,6 @@
<% @members.each do |member| %>
<li >
<%= link_to_user_header member.principal,false,:class => "w150 c_orange fl" %>
<%= link_to_user_header member.principal,true,:class => "w150 c_orange fl" %>
<span class="w150 fl">
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),

View File

@ -9,42 +9,4 @@
:locals => { :contest => @contest, :journals => @jour, :state => false}
%>
<% html_title(l(:label_user_response)) -%>
<script>
var W3CDOM = document.createElement && document.getElementsByTagName;
//window.onload = setMaxLength;
function setMaxLength() {
if (!W3CDOM) return;
var textareas = document.getElementsByTagName('textarea');
for (var i=0;i<textareas.length;i++) {
var textarea = textareas[i];
setMaxLengthItem(textareas[i]);
}
}
function setMaxLengthItem(textarea){
if (textarea.getAttribute('maxlength')) {
var counter = document.createElement('span');
counter.className = 'counter';
var counterClone = counter.cloneNode(true);
counterClone.innerHTML = '<span>0</span>/'+textarea.getAttribute('maxlength');
textarea.parentNode.insertBefore(counterClone,textarea.nextSibling);
textarea.relatedElement = counterClone.getElementsByTagName('span')[0];
textarea.onkeyup = textarea.onchange = checkMaxLength;
textarea.onkeyup();
}
}
function checkMaxLength() {
var maxLength = this.getAttribute('maxlength');
var currentLength = this.value.length;
if (currentLength > maxLength)
this.relatedElement.className = 'toomuch';
else
this.relatedElement.className = '';
this.relatedElement.firstChild.nodeValue = currentLength;
}
</script>
<% html_title(l(:label_course_feedback)) -%>

View File

@ -32,7 +32,7 @@
</script>
<div id="bid_description_<%= bid.id%>" class="news_description mt5">
<div id="bid_description_<%= bid.id%>_content">
<%= textAreailizable bid, :description %>
<%= bid.description.html_safe %>
</div>
</div>
<div class="news_foot c_red" id="bid_show_more_des_button<%= bid.id%>" onclick="bid_show_more_des(<%= bid.id%>);" style="cursor:pointer;display: none;">

View File

@ -1,16 +1,3 @@
<script src="/jquery.min.js"></script>
<script type="text/javascript" src="/javascripts/iPass.packed.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// to enable iPass plugin
$("input[type=password]").iPass();
// for the demo
$("#psw_btn").click(function() {
alert("密码: "+$("#course_course_password").val());
})
});
</script>
<div class="project_r_h02">
<h2 class="project_h2"><%= l(:permission_new_course)%></h2>
</div>
@ -37,8 +24,9 @@
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_new_course_password)%>&nbsp;&nbsp;</label>
<input type="text" style="display: none;">
<input type="password" name="course[password]" id="course_course_password" class="hwork_input02">
<a id="psw_btn" class="">显示明码</a>
<a id="psw_btn" href="javascript:void(0)">显示明码</a>
<div class="cl"></div>
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
</li>

View File

@ -1,4 +1,4 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<%= labelled_form_for @homework, :html => { :multipart => true }, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<%= render :partial => 'bids/new_homework_form', :locals => { :bid => @homework,:bid_id => "new_bid",:f => f,:edit_mode => false } %>
<% end %>

View File

@ -39,7 +39,8 @@
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_new_course_password)%>&nbsp;&nbsp;</label>
<input type="text" name="course[password]" id="course_course_password" class="hwork_input02" value="<%= @course.password%>">
<input type="password" name="course[password]" id="course_course_password" class="hwork_input02" value="<%= @course.password%>">
<a id="psw_btn" href="javascript:void(0)">显示明码</a>
<div class="cl"></div>
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
</li>

View File

@ -16,7 +16,7 @@
<span class="fl"> <%= l(:label_new_activity) %></span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url,:class => "problem_tit c_dblue fl fb"%>
<br />
<p class="mt5 break_word"><%= e.event_description %>
<p class="mt5 break_word"><%= e.event_description.html_safe %>
<br />
<%= l :label_activity_time %> <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %>
</p>

View File

@ -1,25 +0,0 @@
<h1 style="">文章列表</h1>
<div>
<table border="1px solid !important" >
<% @discuss_demo_list.each do |e| %>
<tr align="left" height="20">
<td width="30%" ><%= truncate(e.title,:length => 50) %></td>
<td align="center" width="60%">
<%= truncate(e.body,:length => 50) %> &nbsp;
</td>
<td style=" margin-right: 1" width="10%">
<%= link_to '查看文章',{:controller => 'discuss_demos',:action => 'show',:id=>e.id} %>
</td>
<td>
&nbsp;&nbsp;
<%= link_to '删除文章',discuss_demo_path(e.id), :method => :delete,:confirm => l(:text_are_you_sure) %>
</td>
</tr>
<tr height="20"></tr>
<tr height="20"></tr>
<% end %>
</table>
<% paginate @discuss_demo_list %>
<%= link_to '新建文章',new_discuss_demo_path %>
</div>

View File

@ -1,7 +0,0 @@
<%= javascript_include_tag src='/assets/kindeditor/kindeditor' %>
<h1>新建文章</h1>
<%= form_for @discuss_demo,:url => {:controller => 'discuss_demos',:action => "show",:id =>@discuss_demo.id, :method => :put} do |f| %>
<%= f.text_field :title %>
<%= f.kindeditor :body ,:owner_id => @discuss_demo.id%>
<%= f.submit :value=> '提交' %>
<% end %>

View File

@ -1,3 +0,0 @@
<h1><%= @discuss_demo.title %></h1>
<%= textAreailizable @discuss_demo.body %>
<%=link_to "返回首页",discuss_demos_path %>

View File

@ -22,10 +22,10 @@
</span>
</div>
<button name="button" class="sub_btn" onclick="_file.click()" onmouseover="this.focus()" type="button"><%= l(:label_browse)%></button>
<button name="button" class="sub_btn" onclick="_file.click()" onmouseover="this.focus()" style="<%= ie8? ? 'display:none' : ''%>" type="button" ><%= l(:label_browse) %></button>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',
:class => ie8? ? '':'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:style => ie8? ? '': 'display:none',

View File

@ -15,7 +15,7 @@
</div>
<div class="cl"></div>
<div class="for_img_thumbnails">
<% curse_attachments.sort.reverse.each do |file| %>
<% curse_attachments.each do |file| %>
<% if file.is_public? || User.current.member_of_course?(course) %>
<div class="re_con_box">
<div class="">

View File

@ -26,7 +26,10 @@
<tr>
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_at, topic.author %>
<span class="font_description2">
最后回复:<%=link_to_user topic.last_reply.try(:author) %>
<% author = topic.last_reply.try(:author)%>
<% if author%>
最后回复:<%=link_to_user author %>
<% end%>
</span>
<br />
</span></td>

View File

@ -56,6 +56,7 @@
<div class="N_con">
<%= form_for(HomeworkAttach.new, :method => :post,
:name => 'new_form',
:html => { :multipart => true },
:url => {:controller => 'homework_attach',
:action => 'create',
:user_id => User.current.id,

View File

@ -11,8 +11,10 @@
<ul style="padding:0 0; margin:0 0;display:inline;">
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;" class="loggedas_li">
<%=link_to_user(User.current)%>
<% hidden_non_project = Setting.find_by_name("hidden_non_project")
visiable = hidden_non_project && hidden_non_project.value == "0"%>
<ul class="sub_menu">
<% if @show_course == 1 %>
<% if @show_course == 1 && !visiable %>
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<% hasCourse=false %>
<% User.current.courses.each do |course| %>

View File

@ -53,7 +53,7 @@
<div class="sidebar-forums">
<div class="forums-line">
<div class="forums-title"><%= @forum.name %></div>
<div class="forums-description"><%= @forum.description %></div>
<div class="forums-description"><%= @forum.description.html_safe %></div>
</div>
<!--informations-->
<div class="formus-first-title" >创建人信息</div>

View File

@ -32,8 +32,10 @@
padding-left: 5px !important;
padding-right: 5px !important;
line-height: 1.9;
float: left;
}
.span_wping a:hover{ background-color:#03a1b3;}
.span_wping_background{background: #CCC !important;}
</style>
</head>
<body class="<%= h body_css_classes %>">
@ -149,7 +151,7 @@
<tr>
<td class="font_lighter_sidebar" colspan="2" style="padding-left: 8px;" title="<%= @bid.description %>">
<%= textilizable truncate(@bid.description, length: 200, omission: '...') %>
<%= @bid.description.html_safe %>
</td>
</tr>

View File

@ -84,7 +84,7 @@
<div class="sidebar-forums">
<div class="forums-line">
<div class="forums-title"><%= @forum.name %></div>
<div class="forums-description"><%= @forum.description %></div>
<div class="forums-description"><%= @forum.description.html_safe %></div>
</div>
<!--informations-->
<div class="formus-first-title" >创建人信息</div>

View File

@ -145,6 +145,7 @@
<%= f.text_area 'user_introduction', :rows => 3,
:cols => 65,
:placeholder => "#{l(:label_my_brief_introduction)}",
:maxlength => 200,
:style => "resize: none;",
:class => 'noline'%>
</td>

View File

@ -64,7 +64,7 @@
<%=h @memo.subject %>
</div>
<div class="memo-content" id="memo-content_div">
<%= textAreailizable(@memo,:content) %>
<%= @memo.content.html_safe %>
<p>
<% if @memo.attachments.any?%>
<% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %>

View File

@ -1,47 +1,22 @@
<script type="text/javascript">
// var flag = false;
// jQuery(document).ready(function($) {
// transpotUrl('#content');
// });
// function submit_message_replay()
// {
// regexContent();//onkeyup传给kindeditor用不上了所以只能放在这里
// if(flag)
// {
// message_content_editor.sync();//提交内容之前要sync不然服务器端取不到值
// $("#message_form").submit();
// }
// }
// function regexContent()
// {
// var content = message_content_editor.html();//$.trim($("#message_content").val());
// if(content.length ==0)
// {
// $("#message_content_span").text("<%= l(:label_reply_empty) %>");
// $("#message_content_span").css('color','#ff0000');
// flag = false;
// }
// else
// {
// $("#message_content_span").text("<%= l(:label_field_correct) %>");
// $("#message_content_span").css('color','#008000');
// flag = true;
// }
// }
</script>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_board) %></h2>
<h2 class="project_h2">
<%= l(:label_board) %>
</h2>
</div>
<div class="problem_main">
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(@topic.author),:width => '46',:height => '46'), user_path(@topic.author) %></div>
<div class="talk_txt fl">
<p class="problem_tit fl fb" ><%= link_to @topic.subject, course_boards_path(@topic.course),title: @topic.subject.to_s %></p>
<br/>
<p>由<%= link_to_user_header @topic.author,false,:class=> 'problem_name' %> 添加于<%= format_time(@topic.created_on) %></p>
<div class="ping_dispic">
<%= link_to image_tag(url_to_avatar(@topic.author),:width => '46',:height => '46'), user_path(@topic.author) %>
</div>
<div class="talk_txt fl">
<p class="problem_tit fl fb" >
<%= link_to @topic.subject, course_boards_path(@topic.course),title: @topic.subject.to_s %>
</p>
<br/>
<p>
由<%= link_to_user_header @topic.author,false,:class=> 'problem_name' %>
添加于<%= format_time(@topic.created_on) %>
</p>
</div>
<!-- <a class="talk_edit fr">删除</a><a class="talk_edit fr">编辑</a><a class="talk_edit fr">置顶</a> -->
<%#= watcher_link(@topic, User.current) %>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @topic},
@ -55,12 +30,12 @@
:class => 'talk_edit fr'
) if @message.course_destroyable_by?(User.current) %>
<div class="cl"></div>
<div class="talk_info mb10"><%= textAreailizable(@topic, :content) %></div>
<div class="talk_info mb10"><%= @topic.content.html_safe %></div>
<div class="talk_info mb10"><%= link_to_attachments_course @topic, :author => false %></div>
<!-- <a href="#" class=" link_file ml60">附件爱覅俄方if.zip(27.5kB)</a>-->
<div class="cl"></div>
<% if User.current.logged? %>
<%= toggle_link l(:button_reply), "reply", :focus => 'message_content',:class => 'talk_edit fr' %>
<%= toggle_link l(:button_reply), "reply", :focus => 'message_subject',:class => 'talk_edit fr' %>
<% else %>
<%= link_to l(:button_reply), signin_path,:class => 'talk_edit fr' %>
<% end %>
@ -118,11 +93,11 @@
<div id="reply" style="display:none;">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
<%= link_to l(:button_submit),"#",:onclick => 'course_board_submit_message_replay();' ,:class => "blue_btn fl c_white" ,:style=>"margin-left: 50px;"%>
<%= link_to l(:button_submit),"javascript:void(0)",:onclick => 'course_board_submit_message_replay();' ,:class => "blue_btn fl c_white" ,:style=>"margin-left: 50px;"%>
<% end %>
<div id="preview" class="wiki"></div>
</div>
<% end %>
<div class="cl"></div>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>

View File

@ -27,7 +27,10 @@
</li>
<li>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<label class="fl" >
<span class="c_red">*</span>&nbsp;
<%= l(:field_description) %>&nbsp;&nbsp;
</label>
<%= text_area :quote,:quote,:style => 'display:none' %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<% if replying %>

View File

@ -167,7 +167,7 @@
<tr>
<td class="comments">
<div class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;">
<%= textilizable message,:content,:attachments => message.attachments %>
<%= textAreailizable message,:content,:attachments => message.attachments %>
</div>
<%= link_to_attachments message, :author => false %>
</td>

View File

@ -1,7 +1,7 @@
$('#message_subject').val("<%= raw escape_javascript(@subject) %>");
$('#message_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
//$('#message_content').val("<#%= raw escape_javascript(@content) %>");
$('#quote_quote').html("<%= raw escape_javascript(@content) %>");
$('#quote_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
showAndScrollTo("reply", "message_content");
$('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight;

View File

@ -2,42 +2,23 @@
btn_tips = l(:label_news_notice)
label_tips = l(:label_course_news)
%>
<div class="project_r_h">
<h2 class="project_h2"><%= label_tips %></h2>
</div>
<div class="talk_top">
<p class="fl"><%= l(:label_total_news) %><span><%= @news_count %></span><%= l(:label_course_news_count) %></p>
<p class="fl">
<%= l(:label_total_news) %>
<span><%= @news_count %></span>
<%= l(:label_course_news_count) %>
</p>
<% if @course && User.current.allowed_to?(:manage_news, @course) %>
<%= link_to(btn_tips,new_course_news_path(@course),
:class => 'problem_new_btn fl c_dorange')%>
<%= link_to(btn_tips,new_course_news_path(@course),:class => 'problem_new_btn fl c_dorange')%>
<div class="cl"></div>
<% end %>
<div class="cl"></div>
</div>
<!-- <%# if @course && User.current.allowed_to?(:manage_news, @course) %>
<%#= link_to(btn_tips, new_course_news_path(@course),
:class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %>
<div id="add-news" class="add_frame" style="display:none;">
<%#= 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 => 'ButtonColor m3p10' %>
<%#= preview_link preview_news_path, 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
<%#= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'ButtonColor m3p10' %>
<%# end if @course %>
<div id="preview" class="wiki"></div>
</div>
<%# end %>-->
<div>
<% if @newss.empty? %>
<p class="nodata">
@ -49,10 +30,20 @@
<%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5">
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
<span class="fl"> <%= l(:label_release_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %><br />
<span class="fl">
<%= l(:label_release_news) %>
</span>
<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
<br />
<div class="cl mb5"></div>
<p id="news_description_<%= news.id %>" class="news_description mt5"><%= textAreailizable news.description %><br /> <%= l(:label_create_time) %> <%= format_time(news.created_on) %></p>
<div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div>
<p id="news_description_<%= news.id %>" class="news_description mt5">
<%= news.description.html_safe %>
</p>
<div class="news_foot c_red" style="cursor:pointer;display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>">
<%= l(:button_more)%>...
<span class="g-arr-down"></span>
</div>
<span class="fl"><%= l(:label_end_time)%><%= format_time(news.created_on)%></span>
</div>
<div class="cl"></div>
</div><!--problem_main end-->
@ -65,38 +56,8 @@
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<%# other_formats_links do |f| %>
<%#= f.link_to 'Atom', :url => {:course_id => @course, :key => User.current.rss_key} %>
<%# end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<% html_title(l(:label_course_news)) -%>
</div>
<script type='text/javascript'>
$(document).ready(function ($) {
$('.content-text-list').each(function () {
$(this).find('.delete_icon').hide();
$(this).mouseenter(function (event) {
$(this).find('.delete_icon').show();
});
$(this).mouseleave(function (event) {
$(this).find('.delete_icon').hide();
});
});
});
$(function(){
$('.news_description').each(function () {
if($(this).height() >= 38)
{
$('#news_foot_'+$(this).attr('id').replace('news_description_','')).css("display","block");
}
}
)
});
</script>

View File

@ -1,63 +1,7 @@
<script type="text/javascript">
function regexTitle()
{
var name = $("#news_title").val();
if(name.length ==0)
{
$("#title_notice_span").text("标题不能为空");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
else if(name.length <= 60)
{
$("#title_notice_span").text("填写正确");
$("#title_notice_span").css('color','#008000');
return true;
}
else
{
$("#title_notice_span").text("标题超过60个字符");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
}
function regexDescription()
{
var name = $("#news_description").val();
if(name.length ==0)
{
$("#description_notice_span").text("描述不能为空");
$("#description_notice_span").css('color','#ff0000');
$("#description_notice_span").focus();
return false;
}
else
{
$("#description_notice_span").text("填写正确");
$("#description_notice_span").css('color','#008000');
return true;
}
}
function submitNews()
{
news_description_editor.sync();
if(regexTitle() && regexDescription())
{
$("#news-form").submit();
}
}
function submitComment()
{
comment_editor.sync();
$("#add_comment_form").submit();
}
<script>
function clearMessage()
{
$("#comment_comments").val("");
$("#news_comment").html("<%= escape_javascript(hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none') %><%= escape_javascript(kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字")%>");
}
</script>
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
@ -77,8 +21,9 @@
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5">
<h4 class="r_txt_tit mb5"> <%=h @news.title %></h4>
<%#= watcher_link(@news, User.current) %>
<h4 class="r_txt_tit mb5">
<%=h @news.title %>
</h4>
<%= link_to(l(:button_edit),
edit_news_path(@news),
:class => 'talk_edit fr',
@ -86,7 +31,11 @@
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @course) %>
<%= delete_link(news_path(@news),:class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %>
<div class="cl"></div>
<div class="mb5"><%= textAreailizable(@news, :description) %><br /> <%= l(:label_create_time) %> <%= format_time(@news.created_on) %></div>
<div class="mb5">
<%= @news.description.html_safe %>
<br />
<%= l(:label_create_time) %> <%= format_time(@news.created_on) %>
</div>
<%= link_to_attachments_course @news %>
<!--<a href="#" class=" link_file">附件爱覅俄方if.zip(27.5kB)</a> -->
</div>
@ -97,13 +46,17 @@
<div class="msg_box">
<h4><%= l(:label_comment_add) %></h4>
<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %>
<div class="box" >
<div class="box" id="news_comment">
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%>
</div>
<p class="mt10">
<a href="#" class="grey_btn fr ml10" onclick="clearMessage();"><%= l(:label_cancel_with_space) %></a>
<a href="#" class="blue_btn fr" onclick="submitComment();"><%= l(:label_comment_with_space) %></a>
<a href="javascript:void(0)" class="grey_btn fr ml10" onclick="clearMessage();">
<%= l(:label_cancel_with_space) %>
</a>
<a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();">
<%= l(:label_comment_with_space) %>
</a>
</p>
<% end %>
</div>
@ -116,11 +69,15 @@
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author)%></div>
<div class="ping_discon">
<div class="ping_distop">
<%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %><span class="c_grey fr"><%= format_time(comment.created_on) %></span>
<%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %>
<span class="c_grey fr">
<%= format_time(comment.created_on) %>
</span>
<div class="cl"></div>
<p><%= textAreailizable(comment.comments) %></p>
<p><%= comment.comments.html_safe %></p>
</div>
<div class="ping_disfoot"><%= link_to_if_authorized_course image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
<div class="ping_disfoot">
<%= link_to_if_authorized_course image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
</div>

View File

@ -1,4 +1,6 @@
<h3><%= l(:label_settings) %></h3>
<h3 style="float: left;"><%=l(:label_settings)%></h3>
<%= link_to @text,settings_hidden_non_project_path,:id => "hidden_non_project",:style => "float: right;margin-right: 60px;margin-top: 9px;"%>
<div class="clear"></div>
<%= render_tabs administration_settings_tabs %>

View File

@ -0,0 +1,5 @@
<% if @notifiable.value == "0"%>
$("#hidden_non_project").replaceWith("<%= escape_javascript(link_to '显示非项目信息',settings_hidden_non_project_path,:id => 'hidden_non_project',:style => 'float: right;margin-right: 60px;margin-top: 9px;', :remote => true)%>");
<% else%>
$("#hidden_non_project").replaceWith("<%= escape_javascript(link_to '隐藏非项目信息',settings_hidden_non_project_path,:id => 'hidden_non_project',:style => 'float: right;margin-right: 60px;margin-top: 9px;', :remote => true)%>");
<% end%>

View File

@ -1,6 +1,9 @@
<%hidden_non_project = Setting.find_by_name("hidden_non_project")
visiable = hidden_non_project && hidden_non_project.value == "0"%>
<% unless visiable%>
<div class="linkother" style="margin-left: 30%; float: left">
<a href="http://<%= Setting.host_name%>" class="link_other_item"><%=l(:label_projects_management_platform)%></a>
<a href="http://<%= Setting.host_course%>" class="link_other_item"><%=l(:label_courses_management_platform)%></a>
<a href="http://<%= Setting.host_contest%>" class="link_other_item"><%=l(:label_contests_management_platform)%></a>
</div>
<% end%>

View File

@ -2014,6 +2014,8 @@ zh:
label_recently_updated_courseware: 最近更新了课件
label_no_courses: 您没有参与任何课程,请搜索课程、加入课程,或者创建课程吧!
label_commit_failed: 提交失败
label_recently: 最近被
label_creat: 创建
#api end
label_end_time: 截止时间
@ -2031,4 +2033,6 @@ zh:
modal_valid_unpassing: 该分班已经存在
mail_footer: 点击修改邮件发送设置
label_show_non_project: 显示非项目信息
label_hidden_non_project: 隐藏非项目信息

View File

@ -27,7 +27,6 @@
RedmineApp::Application.routes.draw do
resources :discuss_demos
#match '/discuss_demos/new',:to => 'discuss_demo#create',:via =>[:post]
#match '/discuss_demo/show',:to => 'discuss_demo#show'
mount Mobile::API => '/api'
@ -737,6 +736,7 @@ RedmineApp::Application.routes.draw do
match 'settings', :controller => 'settings', :action => 'index', :via => :get
match 'settings/edit', :via => [:get, :post]
match 'settings/plugin/:id', :to => 'settings#plugin', :via => [:get, :post], :as => 'plugin_settings'
match 'settings/hidden_non_project', :via => [:get, :post]
match 'sys/projects', :via => :get
match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post

View File

@ -266,6 +266,8 @@ repository_domain:
default: repository.trustie.net
please_chose:
default: 请选择
hidden_non_project:
default: 1
plugin_redmine_ckeditor:
serialized: true
default: --- !ruby/hash:ActiveSupport::HashWithIndifferentAccess

View File

@ -1,9 +0,0 @@
class CreateDiscussDemos < ActiveRecord::Migration
def change
create_table :discuss_demos do |t|
t.string :title
t.text :body
t.timestamps
end
end
end

View File

@ -137,6 +137,9 @@ Redmine::AccessControl.map do |map|
map.permission :paret_in_homework,{},:require => :member ,:belong_to_course => true
end
# map.course_module :polls do |map|
# map.permission :view_course_polls, {:polls => [:index,:show]},:require => :member, :belong_to_course => true
# end
map.course_module :boards do |map|
# map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member
@ -484,6 +487,7 @@ Redmine::Activity.map do |activity|
activity.register :course_messages, :default => false, :class_name => 'Message'
activity.register :homeworks, :class_name => 'Bid'
# activity.register :polls, :class_name => 'Poll'
end
Redmine::Search.map do |search|

View File

@ -195,7 +195,8 @@ function addInputFiles(inputEl) {
var aFilename = inputEl.value.split(/\/|\\/);
attachmentId = addFile(inputEl, { name: aFilename[ aFilename.length - 1 ] }, false);
if (attachmentId) {
$(inputEl).attr({ name: 'attachments[' + attachmentId + '][file]', style: 'display:none;' }).appendTo('#attachments_' + attachmentId);
$(inputEl).attr({ name: 'attachments[' + attachmentId + '][file]'}).hide();
$('#upload_file_count').html("已上传"+"<span id=\"count\">"+1+"</span>"+"个文件");
}
}

View File

@ -158,7 +158,7 @@ function regexTitle()
{
$("#title_notice_span").text("标题不能为空");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
$("#news_title").focus();
return false;
}
else if(name.length <= 60)
@ -171,7 +171,7 @@ function regexTitle()
{
$("#title_notice_span").text("标题超过60个字符");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
$("#news_title").focus();
return false;
}
}
@ -214,6 +214,12 @@ function submitFocus(obj)
$(obj).focus();
}
function submitComment()
{
comment_editor.sync();
$("#add_comment_form").submit();
}
/////////////////////////////////////////////////课程讨论区
function course_board_submit_message_replay()
{
@ -226,12 +232,12 @@ function course_board_submit_message_replay()
function MessageReplayVevify() {
var content = message_content_editor.html();//$.trim($("#message_content").val());
if (content.length == 0) {
$("#message_content_span").text("<%= l(:label_reply_empty) %>");
$("#message_content_span").text("回复不能为空");
$("#message_content_span").css('color', '#ff0000');
return false;
}
else {
$("#message_content_span").text("<%= l(:label_field_correct) %>");
$("#message_content_span").text("填写正确");
$("#message_content_span").css('color', '#008000');
return true;
}
@ -404,3 +410,27 @@ $(function(){
$(document).ready(function () {
$("#RSide").css("min-height",$("#LSide").height()-30);
});
// 日历选择日期后关闭
function regexDeadLine()
{
('#ui-datepicker-div').hide;
}
//新建、修改课程明码显示
$(function(){
$("#psw_btn").click(function() {
alert("密码: "+$("#course_course_password").val());
});
});
//课程通知更多按钮显示
$(function(){
$('.news_description').each(function () {
if($(this).height() >= 38)
{
$('#news_foot_'+$(this).attr('id').replace('news_description_','')).css("display","block");
}
}
)
});

View File

@ -0,0 +1,8 @@
// ---------------------------------------------------------------------- //
// iPass - Iphone-like masked password input
// version 1.0
// author: pixelboi8 (pixelboi8@gmail.com)
// created: 12/12/2010
// ---------------------------------------------------------------------- //
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(8($){$.1e.1l=8(D){2 c={\'I\':1r,\'1a\':1q,\'e\':\'%1w\'};5(D){$.1p(c,D)}2 v=[];2 l=[];2 T=1n 1s(\'[^\'+c[\'e\']+\']\',\'1v\');2 i=0;4.W(8(6){2 G=\'-\'+6;2 t=$(4);2 3=4.3;2 q=4.q;2 h=3+G;2 11=3+G;5(!3||!q){1t("1m 1d 1c \'3\' 1b \'q\' 1f w 1g!");12 16}$(\'<a 3="\'+h+\'" q="\'+11+\'" 1i="Q" 1h="1u" />\').1M(t);2 A=$(\'#\'+h);2 g=$(\'#\'+h)[0];5(4.x){g.x=4.x}5(4.F){g.F=4.F}5(4.E){g.E=4.E}5(4.z&&4.z!=\'-1\'){g.z=4.z}5(4.N){g.N=4.N}5(4.H){g.H=4.H}5(4.B){g.B=4.B}5(4.L){g.L=4.L}4.x=\'\';4.B=\'\';t.1O();A.Z(\'1J\',8(){2 m=A.j();v[6]=V(8(){M(6,3,h,m)},c[\'I\'])});A.Z(\'1A\',8(){e(6,h);18(v[6])});$(\'X\').W(8(){5(4.J==3){4.J=h}n 5(t[0].13.1y.1C()==\'X\'){t[0].13.J=h}})});M=8(6,r,3,m){2 o=$(\'#\'+3).j();5(o!=m){19(6,r,3)}n{e(6,3)}m=o;v[6]=V(8(){M(6,r,3,m)},c[\'I\'])};19=8(6,r,3){2 7=P(3);2 K=16;2 p=$(\'#\'+3);2 C=$(\'#\'+r);2 9=p.j().17(\'\');2 d=C.j().17(\'\');5(l[6]){18(l[6]);l[6]=10}w(i=0;i<9.f;i++){5(9[i]!=d[i]){5(9[i]!=u(c[\'e\'])){d.O(i,0,9[i])}n{d[i]=d[i]}}n{d.O(i,0,9[i])}}5(9.f<d.f){d.O(7.k,d.f-9.f,\'\')}w(i=0;i<9.f;i++){5(9[i]!=u(c[\'e\'])){K=i}}w(i=0;i<9.f;i++){5(i<K){9[i]=u(c[\'e\'])}}p.j(9.15(\'\'));C.j(d.15(\'\'));R(3,7)};e=8(6,3){2 7=P(3);2 p=$(\'#\'+3);2 o=p.j();5(!l[6]&&o.1K(T)!=10){l[6]=V(8(){p.j(o.1j(T,u(c[\'e\'])));R(3,7)},c[\'1a\'])}};P=8(3){2 a=$(\'#\'+3)[0];2 7={k:0,s:0};5(a.S){7.k=a.1B;7.s=a.1D}n 5(a.y){2 Y=1H.b.1Q().1E();2 b=a.y();2 U=b.1F();b.1G(Y);U.1z(\'1I\',b);7.k=U.Q.f;7.s=7.k+b.Q.f}12 7};R=8(3,7){2 a=$(\'#\'+3)[0];5(a.S){a.S(7.k,7.s)}n 5(a.y){2 b=a.y();b.1L(1x);b.1N(\'14\',7.s);b.1k(\'14\',7.k);b.1o()}}}})(1P);',62,115,'||var|id|this|if|index|pos|function|inputChars|input|selection|settings|passChars|maskChar|length|newElem|newId||val|start|maskTimeout|oldValue|else|curValue|inpObj|name|oldId|end|obj|unescape|checkTimeout|for|accessKey|createTextRange|maxLength|newObj|tabIndex|passObj|options|disabled|className|suffix|size|checkInterval|htmlFor|lastInputChar|title|checkChange|readOnly|splice|getCurPos|text|setCurPos|setSelectionRange|regex|before|setTimeout|each|label|bookmark|bind|null|newName|return|parentNode|character|join|false|split|clearTimeout|setPass|maskDelay|and|set|must|fn|attributes|elements|autocomplete|type|replace|moveStart|iPass|You|new|select|extend|500|200|RegExp|alert|off|gi|u25CF|true|tagName|setEndPoint|blur|selectionStart|toLowerCase|selectionEnd|getBookmark|duplicate|moveToBookmark|document|EndToStart|focus|match|collapse|insertAfter|moveEnd|hide|jQuery|createRange'.split('|'),0,{}))

View File

@ -55,7 +55,7 @@ a:hover.problem_pic{border:1px solid #64bdd9;}
.problem_txt{ width:610px; margin-left:10px; color:#777777;word-break: break-all;word-wrap: break-word;}
a.problem_name{ color:#ff5722;}
a:hover.problem_name{ color:#d33503;}
a.problem_tit{ color:#0781b4; width:430px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
a.problem_tit{ color:#0781b4; max-width:430px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
a:hover.problem_tit{ color:#09658c; }
.problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;}
/****翻页***/
@ -175,7 +175,7 @@ a:hover.work_edit{color: #fff; background: #64bdd9;}
.wzan a{ display: block;}
a.wzan_img{background:url(images/pic_zan.png) 0 -59px no-repeat; display:block; height:31px; width:30px; color:#fff;}
a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
.msg_box{ width:670px; height:200px; border-bottom:1px dashed #CCC; padding-top:10px;}
.msg_box{ width:670px; height:205px; border-bottom:1px dashed #CCC; padding-top:10px;}
.msg_box h4{ }
.msg_box textarea{width:658px;height:90px;padding:5px;overflow:hidden;background-color: #ffffff; border:1px solid #CCC; margin:5px 0px; color:#666; font-size:12px; }
/*.msg_box a{ float:right; display:block; width:50px; height:22px; background:#15bccf; padding-top:3px; color:#fff; margin-left:10px; text-align:center; margin-top:5px; }*/
@ -243,7 +243,7 @@ a:hover.tijiao{ background:#0f99a9;}
.members_left ul li a{ float:left; text-align:center;}
.members_left ul li span{ float:left; text-align:center; color:#484747;}
.w150{ text-align:center; width:150px;}
.w150{ text-align:center; width:150px;min-height: 10px;}
.f_b{ font-weight: bold;}
.members_right label{ margin-left:15px;}
.N_search{ height:20px; border:1px solid #999;}
@ -316,6 +316,7 @@ a:hover.st_img { border:1px solid #1c9ec7; }
.st_boxlist ul li a span{ color:#1c9ec7;}
.st_boxlist ul li a:hover span{ color:#ff8e15;}
.ml50{ margin-left:50px;}
.ml56{ margin-left:56px !important;}
.ml358{ margin-left:358px;}
.ml258{ margin-left:254px;}
.ml65{ margin-left:65px;}
@ -450,6 +451,23 @@ a.link_file_board{ background:url(../images/pic_file.png) 0 3px no-repeat !impor
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
}
blockquote {
/* font-style: italic; */
border-left: 1px solid #e0e0e0;
border-right: 1px solid #e0e0e0;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
padding-left: 0.6em;
padding-top: 0.6em;
padding-right: 0.6em;
padding-bottom: 0.6em;
margin-left: 1.4em;
margin-right: 0.4em;
border-radius: 4px;
font-family: "Microsoft YaHei";
background: url('../images/requirements/reference.jpg');
}