This commit is contained in:
huang 2015-12-25 15:48:41 +08:00
commit a16d6803ae
9 changed files with 109 additions and 40 deletions

View File

@ -1,4 +1,8 @@
require 'zip'
#coding=utf-8
require "base64"
require 'zip'
class ZipdownController < ApplicationController
#查找项目(课程)
before_filter :find_project_by_bid_id, :only => [:assort]
@ -11,7 +15,12 @@ class ZipdownController < ApplicationController
def download
if User.current.logged?
begin
send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(params[:filename]), :type => detect_content_type(params[:file])
if params[:base64file]
file = Base64.decode64(params[:base64file])
send_file "#{OUTPUT_FOLDER}/#{file}", :filename => filename_for_content_disposition(file), :type => detect_content_type(file)
else
send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(params[:filename]), :type => detect_content_type(params[:file])
end
rescue => e
render file: 'public/no_file_found.html'
end
@ -107,7 +116,9 @@ class ZipdownController < ApplicationController
bid_homework_path, OUTPUT_FOLDER)
}
[{files:[out_file.file_path], count: 1, index: 1,
real_file: out_file.file_path, file: File.basename(out_file.file_path),
real_file: out_file.file_path,
file: File.basename(out_file.file_path),
base64file: Base64.encode64(File.basename(out_file.file_path)),
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
}]
end
@ -129,7 +140,9 @@ class ZipdownController < ApplicationController
bid_homework_path, OUTPUT_FOLDER)
}
[{files:[out_file.file_path], count: 1, index: 1,
real_file: out_file.file_path, file: File.basename(out_file.file_path),
real_file: out_file.file_path,
file: File.basename(out_file.file_path),
base64file: Base64.encode64(File.basename(out_file.file_path)),
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
}]
end

View File

@ -344,7 +344,8 @@ class User < Principal
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count
end
# 查询指派给我的缺陷记录

View File

@ -57,7 +57,7 @@
: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 => container),
: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),

View File

@ -58,7 +58,7 @@
: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 => project),
: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),

View File

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

View File

@ -18,8 +18,8 @@
<li>登录名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li>邮箱&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li>身份&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">姓(First Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">名(Last Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">姓(Last Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">名(First Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_2="true" style="display:none;">组织名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">性别&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">工作单位&nbsp;:&nbsp;</li>

View File

@ -23,7 +23,7 @@
# email_delivery:
# delivery_method: :smtp
# smtp_settings:
# address: "localhost"
# address: smtp.163.com
# port: 25
#
# ==== SMTP server at example.com using LOGIN authentication and checking HELO for foo.com
@ -32,12 +32,12 @@
# email_delivery:
# delivery_method: :smtp
# smtp_settings:
# address: "example.com"
# port: 25
# address: smtp.gmail.com
# port: 587
# authentication: :login
# domain: 'foo.com'
# user_name: 'myaccount'
# password: 'password'
# user_name: senluowanxiangt@gmail.com
# password: 1913TXBja
#
# ==== SMTP server at example.com using PLAIN authentication
#
@ -45,12 +45,12 @@
# email_delivery:
# delivery_method: :smtp
# smtp_settings:
# address: "example.com"
# port: 25
# address: smtp.gmail.com
# port: 587
# authentication: :plain
# domain: 'example.com'
# user_name: 'myaccount'
# password: 'password'
# user_name: senluowanxiangt@gmail.com
# password: 1913TXBja
#
# ==== SMTP server at using TLS (GMail)
#
@ -62,12 +62,12 @@
# delivery_method: :smtp
# smtp_settings:
# enable_starttls_auto: true
# address: "smtp.gmail.com"
# address: smtp.gmail.com
# port: 587
# domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps
# authentication: :plain
# user_name: "your_email@gmail.com"
# password: "your_password"
# user_name: senluowanxiangt@gmail.com
# password: 1913TXBja
#
#
# === More configuration options
@ -78,18 +78,17 @@
# http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer
# default configuration options for all environments
default:
# Outgoing emails configuration (see examples above)
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.example.net
port: 25
domain: example.net
authentication: :login
user_name: "redmine@example.net"
password: "redmine"
address: mail.trustie.net
port: 25
domain: mail.trustie.net
authentication: :login
user_name: "mail@trustie.net"
password: "loong2010"
# Absolute path to the directory where attachments are stored.
# The default is the 'files' directory in your Redmine instance.
@ -104,7 +103,7 @@ default:
# autologin_cookie_name: the name of the cookie (default: autologin)
# autologin_cookie_path: the cookie path (default: /)
# autologin_cookie_secure: true sets the cookie secure flag (default: false)
autologin_cookie_name:
autologin_cookie_name: "autologin_trustie"
autologin_cookie_path:
autologin_cookie_secure:
@ -170,7 +169,7 @@ default:
# Absolute path (e.g. /usr/bin/convert, c:/im/convert.exe) to
# the ImageMagick's `convert` binary. Used to generate attachment thumbnails.
#imagemagick_convert_command:
imagemagick_convert_command: '/home/pdl/redmine-2.3.2-0/common/bin/convert'
# Configuration of RMagcik font.
#
@ -196,11 +195,41 @@ default:
# Maximum number of simultaneous AJAX uploads
#max_concurrent_ajax_uploads: 2
#pic_types: "bmp,jpeg,jpg,png,gif"
repository_root_path: '/tmp/htdocs'
judge_server: 'http://judge.trustie.net/'
# Git's url
gitlab_address: 'http://gitfast.trustie.net'
# specific configuration options for production environment
# that overrides the default ones
production:
# CJK support
rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf
judge_server: 'http://192.168.80.21:8080/'
repository_root_path: '/home/pdl/redmine-2.3.2-0/apache2/htdocs'
cookie_domain: ".trustie.net"
email_delivery:
delivery_method: :smtp
smtp_settings:
address: mail.trustie.net
port: 25
domain: mail.trustie.net
authentication: :login
user_name: "mail@trustie.net"
password: "loong2010"
# specific configuration options for development environment
# that overrides the default ones
development:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: mail.trustie.net
port: 25
domain: mail.trustie.net
authentication: :login
user_name: "mail@trustie.net"
password: "loong2010"

View File

@ -9,7 +9,7 @@
border: 1px solid #DDD;
border-radius: 3px;
box-shadow: 0 0 5px rgba(0,0,0,0.1);
min-width: 120px;
min-width: 200px;
max-height: 200px;
overflow: auto;
z-index: 11110 !important;

View File

@ -870,7 +870,10 @@ function redo() {
window.location.reload()
}
function encodeHomeworkUrl(url){
function encodeHomeworkUrl(url, is_base64){
if(typeof is_base64 === 'boolean' && is_base64){
return '/zipdown/download?base64file='+url;
}
var file = encodeURI(url).replace(/\+/g, '%2B');
return '/zipdown/download?file='+file;
}
@ -891,7 +894,10 @@ $(function(){
}
if(res.length==1){
location.href = encodeHomeworkUrl(res[0].file);return;
if(res[0].base64file){
location.href = encodeHomeworkUrl(res[0].base64file, true);return;
}
location.href = encodeHomeworkUrl(res[0].file);return;
}
document.getElementById('light').style.display='block';
@ -904,8 +910,12 @@ $(function(){
} else {
des = '第'+res[i].index+'个学生的作品下载';
}
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="'+ encodeHomeworkUrl(res[i].file) +'">'+des+'</a><span class="c_grey">&nbsp;&nbsp;(共'+res[i].size+'M</span> </li>').appendTo($container);
if(res[i].base64file){
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="'+ encodeHomeworkUrl(res[i].base64file, true) +'">'+des+'</a><span class="c_grey">&nbsp;&nbsp;(共'+res[i].size+'M</span> </li>').appendTo($container);
} else {
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="'+ encodeHomeworkUrl(res[i].file) +'">'+des+'</a><span class="c_grey">&nbsp;&nbsp;(共'+res[i].size+'M</span> </li>').appendTo($container);
}
}
}
});
@ -921,7 +931,10 @@ $(function(){
else
{
if(res.length==1){
location.href = encodeHomeworkUrl(res[0].file);return;
if(res[0].base64file){
location.href = encodeHomeworkUrl(res[0].base64file, true);return;
}
location.href = encodeHomeworkUrl(res[0].file);return;
}
document.getElementById('light').style.display='block';
$container = $('#light .upload_box_ul');
@ -933,7 +946,12 @@ $(function(){
} else {
des = '第'+res[i].index+'个学生的作品下载';
}
if(res[i].base64file){
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="'+ encodeHomeworkUrl(res[i].base64file, true) +'">'+des+'</a><span class="c_grey">&nbsp;&nbsp;(共'+res[i].size+'M</span> </li>').appendTo($container);
} else {
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="'+ encodeHomeworkUrl(res[i].file) +'">'+des+'</a><span class="c_grey">&nbsp;&nbsp;(共'+res[i].size+'M</span> </li>').appendTo($container);
}
}
}
@ -973,3 +991,14 @@ function showNormalImage(id) {
}
}
$(function(){
//at 加链接
$("span.at").hover(function(){
$(this).css('cursor', 'pointer');
});
$("span.at").live('click', function(){
var userId = $(this).attr('data-user-id');
$(window.location).attr('href', '/users/'+userId);
});
});