Conflicts:
	db/schema.rb
This commit is contained in:
sw 2015-09-08 08:50:00 +08:00
commit 3b24bb375a
14 changed files with 226 additions and 35 deletions

View File

@ -800,11 +800,13 @@ class UsersController < ApplicationController
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page * 10) @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page * 10)
when "project_message" when "project_message"
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10) @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10)
when "current_user"
@user_activities = UserActivity.where("user_id = #{User.current.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('created_at desc').limit(10).offset(@page * 10)
else else
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10)
end end
else else
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10)
end end
# @user_activities = paginateHelper @user_activities,500 # @user_activities = paginateHelper @user_activities,500
@type = params[:type] @type = params[:type]

View File

@ -19,6 +19,7 @@ class CourseActivity < ActiveRecord::Base
user_activity.act_type = self.course_act_type user_activity.act_type = self.course_act_type
user_activity.container_type = "Course" user_activity.container_type = "Course"
user_activity.container_id = self.course_id user_activity.container_id = self.course_id
user_activity.user_id = self.user_id
user_activity.save user_activity.save
end end
end end

View File

@ -54,7 +54,7 @@
<%=@count %> <%=@count %>
</td> </td>
<td align="center"> <td align="center">
<%=format_date(user.last_login_on) %> <%=format_time(user.last_login_on) %>
</td> </td>
<td align="center"> <td align="center">
<%=user.id %> <%=user.id %>

View File

@ -24,16 +24,24 @@
if(email == "") if(email == "")
{ {
$("#valid_email").text("<%= l(:label_input_email_blank)%>"); $("#valid_email").text("<%= l(:label_input_email_blank)%>");
return false;
} }
else if (filter.test(email)) { else if(!filter.test(email))
$("#valid_email").html(""); {
return true; $("#valid_email").text("<%= l(:label_email_format_error)%>");
return false;
}
else if(email.split('@')[0].length >= 20)
{
$("#valid_email").text("邮箱名过长,最长为20个字符");
return false;
} }
else else
{ {
$("#valid_email").text("<%= l(:label_email_format_error)%>"); $("#valid_email").text("");
return true;
} }
return false;
} }
function senderEmail(obj) function senderEmail(obj)

View File

@ -130,4 +130,18 @@
</div> </div>
<% end %> <% end %>
</div> </div>
</div> </div>
<script type="text/javascript">
$(function(){
var images=$("div#activity_description_<%= user_activity_id %>").find("img");
if (images.length>0) {
for (var i=0; i<images.length; i++){
var image=$(images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#activity_description_<%= user_activity_id %> a').colorbox({rel:'nofollow', close: "关闭"});
});
</script>

View File

@ -30,11 +30,11 @@
<div class="courseReferContainer"> <div class="courseReferContainer">
<% if !projects.empty? %> <% if !projects.empty? %>
<% projects.each do |project| %> <% projects.each do |project| %>
<ul class="courseSend fl"> <ul class="courseSend">
<li class="fl"> <li class="" style="display:inline-block">
<input name="projects_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/> <input name="projects_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/>
</li> </li>
<li class="sendCourseName fl"><%= project.name%></li> <li class="sendCourseName"><%= project.name%></li>
</ul> </ul>
<% end %> <% end %>
</div> </div>

View File

@ -30,11 +30,11 @@
<div class="courseReferContainer"> <div class="courseReferContainer">
<% if !courses.empty? %> <% if !courses.empty? %>
<% courses.each do |course| %> <% courses.each do |course| %>
<ul class="courseSend fl"> <ul class="courseSend">
<li class="fl"> <li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/> <input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li> </li>
<li class="sendCourseName fl"><%= course.name%></li> <li class="sendCourseName"><%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%></li>
</ul> </ul>
<% end %> <% end %>
</div> </div>

View File

@ -29,6 +29,7 @@
<li> <li>
<ul class="homepagePostTypeProject fl"> <ul class="homepagePostTypeProject fl">
<li class="f14">更多</li> <li class="f14">更多</li>
<li class="mt-4"><%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeAll postTypeGrey"%>
<li class="mt-4"><%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%> <li class="mt-4"><%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
</ul> </ul>
</li> </li>

View File

@ -0,0 +1,5 @@
class AddUserIdToUserActivities < ActiveRecord::Migration
def change
add_column :user_activities, :user_id, :int
end
end

View File

@ -0,0 +1,40 @@
class UpdateUserActivities < ActiveRecord::Migration
def up
count = UserActivity.all.count / 30 + 2
transaction do
for i in 1 ... count do i
UserActivity.page(i).per(30).each do |activity|
if activity.container_type.to_s == 'Project'
forge_activity = ForgeActivity.where("forge_act_type = '#{activity.act_type.to_s}' and forge_act_id = #{activity.act_id}").first
if forge_activity
activity.user_id = forge_activity.user_id
else
activity.user_id = 0
end
elsif activity.container_type.to_s == 'Course'
course_activity = CourseActivity.where("course_act_type = '#{activity.act_type.to_s}' and course_act_id = #{activity.act_id}").first
if course_activity
activity.user_id = course_activity.user_id
else
activity.user_id = 0
end
end
activity.save
end
end
end
end
def down
count = UserActivity.all.count / 30 + 2
transaction do
for i in 1 ... count do i
UserActivity.page(i).per(30).each do |activity|
activity.user_id = nil
activity.save
end
end
end
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150906091723) do ActiveRecord::Schema.define(:version => 20150907064547) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -211,6 +211,58 @@ ActiveRecord::Schema.define(:version => 20150906091723) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
create_table "code_review_assignments", :force => true do |t|
t.integer "issue_id"
t.integer "change_id"
t.integer "attachment_id"
t.string "file_path"
t.string "rev"
t.string "rev_to"
t.string "action_type"
t.integer "changeset_id"
end
create_table "code_review_project_settings", :force => true do |t|
t.integer "project_id"
t.integer "tracker_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "updated_by"
t.boolean "hide_code_review_tab", :default => false
t.integer "auto_relation", :default => 1
t.integer "assignment_tracker_id"
t.text "auto_assign"
t.integer "lock_version", :default => 0, :null => false
t.boolean "tracker_in_review_dialog", :default => false
end
create_table "code_review_user_settings", :force => true do |t|
t.integer "user_id", :default => 0, :null => false
t.integer "mail_notification", :default => 0, :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "code_reviews", :force => true do |t|
t.integer "project_id"
t.integer "change_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "line"
t.integer "updated_by_id"
t.integer "lock_version", :default => 0, :null => false
t.integer "status_changed_from"
t.integer "status_changed_to"
t.integer "issue_id"
t.string "action_type"
t.string "file_path"
t.string "rev"
t.string "rev_to"
t.integer "attachment_id"
t.integer "file_count", :default => 0, :null => false
t.boolean "diff_all"
end
create_table "comments", :force => true do |t| create_table "comments", :force => true do |t|
t.string "commented_type", :limit => 30, :default => "", :null => false t.string "commented_type", :limit => 30, :default => "", :null => false
t.integer "commented_id", :default => 0, :null => false t.integer "commented_id", :default => 0, :null => false
@ -854,6 +906,7 @@ ActiveRecord::Schema.define(:version => 20150906091723) do
t.datetime "created_on" t.datetime "created_on"
t.integer "comments_count", :default => 0, :null => false t.integer "comments_count", :default => 0, :null => false
t.integer "course_id" t.integer "course_id"
t.datetime "updated_on"
end end
add_index "news", ["author_id"], :name => "index_news_on_author_id" add_index "news", ["author_id"], :name => "index_news_on_author_id"
@ -1110,18 +1163,18 @@ ActiveRecord::Schema.define(:version => 20150906091723) do
create_table "relative_memos", :force => true do |t| create_table "relative_memos", :force => true do |t|
t.integer "osp_id" t.integer "osp_id"
t.integer "parent_id" t.integer "parent_id"
t.string "subject", :null => false t.string "subject", :null => false
t.text "content", :null => false t.text "content", :limit => 16777215, :null => false
t.integer "author_id" t.integer "author_id"
t.integer "replies_count", :default => 0 t.integer "replies_count", :default => 0
t.integer "last_reply_id" t.integer "last_reply_id"
t.boolean "lock", :default => false t.boolean "lock", :default => false
t.boolean "sticky", :default => false t.boolean "sticky", :default => false
t.boolean "is_quote", :default => false t.boolean "is_quote", :default => false
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "viewed_count_crawl", :default => 0 t.integer "viewed_count_crawl", :default => 0
t.integer "viewed_count_local", :default => 0 t.integer "viewed_count_local", :default => 0
t.string "url" t.string "url"
t.string "username" t.string "username"
t.string "userhomeurl" t.string "userhomeurl"
@ -1146,6 +1199,19 @@ ActiveRecord::Schema.define(:version => 20150906091723) do
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
create_table "rich_rich_files", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "rich_file_file_name"
t.string "rich_file_content_type"
t.integer "rich_file_file_size"
t.datetime "rich_file_updated_at"
t.string "owner_type"
t.integer "owner_id"
t.text "uri_cache"
t.string "simplified_type", :default => "file"
end
create_table "roles", :force => true do |t| create_table "roles", :force => true do |t|
t.string "name", :limit => 30, :default => "", :null => false t.string "name", :limit => 30, :default => "", :null => false
t.integer "position", :default => 1 t.integer "position", :default => 1
@ -1197,10 +1263,11 @@ ActiveRecord::Schema.define(:version => 20150906091723) do
t.string "url" t.string "url"
t.string "title" t.string "title"
t.integer "share_type" t.integer "share_type"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "project_id" t.integer "project_id"
t.integer "user_id" t.integer "user_id"
t.string "description"
end end
create_table "softapplications", :force => true do |t| create_table "softapplications", :force => true do |t|
@ -1348,6 +1415,7 @@ ActiveRecord::Schema.define(:version => 20150906091723) do
t.integer "container_id" t.integer "container_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "user_id"
end end
create_table "user_extensions", :force => true do |t| create_table "user_extensions", :force => true do |t|
@ -1361,8 +1429,8 @@ ActiveRecord::Schema.define(:version => 20150906091723) do
t.integer "zip_code" t.integer "zip_code"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "identity"
t.string "technical_title" t.string "technical_title"
t.integer "identity"
t.string "student_id" t.string "student_id"
t.string "teacher_realname" t.string "teacher_realname"
t.string "student_realname" t.string "student_realname"
@ -1430,9 +1498,6 @@ ActiveRecord::Schema.define(:version => 20150906091723) do
t.integer "active" t.integer "active"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "level"
t.integer "file"
t.integer "issue"
end end
create_table "user_statuses", :force => true do |t| create_table "user_statuses", :force => true do |t|

View File

@ -410,9 +410,9 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat;
.searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;} .searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;}
.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;} .searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;}
.searchIconPopup:hover {cursor: pointer} .searchIconPopup:hover {cursor: pointer}
.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;} .courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;}
.courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;} .courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;}
.sendCourseName {font-size:12px; color:#5f6060;} .sendCourseName {font-size:12px; color:#5f6060;display:inline-block}
.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;cursor: pointer;} .courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;cursor: pointer;}
.courseSendSubmit:hover {background-color:#297fb8;} .courseSendSubmit:hover {background-color:#297fb8;}
.courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left} .courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left}
@ -1001,3 +1001,56 @@ a:hover.tijiao{ background:#0f99a9;}
.about_project{ overflow:hidden;display:none;} .about_project{ overflow:hidden;display:none;}
.project_r_h{ width:670px; height:40px; background:#eaeaea; margin-bottom:10px;} .project_r_h{ width:670px; height:40px; background:#eaeaea; margin-bottom:10px;}
.project_r_h02{ width:920px; height:40px; background:#eaeaea; margin-bottom:10px;} .project_r_h02{ width:920px; height:40px; background:#eaeaea; margin-bottom:10px;}
/* colorbox
*******************************************************************************/
/*
Colorbox Core Style:
The following CSS is consistent between example themes and should not be altered.
*/
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
#cboxWrapper {max-width:none;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative;}
#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
#cboxTitle{margin:0;}
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;}
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
/*
User Style:
Change the following styles to modify the appearance of Colorbox. They are
ordered & tabbed in a way that represents the nesting of the generated HTML.
*/
#cboxOverlay{background:#fff;}
#colorbox{outline:0;}
#cboxTopLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 0;}
#cboxTopCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -50px;}
#cboxTopRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px 0;}
#cboxBottomLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 -25px;}
#cboxBottomCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -75px;}
#cboxBottomRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px -25px;}
#cboxMiddleLeft{width:25px; background:url(../images/colorbox/border2.png) repeat-y 0 0;}
#cboxMiddleRight{width:25px; background:url(../images/colorbox/border2.png) repeat-y -25px 0;}
#cboxContent{background:#fff; overflow:hidden;}
.cboxIframe{background:#fff;}
#cboxError{padding:50px; border:1px solid #ccc;}
#cboxLoadedContent{margin-bottom:20px;}
#cboxTitle{position:absolute; bottom:0px; left:0; text-align:center; width:100%; color:#999;}
#cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999;}
#cboxLoadingOverlay{background:#fff url(../images/colorbox/loading.gif) no-repeat 5px 5px;}
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
#cboxSlideshow{position:absolute; bottom:0px; right:42px; color:#444;}
#cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;}
#cboxNext{position:absolute; bottom:0px; left:63px; color:#444;}
#cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;}

View File

@ -418,6 +418,8 @@ div.flash.notice {
background-color: #dfffdf; background-color: #dfffdf;
border-color: #9fcf9f; border-color: #9fcf9f;
color: #005f00; color: #005f00;
word-wrap: break-word;
word-break: break-all
} }
div.flash.warning, .conflict { div.flash.warning, .conflict {

View File

@ -572,7 +572,7 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat;
.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;} .searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;}
.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;} .courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;}
.courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;} .courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;}
.sendCourseName {font-size:12px; color:#5f6060;} .sendCourseName {font-size:12px; color:#5f6060;display:inline-block}
.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#64bdd9; margin-right:25px; float:left;} .courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#64bdd9; margin-right:25px; float:left;}
.courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left} .courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left}
a.sendSourceText {font-size:14px; color:#ffffff;} a.sendSourceText {font-size:14px; color:#ffffff;}