Author Topic: RC Skin: Dynamic Logo and Faveicon by Domain  (Read 9598 times)

Offline raliabdillah

  • Newbie
  • *
  • Posts: 1
RC Skin: Dynamic Logo and Faveicon by Domain
« on: April 17, 2015, 11:30:07 AM »
Hi,
I am new in Roundcube...
I want to ask a "Dynamic Logo and Faveicon by Domain" feature in RC skin for multi domain implementation.
Currently, I have to adjust some code in EVERY SKIN. It will be great if this feature provided in every skin.

First, I Create "_CorpLogo" Folder in my Webserver root folder and put our company logos there
DOMAIN_A_Logo.png
DOMAIN_B_Logo.png
DOMAIN_A_favicon.ico
DOMAIN_B_favicon.ico

Then, I did some modification in these config files:

<defaults.inc.php>
$config['default_host'] = 'mail.DOMAIN_B.org';
$config['username_domain'] = 'DOMAIN_B.org';

$config['include_host_config'] = array(
   'mail.DOMAIN_A.com' => 'com_DOMAIN_A.inc.php',
   'mail.DOMAIN_B.org' => 'org_DOMAIN_B.inc.php'
 );

<com.DOMAIN_A.inc.php>
$config['main_logo'] = 'DOMAIN_A_logo.png';
$config['favicon_logo'] = 'DOMAIN_A_favicon.ico';

<org.DOMAIN_B.inc.php>
$config['main_logo'] = 'DOMAIN_B_logo.png';
$config['favicon_logo'] = 'DOMAIN_B_favicon.ico';


For EVERY SKIN i want to provide to our users, i have to modify headers, login and links html file, for example, in Larry skin as below:

<Larry SKIN>
<Header.html>
<img src="_CorpLogo/<roundcube:var name='config:main_logo' />" id="toplogo" alt="Logo" onclick="if(window.rcmail)rcmail.command('switch-task','mail')">
<!--<roundcube:object name="logo" src="/images/roundcube_logo.png" id="toplogo" alt="Logo" onclick="if(window.rcmail)rcmail.command('switch-task','mail')" />-->

<Login.html>
<img src="_CorpLogo/<roundcube:var name='config:main_logo' />" id="logo">
<!--<roundcube:object name="logo" src="/images/roundcube_logo.png" id="logo" />-->

<Links.html>
<link rel="shortcut icon" href="_CorpLogo/<roundcube:var name='config:favicon_logo' />" />


Really appreciate if there a feature i can use to simplify this modification.
Thanks,

Roeslan

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,881
    • SKaero - Custom Roundcube development
Re: RC Skin: Dynamic Logo and Faveicon by Domain
« Reply #1 on: April 19, 2015, 04:25:30 PM »
Your doing far more work then is needed, just set the skin_logo config parameter no skin changes needed.
Code: [Select]
// replace Roundcube logo with this image
// specify an URL relative to the document root of this Roundcube installation
// an array can be used to specify different logos for specific template files, '*' for default logo
// for example array("*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png")
$config['skin_logo'] = null;

Also don't edit the defaults.inc.php edit the config.inc.php so your changes to get overwritten when updating.

Offline MarzuQnx

  • Newbie
  • *
  • Posts: 6
Re: RC Skin: Dynamic Logo and Faveicon by Domain
« Reply #2 on: August 06, 2015, 09:18:27 AM »
Your doing far more work then is needed, just set the skin_logo config parameter no skin changes needed.
Code: [Select]
// replace Roundcube logo with this image
// specify an URL relative to the document root of this Roundcube installation
// an array can be used to specify different logos for specific template files, '*' for default logo
// for example array("*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png")
$config['skin_logo'] = null;

Also don't edit the defaults.inc.php edit the config.inc.php so your changes to get overwritten when updating.

Hi... can u explain more detail please

Thank u,
MarzuQnx

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,881
    • SKaero - Custom Roundcube development
Re: RC Skin: Dynamic Logo and Faveicon by Domain
« Reply #3 on: August 06, 2015, 04:08:53 PM »
Code: [Select]
$config['skin_logo'] =  array(
     "*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png", // default logo
     "example.com" => "/images/example_com_logo.png", "messageprint" => "/images/example_com_logo_print.png", // logo for example.com
     "example.org" => "/images/example_org_logo.png", "messageprint" => "/images/example_org_logo_print.png", // example.org
);

Offline MarzuQnx

  • Newbie
  • *
  • Posts: 6
Re: RC Skin: Dynamic Logo and Faveicon by Domain
« Reply #4 on: August 06, 2015, 10:55:14 PM »
Code: [Select]
$config['skin_logo'] =  array(
     "*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png", // default logo
     "example.com" => "/images/example_com_logo.png", "messageprint" => "/images/example_com_logo_print.png", // logo for example.com
     "example.org" => "/images/example_org_logo.png", "messageprint" => "/images/example_org_logo_print.png", // example.org
);

Now it's so clear... :) I will try this n get back with report.

Regards,

Offline MarzuQnx

  • Newbie
  • *
  • Posts: 6
Re: RC Skin: Dynamic Logo and Faveicon by Domain
« Reply #5 on: August 06, 2015, 11:17:45 PM »
Code: [Select]
$config['skin_logo'] =  array(
     "*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png", // default logo
     "example.com" => "/images/example_com_logo.png", "messageprint" => "/images/example_com_logo_print.png", // logo for example.com
     "example.org" => "/images/example_org_logo.png", "messageprint" => "/images/example_org_logo_print.png", // example.org
);

hmm.. try this in config.inc.php .. no luck the logo is not changing...

Regards

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
Re: RC Skin: Dynamic Logo and Faveicon by Domain
« Reply #6 on: August 07, 2015, 02:05:31 AM »
That is wrong. This does not work this way (see comments in defaults.inc.php). However, you should be able to do some "if ($_SERVER['HTTP_HOST'] == ...." here.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,881
    • SKaero - Custom Roundcube development
Re: RC Skin: Dynamic Logo and Faveicon by Domain
« Reply #7 on: August 07, 2015, 02:32:05 AM »
Alec is right, I also have a skin switcher for each domain so in my case the solution works.

Offline MarzuQnx

  • Newbie
  • *
  • Posts: 6
Re: RC Skin: Dynamic Logo and Faveicon by Domain
« Reply #8 on: August 07, 2015, 03:40:03 AM »
Alec is right, I also have a skin switcher for each domain so in my case the solution works.

That is wrong. This does not work this way (see comments in defaults.inc.php). However, you should be able to do some "if ($_SERVER['HTTP_HOST'] == ...." here.

 ;) ,  I managed to do it now. skin_logo in the config file is the clue, but still I must edit the parsing process to make it work.

Thanks SKaero for the details use 'skin_logo' in the config.

Regards