set_enrichText("enrich");
$description->id="ag_description";
$has_description = false;
//---------------------------------- Description -------------------------------------------------------------------
// if there are comments then the first one is the description
if ( count($acomment)> 0) {
$has_description = true;
$editable_description = Document_Option::is_enable_editable_description($this->dt_id);
// if editable and the description can be changed
if ( $p_view != 'READ' && $editable_description == true){
echo h2(_("Description"));
$itDescription=new ITextarea("ag_description");
$itDescription->style='class="input_text field_follow_up" style="height:21rem;width:98%;margin-left:1em;"';
$itDescription->set_enrichText('enrich');
$ag_description_id= $acomment[0]['agc_id'];
$itDescription->value=$acomment[0]['agc_comment_raw'];
$itDescription->id="ag_description";
echo \HtmlInput::hidden("ag_description_id",$acomment[0]['agc_id']);
echo $itDescription->input();
}
elseif ($p_view == 'READ' || $editable_description == false)
{
echo h2(_("Description"));
echo '
';
echo $acomment[0]['agc_comment_raw'];
echo '
';
echo '';
}
} elseif ( count($acomment)> 0 && $p_view != 'READ') {
// there is no comments so there is no description, just input one
echo h2(_("Description"));
$description->set_enrichText('enrich');
$description->style='style="height:250px;width:90%;"';
echo '
';
echo $description->input();
echo '
';
} elseif ( $p_view != 'READ' ) {
// no description and no comment it is a new document
echo h2(_("Description"));
$description->set_enrichText('enrich');
$description->style='style="height:250px;width:90%;"';
echo '
';
echo $description->input();
echo '
';
}
//---------------------------------- Comment -----------------------------------------------------------------------
if ( Document_Option::can_add_comment($ag_id) &&
Document_Option::option_comment($this->dt_id) == "ONE_EDIT" )
{
if (count($acomment) > 1 ) {
echo h2(_("Commentaire"));
$comment=new ITextarea("ag_comment_edit");
$comment->set_enrichText("plain");
$comment->style='class="input_text field_follow_up" style="height:21rem;width:98%;margin-left:5%;"';
$ag_comment_id= (count($acomment) > 1)?$acomment[1]['agc_id']:-1;
$comment->value=(count($acomment) > 1 )?$acomment[1]['agc_comment']:'';
$comment->id="ag_comment_edit";
if ( $p_view != 'READ') {
// One editable comment is available
$editable_comment=new Inplace_Edit($comment);
$editable_comment->add_json_param("op", "followup_comment_oneedit");
$editable_comment->add_json_param("agc_id", $ag_comment_id);
$editable_comment->add_json_param("ag_id", $ag_id);
$editable_comment->add_json_param("gDossier", Dossier::id());
$editable_comment->set_callback("ajax_misc.php");
echo '
';
echo $editable_comment->input();
} else {
echo '
';
echo $comment->display();
}
} else {
// new comment
echo '
';
if ( $p_view == 'UPD' && $has_description && Document_Option::can_add_comment($ag_id) ) {
echo h2(_("Commentaire"));
echo '';
// if comment are editable it will be in
if ( Document_Option::option_comment($this->dt_id) == "ONE_EDIT") $desc->set_enrichText("plain");
echo $desc->input();
}
echo '';
}
}
if ( count($acomment) > 0
&& Document_Option::can_add_comment($ag_id)
&& Document_Option::option_comment($this->dt_id) == "SOME_FIXED")
{
echo h2(_("Commentaire"));
for( $c=1;$c
0)
{
$rmComment=sprintf("return confirm_box(null,'"._('Voulez-vous effacer ce commentaire').
" ?',function() {remove_comment('%s','%s');});",
dossier::id(),
$acomment[$c]['agc_id']);
$js=Icon_Action::trash("accom".$acomment[$c]['agc_id'], $rmComment);
$comment= h($m_desc.' '.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']." ".
$acomment[$c]['str_agc_date'].')').$js.
' '.
" ".$acomment[$c]['agc_comment_raw'].'
'
;
}
else
{
$comment=h($m_desc.' '.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']." ".
$acomment[$c]['str_agc_date'].')').
''
;
}
$comment=preg_replace('/ #([0-9]+)/',' \1',$comment);
echo '';
echo $comment;
} // end for
if ( $has_description && $p_view == 'UPD' && Document_Option::can_add_comment($ag_id)) {
echo '';
echo '';
echo $desc->input();
echo '
';
}
echo '';
if ($p_view == 'UPD') {
}
}
?>