Task #1907: Gestion : événement ajout de lien hyperlnk
This commit is contained in:
parent
c38af96905
commit
5ffb31ea7e
3 changed files with 42 additions and 7 deletions
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
@ -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>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue