Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course
This commit is contained in:
commit
2c5c261b70
|
@ -500,7 +500,7 @@ class CoursesController < ApplicationController
|
||||||
@course = Course.new
|
@course = Course.new
|
||||||
@course.safe_attributes = params[:course]
|
@course.safe_attributes = params[:course]
|
||||||
month = Time.now.month
|
month = Time.now.month
|
||||||
render :layout => 'base'
|
render :layout => 'new_base'
|
||||||
end
|
end
|
||||||
|
|
||||||
def desc_sort_course_by_avtivity(activity_count, courses)
|
def desc_sort_course_by_avtivity(activity_count, courses)
|
||||||
|
|
|
@ -239,6 +239,8 @@ class CoursesService
|
||||||
course.time = params[:time]
|
course.time = params[:time]
|
||||||
course.term = params[:term]
|
course.term = params[:term]
|
||||||
course.class_period = params[:class_period]
|
course.class_period = params[:class_period]
|
||||||
|
params[:course][:is_public] ? course.is_public = 1 : course.is_public = 0
|
||||||
|
params[:course][:open_student] ? course.open_student = 1 : course.open_student = 0
|
||||||
if course.save
|
if course.save
|
||||||
if params[:course][:is_public] == '0'
|
if params[:course][:is_public] == '0'
|
||||||
course_status = CourseStatus.find_by_course_id(course.id)
|
course_status = CourseStatus.find_by_course_id(course.id)
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<a href="javascript:void(0)" class="upimg fl">
|
||||||
|
<%= image_tag(url_to_avatar(source), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
|
||||||
|
</a>
|
||||||
|
<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "upbtn fl" %>
|
||||||
|
<%= file_field_tag 'avatar[image]',
|
||||||
|
:id => nil,
|
||||||
|
:class => 'upbtn fl',
|
||||||
|
:size => "1",
|
||||||
|
:multiple => false,
|
||||||
|
:onchange => 'addInputAvatar(this);',
|
||||||
|
:data => {
|
||||||
|
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||||
|
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||||
|
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||||
|
:file_type => Redmine::Configuration['pic_types'].to_s,
|
||||||
|
:type_support_message => l(:error_pic_type),
|
||||||
|
:upload_path => upload_avatar_path(:format => 'js'),
|
||||||
|
:description_placeholder => nil ,# l(:label_optional_description)
|
||||||
|
:source_type => source.class.to_s,
|
||||||
|
:source_id => source.id.to_s
|
||||||
|
} %>
|
||||||
|
<!--</span>-->
|
||||||
|
<% content_for :header_tags do %>
|
||||||
|
<%= javascript_include_tag 'avatars' %>
|
||||||
|
<% end %>
|
||||||
|
<div class="cl"></div>
|
|
@ -1,2 +1,2 @@
|
||||||
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
|
$("#st_groups").html("<%= escape_javascript( render :partial => 'new_groups_name', locals: {:course_groups => @course_groups})%>");
|
||||||
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");
|
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");
|
|
@ -1,16 +1,56 @@
|
||||||
<% @nav_dispaly_course_all_label = 1
|
<div class="project_r_h02">
|
||||||
@nav_dispaly_forum_label = 1
|
<h2 class="project_h2"><%= l(:permission_new_course)%></h2>
|
||||||
@nav_dispaly_course_label = nil
|
|
||||||
@nav_dispaly_store_all_label = 1 %>
|
|
||||||
<h3><%=l(:label_course_new)%></h3>
|
|
||||||
<%= labelled_form_for @course do |f| %>
|
|
||||||
<div class="box tabular">
|
|
||||||
<%= render :partial => 'course_form', :locals => { :f => f } %>
|
|
||||||
<span style="padding-left: 60px; margin-left: 36px">
|
|
||||||
<%= submit_tag l(:button_create), :class => "enterprise"%>
|
|
||||||
</span>
|
|
||||||
<!-- <%#= submit_tag l(:button_create_and_continue), :name => 'course_continue' %> -->
|
|
||||||
<%= javascript_tag "$('#course_name').focus();" %>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="hwork_new">
|
||||||
|
<ul>
|
||||||
|
<%= labelled_form_for @course do |f| %>
|
||||||
|
<li class="ml45">
|
||||||
|
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||||
|
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();">
|
||||||
|
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
|
||||||
|
</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<li class="ml45">
|
||||||
|
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
||||||
|
<input type="text" name="class_period" id="class_period" class="hwork_input02" onkeyup="regex_course_class_period();" maxlength="6">
|
||||||
|
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
|
||||||
|
</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<li class="ml45 mb10">
|
||||||
|
<label><span class="c_red">*</span> <%= l(:label_course_term)%> :</label>
|
||||||
|
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
|
||||||
|
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
|
||||||
|
</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<li class="ml45 mb10">
|
||||||
|
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||||
|
<input type="text" name="course[password]" id="course_course_password" class="hwork_input02" >
|
||||||
|
<div class="cl"></div>
|
||||||
|
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||||
|
</li>
|
||||||
|
<li class="ml45">
|
||||||
|
<label class="fl" > <%= l(:label_new_course_description)%> :</label>
|
||||||
|
<textarea name="course[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" ></textarea>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<li class=" mb5 ml80">
|
||||||
|
<label >公开 :</label>
|
||||||
|
<input checked="checked" id="course_is_public" name="course[is_public]" type="checkbox" value="1">
|
||||||
|
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅课程成员可见该课程。)</span>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<li class=" mb5 ml30">
|
||||||
|
<label >学生列表公开 :</label>
|
||||||
|
<input id="course_open_student" name="course[open_student]" type="checkbox" value="1">
|
||||||
|
<span class="c_grey">(打钩为"学生列表公开",不打钩为不公开,若不公开,则课程外部人员看不到学生列表)</span>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<li class=" ml90" >
|
||||||
|
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_course();" >提交</a>
|
||||||
|
<a href="javascript:history.back()" target="_blank" class="blue_btn grey_btn fl c_white">取消</a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
<% end%>
|
<% end%>
|
||||||
<% html_title(l(:label_course_new)) -%>
|
</ul>
|
||||||
|
</div><!--talknew end-->
|
||||||
|
<div class="cl"></div>
|
|
@ -1,3 +1,60 @@
|
||||||
<h3><%=l(:label_settings)%></h3>
|
<div class="project_r_h">
|
||||||
<%= render_tabs course_settings_tabs %>
|
<h2 class="project_h2"><%= l(:label_course_modify_settings)%></h2>
|
||||||
<% html_title(l(:label_settings)) -%>
|
</div>
|
||||||
|
<div class="hwork_new">
|
||||||
|
<ul>
|
||||||
|
<%= labelled_form_for @course do |f| %>
|
||||||
|
<li class="ml45 mb10">
|
||||||
|
<%= render :partial => "avatar/new_avatar_form", :locals => {source: @course} %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<li class="ml45">
|
||||||
|
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||||
|
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();" value="<%= @course.name%>">
|
||||||
|
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
|
||||||
|
</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<li class="ml45">
|
||||||
|
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
||||||
|
<input type="text" name="class_period" id="class_period" class="hwork_input02" onkeyup="regex_course_class_period();" maxlength="6" value="<%= @course.class_period%>">
|
||||||
|
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
|
||||||
|
</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<li class="ml45 mb10">
|
||||||
|
<label><span class="c_red">*</span> <%= l(:label_course_term)%> :</label>
|
||||||
|
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
|
||||||
|
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
|
||||||
|
</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<li class="ml45 mb10">
|
||||||
|
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||||
|
<input type="text" name="course[password]" id="course_course_password" class="hwork_input02" value="<%= @course.password%>">
|
||||||
|
<div class="cl"></div>
|
||||||
|
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||||
|
</li>
|
||||||
|
<li class="ml45">
|
||||||
|
<label class="fl" > <%= l(:label_new_course_description)%> :</label>
|
||||||
|
<textarea name="course[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" maxlength="6000"><%= @course.description%></textarea>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<li class=" mb5 ml80">
|
||||||
|
<label >公开 :</label>
|
||||||
|
<input <%= @course.is_public == 1 ? 'checked' : ''%> id="course_is_public" name="course[is_public]" type="checkbox">
|
||||||
|
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅课程成员可见该课程。)</span>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<li class=" mb5 ml30">
|
||||||
|
<label >学生列表公开 :</label>
|
||||||
|
<input <%= @course.open_student == 1 ? 'checked' : ''%> id="course_open_student" name="course[open_student]" type="checkbox"/>
|
||||||
|
<span class="c_grey">(打钩为"学生列表公开",不打钩为不公开,若不公开,则课程外部人员看不到学生列表)</span>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<li class=" ml90" >
|
||||||
|
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_edit_course(<%= @course.id%>);" >提交</a>
|
||||||
|
<%= link_to l(:button_cancel), course_path(@course), :class => "blue_btn grey_btn fl c_white" %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div><!--talknew end-->
|
||||||
|
<div class="cl"></div>
|
|
@ -1,2 +1,2 @@
|
||||||
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
|
$("#st_groups").html("<%= escape_javascript( render :partial => 'new_groups_name', locals: {:course_groups => @course_groups})%>");
|
||||||
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");
|
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");
|
|
@ -0,0 +1,45 @@
|
||||||
|
<% course_model %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>
|
||||||
|
<%= h html_title %>
|
||||||
|
</title>
|
||||||
|
<meta name="description" content="<%= Redmine::Info.app_name %>"/>
|
||||||
|
<meta name="keywords" content="issue,bug,tracker"/>
|
||||||
|
<%= csrf_meta_tag %>
|
||||||
|
<%= favicon %>
|
||||||
|
<%= javascript_heads %>
|
||||||
|
<%= heads_for_theme %>
|
||||||
|
<%= call_hook :view_layouts_base_html_head %>
|
||||||
|
<%= stylesheet_link_tag 'public', 'leftside', 'courses'%>
|
||||||
|
<%= javascript_include_tag "course","header" %>
|
||||||
|
<!-- page specific tags -->
|
||||||
|
<%= yield :header_tags -%>
|
||||||
|
</head>
|
||||||
|
<!--add by huang-->
|
||||||
|
<body>
|
||||||
|
<div id="Container">
|
||||||
|
<%= render :partial => 'layouts/new_header' %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div id="content02" >
|
||||||
|
<%= render_flash_messages %>
|
||||||
|
<%= yield %>
|
||||||
|
<%= call_hook :view_layouts_base_content %>
|
||||||
|
</div><!--Content end-->
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<%= render :partial => 'layouts/new_footer' %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div><!--Container end-->
|
||||||
|
<%= render :partial => 'layouts/new_feedback' %>
|
||||||
|
<div id="ajax-indicator" style="display:none;">
|
||||||
|
<span><%= l(:label_loading) %></span>
|
||||||
|
</div>
|
||||||
|
<div id="ajax-modal" style="display:none;"></div>
|
||||||
|
<%= call_hook :view_layouts_base_body_bottom %>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -41,6 +41,63 @@ 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function submit_edit_course(id)
|
||||||
|
{
|
||||||
|
if(regex_course_name()&®ex_course_class_period())
|
||||||
|
{
|
||||||
|
$("#edit_course_"+id).submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//验证搜索时输入名字
|
//验证搜索时输入名字
|
||||||
|
|
Loading…
Reference in New Issue