Merge branch 'szzh' into develop

This commit is contained in:
huang 2015-12-25 19:03:03 +08:00
commit 5ca2896cc4
10 changed files with 61 additions and 13 deletions

View File

@ -649,7 +649,8 @@ class StudentWorkController < ApplicationController
if revise_attachments.count == 2 if revise_attachments.count == 2
revise_attachments.last.destroy revise_attachments.last.destroy
end end
#@attachment = @work.attachments.where("attachtype = 7").order("created_on desc").first attachment = @work.attachments.where("attachtype = 7").first
attachment.update_attributes(:description => params[:description])
respond_to do |format| respond_to do |format|
format.js format.js
end end

View File

@ -17,6 +17,7 @@ class ZipdownController < ApplicationController
begin begin
if params[:base64file] if params[:base64file]
file = Base64.decode64(params[:base64file]) file = Base64.decode64(params[:base64file])
file = file.sub('*', '+')
send_file "#{OUTPUT_FOLDER}/#{file}", :filename => filename_for_content_disposition(file), :type => detect_content_type(file) send_file "#{OUTPUT_FOLDER}/#{file}", :filename => filename_for_content_disposition(file), :type => detect_content_type(file)
else else
send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(params[:filename]), :type => detect_content_type(params[:file]) send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(params[:filename]), :type => detect_content_type(params[:file])
@ -118,11 +119,15 @@ class ZipdownController < ApplicationController
[{files:[out_file.file_path], count: 1, index: 1, [{files:[out_file.file_path], count: 1, index: 1,
real_file: out_file.file_path, real_file: out_file.file_path,
file: File.basename(out_file.file_path), file: File.basename(out_file.file_path),
base64file: Base64.encode64(File.basename(out_file.file_path)), base64file: encode64(File.basename(out_file.file_path)),
size:(out_file.pack_size / 1024.0 / 1024.0).round(2) size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
}] }]
end end
def encode64(str)
Base64.encode64(str).sub('+', '*')
end
def zip_homework_common homework_common def zip_homework_common homework_common
bid_homework_path = [] bid_homework_path = []
digests = [] digests = []
@ -142,7 +147,7 @@ class ZipdownController < ApplicationController
[{files:[out_file.file_path], count: 1, index: 1, [{files:[out_file.file_path], count: 1, index: 1,
real_file: out_file.file_path, real_file: out_file.file_path,
file: File.basename(out_file.file_path), file: File.basename(out_file.file_path),
base64file: Base64.encode64(File.basename(out_file.file_path)), base64file: encode64(File.basename(out_file.file_path)),
size:(out_file.pack_size / 1024.0 / 1024.0).round(2) size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
}] }]
end end

View File

@ -41,7 +41,7 @@
<% end %> <% end %>
<% if issues.count == 10%> <% if issues.count == 10%>
<!--<div id="show_more_issues" class="loadMore mt10 f_grey">点击展开更多<%#=link_to "", project_issues_path({:project_id => project.id,:page => issue_pages.page}.merge(params)),:id => "more_issues_link",:remote => "true",:class => "none" %></div>--> <!--<div id="show_more_issues" class="loadMore mt10 f_grey">点击展开更多<%#=link_to "", project_issues_path({:project_id => project.id,:page => issue_pages.page}.merge(params)),:id => "more_issues_link",:remote => "true",:class => "none" %></div>-->
<%= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> <%= link_to "点击展开更多",project_issues_path({:project_id => project.id,:page => issue_pages.page}.merge(params)),:id => "show_more_issues",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end%> <% end%>
<!--<ul class="wlist">--> <!--<ul class="wlist">-->
<!--<%#= pagination_links_full issue_pages, issue_count, :per_page_links => false, :remote => true, :flag => true %>--> <!--<%#= pagination_links_full issue_pages, issue_count, :per_page_links => false, :remote => true, :flag => true %>-->

View File

@ -115,8 +115,20 @@
$('#ajax-modal').parent().addClass("resourceUploadPopup"); $('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
} }
function submit_files(){ function regex_des() {
$("#upload_form").submit(); if ($.trim($("#attachment_des").val()) == "") {
$("#hint_message").text("附件描述不能为空");
$("#hint_message").css('color','#ff0000');
return false;
} else {
$("#hint_message").text("");
return true;
}
}
function submit_revise_files(){
if (regex_des()) {
$("#upload_form").submit();
}
} }
function closeModal(){ function closeModal(){
hideModal($(".uploadBoxContainer")); hideModal($(".uploadBoxContainer"));

View File

@ -7,8 +7,12 @@
<div class="mb10" id="revise_attachment_div_<%=revise_attachment.id %>"> <div class="mb10" id="revise_attachment_div_<%=revise_attachment.id %>">
<span class="tit_fb"> 追加附件:</span> <span class="tit_fb"> 追加附件:</span>
<%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %> <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %>
<span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %>&nbsp;&nbsp;(<%=revise_attachment_status @homework,revise_attachment %>) <span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %>&nbsp;&nbsp;(<%=revise_attachment_status @homework,revise_attachment %>)<br />
<% unless revise_attachment.description == "" %>
<span class="tit_fb">附件描述:</span><p class="showHworkP"><%=revise_attachment.description %></p>
<% end %>
</div> </div>
<div class="cl"></div>
<% end %> <% end %>
<% if work.user == User.current %> <% if work.user == User.current %>
<div class="resubAtt mb15"> <div class="resubAtt mb15">
@ -18,10 +22,14 @@
<div class="mb10" id="revise_attachment_div_<%=revise_attachment.id %>"> <div class="mb10" id="revise_attachment_div_<%=revise_attachment.id %>">
<span class="tit_fb"> 追加附件:</span> <span class="tit_fb"> 追加附件:</span>
<%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %> <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %>
<span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %> <span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %><br />
<% unless revise_attachment.description == "" %>
<span class="tit_fb">附件描述:</span><p class="showHworkP"><%=revise_attachment.description %></p>
<% end %>
</div> </div>
<% end %> <% end %>
<div class="mb10"> <div class="cl"></div>
<div class="mb10 mt5">
<a href="javascript:void(0);" onclick="show_upload();" class="blueCir ml5" title="请选择文件上传">上传附件</a> <a href="javascript:void(0);" onclick="show_upload();" class="blueCir ml5" title="请选择文件上传">上传附件</a>
</div> </div>
<% end %> <% end %>

View File

@ -113,8 +113,20 @@
$('#ajax-modal').parent().addClass("resourceUploadPopup"); $('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
} }
function submit_files(){ function regex_des() {
$("#upload_form").submit(); if ($.trim($("#attachment_des").val()) == "") {
$("#hint_message").text("附件描述不能为空");
$("#hint_message").css('color','#ff0000');
return false;
} else {
$("#hint_message").text("");
return true;
}
}
function submit_revise_files(){
if (regex_des()) {
$("#upload_form").submit();
}
} }
function closeModal(){ function closeModal(){
hideModal($(".uploadBoxContainer")); hideModal($(".uploadBoxContainer"));

View File

@ -9,7 +9,7 @@
</div> </div>
<div class="uploadBox" id="uploadReviseBox"> <div class="uploadBox" id="uploadReviseBox">
<input type="hidden" name="attachment_type" value="7"> <input type="hidden" name="attachment_type" value="7">
<a href="javascript:void(0);" class="uploadIcon f14" name="button" id="choose_revise_attach" onclick="_file.click();" onmouseover="" style="<%= ie8? ? 'display:none' : ''%>"> <a href="javascript:void(0);" class="uploadIcon f14" name="button" id="choose_revise_attach" onclick="_file.click();" style="<%= ie8? ? 'display:none' : ''%>">
<span class="chooseFile">选择文件</span></a> <span class="chooseFile">选择文件</span></a>
<%= file_field_tag 'attachments[dummy][file]', <%= file_field_tag 'attachments[dummy][file]',
:id => '_file', :id => '_file',
@ -37,9 +37,16 @@
<div class="uploadResourceName">最多只能上传一个小于<span class="c_red">50MB</span>的附件</div> <div class="uploadResourceName">最多只能上传一个小于<span class="c_red">50MB</span>的附件</div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="mt10">
<textarea class="reUploadDetail" id="attachment_des" name="description" placeholder="请在此输入您追加附件的理由(必填)"></textarea>
</div>
<div class="cl"></div>
<p id="hint_message"></p>
<div class="cl"></div>
<div style="margin-top: 10px" > <div style="margin-top: 10px" >
<div class="courseSendSubmit"> <div class="courseSendSubmit">
<%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %> <a href="javascript:void(0);" id="upload_files_submit_btn" class="sendSourceText" onclick="submit_revise_files();">确定</a>
<%#= submit_tag '确定',:onclick=>'submit_revise_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
</div> </div>
<div class="courseSendCancel"> <div class="courseSendCancel">
<a href="javascript:void(0);" id="upload_files_cancle_btn" class="sendSourceText" onclick="closeModal();">取消</a> <a href="javascript:void(0);" id="upload_files_cancle_btn" class="sendSourceText" onclick="closeModal();">取消</a>

View File

@ -81,6 +81,7 @@
<%= format_time(attachment.created_on) %> <%= format_time(attachment.created_on) %>
</span> </span>
</div> </div>
<div class="cl"></div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

View File

@ -439,6 +439,7 @@ RedmineApp::Application.routes.draw do
post '/courses/:id/course_activity', :to => 'courses#show', :as => 'course_activity' post '/courses/:id/course_activity', :to => 'courses#show', :as => 'course_activity'
get '/boards/:id/boards_topic', :to =>'boards#show', :as => 'boards_topic' get '/boards/:id/boards_topic', :to =>'boards#show', :as => 'boards_topic'
match 'courses/:course_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_course_news' match 'courses/:course_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_course_news'
match 'courses/:course_id/news/new', :to => 'news#new', :via => [:get, :post]
#added by young #added by young
resources :users do resources :users do

View File

@ -1227,6 +1227,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;}
.reUploadDetail{border:1px solid #dddddd; float:left; resize:none; width:400px; height:80px; overflow-y:auto;outline: none;}
/*新课程资源库*/ /*新课程资源库*/
.reCon{ margin:5px; width:710px;} .reCon{ margin:5px; width:710px;}