From 2965cfb5ce321406612d412d89a288ca2ea6b9c3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 16:39:54 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/index.html.erb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index add2c5654..167829ec3 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -69,10 +69,9 @@ winrar 工具进行解压 - - <%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%> <%= link_to "匿评", evaluation_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr'%> <%= link_to "缺评", absence_penalty_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr'%> + <%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%> 导出全部: <% end%> From 78181e5e4330051d40b9d88f209b1d6a73017716 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 16:55:04 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=8F=90=E7=A4=BA=EF=BC=9A=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E5=90=8D=E7=A7=B0=E5=92=8C=E6=8F=8F=E8=BF=B0=E4=B8=AD?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=87=BA=E7=8E=B0=E5=AD=A6=E7=94=9F=E7=9A=84?= =?UTF-8?q?=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/new.html.erb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 1b82ac31b..b4162c4da 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -25,6 +25,11 @@ :homework => @homework.id }) do |f|%>
+ <% if @homework.homework_type == 1%> +
+ 提示:匿评作业提交的作品,作品名称和描述中不能出现真实的姓名信息 +
+ <% end%>

<%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %> From 7338f0d44ea253b322676102ecbe346c59eca7bb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 10:02:50 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=9C=AA=E5=AE=8C=E5=96=84=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E8=B5=84=E6=96=99=E7=9A=84=E7=94=A8=E6=88=B7=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=8F=AF=E4=BB=A5=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 27 ++++++++++----------------- app/services/courses_service.rb | 4 +++- config/locales/zh.yml | 1 + 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 3b25438df..00d740ee7 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -443,26 +443,19 @@ class CoursesController < ApplicationController def create cs = CoursesService.new @course = cs.create_course(params,User.current)[:course] - if @course.new_record? + if @course respond_to do |format| - format.html { render :action => 'new', :layout => 'new_base' } #Added by young - format.api { render_validation_errors(@course) } + flash[:notice] = l(:notice_successful_create) + format.html {redirect_to settings_course_url(@course, :course_type => 1)} + format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) } end else respond_to do |format| - format.html { - # render :layout => 'base_courses' - flash[:notice] = l(:notice_successful_create) - if params[:continue] - redirect_to new_course_url(attrs, :course => '0') - elsif params[:course_continue] - redirect_to new_course_url(:course => '1') - else - redirect_to settings_course_url(@course, :course_type => 1) - end - } - format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) } - end + flash[:notice] = l(:notice_create_failed) + # @course = Course.new + format.html { redirect_to new_course_path } #Added by young + format.api { render_validation_errors(@course) } + end end end @@ -532,7 +525,7 @@ class CoursesController < ApplicationController @trackers = Tracker.sorted.all @course = Course.new @course.safe_attributes = params[:course] - month = Time.now.month + # month = Time.now.month render :layout => 'new_base' end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index f5ff2670f..68177552c 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -201,12 +201,14 @@ class CoursesService @course.class_period = params[:class_period].to_i params[:course][:is_public] ? @course.is_public = 1 : @course.is_public = 0 params[:course][:open_student] ? @course.open_student = 1 : @course.open_student = 0 + else + end @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all - if @course.save + if @course && @course.save #unless User.current.admin? r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first m = Member.new(:user => current_user, :roles => [r]) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 2a538138d..1aab2a22c 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -12,6 +12,7 @@ zh: notice_account_wrong_password: 密码错误 name_can_be_empty: 可以不填写真实姓名[保密所需] notice_successful_create: 创建成功 + notice_create_failed: 创建失败,请先完善个人信息 notice_failed_create: 创建失败 notice_successful_update: 更新成功 notice_successful_edit: 修改成功 From fa1a03bef322d818ae5a5febb75cc45ac07325b0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 10:30:26 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=8F=AF=E6=9F=A5=E7=9C=8B=E4=B8=8B=E8=BD=BD=E7=A7=81?= =?UTF-8?q?=E6=9C=89=E8=AF=BE=E7=A8=8B=E7=9A=84=E7=A7=81=E6=9C=89=E8=B5=84?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 2 +- app/views/files/_course_list.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 0003f7586..19c1214e2 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -37,7 +37,7 @@ class FilesController < ApplicationController obj.each do |container| @attachments += container.attachments end - @all_attachments = visable_attachemnts(@attachments) + @all_attachments = User.current.admin? ? @attachments : visable_attachemnts(@attachments) @limit = 10 @feedback_count = @all_attachments.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 8536a3ef5..353d19dab 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -22,7 +22,7 @@

<% curse_attachments.each do |file| %> - <% if file.is_public? || User.current.member_of_course?(course) %> + <% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %>
<%= link_to truncate(file.filename,length: 35, omission: '...'), From f9880a00fdd91dbcdf3bd292941abec28254415f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 16:41:17 +0800 Subject: [PATCH 5/8] =?UTF-8?q?admin=E7=95=8C=E9=9D=A2=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=E5=8F=8A=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 4 ++++ app/views/admin/courses.html.erb | 1 + config/routes.rb | 1 + lib/redmine.rb | 1 + 4 files changed, 7 insertions(+) create mode 100644 app/views/admin/courses.html.erb diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 8e23041c6..fbfdf24c2 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -41,6 +41,10 @@ class AdminController < ApplicationController render :action => "projects", :layout => false if request.xhr? end + def courses + + end + def users sort_init 'login', 'asc' sort_update %w(login firstname lastname mail admin created_on last_login_on) diff --git a/app/views/admin/courses.html.erb b/app/views/admin/courses.html.erb new file mode 100644 index 000000000..d1d06ad36 --- /dev/null +++ b/app/views/admin/courses.html.erb @@ -0,0 +1 @@ +1111 \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 8b8d4a401..dea176f54 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -635,6 +635,7 @@ RedmineApp::Application.routes.draw do match 'admin', :to => 'admin#index', :via => :get match 'admin/projects', :via => :get + get 'admin/courses' match 'admin/users', :via => :get match 'admin/first_page_made', as: :first_page_made match 'admin/course_page_made', as: :course_page_made diff --git a/lib/redmine.rb b/lib/redmine.rb index ba0fd0cee..3043cfe5d 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -367,6 +367,7 @@ end Redmine::MenuManager.map :admin_menu do |menu| menu.push :organization, {:controller => 'admin', :action => 'organization'}, :caption => :label_organization_list menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural + menu.push :courses, {:controller => 'admin', :action => 'courses'}, :caption => :label_course_all menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version From d48a7335025556540b355fe025a2ebff69737a02 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 16:49:50 +0800 Subject: [PATCH 6/8] =?UTF-8?q?1=E3=80=81=E8=B0=83=E6=95=B4admin=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=202=E3=80=81=E9=A1=B9=E7=9B=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=BA=8F=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/projects.html.erb | 112 ++++++++++++++++-------------- 1 file changed, 60 insertions(+), 52 deletions(-) diff --git a/app/views/admin/projects.html.erb b/app/views/admin/projects.html.erb index 4c9479a6d..f5b7955bf 100644 --- a/app/views/admin/projects.html.erb +++ b/app/views/admin/projects.html.erb @@ -1,5 +1,5 @@
-<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %> + <%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>

@@ -7,62 +7,70 @@

<%= form_tag({}, :method => :get) do %> -
- +
+ <%= l(:label_filter_plural) %> - - - <%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> - - <%= text_field_tag 'name', params[:name], :size => 30 %> - <%= submit_tag l(:button_apply), :class => "small", :name => nil %> - <%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %> -
+
+ + <%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> + + <%= text_field_tag 'name', params[:name], :size => 30 %> + <%= submit_tag l(:button_apply), :class => "small", :name => nil %> + <%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %> +
<% end %>  
- - - - - - - - -<% project_tree(@projects) do |project, level| %> - <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> - - - - - -<% end %> - -
- <%=l(:label_project)%> - - <%=l(:field_is_public)%> - - <%=l(:field_created_on)%> -
- - <%= link_to_project_settings(project, {}) %> - - - <%= checked_image project.is_public? %> - - <%= format_date(project.created_on) %> - - <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %> - <%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %> - <%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %> - <%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %> -
+ + + + + + + + + + + + <% project_tree(@projects) do |project, level| %> + <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> + + + + + + + <% end %> + +
+ 序号 + + <%=l(:label_project)%> + + <%=l(:field_is_public)%> + + <%=l(:field_created_on)%> +
+ <%= project.id %> + + + <%= link_to_project_settings(project, {}) %> + + + <%= checked_image project.is_public? %> + + <%= format_date(project.created_on) %> + + <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %> + <%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %> + <%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %> + <%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %> +
<% html_title(l(:label_project_plural)) -%> From 749b9c4429d6e4fa745ecd0c2db83919d6a43637 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 17:02:30 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A0=B9=E6=8D=AEID=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 2 +- app/models/project.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index fbfdf24c2..a01bba913 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -34,7 +34,7 @@ class AdminController < ApplicationController def projects @status = params[:status] || 1 - scope = Project.status(@status).order('lft') + scope = Project.status(@status).order('id asc') scope = scope.like(params[:name]) if params[:name].present? @projects = scope.where(project_type: Project::ProjectType_project).all diff --git a/app/models/project.rb b/app/models/project.rb index 49ed2d0ee..f201e6e3c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -839,7 +839,7 @@ class Project < ActiveRecord::Base # Yields the given block for each project with its level in the tree def self.project_tree(projects, &block) ancestors = [] - projects.sort_by(&:lft).each do |project| + projects.sort_by(&:id).each do |project| while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) ancestors.pop end From 07d95bdda9345c617224c7e268448555a784a638 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 17:34:17 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 6 ++- app/views/admin/courses.html.erb | 77 ++++++++++++++++++++++++++++- config/locales/commons/zh.yml | 2 +- 3 files changed, 82 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index a01bba913..086ecfb7f 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -42,7 +42,11 @@ class AdminController < ApplicationController end def courses - + @name = params[:name] + @courses = Course.like(@name) + respond_to do |format| + format.html + end end def users diff --git a/app/views/admin/courses.html.erb b/app/views/admin/courses.html.erb index d1d06ad36..1615bccbc 100644 --- a/app/views/admin/courses.html.erb +++ b/app/views/admin/courses.html.erb @@ -1 +1,76 @@ -1111 \ No newline at end of file +
+ <%= link_to l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %> +
+ +

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

+ +<%= form_tag({}, :method => :get) do %> +
+ + <%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '课程名称' %> + <%= submit_tag l(:button_apply), :class => "small", :name => nil %> + + <%= l(:button_clear)%> + +
+<% end %> +  + +
+ + + + + + + + + + + + + <% @courses.each do |course| %> + "> + + + + + + + + <% end %> + +
+ 序号 + + 课程 + + 主讲老师 + + 学时 + + <%=l(:field_is_public)%> + + <%=l(:field_created_on)%> +
+ <%= course.id %> + + + <%= link_to(course.name, course_path(course.id)) %> + + + <%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> + + <%= course.class_period %> + + <%= checked_image course.is_public? %> + + <%= format_date(course.created_at) %> +
+
+ +<% html_title(l(:label_course_all)) -%> diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index f83d3810c..5dee0b505 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -263,7 +263,7 @@ zh: label_tags_numbers: "Tag统计" label_issue_plural: 问题跟踪 - label_project_plural: 项目列表 +# label_project_plural: 项目列表 label_user_plural: 用户列表 label_tags_call: 需求 field_filename: 文件