Conflicts:
	app/models/user.rb
	app/views/courses/_course_form.html.erb
	db/schema.rb
course_group
sw 11 years ago
commit 460ba55dde

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

@ -126,7 +126,7 @@ class AdminController < ApplicationController
@status = params[:status] || 1
scope = User.logged.status(@status)
scope = scope.like(params[:name]) if params[:name].present?
scope = scope.like(params[:name],params[:search_by][:id]) if params[:name].present?
@user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page']
@user_base_tag = params[:id] ? 'base_users':'base'

@ -29,7 +29,11 @@ class AutoCompletesController < ApplicationController
@issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%").order("#{Issue.table_name}.id DESC").limit(10).all
@issues.compact!
end
render :layout => false
#render :layout => false
render :json => @issues.map {|issue| {
'value' => issue[:subject]
}}
end

@ -265,6 +265,7 @@ class FilesController < ApplicationController
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
sort=''
if params[:sort]
params[:sort].split(",").each do |sort_type|
order_by = sort_type.split(":")

@ -52,7 +52,7 @@ class ForumsController < ApplicationController
def index
@offset, @limit = api_offset_and_limit({:limit => 10})
@forums_all = Forum.where('1=1')
@forums_all = Forum.reorder("sticky DESC")
@forums_count = @forums_all.count
@forums_pages = Paginator.new @forums_count, @limit, params['page']
@ -208,6 +208,8 @@ class ForumsController < ApplicationController
end
end
private

@ -374,7 +374,7 @@ class UsersController < ApplicationController
"show_changesets" => true
}
scope = User.logged.status(@status)
scope = scope.like(params[:name]) if params[:name].present?
scope = scope.like(params[:name],params[:search_by][:id]) if params[:name].present?
@user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page']
@user_base_tag = params[:id] ? 'base_users':'users_base'

@ -5,7 +5,7 @@ class Course < ActiveRecord::Base
STATUS_CLOSED = 5
STATUS_ARCHIVED = 9
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student
belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表
@ -52,7 +52,8 @@ class Course < ActiveRecord::Base
'term',
'is_public',
'description',
'class_period'
'class_period',
'open_student'
acts_as_customizable

@ -8,7 +8,9 @@ class Forum < ActiveRecord::Base
'topic_count',
'memo_count',
'last_memo_id',
'creator_id'
'creator_id',
'sticky',
'locked'
validates_presence_of :name, :creator_id, :description
validates_length_of :name, maximum: 50
#validates_length_of :description, maximum: 255

@ -1359,7 +1359,7 @@ class Issue < ActiveRecord::Base
# Callback on file attachment
def attachment_added(obj)
if @current_journal && !obj.new_record?
if @current_journal && !obj.new_record? && @current_journal.journalized_id == obj.author_id
@current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :value => obj.filename)
end
end

@ -78,9 +78,13 @@ class Message < ActiveRecord::Base
safe_attributes 'subject', 'content'
safe_attributes 'locked', 'sticky', 'board_id',
safe_attributes 'board_id','locked', 'sticky',
:if => lambda {|message, user|
user.allowed_to?(:edit_messages, message.project)
if message.project
user.allowed_to?(:edit_messages, message.project)
else
user.allowed_to?(:edit_messages, message.course)
end
}
def visible?(user=User.current)
@ -158,6 +162,7 @@ class Message < ActiveRecord::Base
#更新用户分数 -by zjc
def be_user_score
#新建message且无parent的为发帖
if self.parent_id.nil? && !self.board.project.nil?
UserScore.joint(:post_message, self.author,nil,self, { message_id: self.id })
update_memo_number(self.author,1)

@ -199,13 +199,19 @@ class User < Principal
}
scope :sorted, lambda { order(*User.fields_for_order_statement)}
scope :like, lambda {|arg|
scope :like, lambda {|arg, type|
if arg.blank?
where(nil)
else
pattern = "%#{arg.to_s.strip.downcase}%"
#where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern)
where(" LOWER(login) LIKE :p ", :p => pattern)
if type == "0"
where(" LOWER(login) LIKE :p ", :p => pattern)
elsif type == "1"
where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern)
else
where(" LOWER(mail) LIKE :p ", :p => pattern)
end
end
}

@ -17,7 +17,10 @@
<label for='group_id'><%= l(:label_group) %>:</label>
<%= select_tag 'group_id', content_tag('option') + options_from_collection_for_select(@groups, :id, :name, params[:group_id].to_i), :onchange => "this.form.submit(); return false;" %>
<% end %>
<label for="user_browse_label"><%= l(:label_user_search_type) %></label>
<%= select "search_by", "id",
{ l(:label_search_by_login) => "0", l(:label_search_by_name) => "1", l(:label_search_by_email) => "2" },
:size => 20 %>
<label for='name'><%= l(:label_user) %>:</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:label_search), :class => "small", :name => nil %>

@ -17,7 +17,10 @@
<label for='group_id'><%= l(:label_group) %>:</label>
<%= select_tag 'group_id', content_tag('option') + options_from_collection_for_select(@groups, :id, :name, params[:group_id].to_i), :onchange => "this.form.submit(); return false;" %>
<% end %>
<label for="user_browse_label"><%= l(:label_user_search_type) %></label>
<%= select "search_by", "id",
{ l(:label_search_by_login) => "0", l(:label_search_by_name) => "1", l(:label_search_by_email) => "2" },
:size => 20 %>
<label for='name'><%= l(:label_user) %>:</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:label_search), :class => "small", :name => nil %><!--Modified by young-->

@ -43,6 +43,7 @@
<span class="info" style="width: 10px;">
<%= text_field_tag :class_period, @course.class_period, :placeholder => "#{l(:lable_input_class)}", :maxlength => 5 %>
</span>
<span>&nbsp;<strong><%= l(:label_class_hour) %></strong></span>
<span>&nbsp;
<strong>
<%= l(:label_class_hour) %>
@ -57,6 +58,9 @@
<table>
<tr>
<td>
<span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px"><%= l(:label_class_period) %>
<span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px"><%= l(:label_class_period) %>
<span class="required"> *&nbsp;&nbsp;</span></span>
<span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px">
<%= l(:label_class_period) %>
<span class="required"> *&nbsp;&nbsp;</span>
@ -64,6 +68,8 @@
<span class="info" style="width: 10px;">
<%= text_field_tag :class_period, nil, :placeholder => "#{l(:lable_input_class)}", :maxlength => 5 %>
</span>
<strong><%= l(:label_class_hour) %></strong>
<strong><%= l(:label_class_hour) %></strong>
<strong>
<%= l(:label_class_hour) %>
</strong>
@ -80,6 +86,7 @@
<table>
<tr>
<td class="info" align="right" style="width: 86px">
<strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong>
<strong>
<%= l(:label_term) %>
<span class="required"> *&nbsp;&nbsp;</span>
@ -89,6 +96,7 @@
<%= select_tag :time,options_for_select(course_time_option,@course.time), {} %>
</td>
<td class="info" style="width: 10px">
<%= select_tag :term,options_for_select(course_term_option,@course.term),{} %>
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
</td>
</tr>
@ -99,12 +107,14 @@
</table>
</p>
<p style="margin-left:-10px;">
<label for="course[course]_password" style="font-size: 13px;"><%= l(:label_new_course_password) %>
<label for="course[course]_password" style="font-size: 13px;">
<%= l(:label_new_course_password) %>
<span class="required">*</span>
</label>
<input id="course_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%= @course.password %>" size="60" name="course[password]"/>
</p>
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
<em class="info" style="margin-left:95px;">
<%= l(:text_command) %>
</em>
@ -124,12 +134,19 @@
<%= f.check_box :is_public, :style => "margin-left:10px;" %>
<%= l(:label_course_public_info) %>
</em>
</p><!-- modified by bai -->
</p>
<p style="margin-left:-10px;">
<em style="color: #888888;display: block;font-size: 90%;font-style: normal;">
<%= f.check_box :open_student, :style => "margin-left:10px;" %>
<%= l(:label_course_open_student_info) %>
</em>
</p>
<p style="display:none;">
<%= f.text_field :course_type, :value => 1 %>
</p>
<%= wikitoolbar_for 'course_description' %>
<% @course.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :course, value %></p>
<p>
<%= custom_field_tag_with_label :course, value %>
</p>

@ -62,8 +62,8 @@
<input class=" width190" type="password" name="course_password" id="course_password" value="" >
</li>
<li>
<a href="#" class="btn" onclick="submit_form(this);"><%= l(:label_new_join) %></a>
<a href="#" onclick="hideModal(this);"><%= l(:button_cancel)%></a>
<a href="#" class="btn" style="margin-left: 50px;" onclick="submit_form(this);"><%= l(:label_new_join) %></a>
<a href="#" class="btn" style="margin-left: 20px;" onclick="hideModal(this);"><%= l(:button_cancel)%></a>
</li>
</ul>
<% end%>

@ -2,6 +2,7 @@
<% attachmenttypes = @course.attachmenttypes %>
<% sufixtypes = @course.contenttypes %>
<span class="borad-title"><%= t(:label_user_course) %>资源共享区</span>
<div class="content-title-top">
@ -49,7 +50,8 @@
<% if attachmenttypes.any? %>
&nbsp; &nbsp; &nbsp;
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0' ) +options_from_collection_for_select(attachmenttypes, "id", "typeName", params[:type]),
:onchange => "course_attachmenttypes_searchex(this.value)" %>
<% end %>
<% if sufixtypes.any? %>

@ -52,7 +52,7 @@
<% if attachmenttypes.any? %>
&nbsp; &nbsp; &nbsp;
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName",params[:type]),
:onchange => "attachmenttypes_searchex(this.value)" %>
<% end %>
<% if sufixtypes.any? %>

@ -17,6 +17,18 @@
<div class="field">
<%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share' %>
</div>
<div>
<% if User.current.logged? && User.current.admin? %>
<% if @forum.safe_attribute? 'sticky' %>
<%= f.check_box :sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<% end %>
<% if @forum.safe_attribute? 'locked' %>
<%= f.check_box :locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<% end %>
<% end %>
</div>
<div>
<script src="http://<%= Setting.host_name%>/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
<p style="max-width:680px">

@ -7,9 +7,14 @@
<%= forum.creator.nil? ? (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar")) : (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar"), user_path(forum.creator)) %>
</div>
<div class="forums-index-content">
<p ><%= link_to h(forum.name), forum_path(forum) %></p>
<p ><%= textAreailizable forum.description%></p>
<p ><%= authoring forum.created_at, forum.creator %></p></div>
<table class="content-text-list">
<tr><td valign="top" width="500px" class=" <%= forum.sticky? ? 'sticky' : '' %>
<%= forum.locked? ? 'locked' : '' %>">
<p ><%= link_to h(forum.name), forum_path(forum) %></p></td></tr>
<tr><td><p ><%= textAreailizable forum.description%></p></td></tr>
<tr><td><p ><%= authoring forum.created_at, forum.creator %></p></td></tr>
</table>
</div>
<div class="forums-index-count">
<table class="forums-count-color"><tr class="forums-count-color" align="center"><td><%= link_to (forum.memo_count), forum_path(forum) %></td><td><%= link_to (forum.topic_count), forum_path(forum) %></td></tr>
<tr align="center"><td>回答</td><td>帖子</td></tr></table></div>

@ -11,7 +11,8 @@
<td rowspan="2">
<% if User.current.logged? %>
<%= link_to( l(:label_forum_new), new_forum_path, :class => 'icon icon-add') %>
<% end %>
<% end %>
</td>
<td rowspan="2" width="250px" >
<div class="top-content-search">

@ -30,8 +30,13 @@
<% if @issue.safe_attribute? 'subject' %>
<p><%= f.text_field :subject, :size => 80, :maxlength => 255, :required => true, :style => "font-size:small" %></p>
<!--Added by young-->
<%= javascript_tag "observeAutocompleteField('issue_subject', '#{escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (Setting.cross_project_issue_relations? ? 'all' : nil))}')" %>
<!--Ended by young-->
<%= javascript_tag do %>
observeAutocompleteField('issue_subject', '<%= escape_javascript auto_complete_issues_path(:project_id => @project,:scope => (Setting.cross_project_issue_relations? ? 'all' : nil)) %>',
{ select: function(event, ui) {
$('input#issue_subject').val(ui.item.value);
}
});
<% end %>
<% end %>

@ -121,7 +121,7 @@
<% end%>
</td>
<td class="font_index">
<% if User.current.member_of_course?(@course) %>
<% if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) %>
<%= link_to "#{studentCount(@course)}", course_member_path(@course, :role => 2), :course => '1' %>
<% else %>
<span>

@ -95,7 +95,7 @@
<td align="center" width="70px"> <%= l(:label_member) %></td>
<td align="center" width="100px"><%= l(:label_user_watchered) %></td>
<td align="center" width="70px"> <%= l(:label_project_issues) %></td>
<!-- <td align="center" width="58px"><%= l(:label_attachment) %></td> -->
<!-- <td align="center" width="58px"><%#= l(:label_attachment) %></td> -->
</tr>
</table>
<div class="user_underline"></div>

@ -21,6 +21,9 @@
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<% title1 = @user.user_extensions.technical_title %>
<% language1 = @user.language %>
<script type="text/javascript">
function startXMLHttp()
{
@ -36,11 +39,55 @@
{
setInterval("startXMLHttp()",5000);
}
function init_title() {
var title = "<%= "#{title1}" %>"
var language = "<%= "#{language1}" %>"
if(language == 'zh') {
switch (title) {
case 'Professor' :
title1 = '教授';
break;
case 'Associate professor' :
title1 = '副教授';
break;
case 'Lecturer' :
title1 = '讲师';
break;
case 'Teaching assistant' :
title1 = '助教';
break;
default :
title1 = title;
break;
}
}
else {
switch (title) {
case '教授' :
title1 = 'Professor';
break;
case '副教授' :
title1 = 'Associate professor';
break;
case '讲师' :
title1 = 'Lecturer';
break;
case '助教' :
title1 = 'Teaching assistant';
break;
default :
title1 = title;
break;
}
}
document.getElementById('td_tech_title').innerHTML = title1;
}
</script>
</head>
<!--加上 onload="Javascript:t()" 开始定时刷新分数 -->
<body class="<%= h body_css_classes %>">
<body class="<%= h body_css_classes %>" onload="init_title()" >
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
@ -193,8 +240,8 @@
<td style="padding-left: 5px" width="76px">
<%= l(:label_technical_title) %>:
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= @user.user_extensions.technical_title %>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<span id = "td_tech_title"></span>
</td>
<% end %>
</tr>

@ -1,3 +1,3 @@
<%= error_messages_for 'bid' %>
<p><%= f.text_field :content, :required => true, :size => 60, :style => "width:150px;" %></p>
<p><%= hidden_field_tag 'subject', ||=@memo.subject %>
<p><%= hidden_field_tag 'subject'||=@memo.subject %>

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

Loading…
Cancel
Save