socialforge/app/views/files/_upload_course_files.erb

122 lines
5.4 KiB
Plaintext

<script src="/javascripts/jquery.datetimepicker.js" type="text/javascript"></script>
<div id="muban_popup_box" style="width:450px;">
<div class="muban_popup_top">
<h3 class="fl">上传资源</h3>
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="$('#datetimepicker_mask').datetimepicker('destroy');"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear mt15 ml55">
<div class="">
<%= error_messages_for 'attachment' %>
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
<%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<input type="hidden" name="in_course_toolbar" value="Y">
<!--<p class="c_grey fr mt10 mr5">-->
<ul class="c_dark mt10 mb10 f14 attachment_type_ul">
<li class="fl">
<input id="atta_type_1" name="course_attachment_type[]" type="checkbox" value="1" checked class="fl" />
<label for="atta_type_1" class="c_grey fl ml5">课件&nbsp;|&nbsp;</label>
</li>
<li class="fl">
<input id="atta_type_2" name="course_attachment_type[]" type="checkbox" value="2" class="fl"/>
<label for="atta_type_2" class="c_grey fl ml5">软件&nbsp;|&nbsp;</label>
</li>
<li class="fl">
<input id="atta_type_3" name="course_attachment_type[]" type="checkbox" value="3" class="fl"/>
<label for="atta_type_3" class="c_grey fl ml5">媒体&nbsp;|&nbsp;</label>
</li>
<li class="fl">
<input id="atta_type_4" name="course_attachment_type[]" type="checkbox" value="4" class="fl"/>
<label for="atta_type_4" class="c_grey fl ml5">代码&nbsp;|&nbsp;</label>
</li>
<li class="fl">
<input id="atta_type_5" name="course_attachment_type[]" type="checkbox" value="5" class="fl"/>
<label for="atta_type_5" class="c_grey fl ml5">论文&nbsp;|&nbsp;</label>
</li>
<li class="fl">
<input id="atta_type_6" name="course_attachment_type[]" type="checkbox" value="6" class="fl"/>
<label for="atta_type_6" class="c_grey fl ml5">其他</label>
</li>
</ul>
<div class="cl"></div>
<div class="mb10">
<%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
</div>
<div class="cl"></div>
<% if User.current.allowed_to?(:as_teacher,course) %>
<div class="mb10">
<label class="fl c_dark f14" style="margin-top: 4px;">延期发布:</label>
<div class="calendar_div fl ml10">
<input type="text" name="publish_time" id="datetimepicker_mask" placeholder="发布时间(可选)" style="width: 130px;" class="InputBox fl calendar_input" readonly="readonly">
</div>
<div class="cl"></div>
<span class="c_red f12" style="margin-top: 4px;" id="publish_time_notice"></span>
<div class="cl"></div>
</div>
<% end %>
<div class="mb10">
<label class="fl c_dark f14" style="margin-top: 4px;">附件描述:</label>
<div class="fl ml10">
<textarea name="description" placeholder="介绍一下您的资源,让它得到更多人的青睐吧~" style="width: 249px; height: 60px; font-size: 12px;" class="InputBox fl"></textarea>
</div>
<div class="cl"></div>
</div>
<a href="javascript:void(0);" class="fr sy_btn_blue" style="margin-right: 59px;" id="submit_resource" onclick="submit_course_resource();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="$('#datetimepicker_mask').datetimepicker('destroy');hideModal();">取消</a>
<div class="cl"></div>
<% end %>
</div>
</div>
<% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %>
<% end %>
</div>
<script>
function regex_publish_time()
{
var myDate = new Date();
if($.trim($("#datetimepicker_mask").val()) == "")
{
return true;
} else{
var publish_time = Date.parse($("#datetimepicker_mask").val());
if(Date.parse(formate_time(myDate)) > publish_time)
{
$("#publish_time_notice").text("发布时间不能小于当前时间");
return false;
}
else
{
$("#publish_time_notice").text("");
return true;
}
}
}
function submit_course_resource()
{
<% if User.current.allowed_to?(:as_teacher,course) %>
if(regex_publish_time()) {
$('#submit_resource').parent().submit();
}
<% else %>
$('#submit_resource').parent().submit();
<% end %>
}
$(function(){
$('#datetimepicker_mask').datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
formatTime:'H:i',
formatDate:'Y-m-d',
validateOnBlur:false
});
});
</script>