diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index b9422ba64..3d1a3f6a4 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -1,16 +1,56 @@ -<% @nav_dispaly_course_all_label = 1 - @nav_dispaly_forum_label = 1 - @nav_dispaly_course_label = nil - @nav_dispaly_store_all_label = 1 %> -

<%=l(:label_course_new)%>

-<%= labelled_form_for @course do |f| %> -
- <%= render :partial => 'course_form', :locals => { :f => f } %> - - <%= submit_tag l(:button_create), :class => "enterprise"%> - - - <%= javascript_tag "$('#course_name').focus();" %> -
-<% end %> -<% html_title(l(:label_course_new)) -%> \ No newline at end of file +
+

<%= l(:permission_new_course)%>

+
+
+ +
+
\ No newline at end of file diff --git a/app/views/layouts/new_base.html.erb b/app/views/layouts/new_base.html.erb index 378e20ab0..a270243b6 100644 --- a/app/views/layouts/new_base.html.erb +++ b/app/views/layouts/new_base.html.erb @@ -25,80 +25,10 @@
-
-

配置课程

-
-
- -
-
+ <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %>
-
<%= render :partial => 'layouts/new_footer' %> diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 18aa965ca..65f45ea62 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -41,6 +41,55 @@ function edit_group(id,url,course_id,group_id) } ); } +/////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////新建课程相关 +//验证课程名称 +function regex_course_name() +{ + var name = $.trim($("#course_name").val()); + if(name.length == 0) + { + $("#course_name_notice").show(); + return false; + } + else + { + $("#course_name_notice").hide(); + return true; + } +} +//验证课程学时 +function regex_course_class_period() +{ + var class_period = $.trim($("#class_period").val()); + var regex = /^\d*$/; + if(class_period.length == 0) + { + $("#course_class_period_notice").html("学时总数不能为空"); + $("#course_class_period_notice").show(); + return false; + } + else if (regex.test(class_period)) { + $("#course_class_period_notice").html(""); + $("#course_class_period_notice").hide(); + return true; + } + else + { + $("#course_class_period_notice").html("学时总数必须为数字"); + $("#course_class_period_notice").show(); + return false; + } +} +//提交新建课程 +function submit_new_course() +{ + if(regex_course_name()&®ex_course_class_period()) + { + $("#new_course").submit(); + } +} + /////////////////////////////////////////////////////////////// //验证搜索时输入名字