roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.79k stars 1.62k forks source link

Extends skin #6478

Closed splintyg closed 3 years ago

splintyg commented 5 years ago

Hi! I guess it can be an issue with doc:

To create a skin that builds on another, simply name the base skin with the label extends in the meta.json file of your skin:

{ "extends": "larry", ... } This basically adds the base skin folder to the search path for templates and assets. Now the extended skin only needs to provide the templates or includes that actually differ from the base skin.

Skin's /var/www/mail/skins/DD/meta.json contains { "name": "DD", "extends": "larry", "author": "", "license": "", "license-url": "" }

Directory /var/www/mail/skins/DD/ contains a couple of changed css and meta.json, no more. And opening web-interface failed with multiplies 404.

alecpl commented 5 years ago

Works for me. What version? What 404's? What exactly is the folder content?

splintyg commented 5 years ago

1.3.7 ls /var/www/mail/skins/DD/ meta.json styles.css styles.min.css

And one thing i've encountered at first time. If i set $config['skin'] = 'DD'; then login page (a place, where i started to test) get all resources (and styles*css) from /var/www/mail/skins/larry/ If i set $config['skin'] = 'classic'; then all works fine on login page...

alecpl commented 5 years ago

Confirmed. It looks that this is not supported. You'd need to copy includes/links.html to your skin.

I'm not sure we can fix that without breaking some existing skins/plugins. Need more investigation.

splintyg commented 5 years ago

The matter is that further work requires moving all files of larry skin to new skin directory. As i said without copyng all files we look at multiplies 404 errors "resource not found". So the following doesn't work

To create a skin that builds on another, simply name the base skin with the label extends in the meta.json file of your skin:

{ "extends": "larry", ... } This basically adds the base skin folder to the search path for templates and assets. Now the extended skin only needs to provide the templates or includes that actually differ from the base skin.

alecpl commented 5 years ago

No, it does not require moving all files. This depends on what you try to change. Problem with css files is that resource locations (e.g. background images) are resolved by browser. So, using a copy of css file without modifying all url()'s will require all referred images. And we obviously would not want to do this on the fly. We can't get rid of all limitations.

Depending on your needs it might be better to copy/modify only links.html template in a way that it loads additional css file. So, in your skin you'd end up with links.html and single css file. That css file would contain all additional styles.

Spire9 commented 5 years ago

I have been struggling with this same issue since I first installed Roundcube a few months ago.
I found the larry skin in /usr/share/roundcube/skins/larry so I tried to extend it, and even completely duplicate & edit it in /usr/share/roundcube/skins/mySkin but my skin is not even shown in Preferences >> User Interface. If i set $config['skin'] = 'mySkin'; it just loads the Larry skin instead. But if I set $config['skin'] = 'classic';, it switches and all is well.

I am attempting to make Larry more pleasant with some better blues. Especially the one that comes up when the message list is not in a focused state. That blue looks like an old CRT screen that has burned out. It really bugs me.

alecpl commented 5 years ago

Don't use upper-case letters.

Spire9 commented 5 years ago

I didn't use upper case. It was called larry2. Now that you said that, I changed it to josh. Still nothing. Should I expect it to become available on the Preferences >> User Interface screen? I have not modified the css file yet during this go around, so detecting when it's working is tougher.

alecpl commented 5 years ago

You said it was 'mySkin'. 'larry2' is valid name and it should appear on the skins list, until you added 'skin' to dont_override config. I don't know why it didn't work, but as you can see in this ticket it generally works.

Spire9 commented 5 years ago

There must be more that is undocumented. It is not working as expected on my fresh install if RC 1.3.6. What do you mean "until you added 'skin' to dont_override config"?

Spire9 commented 5 years ago

I'm eagerly awaiting the next steps to diagnose this bug.

Spire9 commented 5 years ago

Proof: I created this folder: /usr/share/roundcube/skins/josh

and I created this file: /usr/share/roundcube/skins/josh/meta.json which contains:

{
    "name": "josh",
    "extends": "classic",
    "author": "Josh",
    "license": "Creative Commons Attribution-ShareAlike",
    "license-url": "http://creativecommons.org/licenses/by-sa/3.0/"
}

And in the file: /etc/roundcube/config.inc.php $config['skin'] = 'josh';

as well as a thumbnail.png file.

As you can see, I am now telling it to extend CLASSIC, but it is still giving me the default LARRY.

Also, the setting page does not show the new skin as an option. but the radio-button is gone from both classic and larry, so it knows it is supposed to do something.

splintyg commented 5 years ago

Depending on your needs it might be better to copy/modify only links.html template in a way that it loads additional css file. So, in your skin you'd end up with links.html and single css file. That css file would contain all additional styles.

I guess the certain example will help me understand Your frase "That css file would contain all additional styles." Look, i need new skin exactly as larry one, except for login and main window's background. It must be red. What should i move to new skin directory /var/www/mail/skins/DD/ if it already contains meta.json { "name": "DD", "extends": "larry", "author": "", "license": "", "license-url": "" } ? Thank You.

johndoh commented 5 years ago

@joshk03 please check the permissions on the /usr/share/roundcube/skins/josh folder, make sure they match the other skins (the webserver/php user needs read and execute perms)

@splintyg you need to create a folder structure like this:

./roundcube/skins/DD/ ./roundcube/skins/DD/meta.json - the meta file you already posted ./roundcube/skins/DD/DD.css - the new CSS you want ./roundcube/skins/DD/includes/ ./roundcube/skins/DD/includes/links.html - copy the links.html file from the same place in the Larry skin

modify ./roundcube/skins/DD/includes/links.html to add in your css file (line 8 below, based on RC 1.3.7):

<meta name="viewport" content="" id="viewport" />
<link rel="shortcut icon" href="/images/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="/styles.css" />
<roundcube:if condition="in_array(env:task, array('mail','addressbook','settings'))" />
<link rel="stylesheet" type="text/css" href="/<roundcube:var name="env:task" />.css" />
<roundcube:endif />
<script type="text/javascript" src="/ui.js"></script>
<link rel="stylesheet" type="text/css" href="/DD.css" />
<roundcube:add_label name="errortitle" />
<roundcube:add_label name="toggleadvancedoptions" />

If you want to create your own login page then add ./roundcube/skins/DD/templates/login.html

splintyg commented 5 years ago

Look, i need new skin exactly as larry one, except for login and main window's background color. It must be red.

@johndoh

But in that case browser tries to find in ./roundcube/skins/DD/

link rel="stylesheet" type="text/css" href="/styles.css" / script type="text/javascript" src="/ui.js"></script

So it leads to errors again.

johndoh commented 5 years ago

right. I was testing with git-master. I think this commit 35a3abd fixes the paths

splintyg commented 5 years ago

Ok, thanks to everybody. In fact RoundCube is good and solves almost all tasks of mail client. Let's wait for commit or next release.

Spire9 commented 5 years ago

@johndoh, I had confirmed the permissions matched when I created the folder and files, and now I have changed them all to 777. Even with full access for all there is no change in behavior.

johndoh commented 5 years ago

@joshk03 I suggest you add some debug code into this function https://github.com/roundcube/roundcubemail/blob/release-1.3/program/steps/settings/func.inc#L1310

Spire9 commented 5 years ago

You're the MAN johndoh! You located the code that I would have never found. So the first thing I did was check the folder it was scanning for skins. And it said /var/lib/roundcube/skins And I said W.T.F.

So I took a look at THAT folder, and it contained just two symbolic links to the skins 'classic' and 'larry'. So I added my own symbolic link from terminal: ln -s /usr/share/roundcube/skins/josh /var/lib/roundcube/skins/josh And BINGO. My skin works! Many thanks johndoh!

PS- the instructions need this step added or the code should be updated to not require it.

capa77 commented 5 years ago

Thank you !!

alecpl commented 3 years ago

Reading this again, I see we can close the ticket.