diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 15d731634..52fdad2e7 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2705,7 +2705,7 @@ class UsersController < ApplicationController # 获取公共资源搜索 def get_public_resources_search user_course_ids, user_project_ids, order, score, search - attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)" ,:p => search).order("#{order.nil? ? 'created_on' : order} #{score}") + attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取我的资源 @@ -2816,7 +2816,7 @@ class UsersController < ApplicationController # 获取我的用户类型资源 def get_principal_resources_public order, score - attchments = Attachment.where("container_type = 'Principal'and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}") + attchments = Attachment.where("container_type = 'Principal' and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取我的用户类型资源 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6e0f70313..8d9c9733e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -49,6 +49,21 @@ module ApplicationHelper return result end + # 判断某个资源是否可以申请 + def attach_show_allow attach_id + attachment = Attachment.find(attach_id) + case attachment.container_type + when "Project" + User.current.member_of?(attachment.container) ? true : false + when "Course" + User.current.member_of_course?(attachment.container) ? true : false + when "OrgSubfield" + User.current.member_of_org?(attachment.container) ? true : false + when "Principal" + User.current.id == attachment.author_id ? true : false + end + end + # Time 2015-03-24 15:27:29 # Author lizanle # Description 从硬盘上删除对应的资源文件 diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb index 7d8f7963f..ecb5ebb25 100644 --- a/app/views/organizations/_show_home_page.html.erb +++ b/app/views/organizations/_show_home_page.html.erb @@ -59,7 +59,7 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); - autoUrl('intro_content_<%= @document.id %>'); + autoUrl('intro_content_<%= document.id %>'); function expand_reply(container, btnid) { var target = $(container); var btn = $(btnid); diff --git a/app/views/users/_apply_resource_course_message_reply.html.erb b/app/views/users/_apply_resource_course_message_reply.html.erb index 617ee53c3..2aff99c17 100644 --- a/app/views/users/_apply_resource_course_message_reply.html.erb +++ b/app/views/users/_apply_resource_course_message_reply.html.erb @@ -7,10 +7,10 @@
  • <%= link_to owner.show_name, user_path(owner), :class => "newsBlue homepageNewsPublisher" %> - "><%= ma.apply_result == 1 ? '同意' : '拒绝'%>引用资源: + "><%= ma.apply_result == 2 ? '同意' : '拒绝'%>引用资源:
  • - <% link_str = ma.apply_result == 1 ? + <% link_str = ma.apply_result == 2 ? '您申请引用资源"'+ ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename) + '"的申请已通过' : '您申请引用资源"'+ ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename) + '"的申请被婉拒' %> diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 3397d5929..5dd2495c9 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -6,7 +6,7 @@ <% attachments.each do |attach| %>
    @@ -66,14 +71,15 @@ //批量删除 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($("input[type=checkbox][data-has-history=Y]:checked").length != 0){ + alert("您只能删除没有历史记录的资源,请重新选择后再删除。"); + return; + } + if(data != "" && confirm('确认要删除这些资源吗?')) { $.post( @@ -96,7 +102,8 @@ is_public = line.children().eq(11).html(); user_id = line.children().eq(6).html(); apply_status = line.children().eq(12).html(); - if(is_public == 0 && user_id != '<%= User.current.id %>' && apply_status != 2){ + allow = line.children().eq(13).html(); + if(is_public == 0 && user_id != '<%= User.current.id %>' && apply_status != 2 && allow == 1){ alert('您无权发送私有资源') }else{ if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index d39cccb11..47d5145ac 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -88,8 +88,8 @@ <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %> <% replies_all_i = replies_all_i + 1 %> @@ -121,7 +121,7 @@ <% end %> -
    +
    <%= comment.notes.html_safe %>
    diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb index c066baae0..4a7e5cee3 100644 --- a/app/views/users/new_user_commit_homework.html.erb +++ b/app/views/users/new_user_commit_homework.html.erb @@ -93,13 +93,13 @@
    请使用 <%= @homework.language_name %> 语言编写 <% if @homework.language.to_i == 1 %> - 编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC) + 编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC) <% elsif @homework.language.to_i == 2 %> - 编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC) + 编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC) <% elsif @homework.language.to_i == 3 %> - 编译器信息:Python version "2.6.6" + 编译器信息:Python version "2.6.6" <% elsif @homework.language.to_i == 4 %> - 编译器信息:java version "1.7.0_85" OpenJDK Runtime Environment + 编译器信息:java version "1.7.0_85" OpenJDK Runtime Environment <% end %> style="display-hidden" id="data-language">
    diff --git a/app/views/users/user_commit_homework.html.erb b/app/views/users/user_commit_homework.html.erb index 043886779..1d1d0ef14 100644 --- a/app/views/users/user_commit_homework.html.erb +++ b/app/views/users/user_commit_homework.html.erb @@ -76,13 +76,13 @@
    请使用 <%= @homework.language_name %> 语言编写 <% if @homework.language.to_i == 1 %> - 编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC) + 编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC) <% elsif @homework.language.to_i == 2 %> - 编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC) + 编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC) <% elsif @homework.language.to_i == 3 %> - 编译器信息:Python version "2.6.6" + 编译器信息:Python version "2.6.6" <% elsif @homework.language.to_i == 4 %> - 编译器信息:java version "1.7.0_85" OpenJDK Runtime Environment + 编译器信息:java version "1.7.0_85" OpenJDK Runtime Environment <% end %>
    diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index c86a9ccd3..a8c17345b 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -249,7 +249,7 @@ K.options = { themeType : 'default', langType : 'zh_CN', urlType : '', - newlineTag : 'br', + newlineTag : 'p', resizeType : 1, syncType : 'form', pasteType : 2, diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 3828b981b..aec0af070 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1316,17 +1316,12 @@ function pop_up_box(value,tWidth,tTop,tLeft){ } } - //yk 自动识别URL 并加上链接 -//var strRegex = '((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+([a-z]{3}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?'; - function autoUrl(id){ if ($("#"+id).children().length > 0 ){ $("#"+id+" p,#"+ id +" span,#"+id+" em,#"+id+" h1,#"+id+" h2,#"+id+" h3,#"+id+" h4,#"+id+" strong,#"+id+" b,#"+id+" font,#"+id+" i").each(function(){ if ($(this).children().length == 0){ - var html = $(this).text(); //.replace(/(^\s*)|(\s*$)/g, "") - console.log("html="+html); -// var re=new RegExp(strRegex,"g"); + var html = $(this).text(); html = html.replace(/((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+([a-z]{3}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?/g,function(full) { //没有://的都加上http:// var reStr = full; @@ -1337,7 +1332,6 @@ function autoUrl(id){ else{ reStr = ""+full+""; } - console.log("reStr="+reStr); } return reStr ; }); @@ -1346,11 +1340,9 @@ function autoUrl(id){ }); } else{ - var html = $("#"+id).text(); //.replace(/(^\s*)|(\s*$)/g, "") - console.log("!!!!html="+html); -// var re=new RegExp(strRegex,"g"); + var html = $("#"+id).text(); html = html.replace(/((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+([a-z]{3}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?/g,function(full) { - //没有://的都加上http:// + //没有://的都加上http:// var reStr = full; if (full.length > 0){ if (full.indexOf("://") >= 0){ @@ -1359,7 +1351,6 @@ function autoUrl(id){ else{ reStr = ""+full+""; } - console.log("reStr="+reStr); } return reStr ; }); diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 326d2897b..cfdf12153 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -609,7 +609,7 @@ a.homepageMenuControl {float:left; width:180px;} .NewsBannerName {font-size:16px; color:#4b4b4b; display:block; width:150px; float:left;} .newsType {width:60px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:5px 10px; left:-40px; font-size:12px; color:#888888; display:none; line-height:2; z-index:9999;} .newsReadSetting {width:700px; background-color:#f6f6f6; border-bottom:1px solid #eeeeee; margin:10px auto; height:39px; line-height:39px; vertical-align:middle; font-size:14px; color:#7a7a7a; padding-left:10px;} -.homepageNewsList {width:710px; height:49px; line-height:49px; vertical-align:middle; border-bottom:1px dashed #eaeaea; margin-left:10px;} +.homepageNewsList {width:710px; height:49px; line-height:49px; vertical-align:middle; border-bottom:1px dashed #eaeaea; } .homepageNewsPortrait {width:40px; display:block; margin-top:7px;} .homepageNewsPublisher { max-width:100px; font-size:12px; color:#269ac9; display:block; padding-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; } .homepageNewsType {padding-left: 5px; font-size:12px; color:#888888; display:block;}