Merge remote-tracking branch 'origin/szzh' into homework

This commit is contained in:
guange 2015-08-27 21:00:29 +08:00
commit 5fb2989427
10 changed files with 103 additions and 39 deletions

View File

@ -62,12 +62,12 @@ class AccountController < ApplicationController
if params[:token] if params[:token]
@token = Token.find_token("recovery", params[:token].to_s) @token = Token.find_token("recovery", params[:token].to_s)
if @token.nil? || @token.expired? if @token.nil? || @token.expired?
redirect_to home_url redirect_to signin_path
return return
end end
@user = @token.user @user = @token.user
unless @user && @user.active? unless @user && @user.active?
redirect_to home_url redirect_to signin_path
return return
end end
if request.post? if request.post?
@ -79,7 +79,7 @@ class AccountController < ApplicationController
return return
end end
end end
render :layout => 'static_base', :template => "account/password_recovery" render :template => "account/password_recovery"
return return
else else
if request.post? if request.post?

View File

@ -1066,10 +1066,14 @@ class UsersController < ApplicationController
# 将资源发送到对应的课程,分为发送单个,或者批量发送 # 将资源发送到对应的课程,分为发送单个,或者批量发送
def add_exist_file_to_course def add_exist_file_to_course
@flag = true
if params[:send_id].present? if params[:send_id].present?
send_id = params[:send_id] send_id = params[:send_id]
ori = Attachment.find_by_id(send_id) ori = Attachment.find_by_id(send_id)
course_ids = params[:course_ids] course_ids = params[:course_ids]
if course_ids.nil?
@flag = false
end
unless course_ids.nil? unless course_ids.nil?
course_ids.each do |id| course_ids.each do |id|
next if ori.blank? next if ori.blank?
@ -1087,9 +1091,13 @@ class UsersController < ApplicationController
end end
elsif params[:send_ids].present? elsif params[:send_ids].present?
send_ids = params[:send_ids].split(" ") send_ids = params[:send_ids].split(" ")
course_ids = params[:course_ids]
if course_ids.nil?
@flag = false
end
send_ids.each do |send_id| send_ids.each do |send_id|
ori = Attachment.find_by_id(send_id) ori = Attachment.find_by_id(send_id)
course_ids = params[:course_ids]
unless course_ids.nil? unless course_ids.nil?
course_ids.each do |id| course_ids.each do |id|
next if ori.blank? next if ori.blank?
@ -1106,6 +1114,8 @@ class UsersController < ApplicationController
end end
end end
end end
else
@flag = false
end end
respond_to do |format| respond_to do |format|
format.js format.js
@ -1114,9 +1124,13 @@ class UsersController < ApplicationController
# 添加资源到对应的项目 # 添加资源到对应的项目
def add_exist_file_to_project def add_exist_file_to_project
@flag = true
if params[:send_id].present? if params[:send_id].present?
send_id = params[:send_id] send_id = params[:send_id]
project_ids = params[:projects_ids] project_ids = params[:projects_ids]
if project_ids.nil?
@flag = false
end
ori = Attachment.find_by_id(send_id) ori = Attachment.find_by_id(send_id)
unless project_ids.nil? unless project_ids.nil?
project_ids.each do |project_id| project_ids.each do |project_id|
@ -1134,8 +1148,12 @@ class UsersController < ApplicationController
end end
elsif params[:send_ids].present? elsif params[:send_ids].present?
send_ids = params[:send_ids].split(" ") send_ids = params[:send_ids].split(" ")
project_ids = params[:projects_ids]
if project_ids.nil?
@flag = false
end
send_ids.each do |send_id| send_ids.each do |send_id|
project_ids = params[:projects_ids]
ori = Attachment.find_by_id(send_id) ori = Attachment.find_by_id(send_id)
unless project_ids.nil? unless project_ids.nil?
project_ids.each do |project_id| project_ids.each do |project_id|
@ -1153,6 +1171,7 @@ class UsersController < ApplicationController
end end
end end
else else
@flag=true
end end
respond_to do |format| respond_to do |format|

View File

@ -47,6 +47,12 @@
$("#loginInBox").css({display:"none"}); $("#loginInBox").css({display:"none"});
} }
}); });
// $('#regist_btn').bind('keyup', function(event) {
// if (event.keyCode == "13" && $("#signUpBox").css('display') == 'block')) {
// register();
// }
//});
function clearInfo(id, content) { function clearInfo(id, content) {
var text = $('#' + id); var text = $('#' + id);
if (text.val() == content) { if (text.val() == content) {
@ -161,7 +167,7 @@
<div class="loginContent"> <div class="loginContent">
<div class="loginLeft"> <div class="loginLeft">
<div class="loginLogo"><img src="images/trustie_big_log.png" width="100" height="88" alt="Trustie Logo" /></div> <div class="loginLogo"><img src="images/trustie_big_log.png" width="100" height="88" alt="Trustie Logo" /></div>
<div class="loginInro">欢迎加入Trustie高校创新实践社区老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。Trustie是在中国推行大规模开放在线研究模式MOORE的支撑平台。</div> <div class="loginInro">欢迎加入Trustie高校创新实践社区老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。Trustie是在中国推行大规模开放在线研究模式MOORE的支撑平台。</div>
</div> </div>
<div class="loginRight"> <div class="loginRight">
<div id="loginInBox"> <div id="loginInBox">
@ -206,7 +212,7 @@
</a></div> </a></div>
<% end %> <% end %>
<div class="loginInButton" > <div class="loginInButton" >
<a href="javascript:void(0);" class="c_white db" onclick="$('#main_login_form').submit();">登录</a> <a href="javascript:void(0);" id="login_btn" class="c_white db" onclick="$('#main_login_form').submit();">登录</a>
</div> </div>
</div> </div>
@ -248,7 +254,7 @@
</div> </div>
我已阅读并接受<a href="<%= agreement_path %>" class="newsBlue"><u>Trustie服务协议</u></a>条款</div> 我已阅读并接受<a href="<%= agreement_path %>" class="newsBlue"><u>Trustie服务协议</u></a>条款</div>
<div class="loginUpButton"> <div class="loginUpButton">
<a href="javascript:void(0);" class="c_white db" onclick="register();">注册</a> <a href="javascript:void(0);" class="c_white db" id="regist_btn" onclick="register();">注册</a>
</div> </div>
<% end %> <% end %>

View File

@ -1,20 +1,19 @@
<h3><%=l(:label_password_lost)%></h3>
<%= error_messages_for 'user' %> <%= error_messages_for 'user' %>
<div style="margin-top:20px;width:100%; background-color:#eaebed;">
<div style="width:1000px; background-color:#eaebed; margin:0 auto; width:968px; border:1px solid #dddddd; background:#fff; padding:15px; padding-top:10px;margin: 20px auto">
<h2 style="font-size:16px; color:#484848; width:968px;border-bottom:1px solid #e3e3e3; padding-bottom:5px;">重置密码</h2>
<div style="width:310px; margin:80px auto;">
<%= form_tag(lost_password_path) do %>
<%= hidden_field_tag 'token', @token.value %>
<!--<input type="text" class="NomalInput " value="新密码" />-->
<%= password_field_tag 'new_password', nil, :size => 25,:placeholder=>'新密码',:style=>"width:308px; height:38px; border:1px solid #98a1a6; outline:none; color:#888888; font-size:14px; " %>
<p style=" color:#F00 ;margin-bottom:5px;">至少需要 6 个字符</p>
<!--<input type="text" class="NomalInput mb20 " value="确定密码" />-->
<%= password_field_tag 'new_password_confirmation', nil, :size => 25,:placeholder=>'确定密码',:style=>"width:308px; height:38px; border:1px solid #98a1a6; outline:none; color:#888888; font-size:14px;margin-bottom:20px; " %>
<div style="width:315px; height:40px; background-color:#269ac9; font-size:14px; text-align:center; line-height:40px; vertical-align:middle;"><a href="javascript:void(0);" style=" color:#fff;display:block !important;" onclick="$(this).parent().parent().submit();">提交</a></div>
<% end %>
</div>
<%= form_tag(lost_password_path) do %>
<%= hidden_field_tag 'token', @token.value %>
<div class="box tabular">
<p>
<label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
<%= password_field_tag 'new_password', nil, :size => 25 %>
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
</p>
<p> </div>
<label for="new_password_confirmation"><%= l(:field_password_confirmation)%> <span class="required">*</span></label> </div>
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %>
</p>
</div>
<p><%= submit_tag l(:button_save) %></p>
<% end %>

View File

@ -15,7 +15,19 @@
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%> <%= yield :header_tags -%>
</head> </head>
<
<script type="text/javascript" charset="utf-8">
$(function() {
$(document).keyup(function (e) {
var e = e || event,
code = e.which || e.keyCode;
if (code == 13 && $("#loginInBox").css('display') == 'block') {
e.preventDefault();
$('#main_login_form').submit();
}
});
});
</script>
<div class="navContainer"> <div class="navContainer">
<% is_current_user = User.current.logged? && User.current == @user%> <% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %> <% if User.current.logged? %>
@ -26,3 +38,9 @@
</div> </div>
<%= yield %> <%= yield %>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -1,2 +1,5 @@
<% if @flag == true%>
alert('发送成功') alert('发送成功')
closeModal(); closeModal();
<% else%>
<% end %>

View File

@ -1,2 +1,5 @@
alert('发送成功'); <% if @flag == true%>
closeModal(); alert('发送成功')
closeModal();
<% else%>
<% end %>

View File

@ -161,14 +161,26 @@ $(".resourcesList").mousedown(function(e) {
line = line.parent(); line = line.parent();
} }
//将当前的元素的所有子元素的背景色改为蓝色 //将当前的元素的所有子元素的背景色改为蓝色
line.children().css("background-color", '#00ffff'); line.children().css("background-color", '#e1e1e1');
//将当前元素赋给 上一个对象 保存起来。 //将当前元素赋给 上一个对象 保存起来。
last_line = line; last_line = line;
} }
}); });
$(".resourcesList").click(function(e) { //元素包含关系计算
var contains = function(root, el) {
if (root.compareDocumentPosition)
return root === el || !!(root.compareDocumentPosition(el) & 16);
if (root.contains && el.nodeType === 1){
return root.contains(el) && root !== el;
}
while ((el = el.parentNode))
if (el === root) return true;
return false;
}
$(document.body).click(function(e) {
//在列表上的任何单击事件都要恢复原来的样子 //在列表上的任何单击事件都要恢复原来的样子
//隐藏右键菜单 //隐藏右键菜单
//e.preventDefault();
$("#contextMenu").hide(); $("#contextMenu").hide();
document.oncontextmenu = function() {return true;} document.oncontextmenu = function() {return true;}
//如果当前行为空,那么要将当前行的拿到 //如果当前行为空,那么要将当前行的拿到
@ -180,9 +192,13 @@ $(".resourcesList").click(function(e) {
if(line.get(0).tagName === 'LI'){ if(line.get(0).tagName === 'LI'){
line = line.parent(); line = line.parent();
} }
} }
//将当前行改变为白色 //如果当前对象在表格里,将当前行改变为白色,这里主要是防止点击页面的其他链接的时候,那个链接背景色变白了
line.children().css("background-color", 'white'); if( contains($(".resourcesList").get(0),line.get(0))){
line.children().css("background-color", 'white');
}
//当前行恢复编辑状态到链接状态 //当前行恢复编辑状态到链接状态
if(ele && ele.nodeName != 'INPUT') { if(ele && ele.nodeName != 'INPUT') {
restore(); restore();
@ -258,7 +274,7 @@ $(".resourcesList").click(function(e) {
//批量删除 //批量删除
function batch_delete(){ function batch_delete(){
var data = $("#resources_list_form").serialize(); var data = $("#resources_list_form").serialize();
if(data != "" && confirm('您可能会删不掉这其中上传者不是您的资源,确认要删除这些资源吗?')) { if(data != "" && confirm('您删不掉这其中上传者不是您的资源,确认要删除这些资源吗?')) {
$.post( $.post(
'<%= user_resource_delete_user_path(@user)%>', '<%= user_resource_delete_user_path(@user)%>',
$("#resources_list_form").serialize(),//只会对选中的控件进行序列化提交 $("#resources_list_form").serialize(),//只会对选中的控件进行序列化提交

View File

@ -96,7 +96,7 @@ a.topnav_login_box:hover {color:#a1ebff;}
.topnav_login_list li{ } .topnav_login_list li{ }
/*底部*/ /*底部*/
#Footer{background-color:#ffffff; margin-bottom:10px; padding-bottom:15px; color:#666666;} #Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/
.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;} .footerAboutContainer {width:auto; border-bottom:1px solid #efefef;}
.footerAbout{ width:455px; margin:0 auto;height:35px; line-height:35px; border-bottom:1px solid #efefef; } .footerAbout{ width:455px; margin:0 auto;height:35px; line-height:35px; border-bottom:1px solid #efefef; }
.languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;} .languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;}

View File

@ -385,8 +385,8 @@ a.sendButtonBlue:hover {color:#ffffff;}
a.resourcesTypeAll {background:url(images/homepage_icon.png) -180px -89px no-repeat; padding-left:23px;} a.resourcesTypeAll {background:url(images/homepage_icon.png) -180px -89px no-repeat; padding-left:23px;}
a.resourcesTypeAtt {background:url(images/homepage_icon.png) -180px -49px no-repeat; padding-left:23px;} a.resourcesTypeAtt {background:url(images/homepage_icon.png) -180px -49px no-repeat; padding-left:23px;}
.resourcesType {width:75px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-90px; font-size:12px; color:#888888; display:none; line-height:2;} .resourcesType {width:75px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-90px; font-size:12px; color:#888888; display:none; line-height:2;}
.resourcesUploadBox {float:right; width:103px; height:34px; background-color:#64bdd9; line-height:34px; vertical-align:middle; text-align:center; margin-left:12px;} /*.resourcesUploadBox {float:right; width:103px; height:34px; background-color:#64bdd9; line-height:34px; vertical-align:middle; text-align:center; margin-left:12px;}*/
.resourcesUploadBox:hover {background-color:#0781b4;} /*.resourcesUploadBox:hover {background-color:#0781b4;}*/
/* 个人主页右边部分*/ /* 个人主页右边部分*/
.homepageSearchIcon {width:30px; height:32px; background:url(images/nav_icon.png) -8px 3px no-repeat; float:left;} .homepageSearchIcon {width:30px; height:32px; background:url(images/nav_icon.png) -8px 3px no-repeat; float:left;}
a.homepagePostTypeQuiz {background:url(images/homepage_icon.png) -90px -124px no-repeat; padding-left:23px;} a.homepagePostTypeQuiz {background:url(images/homepage_icon.png) -90px -124px no-repeat; padding-left:23px;}
@ -647,7 +647,7 @@ ul.list_watch{
.Agreementh4{ color:#2980b9; font-weight:bold; font-size:14px; margin-top:30px;} .Agreementh4{ color:#2980b9; font-weight:bold; font-size:14px; margin-top:30px;}
/*底部*/ /*底部*/
#Footer{background-color:#ffffff; margin-bottom:10px; padding-bottom:15px; color:#666666;} #Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/
.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;} .footerAboutContainer {width:auto; border-bottom:1px solid #efefef;}
.footerAbout{ width:455px; margin:0 auto;height:35px; line-height:35px; border-bottom:1px solid #efefef; } .footerAbout{ width:455px; margin:0 auto;height:35px; line-height:35px; border-bottom:1px solid #efefef; }
.languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;} .languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;}