This commit is contained in:
zhuhao 2014-11-18 17:04:09 +08:00
commit c1361e37b8
7 changed files with 58 additions and 106 deletions

View File

@ -97,7 +97,7 @@ module WatchersHelper
return '' unless user && user.logged? return '' unless user && user.logged?
# modify by nwb # modify by nwb
# 主讲教师不允许退出课程 # 主讲教师不允许退出课程
return '' if user.id == course.tea_id || course.is_public == 0 return '' if user.id == course.tea_id
joined = user.member_of_course?(course) joined = user.member_of_course?(course)
text = joined ? l(:label_exit_course) : l(:label_new_join) text = joined ? l(:label_exit_course) : l(:label_new_join)
url_t = join_path(:object_id => course.id) url_t = join_path(:object_id => course.id)

View File

@ -1,6 +1,6 @@
<div id="floatpoint" class="course_ad" > <div id="floatpoint" class="course_ad" >
<table border=0 width="180px" > <table border=0>
<tr> <tr>
<td align=center bgcolor=#15bccf > <td align=center bgcolor=#15bccf >
<span class="ad_title"><%= l(:label_contact_us) %></span> <span class="ad_title"><%= l(:label_contact_us) %></span>
@ -30,85 +30,26 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var XX=1150; // 浮动层的X坐标,即左边距
var xstep=1; // 移动步长此参数越小移动越平滑最小值为1 var xstep=1; // 移动步长此参数越小移动越平滑最小值为1
var delay_time=60; // 每步的时间间隔,此参数越小,移动速度越快 var delay_time=60; // 每步的时间间隔,此参数越小,移动速度越快
var YY=0; var YY=0;
var ch=0; var screen_height = $(window).height(); //浏览器当前窗口文档的高度
var oh=0; var screen_width = $(window).width(); //浏览器当前窗口文档的宽度
var yon=1;
var ns4=document.layers?1:0
var ie=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
if(ie){ window.setInterval(function(){move();},delay_time);
YY=document.body.clientHeight; //由clientHeight取得页面的高度 function move()
floatpoint.style.top=YY; //将浮动层位置调整到页面底部 {
} var floatpoint_height = $("#floatpoint").height();
else if (ns4){ YY += xstep;
if(YY <= 0){xstep = 1; YY = 0;} //如果浮动层超出了上界,则设定移动方向为向下;并设定层的位置为正好在上界处
YY=window.innerHeight; //由innerHeight取得页面的高度 if(YY >= (screen_height-floatpoint_height)) //如果浮动层超出了下界,则设定移动方向为向上;并设定层的位置为正好在下界处
document.floatpoint.pageY=YY; //将浮动层位置调整到页面底部 {
document.floatpoint.visibility="hidden"; //将浮动层隐藏。 xstep = -1;
} YY=(screen_height-floatpoint_height);
else if (ns6){ }
$("#floatpoint").css("top",YY);
YY=window.innerHeight //由innerHeight取得页面的高度 }
document.getElementById('floatpoint').style.top=YY //将浮动层位置调整到页面底部 function change_size(){var body_width = $("#top-menu").width(); $("#floatpoint").css("left",screen_width/2+body_width/2+10);}
} $(document).ready(function(){change_size();});
YY = 0; $(window).resize(function(){screen_width = $(window).width();change_size();});
function reloc1(){
if (ie){
ch=document.body.clientHeight;
oh=floatpoint.offsetHeight;
}
else if (ns4){
ch=window.innerHeight;
oh=document.floatpoint.clip.height;
}
else if (ns6){ //如果是NS6
ch=window.innerHeight //取页面高度
oh=document.getElementById("floatpoint").offsetHeight //取浮动层的高度
}
if(yon==0)
{
YY=YY-xstep;
} //如果当前应该上移则减小YY值
else
{
YY=YY+xstep;
} //否则增加YY值下移
if(YY<0){yon=1;YY=0;} //如果浮动层超出了上界,则设定移动方向为向下;并设定层的位置为正好在上界处
if(YY>=(ch-oh)){yon=0;YY=(ch-oh);} //如果浮动层超出了下界,则设定移动方向为向上;并设定层的位置为正好在下界处
if(ie){ //如果是IE
floatpoint.style.left=XX; //用style.left设定浮动层左边距
floatpoint.style.top=YY+document.body.scrollTop; //用style.top设定浮动层上边距
}
else if (ns4){ //如果是NS4
document.floatpoint.pageX=XX; //用.pageX设定浮动层左边距
document.floatpoint.pageY=YY+window.pageYOffset; //用.pageY设定浮动层上边距
}
else if (ns6){ //如果是NS6
// document.getElementById("floatpoint").style.left=XX
// document.getElementById("floatpoint").style.top=YY+window.pageYOffset
$("#floatpoint").offset({left:XX});
$("#floatpoint").offset({top:YY+window.pageYOffset});
}
}
function onad(){
if(ns4) //如果是NS4
document.floatpoint.visibility="visible"; //设定浮动层为可见
loopfunc(); //开始主循环,以不断改变浮动层位置
}
function loopfunc(){
reloc1(); //调整浮动层位置
setTimeout('loopfunc()',delay_time); //设定下一次调整的延时
}
if (ie||ns4||ns6)
//window.onload=onad //初始化事件触发器
$(document).ready(onad());
</script> </script>

View File

@ -5,11 +5,12 @@
</style> </style>
<%= javascript_include_tag 'attachments' %> <%= javascript_include_tag 'attachments' %>
<!-- fq --> <!-- fq -->
<!--modified by huang-->
<div class="content-title-top"> <div class="content-title-top">
<% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles&Role.where(id: [3, 4, 7, 9] )).size >0))%> <% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles&Role.where(id: [3, 4, 7, 9] )).size >0))%>
<%= link_to(l(:label_course_homework_new), {:controller => 'courses', :action => 'new_homework'}, :class => 'icon icon-add') %> <%= link_to(l(:label_course_homework_new), {:controller => 'courses', :action => 'new_homework'}, :class => 'icon icon-add') %>
<% end %> <% else %>
<span class="font_lighter"><%= l(:label_coursejoin_tip) %></span>
<% end %>
</div> </div>
<div id="bid-show"> <div id="bid-show">
<%= render :partial => 'bids/bid_homework_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %> <%= render :partial => 'bids/bid_homework_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>

View File

@ -13,7 +13,37 @@
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %> <%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %>
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %> <%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %>
<p></p> <p></p>
<div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'course_new', locals: {course: @course} %>
</div>
<div id="relation_file_div" class="relation_file_div hidden">
<fieldset>
<legend>搜索</legend>
<%= form_tag(
attachments_autocomplete_path(:format => 'js'),
:remote => true,
:method => :post) do %>
<%= label_tag(:attach_search, "按关键字搜索:") %>
<%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %>
<% end -%>
<%= form_tag course_attach_relation_path(:format => 'js'),
method: :post,
remote: true,
id: "relation_file_form",
:class => 'hidden' do %>
<%= hidden_field_tag(:class_name, 'course') %>
<%= hidden_field_tag(:class_id, params[:course_id]) %>
<div id="relation_file">
</div>
<div class="kclearfix" style='margin-top: 10px;'>
<%= submit_tag(l(:button_add)) -%>
</div>
<% end -%>
</fieldset>
<div class="line_under" style="margin:20px 0px;"></div>
</div>
</div> </div>
<div class="box" id="files-box"> <div class="box" id="files-box">

View File

@ -20,28 +20,6 @@
<% end %> <% end %>
<div class="line_under" style="margin:20px 0px;"></div> <div class="line_under" style="margin:20px 0px;"></div>
<fieldset>
<legend><%=l(:label_attachment_new)%></legend>
<% attachmenttypes = course.attachmenttypes %>
<%= error_messages_for 'attachment' %>
<%= form_tag(course_files_path(course), :multipart => true,:remote => true,:method => :post,:name=>"upload_form", :class => "tabular") do %>
<p>
<% if attachmenttypes.any? %>
<%= l(:attachment_type) %></label>
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName", 2), {style: 'width:100px'} %>
<% end %>
</p>
<p><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
<%= submit_tag l(:button_add) %>
<% end %>
</fieldset>
<script type='text/javascript'> <script type='text/javascript'>
function tagAddClick(id,objId,objTag) function tagAddClick(id,objId,objTag)
{ {

View File

@ -2134,6 +2134,7 @@ zh:
label_notification: 通知公告 label_notification: 通知公告
label_course_ad_description: 课程模块正在优化中,使用过程中如有问题请您与我们联系,感谢大家的支持! label_course_ad_description: 课程模块正在优化中,使用过程中如有问题请您与我们联系,感谢大家的支持!
label_course_adcolick: 请点击: label_course_adcolick: 请点击:
label_coursejoin_tip: 提示:加入课程才有权限查看或提交作业,“加入”按钮见课程图标右侧!
#end #end
#end #end

View File

@ -12,7 +12,8 @@ h4 {border-bottom: 1px dotted #bbb;}
.course_ad{ .course_ad{
position:absolute; position:absolute;
visibility:visible; visibility:visible;
background:#ffffff background:#ffffff;
width:14%;
} }
.ad_title{ .ad_title{