[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 169/173: Task #1907: Gestion : événement ajou
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 169/173: Task #1907: Gestion : événement ajout de lien hyperlnk |
Date: |
Mon, 22 Mar 2021 12:59:26 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 5ffb31ea7e8820d58dfeffeb294f5d16775c213a
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sat Mar 20 15:04:58 2021 +0100
Task #1907: Gestion : événement ajout de lien hyperlnk
---
include/lib/ac_common.php | 12 ++++++++++++
include/template/detail-action.php | 17 +++++++++++------
unit-test/include/lib/ac_common.php | 20 +++++++++++++++++++-
3 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php
index 6c9a2d3..8f96a81 100644
--- a/include/lib/ac_common.php
+++ b/include/lib/ac_common.php
@@ -1558,4 +1558,16 @@ function rebuild_access_code($pan_code)
$sep=($s_result != "" )?"/":"";
}
return $s_result;
+}
+
+/***
+ * Transform a http link into a clickable link
+ */
+function add_http_link($text)
+{
+
+ $ret=preg_replace("!http[s]{0,1}://[[:graph:]*]*!",'<a href="\\0"
target="_blank">\0</a>',$text);
+
+ return $ret;
+
}
\ No newline at end of file
diff --git a/include/template/detail-action.php
b/include/template/detail-action.php
index 99d70b3..f3769b8 100644
--- a/include/template/detail-action.php
+++ b/include/template/detail-action.php
@@ -1,5 +1,6 @@
<?php
require_once NOALYSS_INCLUDE."/class/follow_up_other_concerned.class.php";
+
//This file is part of NOALYSS and is under GPL
//see licence.txt
$uniq=uniqid("tab",TRUE);
@@ -295,9 +296,10 @@ function small(p_id_textarea){
elseif ($p_view == 'READ' || $editable_description == false)
{
echo h2(_("Description"));
-
echo '<pre class="field_follow_up">';
- echo h($acomment[0]['agc_comment']);
+ $comment_http= h($acomment[0]['agc_comment']);
+ $comment_http=add_http_link($comment_http);
+ echo $comment_http;
echo '</pre>';
}
} else {
@@ -305,6 +307,7 @@ function small(p_id_textarea){
echo $description->input();
}
+
//---------------------------------- Comment
-----------------------------------------------------------------------
if ( Document_Option::can_add_comment($ag_id) &&
@@ -364,7 +367,7 @@ function small(p_id_textarea){
$comment= h($m_desc.'
'.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']." ".
$acomment[$c]['str_agc_date'].')').$js.
'<pre class="field_follow_up"
id="com'.$acomment[$c]['agc_id'].'"> '.
- " ".h($acomment[$c]['agc_comment']).'</pre>'
+ "
".add_http_link(h($acomment[$c]['agc_comment'])).'</pre>'
;
}
@@ -373,7 +376,7 @@ function small(p_id_textarea){
$comment=h($m_desc.'
'.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']." ".
$acomment[$c]['str_agc_date'].')').
'<pre class="field_follow_up"
id="com'.$acomment[$c]['agc_id'].'"> '.
- "
".h($acomment[$c]['agc_comment']).'</pre>'
+ "
".add_http_link(h($acomment[$c]['agc_comment'])).'</pre>'
;
@@ -394,6 +397,7 @@ function small(p_id_textarea){
}
}
+
@@ -488,6 +492,7 @@ for ($i=0;$i<sizeof($aAttachedFile);$i++) :
</tr>
<?php
endfor;
+
?>
</table>
<?php if ( ! empty ($aAttachedFile)) :
@@ -540,7 +545,7 @@ catch(exception) { alert('<?php echo j(_('Je ne peux pas
ajouter de fichier'))?>
</div>
<?php endif;?>
</div>
-<?php if ($p_view != 'NEW') : ?>
+<?php if ($p_view != 'NEW') : ?>
Document créé le <?php echo $this->ag_timestamp ?> par <?php echo
$this->ag_owner?>
<?php endif; ?>
@@ -571,4 +576,4 @@ Document créé le <?php echo $this->ag_timestamp ?> par
<?php echo $this->ag_ow
$('related_action_div<?php echo $uniq?>').hide();
$('dependant_action_div<?php echo $uniq?>').show();
} ;
-</script>
\ No newline at end of file
+</script>
diff --git a/unit-test/include/lib/ac_common.php
b/unit-test/include/lib/ac_common.php
index b2bc19e..750fe4f 100644
--- a/unit-test/include/lib/ac_common.php
+++ b/unit-test/include/lib/ac_common.php
@@ -167,5 +167,23 @@ class Ac_CommonTest extends TestCase
$this->assertEquals(
$result, trim(sql_filter_per($g_connection, 98, 99, "p_id",
"j_tech_per")));
}
-
+ /***
+ * @covers add_http_link
+ */
+ function testAdd_Http_link()
+ {
+ $text="A link on http://demo.noalyss.eu is ok";
+ $result=add_http_link($text);
+ $this->assertEquals('A link on <a href="http://demo.noalyss.eu"
target="_blank">http://demo.noalyss.eu</a> is ok',$result);
+
+ $text="A link on
https://demo.noalyss.eu/do.php?gDossier=33&ac=COMPTA/MENUFIN is ok";
+ $result=add_http_link($text);
+ $this->assertEquals('A link on <a
href="https://demo.noalyss.eu/do.php?gDossier=33&ac=COMPTA/MENUFIN"
target="_blank">https://demo.noalyss.eu/do.php?gDossier=33&ac=COMPTA/MENUFIN</a>
is ok',$result);
+
+
+
+ $text = "The chain is not going to change
htps:/demo.noalyss.eu/do.php?gDossier=33&ac=COMPTA/MENUFIN";
+ $this->assertEquals($text,$text);
+
+ }
}
- [Noalyss-commit] [noalyss] 138/173: Test Unit Acc_Account_Legder , rounded value fixed, (continued)
- [Noalyss-commit] [noalyss] 138/173: Test Unit Acc_Account_Legder , rounded value fixed, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 139/173: Fix cosmetic and typo, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 147/173: Error : duplicate function update_row, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 151/173: htmlspecialchars use HTML5 and UTF8, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 114/173: fixup! Printtva , under some circumstance tva_summary::check fails, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 131/173: Merge branch 'dev-7201' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 142/173: Merge commit 'db9d4c53d1325b1ab3c8a3fcae6ddd201799fb42' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 146/173: Merge branch 'pre7300' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 150/173: Include Bootstrap, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 154/173: create dossier, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 169/173: Task #1907: Gestion : événement ajout de lien hyperlnk,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 101/173: task #0001698: Problème affichage historique fiches Prevent direct use of http_request translation Cosmetic, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 152/173: Bug : filter of the search and tag, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 160/173: typo, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 159/173: Merge branch 'master' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 162/173: Merge branch 'master' into dev-8-bootstrap, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 164/173: Merge branch 'master' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 170/173: Task #1913 Correct calendar : nav button CSS esthétique, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 171/173: Cosmetic button, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 94/173: Merge branch 'accept7100' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 107/173: Merge branch 'accept7100' into entreprise, Dany De Bontridder, 2021/03/22