Merge branch 'develop' into szzh

This commit is contained in:
sw 2015-08-04 17:53:16 +08:00
commit bb8edad410
4 changed files with 103 additions and 15 deletions

View File

@ -2379,17 +2379,18 @@ module ApplicationHelper
notice.html_safe
end
def stantard_code
"// 这是一个C语言的样例程序
//
//
#老师C语言的标准代码
def c_stantard_code_teacher
"// 老师您好这是一个C语言的样例程序
//
//
// 123
// 347
//
// ... ...
//
//
// argv传入
//
// argv传入
//
#include <stdio.h> //引用必须头文件
int main(int argc, char** argv) {
@ -2398,6 +2399,77 @@ int main(int argc, char** argv) {
printf(\"%d\",a+b); //输出a+b
return 0;
}".html_safe
end
#老师C++语言的标准代码
def c_stantard_code_teacher_
"// 老师您好这是一个C++语言的样例程序
//
//
// 123
// 347
// ... ...
//
// argv传入
//
#include <iostream> //引用必须头文件
#include <cstdlib>
using namespace std;
int main(int argc, char** argv){
int a = atoi(argv[1]); //
int b = atoi(argv[2]); //
cout<<a+b; //a+b
return 0;
}".html_safe
end
#学生C语言的标准代码
def c_stantard_code_student
"// 同学好这是一个C语言的样例程序
//
//
// 123
// 347
// ... ...
//
// argv传入
//
#include <stdio.h> //引用必须头文件
int main(int argc, char** argv) {
int a = atoi(argv[1]); //
int b = atoi(argv[2]); //
printf(\"%d\",a+b); //输出a+b
return 0;
}".html_safe
end
#学生C++语言的标准代码
def c_stantard_code_student_
"// 同学好这是一个C++语言的样例程序
//
//
// 123
// 347
// ... ...
//
// argv传入
//
#include <iostream> //引用必须头文件
#include <cstdlib>
using namespace std;
int main(int argc, char** argv){
int a = atoi(argv[1]); //
int b = atoi(argv[2]); //
cout<<a+b; //a+b
return 0;
}".html_safe
end
end

View File

@ -56,7 +56,7 @@
<ul>
<li >
<label class="label02">&nbsp;开发语言:&nbsp;</label>
<%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70"} %>
<%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70",:onchange => "homework_language_change($(this));"} %>
<div class="cl"></div>
</li>
@ -78,7 +78,7 @@
<li >
<label class="label02">&nbsp;标准代码:&nbsp;</label>
<textarea name="standard_code" class=" w547 h350 mb10 fl" oninput="init_programing_test();" onpropertychange="init_programing_test()"><%= homework.homework_detail_programing.standard_code || stantard_code%></textarea>
<textarea name="standard_code" class=" w547 h400 mb10 fl" oninput="init_programing_test();" onpropertychange="init_programing_test()"><%= homework.homework_detail_programing.standard_code || c_stantard_code_teacher%></textarea>
<div class="cl"></div>
</li>
@ -173,4 +173,20 @@
$(this).next("input").val("");
});
}
function homework_language_change(obj)
{
if(obj.val() == "1")
{
// alert(1);
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher%>");
}
else if(obj.val() == "2")
{
// alert(2);
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher_%>");
}
}
</script>

View File

@ -54,8 +54,8 @@
<%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>
&nbsp;&nbsp;&nbsp;
</label>
<% if @homework.homework_type == 2%>
<%= f.text_area "description", :class => "w620 hwork_txt h350", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => stantard_code%>
<% if @homework.homework_type == 2 && @homework.homework_detail_programing%>
<%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%>
<% else %>
<%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>
<% end%>

View File

@ -226,7 +226,7 @@ a:hover.ping_sub{ background:#14a8b9;}
.w430{ width:470px;}
.w557{ width:557px;}
.w350{ width:350px;}
.h350{height: 350px !important;}
.h400{height: 400px !important;}
.w620{ width:480px; height:160px; border:1px solid #CCC;}
.bo{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:470px; }
.bo02{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:480px; margin-left:2px; color: #999; }