Merge branch 'szzh' into develop

This commit is contained in:
sw 2014-08-23 14:02:07 +08:00
commit 09e0f5e33b
8 changed files with 169 additions and 247 deletions

View File

@ -63,6 +63,8 @@ class CoursesController < ApplicationController
#更新课程信息
def update
@course.safe_attributes = params[:course]
@course.time = params[:time]
@course.term = params[:term]
@course.class_period = params[:class_period]
if @course.save
if params[:course][:is_public] == '0'

View File

@ -140,11 +140,11 @@ class MyController < ApplicationController
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
if @user.save
flash[:notice] = l(:notice_account_password_updated)
flash.now[:notice] = l(:notice_account_password_updated)
redirect_to my_account_path
end
else
flash[:error] = l(:notice_account_wrong_password)
flash.now[:error] = l(:notice_account_wrong_password)
end
end
end

View File

@ -453,4 +453,31 @@ module CoursesHelper
Course.tagged_with(tag_name).order('updated_at desc')
end
#课程实践年份下拉框
def course_time_option
type = []
#work_types = WorksCategory.all
for i in (2008..2020)
option = []
option << i
option << i
type << option
end
type
end
#课程课时下拉框
def course_term_option
type = []
option1 = []
option1 << l(:label_spring)
option1 << l(:label_spring)
option2 = []
option2 << l(:label_autumn)
option2 << l(:label_autumn)
type << option1
type << option2
type
end
end

View File

@ -1,10 +1,10 @@
<script type="text/javascript">
function get_options(value){
function get_options(value) {
$.ajax({
type :"POST",
url :'/school/get_options/'+encodeURIComponent(value),
data :'text',
success: function(data){
type: "POST",
url: '/school/get_options/' + encodeURIComponent(value),
data: 'text',
success: function (data) {
$("#occupation").html(data);
}
@ -14,13 +14,12 @@
}
</script>
<script type="text/javascript">
function check(){
var regex=/^\d*$/;
if (!regex.test($("#class_period").val())){
<script type="text/javascript">
function check() {
var regex = /^\d*$/;
if (!regex.test($("#class_period").val())) {
alert("学时只能为整数");
}
}
}
</script>
@ -33,10 +32,12 @@
<!--[form:course]-->
<% unless @course.new_record? %>
<p><%= render :partial=>"avatar/avatar_form",:locals=> {source:@course} %></p>
<p><%= render :partial => "avatar/avatar_form", :locals => {source: @course} %></p>
<% end %>
<!-- <p><%#= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %></p> -->
<p><label for="course_name" style="font-size: 13px;" ><%=l(:label_tags_course_name)%><span class="required" > *&nbsp;&nbsp;</span></label><input id="course_name" type="text" value="<%=@course.name%>" style="width:490px;" size="60" name="course[name]"></p>
<p><label for="course_name" style="font-size: 13px;"><%= l(:label_tags_course_name) %><span class="required">
*&nbsp;&nbsp;</span></label><input id="course_name" type="text" value="<%= @course.name %>" style="width:490px;" size="60" name="course[name]">
</p>
<!-- <p><%#= f.text_field :extra, :required => true, :size => 60, :style => "width:488px;", :disabled => @course.extra_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %>
<%# unless @course.extra_frozen? %>
@ -75,254 +76,91 @@
</td></tr></table></p>
<%# end %>
-->
<% unless @course.nil?%>
<p><table><tr><td><span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px"><%= l(:label_class_period) %><span class="required"> *&nbsp;&nbsp;</span></span>
<span class="info" style="width: 10px;"><%= text_field_tag :class_period, @course.class_period, :placeholder => "在此输入课时",:maxlength=>5 %></span> <span>&nbsp;<strong><%= l(:label_class_hour)%></strong></span>
</td></tr></table></p>
<% unless @course.nil? %>
<p>
<table>
<tr>
<td>
<span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px"><%= l(:label_class_period) %>
<span class="required"> *&nbsp;&nbsp;</span></span>
<span class="info" style="width: 10px;"><%= text_field_tag :class_period, @course.class_period, :placeholder => "在此输入课时", :maxlength => 5 %></span>
<span>&nbsp;<strong><%= l(:label_class_hour) %></strong></span>
</td>
</tr>
</table></p>
<% else %>
<p><table><tr><td><span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px"><%= l(:label_class_period) %><span class="required"> *&nbsp;&nbsp;</span></span>
<span class="info" style="width: 10px;"><%= text_field_tag :class_period, nil, :placeholder => "在此输入课时",:maxlength=>5 %></span><strong><%= l(:label_class_hour)%></strong>
</td></tr></table></p>
<p>
<table>
<tr>
<td>
<span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px"><%= l(:label_class_period) %>
<span class="required"> *&nbsp;&nbsp;</span></span>
<span class="info" style="width: 10px;"><%= text_field_tag :class_period, nil, :placeholder => "在此输入课时", :maxlength => 5 %></span><strong><%= l(:label_class_hour) %></strong>
</td>
</tr>
</table></p>
<% end %>
<!-- end -->
<!-- added by bai 增加了“年度”和“学期” -->
<p><table><tr><td>
<% unless @course.nil? %>
<% if @course.time == 2008 %>
<p><table><tr><td class="info" align="right" style="width: 86px; margin-left:20px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008' selected='selected'>2008</option>
<option value = '2009'>2009</option>
<option value = '2010'>2010</option>
<option value = '2011'>2011</option>
<option value = '2012'>2012</option>
<option value = '2013'>2013</option>
<option value = '2014'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table>
</p>
<% elsif @course.time == 2009 %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009' selected='selected'>2009</option>
<option value = '2010'>2010</option>
<option value = '2011'>2011</option>
<option value = '2012'>2012</option>
<option value = '2013'>2013</option>
<option value = '2014'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2010 %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
<option value = '2010' selected='selected'>2010</option>
<option value = '2011'>2011</option>
<option value = '2012'>2012</option>
<option value = '2013'>2013</option>
<option value = '2014'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2011 %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
<option value = '2010'>2010</option>
<option value = '2011' selected='selected'>2011</option>
<option value = '2012'>2012</option>
<option value = '2013'>2013</option>
<option value = '2014'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<p>
<table>
<tr>
<td>
<% if @course != nil %>
<table>
<tr>
<td class="info" align="right" style="width: 86px">
<strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong>
</td>
<td class="info" style="width: 10px">
<%= select_tag :time,options_for_select(course_time_option,@course.time), {} %>
</td>
<td class="info" style="width: 10px">
<%= select_tag :term,options_for_select(course_term_option,@course.term),{} %>
</td>
</tr>
</table>
<% end %>
</td>
</tr>
</table>
</p>
<!-- end -->
<% elsif @course.time == 2012 %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
<option value = '2010'>2010</option>
<option value = '2011'>2011</option>
<option value = '2012' selected='selected'>2012</option>
<option value = '2013'>2013</option>
<option value = '2014'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2013 %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
<option value = '2010'>2010</option>
<option value = '2011'>2011</option>
<option value = '2012'>2012</option>
<option value = '2013' selected='selected'>2013</option>
<option value = '2014'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2014 %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
<option value = '2010'>2010</option>
<option value = '2011'>2011</option>
<option value = '2012'>2012</option>
<option value = '2013'>2013</option>
<option value = '2014' selected='selected'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2015 %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
<option value = '2010'>2010</option>
<option value = '2011'>2011</option>
<option value = '2012'>2012</option>
<option value = '2013'>2013</option>
<option value = '2014'>2014</option>
<option value = '2015' selected='selected'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2016 %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
<option value = '2010'>2010</option>
<option value = '2011'>2011</option>
<option value = '2012'>2012</option>
<option value = '2013'>2013</option>
<option value = '2014'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016' selected='selected'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2017 %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
<option value = '2010'>2010</option>
<option value = '2011'>2011</option>
<option value = '2012'>2012</option>
<option value = '2013'>2013</option>
<option value = '2014'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017' selected='selected'>2017</option>".html_safe %></td></tr></table></p>
<% else %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
<option value = '2010'>2010</option>
<option value = '2011'>2011</option>
<option value = '2012'>2012</option>
<option value = '2013'>2013</option>
<option value = '2014' selected='selected'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% end %>
<% end %>
</td>
<td>
<% unless @course.nil? %>
<% if @course.term == l(:label_spring) %>
<p><table><tr>
<td class="info" style="width: 10px">
<%= select_tag 'term', "<option value = '#{l(:label_spring)}' selected='selected'>#{l(:label_spring)}</option>
<option value = '#{l(:label_autumn)}'>#{l(:label_autumn)}</option>
".html_safe %></td></tr></table></p>
<% elsif @course.term == l(:label_summer)%>
<p><table><tr>
<td class="info" style="width: 10px">
<%= select_tag 'term', "<option value = '#{l(:label_spring)}'>#{l(:label_spring)}</option>
<option value = '#{l(:label_autumn)}'>#{l(:label_autumn)}</option>
".html_safe %></td></tr></table></p>
<% elsif @course.term == l(:label_autumn)%>
<p><table><tr>
<td class="info" style="width: 10px">
<%= select_tag 'term', "<option value = '#{l(:label_spring)}'>#{l(:label_spring)}</option>
<option value = '#{l(:label_autumn)}' selected='selected'>#{l(:label_autumn)}</option>
".html_safe %></td></tr></table></p>
<% elsif @course.term == l(:label_winter)%>
<p><table><tr>
<td class="info" style="width: 10px">
<%= select_tag 'term', "<option value = '#{l(:label_spring)}'>#{l(:label_spring)}</option>
<option value = '#{l(:label_autumn)}'>#{l(:label_autumn)}</option>
".html_safe %></td></tr></table></p>
<% else %>
<p><table><tr>
<td class="info" style="width: 10px">
<%= select_tag 'term', "<option value = '#{l(:label_spring)}'>#{l(:label_spring)}</option>
<option value = '#{l(:label_autumn)}'>#{l(:label_autumn)}</option>
".html_safe %></td></tr></table></p>
<% end %>
<% end %></td></tr></table>
</p>
<!-- end -->
<!--added by Wen -->
<!-- end -->
<!--added by Wen -->
<!-- end -->
<!-- <p style="margin-left:-10px;"><%#= m.text_field :password, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> -->
<p style="margin-left:-10px;"><label for="course[course]_password" style="font-size: 13px;" ><%=l(:label_new_course_password)%><span class="required"> *</span></label><input id="course_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%=@course.password %>" size="60" name="course[password]"></p>
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
<!-- <p style="margin-left:-10px;"><%#= m.text_field :password, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> -->
<p style="margin-left:-10px;">
<label for="course[course]_password" style="font-size: 13px;"><%= l(:label_new_course_password) %>
<span class="required">
*</span></label><input id="course_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%= @course.password %>" size="60" name="course[password]">
</p>
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
<% end %>
<!-- <p style="margin-left:-10px;padding-right: 20px;"><%#= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %></p> -->
<p style="padding-right: 20px;">
<label for="course_description" style="font-size: 13px;">
<%=l(:label_new_course_description)%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= l(:label_new_course_description) %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</label>
<span class="jstEditor">
<textarea id="course_description" class="wiki-edit" style="font-size:small;width:490px;margin-left:10px;" rows="8" name="course[description]" cols="40" >
<%=@course.description%>
<textarea id="course_description" class="wiki-edit" style="font-size:small;width:490px;margin-left:10px;" rows="8" name="course[description]" cols="40">
<%= @course.description %>
</textarea>
</span>
</p>
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %><%= l(:label_course_public_info) %></em></p><!-- modified by bai -->
<p style="margin-left:-10px;">
<em style="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %><%= l(:label_course_public_info) %></em>
</p><!-- modified by bai -->
<p style="display:none;"><%= f.text_field :course_type, :value => 1 %></p>

View File

@ -42,15 +42,14 @@
<ul class="sub_menu">
<% if @show_course == 1 %>
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<% hasCourse=true%>
<% _bool=false %>
<% hasCourse=false %>
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<% _bool=true %>
<% hasCourse=true %>
<% end %>
<% end %>
<% if _bool %>
<% if hasCourse %>
<li id="course_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id} %>
<ul class="course_sub_menu">
<% User.current.courses.each do |course| %>
@ -71,7 +70,7 @@
<% if hasCourse %>
<ul class="project_sub_menu" style="top: 35px">
<% else %>
<ul class="project_sub_menu">
<ul class="project_sub_menu" style="top: 0px">
<% end %>
<% User.current.projects.each do |project| %>
<li><%= link_to project.name.truncate(10, omission: '...'), {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %></li>

View File

@ -46,7 +46,7 @@
</div>
<div class="memo-title <%= @memo.sticky ? 'sticky' : '' %> <%= @memo.locked? ? 'locked' : '' %>"><%= label_tag l(:field_subject) %>: <%=h @memo.subject %></div>
<div class="memo-title <%= @memo.sticky ? 'sticky' : '' %> <%= @memo.locked? ? 'locked' : '' %>" style="word-break: break-all;"><%= label_tag l(:field_subject) %>: <%=h @memo.subject %></div>
<div class="memo-content">
<%= textAreailizable(@memo,:content) %>
<p>

View File

@ -6,9 +6,9 @@
<li>
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50"><%= link_to image_tag(url_to_avatar(user), :class => "avatar"),
user_path(user),
:title => "#{user.name}" %></td>
<td colspan="2" valign="top" width="50">
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"),user_path(user),:title => "#{user.name}" %>
</td>
<td>
<table width="580px" border="0">
<tr> <!-- modified by bai -->
@ -27,6 +27,8 @@
<% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% else %>
<%= l(:label_x_contribute_to, :count => 0) %>
<% end %>
</p>
@ -38,6 +40,8 @@
<% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% else %>
<%= l(:label_x_course_contribute_to, :count => 0) %>
<% end %>
</p>
</td>

View File

@ -633,3 +633,55 @@ function img_thumbnails() {
});
}
$(document).ready(img_thumbnails);
function TimeClose(dateText, inst) {
if(inst.id=="issue_start_date"){
time=dateText;
}
}
var time=new Date();
function TimeBeforeShow(input){
if(input.id=="issue_due_date"){
//var minDate = $(input).datepicker('option', 'minDate');
var tempdata=$("#issue_start_date").attr("value");
$(input).datepicker('option', 'minDate',new Date(tempdata.replace(/-/g, "/")));
//$('.selector').datepicker('option', 'minDate', '12/25/2012');
}
}
function SetMinValue(){
/// var tempdata=$("#issue_start_date").attr("value");
//$('.selector').datepicker('option', 'minDate', '12/25/2012');
//alert(tempdata);
//$("#issue_due_date").datepicker({
// minDate: new Date(2014,08,23)
//var datepickerOptions=
//{dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
//alert( $('.issue_due_date').length);
//$('.selector')[1].datepicker('option', 'minDate', new Date(2014, 0 - 8, 23));
//$("#issue_due_date").datepicker(datepickerOptions);
//$("##{issue_due_date}").datepicker(datepickerOptions);
//$("#issue_due_date").datepicker(
// {dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}
//)
//});
}
function PrecentChange(obj){
var _v= obj;
if(_v==100)
{
//var select=$("select[id='issue_status_id']");
$("select[id='issue_status_id']").find("option[value='3']").attr("selected","selected");
}
else if(_v==0)
{
//alert(1);
$("select[id='issue_status_id']").find("option[value='1']").attr("selected","selected");
}
else if(_v!=100&&_v!=0)
{
// alert(2);
$("select[id='issue_status_id']").find("option[value='2']").attr("selected","selected");
}
}