diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 155932587..e6ab0f431 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -377,7 +377,7 @@ class UsersController < ApplicationController } scope = User.logged.status(@status) @search_by = params[:search_by] ? params[:search_by][:id] : 0 - scope = scope.like(params[:name],@search_by) if params[:name].present? + scope = scope.like(params[:name],"0") 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' diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 935fb440e..842e1f1b7 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -98,7 +98,7 @@ module WatchersHelper # modify by nwb # 主讲教师不允许退出课程 return '' if user.id == course.tea_id - joined = user.member_of_course?(course) + joined = course.members.map{|m| m.user}.include? user text = joined ? l(:label_exit_course) : l(:label_new_join) url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' diff --git a/app/models/user.rb b/app/models/user.rb index cae5f1aa2..e966742f1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -206,11 +206,11 @@ class User < Principal pattern = "%#{arg.to_s.strip.downcase}%" #where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) if type == "0" - where(" LOWER(login) LIKE :p ", :p => pattern) + where(" LOWER(login) LIKE '#{pattern}' ") elsif type == "1" - where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) + where(" LOWER(concat(lastname, firstname)) LIKE '#{pattern}' ") else - where(" LOWER(mail) LIKE :p ", :p => pattern) + where(" LOWER(mail) LIKE '#{pattern}' ") end end } diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 7937912e4..a8296165f 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -45,7 +45,7 @@ - + diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index 68b92c00e..23c74ed4b 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -1,8 +1,10 @@
- <% reply_allow = JournalsForMessage.create_by_user? User.current %> + <%# reply_allow = JournalsForMessage.create_by_user? User.current %> -

<%= l(:label_user_response) %>

+

+ <%= l(:label_user_response) %> +

<% if !User.current.logged?%>
@@ -30,5 +32,7 @@
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %>
-
    <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
+
    + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> +
\ No newline at end of file diff --git a/app/views/courses/_history.html.erb b/app/views/courses/_history.html.erb index 19b5cef0d..555e94f6d 100644 --- a/app/views/courses/_history.html.erb +++ b/app/views/courses/_history.html.erb @@ -5,18 +5,29 @@ <% if journals.size > 0 %> <% for journal in journals %>
- +
- <%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%><%= format_time(journal.created_on) %> + + <%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%> + + + <%= format_time(journal.created_on) %> +
-

<%= textilizable journal.notes%>

+

+ <%= textilizable journal.notes%> +

<% ids = 'project_respond_form_'+ journal.id.to_s%> - <% if journal.user == User.current|| User.current.admin? %> + <% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %> <%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', @@ -43,7 +54,7 @@ <% end %>
- <%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true} %> + <%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true, :allow_delete => @course && User.current.allowed_to?(:as_teacher,@course)} %>
diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index 7d25cb80b..494cc1f7a 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -37,37 +37,38 @@
diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb index 6eca2b0bf..e6f795722 100644 --- a/app/views/stores/index.html.erb +++ b/app/views/stores/index.html.erb @@ -11,9 +11,15 @@
-
<%=l(:label_attachment)%>
-
<%=l(:field_downloads)%>
-
<%=l(:button_download)%>
+
+ <%=l(:label_attachment)%> +
+
+ <%=l(:field_downloads)%> +
+
+ <%=l(:button_download)%> +
diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb index 8ade60282..1da8c87d6 100644 --- a/app/views/wiki/show.html.erb +++ b/app/views/wiki/show.html.erb @@ -3,9 +3,9 @@ <% if @content.current_version? %> <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %> <%= watcher_link(@page, User.current) %> - <%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %> - <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %> - <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %> + <%#= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %> + <%#= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %> + <%#= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %> <%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del') %> <% else %> <%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') %> diff --git a/app/views/words/_journal_reply.html.erb b/app/views/words/_journal_reply.html.erb index 39321394c..5a6511999 100644 --- a/app/views/words/_journal_reply.html.erb +++ b/app/views/words/_journal_reply.html.erb @@ -1,7 +1,8 @@ <% id = "journal_reply_ul_" + journal.id.to_s%> +<% allow_delete ||= false%>
<% fetch_user_leaveWord_reply(journal).each do |reply|%> - <%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply,:show_name=> show_name} %> + <%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply,:show_name=> show_name, :allow_delete => allow_delete} %> <% end %>
diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index fa69176a8..24577c2ee 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -1,4 +1,5 @@ <% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %> +<% allow_delete ||= false %> <% if parent_jour%> <% reply_allow = JournalsForMessage.create_by_user? User.current %> <% ids_r = 'reply_respond_form_'+ reply.id.to_s %> @@ -30,7 +31,7 @@ <%= format_time reply.created_on %>
+ <%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author)) %> @@ -55,6 +55,8 @@ <%= link_to(bid.name, course_for_bid_path(bid), :class => 'bid_path') %> + <% if User.current.logged? && is_cur_course_student(@course) %> <% cur_user_homework = cur_user_homework_for_bid(bid) %> @@ -83,8 +85,8 @@ <%end%> <%= link_to( - l(:button_edit), - {:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id} + l(:button_edit), + {:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id} ) %> <%#= link_to( diff --git a/app/views/common/403.html b/app/views/common/403.html index f3696c4ea..a89be932d 100644 --- a/app/views/common/403.html +++ b/app/views/common/403.html @@ -7,7 +7,7 @@ body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;} div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;} div,img,tr,td{ border:0;} -table,tr,td{border:0 cellspacing:0; cellpadding:0;} +table,tr,td{border:0; cellspacing:0; cellpadding:0;} ul,li{ list-style-type:none} .cl{ clear:both; overflow:hidden; } a{ text-decoration:none; } diff --git a/app/views/common/404.html b/app/views/common/404.html index 8453e0a41..0d632c4c8 100644 --- a/app/views/common/404.html +++ b/app/views/common/404.html @@ -7,7 +7,7 @@ body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff;} div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;} div,img,tr,td{ border:0;} -table,tr,td{border:0 cellspacing:0; cellpadding:0;} +table,tr,td{border:0; cellspacing:0; cellpadding:0;} ul,li{ list-style-type:none} .cl{ clear:both; overflow:hidden; } a{ text-decoration:none; } diff --git a/app/views/contests/index.html.erb b/app/views/contests/index.html.erb index 5867d7fcd..75b892461 100644 --- a/app/views/contests/index.html.erb +++ b/app/views/contests/index.html.erb @@ -21,36 +21,36 @@