Implemented separate Cascading Style Sheets for different output media

SVN revision: 1782
This commit is contained in:
2007-01-16 20:11:36 +00:00
parent 6b884f2788
commit f1248bac07
2 changed files with 30 additions and 3 deletions
+15 -1
View File
@@ -540,7 +540,21 @@ Admin user = bill
A given theme can contain several Cascading Style Sheets (CSS). This
can be usefule if several logbooks use the same images and icons, but
differnt colors. By default, the CSS <i>default.css</i> is used. This
can be overwritten by this statement.
can be overwritten by this statement. If different CSS'es should be used
for different output media, this can be accomplished with a comma-
separated list in the form
<code><b>CSS = &lt;file1&gt;&amp;&lt;media1&gt;,&lt;file2&gt;&amp;&lt;media2&gt;</b></code>. This will then be translated into separate style sheet
statements for the different media. For example a statement
<code><b>CSS = default.css&amp;screen,print.css&amp;print</b></code>
will result in the HTML statements:
<pre>
&lt;link rel="stylesheet" type="text/css" href="default.css" media="screen"&gt;
&lt;link rel="stylesheet" type="text/css" href="print.css" media="print"&gt;
</pre>
</li>
<li>
<b><code>Title image = &lt;string&gt;</code></b><br>
+15 -2
View File
@@ -6872,7 +6872,9 @@ void show_plain_header(int size, char *file_name)
void show_html_header(LOGBOOK * lbs, BOOL expires, char *title, BOOL close_head, BOOL rss_feed, char *cookie,
int absolute_link)
{
char css[256], str[256];
int i, n;
char css[1000], str[1000], media[1000];
char css_list[MAX_N_LIST][NAME_LENGTH];
show_http_header(lbs, expires, cookie);
@@ -6897,7 +6899,18 @@ void show_html_header(LOGBOOK * lbs, BOOL expires, char *title, BOOL close_head,
else
strlcat(css, "default.css", sizeof(css));
rsprintf("<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\">\n", css);
if (strchr(css, ',')) {
n = strbreak(css, css_list, MAX_N_LIST, ",");
for (i=0 ; i<n ; i++) {
strlcpy(str, css_list[i], sizeof(str));
if (strchr(str, '&')) {
strlcpy(media, strchr(str, '&')+1, sizeof(media));
*strchr(str, '&') = 0;
rsprintf("<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" media=\"%s\">\n", str, media);
}
}
} else
rsprintf("<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\">\n", css);
rsprintf("<link rel=\"shortcut icon\" href=\"favicon.ico\">\n");
rsprintf("<link rel=\"icon\" href=\"favicon.png\" type=\"image/png\">\n");