Ways to customize unique css-file

Started by xian, July 27, 2022, 10:09:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xian

Hello, i'll keep it short - although I'd like to thank you for this versatile tool. Well as you know, and as I've seen, printing the tables to paper is a discussed topic through the years.
I'm fine with editing the css. I have a table which keeps the same geometry with colorcoded teachers etc.
But if I generate multiple tables, do I really have to copy my custom css into every folder?
Unfortunately the css has a different name in every folder, so this won't work, I think.
Wouldn't it be nice, to adress a custom css-File or include custom css-commands as a matter of fet project preferences?

Nevertheless, I assumed somewhere in the system is a the very basic css-file, which keeps all the presets, that are mirrored into all the css-files in the folders. But I couldn't find this source. I'm using a fet within a ubuntu system. Am I wrong? Could you tell me the path to this source.

With best regards
Christian
 

Liviu Lalescu

Hello, Christian,

Thank you for the appreciation!

I will add your suggestion in the TODO. Unfortunately, it is Volker's part, and Volker has currently little time for coding, and I don't have experience with this. My main experience is the algorithm, not presenting the results.

Yes, you need to copy in each folder. But the name of the file is the same, just copy it.

Do you have advice on how to add a custom CSS file?

I hoped to release tomorrow afternoon a new version, 6.5.4. But if you have good suggestions (explained as for a novice in HTML/CSS) for this I might wait and try to add it.

For the CSS generation, see the FET sources, src/engine/timetableexport.cpp, function void TimetableExport::writeStylesheetCss(...).

Liviu.

xian

Hi Liviu,
thanks for the fast response.
Well don't wait with your release. I'm short on time as well, but I'll answer soon.
I'll have a look at the source. Thanks for the hint.
Christian

xian

Hi Liviu,
i took a look at the timetableexport.cpp.
The CSS-Commands are hardcoded (TimetableExport::writeStylesheetCss), so I dont see, how to customize this, while avoiding to compile everytime the whole thing.
(By the way - using fet in ubuntu and not that familiar with compiling at all, i still use the package 5.28. out of the box.)
Anyway. But I think it should be possible to reference a "custom.css" while writing the html-head.

Output:
    <link rel="stylesheet" media="all" href="projectfile_stylesheet.css" type="text/css" />
    <link rel="stylesheet" media="all" href="..\..\additional_custom.css" type="text/css" />
    <link rel="stylesheet" media="all" href="..\additonal_custom.css" type="text/css" />


The first custom link refers to all multi-outputs that are more nested in subdirectories, the second custom link to all single-outputs.

Well, i think it should be possible to alter timetableexport.cpp from line 5419 with adding the two html-lines with a fixstring:
tmp+="    <link rel=\"stylesheet\" media=\"all\" href=\""+cssfilename+"\" type=\"text/css\" />\n";
tmp+="    <link rel=\"stylesheet\" media=\"all\" href=\"../../additional_custom.css+"\" type=\"text/css\" />\n";
tmp+="    <link rel=\"stylesheet\" media=\"all\" href=\"../additional_custom.css+"\" type=\"text/css\" />\n";

As far as I understood, that the later CSS overwrites earlier commands. So one could pick the CSS-Output from FET out of single- oder multi-outputs to adapt them only once in the result/timetables folder .
And I guess, there is no need for error handling for non-exisiting CSS-Files. So there is no problem if there is no custom CSS-File neither one  nor two level up.

Hope i made myself clear. Best regards
Christian







Liviu Lalescu

Hello, Christian,

It is an interesting idea. @Volker Dirr , what do you say? I will add this idea in the TODO list and we'll think of it.

Unfortunately, only we know about this name of an additional CSS. How to inform the casual user?

Please try to use latest FET. It is much nicer. Lately, I provide also a GNU/Linux executable (see Downloads page).

Volker Dirr

Let me think some more.

So the user need to know filename and directory. He also need to copy / create the file manualy.
But on the other hand it will solve your problem.

Liviu Lalescu

Aren't there security risks if a bad person messes with this CSS?

xian

From my point of view, this question is asked by someone who is not satisfied with standard outputs. So a deeper look into manual or forum is obvious, where this workaround is documented. And I bet, if you don't offer a GUI for manipulating CSS by view, a user manipulating CSS by code, will be able to create an additional CSS-file.

I don't think that an additional CSS is that vulnerable. At the other hand the user is either forced to alter the nested original CSS over and over, so why not do it once at another location.
 
 

Volker Dirr

Maybe as a feature that need to be activated in the settings?

Liviu Lalescu

Quote from: Volker Dirr on September 01, 2022, 07:47:58 PMMaybe as a feature that need to be activated in the settings?

OK, maybe we'll do this. Please suggest me the location of the setting, and its name, and further details (write an empty file, modify the HTML code - this is @Volker Dirr 's experience). I am not sure I'll add this right now, but maybe in the near future.