348 lines
15 KiB
Plaintext
348 lines
15 KiB
Plaintext
<style type="text/css">
|
|
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
|
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
|
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
|
|
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
|
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
|
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
|
div.ke-toolbar .ke-outline{border:none;}
|
|
</style>
|
|
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
|
|
<% @center_flag = (User.current == @user) %>
|
|
<% if @center_flag %>
|
|
<div class="top_new">
|
|
<span class="<%= (@user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true)) ? 'top_new_bg' : 'top_newcourses_bg'%> fl"></span>
|
|
<% if @user.allowed_to?(:add_project, nil, :global => true) %>
|
|
<a href="<%= url_for(:controller => 'projects', :action => 'new',:host=>Setting.host_name) %>" class="bgreen_n_btn fr ml10 mt2" target="_blank">新建项目</a>
|
|
<% else %>
|
|
<a href="<%= join_project_projects_path %>" data-remote ="true" class="green_n_btn fr mt2">加入项目</a>
|
|
<% end %>
|
|
|
|
<% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %>
|
|
<a href="<%= url_for(:controller => 'courses', :action => 'new',:host=>Setting.host_course) %>" class="green_n_btn fr mt2" target="_blank">新建课程</a>
|
|
<% else %>
|
|
<!--<a href="<%#= url_for(:controller => 'courses', :action => 'join_private_courses',:host=>Setting.host_course) %>" data-remote ="true" class="green_n_btn fr mt2">加入课程</a>-->
|
|
<a href="<%= join_private_courses_courses_path %>" data-remote ="true" class="green_n_btn fr mt2">加入课程</a>
|
|
<% end %>
|
|
<div class="cl"></div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div id="RSide" class="fl">
|
|
<div class="message_box mb10">
|
|
<div nhname='new_message' style="display:none;">
|
|
<form action="<%= url_for(:controller => 'words', :action => 'create', :user_id => @user.id) %>" data-remote="true" method="post">
|
|
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea' name="new_form[user_message]"></textarea>
|
|
<p nhname='contentmsg'></p>
|
|
<div nhname='toolbar_container' style="float:left;padding-top:3px;"></div>
|
|
<a id="new_message_cancel_btn" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:3px;">取消</a>
|
|
<a id="new_message_submit_btn" href="javascript:void(0)" class="blue_n_btn fr mr5 " style="margin-top:3px;">留言</a>
|
|
</form>
|
|
</div>
|
|
<div class="cl"></div>
|
|
|
|
<div class="message_list_box" nhname="list_more_div" id="nh_messages" style="display:none;">
|
|
<div nhname="container" data-nodatamsg="暂无留言" data-pagesize="3" data-url="<%= url_for(:controller => 'users', :action => 'user_feedback4show') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>
|
|
<div class="message_list_more" style="width:700px">
|
|
<a nhname="expand" href="javascript:void(0)" class="c_blue02">点击展开更多</a> <a nhname="close" style="display:none" href="javascript:void(0)" class="c_lgrey fr mr10">收起</a>
|
|
<div class="cl"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<% if !@center_flag %>
|
|
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
|
|
<div class="users_top">
|
|
<a href="<%=url_for(:controller => 'users', :action => 'user_courses')%>" class="f14 fb fl c_dark ml10 mt8"><%= @center_flag ? '我的课程' : 'TA的课程' %></a>
|
|
<% if @center_flag %>
|
|
<% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %>
|
|
<a href="<%= url_for(:controller => 'courses', :action => 'new',:host=>Setting.host_course) %>" class=" green_u_btn fr mt8 mr8" target="_blank">新建课程</a>
|
|
<% else %>
|
|
<a href="<%= join_private_courses_courses_path %>" data-remote ="true" class=" green_u_btn fr mt8 mr8">加入课程</a>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<div class="cl"></div>
|
|
<div nhname="container" data-nodatamsg="暂无课程" data-url="<%= url_for(:controller => 'users', :action => 'user_courses4show') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>
|
|
<div class="cl"></div>
|
|
<div class="message_list_more mt10">
|
|
<a nhname="expand" href="javascript:void(0)" class="c_blue02">点击展开更多</a> <a nhname="close" style="display:none" href="javascript:void(0)" class="c_lgrey fr">收起</a>
|
|
<div class="cl"></div>
|
|
</div>
|
|
<div class="cl"></div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
|
|
<h4 class="users_h4">课程动态</h4>
|
|
<div nhname="container" data-nodatamsg="暂无动态" data-url="<%= url_for(:controller => 'users', :action => 'user_course_activities') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>
|
|
<div class="message_list_more">
|
|
<a nhname="expand" href="javascript:void(0)" class="c_blue02">点击展开更多</a> <a nhname="close" style="display:none" href="javascript:void(0)" class="c_lgrey fr">收起</a>
|
|
<div class="cl"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<% if !@center_flag %>
|
|
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
|
|
<div class=" users_top">
|
|
<a href="<%=url_for(:controller => 'users', :action => 'user_projects')%>" class="f14 fb fl c_dark ml10 mt8"><%= @center_flag ? '我的项目' : 'TA的项目' %></a>
|
|
<% if @center_flag %>
|
|
<% if @user.allowed_to?(:add_project, nil, :global => true) %>
|
|
<a href="<%= url_for(:controller => 'projects', :action => 'new',:host=>Setting.host_name) %>" class=" green_u_btn fr mt8 mr8" target="_blank">新建项目</a>
|
|
<% else %>
|
|
<a href="<%= join_project_projects_path %>" data-remote ="true" class=" green_u_btn fr mt8 mr8">加入项目</a>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<div class="cl"></div>
|
|
<div nhname="container" data-nodatamsg="暂无项目" data-url="<%= url_for(:controller => 'users', :action => 'user_projects4show') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>
|
|
<div class="cl"></div>
|
|
<div class="message_list_more mt10">
|
|
<a nhname="expand" href="javascript:void(0)" class="c_blue02">点击展开更多</a> <a nhname="close" style="display:none" href="javascript:void(0)" class="c_lgrey fr">收起</a>
|
|
<div class="cl"></div>
|
|
</div>
|
|
<div class="cl"></div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
|
|
<h4 class="users_h4">项目动态</h4>
|
|
<div nhname="container" data-nodatamsg="暂无动态" data-url="<%= url_for(:controller => 'users', :action => 'user_project_activities') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>
|
|
<div class="message_list_more">
|
|
<a nhname="expand" href="javascript:void(0)" class="c_blue02">点击展开更多</a> <a nhname="close" style="display:none" href="javascript:void(0)" class="c_lgrey fr">收起</a>
|
|
<div class="cl"></div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(function(){
|
|
|
|
function init_editor(params){
|
|
var editor = params.kindutil.create(params.textarea, {
|
|
resizeType : 1,minWidth:"1px",width:"100%",height:"80px",
|
|
items:['emoticons'],
|
|
afterChange:function(){//按键事件
|
|
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
|
},
|
|
afterCreate:function(){
|
|
var toolbar = $("div[class='ke-toolbar']",params.div_form);
|
|
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
|
|
params.toolbar_container.append(toolbar);
|
|
}
|
|
}).loadPlugin('paste');
|
|
return editor;
|
|
}
|
|
|
|
function nh_check_field(params){
|
|
var result=true;
|
|
if(params.content!=undefined){
|
|
if(params.content.isEmpty()){
|
|
result=false;
|
|
}
|
|
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
|
params.textarea.html(params.content.html());
|
|
params.content.sync();
|
|
if(params.content.isEmpty()){
|
|
params.contentmsg.html('内容不能为空');
|
|
params.contentmsg.css({color:'#ff0000'});
|
|
}else{
|
|
params.contentmsg.html('填写正确');
|
|
params.contentmsg.css({color:'#008000'});
|
|
}
|
|
params.contentmsg.show();
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function init_form(params){
|
|
params.form.submit(function(){
|
|
var flag = false;
|
|
if(params.form.attr('data-remote') != undefined ){
|
|
flag = true
|
|
}
|
|
var is_checked = nh_check_field({
|
|
issubmit:true,
|
|
content:params.editor,
|
|
contentmsg:params.contentmsg,
|
|
textarea:params.textarea
|
|
});
|
|
if(is_checked){
|
|
if(flag){
|
|
return true;
|
|
}else{
|
|
$(this)[0].submit();
|
|
return false;
|
|
}
|
|
}
|
|
return false;
|
|
});
|
|
}
|
|
function nh_reset_form(params){
|
|
params.form[0].reset();
|
|
params.textarea.empty();
|
|
if(params.editor != undefined){
|
|
params.editor.html(params.textarea.html());
|
|
}
|
|
params.contentmsg.hide();
|
|
}
|
|
|
|
KindEditor.ready(function(K){
|
|
$("a[nhname='reply_btn']").live('click',function(){
|
|
var params = {};
|
|
params.kindutil = K;
|
|
params.container = $(this).parent('div');
|
|
params.div_form = $("div[nhname='div_form']",params.container);
|
|
params.form = $("form",params.div_form);
|
|
params.textarea = $("textarea[name='user_notes']",params.div_form);
|
|
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
|
|
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
|
|
params.cancel_btn = $("a[nhname='cancel_btn']",params.div_form);
|
|
params.submit_btn = $("a[nhname='submit_btn']",params.div_form);
|
|
if(params.textarea.data('init') == undefined){
|
|
params.editor = init_editor(params);
|
|
init_form(params);
|
|
params.cancel_btn.click(function(){
|
|
nh_reset_form(params);
|
|
toggleAndSettingWordsVal(params.div_form, params.textarea);
|
|
});
|
|
params.submit_btn.click(function(){
|
|
params.form.submit();
|
|
});
|
|
params.textarea.data('init',1);
|
|
}
|
|
params.cancel_btn.click();
|
|
setTimeout(function(){
|
|
if(!params.div_form.is(':hidden')){
|
|
params.textarea.show();
|
|
params.textarea.focus();
|
|
params.textarea.hide();
|
|
}
|
|
},300);
|
|
|
|
});
|
|
|
|
$("div[nhname='new_message']").each(function(){
|
|
var params = {};
|
|
params.kindutil = K;
|
|
params.div_form = $(this);
|
|
params.form = $("form",params.div_form);
|
|
if(params.form==undefined || params.form.length==0){
|
|
return;
|
|
}
|
|
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
|
|
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
|
|
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
|
|
params.cancel_btn = $("#new_message_cancel_btn");
|
|
params.submit_btn = $("#new_message_submit_btn");
|
|
|
|
if(params.textarea.data('init') == undefined){
|
|
params.editor = init_editor(params);
|
|
init_form(params);
|
|
params.cancel_btn.click(function(){
|
|
nh_reset_form(params);
|
|
});
|
|
params.submit_btn.click(function(){
|
|
params.form.submit();
|
|
});
|
|
params.textarea.data('init',1);
|
|
$(this).show();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
<script type="text/javascript">
|
|
function init_list_more_div(params){
|
|
var p=params;
|
|
p.exbtn.click(function(){
|
|
var isclose = p.container.data('isclose');
|
|
var hasmore = p.container.data('hasmore');
|
|
if(isclose == '1'){
|
|
$("div[nhname='rec']",p.container).show();
|
|
p.container.data('isclose','0');
|
|
change_status_4_list_more_div(params);
|
|
return;
|
|
}
|
|
if(hasmore == '0'){
|
|
change_status_4_list_more_div(params,'get');
|
|
return;
|
|
}
|
|
var url = p.container.data('url');
|
|
if($("div[nhname='rec']",p.container).length > 0){
|
|
var lastid = $("div[nhname='rec']",p.container).filter(':last').data('id');
|
|
url += "?lastid="+lastid;
|
|
var lasttime = $("div[nhname='rec']",p.container).filter(':last').data('time');
|
|
if(lasttime != undefined){
|
|
url += "&lasttime="+lasttime;
|
|
}
|
|
}
|
|
$.ajax( {url:url,dataType:'text',success:function(data){
|
|
var html = $("<div>"+data+"</div>");
|
|
var lens = $("div[nhname='rec']",html).length;
|
|
if(lens < p.size){
|
|
p.container.data('hasmore','0');
|
|
}
|
|
if(lens>0){
|
|
var currpage = parseInt(p.container.data('currpage'))+1;
|
|
p.container.data('currpage',currpage);
|
|
p.container.append(html.html())
|
|
}
|
|
change_status_4_list_more_div(params,'get');
|
|
p.div.show();
|
|
}} );
|
|
});
|
|
p.clbtn.click(function(){
|
|
var i=0;
|
|
$("div[nhname='rec']",p.container).each(function(){
|
|
i++;
|
|
if(i> p.size){
|
|
$(this).hide();
|
|
}
|
|
});
|
|
p.container.data('isclose','1');
|
|
change_status_4_list_more_div(params);
|
|
});
|
|
p.exbtn.click();
|
|
}
|
|
function change_status_4_list_more_div(params,opt){
|
|
var p=params;
|
|
if($("div[nhname='rec']",p.container).length == 0 && opt != 'get'){
|
|
p.exbtn.click();
|
|
return;
|
|
}
|
|
var show_lens = $("div[nhname='rec']",p.container).length - $("div[nhname='rec']",p.container).filter(':hidden').length;
|
|
if( show_lens > p.size ){
|
|
p.clbtn.show();
|
|
}else{
|
|
p.clbtn.hide();
|
|
}
|
|
if($("div[nhname='rec']",p.container).length == 0){
|
|
p.exbtn.html(p.nodatamsg);
|
|
}else if( p.container.data('hasmore') == '1' || p.container.data('isclose')=='1' ){
|
|
p.exbtn.html('点击展开更多');
|
|
}else{
|
|
p.exbtn.html('没有更多了');
|
|
}
|
|
}
|
|
function init_list_more_div_params(div){
|
|
var params = {};
|
|
params.div = div;
|
|
params.container = $("div[nhname='container']",div);
|
|
params.exbtn = $("a[nhname='expand']",div);
|
|
params.clbtn = $("a[nhname='close']",div);
|
|
params.size = params.container.data('pagesize');
|
|
params.nodatamsg = params.container.data('nodatamsg');
|
|
if( params.size == undefined ){
|
|
params.size = 8;
|
|
}
|
|
return params;
|
|
}
|
|
$(function(){
|
|
$("div[nhname='list_more_div']").each(function(){
|
|
var params = init_list_more_div_params($(this));
|
|
init_list_more_div(params)
|
|
});
|
|
});
|
|
</script>
|