Little Topic Solved improvement

Started by NanoSector, May 03, 2012, 06:16:31 PM

Previous topic - Next topic

NanoSector

Hi!

Today (or, a couple of minutes ago) I was browsing a random PHP-related website running SMF.

The site had a pretty useful effect, showing the Solved topics in green.
Here is an example:
http://www.phpfreaks.com/forums/index.php?PHPSESSID=q20eae9kb52qq5n6m49i1t76j6&board=11.0

I thought this could be useful on this site, too, for having an overview of solved topics in the support boards.

What do you guys think?
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

French

Agree this is useful Yoshi2889,would like to know how they have done that.

Arantor

Looks like the Topic Solved mod that the SimpleDesk team were working on a long time ago, actually. What it amounts to is a template change to the message index to use a different style in the individual rows when a topic is solved.
Holder of controversial views, all of which my own.


Colin

"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

NanoSector

Arantor: Yep, it's actually just like the Locked status, but then a greenie :P
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

Yes, and there's some CSS injected to handle the custom added style... (I think it was Nas who wrote the SD team one, though I don't think it ever got finished)
Holder of controversial views, all of which my own.


NanoSector

Quote from: Arantor on May 03, 2012, 08:33:24 PM
Yes, and there's some CSS injected to handle the custom added style... (I think it was Nas who wrote the SD team one, though I don't think it ever got finished)
That wouldn't be hard to add, would it? I'd say copy the locked status CSS over and change it's color. Maybe it isn't just that simple, I dunno lol.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

Uh, no it wouldn't be hard? (I thought you knew how to write mods like this, adding to $context['html_headers'] is trivial...)
Holder of controversial views, all of which my own.


NanoSector

Quote from: Arantor on May 03, 2012, 08:40:02 PM
Uh, no it wouldn't be hard? (I thought you knew how to write mods like this, adding to $context['html_headers'] is trivial...)
I know how to write mods, lol, though I epically suck with CSS and positioning and that crap :P
A mod to add such functionality isn't hard, though I have no idea what topic solved mod is used here.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

The one here IIRC is a modified version of Sinan's.
Holder of controversial views, all of which my own.


NanoSector

Quote from: Arantor on May 03, 2012, 08:53:47 PM
The one here IIRC is a modified version of Sinan's.
Right. Might check for a quick edit for that mod tomorrow/today (it's 3:00 AM here), I'm pretty tired now.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

French

Any progress on how to showing the Solved topics in green Yoshi2889  ;)
Just don´t know how to add this line in Message index.pp

NanoSector

#12
Quote from: French on May 11, 2012, 12:21:28 PM
Any progress on how to showing the Solved topics in green Yoshi2889  ;)
Just don´t know how to add this line in Message index.pp
Woops, totally forgot about this.

I'll check on this later today or tomorrow :)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

French

MessageIndex.template.php
Is it possible to add a line this is an example elseif ($topic['is_solved']) $color_class = 'solvedbg';   The same way as Sticky topics
Just don't know how you determined the color green
            
foreach ($context['topics'] as $topic)
{
// Is this topic pending approval, or does it have any posts pending approval?
if ($context['can_approve_posts'] && $topic['unapproved_posts'])
$color_class = !$topic['approved'] ? 'approvetbg' : 'approvebg';
// We start with locked and sticky topics.
elseif ($topic['is_sticky'] && $topic['is_locked'])
$color_class = 'stickybg locked_sticky';
// Sticky topics should get a different color, too.
elseif ($topic['is_sticky'])
$color_class = 'stickybg';
                     // Locked topics get special treatment as well.
elseif ($topic['is_locked'])
$color_class = 'lockedbg';
// Last, but not least: regular topics.
else
$color_class = 'windowbg';

// Some columns require a different shade of the color class.
$alternate_class = $color_class . '2';

NanoSector

Oh, thanks for looking into this French :)

In index.css define this:
.solvedbg
{
background-color: rgb(205, 233, 199);
}
.solvedbg2
{
background-color: rgb(205, 233, 199);
}


I guess.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

French

changed in index.css /* Color for background of *topics* requiring approval */.approvetbg

/* Sticky topics get a different background */
.stickybg
{
   background: #625349;
}
.stickybg2
{
   background: #625349;
}
/* Solved topics get a different background */
.solvedbg
{
background: #66FF33;
}
.solvedbg2
{
   background: #66FF33;
}


changed in MessageIndex.template.php
foreach ($context['topics'] as $topic)
{
// Is this topic pending approval, or does it have any posts pending approval?
if ($context['can_approve_posts'] && $topic['unapproved_posts'])
$color_class = !$topic['approved'] ? 'approvetbg' : 'approvebg';
// We start with locked and sticky topics.
elseif ($topic['is_sticky'] && $topic['is_locked'])
$color_class = 'stickybg locked_sticky';
// Sticky topics should get a different color, too.
elseif ($topic['is_sticky'])
$color_class = 'stickybg';
                        // Solved topics should get a different color, too.
                        elseif ($topic['is_solved']) $color_class = 'solvedbg';
                     // Locked topics get special treatment as well.
elseif ($topic['is_locked'])
$color_class = 'lockedbg';
// Last, but not least: regular topics.
else
$color_class = 'windowbg';

Unfortunately it does not work  :-[

French

Last adds after getting this information
QuoteYou need to implement the solved background in the following pages
- Themes/default/css/index.css
- Themes/default/MessageIndex.template.php
- Themes/default/Recent.template.php

On an added note, you must give a solved both CSS clasess
class = 'windowbg solvedbg";
Still Do not get it working unfortunately

c9099088


knightofdoom

Nice idea.. Would be good if implemented..  :D
Glory is fleeting, but obscurity is forever.
Web Designer Sri Lanka

Arantor

What would be great is if it could be done without file editing.

It isn't possible in SMF without *serious* work but with some effort in strengthening the plugin system it could be.

* Arantor knows what he's on about and would encourage those interested who know what I do to go check out a certain board on a certain forum where my own inspired-by-SMF variation is in use ;)
Holder of controversial views, all of which my own.


NanoSector

I might have to take another attempt on this, I'll keep this in my unread posts :)

Thanks for bumping.

Arantor: Yeah this does require some template editing in the regular SMF.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Antechinus


NanoSector

Quote from: Antechinus on February 12, 2013, 05:47:00 AM
Not much template editing.
Not much indeed but it does require some editing.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

NanoSector

#23
Based on Sinan's mod:

Sources/MessageIndex.php
Find:
t.id_last_msg, t.approved, t.unapproved_posts,

Add after:
t.is_solved,

----------

Find:
'is_posted_in' => false,

Add after:

'is_solved' => (bool) $row['is_solved'],


Themes/(theme)/MessageIndex.template.php
Find:
// Last, but not least: regular topics.
else
$color_class = 'windowbg';


Add before:
// Solved topics are greener.
elseif ($topic['is_solved'])
$color_class = 'solvedbg';


Themes/(theme)/css/index.css
At the end of the file, add:
.solvedbg
{
background: #66FF33;
}
.solvedbg2
{
   background: #66FF33;
}


Screenshot is attached.

EDIT: If you want it to work in Unread Replies and Unread Topics

Sources/Recent.php
Find:
m.id_topic, t.id_board, b.id_cat,

Add after:
t.is_solved,

----------

Find:
'message' => $row['body'],

Add after:
'is_solved' => (bool) $row['is_solved'],

----------

Find:
ms.id_topic, t.id_board, b.name AS bname,

Add after:
t.is_solved,

----------

Find:
'is_posted_in' => false,

Add after:
'is_solved' => (bool) $row['is_solved'],

Themes/(theme)/Recent.template.php
This operation needs to be done twice!
Find:
if (strpos($topic['class'], 'locked') !== false)
$color_class .= 'lockedbg';


Add after:
if ($topic['is_solved'])
$color_class = 'solvedbg';
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Acans

Awesome Yoshi!

Gave it a quick spin and works perfectly. :) Plus tried it with a lighter green for curve, almost the same as SD.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

NanoSector

Thanks snow :)

The lighter background indeed looks better. Care to share the hex code? :)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Acans

"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

4Kstore


¡¡NEW MOD: Sparkles User Names!!!

Arantor

Can you use quick moderation to mark a bulk of topics solved? (That'd be a neat improvement)
Holder of controversial views, all of which my own.


NanoSector

Quote from: Arantor on February 12, 2013, 02:56:06 PM
Can you use quick moderation to mark a bulk of topics solved? (That'd be a neat improvement)
No idea, I'd have to take a read through the code. On this site you can't, at least.

Thanks 4K :)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

I know, but it'd be a neat improvement - and it would likely encourage updating the qmod code to be hookable in 2.1 (it's not a small job)
Holder of controversial views, all of which my own.


Matthew K.


NanoSector

I don't know how the qmod code works, honestly. I'd have to take a look at that sometime :)

Thanks Labradoodle :)

Any chances of this being applied on this site or...?
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

The qmod code is horrid because it has to cope with qmod as icons as well as with checkboxes.
Holder of controversial views, all of which my own.


French

Completely forgotten to go on to find a solution, but this is a neat one thanks for sharing Yoshi2889  ;)

NanoSector

Not a problem :)

Arantor: If it were me I'd separate the code for that...
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

French

#36
For the interested  ;)
Our users can choose from several themes, the text in one of the themes was not easy to read, so had to modified this in themes/css/index.css

#messageindex td a {
    color: #647969;
}


Antechinus

You think that is easy to read? IMO, you would have had a hard time making it less readable.

Irisado

Way too garish for me French!  The clashing colours make my eyes hurt.  Yoshi's version conveyed the same effect in a less overtly bright manner.
Soñando con una playa donde brilla el sol, un arco iris ilumina el cielo, y el mar espejea iridescentemente

NanoSector

Quote from: Irisado on February 18, 2013, 11:50:53 AM
Way too garish for me French!  The clashing colours make my eyes hurt.  Yoshi's version conveyed the same effect in a less overtly bright manner.
Sorry, I just picked a random green colour and inserted it O:)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Irisado

Quote from: Yoshi2889 on February 18, 2013, 11:53:29 AM
Sorry, I just picked a random green colour and inserted it O:)

You've ruined the illusion now, you were supposed to say that it took you hours and hours to decide, and that this is the kind of dedication required to be a team member :D.  You've missed a golden opportunity there :P.

More seriously, it doesn't matter if it was random.  A soft shade of green trumps vivid green on a computer screen.
Soñando con una playa donde brilla el sol, un arco iris ilumina el cielo, y el mar espejea iridescentemente

NanoSector

It did take me hours to decide what colour picker to use... You need a good one to be a team member :P

Though I hate picking colours in general, so I just clicked of the first sign of what looked green to me. Sorry for the outcome, though I think snow has put a nice solution to that :)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Acans

Yeah, I've been sorta OCD lately lol. I actually spent 100x longer picking a shade of green I liked than it too me to actually make all the edits haha.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

French

Antechinus &  Irisado you might just be right,with a dark theme it is tricky to set the right color,specially if you want to keep the text readable,now chosen for this color code #C8F6C8

{
background: 
#C8F6C8;
}
.solvedbg2
{
   background: 
#C8F6C8;
}

Antechinus

Quote from: ѕησω on February 18, 2013, 12:36:56 PM
Yeah, I've been sorta OCD lately lol. I actually spent 100x longer picking a shade of green I liked than it too me to actually make all the edits haha.
ROFL. I do that sort thing all the time. Also change paddings, etc by 1px several times just to see what looks best. The actual base coding takes no time in comparison to all the presentation shiz.


Quote from: French on February 18, 2013, 02:57:20 PM
Antechinus &  Irisado you might just be right,with a dark theme it is tricky to set the right color,specially if you want to keep the text readable,now chosen for this color code #C8F6C8

{
background: 
#C8F6C8;
}
.solvedbg2
{
   background: 
#C8F6C8;
}


No, it's not tricky at all with dark themes. I've done several of them, and other people have done stacks of them. All you have to do is follow basic guidelines for contrast, etc, along with using a bit of common sense so you don't burn people's eyeballs out.

If people are using a dark theme their eyes will be adjusted to that. Putting lurid green stripes across it is going to freak theme out. All you really need is some visual indication that the topic is different. It doesn't have to leap out of the screen and rip your balls off. :D

SpeedHighway

Sorry to dredge this.
Small little improvement to Yoshi's improvement.

At the end of the theme index.css add:
.topic_table td.solved_locked2
{
background-image: url(../images/icons/quick_lock.gif);
background-repeat: no-repeat;
background-position: 98% 4px;
}


In the MessageIndex.template.php files, above
Code (Find) Select
// Locked topics get special treatment as well.
elseif ($topic['is_locked'])
$color_class = 'lockedbg';

Add this:
Code (Add Before) Select
// If solved AND locked
elseif ($topic['is_solved'] && $topic['is_locked'])
$color_class = 'solvedbg solved_locked';


This allows it to be both solved and locked.  Otherwise, solving a topic will remove the lock icon.

Advertisement: