Custom Icon for any links without changing the iconpack :-)

Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Wed, 2006-08-02 21:31

Hello Everyone,

I have made a small modification that may help some of you out there who would like to make your gallery pretty :-)

When a new link is created with in the sidebar, the user page, the item action or the Admin panels, etc.... they come up with no icon because they are not registered in the IconPack.

I know it can be quite ugly and hacing to change the icon pack is risky because of future upgrades SO this is wher I Made this for us :-)

This mod creates 3 files

modules\core\templates\local\SiteAdmin.tpl
modules\core\templates\local\UserAdmin.tpl
modules\core\templates\blocks\local\ItemLinks.tpl

They are in the local folder and do not overwrite the core files (so that future upgrade won't break your stuff)

What is does ?
Add a new option for links called iconimage that you can point to ANY graphic for use as an icon !

For example, a link declared like this (.inc file):

array('name' => $this->translate('Address Book'),
      'view' => 'mymodule.AddressBookManage',
      'iconimage' => 'modules/mymodule/images/AddressBook.gif');

or like this (.tpl file):

<a href="{g->url arg1="view=mymodule.AddressBookManage" arg2="iconimage=modules/mymodule/images/AddressBook.gif"}">{g->text text="Address Book"}</a>

Will create a link with a little icon on the side from the AddressBook.gif file :-)

It's pretty simple but can be very usefull ...

Bonus !
I also added another option "popup", that can be 1 to popup the link on a new page (not a popup - a new page)

If you have any question, feel free to ask ;-)

EDIT: Added attachement, thanks LFrank :)
EDIT 2: Added revision for Gallery 2.2 Users :)

See you !
-------------------------
The Termite - :-) - http://perso.mine.nu/

AttachmentSize
Custom IconLinks - core mod.zip3.01 KB
Custom IconLinks - core mod - G2.2.zip3.01 KB
 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Thu, 2006-08-03 11:39

Yeah - I'm tired fiddling around with the css files ... where have you hidden these files?
Thanks,
Lutz

Gallery version = 2.2-svn core 1.1.14
PHP version = 5.1.4 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.4 mod_ssl/2.2.2 OpenSSL/0.9.8b
Database = mysql 5.0.22-log,
Theme=PGtheme,
Gallery-URL=http://lf-photodesign.de

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Thu, 2006-08-03 14:13

Sorry about that ... I added teh file on the first post :-)

-------------------------
The Termite - :-) - http://perso.mine.nu/

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Fri, 2006-08-04 08:31

could it be that this mod causes some problems with the siteadmin? After installing, I've "lost" all icons in the site admin navigator tree - and more serious, I've got only "Array" in the sub_views ".../main.php?g2_view=core.SiteAdmin&g2_subView=Array" in the admin links after installing these files. (instead of .../main.php?g2_view=core.SiteAdmin&g2_subView=core.AdminPerformance"???

Confirmed on my little test-Gallery, too - which returns to normal operation after removal of these files :(
(Could be the SVN I'm running with ThemeAPI 2.4??)

Gallery version = 2.2-svn core 1.1.14
PHP version = 5.1.4 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.4 mod_ssl/2.2.2 OpenSSL/0.9.8b
Database = mysql 5.0.22-log,
Theme=PGtheme,
Gallery-URL=http://lf-photodesign.de

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Fri, 2006-08-04 17:07

Hmm .. it is possible. This was tested with gallery 2.1.1

I should maybe test with the latest SVN and fix it :-)

Thanks for the heads up ;)
-------------------------
The Termite - :-) - http://perso.mine.nu/

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Fri, 2006-08-04 17:21

*g*

Gallery version = 2.2-svn core 1.1.14
PHP version = 5.1.4 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.4 mod_ssl/2.2.2 OpenSSL/0.9.8b
Database = mysql 5.0.22-log,
Theme=PGtheme,
Gallery-URL=http://lf-photodesign.de

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Fri, 2006-08-04 17:38

Always leaving on the edge ;-)

Then again I'd like this functionality included in the gallery for everyone to use eventually so it's best if I fix it ;-)

See you !

-------------------------
The Termite - :-) - http://perso.mine.nu/

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Sat, 2006-08-05 00:42

Here you go LFrank, made the modification for it to work with gallery 2.2 SVN (Current)

It's also added to the first post !

Let me know if you have any issues ;-)

-------------------------
The Termite - :-) - http://perso.mine.nu/

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Mon, 2006-08-07 11:18

;)

no issues so far :) - except probably one :), I can't find the link option...
can you point me a little bit (perhaps I don't see the forest because of so many trees :))
Thanks,
Lutz

Gallery version = 2.2-svn core 1.1.14
PHP version = 5.1.4 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.4 mod_ssl/2.2.2 OpenSSL/0.9.8b
Database = mysql 5.0.22-log,
Theme=PGtheme,
Gallery-URL=http://lf-photodesign.de

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Mon, 2006-08-07 14:25

The link option is something you need to add manually into a link you create (for example in a module.inc or something similar)

In fact, if you have a link that doesn't have an icon, follow this process:

1. Identify the module the link is created by (hovering over the link, will give you the view and the module name if you're not using URL rewrite)
2. Open the module.inc file where the links are created
3. Depending on the type of link, look for the right PHP function

3.a Item Action link -> getItemLinks
3.b Admin Section link -> getSiteAdminViews
3.c User Specific Area (account option) -> getUserAdminViews

In these function, you will see something similar like this:

	    $links[] = array('name' => $this->translate('My Videos'),
			     'view' => 'media.MyVideos');

In order to add the custom icon, you simply need to add a line with "iconimage" that point to a small icon and it'll be displayed just like the regular icon from icon pack

i.e.

	    $links[] = array('name' => $this->translate('My Page'),
			     'view' => 'mymodule.MyPage');
                             'iconimage' => 'modules/mymodule/images/icon.gif');

4. Go back and refresh your page and the icon will show up :-)

Let me know !

-------------------------
The Termite - :-) - http://perso.mine.nu/

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Tue, 2006-08-08 07:14

Aaaah, got it now :)
Thanks a lot
Lutz

Gallery version = 2.2-svn core 1.1.14
PHP version = 5.1.4 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.4 mod_ssl/2.2.2 OpenSSL/0.9.8b
Database = mysql 5.0.22-log,
Theme=PGtheme,
Gallery-URL=http://lf-photodesign.de