Fossil SCM
Added style.css page that get's from the repo or uses a built in style.css. Removed static formatting in header/footer, replaced with divs, spans and ids which the style.css can totally control. The default style.css is simple, uses blue colors from timeline date area. Fixed minor bug on setup_ulist where it would display footer at top.
Commit
5cd959742854ddf2fcd21f4a8b0be5099954f16e
Parent
55dc2abc60a4692…
2 files changed
-1
+152
-17
-1
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -79,11 +79,10 @@ | ||
| 79 | 79 | ** screen for that user. |
| 80 | 80 | */ |
| 81 | 81 | void setup_ulist(void){ |
| 82 | 82 | Stmt s; |
| 83 | 83 | |
| 84 | - style_footer(); | |
| 85 | 84 | login_check_credentials(); |
| 86 | 85 | if( !g.okSetup ){ |
| 87 | 86 | login_needed(); |
| 88 | 87 | return; |
| 89 | 88 | } |
| 90 | 89 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -79,11 +79,10 @@ | |
| 79 | ** screen for that user. |
| 80 | */ |
| 81 | void setup_ulist(void){ |
| 82 | Stmt s; |
| 83 | |
| 84 | style_footer(); |
| 85 | login_check_credentials(); |
| 86 | if( !g.okSetup ){ |
| 87 | login_needed(); |
| 88 | return; |
| 89 | } |
| 90 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -79,11 +79,10 @@ | |
| 79 | ** screen for that user. |
| 80 | */ |
| 81 | void setup_ulist(void){ |
| 82 | Stmt s; |
| 83 | |
| 84 | login_check_credentials(); |
| 85 | if( !g.okSetup ){ |
| 86 | login_needed(); |
| 87 | return; |
| 88 | } |
| 89 |
+152
-17
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /* |
| 2 | -** Copyright (c) 2006 D. Richard Hipp | |
| 2 | +** Copyright (c) 2006,2007 D. Richard Hipp | |
| 3 | 3 | ** |
| 4 | 4 | ** This program is free software; you can redistribute it and/or |
| 5 | 5 | ** modify it under the terms of the GNU General Public |
| 6 | 6 | ** License version 2 as published by the Free Software Foundation. |
| 7 | 7 | ** |
| @@ -74,23 +74,23 @@ | ||
| 74 | 74 | login_check_credentials(); |
| 75 | 75 | @ <html> |
| 76 | 76 | @ <head> |
| 77 | 77 | @ <title>%s(zTitle)</title> |
| 78 | 78 | @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="%s(g.zBaseURL)/timeline.rss"> |
| 79 | + @ <link rel="stylesheet" href="%s(g.zBaseURL)/style.css" type="text/css" media="screen"> | |
| 79 | 80 | @ </head> |
| 80 | - @ <body bgcolor="white"> | |
| 81 | - @ <hr size="1"> | |
| 82 | - @ <table border="0" cellpadding="0" cellspacing="0" width="100%%"> | |
| 83 | - @ <tr><td valign="top" align="left"> | |
| 84 | - @ <big><big><b>%s(zTitle)</b></big></big><br> | |
| 81 | + @ <body> | |
| 82 | + @ <div id="page-title">%s(zTitle)</div> | |
| 83 | + @ <div id="login-status"> | |
| 85 | 84 | if( g.zLogin==0 ){ |
| 86 | - @ <small>not logged in</small> | |
| 85 | + @ not logged in | |
| 87 | 86 | zLogInOut = "Login"; |
| 88 | 87 | }else{ |
| 89 | - @ <small>logged in as %h(g.zLogin)</small> | |
| 88 | + @ logged in as %h(g.zLogin) | |
| 90 | 89 | } |
| 91 | - @ </td><td valign="top" align="right"> | |
| 90 | + @ </div> | |
| 91 | + @ <div id="main-menu"> | |
| 92 | 92 | @ <a href="%s(g.zBaseURL)/index">Home</a> |
| 93 | 93 | if( g.okRead ){ |
| 94 | 94 | @ | <a href="%s(g.zBaseURL)/leaves">Leaves</a> |
| 95 | 95 | @ | <a href="%s(g.zBaseURL)/timeline">Timeline</a> |
| 96 | 96 | } |
| @@ -106,37 +106,41 @@ | ||
| 106 | 106 | @ | <a href="%s(g.zBaseURL)/setup">Setup</a> |
| 107 | 107 | } |
| 108 | 108 | if( !g.noPswd ){ |
| 109 | 109 | @ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a> |
| 110 | 110 | } |
| 111 | + @ </div> | |
| 112 | + @ <div id="sub-menu"> | |
| 111 | 113 | if( nSubmenu>0 ){ |
| 112 | 114 | int i; |
| 113 | - @ <br> | |
| 114 | 115 | qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare); |
| 115 | 116 | for(i=0; i<nSubmenu; i++){ |
| 116 | 117 | struct Submenu *p = &aSubmenu[i]; |
| 117 | 118 | char *zTail = i<nSubmenu-1 ? " | " : ""; |
| 118 | 119 | if( p->zLink==0 ){ |
| 119 | - @ <font color="#888888">%h(p->zLabel)</font> %s(zTail) | |
| 120 | + @ <span class="label">%h(p->zLabel)</span> | |
| 121 | + @ <span class="tail">%s(zTail)</span> | |
| 120 | 122 | }else{ |
| 121 | - @ <a href="%T(p->zLink)">%h(p->zLabel)</a> %s(zTail) | |
| 123 | + @ <a class="label" href="%T(p->zLink)">%h(p->zLabel)</a> | |
| 124 | + @ <span class="tail">%s(zTail)</span> | |
| 122 | 125 | } |
| 123 | 126 | } |
| 124 | 127 | } |
| 125 | - @ </td></tr></table> | |
| 126 | - @ <hr size="1"> | |
| 128 | + @ </div> | |
| 129 | + @ <div id="page"> | |
| 127 | 130 | g.cgiPanic = 1; |
| 128 | 131 | } |
| 129 | 132 | |
| 130 | 133 | /* |
| 131 | 134 | ** Draw the footer at the bottom of the page. |
| 132 | 135 | */ |
| 133 | 136 | void style_footer(void){ |
| 134 | - @ <hr> | |
| 135 | - @ <p align="left"><font size="1"> | |
| 137 | + /* end the <div id="page"> from style_header() */ | |
| 138 | + @ </div> | |
| 139 | + @ <div id="style-footer"> | |
| 136 | 140 | @ Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE) |
| 137 | - @ </font></p> | |
| 141 | + @ </div> | |
| 138 | 142 | } |
| 139 | 143 | |
| 140 | 144 | /* |
| 141 | 145 | ** WEBPAGE: index |
| 142 | 146 | ** WEBPAGE: home |
| @@ -152,14 +156,145 @@ | ||
| 152 | 156 | style_header("Main Title Page"); |
| 153 | 157 | @ No homepage configured for this server |
| 154 | 158 | style_footer(); |
| 155 | 159 | } |
| 156 | 160 | } |
| 161 | + | |
| 162 | +/* | |
| 163 | +** TODO: COPIED FROM WIKI.C... BAD | |
| 164 | +*/ | |
| 165 | +/* | |
| 166 | +** Create a fake replicate of the "vfile" table as a TEMP table | |
| 167 | +** using the manifest identified by manid. | |
| 168 | +*/ | |
| 169 | +static void style_create_fake_vfile(int manid){ | |
| 170 | + static const char zVfileDef[] = | |
| 171 | + @ CREATE TEMP TABLE vfile( | |
| 172 | + @ id INTEGER PRIMARY KEY, -- ID of the checked out file | |
| 173 | + @ vid INTEGER REFERENCES blob, -- The version this file is part of. | |
| 174 | + @ chnged INT DEFAULT 0, -- 0:unchnged 1:edited 2:m-chng 3:m-add | |
| 175 | + @ deleted BOOLEAN DEFAULT 0, -- True if deleted | |
| 176 | + @ rid INTEGER, -- Originally from this repository record | |
| 177 | + @ mrid INTEGER, -- Based on this record due to a merge | |
| 178 | + @ pathname TEXT, -- Full pathname | |
| 179 | + @ UNIQUE(pathname,vid) | |
| 180 | + @ ); | |
| 181 | + ; | |
| 182 | + db_multi_exec(zVfileDef); | |
| 183 | + load_vfile_from_rid(manid); | |
| 184 | +} | |
| 185 | + | |
| 186 | + | |
| 187 | +/* | |
| 188 | +** WEBPAGE: style.css | |
| 189 | +*/ | |
| 190 | +void page_style_css(void){ | |
| 191 | + Stmt q; | |
| 192 | + int id = 0; | |
| 193 | + int rid = 0; | |
| 194 | + int chnged = 0; | |
| 195 | + char *zPathname = 0; | |
| 196 | + char *z; | |
| 197 | + | |
| 198 | + cgi_set_content_type("text/css"); | |
| 199 | + | |
| 200 | + login_check_credentials(); | |
| 201 | + if( !g.localOpen ){ | |
| 202 | + int headid = db_int(0, | |
| 203 | + "SELECT cid FROM plink ORDER BY mtime DESC LIMIT 1" | |
| 204 | + ); | |
| 205 | + style_create_fake_vfile(headid); | |
| 206 | + } | |
| 207 | + | |
| 208 | + db_prepare(&q, | |
| 209 | + "SELECT id, rid, chnged, pathname FROM vfile" | |
| 210 | + " WHERE (pathname='style.css' OR pathname LIKE '%%/style.css')" | |
| 211 | + " AND NOT deleted" | |
| 212 | + ); | |
| 213 | + if( db_step(&q)==SQLITE_ROW ){ | |
| 214 | + id = db_column_int(&q, 0); | |
| 215 | + rid = db_column_int(&q, 1); | |
| 216 | + chnged = db_column_int(&q, 2); | |
| 217 | + if( chnged || rid==0 ){ | |
| 218 | + zPathname = db_column_malloc(&q, 3); | |
| 219 | + } | |
| 220 | + } | |
| 221 | + db_finalize(&q); | |
| 222 | + if( id ){ | |
| 223 | + Blob src; | |
| 224 | + blob_zero(&src); | |
| 225 | + if( zPathname ){ | |
| 226 | + zPathname = mprintf("%s/%z", g.zLocalRoot, zPathname); | |
| 227 | + blob_read_from_file(&src, zPathname); | |
| 228 | + free(zPathname); | |
| 229 | + }else{ | |
| 230 | + content_get(rid, &src); | |
| 231 | + } | |
| 232 | + | |
| 233 | + z = blob_str(&src); | |
| 234 | + @ %s(z) | |
| 235 | + }else{ | |
| 236 | + /* No CSS file found, use our own */ | |
| 237 | + /* | |
| 238 | + ** Selector order: tags, ids, classes, other | |
| 239 | + ** Content order: margin, borders, padding, fonts, colors, other | |
| 240 | + ** Note: Once things are finialize a bit we can collapse this and | |
| 241 | + ** make it much smaller, if necessary. Right now, it's verbose | |
| 242 | + ** but easy to edit. | |
| 243 | + */ | |
| 244 | + @ body { | |
| 245 | + @ margin: 0px; | |
| 246 | + @ padding: 0px; | |
| 247 | + @ background-color: white; | |
| 248 | + @ } | |
| 249 | + @ #page-title { | |
| 250 | + @ padding: 10px 10px 10px 10px; | |
| 251 | + @ font-size: 2em; | |
| 252 | + @ font-weight: bold; | |
| 253 | + @ background-color: #d0d9f4; | |
| 254 | + @ } | |
| 255 | + @ #login-status { | |
| 256 | + @ padding: 0px 10px 10px 0px; | |
| 257 | + @ font-size: 0.9em; | |
| 258 | + @ text-align: right; | |
| 259 | + @ background-color: #d0d9f4; | |
| 260 | + @ position: absolute; | |
| 261 | + @ top: 10; | |
| 262 | + @ right: 0; | |
| 263 | + @ } | |
| 264 | + @ #main-menu { | |
| 265 | + @ border-top: 2px solid #a0b5f4; | |
| 266 | + @ padding: 3px 10px 1px 0px; | |
| 267 | + @ font-size: 0.9em; | |
| 268 | + @ text-align: center; | |
| 269 | + @ background-color: #d0d9f4; | |
| 270 | + @ } | |
| 271 | + @ #sub-menu { | |
| 272 | + @ border-bottom: 2px solid #a0b5f4; | |
| 273 | + @ padding: 3px 10px 3px 0px; | |
| 274 | + @ font-size: 0.9em; | |
| 275 | + @ text-align: center; | |
| 276 | + @ background-color: #d0d9f4; | |
| 277 | + @ } | |
| 278 | + @ #main-menu a:visited, #sub-menu a:visited { | |
| 279 | + @ color: blue; | |
| 280 | + @ } | |
| 281 | + @ #page { | |
| 282 | + @ padding: 10px 20px 10px 20px; | |
| 283 | + @ } | |
| 284 | + @ #style-footer { | |
| 285 | + @ font-size: 0.8em; | |
| 286 | + @ margin-top: 12px; | |
| 287 | + @ padding-top: 5px; | |
| 288 | + @ border-top: 1px solid black; | |
| 289 | + @ } | |
| 290 | + } | |
| 291 | +} | |
| 157 | 292 | |
| 158 | 293 | /* |
| 159 | 294 | ** WEBPAGE: test_env |
| 160 | 295 | */ |
| 161 | 296 | void page_test_env(void){ |
| 162 | 297 | style_header("Environment Test"); |
| 163 | 298 | cgi_print_all(); |
| 164 | 299 | style_footer(); |
| 165 | 300 | } |
| 166 | 301 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1,7 +1,7 @@ | |
| 1 | /* |
| 2 | ** Copyright (c) 2006 D. Richard Hipp |
| 3 | ** |
| 4 | ** This program is free software; you can redistribute it and/or |
| 5 | ** modify it under the terms of the GNU General Public |
| 6 | ** License version 2 as published by the Free Software Foundation. |
| 7 | ** |
| @@ -74,23 +74,23 @@ | |
| 74 | login_check_credentials(); |
| 75 | @ <html> |
| 76 | @ <head> |
| 77 | @ <title>%s(zTitle)</title> |
| 78 | @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="%s(g.zBaseURL)/timeline.rss"> |
| 79 | @ </head> |
| 80 | @ <body bgcolor="white"> |
| 81 | @ <hr size="1"> |
| 82 | @ <table border="0" cellpadding="0" cellspacing="0" width="100%%"> |
| 83 | @ <tr><td valign="top" align="left"> |
| 84 | @ <big><big><b>%s(zTitle)</b></big></big><br> |
| 85 | if( g.zLogin==0 ){ |
| 86 | @ <small>not logged in</small> |
| 87 | zLogInOut = "Login"; |
| 88 | }else{ |
| 89 | @ <small>logged in as %h(g.zLogin)</small> |
| 90 | } |
| 91 | @ </td><td valign="top" align="right"> |
| 92 | @ <a href="%s(g.zBaseURL)/index">Home</a> |
| 93 | if( g.okRead ){ |
| 94 | @ | <a href="%s(g.zBaseURL)/leaves">Leaves</a> |
| 95 | @ | <a href="%s(g.zBaseURL)/timeline">Timeline</a> |
| 96 | } |
| @@ -106,37 +106,41 @@ | |
| 106 | @ | <a href="%s(g.zBaseURL)/setup">Setup</a> |
| 107 | } |
| 108 | if( !g.noPswd ){ |
| 109 | @ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a> |
| 110 | } |
| 111 | if( nSubmenu>0 ){ |
| 112 | int i; |
| 113 | @ <br> |
| 114 | qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare); |
| 115 | for(i=0; i<nSubmenu; i++){ |
| 116 | struct Submenu *p = &aSubmenu[i]; |
| 117 | char *zTail = i<nSubmenu-1 ? " | " : ""; |
| 118 | if( p->zLink==0 ){ |
| 119 | @ <font color="#888888">%h(p->zLabel)</font> %s(zTail) |
| 120 | }else{ |
| 121 | @ <a href="%T(p->zLink)">%h(p->zLabel)</a> %s(zTail) |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | @ </td></tr></table> |
| 126 | @ <hr size="1"> |
| 127 | g.cgiPanic = 1; |
| 128 | } |
| 129 | |
| 130 | /* |
| 131 | ** Draw the footer at the bottom of the page. |
| 132 | */ |
| 133 | void style_footer(void){ |
| 134 | @ <hr> |
| 135 | @ <p align="left"><font size="1"> |
| 136 | @ Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE) |
| 137 | @ </font></p> |
| 138 | } |
| 139 | |
| 140 | /* |
| 141 | ** WEBPAGE: index |
| 142 | ** WEBPAGE: home |
| @@ -152,14 +156,145 @@ | |
| 152 | style_header("Main Title Page"); |
| 153 | @ No homepage configured for this server |
| 154 | style_footer(); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /* |
| 159 | ** WEBPAGE: test_env |
| 160 | */ |
| 161 | void page_test_env(void){ |
| 162 | style_header("Environment Test"); |
| 163 | cgi_print_all(); |
| 164 | style_footer(); |
| 165 | } |
| 166 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1,7 +1,7 @@ | |
| 1 | /* |
| 2 | ** Copyright (c) 2006,2007 D. Richard Hipp |
| 3 | ** |
| 4 | ** This program is free software; you can redistribute it and/or |
| 5 | ** modify it under the terms of the GNU General Public |
| 6 | ** License version 2 as published by the Free Software Foundation. |
| 7 | ** |
| @@ -74,23 +74,23 @@ | |
| 74 | login_check_credentials(); |
| 75 | @ <html> |
| 76 | @ <head> |
| 77 | @ <title>%s(zTitle)</title> |
| 78 | @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="%s(g.zBaseURL)/timeline.rss"> |
| 79 | @ <link rel="stylesheet" href="%s(g.zBaseURL)/style.css" type="text/css" media="screen"> |
| 80 | @ </head> |
| 81 | @ <body> |
| 82 | @ <div id="page-title">%s(zTitle)</div> |
| 83 | @ <div id="login-status"> |
| 84 | if( g.zLogin==0 ){ |
| 85 | @ not logged in |
| 86 | zLogInOut = "Login"; |
| 87 | }else{ |
| 88 | @ logged in as %h(g.zLogin) |
| 89 | } |
| 90 | @ </div> |
| 91 | @ <div id="main-menu"> |
| 92 | @ <a href="%s(g.zBaseURL)/index">Home</a> |
| 93 | if( g.okRead ){ |
| 94 | @ | <a href="%s(g.zBaseURL)/leaves">Leaves</a> |
| 95 | @ | <a href="%s(g.zBaseURL)/timeline">Timeline</a> |
| 96 | } |
| @@ -106,37 +106,41 @@ | |
| 106 | @ | <a href="%s(g.zBaseURL)/setup">Setup</a> |
| 107 | } |
| 108 | if( !g.noPswd ){ |
| 109 | @ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a> |
| 110 | } |
| 111 | @ </div> |
| 112 | @ <div id="sub-menu"> |
| 113 | if( nSubmenu>0 ){ |
| 114 | int i; |
| 115 | qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare); |
| 116 | for(i=0; i<nSubmenu; i++){ |
| 117 | struct Submenu *p = &aSubmenu[i]; |
| 118 | char *zTail = i<nSubmenu-1 ? " | " : ""; |
| 119 | if( p->zLink==0 ){ |
| 120 | @ <span class="label">%h(p->zLabel)</span> |
| 121 | @ <span class="tail">%s(zTail)</span> |
| 122 | }else{ |
| 123 | @ <a class="label" href="%T(p->zLink)">%h(p->zLabel)</a> |
| 124 | @ <span class="tail">%s(zTail)</span> |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | @ </div> |
| 129 | @ <div id="page"> |
| 130 | g.cgiPanic = 1; |
| 131 | } |
| 132 | |
| 133 | /* |
| 134 | ** Draw the footer at the bottom of the page. |
| 135 | */ |
| 136 | void style_footer(void){ |
| 137 | /* end the <div id="page"> from style_header() */ |
| 138 | @ </div> |
| 139 | @ <div id="style-footer"> |
| 140 | @ Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE) |
| 141 | @ </div> |
| 142 | } |
| 143 | |
| 144 | /* |
| 145 | ** WEBPAGE: index |
| 146 | ** WEBPAGE: home |
| @@ -152,14 +156,145 @@ | |
| 156 | style_header("Main Title Page"); |
| 157 | @ No homepage configured for this server |
| 158 | style_footer(); |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | /* |
| 163 | ** TODO: COPIED FROM WIKI.C... BAD |
| 164 | */ |
| 165 | /* |
| 166 | ** Create a fake replicate of the "vfile" table as a TEMP table |
| 167 | ** using the manifest identified by manid. |
| 168 | */ |
| 169 | static void style_create_fake_vfile(int manid){ |
| 170 | static const char zVfileDef[] = |
| 171 | @ CREATE TEMP TABLE vfile( |
| 172 | @ id INTEGER PRIMARY KEY, -- ID of the checked out file |
| 173 | @ vid INTEGER REFERENCES blob, -- The version this file is part of. |
| 174 | @ chnged INT DEFAULT 0, -- 0:unchnged 1:edited 2:m-chng 3:m-add |
| 175 | @ deleted BOOLEAN DEFAULT 0, -- True if deleted |
| 176 | @ rid INTEGER, -- Originally from this repository record |
| 177 | @ mrid INTEGER, -- Based on this record due to a merge |
| 178 | @ pathname TEXT, -- Full pathname |
| 179 | @ UNIQUE(pathname,vid) |
| 180 | @ ); |
| 181 | ; |
| 182 | db_multi_exec(zVfileDef); |
| 183 | load_vfile_from_rid(manid); |
| 184 | } |
| 185 | |
| 186 | |
| 187 | /* |
| 188 | ** WEBPAGE: style.css |
| 189 | */ |
| 190 | void page_style_css(void){ |
| 191 | Stmt q; |
| 192 | int id = 0; |
| 193 | int rid = 0; |
| 194 | int chnged = 0; |
| 195 | char *zPathname = 0; |
| 196 | char *z; |
| 197 | |
| 198 | cgi_set_content_type("text/css"); |
| 199 | |
| 200 | login_check_credentials(); |
| 201 | if( !g.localOpen ){ |
| 202 | int headid = db_int(0, |
| 203 | "SELECT cid FROM plink ORDER BY mtime DESC LIMIT 1" |
| 204 | ); |
| 205 | style_create_fake_vfile(headid); |
| 206 | } |
| 207 | |
| 208 | db_prepare(&q, |
| 209 | "SELECT id, rid, chnged, pathname FROM vfile" |
| 210 | " WHERE (pathname='style.css' OR pathname LIKE '%%/style.css')" |
| 211 | " AND NOT deleted" |
| 212 | ); |
| 213 | if( db_step(&q)==SQLITE_ROW ){ |
| 214 | id = db_column_int(&q, 0); |
| 215 | rid = db_column_int(&q, 1); |
| 216 | chnged = db_column_int(&q, 2); |
| 217 | if( chnged || rid==0 ){ |
| 218 | zPathname = db_column_malloc(&q, 3); |
| 219 | } |
| 220 | } |
| 221 | db_finalize(&q); |
| 222 | if( id ){ |
| 223 | Blob src; |
| 224 | blob_zero(&src); |
| 225 | if( zPathname ){ |
| 226 | zPathname = mprintf("%s/%z", g.zLocalRoot, zPathname); |
| 227 | blob_read_from_file(&src, zPathname); |
| 228 | free(zPathname); |
| 229 | }else{ |
| 230 | content_get(rid, &src); |
| 231 | } |
| 232 | |
| 233 | z = blob_str(&src); |
| 234 | @ %s(z) |
| 235 | }else{ |
| 236 | /* No CSS file found, use our own */ |
| 237 | /* |
| 238 | ** Selector order: tags, ids, classes, other |
| 239 | ** Content order: margin, borders, padding, fonts, colors, other |
| 240 | ** Note: Once things are finialize a bit we can collapse this and |
| 241 | ** make it much smaller, if necessary. Right now, it's verbose |
| 242 | ** but easy to edit. |
| 243 | */ |
| 244 | @ body { |
| 245 | @ margin: 0px; |
| 246 | @ padding: 0px; |
| 247 | @ background-color: white; |
| 248 | @ } |
| 249 | @ #page-title { |
| 250 | @ padding: 10px 10px 10px 10px; |
| 251 | @ font-size: 2em; |
| 252 | @ font-weight: bold; |
| 253 | @ background-color: #d0d9f4; |
| 254 | @ } |
| 255 | @ #login-status { |
| 256 | @ padding: 0px 10px 10px 0px; |
| 257 | @ font-size: 0.9em; |
| 258 | @ text-align: right; |
| 259 | @ background-color: #d0d9f4; |
| 260 | @ position: absolute; |
| 261 | @ top: 10; |
| 262 | @ right: 0; |
| 263 | @ } |
| 264 | @ #main-menu { |
| 265 | @ border-top: 2px solid #a0b5f4; |
| 266 | @ padding: 3px 10px 1px 0px; |
| 267 | @ font-size: 0.9em; |
| 268 | @ text-align: center; |
| 269 | @ background-color: #d0d9f4; |
| 270 | @ } |
| 271 | @ #sub-menu { |
| 272 | @ border-bottom: 2px solid #a0b5f4; |
| 273 | @ padding: 3px 10px 3px 0px; |
| 274 | @ font-size: 0.9em; |
| 275 | @ text-align: center; |
| 276 | @ background-color: #d0d9f4; |
| 277 | @ } |
| 278 | @ #main-menu a:visited, #sub-menu a:visited { |
| 279 | @ color: blue; |
| 280 | @ } |
| 281 | @ #page { |
| 282 | @ padding: 10px 20px 10px 20px; |
| 283 | @ } |
| 284 | @ #style-footer { |
| 285 | @ font-size: 0.8em; |
| 286 | @ margin-top: 12px; |
| 287 | @ padding-top: 5px; |
| 288 | @ border-top: 1px solid black; |
| 289 | @ } |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | /* |
| 294 | ** WEBPAGE: test_env |
| 295 | */ |
| 296 | void page_test_env(void){ |
| 297 | style_header("Environment Test"); |
| 298 | cgi_print_all(); |
| 299 | style_footer(); |
| 300 | } |
| 301 |