Invert left and right (my own comment on left)

This commit is contained in:
Laurent Destailleur 2017-10-04 13:17:16 +02:00
parent 85606126a9
commit 9b3826a54c
3 changed files with 39 additions and 37 deletions

View File

@ -35,13 +35,13 @@ $comment = new Comment($db);
if ($action == 'addcomment')
{
$description = GETPOST('comment_description');
$description = GETPOST('comment_description', 'none');
if (!empty($description))
{
$comment->description = $description;
$comment->datec = time();
$comment->fk_element = GETPOST('id');
$comment->element_type = GETPOST('comment_element_type');
$comment->fk_element = GETPOST('id','int');
$comment->element_type = GETPOST('comment_element_type','alpha');
$comment->fk_user_author = $user->id;
$comment->entity = $conf->entity;
if ($comment->create($user) > 0)

View File

@ -66,19 +66,8 @@ function project_prepare_head($object)
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'project');
// Manage discussion
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))
{
$nbComments = $object->getNbComments();
$head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id;
$head[$h][1] = $langs->trans("CommentLink");
if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>';
$head[$h][2] = 'project_comment';
$h++;
}
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$nbNote = 0;
@ -122,6 +111,17 @@ function project_prepare_head($object)
$h++;
}
// Manage discussion
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))
{
$nbComments = $object->getNbComments();
$head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id;
$head[$h][1] = $langs->trans("CommentLink");
if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>';
$head[$h][2] = 'project_comment';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id;
$head[$h][1].= $langs->trans("Events");
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
@ -188,17 +188,6 @@ function task_prepare_head($object)
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'task');
// Manage discussion
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK))
{
$nbComments = $object->getNbComments();
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
$head[$h][1] = $langs->trans("CommentLink");
if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>';
$head[$h][2] = 'task_comment';
$h++;
}
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$nbNote = 0;
@ -222,6 +211,17 @@ function task_prepare_head($object)
$head[$h][2] = 'task_document';
$h++;
// Manage discussion
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK))
{
$nbComments = $object->getNbComments();
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
$head[$h][1] = $langs->trans("CommentLink");
if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>';
$head[$h][2] = 'task_comment';
$h++;
}
complete_head_from_modules($conf,$langs,$object,$head,$h,'task','remove');
return $head;

View File

@ -29,10 +29,9 @@ print '<td width="25%"></td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<td></td>';
// Description
print '<td colspan="2">';
print '<td colspan="3">';
$desc = GETPOST('comment_description');
@ -47,13 +46,16 @@ print '</td></tr>';
print '</table></form>';
// List of comments
if(!empty($object->comments)) {
if (!empty($object->comments))
{
// Default color for current user
$TColors = array($user->id => array('bgcolor'=>'efefef','color'=>'555'));
$first = true;
foreach($object->comments as $comment) {
foreach($object->comments as $comment)
{
$fk_user = $comment->fk_user_author;
$userstatic->fetch($fk_user);
if(empty($TColors[$fk_user])) {
$bgcolor = random_color(180,240);
if(!empty($userstatic->color)) {
@ -63,10 +65,10 @@ if(!empty($object->comments)) {
$TColors[$fk_user] = array('bgcolor'=>$bgcolor,'color'=>$color);
}
print '<div class="width100p" style="color:#'.$TColors[$fk_user]['color'].'">';
if($fk_user == $user->id) {
if ($fk_user != $user->id) {
print '<div class="width25p float">&nbsp;</div>';
}
print '<div class="width75p float comment comment-table" style="background-color:#'.$TColors[$fk_user]['bgcolor'].'">';
print '<div class="comment-info comment-cell">';
if (! empty($user->photo))
@ -76,7 +78,7 @@ if(!empty($object->comments)) {
print $langs->trans('User').' : '.$userstatic->getNomUrl().'<br/>';
print $langs->trans('Date').' : '.dol_print_date($comment->datec,'dayhoursec');
print '</div>'; // End comment-info
print '<div class="comment-cell comment-right">';
print '<div class="comment-table width100p">';
print '<div class="comment-description comment-cell">';
@ -90,13 +92,13 @@ if(!empty($object->comments)) {
print '</div>'; // End comment-table
print '</div>'; // End comment-right
print '</div>'; // End comment
if($fk_user != $user->id) {
if($fk_user == $user->id) {
print '<div class="width25p float">&nbsp;</div>';
}
print '<div class="clearboth"></div>';
print '</div>'; // end 100p
$first = false;
}
}