Merge branch 'szzh' into cxt_course

This commit is contained in:
cxt 2015-12-14 08:43:44 +08:00
commit c199de1d36
31 changed files with 486 additions and 25 deletions

View File

@ -418,6 +418,8 @@ class ApplicationController < ActionController::Base
@project = Project.find(params[:project_id]) @project = Project.find(params[:project_id])
elsif params[:course_id] elsif params[:course_id]
@course = Course.find(params[:course_id]) @course = Course.find(params[:course_id])
elsif params[:org_subfield_id]
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
end end
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404

View File

@ -240,6 +240,8 @@ class AttachmentsController < ApplicationController
format.html { redirect_to_referer_or respond_path(@attachment.container) } format.html { redirect_to_referer_or respond_path(@attachment.container) }
elsif !@attachment.container.nil? && @attachment.container.is_a?(PhoneAppVersion) elsif !@attachment.container.nil? && @attachment.container.is_a?(PhoneAppVersion)
format.html { redirect_to_referer_or mobile_version_path } format.html { redirect_to_referer_or mobile_version_path }
elsif !@attachment.container.nil? && @attachment.container.is_a?(OrgSubfield)
format.html {redirect_to_referer_or org_subfield_files_path(@attachment.container)}
else else
if @project.nil? if @project.nil?
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) } format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }

View File

@ -299,6 +299,10 @@ class FilesController < ApplicationController
render :layout => 'base_courses' render :layout => 'base_courses'
elsif params[:org_subfield_id] elsif params[:org_subfield_id]
@container_type = 2 @container_type = 2
@organization = Organization.find(params[:organization_id])
@containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
show_attachments @containers
render :layout => 'base_org'
# @subfield = params[:org_subfield_id] # @subfield = params[:org_subfield_id]
end end
@ -424,8 +428,39 @@ class FilesController < ApplicationController
redirect_to course_files_url(@course) redirect_to course_files_url(@course)
} }
end end
end elsif @org_subfield
@addTag=false
# if params[:in_org_subfield_toolbar]
# @in_org_subfield_toolbar = params[:in_org_subfield_toolbar]
# end
attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type])
# if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
# Mailer.run.attachments_added(attachments[:files])
# end
# TODO: 临时用 nyan
sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
@containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] #modify by Long Jun
# @containers += @org_subfield.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
show_attachments @containers
@attachtype = 0
@contenttype = 0
respond_to do |format|
format.js
format.html {
redirect_to org_subfield_files_url(@org_subfield)
}
end
end
end end
end end

View File

@ -223,7 +223,7 @@ class MyController < ApplicationController
end end
flash.now[:error] = l(:notice_account_old_wrong_password) flash.now[:error] = l(:notice_account_old_wrong_password)
end end
render :template => 'my/account',:layout=>'base_users_new' render :template => 'my/account',:layout=>'new_base_user'
end end
# Create a new feeds key # Create a new feeds key

View File

@ -17,4 +17,8 @@ class OrgSubfieldsController < ApplicationController
@organization = Organization.find(@subfield.organization_id) @organization = Organization.find(@subfield.organization_id)
@subfield.update_attributes(:name => params[:name]) @subfield.update_attributes(:name => params[:name])
end end
def show
end
end end

View File

@ -30,7 +30,7 @@ class ProjectsController < ApplicationController
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project] before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project]
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar]
before_filter :file, :statistics #:watcherlist before_filter :file, :statistics #:watcherlist
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去 # 除非项目内人员,不可查看成员, TODO: 完了写报表里去
# before_filter :memberAccess, only: :member # before_filter :memberAccess, only: :member

View File

@ -923,7 +923,7 @@ class StudentWorkController < ApplicationController
#成绩计算 #成绩计算
def set_final_score homework,student_work def set_final_score homework,student_work
if homework && homework.homework_detail_manual if homework && homework.homework_detail_manual
if homework.homework_type == 1 #匿评作业 if homework.homework_type != 2 #匿评作业
if homework.teacher_priority == 1 #教师优先 if homework.teacher_priority == 1 #教师优先
if student_work.teacher_score if student_work.teacher_score
student_work.final_score = student_work.teacher_score student_work.final_score = student_work.teacher_score

View File

@ -113,7 +113,8 @@ module FilesHelper
if attachment.is_public? || if attachment.is_public? ||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) || (attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))|| (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))||
attachment.author_id == User.current.id attachment.author_id == User.current.id ||
attachment.container_type == "OrgSubfield"
result << attachment result << attachment
end end
end end

View File

@ -22,6 +22,7 @@ class Attachment < ActiveRecord::Base
belongs_to :container, :polymorphic => true belongs_to :container, :polymorphic => true
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'" belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'" belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'"
belongs_to :org_subfield, foreign_key: 'container_id', conditions: "attachements.container_type = 'OrgSubfield'"
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'" belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
belongs_to :author, :class_name => "User", :foreign_key => "author_id" belongs_to :author, :class_name => "User", :foreign_key => "author_id"
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"

View File

@ -18,10 +18,28 @@ class Memo < ActiveRecord::Base
#elasticsearch kaminari init #elasticsearch kaminari init
Kaminari::Hooks.init Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do settings index: {
number_of_shards: 5 ,
analysis: {
char_filter: {
and_filter: {
type: "mapping",
mappings: [ "&=> and "]
}
},
analyzer: {
my_analyzer: {
type: 'custom',
tokenizer: 'standard',
filter: ['classic'],
char_filter: ['html_strip']
}
}
}
} do
mappings dynamic: 'false' do mappings dynamic: 'false' do
indexes :subject, analyzer: 'smartcn',index_options: 'offsets' indexes :subject, analyzer: 'smartcn',index_options: 'offsets'#, char_filter: 'html_strip'
indexes :content, analyzer: 'smartcn',index_options: 'offsets' indexes :content, analyzer:'my_analyzer',index_options: 'offsets',search_analyzer: 'smartcn'
indexes :updated_at,index:"not_analyzed" ,type:'date' indexes :updated_at,index:"not_analyzed" ,type:'date'
end end
end end

View File

@ -1,4 +1,9 @@
class OrgSubfield < ActiveRecord::Base class OrgSubfield < ActiveRecord::Base
belongs_to :organization, :foreign_key => :organization_id belongs_to :organization, :foreign_key => :organization_id
has_many :org_document_comments, :dependent => :destroy has_many :org_document_comments, :dependent => :destroy
has_many :files
acts_as_attachable
def project
end
end end

View File

@ -46,7 +46,7 @@ class StudentWork < ActiveRecord::Base
#成绩计算 #成绩计算
def set_final_score homework,student_work def set_final_score homework,student_work
if homework && homework.homework_detail_manual if homework && homework.homework_detail_manual
if homework.homework_type == 1 #匿评作业 if homework.homework_type != 2 #匿评作业
if homework.teacher_priority == 1 #教师优先 if homework.teacher_priority == 1 #教师优先
if student_work.teacher_score if student_work.teacher_score
student_work.final_score = student_work.teacher_score student_work.final_score = student_work.teacher_score

View File

@ -89,7 +89,7 @@
<% end %> <% end %>
</ul> </ul>
<% if @course.is_delete == 1 %> <% if @course.is_delete == 1 %>
<div class="mt30 fr"><img src="/images/pic_del.gif" class="mr5"><%=link_to "恢复该课程", renew_course_path(@course) %></div> <div class="mt30"><%=link_to "恢复该课程", renew_course_path(@course) %></div>
<% else %> <% else %>
<div class="mt30"> <div class="mt30">
<img src="/images/pic_del.gif" class="mr5"><%=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %> <img src="/images/pic_del.gif" class="mr5"><%=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %>

View File

@ -20,6 +20,25 @@
:lebel_file_uploding => l(:lebel_file_uploding), :lebel_file_uploding => l(:lebel_file_uploding),
:delete_all_files => l(:text_are_you_sure_all) :delete_all_files => l(:text_are_you_sure_all)
} %> } %>
<% elsif @project %>
<%= 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'),
: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)
} %>
<% else %> <% else %>
<%= file_field_tag 'attachments[dummy][file]', <%= file_field_tag 'attachments[dummy][file]',
:id => '_file', :id => '_file',

View File

@ -0,0 +1,56 @@
<% delete_allowed = User.current.admin? %>
<div class="re_con_top">
<p class="f_l c_blue f_b f_14">共有&nbsp;<%= all_attachments.count%>&nbsp;个资源</p>
<p class="f_r" style="color: #808080">
<% if order == "asc" %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp;/&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% else %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp; /&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% end %>
</p>
</div>
<div class="cl"></div>
<!--<div class="files_tag" id="files_tag">-->
<!--<%#= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>-->
<!--</div>-->
<div class="cl"></div>
<div class="for_img_thumbnails">
<% org_subfield_attachments.each do |file| %>
<% if 1 %>
<div class="re_con_box" id="container_files_<%= file.id %>">
<div class="">
<%= 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? %>
<%= file_preview_tag(file, class: 'f_l re_open', style:'text-align: center;') %>
<% end %>
</div>
<div class="cl"></div>
<div class="mt5">
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
<%= link_to( l(:button_delete), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @org_subfield.id && file.container_type == "OrgSubfield"%>
<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>
<!--<div class="tag_h">-->
<!--&lt;!&ndash; container_type = 1 代表是课程里的资源 &ndash;&gt;-->
<!--<%#= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>-->
<!--<%#= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>-->
<!--</div>-->
<div class="cl"></div>
</div><!---re_con_box end-->
<% end %>
<% end %>
</div>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
<div class="cl"></div>

View File

@ -0,0 +1,97 @@
<%= stylesheet_link_tag 'courses' %>
<script>
function searchone4reload(fileid){
var url = "<%= searchone4reload_org_subfield_files_path(@org_subfield)%>";
var data = {};data.fileid=fileid;
$.ajax({
url:url,dataType:'text',data:data,success:function(text){
var container_file_div = $("#container_files_"+fileid);
container_file_div.after(text);
container_file_div.remove();
}
});
}
function show_upload(obj)
{
switch(obj)
{
case 1:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>');
break;
case 2:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 2}) %>');
break;
case 3:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 3}) %>');
break;
case 4:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 4}) %>');
break;
case 6:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 6}) %>');
break;
default:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 5}) %>');
}
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function closeModal()
{
hideModal($("#popbox_upload"));
}
function presscss(id)
{
if(id == "inorg_subfield")
{
$('#inorg_subfield').attr("class", "re_schbtn b_dblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
else
{
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_dblue");
}
}
function buttoncss()
{
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
</script>
<div class="container">
<div class="resources"><!--资源库内容开始--->
<div class="re_top" style="width:710px;">
<%= form_tag( search_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
<%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<% end %>
<%# if is_org_subfield_teacher(User.current,@org_subfield) || (@org_subfield.publish_resource==1 && User.current.member_of_org_subfield?(@org_subfield) ) %> <!-- show_window('light','fade','20%','35%')-->
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
<p class="c_grey fr mt10 mr5">
上传:
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(1);">课件</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(2);">软件</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(3);">媒体</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(4);">代码</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(6);">论文</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(5);">其他</a>
</p>
<%# end %>
</div><!---re_top end-->
<div class="cl"></div>
<div class="re_con" id="org_subfield_list">
<%= render :partial => 'org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments} %>
</div><!---re_con end-->
</div>
</div>
<% html_title(l(:label_attachment_plural)) -%>

View File

@ -0,0 +1,55 @@
<% delete_allowed = User.current.admin? %>
<div class="re_con_top">
<p class="f_l c_blue f_b f_14">共有&nbsp;<%= all_attachments.count%>&nbsp;个资源</p>
<p class="f_r" style="color: #808080">
<% if order == "asc" %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp;/&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% else %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp; /&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% end %>
</p>
</div>
<div class="cl"></div>
<div class="files_tag" id="files_tag">
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>
</div>
<div class="cl"></div>
<div class="for_img_thumbnails">
<% curse_attachments.each do |file| %>
<% if file.is_public? || User.current.admin? %>
<div class="re_con_box" id="container_files_<%= file.id %>">
<div class="">
<%= 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" %>
</div>
<div class="cl"></div>
<div class="mt5">
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
<%= link_to( l(:button_delete), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @org_subfield.id && file.container_type == "OrgSubfield"%>
<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>
<div class="tag_h">
<!-- container_type = 1 代表是课程里的资源 -->
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
</div>
<div class="cl"></div>
</div><!---re_con_box end-->
<% else %>
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
<% end %>
<% end %>
</div>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
<div class="cl"></div>

View File

@ -0,0 +1,31 @@
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
<div class="upload_con">
<h2 style="text-align: center"><%= l(:label_upload_files)%></h2>
<div class="upload_box">
<%= error_messages_for 'attachment' %>
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
<%= form_tag(org_subfield_files_path(org_subfield), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
<!--<input type="hidden" name="in_org_subfield_toolbar" value="Y">-->
<input type="hidden" name="org_subfield_attachment_type" value="<%= org_subfield_attachment_type%>">
<%= render :partial => 'files/attachement_list',:locals => {:org_subfield => org_subfield} %>
<div class="cl"></div>
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
<% end %>
</div>
</div>
<% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %>
<% end %>
</div>
<script>
function submit_resource()
{
$('#submit_resource').parent().submit();
}
</script>

View File

@ -52,6 +52,17 @@ $('#upload_file_div').slideToggle('slow');
setTimeout( function(){div.remove();},3000) setTimeout( function(){div.remove();},3000)
<% end %> <% end %>
<%end%> <%end%>
<% elsif @org_subfield %>
hideModal();
$("#resource_list").html('<%= j(render partial: "subfield_files" ,locals: {org_subfield: @org_subfield}) %>');
// $("#courses_files_count_info").html("<%#= @all_attachments.count%>");
// $("#courses_files_count_nav").html("(<%#= @all_attachments.count%>)")
// 添加文件上传成功提示,
<% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#org_subfield_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<% end %> <% end %>
<% end %> <% end %>
$(document).ready(img_thumbnails); $(document).ready(img_thumbnails);

View File

@ -1,8 +1,10 @@
<div id="resource_list"> <div id="resource_list">
<% if @isproject %> <% if @container_type == 0 %>
<%= render :partial => 'project_file_new', locals: {project: @project} %> <%= render :partial => 'project_file_new', locals: {project: @project} %>
<% else %> <% elsif @container_type == 1 %>
<%= render :partial => 'course_file', locals: {course: @course} %> <%= render :partial => 'course_file', locals: {course: @course} %>
<% elsif @container_type == 2 %>
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
<% end %> <% end %>
</div> </div>

View File

@ -115,10 +115,7 @@
$.ajax({ $.ajax({
url:'/forums/'+'<%= @forum.id.to_s%>'+'/memos', url:'/forums/'+'<%= @forum.id.to_s%>'+'/memos',
type:'post', type:'post',
data:{ data:$("#new_memo").serialize(),
'memo[content]':$("#memo_content").val(),
'memo[subject]':$("#memo_subject").val()
},
success:function(data){ success:function(data){
}, },

View File

@ -30,7 +30,7 @@
<li>&nbsp;&nbsp;</li> <li>&nbsp;&nbsp;</li>
</ul> </ul>
<ul class="setting_right "> <ul class="setting_right ">
<li><%= f.text_field :login,:no_label=>true, :required => true, :nh_required=>"1",:disabled=>'disabled', :name => "login",:class=>"w210"%></li> <li><%= f.text_field :login,:no_label=>true, :required => true,:style=>"color:grey", :nh_required=>"1",:disabled=>'disabled', :name => "login",:class=>"w210"%></li>
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li> <li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li>
<li> <li>

View File

@ -0,0 +1,96 @@
<script>
function searchone4reload(fileid){
var url = "<%= searchone4reload_course_files_path(@course)%>";
var data = {};data.fileid=fileid;
$.ajax({
url:url,dataType:'text',data:data,success:function(text){
var container_file_div = $("#container_files_"+fileid);
container_file_div.after(text);
container_file_div.remove();
}
});
}
function show_upload(obj)
{
switch(obj)
{
case 1:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 1}) %>');
break;
case 2:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 2}) %>');
break;
case 3:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 3}) %>');
break;
case 4:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 4}) %>');
break;
case 6:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 6}) %>');
break;
default:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 5}) %>');
}
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function closeModal()
{
hideModal($("#popbox_upload"));
}
function presscss(id)
{
if(id == "incourse")
{
$('#incourse').attr("class", "re_schbtn b_dblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
else
{
$('#incourse').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_dblue");
}
}
function buttoncss()
{
$('#incourse').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
</script>
<div class="container">
<div class="resource"><!--资源库内容开始--->
<div class="re_top">
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<% end %>
<% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> <!-- show_window('light','fade','20%','35%')-->
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
<p class="c_grey fr mt10 mr5">
上传:
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(1);">课件</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(2);">软件</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(3);">媒体</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(4);">代码</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(6);">论文</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(5);">其他</a>
</p>
<% end %>
</div><!---re_top end-->
<div class="cl"></div>
<div class="re_con" id="course_list">
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
</div><!---re_con end-->
</div>
</div>
<% html_title(l(:label_attachment_plural)) -%>

View File

@ -29,7 +29,8 @@
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%> <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%>
<% else %> <% else %>
<%#= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %> <%#= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %>
<a href="javascript:void(0);" class="homepageMenuText"><%= field.name %></a>
<% end %> <% end %>
</div> </div>
<div class="homepageLeftMenuCourses" id="homepageLeftMenuField_<%= field.id %>" style="display:none;"> <div class="homepageLeftMenuCourses" id="homepageLeftMenuField_<%= field.id %>" style="display:none;">

View File

@ -1,2 +1,2 @@
//location.reload(); //location.reload();
window.location.href ='<%= organization_path(@org, :show_homepage => params[:show_homepage])%>'; window.location.href ='<%= organization_path(@org, :show_homepage => 1)%>';

View File

@ -180,7 +180,7 @@
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<p> <p>
<%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好! <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
该作业已经关闭了匿评。作业信息如下: 该作业已经关闭了匿评。作业信息如下:
</p> </p>
<ul class="ul_grey"> <ul class="ul_grey">
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li> <li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>

View File

@ -72,7 +72,17 @@ RedmineApp::Application.routes.draw do
end end
resources :org_subfields do resources :org_subfields do
resources :files, :only => [:index, :new, :create] do
collection do
match "getattachtype", :via => [:get, :post]
match "search",:via => [:post,:get]
match "searchone4reload",:via => [:post,:get]
match "search_tag_attachment", :via => [:post,:get]
end
member do
match "quote_resource_show", :via => [:get]
end
end
end end
resources :org_document_comments do resources :org_document_comments do

View File

@ -159,4 +159,5 @@ function init_activity_KindEditor_data(id){
div_form = $("div[nhname='new_message_" + id + "']"); div_form = $("div[nhname='new_message_" + id + "']");
$(".ke-edit", div_form).css("height","33px"); $(".ke-edit", div_form).css("height","33px");
$(".ke-edit-iframe",div_form).css("height","33px");
} }

View File

@ -1226,3 +1226,7 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat;
.mb10 {margin-bottom: 10px} .mb10 {margin-bottom: 10px}
.mb15 {margin-bottom: 15px} .mb15 {margin-bottom: 15px}
div.disable_link {background-color: #c1c1c1 !important;} div.disable_link {background-color: #c1c1c1 !important;}
/*新课程资源库*/
.reCon{ margin:5px; width:710px;}
.reTop{width:710px; height:40px; background:#eaeaea; padding:5px;}

View File

@ -71,3 +71,16 @@ a.linkGrey8:hover {color:#585858;}
#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;} #orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;}
.orgListStatus {width:55px; float:left;} .orgListStatus {width:55px; float:left;}
.reCon{ margin:5px; width:710px;}
.retop{width:710px; height:40px; background:#eaeaea; padding:5px;}
.resources {width:718px; background-color:#ffffff; padding:15px; border:1px solid #dddddd;float: right}
.re_search{ margin-top:7px; margin-left:5px;}
.re_search{ margin-top:7px; margin-left:5px;}
.re_schbox{ width:240px; height:24px; border:1px solid #64bdd9; color:#666666;}
.re_schbtn{ width:60px; height:26px; color:#fff; margin-right:5px; border:none; margin-left:0px;padding-left: 0px;}
.b_lblue{ background:#64bdd9;}
.c_grey{ color:#888888;}
.re_con{ margin:5px; width:665px;}
.re_con_top{color:#494949; }
.re_con_top span{ color:#999999; font-weight:bold;}
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }