Date: Wed, 26 Jun 2019 15:45:41 +0800
Subject: [PATCH 05/42] fix log
---
app/services/users_service.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/services/users_service.rb b/app/services/users_service.rb
index 14289425..6ab6d3f6 100644
--- a/app/services/users_service.rb
+++ b/app/services/users_service.rb
@@ -343,7 +343,7 @@ class UsersService
g = Gitlab.client
g.edit_user(@current_user.gid, :password => params[:new_password])
rescue Exception => e
- logger.error "change users password failed! ===> #{e}"
+ Rails.logger.error "change users password failed! ===> #{e.message}"
end
end
#raise @current_user.errors.full_message
From adbbf537da1d734ff7d07c8a108db06c6fdb8029 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 26 Jun 2019 18:08:07 +0800
Subject: [PATCH 06/42] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
db/migrate/20190626070641_add_limit_for_shixuns.rb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/db/migrate/20190626070641_add_limit_for_shixuns.rb b/db/migrate/20190626070641_add_limit_for_shixuns.rb
index 1de29c80..e403c061 100644
--- a/db/migrate/20190626070641_add_limit_for_shixuns.rb
+++ b/db/migrate/20190626070641_add_limit_for_shixuns.rb
@@ -1,5 +1,8 @@
class AddLimitForShixuns < ActiveRecord::Migration
def up
+ if !Challenge.first.has_attribute?(:exec_time)
+ add_column :challenges, :exec_time, :integer, :default => 120
+ end
Shixun.find_each do |shixun|
shixun.challenges.update_all(:exec_time => shixun.exec_time)
shixun.mirror_repositories.each do |mirror|
From 3ed7b1150e3959b9e49ef44f0493027113f63add Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 26 Jun 2019 18:22:36 +0800
Subject: [PATCH 07/42] =?UTF-8?q?=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/shixuns_controller.rb | 10 ++++++++++
app/views/shixuns/_settings_edit.html.erb | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index 744dd683..f0a9bc48 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -877,6 +877,16 @@ class ShixunsController < ApplicationController
ShixunTagRepertoire.create!(:tag_repertoire_id => str.tag_repertoire_id, :shixun_id => new_shixun.id)
end
+ # 同步配置
+ @shixun.shixun_service_configs.each do |config|
+ ShixunServiceConfig.create!(:shixun_id => new_shixun.id,
+ :cpu_limit => config.cpu_limit,
+ :lower_cpu_limit => config.lower_cpu_limit,
+ :memory_limit => config.memory_limit,
+ :request_limit => config.request_limit,
+ :mirror_repository_id => config.mirror_repository_id)
+ end
+
# 同步复制版本库,先fork再修改版本库名
# eduforge用户作为版本库的创建者
repository = Repository.new
diff --git a/app/views/shixuns/_settings_edit.html.erb b/app/views/shixuns/_settings_edit.html.erb
index 6e6fff64..5001bd6c 100644
--- a/app/views/shixuns/_settings_edit.html.erb
+++ b/app/views/shixuns/_settings_edit.html.erb
@@ -294,7 +294,7 @@
<% end %>
- <% if User.current.admin? || User.cuurent.business? %>
+ <% if User.current.admin? || User.current.business? %>
服务配置
<% @shixun.shixun_service_configs.each do |config| %>
From eb61f98246cec94524fbf0be8fe1300e43934212 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 26 Jun 2019 18:33:09 +0800
Subject: [PATCH 08/42] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E8=B5=84=E6=BA=90=E7=BB=9F=E4=B8=80=E8=AE=BE=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index cc93b840..2bfc127d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -277,7 +277,7 @@ module ApplicationHelper
:cpuLimit => config.cpu_limit,
:cpuRequest => config.lower_cpu_limit,
:memoryLimit => "#{config.memory_limit}M",
- :memoryRequest => "#{config.request_limit}",
+ :memoryRequest => "#{config.request_limit}M",
:resourceLimit => "#{config.resource_limit}K",
:type => mirror.try(:main_type) == "1" ? "main" : "sub"}
end
From 7b46227ec45ed99abd678bb2ee3cc0e62c75aa85 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 27 Jun 2019 00:17:56 +0800
Subject: [PATCH 09/42] =?UTF-8?q?=E9=95=9C=E5=83=8F=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E4=B8=8A=E7=BA=BF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...ify_request_limit_for_shixun_service_config.rb | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 db/migrate/20190626161150_modify_request_limit_for_shixun_service_config.rb
diff --git a/db/migrate/20190626161150_modify_request_limit_for_shixun_service_config.rb b/db/migrate/20190626161150_modify_request_limit_for_shixun_service_config.rb
new file mode 100644
index 00000000..060cad94
--- /dev/null
+++ b/db/migrate/20190626161150_modify_request_limit_for_shixun_service_config.rb
@@ -0,0 +1,15 @@
+class ModifyRequestLimitForShixunServiceConfig < ActiveRecord::Migration
+ def up
+ ShixunServiceConfig.find_each do |config|
+ # repertoire_id = 5 代表的是大数据的镜像
+ if config.mirror_repository.repertoire_id != 5
+ config.update_column(:request_limit, 10)
+ else
+ puts("####---#{config.mirror_repository.name}")
+ end
+ end
+ end
+
+ def down
+ end
+end
From cefa6fa68bd3ac84b34cab5b1d2db885720aae1f Mon Sep 17 00:00:00 2001
From: p31729568
Date: Thu, 27 Jun 2019 09:39:27 +0800
Subject: [PATCH 10/42] library management
---
Gemfile | 3 +
app/controllers/libraries_controller.rb | 61 +++++++++
.../managements/library_applies_controller.rb | 47 +++++++
app/helpers/application_helper.rb | 23 ++--
app/libs/util.rb | 7 +
app/models/library.rb | 46 +++++++
app/models/library_apply.rb | 19 +++
app/models/tiding.rb | 8 ++
app/models/user.rb | 1 +
app/services/libraries/agree_apply_service.rb | 32 +++++
.../libraries/refuse_apply_service.rb | 37 ++++++
app/services/libraries/save_service.rb | 37 ++++++
app/services/libraries/submit_service.rb | 31 +++++
app/views/layouts/base_management.html.erb | 1 +
.../_library_apply_list.html.erb | 78 ++++++++++++
.../library_applies/index.html.erb | 120 ++++++++++++++++++
.../managements/library_applies/index.js.erb | 30 +++++
config/locales/libraries/zh.yml | 8 ++
config/routes.rb | 13 ++
db/migrate/20190626004605_create_libraries.rb | 18 +++
.../20190626005624_create_library_applies.rb | 14 ++
lib/trustie/sms/sms.rb | 3 +
22 files changed, 627 insertions(+), 10 deletions(-)
create mode 100644 app/controllers/libraries_controller.rb
create mode 100644 app/controllers/managements/library_applies_controller.rb
create mode 100644 app/libs/util.rb
create mode 100644 app/models/library.rb
create mode 100644 app/models/library_apply.rb
create mode 100644 app/services/libraries/agree_apply_service.rb
create mode 100644 app/services/libraries/refuse_apply_service.rb
create mode 100644 app/services/libraries/save_service.rb
create mode 100644 app/services/libraries/submit_service.rb
create mode 100644 app/views/managements/library_applies/_library_apply_list.html.erb
create mode 100644 app/views/managements/library_applies/index.html.erb
create mode 100644 app/views/managements/library_applies/index.js.erb
create mode 100644 config/locales/libraries/zh.yml
create mode 100644 db/migrate/20190626004605_create_libraries.rb
create mode 100644 db/migrate/20190626005624_create_library_applies.rb
diff --git a/Gemfile b/Gemfile
index 6cf60e0e..d89f9a24 100644
--- a/Gemfile
+++ b/Gemfile
@@ -67,6 +67,9 @@ gem 'oauth2'
gem 'axlsx', '3.0.0.pre'
gem 'axlsx_rails', '0.3.0'
+# state machine
+gem 'aasm'
+
#Ruby 2.2+ has removed test/unit from the core library.
if RUBY_VERSION>='2.2'
gem 'test-unit', '~> 3.0'
diff --git a/app/controllers/libraries_controller.rb b/app/controllers/libraries_controller.rb
new file mode 100644
index 00000000..ce34e603
--- /dev/null
+++ b/app/controllers/libraries_controller.rb
@@ -0,0 +1,61 @@
+class LibrariesController < ApplicationController
+ before_filter :require_login
+
+ def index
+ libraries = Library.where(nil)
+
+ libraries =
+ if params[:filter] == 'mine'
+ libraries.where(user_id: current_user.id).order('created_at desc')
+ else
+ libraries.where(status: :published).order('visited_count desc')
+ end
+
+ search = params[:search].to_s.strip
+ libraries = libraries.where('title LIKE ?', "%#{search}%") if search.present?
+
+ @libraries = paginateHelper libraries.includes(user: :user_extensions)
+ end
+
+ def show
+ @library = Library.find(params[:id])
+ @library.increment_visited_count!
+ end
+
+ def new
+ @library = current_user.libraries.new
+ end
+
+ def create
+ @library = current_user.libraries.new
+ Libraries::SaveService.new(@library, current_user, params).call
+ redirect_to library_path(id: @library.id)
+ rescue ActiveRecord::RecordInvalid => _
+ render 'new'
+ end
+
+ def edit
+ @library = current_library
+ end
+
+ def update
+ @library = current_library
+ Libraries::SaveService.new(@library, current_user, params).call
+ redirect_to library_path(id: @library.id)
+ rescue ActiveRecord::RecordInvalid => _
+ render 'edit'
+ end
+
+ def publish
+ Libraries::SubmitService.new(current_library).call
+ render json: { status: 0 }
+ rescue Libraries::SubmitService::Error => ex
+ render json: { status: 0, message: ex.message }
+ end
+
+ private
+
+ def current_library
+ @_current_library ||= current_user.libraries.find(params[:id])
+ end
+end
\ No newline at end of file
diff --git a/app/controllers/managements/library_applies_controller.rb b/app/controllers/managements/library_applies_controller.rb
new file mode 100644
index 00000000..512f47b4
--- /dev/null
+++ b/app/controllers/managements/library_applies_controller.rb
@@ -0,0 +1,47 @@
+class Managements::LibraryAppliesController < Managements::BaseController
+ before_filter :set_menu_type
+
+ def index
+ applies = LibraryApply.order('library_applies.updated_at desc')
+
+ search = params[:search].to_s.strip
+ if search.present?
+ applies = applies.joins(:library)
+ .where('libraries.uuid like :search or libraries.title like :search', search: "%#{search}%")
+ end
+
+ applies = applies.where(status: params[:status].presence || :pending)
+
+ @library_applies = paginateHelper applies.includes(library: { user: :user_extensions })
+
+ respond_to do |format|
+ format.js
+ format.html
+ end
+ end
+
+ def agree
+ Libraries::AgreeApplyService.new(current_library_apply, current_user).call
+ render json: { status: 0 }
+ rescue Libraries::AgreeApplyService::Error => e
+ render json: { status: -1, message: e.message }
+ end
+
+ def refuse
+ Libraries::RefuseApplyService.new(current_library_apply, current_user, reason: params[:reason]).call
+ render json: { status: 0 }
+ rescue Libraries::RefuseApplyService::Error => e
+ render json: { status: -1, message: e.message }
+ end
+
+ private
+
+ def current_library_apply
+ @_current_library_apply ||= LibraryApply.find(params[:id])
+ end
+
+ def set_menu_type
+ @menu_type = 10
+ @sub_type = 8
+ end
+end
\ No newline at end of file
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 34fa1a8d..83d80b3e 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -727,16 +727,17 @@ module ApplicationHelper
when 9
sub_type == 1 ? "实训留言列表" : ""
when 10
- sub_type == 1 ? "实名认证" :
- (sub_type == 2 ? "试用授权" :
- (sub_type == 3 ? "部门审批" :
- (sub_type == 4 ? "单位审批" :
- (sub_type == 5 ? "实训发布" :
- (sub_type == 6 ? "实训课程发布" : "职业认证")
- )
- )
- )
- )
+ case sub_type
+ when 1 then '实名认证'
+ when 2 then '试用授权'
+ when 3 then '部门审批'
+ when 4 then '单位审批'
+ when 5 then '实训发布'
+ when 6 then '实训课程发布'
+ when 7 then '职业认证'
+ when 8 then '文库发布'
+ else '职业认证'
+ end
when 11
"工程认证+"
when 12
@@ -7430,6 +7431,8 @@ def tiding_url tiding
project_pull_requests_path(tiding.parent_container_id)
when 'Department'
my_account_path
+ when 'Library'
+ tiding.tiding_type == 'System' ? library_applies_path : library_path(tiding.container_id)
end
end
diff --git a/app/libs/util.rb b/app/libs/util.rb
new file mode 100644
index 00000000..e72029ae
--- /dev/null
+++ b/app/libs/util.rb
@@ -0,0 +1,7 @@
+module Util
+ module_function
+
+ def generate_time_uuid
+ "#{Time.zone.now.strftime('%Y%m%d%H%M%S')}#{Random.rand(10**8).to_i}"
+ end
+end
\ No newline at end of file
diff --git a/app/models/library.rb b/app/models/library.rb
new file mode 100644
index 00000000..735445c9
--- /dev/null
+++ b/app/models/library.rb
@@ -0,0 +1,46 @@
+class Library < ActiveRecord::Base
+ include AASM
+
+ belongs_to :user
+
+ has_many :library_applies, dependent: :delete_all
+ has_many :attachments, as: :container
+
+ attr_accessible :title, :content
+
+ validates :title, presence: true
+ validates :content, presence: true
+ validates :uuid, presence: true, uniqueness: true
+
+ aasm(:status) do
+ state :pending, initiali: true
+ state :processing
+ state :refused
+ state :published
+
+ event :submit do
+ transitions from: [:pending, :refused], to: :processing
+ end
+
+ event :refuse do
+ transitions from: :processing, to: :refused
+ end
+
+ event :publish do
+ transitions from: :processing, to: :published
+ end
+ end
+
+ def generate_uuid
+ uuid = Util.generate_time_uuid
+ while Library.exists?(uuid: uuid)
+ uuid = Util.generate_time_uuid
+ end
+
+ self.uuid = uuid
+ end
+
+ def increment_visited_count!
+ Library.connection.execute("update libraries set visited_count = COALESCE(visited_count, 0) + 1 where id = #{id}")
+ end
+end
\ No newline at end of file
diff --git a/app/models/library_apply.rb b/app/models/library_apply.rb
new file mode 100644
index 00000000..9c1e183a
--- /dev/null
+++ b/app/models/library_apply.rb
@@ -0,0 +1,19 @@
+class LibraryApply < ActiveRecord::Base
+ include AASM
+
+ belongs_to :library
+
+ aasm(:status) do
+ state :pending, initiali: true
+ state :refused
+ state :agreed
+
+ event :refuse do
+ transitions from: :pending, to: :refused
+ end
+
+ event :agree do
+ transitions from: :pending, to: :agreed
+ end
+ end
+end
\ No newline at end of file
diff --git a/app/models/tiding.rb b/app/models/tiding.rb
index ec8c68d8..6b40615c 100644
--- a/app/models/tiding.rb
+++ b/app/models/tiding.rb
@@ -358,6 +358,14 @@ class Tiding < ActiveRecord::Base
" "
when 'Department'
"你选填的二级单位:#{self.container.try(:name)}(#{self.container.try(:school).name})因不符合规范,已被系统删除.请重新选择"
+ when 'Library'
+ library = Library.find_by(id: container_id)
+ if tiding_type == 'Apply'
+ "申请发布文库:#{library.try(:name)}"
+ elsif tiding_type == 'System'
+ text = status == 1 ? "审核已通过" : "审核未通过, 原因:#{extra}"
+ "你提交的发布文库申请:#{library.try(:name)},#{text}"
+ end
else
logger.error "error type: 1"
end
diff --git a/app/models/user.rb b/app/models/user.rb
index db1ff58a..c206d51e 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -250,6 +250,7 @@ class User < Principal
has_many :ec_course_users
+ has_many :libraries, dependent: :destroy
#####
scope :logged, lambda { where("#{User.table_name}.status <> #{STATUS_ANONYMOUS}") }
diff --git a/app/services/libraries/agree_apply_service.rb b/app/services/libraries/agree_apply_service.rb
new file mode 100644
index 00000000..8d901b67
--- /dev/null
+++ b/app/services/libraries/agree_apply_service.rb
@@ -0,0 +1,32 @@
+class Libraries::AgreeApplyService
+ Error = Class.new(StandardError)
+
+ attr_reader :library_apply, :library, :user
+
+ def initialize(library_apply, user)
+ @library_apply = library_apply
+ @library = library_apply.library
+ @user = user
+ end
+
+ def call
+ raise Error, '该状态下不能进行此操作' unless library_apply.may_agree?
+
+ ActiveRecord::Base.transaction do
+ library_apply.agree!
+ library_apply.library.publish!
+
+ # 将消息改为已处理
+ Tiding.where(container_id: library.id, container_type: 'Library', tiding_type: 'Apply', status: 0).update_all(status: 1)
+ notify_library_author!
+ end
+ end
+
+ private
+
+ def notify_library_author!
+ Tiding.create!(user_id: library.user_id, trigger_user_id: 1,
+ container_id: library.id, container_type: 'Library',
+ tiding_type: 'System', status: 1)
+ end
+end
\ No newline at end of file
diff --git a/app/services/libraries/refuse_apply_service.rb b/app/services/libraries/refuse_apply_service.rb
new file mode 100644
index 00000000..5661773c
--- /dev/null
+++ b/app/services/libraries/refuse_apply_service.rb
@@ -0,0 +1,37 @@
+class Libraries::RefuseApplyService
+ Error = Class.new(StandardError)
+
+ attr_reader :library_apply, :library, :user, :params
+
+ def initialize(library_apply, user, params)
+ @library_apply = library_apply
+ @library = library_apply.library
+ @user = user
+ @params = params
+ end
+
+ def call
+ reason = params[:reason].to_s.strip
+ raise Error, '原因不能为空' if reason.blank?
+ raise Error, '该状态下不能进行此操作' unless library_apply.may_refuse?
+
+ ActiveRecord::Base.transaction do
+ library_apply.reason = reason
+ library_apply.refused_at = Time.current
+ library_apply.refuse
+ library_apply.save!
+
+ # 将消息改为已处理
+ Tiding.where(container_id: library.id, container_type: 'Library', tiding_type: 'Apply', status: 0).update_all(status: 1)
+ notify_library_author!
+ end
+ end
+
+ private
+
+ def notify_library_author!
+ Tiding.create!(user_id: library.user_id, trigger_user_id: 1,
+ container_id: library.id, container_type: 'Library',
+ tiding_type: 'System', status: 2, extra: library_apply.reason)
+ end
+end
\ No newline at end of file
diff --git a/app/services/libraries/save_service.rb b/app/services/libraries/save_service.rb
new file mode 100644
index 00000000..3a81d379
--- /dev/null
+++ b/app/services/libraries/save_service.rb
@@ -0,0 +1,37 @@
+class Libraries::SaveService
+ Error = Class.new(StandardError)
+
+ attr_reader :library, :user, :params
+
+ def initialize(library, user, params)
+ @library = library
+ @user = user
+ @params = params
+ end
+
+ def call
+ validate_params!
+
+ if library.new_record?
+ library.user_id = user.id
+ library.generate_uuid
+ end
+
+ attachment_ids = params.delete(:attachment_ids)
+
+ ActiveRecord::Base.transaction do
+ library.assign_attributes(params)
+ library.save!
+
+ Attachment.where(id: attachment_ids).update_all(container_id: library.id, container_type: 'Library')
+ end
+
+ library
+ end
+
+ private
+
+ def validate_params!
+ raise Error, '附件不能为空' if params[:attachment_ids].blank?
+ end
+end
diff --git a/app/services/libraries/submit_service.rb b/app/services/libraries/submit_service.rb
new file mode 100644
index 00000000..965ba673
--- /dev/null
+++ b/app/services/libraries/submit_service.rb
@@ -0,0 +1,31 @@
+class Libraries::SubmitService
+ Error = Class.new(StandardError)
+
+ attr_reader :library
+
+ def initialize(library)
+ @library = library
+ end
+
+ def call
+ raise Error, '该状态下不能提交审核' unless library.may_submit?
+
+ ActiveRecord::Base.transaction do
+ library.published_at = Time.current
+ library.submit
+ library.save!
+
+ library.library_applies.create!
+ send_library_apply_notify!
+ end
+ end
+
+ private
+
+ def send_library_apply_notify!
+ Tiding.create!(user_id: 1, trigger_user_id: library.user_id,
+ container_id: library.id, container_type: 'Library',
+ tiding_type: 'Apply', status: 0)
+ Trustie::Sms.send(mobile: '18711011226', send_type:'publish_library' , name: '管理员') rescue nil
+ end
+end
\ No newline at end of file
diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb
index 48fee5c4..891cf808 100644
--- a/app/views/layouts/base_management.html.erb
+++ b/app/views/layouts/base_management.html.erb
@@ -116,6 +116,7 @@
<%= link_to '单位审批', unit_managements_path %>
<%= link_to '实训发布', shixun_authorization_managements_path %>
<%= link_to '实训课程发布', subject_authorization_managements_path %>
+ <%= link_to '文库发布', library_applies_path(status: :pending) %>
认证+
diff --git a/app/views/managements/library_applies/_library_apply_list.html.erb b/app/views/managements/library_applies/_library_apply_list.html.erb
new file mode 100644
index 00000000..46fe1b54
--- /dev/null
+++ b/app/views/managements/library_applies/_library_apply_list.html.erb
@@ -0,0 +1,78 @@
+<% if @library_applies.present? %>
+ <% @library_applies.each do |apply| %>
+ <% user = apply.library.user %>
+ <% library = apply.library %>
+
+ <% end %>
+
+
+
+ <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
+
+
+
+
+<% else %>
+ <%= render :partial => "welcome/no_data" %>
+<% end %>
+
+
\ No newline at end of file
diff --git a/app/views/managements/library_applies/index.html.erb b/app/views/managements/library_applies/index.html.erb
new file mode 100644
index 00000000..6cef2418
--- /dev/null
+++ b/app/views/managements/library_applies/index.html.erb
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+ <%= link_to "待审批", library_applies_path(status: :pending), class: 'tab_type', remote: true %>
+
+
+ <%= link_to "已审批", library_applies_path(status: [:refused, :agreed]), class: 'tab_type', remote: true %>
+
+
+
+
+
+
+
+
+ <%= render :partial => "managements/library_applies/library_apply_list"%>
+
+
+
+
+
+
+
+ <%= link_to "全部", library_applies_path(status: [:refused, :agreed]), :class => "edu-filter-cir-grey mr5 fl font-12 active", :id => "library_all_authentication", :remote => true %>
+ <%= link_to "同意", library_applies_path(status: :agreed), :class => "edu-filter-cir-grey mr5 fl font-12", :id => "library_agree_authentication", :remote => true %>
+ <%= link_to "拒绝", library_applies_path(status: :refused), :class => "edu-filter-cir-grey mr5 fl font-12", :id => "library_reject_authentication", :remote => true %>
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/managements/library_applies/index.js.erb b/app/views/managements/library_applies/index.js.erb
new file mode 100644
index 00000000..aa6f932f
--- /dev/null
+++ b/app/views/managements/library_applies/index.js.erb
@@ -0,0 +1,30 @@
+var nTabIcon_1 = $("#edu-tab-con-1");
+var nTabIcon_2 = $("#edu-tab-con-2");
+var nTabNav_1 = $("#edu-tab-nav-1");
+var nTabNav_2 = $("#edu-tab-nav-2");
+var nAudit = $("#library_all_authentication").parent();
+
+<% if params[:status].to_s == 'pending' %>
+$("#authentication_list").html("<%= j( render :partial => "managements/library_applies/library_apply_list" ) %>");
+nTabNav_1.addClass("background-orange");
+nTabNav_2.removeClass("background-orange");
+nTabIcon_1.show();
+nTabIcon_2.hide();
+<% else %>
+$("#library_authentication_list").html("<%= j( render :partial => "managements/library_applies/library_apply_list" ) %>");
+nTabNav_1.removeClass("background-orange");
+nTabNav_2.addClass("background-orange");
+nTabIcon_1.hide();
+nTabIcon_2.show();
+/* -------------------------- 未审批(全部、同意、拒绝点击时动态样式) ------------------------------ */
+if(<%= params[:status].to_s == 'agreed' %>){
+ nAudit.find(".active").removeClass("active");
+ $("#library_agree_authentication").addClass("active");
+}else if(<%= params[:status].to_s == 'refused' %>){
+ nAudit.find(".active").removeClass("active");
+ $("#library_reject_authentication").addClass("active");
+}else{
+ nAudit.find(".active").removeClass("active");
+ $("#library_all_authentication").addClass("active");
+}
+<% end %>
\ No newline at end of file
diff --git a/config/locales/libraries/zh.yml b/config/locales/libraries/zh.yml
new file mode 100644
index 00000000..3004ecab
--- /dev/null
+++ b/config/locales/libraries/zh.yml
@@ -0,0 +1,8 @@
+'zh':
+ activerecord:
+ models:
+ library: '文库'
+ attributes:
+ library:
+ title: '标题'
+ content: '描述'
diff --git a/config/routes.rb b/config/routes.rb
index 137a1231..6a053d70 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -730,6 +730,15 @@ RedmineApp::Application.routes.draw do ## oauth相关
get :school_data_grow, controller: 'managements::schools', action: 'data_grow'
get :school_data_contrast, controller: 'managements::schools', action: 'data_contrast'
get :school_statistics_xlsx, controller: 'managements::schools', action: 'statistics_xlsx'
+
+ scope module: :managements do
+ resources :library_applies, only: [:index] do
+ member do
+ post :agree
+ post :refuse
+ end
+ end
+ end
end
end
# Enable Grack support
@@ -2649,6 +2658,10 @@ RedmineApp::Application.routes.draw do ## oauth相关
resource :sso, only: [:show, :create]
+ resources :libraries do
+ post :publish, on: :member
+ end
+
get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_subfield_without_id'
Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
diff --git a/db/migrate/20190626004605_create_libraries.rb b/db/migrate/20190626004605_create_libraries.rb
new file mode 100644
index 00000000..b782eacd
--- /dev/null
+++ b/db/migrate/20190626004605_create_libraries.rb
@@ -0,0 +1,18 @@
+class CreateLibraries < ActiveRecord::Migration
+ def change
+ create_table :libraries do |t|
+ t.references :user
+
+ t.string :title
+ t.text :content
+ t.string :uuid, unique: true
+ t.string :status
+ t.integer :visited_count
+ t.datetime :published_at
+
+ t.timestamps
+ end
+
+ add_index :libraries, :published_at
+ end
+end
diff --git a/db/migrate/20190626005624_create_library_applies.rb b/db/migrate/20190626005624_create_library_applies.rb
new file mode 100644
index 00000000..990bfa38
--- /dev/null
+++ b/db/migrate/20190626005624_create_library_applies.rb
@@ -0,0 +1,14 @@
+class CreateLibraryApplies < ActiveRecord::Migration
+ def change
+ create_table :library_applies do |t|
+ t.references :library
+ t.string :status
+ t.string :reason
+
+ t.datetime :refused_at
+ t.timestamps
+ end
+
+ add_index :library_applies, :refused_at
+ end
+end
diff --git a/lib/trustie/sms/sms.rb b/lib/trustie/sms/sms.rb
index 33584a0c..319de17c 100644
--- a/lib/trustie/sms/sms.rb
+++ b/lib/trustie/sms/sms.rb
@@ -57,6 +57,9 @@ module Trustie
elsif send_type == "training_pay"
params['text'] = "【计算机实践教学】亲爱的#{user_name}老师,您已经成功报名参与了11月24日--25日在深圳大学举办的全国软件工程实践教学案例与应用研讨会,请准时参加。(如有任何参会问题,请致电咨询会务联系人汤老师13099740868)"
Rails.logger.info "#{params['text']}"
+ elsif send_type == 'publish_library'
+ params['text'] = "【Edu实训】亲爱的#{name},有新的文库发布申请,请尽快处理"
+ Rails.logger.info "#{params['text']}"
end
http = Net::HTTP.new(send_tpl_sms_uri.host, send_tpl_sms_uri.port)
From 070be6e895bda77eb0c70816b6b6bc6db19013e6 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Thu, 27 Jun 2019 11:12:13 +0800
Subject: [PATCH 11/42] competition staff setting
---
app/controllers/competitions_controller.rb | 70 +++++++++++--------
app/models/competition.rb | 1 +
app/models/competition_staff.rb | 22 ++++++
.../_competition_list_page.html.erb | 57 +++++++++++++--
config/locales/competition_staffs/zh.yml | 7 ++
...0190627013059_create_competition_staffs.rb | 13 ++++
public/stylesheets/css/edu-admin.css | 6 +-
7 files changed, 138 insertions(+), 38 deletions(-)
create mode 100644 app/models/competition_staff.rb
create mode 100644 config/locales/competition_staffs/zh.yml
create mode 100644 db/migrate/20190627013059_create_competition_staffs.rb
diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb
index 384bf4df..75a06fd3 100644
--- a/app/controllers/competitions_controller.rb
+++ b/app/controllers/competitions_controller.rb
@@ -458,41 +458,51 @@ class CompetitionsController < ApplicationController
def competition_setting
# @competition = Competition.find params[:id]
- if params[:md_name]
- md_modules = @competition.competition_modules.where(:md_edit => true)
- md_modules.destroy_all if md_modules
- params[:md_name].each_with_index do |name, index|
- hidden = params[:md_checked][index].to_i == 0 ? 1 : 0
- cm = CompetitionModule.create(:competition_id => @competition.id,:name => name, :position => params[:md_position][index], :hidden => hidden, :md_edit => true)
- # 创建md_contents
- CompetitionModuleMdContent.create(:competition_module_id => cm.id)
+ ActiveRecord::Base.transaction do
+ if params[:md_name]
+ md_modules = @competition.competition_modules.where(:md_edit => true)
+ md_modules.destroy_all if md_modules
+ params[:md_name].each_with_index do |name, index|
+ hidden = params[:md_checked][index].to_i == 0 ? 1 : 0
+ cm = CompetitionModule.create(:competition_id => @competition.id,:name => name, :position => params[:md_position][index], :hidden => hidden, :md_edit => true)
+ # 创建md_contents
+ CompetitionModuleMdContent.create(:competition_module_id => cm.id)
+ end
end
- end
- if params[:competition_module]
- @competition.competition_modules.where(:id => params[:competition_module], :md_edit => false).update_all(:hidden => 0)
- none_modules = @competition.competition_modules.where("name != '首页' and md_edit = false").map(&:id).join(",").split(",") - params[:competition_module]
- @competition.competition_modules.where(:id => none_modules).update_all(:hidden => 1)
- end
- if params[:name]
- @competition.competition_modules.where("name not in ('首页', '报名', '通知公告', '排行榜', '资料下载') and md_edit = false").each_with_index do |mod, index|
- mod.update_attribute("name", params[:name][index])
+ if params[:competition_module]
+ @competition.competition_modules.where(:id => params[:competition_module], :md_edit => false).update_all(:hidden => 0)
+ none_modules = @competition.competition_modules.where("name != '首页' and md_edit = false").map(&:id).join(",").split(",") - params[:competition_module]
+ @competition.competition_modules.where(:id => none_modules).update_all(:hidden => 1)
end
- end
- if params[:url]
- @competition.competition_modules.where("name not in ('首页', '报名', '通知公告', '排行榜') and md_edit = false").each_with_index do |mod, index|
- mod.update_attribute("url", params[:url][index])
+ if params[:name]
+ @competition.competition_modules.where("name not in ('首页', '报名', '通知公告', '排行榜', '资料下载') and md_edit = false").each_with_index do |mod, index|
+ mod.update_attribute("name", params[:name][index])
+ end
end
- end
- if params[:position]
- @competition.competition_modules.where(:md_edit => false).each_with_index do |mod, index|
- mod.update_attribute("position", params[:position][index])
+ if params[:url]
+ @competition.competition_modules.where("name not in ('首页', '报名', '通知公告', '排行榜') and md_edit = false").each_with_index do |mod, index|
+ mod.update_attribute("url", params[:url][index])
+ end
end
- end
- @competition.update_attributes(:identifier => params[:identifier], :min_num => params[:min_num], :max_num => params[:max_num], :enroll_end_time => params[:enroll_end_time])
- if params[:new_name]
- params[:new_name].each_with_index do |new_module, index|
- @competition.competition_modules << CompetitionModule.new(:name => new_module, :position => params[:new_position][index], :hidden => 0, :url => params[:new_url][index])
+ if params[:position]
+ @competition.competition_modules.where(:md_edit => false).each_with_index do |mod, index|
+ mod.update_attribute("position", params[:position][index])
+ end
+ end
+ @competition.update_attributes(:identifier => params[:identifier], :enroll_end_time => params[:enroll_end_time])
+
+ if params[:competition_staffs].present?
+ @competition.competition_staffs.delete_all
+ params[:competition_staffs].each_with_index do |staff_params, index|
+ @competition.competition_staffs.create(staff_params.merge(position: index + 1))
+ end
+ end
+
+ if params[:new_name]
+ params[:new_name].each_with_index do |new_module, index|
+ @competition.competition_modules << CompetitionModule.new(:name => new_module, :position => params[:new_position][index], :hidden => 0, :url => params[:new_url][index])
+ end
end
end
end
diff --git a/app/models/competition.rb b/app/models/competition.rb
index 9b421ed9..9506b724 100644
--- a/app/models/competition.rb
+++ b/app/models/competition.rb
@@ -13,6 +13,7 @@ class Competition < ActiveRecord::Base
has_many :chart_rules, :dependent => :destroy
has_many :competition_scores, :dependent => :destroy
has_many :competition_text_configs, :dependent => :destroy
+ has_many :competition_staffs, dependent: :destroy
acts_as_attachable
after_create :create_competition_modules
diff --git a/app/models/competition_staff.rb b/app/models/competition_staff.rb
new file mode 100644
index 00000000..bfa1daba
--- /dev/null
+++ b/app/models/competition_staff.rb
@@ -0,0 +1,22 @@
+class CompetitionStaff < ActiveRecord::Base
+ default_scope order: 'position asc'
+
+ attr_accessible :minimum, :maximum, :category, :position
+
+ belongs_to :competition
+
+ validates :position, numericality: { only_integer: true }
+ validates :minimum, numericality: { only_integer: true, greater_than: 0 }
+ validates :maximum, numericality: { only_integer: true, greater_than_or_equal_to: lambda { |obj| obj.minimum } }
+ validates :category, presence: true, inclusion: { in: %w(all teacher student profession) }
+
+ def category_text
+ I18n.t("competition_staff.category.#{category}", locale: 'zh')
+ end
+
+ def self.category_options
+ %w(all teacher student profession).map do |category|
+ [I18n.t("competition_staff.category.#{category}", locale: 'zh'), category]
+ end
+ end
+end
\ No newline at end of file
diff --git a/app/views/managements/_competition_list_page.html.erb b/app/views/managements/_competition_list_page.html.erb
index 2610f7dc..94cacc8d 100644
--- a/app/views/managements/_competition_list_page.html.erb
+++ b/app/views/managements/_competition_list_page.html.erb
@@ -68,13 +68,29 @@
<% end %>
<% if com_module.name == "报名" %>
-
- ~
- 人
-
-
-
报名截止:
-
+
<% end %>
<% if com_module.name != "首页" && com_module.name != "报名" && com_module.name != "通知公告" && com_module.name != "排行榜" %>
@@ -149,6 +165,20 @@
+
+
<% content_for :header_tags do %>
@@ -504,4 +534,17 @@
}
})
}
+
+ $(function(){
+ $('.add-competition-staff-btn').on('click', function(){
+ $('.competition-staff-settings').append($('.competition-staff-row-example').html());
+ });
+
+ $('.competition-staff-settings').on('click', '.add-icon', function(){
+ $('.competition-staff-settings').append($('.competition-staff-row-example').html());
+ });
+ $('.competition-staff-settings').on('click', '.delete-icon', function(){
+ $(this).parents('.competition-staff-row').remove();
+ });
+ })
diff --git a/config/locales/competition_staffs/zh.yml b/config/locales/competition_staffs/zh.yml
new file mode 100644
index 00000000..2d51f90c
--- /dev/null
+++ b/config/locales/competition_staffs/zh.yml
@@ -0,0 +1,7 @@
+'zh':
+ competition_staff:
+ category:
+ all: 不限
+ teacher: 教师
+ student: 学生
+ profession: 专业人士
\ No newline at end of file
diff --git a/db/migrate/20190627013059_create_competition_staffs.rb b/db/migrate/20190627013059_create_competition_staffs.rb
new file mode 100644
index 00000000..7958534c
--- /dev/null
+++ b/db/migrate/20190627013059_create_competition_staffs.rb
@@ -0,0 +1,13 @@
+class CreateCompetitionStaffs < ActiveRecord::Migration
+ def change
+ create_table :competition_staffs do |t|
+ t.references :competition
+ t.integer :position
+ t.string :category
+ t.integer :minimum
+ t.integer :maximum
+
+ t.timestamps
+ end
+ end
+end
diff --git a/public/stylesheets/css/edu-admin.css b/public/stylesheets/css/edu-admin.css
index 7448e758..b3d4987b 100644
--- a/public/stylesheets/css/edu-admin.css
+++ b/public/stylesheets/css/edu-admin.css
@@ -104,4 +104,8 @@ a:hover.edu-admin-nav-a,.active a.edu-admin-nav-a{color: #5faee3;}
/*超级管理员----技术体系*/
.createsystem{cursor: pointer;width: 100%;height: 70px;line-height: 70px;border:1px dashed #FF7500;color: #FF7500;text-align: center;margin:15px 0px 20px 0px;border-radius: 4px;}
-.infoul li{list-style-type: disc}
\ No newline at end of file
+.infoul li{list-style-type: disc}
+
+/* 竞赛配置 */
+.competition-staff-settings .competition-staff-row .competition-staff-operate .add-icon { display: none; }
+.competition-staff-settings .competition-staff-row:last-child .competition-staff-operate .add-icon { display: inline; }
\ No newline at end of file
From d0496b45be74dee3b3e580918f66a97c0bd4f408 Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Thu, 27 Jun 2019 14:36:37 +0800
Subject: [PATCH 12/42] =?UTF-8?q?=E6=96=87=E5=BA=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../attachments/_from_libraries.html.erb | 62 +++++++++++
app/views/libraries/index.html.erb | 61 +++++++++++
app/views/libraries/new.html.erb | 81 +++++++++++++++
app/views/libraries/publish.html.erb | 15 +++
app/views/libraries/show.html.erb | 96 ++++++++++++++++++
.../managements/_libraries_index.html.erb | 0
public/images/educoder/success.png | Bin 0 -> 3351 bytes
public/stylesheets/educoder/edu-all.css | 36 +++++++
public/stylesheets/educoder/edu-main.css | 2 +-
9 files changed, 352 insertions(+), 1 deletion(-)
create mode 100644 app/views/attachments/_from_libraries.html.erb
create mode 100644 app/views/libraries/index.html.erb
create mode 100644 app/views/libraries/new.html.erb
create mode 100644 app/views/libraries/publish.html.erb
create mode 100644 app/views/libraries/show.html.erb
create mode 100644 app/views/managements/_libraries_index.html.erb
create mode 100644 public/images/educoder/success.png
diff --git a/app/views/attachments/_from_libraries.html.erb b/app/views/attachments/_from_libraries.html.erb
new file mode 100644
index 00000000..4486ec13
--- /dev/null
+++ b/app/views/attachments/_from_libraries.html.erb
@@ -0,0 +1,62 @@
+
+
+ 上传附件
+
+ 从我的电脑选择要上传的文档:按住CTRL可以上传多份文档
+ 上传出现错误,请检查您的网络环境,并刷新页面重新上传。
+
+
+
+ <% if defined?(container) && container && container.saved_attachments %>
+ <% container.attachments.each_with_index do |attachment, i| %>
+
+
+ <% size = judge_Chinese_num attachment.filename %>
+ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly hidden color-grey fl', :size => size, :style => 'border:none; max-width:980px;white-space: nowrap; text-overflow:ellipsis;font-family: Consolas;', :readonly => 'readonly') %>
+ <%= number_to_human_size attachment.filesize %>
+ <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
+ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
+
+ <% end %>
+ <% container.saved_attachments.each_with_index do |attachment, i| %>
+
+
+
+ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'hidden atta_input readonly color-grey fl', :style => 'border:none; max-width:980px;', :readonly => 'readonly') %>
+ <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload fl mt2') unless attachment.id.nil? %>
+ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
+
+ <% end %>
+ <% end %>
+
+<%= file_field_tag 'attachments[dummy][file]',
+ :id => '_file',
+ :class => ie8? ? '' : 'file_selector',
+ :multiple => true,
+ :onchange => 'addInputFiles(this);',
+ :style => ie8? ? '' : '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',:project =>nil),
+ :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),
+ :lebel_file_uploding => l(:lebel_file_uploding),
+ :delete_all_files => l(:text_are_you_sure_all)
+ } %>
+
+
+
+<%= javascript_include_tag 'attachments' %>
+
\ No newline at end of file
diff --git a/app/views/libraries/index.html.erb b/app/views/libraries/index.html.erb
new file mode 100644
index 00000000..f79227f6
--- /dev/null
+++ b/app/views/libraries/index.html.erb
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格
+
+ 张莉
+ 188 浏览
+ 发布时间:2018-05-15 15:45
+
+
+
+
+
+
+
软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格
+
+ 张莉
+ 188 浏览
+ 发布时间:2018-05-15 15:45
+
+
+
+
+
+
+
软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格
+
+ 张莉
+ 188 浏览
+ 发布时间:2018-05-15 15:45
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/libraries/new.html.erb b/app/views/libraries/new.html.erb
new file mode 100644
index 00000000..e5cf8ef9
--- /dev/null
+++ b/app/views/libraries/new.html.erb
@@ -0,0 +1,81 @@
+<%= javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/hint/show-hint", "/codemirror/addon/hint/javascript-hint", "/codemirror/addon/selection/active-line", "/codemirror/addon/lint/javascript-lint", "/codemirror/addon/lint/css-lint", "/codemirror/addon/lint/lint", "/codemirror/addon/lint/json-lint", "/editormd/lib/codemirror/addon/lint/css-lint" %>
+<%= stylesheet_link_tag "/codemirror/lib/codemirror" %>
+<%= stylesheet_link_tag '/editormd/css/editormd' %>
+<%= javascript_include_tag '/editormd/editormd' %>
+
+
+ 胡莎莎 >
+ 文库 >
+ 新建
+
+
上传文档
+
+
+
+ 标题
+
+ 简明扼要介绍文档&视频所包含的主要的内容
+
+
+ <%= render :partial => 'attachments/from_libraries', :locals => {:container => @homework} %>
+
+
+
+
+
审核说明
+
+ 平台管理员将对每天新上传的文档进行审核,审核通过的文档将公开显示,否则将私有化或移除
+
+
+
+
温馨提示
+
+ 1.请勿上传已设置加密或只读的文档资源
+ 2.可以上传教学积累和撰写的文档资料,如教学案例、总结、心得等,上传支持的文件最大容量:100MB
+ 3.上传涉及侵权内容的文档将会被移除。
+ 4.为营造绿色网络环境,严禁上传违反国家关于互联网相关规定的内容
+ 5.Chrome,Firefox,Safari,IE11及以上版本浏览器上传!
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/libraries/publish.html.erb b/app/views/libraries/publish.html.erb
new file mode 100644
index 00000000..1c5a718c
--- /dev/null
+++ b/app/views/libraries/publish.html.erb
@@ -0,0 +1,15 @@
+
+
\ No newline at end of file
diff --git a/app/views/libraries/show.html.erb b/app/views/libraries/show.html.erb
new file mode 100644
index 00000000..f8906b04
--- /dev/null
+++ b/app/views/libraries/show.html.erb
@@ -0,0 +1,96 @@
+
+
+ 胡莎莎 >
+ 文库 >
+ 新建
+
+
+ C语言程序教学案例
+ 草稿
+ 返回
+
+
+
+
+ 私有化原因
+ (请按照提示修改,并在完成编辑后重新提交)
+ 点击展开
+
+
+
+ 2018-12-25 03:58
+ 文档&视频的任何位置(包括文档标题、简介、文档等),都不允许出现任何有推广或宣传目的内容,如电话号码、电子邮箱地址、即时通讯工具号码等具体联系信息以及广告宣传语等,其中被警告多次而仍然添加广告内容的用户会被判定为广告用户,将接受封号处罚。
+
+
+ 2018-12-25 03:58
+ 文档&视频的任何位置(包括文档标题、简介、文档等),都不允许出现任何有推广或宣传目的内容,如电话号码、电子邮箱地址、即时通讯工具号码等具体联系信息宣传语等,其中被警告多次而仍然添加广告内容的用户会被判定为广告用户,将接受封号处罚。
+
+
+
+
+
+ 详情
+ 编辑
+
+
+
+
+
胡莎莎
+
+ 国防科技大学
+ 教授
+
+ 编码:2018120409235950611737
+ 上传时间:2018-12-04 09:23
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/managements/_libraries_index.html.erb b/app/views/managements/_libraries_index.html.erb
new file mode 100644
index 00000000..e69de29b
diff --git a/public/images/educoder/success.png b/public/images/educoder/success.png
new file mode 100644
index 0000000000000000000000000000000000000000..9282ef4d0d542489b5bb716593ede64aba53e467
GIT binary patch
literal 3351
zcmV+y4e0WTP)2x2CPcp6(knL$7i
z6;55Mc#h~PC{hmzGeN5rthlgdCInIui!8E~ge94IU(bEXUpR|
z0RZ0~ZnsEhHa|$4%gh(0*;2IL-8(0|l9>6+g`4fV5
zwXbMuje+pGp%OxnK~=M_vat2HAR0@ojDVOGX08L_yfePYHgmT9N`w8^&(WZtsc3)q9FdjC=T#$UPE6>W(6e6AgAR``5tLU?V
znO_eO=GQu$J5;B2FfO)$K}LFW5wik!=g
zw97a_HY~Ok9RA+|F;@^^9Ilbx8jQtaZGiET|Ln6S$P3CAo-rz7g{CTs#w2a>vi1d_DrY?2IU*J7nfD*!PX^6
z{+c;g+a&rBpk8{6=sIorP?OBRt}QNGuhl2bf)se>jFL!N2_REz=Uud2z0C4&{6%GJ
zwfLt=5WDx8;lxrUh!S<_LkkziwP7?c1;_Xt(>{w9G-^QxRn8h_vDiK$P*${^b+h`1
zgA}~3X7sd;(fA#eAcMX0`br3{C!k+6opjf_4BjoH@#-4K4Dk&{RZ%U-1#8RG(&UU!
z3AkJpaXT!u4`HM=IhQkayLI$pRCM!jf
zws)0}OGc8a2TOe9YLw+cJBz0sX%8o?Aa<{7E`g@%={(uCeFhjj*XMASsun~_@ed#C)yn$c8}{dA`)Rb$zl=%BFxBFb0Y-Af8t(8NJ;6`NXQ=E?pd=X0S>P7}oLacv@^OH8#O
zfx*v9?TLGHuEKS_^YF9OOaxeluYMo?{@*QFzGt)Yx6y@xjXp=|urmZ1ROuRKwb0i_
zci36*hWEzI6K-=QjfQ)CjSAT(gL1y5YTb
z0>F{kxp=&6#{zQg#h4Grg2x?tw}d_~SB&4PGbONr?B
z3C^Km=4lxjq0ZMI{1y|xdDk#oegfj9)eh&lmJ#CGL7;&q^pbFpdc+XUyteBLxNAQ)
z+%E?2^f{b)l>g!EKGsy*-tI7e=oLeRy5GKGDYhNmYl0wPS)y~PpyKJ#lGW-pyoUq>
z)H-LhcH`~c-{8+R9@9LNSsqPxuj^p~J#Shs2>>i!`W6-5j8u#Ey{2mq)Z&rND@}P@
z4^hOx!&KmP&zFG73Ba2vCI~TJD7+bII>e~jUyCVQR-(y-rIXf9%fJFE@VHh;L}N{1
zBhH{kh~aG!!;E#Tw)Du%@6iyiTkK`HD$d*)-hF2iqvc&>y%1zOfPBLli2^W9vf_@u
zLovE{J}&6d3n%3Od`I`={U5fX>OgH2NX=C{qZlnt)(Sy>1dtuI*9JAnN$-V4g<~-=
zYjCA3YZ~6Yavb`l
zcf8f)^FzBZY2)&Uq8K8^zU`Q@H4b7lbK5|6k2^pFi@{v0f-B9t7I)`dsj9A6vUp(A
zim;+|0WrjaRv>PIh&7v!emMz!Qq_OH4<|~O5JOpDL@;i*taDQ`@X-j7k0!bzM47Z{
zg);Gra!s!RSX6k6uJ;UYd~Z{&2;gI4QWuH3V!o}pPf7+p)*y(meqGD$>$0r#l{fG-
zi}oZ#YxdP(>ef}UpTOI{4#lMI7SEM=(OswdYfB*fYvhB-vZZMP+jL|P250u}N@55e
zYRT?(|C<1HGpi=*!Z#`}C|2G-;!zT8WP~XAJg!S8KTplXieF67JW8|*nV@1oSvraL
z;^JjleX(Tdt>_UZ{6;J3;o6DFk;f8e&N$6XWpUB&bw5PFLZcmz2JiB$zIb`)tzl!L
zqQUB@t`I{^;6amDZME9ly!_srv!qHZh*9mt6Vu|Mx0xnNqKhGTWH~S@p+4b?+t*?f
zMoOm;L+Bws;RvV)RJq3}PswBNXJI2;z0WMZoXku11Rimu8)hB?jES
zD)##E*fud|m>t8epE+iJ%U9(5LuiEDM}(L4!y1R6SCq~qhB87J_xp-U7b}7kRJe1=
zii8U#)hbG-6GK_&J(1@xd9v=O==TH-wjOrY`B*aSR%BXJRSmz+CPuSUZGx?vC-%hM
zjvz$&>#*A*zC2d$^S8WbB>tSy`s!ll*}fv@6XJiTMo6M>*b$G!3ojXqUMcDAj+9kD
zY{L`P70NcW&Q^jX4XYVFRmnVe`j$4Ydm{mbiRw_cEgj-e!%d(4R?o}sX$vN|MXO~~f4zo=*yixMdMZ>#!^>vjkc69))JlBqRfbzP`TtArvM#EV&zu@1$@EO-
zNy2DsBEC>{dM4$G%R6Vj1gXnzQ!tP1$jCC}1%5}_l=f-mt{|Yp)TRcS
z+ohoxsPs8XOFD8gq9FMn&go}MrA^60TXbJ5KL%kLTH|=M!^Hd%1yLsWD)$}4c)L4n
zoz_iz`|}2~9K6$CJnfxG_^Jd^-c6FJ{~~c2_IGApn>?H47h%FGzJ=m?=~5D{@A>b3Ci(#u>7MN97L@4LO;w1-k{~Uyif<4M@R^u
zz~e5IB&-6XzgnxiWIe`r%)uLc#nU$H@lUrP%ADez*;hj9N&+s^V@zjl%iyobX1lTa
zS5x-r^}!H9gc1GTnU|iK9eA<3ovOgVYxU`t2X_yD^tfIzbWQ5vI=6dW6TtKw5zaEg
zz(mDh;0VBzeGaFgtKo)?kk-WIdgtb(L4E}wN1_s{%PxZFWH5M7q!ZV)^kIr1Aw$HW
zVvxPbU{u%9)Il4m6~`42zPa!(|b4o#v8JYX8Nx!t&5giE%jq2NXR%5_hn^F
zX?Yq`pLs@$ciP)DFw^S+lIOP<8KNCFa?6+t5;92yQKX-g#t}&q35ZWRhc^6(z-MOp
z)#E4RH(Q5yMyAoY8gUb(wF^Vmx-Vwt+re}TfQw@FWl|);CtxcRFDIgRt4Eb?F^*bo
zNC_cGYt!>8X7;yOQ%WSzC<2cFXn;1?!nNXE4Ej_CuMGwoD|VF3F#7BXUFIg7AZ@)7
z%Q8S(At6{ukn+IDCF1h{^aLmq%xMf#_PddC>I0nsxE{b!X4(Tn9TV3w%bS6~rW(hL
h4ucGIv1vf#{{wCF@J=*+b}j$_002ovPDHLkV1g8qVdVe-
literal 0
HcmV?d00001
diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css
index bbd05a56..b946dc24 100644
--- a/public/stylesheets/educoder/edu-all.css
+++ b/public/stylesheets/educoder/edu-all.css
@@ -3249,4 +3249,40 @@ line-height: 16px;display: inline-block;color: rgba(65, 140, 205, 1) !important;
position:absolute;
top: 12px;
right: 20px;
+}
+
+/*文库*/
+.library_nav li{
+ float: left;cursor: pointer;margin-right: 30px;position: relative;color: #05101A;height: 40px;line-height: 20px;
+ font-size: 16px;
+}
+.library_nav li.active,.library_nav li:hover{
+ color: #4cacff;
+}
+.library_nav li.active:after{
+ position: absolute;content: '';background: #4cacff;color: #4cacff;width: 100%;height: 2px;bottom: 0px;left:0px;
+}
+.library_list{
+ margin-bottom: 30px;
+}
+.library_list_item{
+ background: #fff;padding:30px;margin-bottom: 15px;display: flex;
+}
+.upload_Title{
+ position: relative;margin-right: 30px;float: left;line-height: 35px;font-size: 16px;
+}
+.upload_Title:before{
+ position: absolute;left: -10px;top:2px;content: '*';color: #FE4F4C;
+}
+.librariesField{
+ width: 100%;background: #F2F9FF;justify-content: center;align-items: center;display: -webkit-flex;text-align: center;
+ height: 120px;border-radius: 4px;border:1px dashed #4cacff;
+}
+.private_reason{overflow: hidden}
+.private_reason li{margin-bottom: 10px;}
+.successPage{
+ justify-content: center;align-items: center;display: -webkit-flex;height: 570px;text-align: center;margin-bottom: 50px;
+}
+.changebtn{
+ width: 127px;font-size: 16px;height: 40px; line-height: 40px;
}
\ No newline at end of file
diff --git a/public/stylesheets/educoder/edu-main.css b/public/stylesheets/educoder/edu-main.css
index 266f9b7f..bab8eb70 100644
--- a/public/stylesheets/educoder/edu-main.css
+++ b/public/stylesheets/educoder/edu-main.css
@@ -180,7 +180,7 @@ a.decoration{text-decoration: underline}
/*定位*/
.pr{position: relative}
.df {display:flex;display: -webkit-flex;display: -ms-flex;}
-.flex1{flex: 1;}
+.flex1{flex: 1;width: 0}
/*去掉IE input框输入时自带的清除按钮*/
input::-ms-clear{display:none;}
/*自定义滚动条宽度*/
From 39d46e8222c25d361b5bdc68289a58c5596215a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 27 Jun 2019 15:01:17 +0800
Subject: [PATCH 13/42] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E9=A1=B5=E6=9C=8D=E5=8A=A1=E5=99=A8=E8=AE=BE=E7=BD=AE=E8=B0=83?=
=?UTF-8?q?=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/shixuns/_settings_edit.html.erb | 73 ++++++++++++++++++++++-
1 file changed, 70 insertions(+), 3 deletions(-)
diff --git a/app/views/shixuns/_settings_edit.html.erb b/app/views/shixuns/_settings_edit.html.erb
index 5001bd6c..3f119725 100644
--- a/app/views/shixuns/_settings_edit.html.erb
+++ b/app/views/shixuns/_settings_edit.html.erb
@@ -298,8 +298,8 @@
服务配置
<% @shixun.shixun_service_configs.each do |config| %>
-
<%= config.mirror_repository.try(:type_name) %>
-
+
<%= config.mirror_repository.try(:type_name) %>
+
CPU(核):
@@ -345,14 +345,67 @@
<% end %>
+
<% end %>
保存
<%= link_to "取消", settings_shixun_path(@shixun), :class => "defalutCancelbtn fl" %>
<% end %>
+
+
+
+
+
-
\ No newline at end of file
+ $("#unit-all").show();
+ }
+
+ $("input[name='public_degree']").live("click", function () {
+ var item = $(this).attr("id");
+ if ($(this).is(":checked") && item == "public-part") {
+ $("#person-unit").show();
+ $("#person-unit").find("input").val("");
+ //$(".unit-part").remove();
+ $("#unit-all").show();
+ } else {
+ $("#unit-all").hide();
+ }
+ });
+
+ $("body").on("click", function (e) {
+ //alert($(e.target).attr("id"));
+ if ($(e.target).attr("id") != "person-unit") {
+ $("#scope-down-list").hide();
+ }
+ });
+ //设置编辑时显示的单位
+ $(".unit-part input").each(function () {
+ $(this).attr("size", parseInt($(this).val().length) * 2);
+ })
+ });
+
+ //申请新建
+ function post_apply() {
+ var html = "<%= escape_javascript(render :partial => 'shixuns/apply_setnew') %>";
+ pop_box_new(html, 460, 416);
+ }
+
+ var setting_editormd = editormd("setting_introduction", {
+ width: "100%",
+ height: 210,
+ syncScrolling: "single",
+ //你的lib目录的路径,我这边用JSP做测试的
+ path: "/editormd/lib/",
+ tex: true,
+ toolbarIcons: function () {
+ // Or return editormd.toolbarModes[name]; // full, simple, mini
+ // Using "||" set icons align right.
+ return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
+ },
+ toolbarCustomIcons: {
+ testIcon: "
",
+ testIcon1: "
"
+ },
+ onload: function () {
+ $("#setting_introduction [type=\"latex\"]").bind("click", function () {
+ setting_editormd.cm.replaceSelection("```latex");
+ setting_editormd.cm.replaceSelection("\n");
+ setting_editormd.cm.replaceSelection("\n");
+ setting_editormd.cm.replaceSelection("```");
+ var __Cursor = setting_editormd.cm.getDoc().getCursor();
+ setting_editormd.cm.setCursor(__Cursor.line - 1, 0);
+ });
+
+ $("#setting_introduction [type=\"inline\"]").bind("click", function () {
+ setting_editormd.cm.replaceSelection("$$$$");
+ var __Cursor = setting_editormd.cm.getDoc().getCursor();
+ setting_editormd.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
+ setting_editormd.cm.focus();
+ });
+ $("[type=\"inline\"]").attr("title", "行内公式");
+ $("[type=\"latex\"]").attr("title", "多行公式");
+
+ },
+ //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。
+ saveHTMLToTextarea: true,
+ autoFocus: false,
+ // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
+ dialogMaskOpacity: 0.6,
+ placeholder: "请输入完成当前任务依赖的知识点或者其它相关信息",
+ imageUpload: true,
+ imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
+ imageUploadURL: "<%= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>" //url
+ });
+ md_elocalStorage(setting_editormd, "shixun_edit_<%= User.current.id %>", "in");
+
+ var script_Codemirror = CodeMirror.fromTextArea(document.getElementById("shixun_script"), {
+ lineNumbers: true,
+ theme: "default",
+ // extraKeys: {"Ctrl-Q": "autocomplete"}, // 快捷键
+ indentUnit: 4, //代码缩进为一个tab的距离
+ matchBrackets: true,
+ autoRefresh: true,
+ smartIndent: true,//智能换行
+ styleActiveLine: true,
+ lint: true
+ });
+ script_Codemirror.setSize("auto", "600px");
+ // 非管理员只能查看
+
\ No newline at end of file
From 4af236dc3e8491c668e67cd382f48692d296ed3a Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 27 Jun 2019 17:48:12 +0800
Subject: [PATCH 24/42] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=9E=E8=AE=AD?=
=?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/shixun.rb | 4 ++++
app/views/shixuns/_settings_edit.html.erb | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/models/shixun.rb b/app/models/shixun.rb
index e7682a74..fe9a00b1 100644
--- a/app/models/shixun.rb
+++ b/app/models/shixun.rb
@@ -273,6 +273,10 @@ class Shixun < ActiveRecord::Base
return name
end
+ def child_mirror_ids
+ self.mirror_repositories.where(:main_type => 0).pluck(:id)
+ end
+
def mirror_name
self.mirror_repositories.map(&:type_name).blank? ? "" : self.mirror_repositories.map(&:type_name)
end
diff --git a/app/views/shixuns/_settings_edit.html.erb b/app/views/shixuns/_settings_edit.html.erb
index e23adfc6..e4837252 100644
--- a/app/views/shixuns/_settings_edit.html.erb
+++ b/app/views/shixuns/_settings_edit.html.erb
@@ -71,7 +71,7 @@
<% end %>
-