弹框蓝色边框与关闭键替换

This commit is contained in:
Tim 2016-01-20 16:03:28 +08:00
parent a3c30ee965
commit ffba281de5
44 changed files with 1460 additions and 1458 deletions

View File

@ -28,7 +28,7 @@
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='hiddent_alert_model();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='hiddent_alert_model();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","").css("width","511"); $('#ajax-modal').parent().css("top","").css("left","").css("width","511").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("alert_praise"); $('#ajax-modal').parent().addClass("alert_praise");
<% end %> <% end %>

View File

@ -1,8 +1,8 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms', locals: { bid: @bid, totle_size:@totle_size, cur_size:@cur_size, percent:@percent}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms', locals: { bid: @bid, totle_size:@totle_size, cur_size:@cur_size, percent:@percent}) %>');
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
//$('#ajax-modal').css('height','180px'); //$('#ajax-modal').css('height','180px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').parent().addClass("anonymos");

View File

@ -7,5 +7,5 @@ $('#ajax-modal').siblings().hide();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='javascript:' onclick='hidden_join_course_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='hidden_join_course_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("alert_box"); $('#ajax-modal').parent().addClass("alert_box");

View File

@ -1,8 +1,8 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/new_join', locals: { :course => @course}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/new_join', locals: { :course => @course}) %>');
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
$('#ajax-modal').css('height','100px'); $('#ajax-modal').css('height','100px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').parent().addClass("anonymos");

View File

@ -135,7 +135,7 @@
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').parent().addClass("anonymos");
} }
$("#time_selected").click(select); $("#time_selected").click(select);

View File

@ -9,5 +9,5 @@ $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span>" + $('#ajax-modal').before("<span>" +
"<a href='javascript:void(0)' onclick='hidden_homework_score_form();'><img src='/images/bid/close.png' width='26px' height='26px' style='margin-left: 375px;' /></a></span>"); "<a href='javascript:void(0)' onclick='hidden_homework_score_form();'><img src='/images/bid/close.png' width='26px' height='26px' style='margin-left: 375px;' /></a></span>");
//$('#ajax-modal').parent().removeClass(); //$('#ajax-modal').parent().removeClass();
$('#ajax-modal').parent().css("top","30%").css("left","40%").css("position","fixed"); $('#ajax-modal').parent().css("top","30%").css("left","40%").css("position","fixed").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("new-watcher"); $('#ajax-modal').parent().addClass("new-watcher");

View File

@ -1,37 +1,37 @@
<%= form_for('', <%= form_for('',
:html => { :multipart => true }, :html => { :multipart => true },
:url => {:controller => 'exercise', :url => {:controller => 'exercise',
:action => 'commit_exercise', :action => 'commit_exercise',
:id => exercise.id :id => exercise.id
},:remote=>true ) do |f| %> },:remote=>true ) do |f| %>
<div class="ur_buttons"> <div class="ur_buttons">
<a class="ur_button_submit" onclick="poll_submit();"> 提交 </a> <a class="ur_button_submit" onclick="poll_submit();"> 提交 </a>
<div class="polls_cha"> <div class="polls_cha">
<%= f.check_box 'show_result', :value => exercise.show_result%> <%= f.check_box 'show_result', :value => exercise.show_result%>
<%= label_tag '_show_result', '允许学生查看测验结果' %> <%= label_tag '_show_result', '允许学生查看测验结果' %>
<!--<input name="exercise[show_result]" value="<%#exercise.show_result %>" type="checkbox" checked="true"> <!--<input name="exercise[show_result]" value="<%#exercise.show_result %>" type="checkbox" checked="true">
<label for="">允许学生查看测验结果</label>--> <label for="">允许学生查看测验结果</label>-->
</div> </div>
</div> </div>
<% end %> <% end %>
<script type="text/javascript"> <script type="text/javascript">
function poll_submit() { function poll_submit() {
var question_form = $("form.new_exercise_question"); var question_form = $("form.new_exercise_question");
if($("#polls_head_edit").is(":visible")){ if($("#polls_head_edit").is(":visible")){
alert("请先保存测验标题及测验基本信息。"); alert("请先保存测验标题及测验基本信息。");
} else if(question_form.length > 0) { } else if(question_form.length > 0) {
alert("请先保存正在编辑的题目。"); alert("请先保存正在编辑的题目。");
} else{ } else{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'exercise_submit_info', locals: { :exercise => exercise}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'exercise_submit_info', locals: { :exercise => exercise}) %>');
showModal('ajax-modal', '400px'); showModal('ajax-modal', '400px');
//$('#ajax-modal').css('height','120px'); //$('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }
} }
</script> </script>

View File

@ -1,8 +1,8 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>');
showModal('ajax-modal', '270px'); showModal('ajax-modal', '270px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='hidden_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='hidden_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("alert_box"); $('#ajax-modal').parent().addClass("alert_box");

View File

@ -25,7 +25,7 @@
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }
@ -57,7 +57,7 @@
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }
} }

View File

@ -1,10 +1,10 @@
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>"); $("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>"); $('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
showModal('ajax-modal', '250px'); showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','111px'); //$('#ajax-modal').css('height','111px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("poll_alert_form"); $('#ajax-modal').parent().addClass("poll_alert_form");

View File

@ -1,10 +1,10 @@
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>"); $("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>"); $('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
showModal('ajax-modal', '250px'); showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','80px'); //$('#ajax-modal').css('height','80px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("poll_alert_form"); $('#ajax-modal').parent().addClass("poll_alert_form");

View File

@ -40,7 +40,7 @@
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#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').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().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }

View File

@ -6,7 +6,7 @@
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#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').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","40%").css("left","36%"); $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }

View File

@ -7,5 +7,5 @@
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#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').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().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");

View File

@ -1,11 +1,11 @@
<% if @can_quote %> <% if @can_quote %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => ''}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => ''}) %>');
<% else %> <% else %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => '403'}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => '403'}) %>');
<% end %> <% end %>
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#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').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().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");

View File

@ -7,5 +7,5 @@
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#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').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","30%").css("left","35%"); $('#ajax-modal').parent().css("top","30%").css("left","35%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");

View File

@ -1,6 +1,6 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>');
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>"); $('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' 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().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");

View File

@ -3,13 +3,13 @@
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>"); $('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","40%").css("left","36%"); $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
<% elsif @course %> <% elsif @course %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>');
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>"); $('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","40%").css("left","36%"); $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
<% end %> <% end %>

View File

@ -1,10 +1,10 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'show') %>');
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').css('height','569px'); $('#ajax-modal').css('height','569px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='javascript:void(0)' onclick='hidden_homework_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:void(0)' onclick='hidden_homework_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("alert_box"); $('#ajax-modal').parent().addClass("alert_box");

View File

@ -1,6 +1,6 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>');
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed"); $('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9");

View File

@ -1,6 +1,6 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity => @course_activity}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity => @course_activity}) %>');
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed"); $('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9");

View File

@ -3,4 +3,4 @@ showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9");

View File

@ -4,7 +4,7 @@ showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9");
$(function() { $('#evaluation_start_time').datepicker(datepickerOptions); $(function() { $('#evaluation_start_time').datepicker(datepickerOptions);
$('#evaluation_end_time').datepicker(datepickerOptions); $('#evaluation_end_time').datepicker(datepickerOptions);
}); });

View File

@ -279,7 +279,7 @@
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>"); $('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' 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().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }
// 鼠标经过的时候显示内容 // 鼠标经过的时候显示内容

View File

@ -242,7 +242,7 @@
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>"); $('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","40%").css("left","36%"); $('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }

View File

@ -1,8 +1,8 @@
$("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src')); $("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src'));
$('#ajax-modal').html($("#nh_tx_dialog_html").html()); $('#ajax-modal').html($("#nh_tx_dialog_html").html());
showModal('ajax-modal','460px'); showModal('ajax-modal','460px');
$('#ajax-modal').siblings().hide(); $('#ajax-modal').siblings().hide();
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
//$('#ajax-modal').parent().css("top","").css("left",""); //$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("alert_box"); $('#ajax-modal').parent().addClass("alert_box");
$('#ajax-modal').parent().css("border", "2px solid #15bccf").css("border-radius", "0").css(" -webkit-border-radius", "0").css(" -moz-border-radius", "0"); $('#ajax-modal').parent().css("border", "3px solid #269ac9").css("border-radius", "0").css(" -webkit-border-radius", "0").css(" -moz-border-radius", "0");

View File

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

View File

@ -1,397 +1,397 @@
<%= stylesheet_link_tag 'polls', :media => 'all' %> <%= stylesheet_link_tag 'polls', :media => 'all' %>
<script type="text/javascript"> <script type="text/javascript">
//编辑问卷描述之后 //编辑问卷描述之后
var popWindow ; //弹出框的引用 var popWindow ; //弹出框的引用
var importPollPopWindow; //选择导入的弹出框引用 var importPollPopWindow; //选择导入的弹出框引用
function edit_head(){ function edit_head(){
$("#polls_description").val($("#polls_description_div").html()); $("#polls_description").val($("#polls_description_div").html());
} }
$(function(){ $(function(){
//点击空白处 //点击空白处
$(document).bind('click',function(e){ $(document).bind('click',function(e){
//弹出框非空 不是a标签 点击的不是弹出框 ,那么弹出框就会隐藏 //弹出框非空 不是a标签 点击的不是弹出框 ,那么弹出框就会隐藏
if(popWindow && e.target.nodeName != 'A' && !popWindow.is(e.target) && popWindow.has(e.target).length === 0){ // Mark 1 if(popWindow && e.target.nodeName != 'A' && !popWindow.is(e.target) && popWindow.has(e.target).length === 0){ // Mark 1
popWindow.css('display', 'none'); popWindow.css('display', 'none');
} }
if(importPollPopWindow && e.target.nodeName != 'A' && !importPollPopWindow.is(e.target) && importPollPopWindow.has(e.target).length === 0){ if(importPollPopWindow && e.target.nodeName != 'A' && !importPollPopWindow.is(e.target) && importPollPopWindow.has(e.target).length === 0){
importPollPopWindow.css('display', 'none'); importPollPopWindow.css('display', 'none');
} }
}); });
}) })
function dismiss(quest_type,quest_id){ function dismiss(quest_type,quest_id){
popWindow = $("#div_"+quest_type+"_"+quest_id); popWindow = $("#div_"+quest_type+"_"+quest_id);
if(popWindow){ if(popWindow){
popWindow.css('display', 'none'); popWindow.css('display', 'none');
} }
} }
function chooseQuestionType(quest_type,quest_id){ function chooseQuestionType(quest_type,quest_id){
//quest_type 分为 mc mcq single multi //quest_type 分为 mc mcq single multi
//quest_id 是quetion的id 下同 //quest_id 是quetion的id 下同
if(popWindow){ if(popWindow){
popWindow.css('display', 'none'); popWindow.css('display', 'none');
} }
popWindow = $("#div_"+quest_type+"_"+quest_id); popWindow = $("#div_"+quest_type+"_"+quest_id);
$("#div_"+quest_type+"_"+quest_id).click(function(e){ $("#div_"+quest_type+"_"+quest_id).click(function(e){
e.stopPropagation(); //组织冒泡到document.body中去 e.stopPropagation(); //组织冒泡到document.body中去
}); });
$("#div_"+quest_type+"_"+quest_id).css("position", "absolute"); $("#div_"+quest_type+"_"+quest_id).css("position", "absolute");
$("#div_"+quest_type+"_"+quest_id).css("top", $("#add_"+quest_type+"_"+quest_id).offset().top+30); $("#div_"+quest_type+"_"+quest_id).css("top", $("#add_"+quest_type+"_"+quest_id).offset().top+30);
$("#div_"+quest_type+"_"+quest_id).css("left", $("#add_"+quest_type+"_"+quest_id).offset().left-10); $("#div_"+quest_type+"_"+quest_id).css("left", $("#add_"+quest_type+"_"+quest_id).offset().left-10);
if( $("#div_"+quest_type+"_"+quest_id).css('display') == 'block') { if( $("#div_"+quest_type+"_"+quest_id).css('display') == 'block') {
$("#div_"+quest_type+"_"+quest_id).css('display', 'none'); $("#div_"+quest_type+"_"+quest_id).css('display', 'none');
} }
else{ else{
$("#div_"+quest_type+"_"+quest_id).css('display', 'block'); $("#div_"+quest_type+"_"+quest_id).css('display', 'block');
} }
} }
function add_MC(){ function add_MC(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>"); $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
$("#poll_questions_title").focus(); $("#poll_questions_title").focus();
} }
function insert_MC(quest_type,quest_num,quest_id){ function insert_MC(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html( $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+ '<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
' <div class="ur_editor radio"> '+ ' <div class="ur_editor radio"> '+
'<div class="ur_editor_title"> '+ '<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+ '<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+ '<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+ '<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="1"/>'+ '<input type="hidden" name="question_type" value="1"/>'+
'<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题标题"/>'+ '<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+ '<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+ '<label>必答</label>'+
'</div>'+ '</div>'+
'<div class="ur_editor_content">'+ '<div class="ur_editor_content">'+
'<ul>'+ '<ul>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+ '<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+ '<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+ '<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'</ul>'+ '</ul>'+
'</div>'+ '</div>'+
'<div class="ur_editor_footer">'+ '<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+ '<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<%= l(:label_button_ok)%>'+ '<%= l(:label_button_ok)%>'+
'</a>'+ '</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+ '<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+ '<%= l(:button_cancel)%>'+
'</a>'+ '</a>'+
'</div>'+ '</div>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'</div>'+ '</div>'+
'<% end%>' '<% end%>'
); );
$("#poll_questions_title").focus(); $("#poll_questions_title").focus();
} }
function add_MCQ(){ function add_MCQ(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>"); $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
$("#poll_questions_title").focus(); $("#poll_questions_title").focus();
} }
function insert_MCQ(quest_type,quest_num,quest_id){ function insert_MCQ(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html( $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+ '<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor checkbox">'+ '<div class="ur_editor checkbox">'+
'<div class="ur_editor_title">'+ '<div class="ur_editor_title">'+
'<label>问题:&nbsp;&nbsp;</label>'+ '<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+ '<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+ '<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="2"/>'+ '<input type="hidden" name="question_type" value="2"/>'+
'<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题标题"/>'+ '<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+ '<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+ '<label>必答</label>'+
'</div>'+ '</div>'+
'<div class="ur_editor_content">'+ '<div class="ur_editor_content">'+
'<ul>'+ '<ul>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+ '<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除"" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除"" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+ '<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'<li class="ur_item">'+ '<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+ '<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+ '<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+ '<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+ '<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+ '</li>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'</ul>'+ '</ul>'+
'</div>'+ '</div>'+
'<div class="ur_editor_footer">'+ '<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+ '<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<%= l(:label_button_ok)%>'+ '<%= l(:label_button_ok)%>'+
'</a>'+ '</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+ '<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+ '<%= l(:button_cancel)%>'+
'</a>'+ '</a>'+
'</div>'+ '</div>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'</div>'+ '</div>'+
'<% end%>' '<% end%>'
); );
$("#poll_questions_title").focus(); $("#poll_questions_title").focus();
} }
function add_single(){ function add_single(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>"); $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>");
$("#poll_questions_title").focus(); $("#poll_questions_title").focus();
} }
function insert_SINGLE(quest_type,quest_num,quest_id){ function insert_SINGLE(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html( $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+ '<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor text ">'+ '<div class="ur_editor text ">'+
'<div class="ur_editor_title">'+ '<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+ '<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+ '<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+ '<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="3"/>'+ '<input type="hidden" name="question_type" value="3"/>'+
'<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观标题"/>'+ '<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+ '<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label for="ur_question_require">必答</label>'+ '<label for="ur_question_require">必答</label>'+
'</div>'+ '</div>'+
'<div class="ur_editor_footer">'+ '<div class="ur_editor_footer">'+
'<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+ '<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<%= l(:label_button_ok)%>'+ '<%= l(:label_button_ok)%>'+
'</a>'+ '</a>'+
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+ '<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+ '<%= l(:button_cancel)%>'+
'</a>'+ '</a>'+
'</div>'+ '</div>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'</div>'+ '</div>'+
'<% end%>' '<% end%>'
); );
$("#poll_questions_title").focus(); $("#poll_questions_title").focus();
} }
function add_mulit(){ function add_mulit(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>"); $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
$("#poll_questions_title").focus(); $("#poll_questions_title").focus();
} }
function insert_MULIT(quest_type,quest_num,quest_id){ function insert_MULIT(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html( $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+ '<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor textarea">'+ '<div class="ur_editor textarea">'+
'<div class="ur_editor_title">'+ '<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+ '<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+ '<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+ '<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="4"/>'+ '<input type="hidden" name="question_type" value="4"/>'+
'<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观标题"/>'+ '<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+ '<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+ '<label>必答</label>'+
'</div>'+ '</div>'+
'<div class="ur_editor_toolbar">'+ '<div class="ur_editor_toolbar">'+
'</div>'+ '</div>'+
'<div class="ur_editor_footer">'+ '<div class="ur_editor_footer">'+
'<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+ '<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<%= l(:label_button_ok)%>'+ '<%= l(:label_button_ok)%>'+
'</a>'+ '</a>'+
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+ '<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+ '<%= l(:button_cancel)%>'+
'</a>'+ '</a>'+
'</div>'+ '</div>'+
'<div class="cl"></div>'+ '<div class="cl"></div>'+
'</div>'+ '</div>'+
'<% end%>' '<% end%>'
); );
$("#poll_questions_title").focus(); $("#poll_questions_title").focus();
} }
//选择导入调查问卷 //选择导入调查问卷
function importPoll(){ function importPoll(){
importPollPopWindow = $("#import_poll"); importPollPopWindow = $("#import_poll");
$("#import_poll").css("position", "absolute"); $("#import_poll").css("position", "absolute");
$("#import_poll").css("top", $("#import_btn").offset().top+30); $("#import_poll").css("top", $("#import_btn").offset().top+30);
$("#import_poll").css("left", $("#import_btn").offset().left-65); $("#import_poll").css("left", $("#import_btn").offset().left-65);
$("#import_poll").css("display","block") $("#import_poll").css("display","block")
} }
function remote_import(){ function remote_import(){
importPollPopWindow.css('display', 'none'); importPollPopWindow.css('display', 'none');
if($("#import_poll").val() === 0){ if($("#import_poll").val() === 0){
return; return;
}else{ }else{
if(confirm("确认导入问卷"+$("#import_poll").find("option:selected").text()+"?")){ if(confirm("确认导入问卷"+$("#import_poll").find("option:selected").text()+"?")){
$("#import_form").submit(); $("#import_form").submit();
}else{ }else{
return; return;
} }
} }
} }
//添加标题时确定按钮 //添加标题时确定按钮
function add_poll_question(doc) function add_poll_question(doc)
{ {
var title = $.trim($("#poll_questions_title").val()); var title = $.trim($("#poll_questions_title").val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();} if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
} }
//修改标题时确定按钮 //修改标题时确定按钮
function edit_poll_question(doc,id) function edit_poll_question(doc,id)
{ {
var title = $.trim($("#poll_questions_title_" + id).val()); var title = $.trim($("#poll_questions_title_" + id).val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();} if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
} }
//问卷头 //问卷头
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();} function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
function pollsSubmit(doc){ function pollsSubmit(doc){
var title = $.trim($("#polls_title").val()); var title = $.trim($("#polls_title").val());
if(title.length == 0){alert("问卷标题不能为空");}else{doc.parent().parent().parent().submit();} if(title.length == 0){alert("问卷标题不能为空");}else{doc.parent().parent().parent().submit();}
} }
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();} function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
// //
function pollQuestionCancel(question_id){ function pollQuestionCancel(question_id){
$("#show_poll_questions_"+question_id).show(); $("#show_poll_questions_"+question_id).show();
$("#edit_poll_questions_"+question_id).hide(); $("#edit_poll_questions_"+question_id).hide();
} }
function pollQuestionEdit(question_id){ function pollQuestionEdit(question_id){
$("#show_poll_questions_"+question_id).hide(); $("#show_poll_questions_"+question_id).hide();
$("#edit_poll_questions_"+question_id).show(); $("#edit_poll_questions_"+question_id).show();
$("#poll_questions_title_"+question_id).focus(); $("#poll_questions_title_"+question_id).focus();
} }
//单选题 //单选题
function add_single_answer(doc) function add_single_answer(doc)
{ {
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='新建选项'/>" + doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='新建选项'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+ "<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>"); "</li><div class='cl'></div>");
} }
function remove_single_answer(doc) function remove_single_answer(doc)
{ {
if(doc.parent().siblings("li").length == 0) if(doc.parent().siblings("li").length == 0)
{ {
alert("选择题至少有一个选项"); alert("选择题至少有一个选项");
} }
else else
{ {
doc.parent().remove(); doc.parent().remove();
} }
} }
function poll_submit() function poll_submit()
{ {
var title = $.trim($("#polls_name_h").html()); var title = $.trim($("#polls_name_h").html());
if(title.length == 0) if(title.length == 0)
{ {
alert("问卷标题不能为空"); alert("问卷标题不能为空");
} }
else{ else{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>');
showModal('ajax-modal', '310px'); showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px'); $('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }
} }
</script> </script>
<div class=" polls_content polls_edit" id="polls"> <div class=" polls_content polls_edit" id="polls">
<!-- 头部 --> <!-- 头部 -->
<div id="polls_head_show" style="display: none;"> <div id="polls_head_show" style="display: none;">
<%= render :partial => 'show_head', :locals => {:poll => @poll}%> <%= render :partial => 'show_head', :locals => {:poll => @poll}%>
</div> </div>
<div id="polls_head_edit"> <div id="polls_head_edit">
<%= render :partial => 'edit_head', :locals => {:poll => @poll}%> <%= render :partial => 'edit_head', :locals => {:poll => @poll}%>
</div> </div>
<!-- 问题 --> <!-- 问题 -->
<div id="poll_content"> <div id="poll_content">
<%= render :partial => 'poll_content', :locals => {:poll => @poll}%> <%= render :partial => 'poll_content', :locals => {:poll => @poll}%>
</div> </div>
<div class="tabs"> <div class="tabs">
<ul class="tabs_list"> <ul class="tabs_list">
<li class="tab_item02 " > <li class="tab_item02 " >
<a title="<%= l(:label_MC) %>" class="tab_icon icon_radio" onclick="add_MC();"> <a title="<%= l(:label_MC) %>" class="tab_icon icon_radio" onclick="add_MC();">
<%= l(:label_MC) %> <%= l(:label_MC) %>
</a> </a>
</li> </li>
<li class="tab_item02 " > <li class="tab_item02 " >
<a title="<%= l(:label_MCQ) %>" class=" tab_icon icon_checkbox" onclick="add_MCQ();"> <a title="<%= l(:label_MCQ) %>" class=" tab_icon icon_checkbox" onclick="add_MCQ();">
<%= l(:label_MCQ) %> <%= l(:label_MCQ) %>
</a> </a>
</li> </li>
<li class="tab_item02 " > <li class="tab_item02 " >
<a title="<%= l(:label_single) %>" class="tab_icon icon_text" onclick="add_single();"> <a title="<%= l(:label_single) %>" class="tab_icon icon_text" onclick="add_single();">
<%= l(:label_single) %> <%= l(:label_single) %>
</a> </a>
</li> </li>
<li class="tab_item02 " > <li class="tab_item02 " >
<a title="<%= l(:label_mulit)%>" class="tab_icon icon_textarea" onclick="add_mulit();"> <a title="<%= l(:label_mulit)%>" class="tab_icon icon_textarea" onclick="add_mulit();">
<%= l(:label_mulit)%> <%= l(:label_mulit)%>
</a> </a>
</li> </li>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>
</div><!--选项 end--> </div><!--选项 end-->
<!-- 新增问题 --> <!-- 新增问题 -->
<div id="new_poll_question"> <div id="new_poll_question">
</div> </div>
<div class="ur_buttons"> <div class="ur_buttons">
<a class="ur_button_submit" onclick="poll_submit();"> <a class="ur_button_submit" onclick="poll_submit();">
<%= l(:label_memo_create)%> <%= l(:label_memo_create)%>
</a> </a>
<div class="polls_cha"> <div class="polls_cha">
<input type="checkbox" name="" value="" > <input type="checkbox" name="" value="" >
<label for="">允许学生查看调查结果</label> <label for="">允许学生查看调查结果</label>
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<!-- 新增问题 --> <!-- 新增问题 -->
<div id="import_poll" style="display: none"> <div id="import_poll" style="display: none">
<%= form_tag({:controller => 'poll', :action => 'import_poll', :to_id => @poll.id},:remote=>'true', :method => :get,:id=>"import_form") do %> <%= form_tag({:controller => 'poll', :action => 'import_poll', :to_id => @poll.id},:remote=>'true', :method => :get,:id=>"import_form") do %>
<%= select( :poll, :id, Poll.where("polls_group_id = #{@poll.polls_group_id} and polls_type='course' and id != #{@poll.id}").map{|c| [c.polls_name, c.id]}.unshift(["选择要导入的问卷",0]), <%= select( :poll, :id, Poll.where("polls_group_id = #{@poll.polls_group_id} and polls_type='course' and id != #{@poll.id}").map{|c| [c.polls_name, c.id]}.unshift(["选择要导入的问卷",0]),
{ :include_blank => false,:selected=> 0,:class=>"w90" { :include_blank => false,:selected=> 0,:class=>"w90"
}, },
{:onchange=>"remote_import();",:id=>"import_id",:name=>"import_id"} {:onchange=>"remote_import();",:id=>"import_id",:name=>"import_id"}
) )
%> %>
<% end%> <% end%>
</select> </select>
</div> </div>
</div><!--编辑end--> </div><!--编辑end-->

View File

@ -5,5 +5,5 @@ $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='hidden_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='hidden_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("alert_box"); $('#ajax-modal').parent().addClass("alert_box");

View File

@ -1,91 +1,91 @@
<%= stylesheet_link_tag 'polls', :media => 'all' %> <%= stylesheet_link_tag 'polls', :media => 'all' %>
<script type="text/javascript"> <script type="text/javascript">
function republish_poll(poll_id) function republish_poll(poll_id)
{ {
$('#ajax-modal').html("<div id='popbox02'>" + $('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" + "<div class='upload_con'>" +
"<div class='upload_box'>" + "<div class='upload_box'>" +
"<p class='polls_box_p'>取消发布后问卷统计结果将会被清空<br />是否确定取消发布该问卷?</p>" + "<p class='polls_box_p'>取消发布后问卷统计结果将会被清空<br />是否确定取消发布该问卷?</p>" +
"<div class='polls_btn_box'>" + "<div class='polls_btn_box'>" +
"<a href='/poll/"+ poll_id +"/republish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" + "<a href='/poll/"+ poll_id +"/republish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" + "<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" + "</div>" +
"<div class='cl'></div>" + "<div class='cl'></div>" +
"</div>" + "</div>" +
"</div>" + "</div>" +
"</div>"); "</div>");
showModal('ajax-modal', '310px'); showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px'); $('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }
function clickCanel(){hideModal("#popbox02");} function clickCanel(){hideModal("#popbox02");}
function poll_submit(poll_id,poll_name) function poll_submit(poll_id,poll_name)
{ {
if(poll_name == 0) if(poll_name == 0)
{ {
alert("问卷标题不能为空"); alert("问卷标题不能为空");
} }
else else
{ {
$('#ajax-modal').html("<div id='popbox02'>" + $('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" + "<div class='upload_con'>" +
"<div class='upload_box'>" + "<div class='upload_box'>" +
"<p class='polls_box_p'>问卷发布后将不能对问卷进行修改,<br />是否确定发布该问卷?</p>" + "<p class='polls_box_p'>问卷发布后将不能对问卷进行修改,<br />是否确定发布该问卷?</p>" +
"<div class='polls_btn_box'>" + "<div class='polls_btn_box'>" +
"<a href='/poll/"+ poll_id +"/publish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" + "<a href='/poll/"+ poll_id +"/publish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" + "<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" + "</div>" +
"<div class='cl'></div>" + "<div class='cl'></div>" +
"</div>" + "</div>" +
"</div>" + "</div>" +
"</div>"); "</div>");
showModal('ajax-modal', '310px'); showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px'); $('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }
} }
function close_poll(poll_id) function close_poll(poll_id)
{ {
$('#ajax-modal').html("<div id='popbox02'>" + $('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" + "<div class='upload_con'>" +
"<div class='upload_box'>" + "<div class='upload_box'>" +
"<p class='polls_box_p'>问卷关闭后学生将不能继续提交问卷,<br />是否确定关闭该问卷?</p>" + "<p class='polls_box_p'>问卷关闭后学生将不能继续提交问卷,<br />是否确定关闭该问卷?</p>" +
"<div class='polls_btn_box'>" + "<div class='polls_btn_box'>" +
"<a href='/poll/"+ poll_id +"/close_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" + "<a href='/poll/"+ poll_id +"/close_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" + "<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" + "</div>" +
"<div class='cl'></div>" + "<div class='cl'></div>" +
"</div>" + "</div>" +
"</div>" + "</div>" +
"</div>"); "</div>");
showModal('ajax-modal', '310px'); showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px'); $('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }
function closeModal() function closeModal()
{ {
hideModal($("#popbox_upload")); hideModal($("#popbox_upload"));
} }
</script> </script>
<div class="polls_content02" id="polls"> <div class="polls_content02" id="polls">
<%= render :partial => 'poll_list'%> <%= render :partial => 'poll_list'%>
</div><!--问卷内容end--> </div><!--问卷内容end-->

View File

@ -1,13 +1,13 @@
<% if @polls.empty? %> <% if @polls.empty? %>
alert('您目前还没有自己新建的问卷'); alert('您目前还没有自己新建的问卷');
<% else %> <% else %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#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').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().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
<% end %> <% end %>

View File

@ -6,5 +6,5 @@ $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("poll_alert_form"); $('#ajax-modal').parent().addClass("poll_alert_form");

View File

@ -6,5 +6,5 @@ $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("poll_alert_form"); $('#ajax-modal').parent().addClass("poll_alert_form");

View File

@ -1,10 +1,10 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/join_project') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/join_project') %>');
showModal('ajax-modal', '540px'); showModal('ajax-modal', '540px');
$('#ajax-modal').css('height','260px'); $('#ajax-modal').css('height','260px');
//$('#ajax-modal').siblings().remove(); //$('#ajax-modal').siblings().remove();
$('#ajax-modal').siblings().hide(); $('#ajax-modal').siblings().hide();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='#' onclick='hidden_join_course_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='#' onclick='hidden_join_course_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise"); $('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("alert_box"); $('#ajax-modal').parent().addClass("alert_box");

View File

@ -1,24 +1,24 @@
<% if @has_commit %> <% if @has_commit %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/has_commit_work') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/has_commit_work') %>');
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').parent().addClass("anonymos");
<% elsif @submit_result%> <% elsif @submit_result%>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>');
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='/student_work/"+ <%=@student_work.id%> +"/retry_work' class='upload_btn' data-remote='true'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='/student_work/"+ <%=@student_work.id%> +"/retry_work' class='upload_btn' data-remote='true'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').parent().addClass("anonymos");
<% else %> <% else %>
window.location.href = '<%= new_student_work_url(:homework => @homework.id)%>'; window.location.href = '<%= new_student_work_url(:homework => @homework.id)%>';
<% end %> <% end %>
function clickCanel() { function clickCanel() {
hideModal('#popbox02'); hideModal('#popbox02');
window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>';
} }

View File

@ -1,118 +1,118 @@
<div class="homepageRightBanner mb10"> <div class="homepageRightBanner mb10">
<div class="NewsBannerName">编辑作品</div> <div class="NewsBannerName">编辑作品</div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="HomeWork" id="users_setting"> <div class="HomeWork" id="users_setting">
<div class="HomeWorkBox"> <div class="HomeWorkBox">
<div class=""> <div class="">
<div class="homepagePostTitle fl m_w530 hidden"> <div class="homepagePostTitle fl m_w530 hidden">
<%= @homework.name%>(作业名称) <%= @homework.name%>(作业名称)
</div> </div>
<span class="fr c_grey"> <span class="fr c_grey">
截止时间:<%= @homework.end_time%> 截止时间:<%= @homework.end_time%>
</span> </span>
<div class="cl"></div> <div class="cl"></div>
<a href="javascript:void(0);" class="c_blue"> <a href="javascript:void(0);" class="c_blue">
<%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%> <%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%>
</a> </a>
<div class="cl"></div> <div class="cl"></div>
<div class="HomeWorkP"> <div class="HomeWorkP">
<%= @homework.description.html_safe %> <%= @homework.description.html_safe %>
</div> </div>
</div> </div>
</div><!----HomeWorkBox end--> </div><!----HomeWorkBox end-->
<div class="cl"></div> <div class="cl"></div>
<div class="HomeWorkCon mt15"> <div class="HomeWorkCon mt15">
<%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%> <%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%>
<div class=" c_red mb10"> <div class=" c_red mb10">
提示:作品名称和描述中不要出现真实的姓名信息 提示:作品名称和描述中不要出现真实的姓名信息
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% if @homework.homework_type == 3 %> <% if @homework.homework_type == 3 %>
<span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span> <span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span>
<span id="max_num_member" style="display: none"><%=@homework.homework_detail_group.max_num %></span> <span id="max_num_member" style="display: none"><%=@homework.homework_detail_group.max_num %></span>
<% str = User.current.id.to_s%> <% str = User.current.id.to_s%>
<% @work.student_work_projects.where("is_leader = ?", 0).each do |pro| %> <% @work.student_work_projects.where("is_leader = ?", 0).each do |pro| %>
<% str += ','+pro.user_id.to_s %> <% str += ','+pro.user_id.to_s %>
<% end %> <% end %>
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %> <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %>
<% end %> <% end %>
<div> <div>
<input type="text" name="student_work[name]" id="student_work_name" placeholder="请简洁的概括作品的功能或特性" class="InputBox W700" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>"> <input type="text" name="student_work[name]" id="student_work_name" placeholder="请简洁的概括作品的功能或特性" class="InputBox W700" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">
<div class="cl"></div> <div class="cl"></div>
<p id="student_work_name_span" class="c_red mb10"></p> <p id="student_work_name_span" class="c_red mb10"></p>
</div> </div>
<div class="mt10"> <div class="mt10">
<textarea name="student_work[description]" id="student_work_description" placeholder="请介绍你的作品" class="InputBox W700 H150" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%= @work.description%></textarea> <textarea name="student_work[description]" id="student_work_description" placeholder="请介绍你的作品" class="InputBox W700 H150" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%= @work.description%></textarea>
<script> <script>
var text = document.getElementById("student_work_description"); var text = document.getElementById("student_work_description");
autoTextarea(text);// 调用 autoTextarea(text);// 调用
</script> </script>
<div class="cl"></div> <div class="cl"></div>
<p id="student_work_description_textarea" class="c_red mb10"></p> <p id="student_work_description_textarea" class="c_red mb10"></p>
</div> </div>
<div id="homework_attachments"> <div id="homework_attachments">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false,:has_group=>false} %> <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false,:has_group=>false} %>
</div> </div>
<% if @homework.homework_type == 3 %> <% if @homework.homework_type == 3 %>
<div class="mt5 fl"> <div class="mt5 fl">
<a href="javascript:void(0);" class="memberBtn fl mt3 mr15" title="请添加小组的其他成员" onclick="show_group_member();">合作成员</a> <a href="javascript:void(0);" class="memberBtn fl mt3 mr15" title="请添加小组的其他成员" onclick="show_group_member();">合作成员</a>
</div> </div>
<% end %> <% end %>
<div class="mt5"> <div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();edit_student_work(<%= @work.id%>);">确定</a> <a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();edit_student_work(<%= @work.id%>);">确定</a>
<span class="fr mr10 mt3">或</span> <span class="fr mr10 mt3">或</span>
<%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%> <%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% end%> <% end%>
</div><!----HomeWorkCon end--> </div><!----HomeWorkCon end-->
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
<% if @homework.homework_detail_group %> <% if @homework.homework_detail_group %>
$(function(){ $(function(){
<%members = @work.student_work_projects.where("is_leader =?",0) %> <%members = @work.student_work_projects.where("is_leader =?",0) %>
var str = $('#group_members_show').html(); var str = $('#group_members_show').html();
<% members.each do |member| %> <% members.each do |member| %>
str += '、<%= (User.find member.user_id).show_name %>'; str += '、<%= (User.find member.user_id).show_name %>';
<% end %> <% end %>
$('#group_members_show').html(str); $('#group_members_show').html(str);
$('span.group_detail_info').text('分组人数:<%=@homework.homework_detail_group.min_num %>-<%=@homework.homework_detail_group.max_num %> 人'); $('span.group_detail_info').text('分组人数:<%=@homework.homework_detail_group.min_num %>-<%=@homework.homework_detail_group.max_num %> 人');
}); });
<% end %> <% end %>
// 添加组成员 // 添加组成员
function show_group_member() { function show_group_member() {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/choose_group_member',:locals => {:homework=>@homework,:edit_mode => true}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/choose_group_member',:locals => {:homework=>@homework,:edit_mode => true}) %>');
showModal('ajax-modal', '528px'); showModal('ajax-modal', '528px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("addMemberCP"); $('#ajax-modal').parent().addClass("addMemberCP");
} }
function popupRegex(){ function popupRegex(){
if(regexStudentWorkName()&&regexStudentWorkDescription()) if(regexStudentWorkName()&&regexStudentWorkDescription())
{ {
if($("#group_member_ids").length > 0) { if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) { if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>"); $('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').parent().addClass("anonymos");
} }
} else { } else {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>"); $('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').parent().addClass("anonymos");
} }
} }
} }
</script> </script>

View File

@ -30,7 +30,7 @@
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9");
} }
$(function(){ $(function(){

View File

@ -1,177 +1,177 @@
<!-- 此界面只用来新建匿评作业作品 --> <!-- 此界面只用来新建匿评作业作品 -->
<script type="text/javascript"> <script type="text/javascript">
<%if @homework.homework_detail_manual.comment_status != 1%> <%if @homework.homework_detail_manual.comment_status != 1%>
$(function(){ $(function(){
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_student_work_alert') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_student_work_alert') %>');
showModal('ajax-modal', '360px'); showModal('ajax-modal', '360px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","65%").css("left","60%"); $('#ajax-modal').parent().css("top","65%").css("left","60%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos_work"); $('#ajax-modal').parent().addClass("anonymos_work");
}); });
<% end%> <% end%>
<% if @homework.homework_detail_group %> <% if @homework.homework_detail_group %>
$(function(){ $(function(){
$('span.group_detail_info').text('分组人数:<%=@homework.homework_detail_group.min_num %>-<%=@homework.homework_detail_group.max_num %> 人'); $('span.group_detail_info').text('分组人数:<%=@homework.homework_detail_group.min_num %>-<%=@homework.homework_detail_group.max_num %> 人');
}); });
<% end %> <% end %>
//快速创建项目的弹框 //快速创建项目的弹框
function new_project(){ function new_project(){
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_project') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_project') %>');
showModal('ajax-modal', '800px'); showModal('ajax-modal', '800px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","30%").css("left","20%").css("position","fixed"); $('#ajax-modal').parent().css("top","30%").css("left","20%").css("position","fixed").css("border","3px solid #269ac9");
} }
// 点击 checkbox选中引用的资源的时候保存该资源的id到session里去 // 点击 checkbox选中引用的资源的时候保存该资源的id到session里去
function store_seleted_resource(dom){ function store_seleted_resource(dom){
if(dom.attr('checked') == 'checked' ){ if(dom.attr('checked') == 'checked' ){
$.get( $.get(
'<%= store_selected_resource_user_path(User.current) %>'+'?save=y&res_id='+dom.val() '<%= store_selected_resource_user_path(User.current) %>'+'?save=y&res_id='+dom.val()
) )
}else { }else {
$.get( $.get(
'<%= store_selected_resource_user_path(User.current) %>'+'?save=n&res_id='+dom.val() '<%= store_selected_resource_user_path(User.current) %>'+'?save=n&res_id='+dom.val()
) )
} }
} }
// 添加组成员 // 添加组成员
function show_group_member() { function show_group_member() {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/choose_group_member',:locals => {:homework=>@homework}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/choose_group_member',:locals => {:homework=>@homework}) %>');
showModal('ajax-modal', '528px'); showModal('ajax-modal', '528px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("addMemberCP"); $('#ajax-modal').parent().addClass("addMemberCP");
} }
// 关联项目 // 关联项目
function show_project() { function show_project() {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/relate_project',:locals => {:homework=>@homework}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/relate_project',:locals => {:homework=>@homework}) %>');
showModal('ajax-modal', '320px'); showModal('ajax-modal', '320px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("groupPopUp"); $('#ajax-modal').parent().addClass("groupPopUp");
} }
// 作品校验 // 作品校验
function popupRegex(){ function popupRegex(){
if(regexStudentWorkName()&&regexStudentWorkDescription()) if(regexStudentWorkName()&&regexStudentWorkDescription())
{ {
if($("#group_member_ids").length > 0) { if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) { if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>"); $('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').parent().addClass("anonymos");
} }
} else { } else {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>"); $('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').parent().addClass("anonymos");
} }
} }
} }
</script> </script>
<div class="homepageRightBanner mb10"> <div class="homepageRightBanner mb10">
<div class="NewsBannerName">提交作品</div> <div class="NewsBannerName">提交作品</div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="HomeWork" id="users_setting"> <div class="HomeWork" id="users_setting">
<div class="HomeWorkBox"> <div class="HomeWorkBox">
<div class=""> <div class="">
<div class="homepagePostTitle fl m_w530 hidden"> <div class="homepagePostTitle fl m_w530 hidden">
<%= @homework.name%>(作业名称) <%= @homework.name%>(作业名称)
</div> </div>
<span class="fr c_grey"> <span class="fr c_grey">
截止时间:<%= @homework.end_time%> 截止时间:<%= @homework.end_time%>
</span> </span>
<div class="cl"></div> <div class="cl"></div>
<a href="javascript:void(0);" class="c_blue"> <a href="javascript:void(0);" class="c_blue">
<%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%> <%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%>
</a> </a>
<div class="cl"></div> <div class="cl"></div>
<div class="HomeWorkP"> <div class="HomeWorkP">
<%= @homework.description.html_safe %> <%= @homework.description.html_safe %>
</div> </div>
<div> <div>
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %> <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
</div> </div>
</div><!----HomeWorkBox end--> </div><!----HomeWorkBox end-->
<div class="cl"></div> <div class="cl"></div>
<div class="HomeWorkCon mt15"> <div class="HomeWorkCon mt15">
<%= form_for(@student_work, <%= form_for(@student_work,
:html => { :multipart => true }, :html => { :multipart => true },
:url => {:controller => 'student_work', :url => {:controller => 'student_work',
:action => 'create', :action => 'create',
:homework => @homework.id :homework => @homework.id
},:remote=>true ) do |f| %> },:remote=>true ) do |f| %>
<div class=" c_red mb10"> <div class=" c_red mb10">
提示:作品名称和描述中不要出现真实的姓名信息 提示:作品名称和描述中不要出现真实的姓名信息
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% if @homework.homework_type == 3 %> <% if @homework.homework_type == 3 %>
<span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span> <span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span>
<span id="max_num_member" style="display: none"><%=@homework.homework_detail_group.max_num %></span> <span id="max_num_member" style="display: none"><%=@homework.homework_detail_group.max_num %></span>
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %> <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %>
<% end %> <% end %>
<div> <div>
<%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %> <%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %>
<div class="cl"></div> <div class="cl"></div>
<p id="student_work_name_span" class="c_red mb10"></p> <p id="student_work_name_span" class="c_red mb10"></p>
</div> </div>
<div class="mt10"> <div class="mt10">
<%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请介绍你的作品", :onkeyup => "regexStudentWorkDescription();"%> <%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请介绍你的作品", :onkeyup => "regexStudentWorkDescription();"%>
<script> <script>
var text = document.getElementById("student_work_description"); var text = document.getElementById("student_work_description");
autoTextarea(text);// 调用 autoTextarea(text);// 调用
</script> </script>
<div class="cl"></div> <div class="cl"></div>
<p id="student_work_description_textarea" class="c_red mb10"></p> <p id="student_work_description_textarea" class="c_red mb10"></p>
</div> </div>
<div id="homework_attachments"> <div id="homework_attachments">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %> <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %>
</div> </div>
<div id="group_member"> <div id="group_member">
</div> </div>
<div id="relate_project"> <div id="relate_project">
</div> </div>
<% if @homework.homework_type == 3 %> <% if @homework.homework_type == 3 %>
<div class="mt5 fl"> <div class="mt5 fl">
<a href="javascript:void(0);" class="memberBtn fl mt3 mr15" title="请添加小组的其他成员" onclick="show_group_member();">合作成员</a> <a href="javascript:void(0);" class="memberBtn fl mt3 mr15" title="请添加小组的其他成员" onclick="show_group_member();">合作成员</a>
</div> </div>
<% end %> <% end %>
<!--<div class="mt5 fl"> <!--<div class="mt5 fl">
<a href="javascript:void(0);" class="RalationIcon fl mt3" title="请选择作业的关联项目" onclick="show_project();">关联项目</a> <a href="javascript:void(0);" class="RalationIcon fl mt3" title="请选择作业的关联项目" onclick="show_project();">关联项目</a>
</div>--> </div>-->
<!--<div class="mt10 none" id="about_project"> <!--<div class="mt10 none" id="about_project">
<%#= select_tag :project_id, options_for_select(user_projects_option, @student_work.project_id), {:class => "InputBox W680 fl"} %> <%#= select_tag :project_id, options_for_select(user_projects_option, @student_work.project_id), {:class => "InputBox W680 fl"} %>
<%#=link_to "", new_project_path, :class => "ml5 mt5 SetUpIcon fl", :title => "快速创建"%> <%#=link_to "", new_project_path, :class => "ml5 mt5 SetUpIcon fl", :title => "快速创建"%>
<a class=" ml5 mt5 SetUpIcon fl" href="javascript:void(0)" title="快速创建" onclick="new_project();"></a> <a class=" ml5 mt5 SetUpIcon fl" href="javascript:void(0)" title="快速创建" onclick="new_project();"></a>
<div class="cl"></div> <div class="cl"></div>
</div>--> </div>-->
<div class="mt5"> <div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();new_student_work();">提交</a> <a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();new_student_work();">提交</a>
<span class="fr mr10 mt3">或</span> <span class="fr mr10 mt3">或</span>
<%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%> <%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% end%> <% end%>
</div><!----HomeWorkCon end--> </div><!----HomeWorkCon end-->
</div> </div>

View File

@ -1,16 +1,16 @@
<% if @submit_result%> <% if @submit_result%>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_edit_information') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_edit_information') %>');
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').parent().addClass("anonymos");
<% else %> <% else %>
window.location.href = '<%= edit_student_work_url(@work)%>'; window.location.href = '<%= edit_student_work_url(@work)%>';
<% end %> <% end %>
function clickCanel() { function clickCanel() {
hideModal('#popbox02'); hideModal('#popbox02');
window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>';
} }

View File

@ -131,10 +131,10 @@
</div> </div>
</script> </script>
<div class="BluePopupBox" id="BluePopupBox" style="display:none"> <div class="BluePopupBox" id="BluePopupBox" style="display:none;">
<%= render :partial => 'users/user_programing_attr', :locals => {:edit_mode => edit_mode, :homework=>homework} %> <%= render :partial => 'users/user_programing_attr', :locals => {:edit_mode => edit_mode, :homework=>homework} %>
</div><!----BluePopupBox end--> </div><!----BluePopupBox end-->
<div class="BluePopupBox" style="display:none" id="GroupPopupBox"> <div class="BluePopupBox" style="display:none;" id="GroupPopupBox">
<%= render :partial => 'users/user_group_attr', :locals => {:edit_mode => edit_mode, :homework=>homework}%> <%= render :partial => 'users/user_group_attr', :locals => {:edit_mode => edit_mode, :homework=>homework}%>
</div> </div>

View File

@ -1,9 +1,9 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_new_score') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_new_score') %>');
showModal('ajax-modal', '400px'); showModal('ajax-modal', '400px');
$('#ajax-modal').css('height','auto'); $('#ajax-modal').css('height','auto');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='javascript:void(0)' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:void(0)' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
//$('#ajax-modal').parent().removeClass("alert_praise"); //$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","30%").css("left","35%"); $('#ajax-modal').parent().css("top","30%").css("left","35%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("alert_box"); $('#ajax-modal').parent().addClass("alert_box");

View File

@ -1,7 +1,7 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_homeworks') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_homeworks') %>');
showModal('ajax-modal', '580px'); showModal('ajax-modal', '580px');
$('#ajax-modal').css('height','300px').css("width","580px"); $('#ajax-modal').css('height','300px').css("width","580px");
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='javascript:void(0)' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='javascript:void(0)' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed"); $('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed").css("border","3px solid #269ac9");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,365 +1,367 @@
$(function(){ $(function(){
//提交作业 //提交作业
var bt=baidu.template; var bt=baidu.template;
bt.LEFT_DELIMITER='<!'; bt.LEFT_DELIMITER='<!';
bt.RIGHT_DELIMITER='!>'; bt.RIGHT_DELIMITER='!>';
var tested = false; var tested = false;
var valid_form = function() { var valid_form = function() {
var src = $('#program-src').val(); var src = $('#program-src').val();
var title = $('#program-title').val(); var title = $('#program-title').val();
if (!src) { if (!src) {
alert('请输入正确的代码'); alert('请输入正确的代码');
return false; return false;
} }
if (!title) { if (!title) {
alert('请输入标题'); alert('请输入标题');
return false; return false;
} }
return true; return true;
}; };
var test_program = function(cb){ var test_program = function(cb){
var homework_id = $('#test-program-btn').attr('data-homework-id'); var homework_id = $('#test-program-btn').attr('data-homework-id');
var student_work_id = $('#test-program-btn').attr('data-student-work-id'); var student_work_id = $('#test-program-btn').attr('data-student-work-id');
var src = $('#program-src').val(); var src = $('#program-src').val();
var title = $('#program-title').val(); var title = $('#program-title').val();
var is_test = $('input[name=is_test]').val(); var is_test = $('input[name=is_test]').val();
if(!valid_form()){ if(!valid_form()){
return; return;
} }
$.post( $.post(
'/student_work/program_test', '/student_work/program_test',
{homework: homework_id, student_work_id: student_work_id, src: src, title: title, is_test: is_test}, {homework: homework_id, student_work_id: student_work_id, src: src, title: title, is_test: is_test},
function(data,status){ function(data,status){
tested = true; tested = true;
console.log(data); console.log(data);
if(data.index <=0){ if(data.index <=0){
data.index = $('.ProResultTop').length+1; data.index = $('.ProResultTop').length+1;
} }
if (typeof cb == 'function') {cb(data); return;} if (typeof cb == 'function') {cb(data); return;}
var html=bt('t:result-list',data); var html=bt('t:result-list',data);
$('.ProResult').prepend(html); $('.ProResult').prepend(html);
if (data.status==0 && is_test != 'true') { if (data.status==0 && is_test != 'true') {
var r=confirm("答题正确,是否立刻提交?"); var r=confirm("答题正确,是否立刻提交?");
if (r) { if (r) {
$(".HomeWorkCon form").submit(); $(".HomeWorkCon form").submit();
} }
} }
} }
); );
}; };
$('#test-program-btn').on('click', test_program); $('#test-program-btn').on('click', test_program);
$('#commit-program-work-btn').on('click', function(){ $('#commit-program-work-btn').on('click', function(){
if(!valid_form()){ if(!valid_form()){
return; return;
} }
if($('.ProResult .ProResultTop').length<=0){ if($('.ProResult .ProResultTop').length<=0){
var r=confirm("测试后才能提交,是否立刻测试?"); var r=confirm("测试后才能提交,是否立刻测试?");
if (r) { if (r) {
test_program(); test_program();
} }
return; return;
} }
if (!tested) { if (!tested) {
test_program(function(data){ test_program(function(data){
if (data.status!=0) { if (data.status!=0) {
var r=confirm("测试不通过,是否强制提交?"); var r=confirm("测试不通过,是否强制提交?");
if (!r) { if (!r) {
return; return;
} }
}; };
$(".HomeWorkCon form").submit(); $(".HomeWorkCon form").submit();
}); });
return; return;
} }
$(".HomeWorkCon form").submit(); $(".HomeWorkCon form").submit();
}); });
$('form.edit_student_work').on('keydown', '#program-src', function(){ $('form.edit_student_work').on('keydown', '#program-src', function(){
tested = false; tested = false;
}); });
//发布作业 //发布作业
$('#program-src').focus(function(){ $('#program-src').focus(function(){
$(this).css('height', '100px'); $(this).css('height', '100px');
}); });
var datepickerOptions={dateFormat:'yy-mm-dd',firstDay:0,showWeek:true,showOtherMonths:true,selectOtherMonths:true}; var datepickerOptions={dateFormat:'yy-mm-dd',firstDay:0,showWeek:true,showOtherMonths:true,selectOtherMonths:true};
$('input.date-input').datepicker(datepickerOptions); $('input.date-input').datepicker(datepickerOptions);
$('a.pic_date').on('click', function(){ $('a.pic_date').on('click', function(){
$(this).parent().prev().first().focus(); $(this).parent().prev().first().focus();
}) })
$("#BluePopupBox").dialog({ $("#BluePopupBox").dialog({
modal: true, modal: true,
autoOpen: false, autoOpen: false,
dialogClass: 'BluePopupBox', dialogClass: 'BluePopupBox',
minWidth: 753 minWidth: 753
}); });
$('#BluePopupBox').parent().css("border","3px solid #269ac9");
$('a.ProBtn').live('click', function(){
$("#BluePopupBox").dialog("open"); $('a.ProBtn').live('click', function(){
$(".ui-dialog-titlebar").hide(); $("#BluePopupBox").dialog("open");
$("a.CloseBtn").on('click', function(){ $(".ui-dialog-titlebar").hide();
$("#BluePopupBox" ).dialog("close"); $("a.CloseBtn").on('click', function(){
}); $("#BluePopupBox" ).dialog("close");
$('#textarea_input_test').focus(); });
}); $('#textarea_input_test').focus();
});
var saveProgramAnswers = function() {
var test_numbers = 0; var saveProgramAnswers = function() {
var valid = true; var test_numbers = 0;
var input = null; var valid = true;
var output = null; var input = null;
var input_groups = []; var output = null;
$.each($('#BluePopupBox textarea.InputBox'), function(i, val){ var input_groups = [];
if ($(val).val().length<=0) { $.each($('#BluePopupBox textarea.InputBox'), function(i, val){
$(val)[0].focus(); if ($(val).val().length<=0) {
valid =false; $(val)[0].focus();
return false; valid =false;
} return false;
if (test_numbers %2==0) { }
input = $(val).val(); if (test_numbers %2==0) {
} else { input = $(val).val();
output = $(val).val(); } else {
input_groups.push({input: input, output: output}); output = $(val).val();
} input_groups.push({input: input, output: output});
test_numbers += 1; }
}); test_numbers += 1;
});
var language = '';
if($('select.language_type').val() == 1){ var language = '';
language = 'C'; if($('select.language_type').val() == 1){
}else if($('select.language_type').val() == 2){ language = 'C';
language = 'C++'; }else if($('select.language_type').val() == 2){
}else if($('select.language_type').val() == 3){ language = 'C++';
language = 'Python'; }else if($('select.language_type').val() == 3){
}else if($('select.language_type').val() == 4){ language = 'Python';
language = 'Java'; }else if($('select.language_type').val() == 4){
} language = 'Java';
}
if (valid) {
$("input[name=homework_type]").val(2); if (valid) {
$('span.program_detail_info').text('('+language+''+test_numbers/2+'组测试)'); $("input[name=homework_type]").val(2);
//保存js值 $('span.program_detail_info').text('('+language+''+test_numbers/2+'组测试)');
var data = { //保存js值
language_type: $('select.language_type').val(), var data = {
input_groups: input_groups language_type: $('select.language_type').val(),
}; input_groups: input_groups
//构建到form中 };
$('.program-input').remove(); //构建到form中
var html=bt('t:program-input-list',data); $('.program-input').remove();
$("input[name=homework_type]").after(html); var html=bt('t:program-input-list',data);
} $("input[name=homework_type]").after(html);
return valid; }
}; return valid;
};
$("#BluePopupBox a.BlueCirBtn").live('click', function(){
if(saveProgramAnswers()){ $("#BluePopupBox a.BlueCirBtn").live('click', function(){
if($( "#BluePopupBox" ).dialog( "isOpen" )){ if(saveProgramAnswers()){
$("#BluePopupBox").dialog( "close" ); if($( "#BluePopupBox" ).dialog( "isOpen" )){
} $("#BluePopupBox").dialog( "close" );
} }
}); }
});
$("#BluePopupBox").on('click', 'a.icon_add', function(){
var html = bt('t:test-answer-list', null); $("#BluePopupBox").on('click', 'a.icon_add', function(){
$(this).parent('.mt10').after(html); var html = bt('t:test-answer-list', null);
var inputs = document.getElementsByName("program[input][]"); $(this).parent('.mt10').after(html);
var outputs = document.getElementsByName("program[output][]"); var inputs = document.getElementsByName("program[input][]");
if (inputs.length == outputs.length) { var outputs = document.getElementsByName("program[output][]");
for (var i=0; i<inputs.length; i++) { if (inputs.length == outputs.length) {
autoTextarea2(inputs[i], outputs[i]); for (var i=0; i<inputs.length; i++) {
autoTextarea2(outputs[i], inputs[i]); autoTextarea2(inputs[i], outputs[i]);
} autoTextarea2(outputs[i], inputs[i]);
} }
}
});
$("#BluePopupBox").on('click', 'a.icon_remove', function(){ });
$(this).parent('.mt10').remove(); $("#BluePopupBox").on('click', 'a.icon_remove', function(){
}); $(this).parent('.mt10').remove();
});
//分组作业
$("#GroupPopupBox").dialog({ //分组作业
modal: true, $("#GroupPopupBox").dialog({
autoOpen: false, modal: true,
dialogClass: 'BluePopupBox', autoOpen: false,
minWidth: 290 dialogClass: 'BluePopupBox',
}); minWidth: 290
});
$('a.groupBtn').live('click', function(){ $('#GroupPopupBox').parent().css("border","3px solid #269ac9");
$("#GroupPopupBox").dialog("open");
$(".ui-dialog-titlebar").hide(); $('a.groupBtn').live('click', function(){
$("a.popClose").on('click', function(){ $("#GroupPopupBox").dialog("open");
$("#GroupPopupBox" ).dialog("close"); $(".ui-dialog-titlebar").hide();
}); $("a.popClose").on('click', function(){
$("#cancel_group").on('click', function(){ $("#GroupPopupBox" ).dialog("close");
$("#GroupPopupBox" ).dialog("close"); });
}); $("#cancel_group").on('click', function(){
$('#min_num').focus(); $("#GroupPopupBox" ).dialog("close");
}); });
$('#min_num').focus();
var saveGroupAttr = function() { });
var valid = true;
var base_on_project = 0; var saveGroupAttr = function() {
var min = $.trim($("#min_num").val()); var valid = true;
var max = $.trim($("#max_num").val()); var base_on_project = 0;
if(min.length <= 0) { var min = $.trim($("#min_num").val());
$("#min_num").focus(); var max = $.trim($("#max_num").val());
valid = false; if(min.length <= 0) {
return false; $("#min_num").focus();
} valid = false;
if(max.length <= 0) { return false;
$("#max_num").focus(); }
valid = false; if(max.length <= 0) {
return false; $("#max_num").focus();
} valid = false;
if ($("#base_on_project").is(":checked")) { return false;
base_on_project = 1; }
} if ($("#base_on_project").is(":checked")) {
if (valid) { base_on_project = 1;
$("input[name=homework_type]").val(3); }
$('span.group_detail_info').text('分组人数:'+min+'-'+max+' 人'); if (valid) {
//保存js值 $("input[name=homework_type]").val(3);
var data = { $('span.group_detail_info').text('分组人数:'+min+'-'+max+' 人');
base_on_project: base_on_project, //保存js值
min_num: min, var data = {
max_num: max base_on_project: base_on_project,
}; min_num: min,
//构建到form中 max_num: max
$('.group-input').remove(); };
var html=bt('t:group-input-list',data); //构建到form中
$("input[name=homework_type]").after(html); $('.group-input').remove();
} var html=bt('t:group-input-list',data);
return valid; $("input[name=homework_type]").after(html);
}; }
return valid;
$("#GroupPopupBox a.group_btn").live('click', function(){ };
if(saveGroupAttr()){
if($( "#GroupPopupBox" ).dialog( "isOpen" )){ $("#GroupPopupBox a.group_btn").live('click', function(){
$("#GroupPopupBox").dialog( "close" ); if(saveGroupAttr()){
} if($( "#GroupPopupBox" ).dialog( "isOpen" )){
} $("#GroupPopupBox").dialog( "close" );
}); }
}
//代码编辑器 });
if (typeof CodeMirror != "undefined") {
var program_name = "text/x-csrc"; //代码编辑器
var language = $('#data-language').attr('data-language'); if (typeof CodeMirror != "undefined") {
if (language == 1) { var program_name = "text/x-csrc";
program_name = 'text/x-csrc'; var language = $('#data-language').attr('data-language');
} else if(language==2){ if (language == 1) {
program_name = 'text/x-c++src'; program_name = 'text/x-csrc';
}else if(language==3){ } else if(language==2){
program_name = 'text/x-cython'; program_name = 'text/x-c++src';
} else if(language==4){ }else if(language==3){
program_name = 'text/x-java'; program_name = 'text/x-cython';
} } else if(language==4){
program_name = 'text/x-java';
if ($('#program-src').val().length<=0) { }
var src = '';
if(language==4){ if ($('#program-src').val().length<=0) {
src = '\ var src = '';
import java.io.*;\n\ if(language==4){
import java.util.*;\n\ src = '\
\n\ import java.io.*;\n\
//请一定不要修改类名\n\ import java.util.*;\n\
class Main\n\ \n\
{\n\ //请一定不要修改类名\n\
public static void main (String args[])\n\ class Main\n\
{\n\ {\n\
//获取参数方式\n\ public static void main (String args[])\n\
//Scanner in = new Scanner(System.in);\n\ {\n\
//int a = in.nextInt();\n\ //获取参数方式\n\
//int b = in.nextInt();\n\ //Scanner in = new Scanner(System.in);\n\
\n\ //int a = in.nextInt();\n\
//您的代码\n\ //int b = in.nextInt();\n\
}\n\ \n\
}\n\ //您的代码\n\
'; }\n\
} }\n\
else if(language==1){ ';
src = '#include <stdio.h>\n\ }
\n\ else if(language==1){
int main()\n\ src = '#include <stdio.h>\n\
{\n\ \n\
//获取参数方式 scanf\n\ int main()\n\
//int x =0;\n\ {\n\
//int y = 0;\n\ //获取参数方式 scanf\n\
//scanf("%d", &x);\n\ //int x =0;\n\
\n\ //int y = 0;\n\
//结果输出使用prinf\n\ //scanf("%d", &x);\n\
//printf("%d",x);\n\ \n\
\n\ //结果输出使用prinf\n\
return 0;\n\ //printf("%d",x);\n\
}\n\ \n\
'; return 0;\n\
} else if(language==2){ }\n\
src = '\ ';
#include <iostream>\n\ } else if(language==2){
using namespace std;\n\ src = '\
\n\ #include <iostream>\n\
int main()\n\ using namespace std;\n\
{\n\ \n\
//获取参数方式 cin\n\ int main()\n\
//int x =0;\n\ {\n\
//cin >> x;\n\ //获取参数方式 cin\n\
\n\ //int x =0;\n\
//结果输出使用 cout\n\ //cin >> x;\n\
//cout<<"1";\n\ \n\
\n\ //结果输出使用 cout\n\
return 0;\n\ //cout<<"1";\n\
}\n\ \n\
'; return 0;\n\
} else if(language==3){ }\n\
src = '\ ';
import sys \n\ } else if(language==3){
\n\ src = '\
#获取参数方式使用raw_input\n\ import sys \n\
#input = raw_input()\n\ \n\
#a, b = input.split()\n\ #获取参数方式使用raw_input\n\
\n\ #input = raw_input()\n\
#结果输出使用 print \n\ #a, b = input.split()\n\
#print (str(int(a)+int(b)))\n\ \n\
'; #结果输出使用 print \n\
} #print (str(int(a)+int(b)))\n\
';
$('#program-src').val(src); }
};
$('#program-src').val(src);
var editor = CodeMirror.fromTextArea(document.getElementById("program-src"), { };
mode: {name: program_name,
version: 2, var editor = CodeMirror.fromTextArea(document.getElementById("program-src"), {
singleLineStringErrors: false}, mode: {name: program_name,
lineNumbers: true, version: 2,
indentUnit: 2, singleLineStringErrors: false},
matchBrackets: true lineNumbers: true,
}); indentUnit: 2,
matchBrackets: true
editor.on('change',function(cMirror){ });
// get value right from instance
$('#program-src').val(cMirror.getValue()); editor.on('change',function(cMirror){
}); // get value right from instance
} $('#program-src').val(cMirror.getValue());
});
}
}); });