FET Forum

FET Development => Suggestions => Topic started by: Benahmed Abdelkrim on July 23, 2016, 12:11:15 PM

Title: add colgroup default
Post by: Benahmed Abdelkrim on July 23, 2016, 12:11:15 PM
 Hello!...
       I have a small suggestion; add <colgroup> by default has all the tables produced by FET.
this allows the user to color the desired columns
I attach 3 files as example after modification.

code befor:
   <table id="table_2_DETAILED" border="1" class="odd_table">
      <caption>  </caption>
      <thead>


code after:
<table id="table_2_DETAILED" border="1" class="odd_table">
   <caption> </caption>
   <colgroup>
    <col class="coll" />
    <col class="col2" />
    <col class="col3" />
<col class="col4" />
    <col class="col5" />
    <col class="col6" />
<col class="col7" />
    <col class="col8" />
    <col class="col9" />
<col class="col10" />
  </colgroup> 
      <thead>

Title: Re: add colgroup default
Post by: Volker Dirr on July 23, 2016, 01:25:28 PM
Nice suggestion, but it is an "old" coding style. Around 5 years old.
The advantage is, that old webbowsers will support it.
The disadvante is, that code and size will grow again.

I think you should use new coding style if you want such a feature:
use ":nth-of-type()" to the <td> and/or <th> elements.
by this we don't need to set classes to the cols at all.
it will simplify the code very much and you can do that already right now in the css file. No changes in the html code is needed to use that feature.

i also think a TODO for later fet versions is to REMOVE the "line0", "line1", ... classes i added into the source some years ago.
because it is also old coding style. It's possible to use  ":nth-of-type()" also to the rows.
so it will simplify the code.
but i think this is a TODO not right now, because at the moment there are still a guys using old webbrowsers that doesn't support that feature.
So i think we can remove it in maybe 2-3 years.
Title: Re: add colgroup default
Post by: Benahmed Abdelkrim on July 23, 2016, 02:50:25 PM
thank you very much mrs. volker for this information. This feature works perfectly. this is a new feature of CSS3. thank you again. :)
Title: Re: add colgroup default
Post by: Benahmed Abdelkrim on July 23, 2016, 05:12:16 PM
I forgot to add the modifications to the CSS code, here's the code:
 
/* Colonnes avec classes */
  col.col4 {
  background-color:#d6d3ce;
}
col.col7 {
  background-color:#d6d3ce;
}


    as you can check the attached file above.
but I found somewhat different results from what I expected, it is applying the new feature of CSS3.
I attach the file with ":nth-of-type( )"

Title: Re: add colgroup default
Post by: Volker Dirr on July 23, 2016, 10:17:30 PM
the file with col4 and col7 classes are missing.
but it doesn't matter, since i understand already what you mean:

if you use the :nth-of-type() stuff, then it will luck "ugly" if the duration of the activities is different.
solution: use only activities with duration 1.

but if you use col stuff like you suggested, then it won't be much better.
ok, the break in your example will look nicer. that is correct.
but as soon as you try to color a column with an activity duration >2 it will also not look fine (ok, a bit "nicer" then with nth-of-type, but still not nice; because the whole activity will be colored (or not colored).
so same solution here: this trick work only if all activities in a column have got the same duration. so again in worst case you are only allowed to use activities with duration 1.

hmm...
i will maybe code an automatic split for the final table, since you already requested that for printing timetables.
Title: Re: add colgroup default
Post by: Benahmed Abdelkrim on July 24, 2016, 06:55:43 AM
Quote from: Volker Dirr on July 23, 2016, 10:17:30 PM
the file with col4 and col7 classes are missing.
but it doesn't matter, since i understand already what you mean:
no the file is not missing, you can download it, it is compressed, called colgroup.rar.

Quote from: Volker Dirr on July 23, 2016, 10:17:30 PM

hmm...
i will maybe code an automatic split for the final table, since you already requested that for printing timetables.
please do not make automatic split. tables are prettier like that. for colored columns I inject a few lines of code, it's not complicated...thank you.
Title: Re: add colgroup default
Post by: Volker Dirr on July 24, 2016, 09:49:29 AM
ah... i forgot. the first file.

yes, exactly what i thought. it will look ugly if you colour columns with activities that have duration larger 1.
so for example if you color col3 and col8.

but why do you use col at all if you color the breaks only?
that is already possible several years now without using colgroups.
i added a class "break".
so you can just set a break and style that by css.
it will look like your table and it will also work with web browsers that doesn't support the colgroup feature.
Title: Re: add colgroup default
Post by: Benahmed Abdelkrim on July 24, 2016, 04:49:59 PM
Quote from: Volker Dirr on July 24, 2016, 09:49:29 AM
but why do you use col at all if you color the breaks only?
that is already possible several years now without using colgroups.
i added a class "break".
so you can just set a break and style that by css.
it will look like your table and it will also work with web browsers that doesn't support the colgroup feature.

yes it is true, and I have already tried the class "break" but I got adverse results; all cells "break" are colored !, and what I wanted was only the columns "B" and "Lu". this for tables produced by FET is turned into HTML / CSS.
but this trick does not work with tables  exported by TiTiTo
Title: Re: add colgroup default
Post by: Volker Dirr on July 24, 2016, 05:02:37 PM
ah. ok.
the first problem is easy:
modify the break after you generated a timetable and generate that file with from the results directory again.
Or maybe use not available times instead of break (but that is of course complicated).

the second one is more difficult.
you are right. i didn't add that feature into TiTiTo so far.
ok. i will write it on my TODO list.

currently i am coding on merging activities with same teachers, students, subject and room. So you can use the span.
I can't add that feature into FET, since in FET a lot of contraints might refer to the activities. I think it is also not clever to add that feature there, because one the activies are merged FET won't be able to split them again.
But in TiTiTo you will just import final tables without most constraints. It will be easy to code (i think).
I will let you now more as soon as i am ready.