Alternating colours

Started by smokester, March 30, 2017, 03:25:52 PM

Previous topic - Next topic

smokester

Hello all.

is there a way of forcing the background colour of replies of a ticket to alternate. I can't seem to do it through the css of the theme I'm using - it just doesn't alternate.

this would be useful when reviewing a long ticket.

Thanks in advance

SleePy

It can be by modifying the SimpleDesk-Display.template.php in the sd_template folder (in default theme folder)

look for:

while ($reply = $context['get_replies']())
{
if (!empty($reply['is_new']))
echo '
<a id="new"></a>';

echo '
<div class="description shd_reply', (!empty($context['ticket']['display_recycle']) && $reply['message_status'] == MSG_STATUS_DELETED ? ' errorbox' : ''), '" id="msg', $reply['id'], '">


Replace that with:
$alt = false;
while ($reply = $context['get_replies']())
{
$alt = !$alt;

if (!empty($reply['is_new']))
echo '
<a id="new"></a>';

echo '
<div class="', $alt? 'description' : 'information', ' shd_reply', (!empty($context['ticket']['display_recycle']) && $reply['message_status'] == MSG_STATUS_DELETED ? ' errorbox' : ''), '" id="msg', $reply['id'], '">
Jeremy D — Spare-Developer

smokester

Thanks for this.

To make this work do I now style "description" and "information" with different background colours?

I'd try that and test it now but I'm not at my work comp', and there's a possibility you may reply to this before I am which might save some time of I am wrong.

Many thanks

smokester

Sorry for the double post but I have realised a probable flaw in this idea I've requested. I realised that if someone double posted in a ticket, the alternating colours would become confusing as they would no longer seemingly apply to the poster.

It seems what I really need is to find a way to assign a background colour to a member's id/post so that replies can be read and identified more easily.

Is that possible?

Thanks in advance.

SleePy

If you want to change the color, I would suggest creating new names, copying the existing css for information and description and then altering it to fit your needs.  Unless you want to change those globally, as they are SMF css code and used in other parts around SMF.

If you wanted to track colors by the member, it should be possible by tracking the id_member and only changing $alt when we encounter a different id_member:

$alt = false;
$last_id_member = -1;
while ($reply = $context['get_replies']())
{
if ($last_id_member != $reply['id_member'])
$alt = !$alt;
$last_id_member = $reply['id_member'];

if (!empty($reply['is_new']))
echo '
<a id="new"></a>';

echo '
<div class="', $alt? 'description' : 'information', ' shd_reply', (!empty($context['ticket']['display_recycle']) && $reply['message_status'] == MSG_STATUS_DELETED ? ' errorbox' : ''), '" id="msg', $reply['id'], '">
Jeremy D — Spare-Developer

smokester

Thanks SleePy,

I'm not really clued up enough to understand what you said in the second part of your last reply. If there is a way to have unique post background colours based in a members' ids, I'd love to know how that could be done. I have set up departments with corresponding member groups so many people can chip in and reply to a ticket.  The problem is you sort of lose who is saying what. Being able to identify them instantly would be more than useful.

I was looking at standard mods like this one:

https://custom.simplemachines.org/mods/index.php?mod=1310

but it wouldn't really do what I am asking and it probably wouldn't integrate into simpledesk of it did.


Any ideas?


SleePy

We don't support that mod, not that it couldn't be done.

The changes I suggested in my last post group replies based on the member id.  If the same member replies multiple times in a row, the color wouldn't change.
Jeremy D — Spare-Developer

smokester

Yes, I did comment that I doubted that the mod would integrate into SD.

I thought the principle was interesting, though. It seemed a more doable method (if only brute force) to assign a colour to a membergroup and then add only one user to that membergroup. This would then hopefully separate the background colour of replies by poster.

Is there perhaps a way to do that?

SleePy

There isn't a way easily to do it.  You would have to start off with that mod working in SMF, then bring in the changes it makes into the display for SimpleDesk as well.
Jeremy D — Spare-Developer

smokester

I have a sandboxed version installed locally that I use for testing.  I'll play around with it and see if I can get it to work. 

I may well need a little more help modifying the SD display template, though.