diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 291593fc5..c8518e8a3 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -79,13 +79,12 @@ class BoardsController < ApplicationController end end end - + # 更新@消息为已读 @project.boards.each do |board| board.messages.each do |m| User.current.at_messages.unviewed('Message', m.id).each {|x| x.viewed!} end end - elsif @course query_course_messages = @board.messages query_course_messages.each do |query_course_message| @@ -106,43 +105,19 @@ class BoardsController < ApplicationController @is_new = params[:is_new] @topic_count = @board ? @board.topics.count : 0 if @project - @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] - #现在发布帖子的时候置顶功能已经没有了。所以取消这个置顶排序 #{Message.table_name}.sticky DESC, - @topics = @board.topics. - reorder("#{Message.table_name}.created_on desc"). - includes(:last_reply). - limit(@topic_pages.per_page). - offset(@topic_pages.offset). - - preload(:author, {:last_reply => :author}). - all + if @board + limit = 10; + @topic_count = @board.topics.count(); + @topic_pages = (params[:page] ? params[:page].to_i + 1 : 0) *10 + @topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) desc"). + limit(limit).offset(@topic_pages).includes(:last_reply). + preload(:author, {:last_reply => :author}).all(); + else + @topics = []; + end elsif @course - # - # board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc"). - # includes(:last_reply). - # # limit(@topic_pages.per_page). - # # offset(@topic_pages.offset). - # - # preload(:author, {:last_reply => :author}). - # all : [] - # @topics = paginateHelper board_topics,10 if (@board) limit = 10; - #pageno = params[:page]; - #if(pageno == nil || pageno=='') - # dw_topic = nil; - # if( params[:parent_id]!=nil && params[:parent_id]!='' ) - # dw_topic = @board.topics.where(id:params[:parent_id]).first(); - # end - # if( dw_topic != nil ) - # dw_count = @board.topics.where('(sticky>?) or (sticky=? and created_on>?)',dw_topic.sticky,dw_topic.sticky,dw_topic.created_on).count(); - # dw_count = dw_count+1; - # pageno = dw_count%10==0 ? (dw_count/limit) : (dw_count/limit+1) - # end - #end - #if(pageno == nil || pageno=='') - # pageno=1; - #end @topic_count = @board.topics.count(); @topic_pages = (params[:page] ? params[:page].to_i + 1 : 0) *10 @topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) desc"). diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index f4ad88757..543521e0f 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -270,7 +270,12 @@ class MessagesController < ApplicationController if params[:is_board] redirect_to project_boards_url(@project) else - redirect_to board_message_url(@board, @topic, :r => @reply) + if @message.parent + redirect_to board_message_url(@board, @message.parent, :r => r) + else + redirect_to project_board_url(@project, @board) + end + # redirect_to board_message_url(@board, @topic, :r => @reply) end elsif @course if params[:is_board] diff --git a/app/models/board.rb b/app/models/board.rb index 67d59e599..b66719edf 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -19,6 +19,7 @@ class Board < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :project,:touch => true belongs_to :course,:touch=>true + belongs_to :org_subfield, :touch => true has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC" has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC" belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index 6a31203b0..0747114ca 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -4,7 +4,22 @@ class OrgSubfield < ActiveRecord::Base has_many :files has_many :org_subfield_messages, :dependent => :destroy has_many :messages, :through => :org_subfield_messages + has_many :boards, :dependent => :destroy acts_as_attachable + after_create :create_board_sync + # 创建资源栏目讨论区 + def create_board_sync + @board = self.boards.build + #self.name=" #{l(:label_borad_course) }" + @board.name = " #{l(:label_borad_org_subfield) }"#self.name + @board.description = self.name.to_s + @board.project_id = -1 + if @board.save + logger.debug "[OrgSubfield Model] ===> #{@board.to_json}" + else + logger.error "[OrgSubfield Model] ===> Auto create board when org_subfield saved, because #{@board.full_messages}" + end + end def project end diff --git a/app/views/attachments/_form_course.html.erb b/app/views/attachments/_form_course.html.erb index 348c5339d..6d921903d 100644 --- a/app/views/attachments/_form_course.html.erb +++ b/app/views/attachments/_form_course.html.erb @@ -4,10 +4,10 @@ <% container.saved_attachments.each_with_index do |attachment, i| %> - <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> - <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> - <%= l(:field_is_public)%>: - <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly=>'readonly')%> + <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + + <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> @@ -17,10 +17,10 @@ <% container.attachments.each_with_index do |attachment, i| %> - <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> - <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> - <%= l(:field_is_public)%>: - <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly=>'readonly')%> + <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + + <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> diff --git a/app/views/attachments/_form_project_new.html.erb b/app/views/attachments/_form_project_new.html.erb new file mode 100644 index 000000000..09a1ea847 --- /dev/null +++ b/app/views/attachments/_form_project_new.html.erb @@ -0,0 +1,77 @@ + +<% if defined?(container) && container && container.saved_attachments %> + <% if isReply %> + <% container.saved_attachments.each_with_index do |attachment, i| %> + + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> + + <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + + <% end %> + <% else %> + <% container.attachments.each_with_index do |attachment, i| %> + + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> + + <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + + <% end %> + <% end %> +<% end %> + + + +<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> + +<%#= button_tag "#{l(:button_browse)}", :type=>"button", :onclick=>"file#{container.id}.click()",:class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> + <% id ="file#{container.id}"%> + 上传附件 + <%= file_field_tag 'attachments[dummy][file]', + :id => "file#{container.id}", + :class => 'file_selector', + :multiple => true, + :onchange => "addInputFiles_board(this, '#{container.id}');", + :style => 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :delete_all_files => l(:text_are_you_sure_all), + :lebel_file_uploding => l(:lebel_file_uploding), + :containerid => "#{container.id}" + } %> + <% if container.nil? %> + <%= l(:label_no_file_uploaded)%> + <% end %> + + + +<% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> +<% end %> + + diff --git a/app/views/boards/_project_new.html.erb b/app/views/boards/_project_new.html.erb new file mode 100644 index 000000000..44895a48e --- /dev/null +++ b/app/views/boards/_project_new.html.erb @@ -0,0 +1,65 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> + +<%= error_messages_for 'message' %> +
+
+
+
+ +

+
+ +
+
+
\ No newline at end of file diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 8a11d2859..3dac2a3d5 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -8,7 +8,7 @@ $("#subjectmsg").text(""); document.getElementById("message_sticky").checked=false; document.getElementById("message_locked").checked=false; - $("#topic_attachments").html("<%= escape_javascript(render :partial => 'attachments/form_course', :locals => {:container => Message.new, :isReply => @isReply})%>"); + $("#topic_attachments").html("<%= escape_javascript(render :partial => 'attachments/form_project_new', :locals => {:container => Message.new, :isReply => @isReply})%>"); message_content_editor.html(""); $("#topic_editor").toggle(); } @@ -21,98 +21,13 @@
-
- 项目讨论区 -
+
<%= l(:label_borad_project) %>
<% if User.current.logged? %> <%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, - :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> - <%#= render :partial => 'project_new_topic', :locals => {:f => f, :topic => @message, :edit_mode => false, :course => @board.course} %> - <%= render :partial => 'project_new_topic', :locals => {:f => f, :topic => @message, :edit_mode => false, :project => @board.project} %> + :html => {:nhname=>'form',:multipart => true, :id => 'message-form-project'} do |f| %> + <%= render :partial => 'project_new', :locals => {:f => f, :topic => @message, :edit_mode => false, :project => @board.project} %> <% end %> <% end %> <%= render :partial=> 'project_show_detail',:locals =>{:topics => @topics, :page => 0} %>
- - - - - - - \ No newline at end of file diff --git a/app/views/boards/_project_show_detail.html.erb b/app/views/boards/_project_show_detail.html.erb index 9194f48a2..8fb663aff 100644 --- a/app/views/boards/_project_show_detail.html.erb +++ b/app/views/boards/_project_show_detail.html.erb @@ -1,70 +1,71 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor" %> -<% end %> - - -<% if topics%> - <% topics.each do |topic| %> - - <% if topic %> - <%= render :partial => 'users/project_message', :locals => {:activity => topic,:user_activity_id =>topic.id} %> - <% end %> - <% end %> - - <% if topics.count == 10 %> -
展开更多<%= link_to "", boards_topic_path(@board, :project_id => @board.project.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %>
- <% end %> -<% end%> - - \ No newline at end of file +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag "init_activity_KindEditor" %> +<% end %> + +<% if topics%> + <% topics.each do |topic| %> + + <% if topic %> + <%= render :partial => 'users/project_message', :locals => {:activity => topic, :user_activity_id => topic.id} %> + <% end %> + <% end %> + + <% if topics.count == 10 %> + + <%= link_to "点击展开更多", boards_topic_path(@board, :project_id => @board.project.id ,:page => page), :id => "show_more_project_topic",:remote => "true",:class => "loadMore mt10 f_grey"%> + <% end %> +<% end%> + + diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 5ae3459a5..89f43e0d6 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -32,12 +32,11 @@ <% end %> - - <% if @project %> - <%= render :partial => 'project_show', locals: {project: @project} %> - <% elsif @course %> - <%= render :partial => 'course_show', :locals => {:topics => @topics, :page => 0, :course => @course} %> - <% end %> +<% if @project %> + <%= render :partial => 'project_show', locals: {:topics => @topics, :page => 0, project: @project} %> +<% elsif @course %> + <%= render :partial => 'course_show', :locals => {:topics => @topics, :page => 0, :course => @course} %> +<% end %> -
-
-
- <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> -
-
- <% if @topic.author.id == User.current.id%> - - <%end%> -
- 主题: <%= @topic.subject%> +
+
+
+
+ <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
-
+
+ <% if @topic.author.id == User.current.id%> + + <%end%> + +
-
- <% if @topic.try(:author).try(:realname) == ' ' %> - <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% else %> - <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% end %> -
-
<%= format_time( @topic.created_on)%>
-
-
- <%= @topic.content.html_safe%> +
+ <% if @topic.try(:author).try(:realname) == ' ' %> + <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
+
<%= format_time( @topic.created_on)%>
+
+
+ <%= @topic.content.html_safe%> +
+
+
+ <%= link_to_attachments_course @topic, :author => false %> +
-
- <%= link_to_attachments_course @topic, :author => false %> -
-
-
-
- <% unless @replies.empty? %> -
-
回复(<%=@reply_count %>)
-
- -
-
- <% @replies.each_with_index do |reply,i| %> - -
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> -
-
-
- <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% end %> -
-
- <%= reply.content.html_safe%> +
+
+ <% @replies.each_with_index do |reply,i| %> + +
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
-
- <%= format_time(reply.created_on) %> - -
-
- <% end %> -
- - <% end %> -
- <% if !@topic.locked? && authorize_for('messages', 'reply') %> -
- -
-
- <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %> - <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> - <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'project_board_cancel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %> - <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'project_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %> <% end %> +
+ + <% end %> +
+ <% if !@topic.locked? && authorize_for('messages', 'reply') %> +
+
+
+ <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %> + <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> + <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'project_board_cancel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %> + <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'project_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %> + <% end %> +
+
-
- <% end %> + <% end %> +
-
\ No newline at end of file +
diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 1eecc6b18..b9ebc2135 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -16,15 +16,20 @@
<% if activity.parent_id.nil? %> - <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey" - %> + <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey fl" %> <% else %> - <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey" - %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey fl" %> <% end %> + <% if activity.sticky == 1%> + 置顶 + <% end%> + <% if activity.locked %> +        + <% end%> +
- 时间:<%= format_time(activity.created_on) %> + 发帖时间:<%= format_time(activity.created_on) %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 230532d71..e4a23373d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1728,6 +1728,7 @@ zh: label_hot_project: '热门项目' label_borad_project: 项目讨论区 label_borad_course: 课程讨论区 + label_borad_org_subfield: 资源栏目讨论区 view_borad_course: 课程讨论 label_memo_create_succ: 发布成功 label_memo_create_fail: 发布失败 diff --git a/db/migrate/20151230015225_add_quotes_to_messages.rb b/db/migrate/20151230015225_add_quotes_to_messages.rb new file mode 100644 index 000000000..4e19725d5 --- /dev/null +++ b/db/migrate/20151230015225_add_quotes_to_messages.rb @@ -0,0 +1,4 @@ +class AddQuotesToMessages < ActiveRecord::Migration + def change + end +end diff --git a/db/migrate/20151230015410_add_org_subfield_id_to_boards.rb b/db/migrate/20151230015410_add_org_subfield_id_to_boards.rb new file mode 100644 index 000000000..853238813 --- /dev/null +++ b/db/migrate/20151230015410_add_org_subfield_id_to_boards.rb @@ -0,0 +1,5 @@ +class AddOrgSubfieldIdToBoards < ActiveRecord::Migration + def change + add_column :boards, :org_subfield_id, :integer + end +end diff --git a/db/migrate/20151230015904_set_board_for_org_subfields.rb b/db/migrate/20151230015904_set_board_for_org_subfields.rb new file mode 100644 index 000000000..cad6526a0 --- /dev/null +++ b/db/migrate/20151230015904_set_board_for_org_subfields.rb @@ -0,0 +1,11 @@ +# encoding: utf-8 +class SetBoardForOrgSubfields < ActiveRecord::Migration + def up + OrgSubfield.where("field_type='Post'").each do |field| + Board.create(:org_subfield_id => field.id, :name => "资源栏目讨论区", :project_id => -1, :description => field.name) + end + end + + def down + end +end diff --git a/public/javascripts/project.js b/public/javascripts/project.js index cc679847a..24e864780 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -551,4 +551,63 @@ function issueEditShow(){ function issueDetailShow(){ $("#issue_edit").hide(); $("#issue_detail").show(); -} \ No newline at end of file +} + +//项目讨论区提交 +function regexTopicSubject() { + var name = $("#message_subject").val(); + if(name.length ==0) + { + $("#subjectmsg").text("标题不能为空"); + $("#subjectmsg").css('color','#ff0000'); + $("#message_subject").focus(); + return false; + } + else if(name.length <= 255) + { + $("#subjectmsg").text("填写正确"); + $("#subjectmsg").css('color','#008000'); + return true; + } + else + { + $("#subjectmsg").text("标题超过255个字符"); + $("#subjectmsg").css('color','#ff0000'); + $("#message_subject").focus(); + return false; + } +} + +function regexTopicDescription() +{ + var name = message_content_editor.html(); + if(message_content_editor.isEmpty()) + { + $("#message_content_span").text("描述不能为空"); + $("#message_content_span").css('color','#ff0000'); + return false; + } + else if(name.length >=6000){ + $("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)"); + $("#message_content_span").css('color','#ff0000'); + return false; + } + else + { + $("#message_content_span").text("填写正确"); + $("#message_content_span").css('color','#008000'); + return true; + } +} +function submit_topic_project() +{ + if(regexTopicSubject() && regexTopicDescription()) + { + message_content_editor.sync(); + $("#message-form-project").submit(); + } +} + +function reset_topic(){ + +} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index c9d303f1d..a60198593 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1094,4 +1094,51 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c .weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;} .upload_img img{max-width: 100%;} -.table_maxWidth table {max-width: 642px;} \ No newline at end of file +.table_maxWidth table {max-width: 642px;} + +/*新讨论区*/ +select.InputBox, input.InputBox, textarea.InputBox {border: 1px solid #D9D9D9;color: #888;height: 28px;line-height: 28px;padding-left: 5px;font-size: 14px;} +.w713 {width: 713px;} +a.BlueCirBtnMini{ display:block;width:40px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #269ac9; color:#269ac9; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} +a.AnnexBtn{ background: url(images/homepage_icon2.png) 0px -343px no-repeat !important; width:70px; height:20px; display:block; padding-left:20px; color:#888888;} +a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;} +.sticky_btn_cir{ background:#269ac9; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} +.locked_btn_cir{background: url("../images/locked.png") 0 0 no-repeat; cursor: default;} +/*讨论区内部样式*/ +.postDetailContainer {padding:15px; border:1px solid #dddddd; background-color:#ffffff;} +.postlabel {background-color:#edf1f2; color:#888888; padding:2px 5px; float:left; margin-bottom:5px;} +.postRightContainer {width:718px; border:1px solid #dddddd; padding:15px; background-color:#ffffff; float:left; margin-bottom:10px;} +.postDetailBanner {height:30px; width:720px; border-bottom:1px solid #efefef;} +.postDetailRow {width:720px; border-bottom:1px solid #efefef; padding:15px 0;} +.postDetailPortrait {width:50px; height:50px; float:left; margin-right:15px;} +.postDetailWrap {width:580px; float:left;} +.postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} +.postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} +.postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} +.postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} +.postDetailDate {color:#888888; font-size:12px; float:left;} +.postDetailReply { margin-top:28px; color:#888888; float:right;} +a.postReplyIcon {background:url(images/post_image_list.png) -40px 2px no-repeat; width:18px; height:18px; float:left;} +a.postReplyIcon:hover {background:url(images/post_image_list.png) -40px -29px no-repeat;} +.postDetailInput {width:713px; height:28px; border:1px solid #d9d9d9; outline:none !important;} +.postAttIcon {background:url(images/post_image_list.png) 0px -91px no-repeat; width:16px; height:16px; padding-left:20px;} +.postAttIcon:hover {background:url(images/post_image_list.png) 0px -113px no-repeat;} +.postThemeContainer {width:720px;} +.postThemeWrap {width:655px; float:left;position: relative} +.postLikeIcon {background:url(images/post_image_list.png) 0px -42px no-repeat ;float:right; padding-left:18px; margin-top:3px;} +.postLikeIcon:hover {background:url(images/post_image_list.png) 0px -64px no-repeat ;} +a.AnnexBtn{ background: url(images/homepage_icon2.png) 0px -343px no-repeat !important; width:70px; height:20px; display:block; padding-left:20px; color:#888888;} +a:hover.AnnexBtn{background: url(images/homepage_icon2.png) -90px -343px no-repeat !important; color:#3598db;} +.postEdit {background:url(images/post_image_list.png) 0px -94px no-repeat; width:18px; height:18px; display:block; float:left;} +.postDelete {background:url(images/post_image_list.png) -42px -93px no-repeat; width:18px; height:18px; display:block; float:right;} +.pageBanner {width:968px; margin:0px auto; border:1px solid #dddddd; background-color: #FFF; padding: 10px 15px; float:left;} +.homepagePostReplyInput {width:543px; height:33px; max-width:543px; max-height:33px; border:1px solid #d9d9d9; outline:none;} +.postRouteContainer {padding:10px 15px; background-color:#ffffff; border:1px solid #dddddd; margin-top:10px; font-size:14px;} +a.postRouteLink {font-weight:bold; color:#484848;} +a.postRouteLink:hover {text-decoration:underline;} +.homepagePostSetting ul li:hover ul {display:block;} + +.ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} +.ReplyToMessageInputContainer {width:582px; float:left;} +a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;} +a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;}