From 7da1418069e09e002efd311a7d6e371690f6280f Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 19 May 2016 16:24:57 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=AF=86=E5=88=ABURL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_intro_content.html.erb | 5 ++- public/javascripts/application.js | 54 +++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/app/views/users/_intro_content.html.erb b/app/views/users/_intro_content.html.erb index 351f1fdb0..ead3f6713 100644 --- a/app/views/users/_intro_content.html.erb +++ b/app/views/users/_intro_content.html.erb @@ -1,6 +1,6 @@
- <%= content.to_s.html_safe%> + <%= content.to_s.html_safe %>
\ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index d9f532a48..6023542f3 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1291,3 +1291,57 @@ function pop_up_box(value,tWidth,tTop,tLeft){ } +//yk 自动识别URL 并加上链接 +var strRegex = '((https|http|ftp|rtsp|mms)?://)' + + '?(([0-9a-z_!~*\'().&=+$%-]+: )?[0-9a-z_!~*\'().&=+$%-]+@)?' //ftp的user@ + + '(([0-9]{1,3}.){3}[0-9]{1,3}' // IP形式的URL- 199.194.52.184 + + '|' // 允许IP和DOMAIN(域名) + + '([0-9a-z_!~*\'()-]+.)*' // 域名- www. + + '([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].' // 二级域名 + + '[a-z]{2,6})' // first level domain- .com or .museum + + '(:[0-9]{1,4})?' // 端口- :80 + + '((/?)|' // a slash isn't required if there is no file name + + '(/[0-9a-z_!~*\'().;?:@&=+$,%#-]+)+/?)'; + +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"); + html = html.replace(re,function(full) { + //没有://的都加上http:// + if (full.indexOf("://") >= 0){ + var reStr = ""+full+""; + } + else{ + var reStr = ""+full+""; + } + console.log("reStr="+reStr); + return reStr; + }); + $(this).html(html); + } + }); + } + else{ + var html = $("#"+id).text(); //.replace(/(^\s*)|(\s*$)/g, "") + console.log("html="+html); + var re=new RegExp(strRegex,"g"); + html = html.replace(re,function(full) { + //没有://的都加上http:// + if (full.indexOf("://") >= 0){ + var reStr = ""+full+""; + } + else{ + var reStr = ""+full+""; + } + console.log("reStr="+reStr); + return reStr; + }); + $("#"+id).html(html); + } +} + + From ed58e780656d1e967158b5f236869f5bd8c4862c Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 19 May 2016 16:38:48 +0800 Subject: [PATCH 2/4] =?UTF-8?q?KE=E8=A1=A8=E6=A0=BC=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/new_user.css | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index f79b3ca02..db2974e01 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -672,6 +672,7 @@ a.postTypeGrey:hover {color:#269ac9;} .homepagePostDes {float:left; width:655px; margin-left:15px; overflow:hidden;} .homepagePostTo {font-size:14px; color:#484848; margin-bottom:5px;} .homepagePostTitle {font-size:14px; color:#484848; margin-bottom:5px; font-weight:bold;} +.homepagePostTitle td,.homepagePostTitle tr {border: 1px solid; border-color: inherit;} .homepagePostSubmitContainer {height:25px; margin-top: 8px; margin-bottom: 5px;} .homepagePostSubmit {font-size:14px; color:#888888; border:1px solid #dddddd; background-color:#eaeaea; float:left; margin-right:20px; padding:0px 10px;} .homepagePostSubmit:hover {background-color:#d8d8d8;} @@ -681,10 +682,9 @@ a.postTypeGrey:hover {color:#269ac9;} .homepagePostReply {width:720px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;} .homepagePostIntro ol li{list-style-type: decimal;margin-left: 40px;} .homepagePostIntro ul li{list-style-type: disc;margin-left: 40px;} +.homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;} .homepagePostReplyBanner {width:718px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;} - .borderBottomNone {border-bottom:none !important;} -.homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;} .homepagePostReplyBanner {width:718px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;} .borderBottomNone {border-bottom:none !important;} .topBorder {border-top: 1px solid #e4e4e4;} @@ -721,6 +721,7 @@ a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyContent {font-size:12px; color:#484848; margin:3px 5px 12px 5px;font: 14px/1.5 "sans serif",tahoma,verdana,helvetica;font-family:"微软雅黑","宋体";} .homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 40px;} .homepagePostReplyContent ul li{list-style-type: disc;margin-left: 40px;} +.homepagePostReplyContent td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;} .table_maxWidth table {max-width: 642px;} .homepagePostProjectState {width:52px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;} .homepagePostAssignTo {float:left; font-size:14px; color:#269ac9;} @@ -864,7 +865,7 @@ a.sortArrowActiveU {background:url(images/post_image_list.png) -17px -20px no-re .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} .postDetailDes ol li{list-style-type: decimal;margin-left: 40px;} .postDetailDes ul li{list-style-type: disc;margin-left: 40px;} -.postDetailDes td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;} +.postDetailDes td,.postDetailDes tr {border: 1px solid; border-color: inherit;} .homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; } /*line-height: 18px !important;*/ .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} From 0dd7aae08c9258f933211c15122ac71b96211d0a Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 19 May 2016 16:39:23 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=85=88=E6=B3=A8=E9=87=8A=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E8=AF=86=E5=88=ABURL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_intro_content.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_intro_content.html.erb b/app/views/users/_intro_content.html.erb index ead3f6713..050720b6c 100644 --- a/app/views/users/_intro_content.html.erb +++ b/app/views/users/_intro_content.html.erb @@ -14,7 +14,7 @@ $(this).html(postContent); }); - autoUrl('intro_content_<%= user_activity_id%>'); +// autoUrl('intro_content_<%#= user_activity_id%>'); description_show_hide(<%=user_activity_id %>); }); From ded5f8f86105d3f4c592c58d99d3c9b11a5cd403 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 20 May 2016 15:30:25 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=AD=E6=98=BE?= =?UTF-8?q?=E7=A4=BAKE=E5=86=85=E5=AE=B9=E7=9A=84=E5=9C=B0=E6=96=B9?= =?UTF-8?q?=E9=83=BD=E5=8A=A0=E4=B8=8A=E8=87=AA=E5=8A=A8=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E7=BD=91=E5=9D=80=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blog_comments/show.html.erb | 2 + app/views/courses/syllabus.html.erb | 2 + app/views/forums/_show_topics.html.erb | 8 ++- app/views/issues/_detail.html.erb | 11 +++- app/views/issues/_issue_replies.html.erb | 1 + app/views/memos/show.html.erb | 4 +- app/views/messages/_course_show.html.erb | 2 + .../messages/_org_subfield_show.html.erb | 2 + app/views/messages/_project_show.html.erb | 2 + app/views/news/_course_show.html.erb | 2 + app/views/news/_organization_show.html.erb | 2 + app/views/news/_project_show.html.erb | 2 + app/views/org_document_comments/show.html.erb | 2 + .../_org_course_homework.html.erb | 1 + .../_org_course_message.html.erb | 1 + .../organizations/_org_course_news.html.erb | 1 + .../organizations/_org_project_issue.html.erb | 1 + .../_org_subfield_message.html.erb | 1 + .../organizations/_org_subfield_news.html.erb | 1 + .../organizations/_project_message.html.erb | 1 + .../organizations/_show_home_page.html.erb | 1 + .../organizations/_show_org_document.html.erb | 8 ++- app/views/projects/_project_news.html.erb | 3 +- app/views/sub_document_comments/show.html.erb | 2 + app/views/users/_course_homework.html.erb | 1 + .../users/_course_journalsformessage.html.erb | 1 + app/views/users/_course_message.html.erb | 3 +- app/views/users/_course_news.html.erb | 1 + app/views/users/_intro_content.html.erb | 4 +- app/views/users/_project_issue_reply.html.erb | 1 + app/views/users/_project_message.html.erb | 1 + app/views/users/_project_news.html.erb | 1 + app/views/users/_user_blog.html.erb | 1 + .../users/_user_homework_detail.html.erb | 1 + .../users/_user_journalsformessage.html.erb | 6 ++ public/javascripts/application.js | 57 +++++++++---------- public/stylesheets/new_user.css | 2 +- public/stylesheets/project.css | 4 +- 38 files changed, 104 insertions(+), 43 deletions(-) diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index de7f1647d..d3763abf3 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -141,6 +141,7 @@
@@ -215,5 +216,6 @@ var postContent = $("#message_description_<%= @article.id %>").html(); postContent = postContent.replace(/ /g," "); $("#message_description_<%= @article.id %>").html(postContent); + autoUrl('message_description_<%= @article.id %>'); }); diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb index 8be245958..66bc8ff9a 100644 --- a/app/views/courses/syllabus.html.erb +++ b/app/views/courses/syllabus.html.erb @@ -120,6 +120,7 @@
@@ -214,5 +215,6 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('message_description_<%= @article.id %>'); }); \ No newline at end of file diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index 08c030f90..ed90453ac 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -1,6 +1,12 @@
<% if memos.any? %> <% memos.each do |topic| %> +
@@ -16,7 +22,7 @@ <%= get_praise_num(topic)%>
-
<%= topic.content.html_safe%> +
<%= topic.content.html_safe%>
<% author = topic.last_reply.try(:author)%> diff --git a/app/views/issues/_detail.html.erb b/app/views/issues/_detail.html.erb index 92021f728..03c420c99 100644 --- a/app/views/issues/_detail.html.erb +++ b/app/views/issues/_detail.html.erb @@ -28,7 +28,7 @@ <%= render :partial => 'action_menu' %>
<% if @issue.description? || @issue.attachments.any? -%> -
+
<% if @issue.description? %> <%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> <%= textAreailizable @issue, :description, :attachments => @issue.attachments %> @@ -43,4 +43,11 @@ <%= render :partial => 'issues/attributes_show' %>
-
\ No newline at end of file +
+ + \ No newline at end of file diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb index aaf9c132f..197cd9c02 100644 --- a/app/views/issues/_issue_replies.html.erb +++ b/app/views/issues/_issue_replies.html.erb @@ -3,6 +3,7 @@ <% replies_all_i=replies_all_i + 1 %> diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index aeaf3f423..3524de0c8 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -99,7 +99,7 @@
@@ -147,6 +148,7 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('activity_description_<%= @memo.id %>'); description_show_hide(<%= @memo.id %>); }); \ No newline at end of file diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 33c9d7f8d..443440455 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -109,6 +109,7 @@
@@ -188,5 +189,6 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('message_description_<%= @topic.id %>'); }); diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 4d5af61dd..145afcfd7 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -138,6 +138,7 @@
@@ -210,5 +211,6 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('message_description_<%= @topic.id %>'); }); diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index 10046bce2..35b3f8a3c 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -165,6 +165,7 @@
@@ -245,5 +246,6 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('message_description_<%= @topic.id %>'); }); diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 46346eb71..5908c7593 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -115,6 +115,7 @@
@@ -210,5 +211,6 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('message_description_<%= @news.id %>'); }); diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb index 640854164..7eecf43ab 100644 --- a/app/views/news/_organization_show.html.erb +++ b/app/views/news/_organization_show.html.erb @@ -97,6 +97,7 @@
@@ -185,5 +186,6 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('message_description_<%= @news.id %>'); }); diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 6b91c98ed..6b3824222 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -107,6 +107,7 @@
@@ -195,5 +196,6 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('message_description_<%= @news.id %>'); }); diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index f5b186197..e2967a9ae 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -84,6 +84,7 @@ <% user = User.find(reply.creator_id) %> @@ -158,6 +159,7 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('intro_content_<%= @document.id %>'); }); function expand_reply(container, btnid) { var target = $(container); diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index d72600e1e..d3fe36fe3 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -315,6 +315,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb index e0ec8d5fd..e68745f7a 100644 --- a/app/views/organizations/_org_course_message.html.erb +++ b/app/views/organizations/_org_course_message.html.erb @@ -100,6 +100,7 @@ <% replies_all_i=replies_all_i+1 %> diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb index 6fa588ec9..acf0f0377 100644 --- a/app/views/organizations/_org_course_news.html.erb +++ b/app/views/organizations/_org_course_news.html.erb @@ -69,6 +69,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index d19c2cabe..9ca10c91d 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -80,6 +80,7 @@ <% replies_all_i=replies_all_i + 1 %> diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index 315b6d8b4..61bc5bc7f 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -105,6 +105,7 @@ <% replies_all_i=replies_all_i+1 %> diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb index 314380c20..5d6c38542 100644 --- a/app/views/organizations/_org_subfield_news.html.erb +++ b/app/views/organizations/_org_subfield_news.html.erb @@ -89,6 +89,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index 63d416f7a..e1b000c70 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -79,6 +79,7 @@ <% replies_all_i=replies_all_i+1 %> diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb index 63eb1808b..7d8f7963f 100644 --- a/app/views/organizations/_show_home_page.html.erb +++ b/app/views/organizations/_show_home_page.html.erb @@ -59,6 +59,7 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('intro_content_<%= @document.id %>'); function expand_reply(container, btnid) { var target = $(container); var btn = $(btnid); diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 6012dd0d4..e8f531206 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -88,6 +88,12 @@
    <% reply_id = 0 %> <% comments_for_doc.each do |comment| %> + <% reply_id += 1 %>
  • <%= link_to image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_id) %>
    @@ -104,7 +110,7 @@
<% unless comment.content.blank? %> -
<%= comment.content.html_safe %>
+
<%= comment.content.html_safe %>
<% end %>
diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index 2994d908b..6d97b252d 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -69,6 +69,7 @@ <% replies_all_i = replies_all_i + 1 %> @@ -125,4 +126,4 @@ $(function(){ user_card_show_hide(); }); - + diff --git a/app/views/sub_document_comments/show.html.erb b/app/views/sub_document_comments/show.html.erb index 3155c178b..fc35d00cb 100644 --- a/app/views/sub_document_comments/show.html.erb +++ b/app/views/sub_document_comments/show.html.erb @@ -97,6 +97,7 @@ <% user = User.find(reply.creator_id) %> @@ -164,6 +165,7 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('intro_content_<%= @document.id %>'); var replyCount = $(".homepagePostReplyContainer").size(); if (replyCount >3){ for(var i= 3; i < replyCount+1; i++){ diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index fe586b28c..3721244ed 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -321,6 +321,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb index 05e0a67b0..aeb7f5e5d 100644 --- a/app/views/users/_course_journalsformessage.html.erb +++ b/app/views/users/_course_journalsformessage.html.erb @@ -56,6 +56,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index aa2781b95..8b6056309 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -117,6 +117,7 @@ <% replies_all_i=replies_all_i+1 %> @@ -179,4 +180,4 @@ $(function(){ user_card_show_hide(); }); - + diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 3e4bda9f3..19d62b14e 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -94,6 +94,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_intro_content.html.erb b/app/views/users/_intro_content.html.erb index 050720b6c..04babe100 100644 --- a/app/views/users/_intro_content.html.erb +++ b/app/views/users/_intro_content.html.erb @@ -13,9 +13,7 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); - -// autoUrl('intro_content_<%#= user_activity_id%>'); - + autoUrl('intro_content_<%= user_activity_id%>'); description_show_hide(<%=user_activity_id %>); }); \ No newline at end of file diff --git a/app/views/users/_project_issue_reply.html.erb b/app/views/users/_project_issue_reply.html.erb index 671cbeab9..5323b76b6 100644 --- a/app/views/users/_project_issue_reply.html.erb +++ b/app/views/users/_project_issue_reply.html.erb @@ -29,6 +29,7 @@ <% replies_all_i=replies_all_i + 1 %> diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 468ce3a88..b6e3f9a94 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -112,6 +112,7 @@ <% replies_all_i=replies_all_i+1 %> diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index 681493c44..55e2182b5 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -91,6 +91,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 904d573bb..de5ffc31f 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -75,6 +75,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index e561c6363..f81fbabf5 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -331,6 +331,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index 944477e88..d39cccb11 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -86,6 +86,12 @@
    <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %> + <% replies_all_i = replies_all_i + 1 %>
  • diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b0fda8168..3828b981b 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1318,16 +1318,7 @@ function pop_up_box(value,tWidth,tTop,tLeft){ //yk 自动识别URL 并加上链接 -var strRegex = '((https|http|ftp|rtsp|mms)?://)' - + '?(([0-9a-z_!~*\'().&=+$%-]+: )?[0-9a-z_!~*\'().&=+$%-]+@)?' //ftp的user@ - + '(([0-9]{1,3}.){3}[0-9]{1,3}' // IP形式的URL- 199.194.52.184 - + '|' // 允许IP和DOMAIN(域名) - + '([0-9a-z_!~*\'()-]+.)*' // 域名- www. - + '([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].' // 二级域名 - + '[a-z]{2,6})' // first level domain- .com or .museum - + '(:[0-9]{1,4})?' // 端口- :80 - + '((/?)|' // a slash isn't required if there is no file name - + '(/[0-9a-z_!~*\'().;?:@&=+$,%#-]+)+/?)'; +//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 ){ @@ -1335,17 +1326,20 @@ function autoUrl(id){ if ($(this).children().length == 0){ var html = $(this).text(); //.replace(/(^\s*)|(\s*$)/g, "") console.log("html="+html); - var re=new RegExp(strRegex,"g"); - html = html.replace(re,function(full) { +// var re=new RegExp(strRegex,"g"); + 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:// - if (full.indexOf("://") >= 0){ - var reStr = ""+full+""; + var reStr = full; + if (full.length > 0){ + if (full.indexOf("://") >= 0){ + reStr = ""+full+""; + } + else{ + reStr = ""+full+""; + } + console.log("reStr="+reStr); } - else{ - var reStr = ""+full+""; - } - console.log("reStr="+reStr); - return reStr; + return reStr ; }); $(this).html(html); } @@ -1353,18 +1347,21 @@ function autoUrl(id){ } else{ var html = $("#"+id).text(); //.replace(/(^\s*)|(\s*$)/g, "") - console.log("html="+html); - var re=new RegExp(strRegex,"g"); - html = html.replace(re,function(full) { - //没有://的都加上http:// - if (full.indexOf("://") >= 0){ - var reStr = ""+full+""; - } - else{ - var reStr = ""+full+""; + console.log("!!!!html="+html); +// var re=new RegExp(strRegex,"g"); + 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; + if (full.length > 0){ + if (full.indexOf("://") >= 0){ + reStr = ""+full+""; + } + else{ + reStr = ""+full+""; + } + console.log("reStr="+reStr); } - console.log("reStr="+reStr); - return reStr; + return reStr ; }); $("#"+id).html(html); } diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index db2974e01..d7b56a8aa 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1457,7 +1457,7 @@ span.at a{color:#269ac9;text-decoration: none;} .pic_edit2:hover{display:inline-block; background:url(../images/public_icon.png) -32px -32px no-repeat; width:20px; height:15px;} .w70{ width:70px;} .w80{ width:80px;} -.label03{ width:70px; text-align:right; display:block; float:left;} +.label03{ width:70px; text-align:right; display:block; float:left;white-space: nowrap;} .pro_info_p{color:#0781b4 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } .proInfoP{color:#000000 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 927be4cc3..09f7075f7 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -470,7 +470,7 @@ a:hover.st_add{ color:#ff8e15;} .newpro_box select{ height:29px; float:left; margin-bottom:10px;} /*.label{ width:80px; text-align:right; font-size:14 background-image: url(../images/true.png); }*/ .label02{ width:110px; text-align:right; font-size:14px; display:block; float:left;} -.label03{ width:70px; text-align:right; display:block; float:left;} +.label03{ width:70px; text-align:right; display:block; float:left;white-space: nowrap;} .collapsible{ border-left:none;border-right:none;border-bottom:none; border-top:1px solid #e4e4e4; padding-top:10px; } .icon-reload { background-image: url(../images/reload.png); } .icon { @@ -1240,4 +1240,4 @@ a.pages-big{ width:50px;} .pages{width:330px; margin:20px auto 10px;} .red-cir-btn{ background:#e74c3c; padding:1px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} -.green-cir-btn{ background:#28be6c; padding:1px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} +.green-cir-btn{ background:#28be6c; padding:1px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}