Merge branch 'cxt_course' of https://git.trustie.net/jacknudt/trustieforge into cxt_course

cxt_course
Tim 9 years ago
commit 3548c23aad

1
.gitignore vendored

@ -33,3 +33,4 @@ vendor/cache
/tags
/config/initializers/gitlab_config.rb
1234567
public/javascripts/wechat/node_modules/

@ -1,3 +1,5 @@
#coding=utf-8
module Mobile
require_relative 'middleware/error_handler'
require_relative 'apis/auth'
@ -29,16 +31,22 @@ module Mobile
end
def authenticate!
raise('Unauthorized. Invalid or expired token.') unless current_user
raise('Unauthorized. 用户认证失败.') unless current_user
end
def current_user
openid = params[:openid]
if openid
uw = UserWechat.find_by_openid(params[:openid])
return uw.user if uw
end
token = ApiKey.where(access_token: params[:token]).first
if token && !token.expired?
@current_user = User.find(token.user_id)
else
nil
return User.find(token.user_id)
end
nil
end
end

@ -12,7 +12,9 @@ module Mobile
requires :openid, type: String
end
post do
user = UserWechat.find_by_openid(params[:openid]).user
authenticate!
user = current_user
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id)

@ -97,7 +97,6 @@ module Mobile
desc "加入课程"
params do
requires :token, type: String
requires :course_password, type: String
end
post ":id" do

@ -916,4 +916,11 @@ class ApplicationController < ActionController::Base
call_hook(:controller_account_success_authentication_after, {:user => user })
end
def user_unlogged_check
if !User.current.logged?
render(:partial => 'organizations/unlogged_tip')
return false
end
true
end
end

@ -265,6 +265,10 @@ class AttachmentsController < ApplicationController
@history.save #历史记录保存完毕
#将最新保存的记录 数据替换到 需要修改的文件记录
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes")
# 如果附件描述被修改,则保存附件
unless params[:description] == @attachment.description
@old_attachment.description = params[:description]
end
@old_attachment.save
#删除当前记录
@attachment.delete

@ -49,6 +49,11 @@ class ExerciseController < ApplicationController
return
end
@exercise = Exercise.find params[:id]
@exercise.course_messages.each do |message|
if User.current.id == message.user_id && message.viewed == 0
message.update_attributes(:viewed => true) if message.viewed == 0
end
end
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
exercise_end = @exercise.end_time > Time.now
if @exercise.time == -1

@ -26,7 +26,7 @@ class FilesController < ApplicationController
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,
:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,
:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file]
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file,:update_file_description]
helper :sort
include SortHelper
@ -483,6 +483,7 @@ class FilesController < ApplicationController
if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name)
attachment.description = params[:description]
attachment.save
end
end
@ -493,6 +494,7 @@ class FilesController < ApplicationController
if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name)
attachment.description = params[:description]
attachment.save
end
end
@ -600,6 +602,7 @@ class FilesController < ApplicationController
if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name)
attachment.description = params[:description]
attachment.save
end
end
@ -610,6 +613,7 @@ class FilesController < ApplicationController
if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name)
attachment.description = params[:description]
attachment.save
end
end
@ -911,5 +915,10 @@ class FilesController < ApplicationController
def upload_files_menu
end
end
def update_file_description
@attachment = Attachment.find(params[:id])
@attachment.description = params[:description]
@attachment.save
end
end

@ -1,6 +1,6 @@
class OrgDocumentCommentsController < ApplicationController
before_filter :find_organization, :only => [:new, :create, :show, :index]
before_filter :authorize_allowed, :only => [:create]
before_filter :authorize_allowed, :only => [:create, :add_reply]
helper :attachments,:organizations
layout 'base_org'
@ -38,6 +38,11 @@ class OrgDocumentCommentsController < ApplicationController
def show
@document = OrgDocumentComment.find(params[:id])
@org_subfield = OrgSubfield.where(:id => @document.org_subfield_id).first
@subfield_content = @organization.org_subfields.order("priority")
respond_to do |format|
format.html {render :layout => (@organization.switch_type && @document && !@document.org_subfield_id.blank?) ? 'base_org_custom' : 'base_org'}
end
end
def index
@ -91,7 +96,12 @@ class OrgDocumentCommentsController < ApplicationController
def add_reply_in_doc
@document = OrgDocumentComment.find(params[:id]).root
@comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id])
@comment.content = params[:org_comment][:org_content]
if params[:org_comment].blank?
@comment.content = params[:org_content]
else
@comment.content = params[:org_comment][:org_content]
end
@document.children << @comment
@document.save
respond_to do |format|

@ -9,14 +9,15 @@ class OrgSubfieldsController < ApplicationController
@subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id], :priority => @organization.org_subfields.order("priority").last.priority + 1)
if !params[:sub_dir].blank?
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
if SubfieldSubdomainDir.find_by_sql(sql).count == 0
SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir].downcase)
end
end
@subfield.update_attributes(:field_type => params[:field_type])
#默认类型为帖子
@subfield.update_attributes(:field_type => params[:field_type]||"Post")
# admin配置的类型
update_status_by_type(@subfield, params[:field_type])
update_status_by_type(@subfield, params[:field_type]||"Post")
else
@res = false
end
@ -56,6 +57,10 @@ class OrgSubfieldsController < ApplicationController
@org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+
"subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+
" org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first
if @org_subfield.nil?
render_404
return
end
if @org_subfield.field_type == 'Post'
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
@org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)

@ -28,8 +28,9 @@ class OrganizationsController < ApplicationController
helper :project_score
helper :issues
include UsersHelper
before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout, :teachers, :students, :projects, :courses]
before_filter :allow_as_admin, :only => [:students, :teachers, :projects, :courses, :acts]
include OrganizationsHelper
before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout, :teachers, :students, :projects, :courses, :acts]
# before_filter :allow_as_admin, :only => [:students, :teachers, :projects, :courses, :acts]
layout 'base_org'
def index
@ -77,8 +78,12 @@ class OrganizationsController < ApplicationController
def show
# 组织新类型 show_mode判断标准 1为新类型0为旧
if @organization.switch_type && params[:org_subfield_id].nil? && params[:list] .nil?
if @organization.switch_type && params[:list] .nil?
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
unless params[:org_subfield_id].nil?
@org_subfield = OrgSubfield.where(:id => params[:org_subfield_id]).first
@subfield_acts = get_subfield_acts(@org_subfield)
end
@subfield_content = @organization.org_subfields.order("priority")
shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
@ -175,7 +180,7 @@ class OrganizationsController < ApplicationController
q = params[:search].nil? ? "" : "#{params[:search].strip}"
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comptec").first : OrgSubfield.find(params[:org_subfield_id])
@type = params[:type]
if @type == "courses" || @type.nil?
if @type.blank?
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
elsif @type == "famous"
@ -199,7 +204,7 @@ class OrganizationsController < ApplicationController
q = params[:search].nil? ? "" : "#{params[:search].strip}"
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Compstu").first : OrgSubfield.find(params[:org_subfield_id])
@type = params[:type]
if @type == "courses" || @type.nil?
if @type.blank?
@org_students = User.find_by_sql("select u.*, ue.student_id, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
from users u, user_extensions ue where u.id = ue.user_id and ue.identity= 1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
elsif @type == "famous"
@ -235,7 +240,7 @@ class OrganizationsController < ApplicationController
q = params[:search].nil? ? "" : "#{params[:search].strip}"
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comppro").first : OrgSubfield.find(params[:org_subfield_id])
@type = params[:type]
if @type.nil?
if @type.blank?
@containers = Project.find_by_sql("select p.*, (select count(*) from forge_activities where forge_activities.project_id = p.id) as project_count
from projects p where p.status =1 and p.is_public =1 and name like '%#{q}%' order by project_count desc;")
elsif @type == "famous"
@ -249,7 +254,7 @@ class OrganizationsController < ApplicationController
q = params[:search].nil? ? "" : "#{params[:search].strip}"
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Compstu").first : OrgSubfield.find(params[:org_subfield_id])
@type = params[:type]
if @type.nil?
if @type.blank?
@containers = Course.find_by_sql("select c.*, (select count(*) from course_activities where course_activities.course_id = c.id) as course_count
from courses c where c.is_delete =0 and c.is_public =1 and name like '%#{q}%' order by course_count desc;")
elsif @type == "famous"
@ -260,6 +265,19 @@ class OrganizationsController < ApplicationController
end
def acts
@subfield_content = @organization.org_subfields.order("priority")
@org_subfield = OrgSubfield.where(:id => params[:org_subfield_id]).first
shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
project_ids = (@organization.projects.map(&:id) - shield_project_ids) << 0
course_ids = (@organization.courses.map(&:id) - shield_course_ids) << 0
@org_acts = UserActivity.find_by_sql("SELECT * FROM `user_activities` where act_type in ('HomeworkCommon', 'News', 'Message', 'Issue') and
((container_type = 'Course' and container_id in (#{course_ids.join(',')})) or (container_type = 'Project' and container_id in (#{project_ids.join(',')})))
order by created_at desc limit 6;")
respond_to do |format|
format.html{render :layout => 'base_org_custom'}
format.js
end
end
def searchmember_by_name members, name

@ -1,12 +1,12 @@
class PraiseTreadController < ApplicationController
accept_api_auth :tread_plus,:praise_plus
before_filter :require_login,:only => [:praise_plus,:tread_plus]
# before_filter :require_login,:only => [:praise_plus,:tread_plus]
before_filter :user_unlogged_check,:only => [:praise_plus,:tread_plus,:praise_minus]
def praise_plus
@obj = nil
@activity = false
if request.get?
@obj_id = params[:obj_id]
@obj_type = params[:obj_type]

@ -325,13 +325,10 @@ update
def show
## TODO: the below will move to filter, done.
if !User.current.member_of?(@project)
if @project.hidden_repo
render_403
return -1
end
if !User.current.member_of?(@project) && @project.hidden_repo
render_403
return
end
@entries = @repository.entries(@path, @rev)
@changeset = @repository.find_changeset_by_name(@rev)
if request.xhr?
@ -363,7 +360,7 @@ update
# ip = RepositoriesHelper::REPO_IP_ADDRESS
gitlab_address = Redmine::Configuration['gitlab_address']
# REDO:需优化,仅测试用
@zip_path = gitlab_address.to_s + "/api/v3/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=YTyCv4978MXmdL2B9C62"
@zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token
if @repository.type.to_s == "Repository::Gitlab"
@repos_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+@repository.identifier+"."+"git"
else

@ -1,9 +1,9 @@
class SubDocumentCommentsController < ApplicationController
before_filter :find_subdomain_and_subfield, :only => [:new, :create, :show, :index, :destroy, :edit]
before_filter :find_subfield_content, :only => [:show, :index]
before_filter :authorize_allowed, :only => [:create]
before_filter :authorize_allowed, :only => [:create, :add_reply]
helper :attachments,:organizations
layout 'base_sub_domain'
layout 'base_org_custom'
def new
@sub_document_comment = SubDocumentComment.new
@ -41,7 +41,7 @@ class SubDocumentCommentsController < ApplicationController
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
@document = SubDocumentComment.find(params[:id])
respond_to do |format|
format.html {render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'}
format.html {render :layout => @organization.switch_type ? 'base_org_custom' : 'base_org'}
end
else
render_403
@ -58,7 +58,7 @@ class SubDocumentCommentsController < ApplicationController
@offset ||= @atta_pages.offset
@documents = paginateHelper @documents,20
respond_to do |format|
format.html {render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'}
format.html {render :layout => @organization.switch_type ? 'base_org_custom' : 'base_org'}
end
else
render_403

@ -132,10 +132,10 @@ class UsersController < ApplicationController
# 未读的消息存放在数组
mess = message_all.message
if (message_all.message_type != "SystemMessage"&& !mess.nil? && (mess.viewed == 0 || !mess.viewed)) || (message_all.message_type == "SystemMessage"&& !mess.nil? && mess.created_at > onclick_time)
unless (message_all.message_type == 'CourseMessage' && mess && mess.course.is_delete == 1)
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
@message_alls << mess
end
break if @message_alls.length == 5
break if @message_alls.length == 10
end
end
end
@ -166,7 +166,7 @@ class UsersController < ApplicationController
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
messages.each do |message_all|
mess = message_all.message
unless (message_all.message_type == 'CourseMessage' && mess && mess.course.is_delete == 1)
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
@message_alls << mess
end
end
@ -177,7 +177,7 @@ class UsersController < ApplicationController
# 在点击或者刷新消息列表后未读的消息存放在数组
mess = message_all.message
if message_all.message_type != "SystemMessage"&& !mess.nil? && (mess.viewed == 0 || !mess.viewed)
unless (message_all.message_type == 'CourseMessage' && mess && mess.course.is_delete == 1)
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
@message_alls << mess
end
end

@ -1080,7 +1080,7 @@ module ApplicationHelper
elsif @user
title << @user.try(:realname)
else
title << User.current.try(:realname)
title << (User.current.id == 2 ? "未登录" : User.current.try(:realname))
end
if first_page.nil? || first_page.web_title.nil?
title << Setting.app_title unless Setting.app_title == title.last

@ -66,52 +66,102 @@ module OrganizationsHelper
def org_user_by_type obj
case obj.act_type
when "Message"
user = obj.act.author
obj.act.author
when "News"
user = obj.act.author
obj.act.author
when "HomeworkCommon"
user = obj.act.user
obj.act.user
when "Issue"
user = obj.act.author
obj.act.author
end
end
def org_title_by_type obj
case obj.act_type
when "Message"
user = obj.act.parent_id.nil? ? obj.act.subject : obj.act.parent.subject
obj.act.parent_id.nil? ? obj.act.subject : obj.act.parent.subject
when "News"
user = obj.act.title
obj.act.title
when "HomeworkCommon"
user = obj.act.name
obj.act.name
when "Issue"
user = obj.act.subject
obj.act.subject
end
end
def org_content_by_type obj
case obj.act_type
when "Message"
user = obj.act.parent_id.nil? ? obj.act.content : obj.act.parent.content
obj.act.parent_id.nil? ? obj.act.content : obj.act.parent.content
when "News"
user = obj.act.description
obj.act.description
when "HomeworkCommon"
user = obj.act.description
obj.act.description
when "Issue"
user = obj.act.description
obj.act.description
end
end
def org_time_by_type obj
case obj.act_type
when "Message"
time = obj.act.updated_on
obj.act.created_on
when "News"
user = obj.act.created_on
obj.act.created_on
when "HomeworkCommon"
user = obj.act.updated_at
obj.act.created_at
when "Issue"
user = obj.act.updated_on
obj.act.created_on
end
end
def org_reply_count_type obj
case obj.act_type
when "HomeworkCommon"
obj.act.journals_for_messages.count
when "Issue"
obj.act.journals.count
when "Message"
obj.act.children.count
when "News"
obj.act.comments_count
end
end
# 组织的栏目类型标题
def subfield_title_type obj
case obj.org_act_type
when "OrgDocumentComment"
obj.org_act.title
when "Message"
obj.org_act.parent_id.nil? ? obj.org_act.subject : obj.org_act.parent.subject
when "News"
obj.org_act.title
when "Issue"
obj.org_act.subject
end
end
# 组织的栏目类型时间
def subfield_time_type obj
case obj.org_act_type
when "OrgDocumentComment"
obj.org_act.updated_at
when "Message"
obj.org_act.updated_on
when "News"
obj.org_act.created_on
end
end
def subfield_reply_count_type obj
case obj.org_act_type
when "OrgDocumentComment"
obj.org_act.children.count
when "Message"
obj.org_act.children.count
when "News"
obj.org_act.comments_count
end
end
@ -178,17 +228,19 @@ module OrganizationsHelper
# 系统栏目只有管理员才能看到
def subfield_to_addmin?(org)
if User.current.admin?
@organization.org_subfields.order("priority")
else
@organization.org_subfields.select { |os| (os.field_type != "Comptec" && os.field_type != "Compstu" && os.field_type != "Comppro" && os.field_type != "Compcou" && os.field_type != "Compact") }.sort_by {|os| os.priority}
end
# if User.current.admin?
@organization.org_subfields.order("priority")
# else
# @organization.org_subfields.select { |os| (os.field_type != "Comptec" && os.field_type != "Compstu" && os.field_type != "Comppro" && os.field_type != "Compcou" && os.field_type != "Compact") }.sort_by {|os| os.priority}
# end
end
def get_subfield_acts field
org_subfield = OrgSubfield.find(field.id)
org_subfield_ids = org_subfield.org_document_comments.map(&:id) << 0
org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{org_subfield.id})").order('updated_at desc')
unless field.nil?
org_subfield = OrgSubfield.find(field.id)
org_subfield_ids = org_subfield.org_document_comments.map(&:id) << 0
org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{org_subfield.id})").order('updated_at desc')
end
end
def allow_to_create?(org, type)

File diff suppressed because it is too large Load Diff

@ -13,7 +13,7 @@
<span class="attachment">
<%= link_to truncate(@attachment.filename,length: 35, omission: '...'),
download_named_attachment_path(@attachment.id, @attachment.filename),
:title => @attachment.filename+"\n"+@attachment.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %>
:title => @attachment.filename+"\n"+@attachment.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:280px;",:class => "linkBlue f14 fb link_file_a2 fl" %>
</span>
<span class="fr">版本号:当前</span>
<div class="cl"></div>

@ -39,6 +39,15 @@
<!--<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%#= l(:button_cancel)%></a>-->
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
</div>
<div class="cl"></div>
<div class="mb5 mt5">
<label class="fl c_dark f14" style="line-height:30px;">描述:</label>
<div class="fl">
<input type="text" name="description" class="InputBox fl W160" value="<%= @attachment.description %>">
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<div class="uploadResourceIntr">
<div class="uploadResourceName fl"><span id="upload_file_count">(未选择文件)</span></div>
<div class="uploadResourceIntr2 fl">您可以上传小于<span class="c_red">50MB</span>的文件</div>

@ -1,20 +1,24 @@
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="ReplyToMessageInputContainer mb10">
<div nhname='new_message_<%= reply.id%>'>
<%= form_for @blog_comment, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => @blogComment.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
<input type="hidden" name="quote[quote]" id="quote_quote">
<% if course_id%>
<input type="hidden" name="course_id" id="" value="<%= course_id%>">
<% end %>
<input type="hidden" name="blog_comment[title]" id="reply_subject">
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="blog_comment[content]"></textarea>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
</div>
<% if User.current.logged? %>
<div nhname='new_message_<%= reply.id%>'>
<%= form_for @blog_comment, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => @blogComment.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
<input type="hidden" name="quote[quote]" id="quote_quote">
<% if course_id%>
<input type="hidden" name="course_id" id="" value="<%= course_id%>">
<% end %>
<input type="hidden" name="blog_comment[title]" id="reply_subject">
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="blog_comment[content]"></textarea>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>

@ -184,20 +184,24 @@
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @article.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@article.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer" style="margin-top: 8px">
<div nhname='new_message_<%= @article.id%>' style="display:none;">
<%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%>
<input type="hidden" name="course_id" value="<%= @course.id%>">
<input type="hidden" name="blog_comment[title]" value="RE:<%= @article.title%>">
<input type="hidden" name="blog_comment[sticky]" value="0">
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="blog_comment[locked]" value="0">
<div nhname='toolbar_container_<%= @article.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @article.id%>' name="blog_comment[content]"></textarea>
<a id="new_message_submit_btn_<%= @article.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= @article.id%>'></p>
<% end%>
</div>
<% if User.current.logged? %>
<div nhname='new_message_<%= @article.id%>' style="display:none;">
<%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%>
<input type="hidden" name="course_id" value="<%= @course.id%>">
<input type="hidden" name="blog_comment[title]" value="RE:<%= @article.title%>">
<input type="hidden" name="blog_comment[sticky]" value="0">
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="blog_comment[locked]" value="0">
<div nhname='toolbar_container_<%= @article.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @article.id%>' name="blog_comment[content]"></textarea>
<a id="new_message_submit_btn_<%= @article.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= @article.id%>'></p>
<% end%>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>

@ -0,0 +1,5 @@
<p ondblclick=show_edit_file_description('<%= file.id %>')>
资源描述:<% if file.description.blank? %><span style="color:#C5C5BE; cursor:pointer;" title="双击可编辑">双击添加描述</span><% else %><span style="cursor:pointer;" title="双击可编辑"><%= file.description %></span><% end %>
<%#= file.description.blank? ? "该资源暂无描述" : file.description %>
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_file_description("+file.id.to_s+");"%>
</p>

@ -1,7 +1,7 @@
<% delete_allowed = User.current.admin? %>
<% org_subfield_attachments.each do |file| %>
<% if file.is_public == 1 or User.current.member_of_org?(file.container.organization) %>
<% if file.is_public == 1 or User.current.member_of_org?(file.container.organization) || User.current.admin? %>
<div class="resources mt10" id="container_files_<%= file.id %>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
@ -36,6 +36,25 @@
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
<p class="fl ml15 fontGrey2">下载<%= file.downloads%>&nbsp;&nbsp;|&nbsp;&nbsp;引用<span id="reference_number_<%= file.id %>"><%= file.quotes.nil? ? 0:file.quotes %></span></p>
</div>
<div class="cl"></div>
<% if User.current.logged? && ((delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" )%>
<div>
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
</div>
<textarea class="homepageSignatureTextarea none" placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
onblur="edit_file_description('<%= update_file_description_org_subfield_file_path(file.container.organization,file)%>','<%= file.id %>');"><%= file.description %></textarea>
</div>
<% else %>
<div class="fontGrey2 mb4">
<% unless file.description.blank? %>
<div class="cl"></div>
<div class="fontGrey2 mb4">资源描述:<%= file.description %></div>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<div class="tag_h">
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>

@ -21,8 +21,8 @@
<%= link_to truncate(file.filename,length: 35, omission: '...'),
download_named_attachment_path(file.id, file.filename),
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
<% if User.current.logged? %>
<% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
<% if User.current.logged? || User.current.admin? %>
<% if ((manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file)) || User.current.admin? %>
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
<% if authority_pubilic_for_files(project, file) && delete_allowed %>
<span id="is_public_<%= file.id %>">
@ -43,6 +43,22 @@
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
</div>
<div class="cl"></div>
<% if User.current.admin? || ( User.current.logged? && ( (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file))) %>
<div>
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
</div>
<textarea class="homepageSignatureTextarea none" placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
onblur="edit_file_description('<%= update_file_description_project_file_path(project,file)%>','<%= file.id %>');"><%= file.description %></textarea>
</div>
<% else %>
<div class="fontGrey2 mb4">
<% unless file.description.blank? %>
<div class="cl"></div>
<div class="fontGrey2 mb4">资源描述:<%= file.description %></div>
<% end %>
</div>
<% end %>
<div class="tag_h">
<!-- container_type = 2 代表是项目里的资源 -->
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>

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

Loading…
Cancel
Save