Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
a70e0ccadd
|
@ -41,7 +41,7 @@ class UsersController < ApplicationController
|
|||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index]
|
||||
before_filter :auth_user_extension, only: :show
|
||||
before_filter :rest_user_score, only: :show
|
||||
#before_filter :rest_user_score, only: :show
|
||||
#before_filter :select_entry, only: :user_projects
|
||||
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
|
||||
|
||||
|
|
|
@ -7,17 +7,6 @@ class ZipdownController < ApplicationController
|
|||
SAVE_FOLDER = "#{Rails.root}/files"
|
||||
OUTPUT_FOLDER = "#{Rails.root}/tmp/archiveZip"
|
||||
|
||||
#通过作业Id找到项目(课程)
|
||||
def find_project_by_bid_id
|
||||
obj_class = params[:obj_class]
|
||||
obj_id = params[:obj_id]
|
||||
obj = obj_class.constantize.find(obj_id)
|
||||
case obj.class.to_s.to_sym
|
||||
when :Bid
|
||||
@project = obj.courses[0]
|
||||
end
|
||||
end
|
||||
|
||||
def assort
|
||||
if params[:obj_class] == "Bid"
|
||||
bid = Bid.find params[:obj_id]
|
||||
|
@ -33,8 +22,8 @@ class ZipdownController < ApplicationController
|
|||
end
|
||||
send_file zipfile, :filename => bid.name + ".zip", :type => detect_content_type(zipfile) if zipfile
|
||||
|
||||
rescue Exception => e
|
||||
render file: 'public/no_file_found.html'
|
||||
#rescue Exception => e
|
||||
# render file: 'public/no_file_found.html'
|
||||
end
|
||||
|
||||
#下载某一学生的作业的所有文件
|
||||
|
@ -56,12 +45,23 @@ class ZipdownController < ApplicationController
|
|||
else
|
||||
render_403
|
||||
end
|
||||
rescue => e
|
||||
render file: 'public/file_not_found.html'
|
||||
#rescue => e
|
||||
# render file: 'public/file_not_found.html'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
#通过作业Id找到项目(课程)
|
||||
def find_project_by_bid_id
|
||||
obj_class = params[:obj_class]
|
||||
obj_id = params[:obj_id]
|
||||
obj = obj_class.constantize.find(obj_id)
|
||||
case obj.class.to_s.to_sym
|
||||
when :Bid
|
||||
@project = obj.courses[0]
|
||||
end
|
||||
end
|
||||
|
||||
def zip_bid(bid)
|
||||
# Todo: User Access Controll
|
||||
bid_homework_path = []
|
||||
|
@ -101,10 +101,20 @@ class ZipdownController < ApplicationController
|
|||
|
||||
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
|
||||
input_filename.each do |filename|
|
||||
flag = true
|
||||
index = 1
|
||||
rename_file = ic.iconv( (File.basename(filename)) ).to_s
|
||||
rename_file = ic.iconv( filename_to_real( File.basename(filename))).to_s if is_attachment
|
||||
|
||||
zipfile.add(rename_file, filename)
|
||||
begin
|
||||
zipfile.add(rename_file, filename)
|
||||
flag = false
|
||||
rescue Exception => e
|
||||
zipfile.get_output_stream('FILE_NOTICE.txt') do |os|
|
||||
os.write l(:label_file_exist)
|
||||
end
|
||||
next
|
||||
end
|
||||
end
|
||||
unless not_exist_file.empty?
|
||||
zipfile.get_output_stream('FILE_LOST.txt') do |os|
|
||||
|
@ -113,9 +123,9 @@ class ZipdownController < ApplicationController
|
|||
end
|
||||
end
|
||||
zipfile_name
|
||||
rescue Errno => e
|
||||
logger.error "[zipdown#zipping] ===> #{e}"
|
||||
@error = e
|
||||
#rescue Errno => e
|
||||
# logger.error "[zipdown#zipping] ===> #{e}"
|
||||
# @error = e
|
||||
end
|
||||
def detect_content_type(name)
|
||||
content_type = Redmine::MimeType.of(name)
|
||||
|
|
|
@ -62,7 +62,7 @@ function f_submit()
|
|||
<style type="text/css">
|
||||
/*浮窗*/
|
||||
body{ height:3000px; font-family:'微软雅黑';}
|
||||
div,ul,li,body,h3,p{margin:0; padding:0;}
|
||||
|
||||
a{ text-decoration:none;}
|
||||
#roll{ background:url(/images/f_opnion.jpg) 0 0 no-repeat;width:157px; height:332px; position:absolute;}
|
||||
.opnionBox{ width: 130px; height:146px; margin:76px auto 20px; }
|
||||
|
@ -101,10 +101,10 @@ a:hover.opnionButton{ text-decoration:underline;}
|
|||
<% get_memo %>
|
||||
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
|
||||
<div class="actions" style="max-width:680px">
|
||||
<p>
|
||||
<p style="margin:0; padding:0;">
|
||||
<%= f.text_area :subject, :class => "opnionText",:placeholder => "有什么想说的,尽管来咆哮吧~~"%>
|
||||
</p>
|
||||
<p>
|
||||
<p style="margin:0; padding:0;">
|
||||
<%= f.hidden_field :content, :required => true ,:value=>'该贴来自用户反馈!'%>
|
||||
</p>
|
||||
<%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %>
|
||||
|
|
|
@ -2239,5 +2239,6 @@ zh:
|
|||
label_course_prompt: 课程:
|
||||
label_contain_resource: 已包含资源:
|
||||
label_quote_resource_failed: ",此资源引用失败! "
|
||||
label_file_lost: 以下文件在服务器丢失,请联系相关人员重新上传:
|
||||
label_file_lost: 以下无法成功下载,请联系相关人员重新上传:
|
||||
label_file_exist: 该作品中有重复命名文件,请通过文件名学号和姓名信息进入该作业详细界面手动下载
|
||||
|
||||
|
|
|
@ -831,8 +831,9 @@ ActiveRecord::Schema.define(:version => 20150112024820) do
|
|||
t.integer "user_id"
|
||||
t.datetime "published_at"
|
||||
t.datetime "closed_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.text "polls_description"
|
||||
end
|
||||
|
||||
create_table "praise_tread_caches", :force => true do |t|
|
||||
|
|
|
@ -91,12 +91,19 @@ module Redmine
|
|||
ActiveSupport::Deprecation.warn "acts_as_activity_provider with implicit :permission option is deprecated. Add a visible scope to the #{self.name} model or use explicit :permission option."
|
||||
scope = scope.scoped(:conditions => Project.allowed_to_condition(user, "view_#{self.name.underscore.pluralize}".to_sym, options))
|
||||
end
|
||||
to = scope.select(:created_on).order("created_on desc").first.created_on
|
||||
if options[:course]
|
||||
from = (to - days) > created_time ? (to - days) : created_time.to_date
|
||||
else
|
||||
from = to - days -1.years
|
||||
unless scope.all(provider_options[:find_options].dup).first.nil?
|
||||
if provider_options[:timestamp].include? "updated_on"
|
||||
to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.updated_on
|
||||
else
|
||||
to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.created_on
|
||||
end
|
||||
if options[:course]
|
||||
from = (to - days.days) > created_time ? (to - days.days) : created_time.to_date
|
||||
else
|
||||
from = to - days.days - 1.years
|
||||
end
|
||||
end
|
||||
|
||||
if from && to
|
||||
scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue