Yellow: Highlight Package On Hover For SMF 2.0.x & 1.1.x (Hook Version!)

Started by Hj Ahmad Rasyid Hj Ismail, August 29, 2014, 05:26:41 AM

Previous topic - Next topic

Hj Ahmad Rasyid Hj Ismail

Link to Mod

Yellow: Highlight Package On Hover
Version 1.1.1 For SMF 2.0.x (Hook, No File Mod) & 1.1.x


1. Please do your own backup though every installation is backed up automatically.
2. By default SMF uses windowbg and windowbg2 for its package browse and installed list.
3. An admin sometimes cannot see its line properly when install, uninstall or delete.
4. Due to that he/she may end up clicking install/uninstall/delete on wrong package.
5. This mod will highlight your package line on hover, so an admin can be certain in your action.
6. This mod is fully using hook, so there will be no direct files modifications.
7. Upon successful installation, in the mod settings page, you can turn this mod on/off.
8. You can also change the default highlight color i.e. yellow to other preferred color.
9. This mod now highlights all admin lines that fall under css:
- div#admincenter tr.windowbg/2 for SMF 2.0.x.
- table.bordercolor td.windowbg2 table tbody tr for SMF 1.1.x.
10. You can also test it in lower version too as IMO it should work just fine. ;)


Thank you for using/testing it.


Yours friendly,
Abu Fahim Ismail.

BSD License. Feel free to modify accordingly but keep author's link if it is in there somewhere. ;)

 

#Version 1.1.2
- Fix readme file parse error.

#Version 1.1.1
- Fix "Unable to load the '1' template." error.

#Version 1.1.0
- Adding more options to highlight a particular line i.e. bold and italic.

#Version 1.0.2
- Remove the need to edit to SMF 1.1.x default theme template file.
- More user friendly to other themes.

#Version 1.0.1
- Implementing full hook with no file modification for 2.0.x.
- Option to turn it on and off.
- Option to change color.

#Version 1.0
- Simply highlight package line on hover with yellow color.
- Basic. No option.

Ninja ZX-10RR

I have installed this mod from the other topic during the time between that topic being closed and this one being opened. I have the version 1.0.1 and the one available for download is the 1.0.0, should I revert to the 1 or leave it there?
And of course thank you so much for the mod :D , I wish I had installed it before when I had 10 mods... (Now they are 90+ installed...)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Hj Ahmad Rasyid Hj Ismail

I have just uploaded the latest version. This latest one is better as it has more options. You can also make the hovered line bold and/or italic at the same time instead of only highlighting it.

Change Logs
#Version 1.1.0
- Adding more options to highlight a particular line i.e. bold and italic.

#Version 1.0.2
- Remove the need to edit to SMF 1.1.x default theme template file.
- More user friendly to other themes.

#Version 1.0.1
- Implementing full hook with no file modification for 2.0.x.
- Option to turn it on and off.
- Option to change color.

#Version 1.0
- Simply highlight package line on hover with yellow color.
- Basic. No option.

Ninja ZX-10RR

Thanks for the update :D note... It gave me
QuoteUnable to load the '1' template.
right after pressing install and it was not saying successful. O.o it works though. But it shot that error in the error log as well.
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Ninja ZX-10RR

Update: it does it everytime I try to install/uninstall something and as a result of this I uninstalled it temporarily. Feel free to merge the posts I just wanted you to receive the notification about this since it could be useful to fix it ;)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Hj Ahmad Rasyid Hj Ismail

Error have details. To fix such error without details is impossible unless it can be easily reproduce-able or replicate-able. As such, if you are keen on helping to resolve the claimed error, do provide its details.

Since I am not given details information with regard to the claimed error, like line, url etc, I have proceeded test to version 1.1.0 on fresh SMF install again. Unfortunately, I cannot reproduce or replicate any of the claimed error.

Thus, I suspect, there could be a conflicting mod which, may be resolved if more details are provided.

Ninja ZX-10RR

The fact is that I would have provided those details but it simply throws that error without indicating any file or any line, it just says what I reported you, same words :( the mod was successfull in its previous version while the last one isn't. I don't know. :( I think I will install the previous one...
Quote
August 29, 2014, 04:54:08 PM
02c5e1bc67bcd9a7c04e7c40a8ada9b9
Type of error: Template
http://vige.altervista.org/forum/index.php?action=admin;area=packages;sa=uninstall2;package=ridd1.0-nofilter.tar.gz;pid=40
Unable to load the '1' template.

Installed the version 1.0.1 and works perfectly...
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Hj Ahmad Rasyid Hj Ismail

Well, this mod does not use its own template nor changes default files and thus, I failed to see how it affects the Packages.php or Packages.template.php at all. What this mod do is only add a style that is controlled by its mod settings in mod settings page. By using SMF hook, this style is injected to the header so that it can be turned on and off.

What version 1.1.0 add is another line for bold and italic and not so much different with version 1.0.1 at all. But we can discuss the code as well composition of files to find out why.

In 1.0.1, in the file Subs-Yellow.php, we have these two functions:
function Yellow()
{
global $txt, $scripturl, $context, $modSettings, $settings;

// Load the ROAM language
loadLanguage('Yellow');

if ($context['sub_template'] = ('view_installed' || 'browse') && !empty($modSettings['yellow_enable']))
{
// Default color for highlighting package is yellow
$context['html_headers'] .= "\n" . '
<style type="text/css">
/*<![CDATA[*/
div#admincenter tr.windowbg:hover, div#admincenter tr.windowbg2:hover
{
background: ' . (empty($modSettings['yellow_change']) ? 'yellow' : $modSettings['yellow_change']) . ';
}
/*]]>*/
</style>
';
}
}

function Yellow_Settings(&$config_vars)
{
global $txt, $scripturl, $context, $modSettings, $settings;

// Load the ROAM language
loadLanguage('Yellow');

$yellow = array(
// Add Yellow Settings
array('check', 'yellow_enable'),
array('text', 'yellow_change'),
'',
);
// Insert after all available slice.
$first = array_slice($config_vars, 0);
$config_vars = array_merge($first, $yellow);
}



Then, in 1.1.0, we change the file name to Yellow.subs.php (for standardizing purpose) and added a few more lines as follows:
function Yellow()
{
global $txt, $scripturl, $context, $modSettings, $settings;

// Load the ROAM language
loadLanguage('Yellow');

if ($context['sub_template'] = ('view_installed' || 'browse') && !empty($modSettings['yellow_enable']))
{
// Default color for highlighting package is yellow
$context['html_headers'] .= "\n" . '
<style type="text/css">
/*<![CDATA[*/
div#admincenter tr.windowbg:hover, div#admincenter tr.windowbg2:hover
{
background: ' . (empty($modSettings['yellow_change']) ? 'yellow' : $modSettings['yellow_change']) . ';
' . (!empty($modSettings['yellow_font_weight']) ? 'font-weight: bold;' : '') . '
' . (!empty($modSettings['yellow_font_style']) ? 'font-style: italic;' : '') . '
}
/*]]>*/
</style>
';
}
}

function Yellow_Settings(&$config_vars)
{
global $txt, $scripturl, $context, $modSettings, $settings;

// Load the ROAM language
loadLanguage('Yellow');

$yellow = array(
'',
// Add Yellow Settings
array('check', 'yellow_enable'),
array('check', 'yellow_font_weight'),
array('check', 'yellow_font_style'),
array('text', 'yellow_change'),
);
// Insert after all available slice.
$first = array_slice($config_vars, 0);
$config_vars = array_merge($first, $yellow);
}



In the hook file, previously named as add_remove_hooks.php and now named as Yellow.hooks.php, the code are as follows:
// Define the hooks
$hook_functions = array(
'integrate_admin_include' => '$sourcedir/Yellow.subs.php',
'integrate_admin_areas' => 'Yellow',
'integrate_general_mod_settings' => 'Yellow_Settings',
);

Of course the filename in the code was previously, Subs-Yellow.php.


Both was tested in fresh installed SMF was fine with no error. Figuring it out without any clue is difficult as the said error can caused by any reason. But the given error also doesn't seems to make sense to me unless SMF is questioning how the file is named. May be renaming Subs-Yellow.php to Yellow.subs.php is the cause.

akbora

This mod is good works perfectly thanks

Otherwise can you active normal message index and the other areas.
SMF 2.0.13
Default Theme
Utf8 Turkish
---------------

Hj Ahmad Rasyid Hj Ismail

Thank you for the feedback akbora.

It will not be so easy for other template like message index actually and other areas. It will depend on how a particular template is designed.

If they are simply using windowbg /2 in their tr and no styling class for its td, then it is easy. Otherwise, it will be a lot more works to attend to each particular part. Bear in mind that each themes have their own template styling as well.

I will see what I can do and to which part this mod can be extended or may be create another mod for another part later.

Ninja ZX-10RR

Wait. I have a lot of things to add.

So before I was not completely correct, even the previous version does that thing when trying to access to current theme settings...

But I have the default theme :/ I am not a coder I can't really understand why it does it... sorry for not being totally accurate before :(
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Hj Ahmad Rasyid Hj Ismail

Ok. I think I begin to understand the problem but since I cannot replicate/reproduce the error, I will need a favor from you to test the following package and see whether the said error is still there. I have removed the following code from Yellow.subs.php

$context['sub_template'] = ('view_installed' || 'browse') &&

I am betting that the code is causing the error. Do update once you have tested it.

Ninja ZX-10RR

Sorry for the delay I have been really busy today.

YES! You nailed it! Works perfectly :D thanks for the fix :D you rock!
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Hj Ahmad Rasyid Hj Ismail

That's a great  news. I will upload this new package to the mod site then.

Hj Ahmad Rasyid Hj Ismail

Quote from: akbora on August 30, 2014, 06:43:34 AM
This mod is good works perfectly thanks

Otherwise can you active normal message index and the other areas.

I finally find a way to extend yellow highlighting mod to other places that have rows i.e. use <tbody> <tr> in its code. In other words, after I finalize the upgrade package, users of this mod can, upon hover, highlight message index, memberlist, personal messages, buddy list etc with default or their preferred highlighting options.

However, for maintenance purposes, this mod will be limited only to places that have rows using the said <tbody><tr> in its code and will not be extended to others like <ul><li> code.

Highlighting options can only be determined by admin as the current one and will not be extended to forum users for the coming upgrade. Similarly, the highlighting options will also not going to be extended to provide different highlighting to different places but will maintain the current one.

Unfortunately, time of upgrade will not be coming any time sooner (no promise) but it will be delivered when it is ready. I will update here when it is released.

Ninja ZX-10RR

Oh, good to know :) it's already awesome since it's already working in other areas such as membergroups so I really like it. Will wait for this even more awesome update :D thanks in advance and don't rush ;)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Hj Ahmad Rasyid Hj Ismail

Of course, I won't rush for this. This is because some portals (eg. SimplePortal) might be using <tbody><tr> as well. So, I need to use a precise css to cover all area without affecting other mods or unnecessary areas.

Jade Elizabeth

I know this is such a simple mod but thanks for making it. It's such a little thing but it's a real help to many admins. I've been going through your mods today actually and it seems to me that we value similar things, and neat/intuitive interfaces are one of those! It's really great to see you making these as mods as well, instead of hiding these awesome features away in themes.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

villasg

Thanks a lot .
Very nice idea - mod .

In installation i receive one error


**/forum/index.php?action=admin;area=packages;sa=install;package=Yellow.V.1.1.1.zip
8: Undefined index: package_readme
File : **/forum/Sources/Packages.php
Line: 356


Line 356 in Packages.php are

$context['package_readme'] = preg_replace('~\[[/]?html\]~i', '', $context['package_readme']);



I guess need to rename the file Yellow.readme.txt to readme.txt

Hj Ahmad Rasyid Hj Ismail

Thank you for the compliment Jade and thank you for the report villasg.

Upgraded to 1.1.2. Hopefully the bug is fixed.

Advertisement: