Merge branch 'develop' into hjq_beidou

Conflicts:
	db/schema.rb
This commit is contained in:
huang 2016-03-29 13:51:46 +08:00
commit 80cd5089a4
44 changed files with 624 additions and 529 deletions

View File

@ -55,8 +55,31 @@ class StudentWorkController < ApplicationController
render :json => resultObj
end
#行尾空格替换成□
def space_replace_1(str)
for i in 0 .. str.size
tChar = str[i]
if tChar != ' ' && tChar != "\n"
sFlag = false
eFlag = false
elsif tChar == ' ' && sFlag == false
tStart = i
sFlag = true
elsif tChar == "\n"
tEnd = i - 1
if sFlag == true
for j in tStart .. tEnd
str[j] = ""
end
sFlag = false
end
end
end
end
#由于负载问题 不要使用全局变量
#根据传入的tIndex确定是第几次测试
#之后如果觉得很卡 可以改成将结果传回JS再以参数形式传回来
def program_test_ex
is_test = params[:is_test] == 'true'
resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T'),tseq:1,tcount:1,testid:1} #保存每测试一次返回的结果
@ -78,11 +101,14 @@ class StudentWorkController < ApplicationController
result = test_realtime_ex(test, params[:src])
if result["status"].to_i != -2
result["results"].first['output'] = result["results"].first['output'].gsub(" ","")
result["results"].first['result'] = result["results"].first['result'].gsub(" ","")
#result["results"].first['output'] = result["results"].first['output'].gsub(" ","□")
#result["results"].first['result'] = result["results"].first['result'].gsub(" ","□")
end
logger.debug result
space_replace_1(result["results"].first['output'])
space_replace_1(result["results"].first['result'])
logger.debug result
#-1 默认值 0全部正确并结束 2 超时 -2 编译错误
resultObj[:status] = -1
@ -108,7 +134,7 @@ class StudentWorkController < ApplicationController
student_work.late_penalty = 0
end
#每次都要把数据存到数据库中
#每次从数据库取出上次的结果加上本次的结果再存入数据库
status = result["status"]
if index == 1
student_work_test = student_work.student_work_tests.build(status: status,
@ -555,7 +581,7 @@ class StudentWorkController < ApplicationController
end
end
end
redirect_to user_homeworks_user_path(User.current.id)
redirect_to student_homeworks_user_path(User.current.id)
end
def retry_work

View File

@ -1618,8 +1618,10 @@ class UsersController < ApplicationController
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
@status = params[:status]
@type = params[:type]
@path = user_resource_user_path(User.current, :type => @type)
@limit = 25
@is_remote = true
@atta_count = @attachments.count
@ -1677,6 +1679,7 @@ class UsersController < ApplicationController
end
@status = params[:status]
@type = params[:type]
@path = user_resource_user_path(User.current, :type => @type)
@limit = 25
@is_remote = true
@atta_count = @attachments.count
@ -1701,6 +1704,7 @@ class UsersController < ApplicationController
.select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 }
end
@search = params[:search]
@type = params[:type]
#这里仅仅是传递需要发送的资源id
@send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids]
@ -1719,6 +1723,7 @@ class UsersController < ApplicationController
@projects = @user.projects.visible
end
@search = params[:search]
@type = params[:type]
#这里仅仅是传递需要发送的资源id
@send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids
@ -1820,6 +1825,7 @@ class UsersController < ApplicationController
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
@type = params[:type]
@limit = 25
@path = user_resource_user_path(User.current, :type => @type)
@user = User.current
@is_remote = true
@atta_count = @attachments.count
@ -1931,6 +1937,7 @@ class UsersController < ApplicationController
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
@type = params[:type]
@limit = 25
@path = user_resource_user_path(User.current, :type => @type)
@user = User.current
@is_remote = true
@atta_count = @attachments.count
@ -2029,6 +2036,7 @@ class UsersController < ApplicationController
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
@type = params[:type]
@limit = 25
@path = user_resource_user_path(User.current, :type => @type)
@user = User.current
@is_remote = true
@atta_count = @attachments.count
@ -2721,6 +2729,7 @@ class UsersController < ApplicationController
name = "%"+name+"%"
@orgs = User.current.organizations.where("name like ?", name)
@user = User.current
@type = params[:type]
respond_to do |format|
format.html {render :layout => 'static_base'}
format.js

View File

@ -130,7 +130,7 @@ module StudentWorkHelper
def revise_attachment_status homework, attach
date = Time.parse(format_time(attach.created_on.to_s)).strftime("%Y-%m-%d")
status = ""
if homework.homework_detail_manual && ((homework.anonymous_comment == 0 &&homework.homework_detail_manual.evaluation_start.to_s <= date) || (homework.anonymous_comment == 1 && homework.end_time < date))
if homework.homework_detail_manual && ((homework.anonymous_comment == 0 &&homework.homework_detail_manual.evaluation_start.to_s <= date) || (homework.anonymous_comment == 1 && homework.end_time.to_s < date))
status = "此时其他同学作品已公开"
else
status = "此时其他同学作品尚未公开"

View File

@ -1,6 +1,7 @@
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% teacher_num = TeacherAndAssistantCount(@course) %>
<% student_num = studentCount(@course) %>
<% course_file_num = visable_attachemnts_incourse(@course).count %>
<div class="pr_info_logo fl mr10 mb5">
<% if is_excellent_course(@course) %>
<img src="/images/course/boutique.png" width="50" height="auto" alt="精品" class="boutiqueP" />

View File

@ -55,8 +55,7 @@
<div id="content">
<div id="LSide" class="fl">
<div class="project_info" style="position: relative" id="project_info_<%=@course.id %>">
<% course_file_num = visable_attachemnts_incourse(@course).count %>
<%=render :partial=>'layouts/project_info', :locals => {:course_file_num => course_file_num} %>
<%=render :partial=>'layouts/project_info' %>
</div><!--课程信息 end-->
<div class="info_box">
<ul>

View File

@ -28,13 +28,13 @@
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
</p>
</li>
<li class=" mb5 ml45">
<span style="margin-left:10px;" >显示模式&nbsp;&nbsp;&nbsp;&nbsp;: </span>
<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:2px;" checked />
<label for="show_mode_ordinary">社区模式一</label>
<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" />
<label for="show_mode_special">社区模式二</label>
</li>
<!--<li class=" mb5 ml45">-->
<!--<span style="margin-left:10px;" >显示模式&nbsp;&nbsp;&nbsp;&nbsp;: </span>-->
<!--<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:2px;" checked />-->
<!--<label for="show_mode_ordinary">社区模式一</label>-->
<!--<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" />-->
<!--<label for="show_mode_special">社区模式二</label>-->
<!--</li>-->
<li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label>
<input id="organization_is_public" name="organization[is_public]" onclick="disable_down($(this), $('#organization_alow_download'), $('#allow_down_hint'));" type="checkbox" value="1" checked="checked">

View File

@ -72,13 +72,13 @@
<!--class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 -->
</div>
<div class="cl"></div>
<div class="orgRow mb10 mt5">
<span style="margin-left:10px;" >显示模式&nbsp;: </span>
<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:5px;" <%= @organization.show_mode == 0 ? "checked" : "" %> />
<label for="show_mode_ordinary">社区模式一</label>
<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" <%= @organization.show_mode == 1 ? "checked" : "" %> />
<label for="show_mode_special">社区模式二</label>
</div>
<!--<div class="orgRow mb10 mt5">-->
<!--<span style="margin-left:10px;" >显示模式&nbsp;: </span>-->
<!--<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:5px;" <%= @organization.show_mode == 0 ? "checked" : "" %> />-->
<!--<label for="show_mode_ordinary">社区模式一</label>-->
<!--<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" <%= @organization.show_mode == 1 ? "checked" : "" %> />-->
<!--<label for="show_mode_special">社区模式二</label>-->
<!--</div>-->
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开&nbsp;: </span>
<input type="checkbox" id="is_public" onclick="disable_down($(this), $('#allow_download'),$('#allow_down_hint'));" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
</div>

View File

@ -48,7 +48,7 @@
</script>
<% unless forge_acts.empty? %>
<% forge_acts.includes(:forge_act).each do |activity| -%>
<% forge_acts.each do |activity| -%>
<script>
function expand_reply(container, btnid) {
var target = $(container);

View File

@ -18,7 +18,7 @@
<% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%>
<!-- 匿评结束阶段,显示点赞按钮 -->
<li class="fr" id="student_work_praise_<%= work.id%>">
<%= render :partial => 'student_work_praise' %>
<%= render :partial => 'student_work_praise',:locals => {:work => work} %>
</li>
<% end%>
<div class="cl"></div>

View File

@ -25,7 +25,7 @@
<% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %>
<!-- 匿评结束阶段,显示点赞按钮 -->
<li class="fr" id="student_work_praise_<%= work.id%>">
<%= render :partial => 'student_work_praise' %>
<%= render :partial => 'student_work_praise',:locals => {:work => work} %>
</li>
<% end%>
<div class="cl"></div>

View File

@ -1,5 +1,5 @@
<% if is_praise_homework User.current.id,@work.id %>
<%= link_to "赞(#{praise_homework_count @work.id})",praise_student_work_student_work_path(@work), :remote => true,:class => 'orange_btn', :style => 'font-size:12px;'%>
<% if is_praise_homework User.current.id,work.id %>
<%= link_to "赞(#{praise_homework_count work.id})",praise_student_work_student_work_path(work), :remote => true,:class => 'orange_btn', :style => 'font-size:12px;'%>
<% else %>
<%= link_to "赞(#{praise_homework_count @work.id})","javascript:void(0)",:class => 'grey_btn', :style => 'font-size:12px;'%>
<%= link_to "赞(#{praise_homework_count work.id})","javascript:void(0)",:class => 'grey_btn', :style => 'font-size:12px;'%>
<% end %>

View File

@ -1 +1 @@
$('#student_work_praise_<%= @work.id%>').html('<%= escape_javascript(render :partial => 'student_work/student_work_praise')%>');
$('#student_work_praise_<%= @work.id%>').html('<%= escape_javascript(render :partial => 'student_work/student_work_praise', :locals => {:work => @work})%>');

View File

@ -0,0 +1,26 @@
<%= form_tag add_exist_file_to_course_user_path(user, :type => defined? type ? "6" : type ),:remote=>true,:id=>'course_list_form' do %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !courses.empty? %>
<% courses.each do |course| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%></li>
</ul>
<% end %>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>

View File

@ -0,0 +1,26 @@
<%= form_tag share_message_to_course_user_path(user), :remote => true, :id => 'course_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !courses.empty? %>
<% courses.each do |course| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= truncate(course.name, :lendght => 25) + '['+course.time.to_s+course.term + ']' %></li>
</ul>
<% end %>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,26 @@
<%= form_tag share_news_to_course_user_path(user), :remote => true, :id => 'course_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !courses.empty? %>
<% courses.each do |course| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= truncate(course.name, :lendght => 25) + '['+course.time.to_s+course.term + ']' %></li>
</ul>
<% end %>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a>
</div>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,32 @@
<%= form_tag add_exist_file_to_org_user_path(user, :type => defined? type ? "6" : type),:remote=>true,:id=>'orgs_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="sectionWrap fl mr15">
<ul class="fontGrey3 sectionContent">
<% unless orgs.empty? %>
<% orgs.each do |org|%>
<li>
<label>
<input type="radio" name="org_id" value="<%= org.id%>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id)%>')" class="mt3 fl mr5" />
<span><%= org.name%></span></label>
</li>
<%end%>
<%end%>
</ul>
</div>
<div class="columnWrap">
<ul class="columnContent">
<%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%>
</ul>
</div>
<div class="cl"></div>
<div class="orgDirection mb10 break_word" style="white-space: nowrap;-o-text-overflow:ellipsis;text-overflow: ellipsis;overflow: hidden">目标地址:</div>
<div class="courseSendSubmit mr15">
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
</div>
<div class="cl"></div>
<%end %>

View File

@ -0,0 +1,31 @@
<%= form_tag share_message_to_org_user_path(user), :remote => true, :id => 'orgs_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="sectionWrap fl mr15">
<ul class="fontGrey3 sectionContent">
<% unless orgs.empty? %>
<% orgs.each do |org| %>
<li>
<label>
<input type="radio" name="org_id" value="<%= org.id %>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id,:send_type => params[:send_type])%>')" class="mt3 fl mr5"/>
<span><%= org.name %></span></label>
</li>
<% end %>
<% end %>
</ul>
</div>
<div class="columnWrap">
<ul class="columnContent">
<%= render :partial => 'users/org_resources_subfield', :locals => {:subfield => nil} %>
</ul>
</div>
<div class="cl"></div>
<div class="orgDirection mb10 break_word" style="white-space: nowrap;-o-text-overflow:ellipsis;text-overflow: ellipsis;overflow: hidden">目标地址:</div>
<div class="courseSendSubmit mr15">
<%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();', :onclick => "check_des(event);" %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
</div>
<div class="cl"></div>
<% end %>

View File

@ -0,0 +1,32 @@
<%= form_tag share_news_to_org_user_path(user), :remote => true, :id => 'orgs_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="sectionWrap fl mr15">
<ul class="fontGrey3 sectionContent">
<% unless orgs.empty? %>
<% orgs.each do |org| %>
<li>
<label>
<input type="radio" name="org_id" value="<%= org.id %>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id,:send_type => params[:send_type])%>')" class="mt3 fl mr5"/>
<span><%= org.name %></span></label>
</li>
<% end %>
<% end %>
</ul>
</div>
<div class="columnWrap">
<ul class="columnContent">
<%= render :partial => 'users/org_resources_subfield', :locals => {:subfield => nil} %>
</ul>
</div>
<div class="cl"></div>
<div class="orgDirection mb10 break_word" style="white-space: nowrap;-o-text-overflow:ellipsis;text-overflow: ellipsis;overflow: hidden">目标地址:</div>
<div class="courseSendSubmit mr15">
<%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();', :onclick => "check_des(event);" %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
</div>
<div class="cl"></div>
<% end %>

View File

@ -0,0 +1,25 @@
<%= form_tag add_exist_file_to_project_user_path(user, :type => defined? type ? "6" : type), :remote => true, :id => 'projects_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !projects.empty? %>
<% projects.each do |project| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="projects_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= project.name %></li>
</ul>
<% end %>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,25 @@
<%= form_tag share_message_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !projects.empty? %>
<% projects.each do |project| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="project_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= project.name%></li>
</ul>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>

View File

@ -0,0 +1,25 @@
<%= form_tag share_news_to_project_user_path(user), :remote => true, :id => 'projects_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !projects.empty? %>
<% projects.each do |project| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="project_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= project.name %></li>
</ul>
<% end %>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>

View File

@ -18,42 +18,6 @@
<% end %>
<div class="cl"></div>
</div>
<%= form_tag add_exist_file_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="sectionWrap fl mr15">
<ul class="fontGrey3 sectionContent">
<% unless @orgs.empty? %>
<% @orgs.each do |org|%>
<li>
<label>
<input type="radio" name="org_id" value="<%= org.id%>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id)%>')" class="mt3 fl mr5" />
<span><%= org.name%></span></label>
</li>
<%end%>
<%end%>
</ul>
</div>
<div class="columnWrap">
<ul class="columnContent">
<!--<span class="fontBlue pl10">请在左侧选择要转发的位置</span>-->
<!--<li style="background-color:#f1f1f1; color:#555555; padding-top:2px; padding-bottom:2px;">请选择栏目:</li>-->
<%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%>
<!--<li>-->
<!--<label>-->
<!--<input type="radio" name="sendColumn" class="mt3 fl mr5" />-->
<!--<span>动态</span></label>-->
<!--</li>-->
</ul>
</div>
<div class="cl"></div>
<div class="orgDirection mb10 break_word" style="white-space: nowrap;-o-text-overflow:ellipsis;text-overflow: ellipsis;overflow: hidden">目标地址:</div>
<div class="courseSendSubmit mr15">
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
</div>
<div class="cl"></div>
<%end %>
<div id="org_file_form">
<%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids, :type => type} %>
</div>

View File

@ -24,31 +24,8 @@
<%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %>
<% end %>
</div>
<%= form_tag add_exist_file_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !projects.empty? %>
<% projects.each do |project| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="projects_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= project.name%></li>
</ul>
<% end %>
</div>
<div id="project_file_form">
<%= render :partial => 'users/project_file_form', :locals => {:user => user, :projects => projects, :send_id => send_id, :send_ids => send_ids, :type => type} %>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>
</div>

View File

@ -26,31 +26,8 @@
<%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %>
<% end %>
</div>
<%= form_tag add_exist_file_to_course_user_path(user),:remote=>true,:id=>'course_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !courses.empty? %>
<% courses.each do |course| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%></li>
</ul>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>
<div id="course_file_form">
<%= render :partial => "users/course_file_form", :locals => {:user => user, :send_id => send_id, :send_ids => send_ids, :courses => courses, :type => type} %>
</div>
</div>

View File

@ -26,14 +26,170 @@
<% end %>
<% end %>
<ul class="resource-list">
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" id="contextMenu">
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)preview();" onfocus="this.blur()">预览</a></li>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)rename();" onfocus="this.blur()">重命名</a></li>
<!-- data-remote="true" 这个属性会让ajax请求状态标志就在当前按钮的上方显示就不会滚动浏览器因而弹出框也会在当前窗口中央展示-->
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)show_send_();" data-remote="true" onfocus="this.blur()" >发送</a></li>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)delete_file();" onfocus="this.blur()">删除</a></li>
</ul>
</ul>
<script>
function show_upload(){
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'upload_resource' ,:locals => {:user=>User.current.id,:type=>@type,:status=>@status})%>');
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal();' style='margin-left: 435px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top","50%").css("left","50%").css("position","absolute");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
}
//批量删除
function batch_delete(){
var data = $("#resources_list_form").serialize();
if($("input[type=checkbox][data-has-history=Y]:checked").length != 0){
alert("您只能删除没有历史记录的资源,请重新选择后再删除。");
return;
}
if($("input[type=checkbox][data-deleteble=N]:checked").length != 0){
alert("您只能删除自己上传的资源,请重新选择后再删除。");
return;
}
if(data != "" && confirm('确认要删除这些资源吗?')) {
$.post(
'<%= user_resource_delete_user_path(User.current.id,:type=>@type,:status=>@status)%>',
$("#resources_list_form").serialize(),//只会对选中的控件进行序列化提交
function (data) {
}
);
}
}
function show_send(){
$("#contextMenu").hide();
document.oncontextmenu = function() {return true;}
line.children().css("background-color",'white');
id = line.children().last().html();
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(User.current.id) %>' + "?send_id=" + id + "&type=<%= @type %>",
data:{send_type:'file'}
});
}else{
$.ajax({
type: 'get',
url: '<%= search_user_course_user_path(User.current.id)%>' + "?send_id=" + id + "&type=<%= @type %>",
data:{send_type:'file'}
});
}
}
function batch_send(){
if($("#resources_list_form").serialize() == ""){
alert('暂时不支持多页选择,您当前页没有选择任何资源');
return ;
}
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(User.current.id)%>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type%>",
data:{send_type:'file'}
});
}else{
$.ajax({
type: 'get',
url: '<%= search_user_course_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type%>",
data:{send_type:'file'}
});
}
}
function preview(){
$("#contextMenu").hide();
document.oncontextmenu = function() {return true;}
line.children().css("background-color",'white');
id = line.children().last().html();
$.ajax({
type:'get',
url:'<%= resource_preview_user_path(User.current.id)%>'+"?resource_id="+id
});
}
String.prototype.trim = function() {
var str = this,
str = str.replace(/^\s\s*/, ''),
ws = /\s/,
i = str.length;
while (ws.test(str.charAt(--i)));
return str.slice(0, i + 1);
}
//恢复编辑状态到链接状态
//如果当前是编辑状态,任何的不在输入框里的单击右键事件都需要将编辑状态变回链接状态
//如果是编辑状态,且做了修改,那么久要进行修改,并且将修改值经过处理替换到页面显示
function restore(){
//上一行不为空 且链接不为空
if( last_line != null && res_link != null && res_link != '') {
name = $("#res_name").lenght != 0 && $("#res_name").val() != undefined ? $("#res_name").val().trim() : undefined ;
if (name == undefined || name === 'undefined' ){ //只要res_name没有值那么就不是编辑状态
return;
}
if( name && name != res_name.trim()){
if(confirm('确定修改为 '+name)){
$.ajax({
url: '<%=rename_resource_user_path(User.current.id) %>'+ "?res_name="+$('#res_name').val() + "&res_id=" + $("#res_id").val(),
type:'get',
success:function (data)
{
if (data != 'fail' && name != undefined && name != 'undefined') {//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变
last_line.children().eq(1).html(res_link);
last_line.children().eq(1).children().attr('title', name);
last_line.children().eq(1).children().attr('href', data);
last_line.children().eq(1).children().html(name.length > 17 ? name.substring(0, 17) + '...' : name);
} else {
last_line.children().eq(1).html(res_link);
res_link = null; //如果修改失败恢复之后将res_link置空
}
}
} );
}else{
last_line.children().eq(1).html(res_link);
res_link = null; //如果没有做修改恢复之后将res_link置空
}
}else {
last_line.children().eq(1).html(res_link);
res_link = null;//如果没有做修改恢复之后将res_link置空
}
}
}
function delete_file() {
$("#contextMenu").hide();
document.oncontextmenu = function () {
return true;
}
line.children().css("background-color", 'white');
id = line.children().last().html();
user_id = line.children().eq(5).html();
if(line.children().first().children().data('hasHistory') == 'Y'){
alert('该资源存在历史版本,不能删除');
return;
}
if(user_id === '<%= User.current.id%>') {
if (confirm('确定要删除资源"' + line.children().eq(1).children().attr('title').trim() + '"么?')) {
$.ajax({
type: 'post',
url: '<%= user_resource_delete_user_path(User.current.id)%>' + '?resource_id=' + id + '&type=<%=@type %>&status=<%=@status %>'
});
}
}else{
alert('您无法删除此资源!')
}
}
</script>

View File

@ -26,31 +26,8 @@
<%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %>
<% end %>
</div>
<%= form_tag share_message_to_course_user_path(user),:remote=>true,:id=>'course_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !courses.empty? %>
<% courses.each do |course| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%></li>
</ul>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>
</div>
<div id="course_message_form">
<%= render :partial => 'users/course_message_form', :locals => {:user => user, :courses => courses, :send_id => send_id, :send_ids => send_ids} %>
</div>
</div>

View File

@ -18,42 +18,6 @@
<% end %>
<div class="cl"></div>
</div>
<%= form_tag share_message_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="sectionWrap fl mr15">
<ul class="fontGrey3 sectionContent">
<% unless @orgs.empty? %>
<% @orgs.each do |org|%>
<li>
<label>
<input type="radio" name="org_id" value="<%= org.id%>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id,:send_type => params[:send_type])%>')" class="mt3 fl mr5" />
<span><%= org.name%></span></label>
</li>
<%end%>
<%end%>
</ul>
</div>
<div class="columnWrap">
<ul class="columnContent">
<!--<span class="fontBlue pl10">请在左侧选择要转发的位置</span>-->
<!--<li style="background-color:#f1f1f1; color:#555555; padding-top:2px; padding-bottom:2px;">请选择栏目:</li>-->
<%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%>
<!--<li>-->
<!--<label>-->
<!--<input type="radio" name="sendColumn" class="mt3 fl mr5" />-->
<!--<span>动态</span></label>-->
<!--</li>-->
</ul>
</div>
<div class="cl"></div>
<div class="orgDirection mb10 break_word" style="white-space: nowrap;-o-text-overflow:ellipsis;text-overflow: ellipsis;overflow: hidden">目标地址:</div>
<div class="courseSendSubmit mr15">
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
</div>
<div class="cl"></div>
<%end %>
<div id="org_message_form">
<%= render :partial => 'users/org_message_form',:locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids} %>
</div>

View File

@ -24,30 +24,8 @@
<%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %>
<% end %>
</div>
<%= form_tag share_message_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !projects.empty? %>
<% projects.each do |project| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="project_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= project.name%></li>
</ul>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>
</div>
<div id="project_message_form">
<%= render :partial => 'users/project_message_form', :locals => {:projects => projects, :user => user, :send_id => send_id, :send_ids => send_ids} %>
</div>
</div>

View File

@ -26,31 +26,8 @@
<%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %>
<% end %>
</div>
<%= form_tag share_news_to_course_user_path(user),:remote=>true,:id=>'course_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !courses.empty? %>
<% courses.each do |course| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%></li>
</ul>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>
</div>
<div id="course_news_form">
<%= render :partial => 'users/course_news_form',:locals => {:user => user, :courses => courses, :send_id => send_id, :send_ids => send_ids} %>
</div>
</div>

View File

@ -18,42 +18,6 @@
<% end %>
<div class="cl"></div>
</div>
<%= form_tag share_news_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="sectionWrap fl mr15">
<ul class="fontGrey3 sectionContent">
<% unless @orgs.empty? %>
<% @orgs.each do |org|%>
<li>
<label>
<input type="radio" name="org_id" value="<%= org.id%>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id,:send_type => params[:send_type])%>')" class="mt3 fl mr5" />
<span><%= org.name%></span></label>
</li>
<%end%>
<%end%>
</ul>
</div>
<div class="columnWrap">
<ul class="columnContent">
<!--<span class="fontBlue pl10">请在左侧选择要转发的位置</span>-->
<!--<li style="background-color:#f1f1f1; color:#555555; padding-top:2px; padding-bottom:2px;">请选择栏目:</li>-->
<%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%>
<!--<li>-->
<!--<label>-->
<!--<input type="radio" name="sendColumn" class="mt3 fl mr5" />-->
<!--<span>动态</span></label>-->
<!--</li>-->
</ul>
</div>
<div class="cl"></div>
<div class="orgDirection mb10 break_word" style="white-space: nowrap;-o-text-overflow:ellipsis;text-overflow: ellipsis;overflow: hidden">目标地址:</div>
<div class="courseSendSubmit mr15">
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
</div>
<div class="cl"></div>
<%end %>
<div id="org_news_form">
<%= render :partial => 'users/org_news_form', :locals => {:orgs => @orgs, :user => user,:send_id => send_id, :send_ids => send_ids} %>
</div>

View File

@ -24,31 +24,8 @@
<%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %>
<% end %>
</div>
<%= form_tag share_news_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !projects.empty? %>
<% projects.each do |project| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="project_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= project.name%></li>
</ul>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>
</div>
<div id="project_news_form">
<%= render :partial => 'users/project_news_form', :locals => {:user => user, :projects => projects, :send_id => send_id, :send_ids => send_ids} %>
</div>
</div>

View File

@ -37,6 +37,16 @@
<!--<div id="upload_box" style="display: none">-->
<!--<%#= render :partial => 'upload_resource' ,:locals => {:user=>@user}%>-->
<!--</div>-->
<ul class="resource-list">
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" id="contextMenu">
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)preview();" onfocus="this.blur()">预览</a></li>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)rename();" onfocus="this.blur()">重命名</a></li>
<!-- data-remote="true" 这个属性会让ajax请求状态标志就在当前按钮的上方显示就不会滚动浏览器因而弹出框也会在当前窗口中央展示-->
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)show_send();" onfocus="this.blur()" >发送</a></li>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)delete_file();" onfocus="this.blur()">删除</a></li>
</ul>
</ul>
<script>
var pageX = 0;
var pageY = 0;
@ -197,93 +207,6 @@
$("#res_count").html(0);
}
}
function show_upload(){
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'upload_resource' ,:locals => {:user=>User.current.id,:type=>@type,:status=>@status})%>');
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal();' style='margin-left: 435px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top","50%").css("left","50%").css("position","absolute");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
}
//批量删除
function batch_delete(){
var data = $("#resources_list_form").serialize();
if($("input[type=checkbox][data-has-history=Y]:checked").length != 0){
alert("您只能删除没有历史记录的资源,请重新选择后再删除。");
return;
}
if($("input[type=checkbox][data-deleteble=N]:checked").length != 0){
alert("您只能删除自己上传的资源,请重新选择后再删除。");
return;
}
if(data != "" && confirm('确认要删除这些资源吗?')) {
$.post(
'<%= user_resource_delete_user_path(User.current.id,:type=>@type,:status=>@status)%>',
$("#resources_list_form").serialize(),//只会对选中的控件进行序列化提交
function (data) {
}
);
}
}
function show_send_(){
$("#contextMenu").hide();
document.oncontextmenu = function() {return true;}
line.children().css("background-color",'white');
id = line.children().last().html();
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(User.current.id)%>' + '?send_id=' + id,
data:{send_type:'file'}
});
}else{
$.ajax({
type: 'get',
url: '<%= search_user_course_user_path(User.current.id)%>' + '?send_id=' + id,
data:{send_type:'file'}
});
}
}
function batch_send(){
if($("#resources_list_form").serialize() == ""){
alert('暂时不支持多页选择,您当前页没有选择任何资源');
return ;
}
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(User.current.id)%>' + '?' + $("#resources_list_form").serialize(),
data:{send_type:'file'}
});
}else{
$.ajax({
type: 'get',
url: '<%= search_user_course_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize(),
data:{send_type:'file'}
});
}
}
function preview(){
$("#contextMenu").hide();
document.oncontextmenu = function() {return true;}
line.children().css("background-color",'white');
id = line.children().last().html();
$.ajax({
type:'get',
url:'<%= resource_preview_user_path(User.current.id)%>'+"?resource_id="+id
});
}
function rename(){
$("#contextMenu").hide();
document.oncontextmenu = function() {return true;}
@ -299,88 +222,10 @@
' onkeypress="if(event.keyCode==13){event.preventDefault();this.blur();}" ' +
'value="'+res_name+
'"/> <input type="hidden" id ="res_id" name="res_id" value="'+id+'"/>');
alert("test");
$("#res_name").focus();
$("html,body").animate({scrollTop:$("#res_name").offset().top},1000)
}else{
alert('您无法修改此资源!')
}
}
String.prototype.trim = function() {
var str = this,
str = str.replace(/^\s\s*/, ''),
ws = /\s/,
i = str.length;
while (ws.test(str.charAt(--i)));
return str.slice(0, i + 1);
}
//恢复编辑状态到链接状态
//如果当前是编辑状态,任何的不在输入框里的单击右键事件都需要将编辑状态变回链接状态
//如果是编辑状态,且做了修改,那么久要进行修改,并且将修改值经过处理替换到页面显示
function restore(){
//上一行不为空 且链接不为空
if( last_line != null && res_link != null && res_link != '') {
name = $("#res_name").lenght != 0 && $("#res_name").val() != undefined ? $("#res_name").val().trim() : undefined ;
if (name == undefined || name === 'undefined' ){ //只要res_name没有值那么就不是编辑状态
return;
}
if( name && name != res_name.trim()){
if(confirm('确定修改为 '+name)){
$.ajax({
url: '<%=rename_resource_user_path(User.current.id) %>'+ "?res_name="+$('#res_name').val() + "&res_id=" + $("#res_id").val(),
type:'get',
success:function (data)
{
if (data != 'fail' && name != undefined && name != 'undefined') {//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变
last_line.children().eq(1).html(res_link);
last_line.children().eq(1).children().attr('title', name);
last_line.children().eq(1).children().attr('href', data);
last_line.children().eq(1).children().html(name.length > 17 ? name.substring(0, 17) + '...' : name);
} else {
last_line.children().eq(1).html(res_link);
res_link = null; //如果修改失败恢复之后将res_link置空
}
}
} );
}else{
last_line.children().eq(1).html(res_link);
res_link = null; //如果没有做修改恢复之后将res_link置空
}
}else {
last_line.children().eq(1).html(res_link);
res_link = null;//如果没有做修改恢复之后将res_link置空
}
}
}
function delete_file() {
$("#contextMenu").hide();
document.oncontextmenu = function () {
return true;
}
line.children().css("background-color", 'white');
id = line.children().last().html();
user_id = line.children().eq(5).html();
if(line.children().first().children().data('hasHistory') == 'Y'){
alert('该资源存在历史版本,不能删除');
return;
}
if(user_id === '<%= User.current.id%>') {
if (confirm('确定要删除资源"' + line.children().eq(1).children().attr('title').trim() + '"么?')) {
$.ajax({
type: 'post',
url: '<%= user_resource_delete_user_path(User.current.id)%>' + '?resource_id=' + id + '&type=<%=@type %>&status=<%=@status %>'
});
}
}else{
alert('您无法删除此资源!')
}
}
</script>

View File

@ -1,6 +1,7 @@
<% if @flag == true%>
$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>');
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);

View File

@ -1,6 +1,7 @@
<% if @flag == true%>
$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>');
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);

View File

@ -1,6 +1,7 @@
<% if @flag == true%>
$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>');
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);

View File

@ -9,18 +9,28 @@
//$("#upload_box").css('left','').css('top','');
//$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
//$("#upload_box").css('display','block');
<% if params[:send_type].present? && params[:send_type] == 'news' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
<% elsif params[:send_type] == 'file' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
<% elsif params[:send_type] == 'message' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,:locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
<% if params[:is_observe].nil? %>
<% if params[:send_type].present? && params[:send_type] == 'news' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
<% elsif params[:send_type] == 'file' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids, :type=>@type}) %>');
<% elsif params[:send_type] == 'message' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,:locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
<% end %>
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top","50%").css("left","50%");
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
var val = $("#search_course_input").val();
$("#search_course_input").val("").focus().val(val);
<% else %>
<% if params[:send_type] == 'news' %>
$("#course_news_form").html("<%= escape_javascript(render :partial => 'users/course_news_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>")
<% elsif params[:send_type] == 'file' %>
$("#course_file_form").html("<%= escape_javascript(render :partial => 'users/course_file_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>");
<% elsif params[:send_type] == 'message' %>
$("#course_message_form").html("<%= escape_javascript(render :partial => 'users/course_message_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>");
<% end %>
<% end %>
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top","50%").css("left","50%");
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
var val = $("#search_course_input").val();
$("#search_course_input").val("").focus().val(val);

View File

@ -1,7 +1,8 @@
<% if params[:is_observe].nil? %>
<% if params[:send_type].present? && params[:send_type] == 'news' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
<% elsif params[:send_type] == 'file' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids,:type => @type})%>');
<% elsif params[:send_type] == 'message' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
<% end %>
@ -12,4 +13,13 @@ $('#ajax-modal').parent().css("top","50%").css("left","50%");
$('#ajax-modal').parent().addClass("popbox").addClass("shareDP");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
var val = $("#search_org_input").val();
$("#search_org_input").val("").focus().val(val);
$("#search_org_input").val("").focus().val(val);
<% else %>
<% if params[:send_type] == 'news' %>
$("#org_news_form").html("<%= escape_javascript(render :partial => 'users/org_news_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>");
<% elsif params[:send_type] == 'file' %>
$("#org_file_form").html("<%= escape_javascript(render :partial => 'users/org_file_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>");
<% elsif params[:send_type] == 'message' %>
$("#org_message_form").html("<%= escape_javascript(render :partial => 'users/org_message_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>");
<% end %>
<% end %>

View File

@ -1,7 +1,8 @@
<% if params[:is_observe].nil? %>
<% if params[:send_type].present? && params[:send_type] == 'news' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
<% elsif params[:send_type] == 'file' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids,:type => @type}) %>');
<% elsif params[:send_type] == 'message' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
<% end %>
@ -14,3 +15,12 @@ $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
//$("#search_project_input").focus();
var val = $("#search_project_input").val();
$("#search_project_input").val("").focus().val(val);
<% else %>
<% if params[:send_type] == 'news' %>
$("#project_news_form").html("<%= escape_javascript(render :partial => 'users/project_news_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>");
<% elsif params[:send_type] == 'file' %>
$("#project_file_form").html("<%= escape_javascript(render :partial => 'users/project_file_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>");
<% elsif params[:send_type] == 'message' %>
$("#project_message_form").html("<%= escape_javascript(render :partial => 'users/project_message_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>");
<% end %>
<% end %>

View File

@ -1,15 +1,15 @@
closeModal();
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#res_all_count").html(<%= @atta_count%>);
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
//更新状态
$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>');
$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>');
$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>');
$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>');
$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>');
$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>');
closeModal();
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
$("#res_all_count").html(<%= @atta_count%>);
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
//更新状态
$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>');
$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>');
$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>');
$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>');
$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>');
$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>');
$("#resource_type_file").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 4, :search => @switch_search) %>');

View File

@ -1,14 +1,14 @@
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#res_all_count").html(<%= @atta_count%>);
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
//更新状态
$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>');
$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>');
$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>');
$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>');
$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>');
$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>');
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
$("#res_all_count").html(<%= @atta_count%>);
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
//更新状态
$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>');
$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>');
$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>');
$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>');
$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>');
$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>');
$("#resource_type_file").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 4, :search => @switch_search) %>');

View File

@ -0,0 +1,17 @@
class UpdateOneStudentTeacherScore < ActiveRecord::Migration
def up
work = StudentWork.find 49774
score = StudentWorksScore.new
score.score = 100
score.user_id = 7318
score.student_work_id = work.id
score.reviewer_role = 1
if score.save
work.teacher_score = score.score
end
work.save
end
def down
end
end

View File

@ -163,11 +163,17 @@ module Redmine
# :per_page_links if set to false, the "Per page" links are not rendered
#
def pagination_links_full(*args)
page = ""
pagination_links_each(*args) do |text, parameters, options|
if block_given?
yield text, parameters, options
else
link_to text, params.merge(parameters), options
if args[2][:path].nil?
link_to text, params.merge(parameters), options
else
page = "&page" + parameters[:page].to_s unless parameters[:page].nil?
link_to text, args[2][:path].to_s + page, options
end
end
end
end

View File

@ -1055,7 +1055,7 @@ function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) {
$.ajax({
url: url,
type: 'get',
data: {search: $this.val(),send_id:send_id,send_ids:send_ids, send_type:send_type},
data: {search: $this.val(),send_id:send_id,send_ids:send_ids, send_type:send_type, is_observe:true},
success: function(data){ },
beforeSend: function(){ $this.addClass('ajax-loading'); },
complete: function(){ $this.removeClass('ajax-loading'); }
@ -1065,10 +1065,10 @@ function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) {
var reset = function() {
if (timer) {
clearInterval(timer);
timer = setInterval(check, 300);
timer = setInterval(check, 500);
}
};
var timer = setInterval(check, 300);
var timer = setInterval(check, 500);
$this.bind('keyup click mousemove', reset);
});
}

View File

@ -426,7 +426,7 @@ $(function(){
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M否则会返回错误\n\
//3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),空格用□表示\n\
//3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),每行末尾的所有空格用□表示\n\
import java.io.*;\n\
import java.util.*;\n\
\n\
@ -450,7 +450,7 @@ class Main\n\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M否则会返回错误\n\
//3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),空格用□表示\n\
//3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),每行末尾的所有空格用□表示\n\
#include <stdio.h>\n\
int main()\n\
{\n\
@ -470,7 +470,7 @@ src = '\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M否则会返回错误\n\
//3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),空格用□表示\n\
//3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),每行末尾的所有空格用□表示\n\
#include <iostream>\n\
using namespace std;\n\
\n\