Fossil SCM
Added style info to db_generic_query_view(), so it can be styled via css
Commit
0095e24ba94fde3c22f77b0b5ae6ad7dc05e75f1
Parent
a20dcb5c26addae…
2 files changed
+4
-3
+21
M
src/db.c
+4
-3
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1173,12 +1173,12 @@ | ||
| 1173 | 1173 | { |
| 1174 | 1174 | @ db_generic_query_view(): Error processing SQL: [%s(sql)] |
| 1175 | 1175 | return; |
| 1176 | 1176 | } |
| 1177 | 1177 | int colc = db_column_count(&st); |
| 1178 | - @ <table cellpadding='4px' border='1'><tbody> | |
| 1179 | - @ <tr> | |
| 1178 | + @ <table class='fossil_db_generic_query_view'><tbody> | |
| 1179 | + @ <tr class='header'> | |
| 1180 | 1180 | for( i = 0; i < colc; ++i ) { |
| 1181 | 1181 | if( coln ) |
| 1182 | 1182 | { |
| 1183 | 1183 | @ <th>%s(coln[i] ? coln[i] : db_column_name(&st,i))</th> |
| 1184 | 1184 | } |
| @@ -1187,12 +1187,13 @@ | ||
| 1187 | 1187 | @ <td>%s(db_column_name(&st,i))</td> |
| 1188 | 1188 | } |
| 1189 | 1189 | } |
| 1190 | 1190 | @ </tr> |
| 1191 | 1191 | |
| 1192 | + int row = 0; | |
| 1192 | 1193 | while( SQLITE_ROW == db_step(&st) ){ |
| 1193 | - @ <tr> | |
| 1194 | + @ <tr class='%s( (row++%2) ? "odd" : "even")'> | |
| 1194 | 1195 | for( i = 0; i < colc; ++i ) { |
| 1195 | 1196 | char * xf = 0; |
| 1196 | 1197 | char const * xcf = 0; |
| 1197 | 1198 | xcf = (xform && xform[i]) |
| 1198 | 1199 | ? (xf=(xform[i])(db_column_text(&st,i))) |
| 1199 | 1200 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1173,12 +1173,12 @@ | |
| 1173 | { |
| 1174 | @ db_generic_query_view(): Error processing SQL: [%s(sql)] |
| 1175 | return; |
| 1176 | } |
| 1177 | int colc = db_column_count(&st); |
| 1178 | @ <table cellpadding='4px' border='1'><tbody> |
| 1179 | @ <tr> |
| 1180 | for( i = 0; i < colc; ++i ) { |
| 1181 | if( coln ) |
| 1182 | { |
| 1183 | @ <th>%s(coln[i] ? coln[i] : db_column_name(&st,i))</th> |
| 1184 | } |
| @@ -1187,12 +1187,13 @@ | |
| 1187 | @ <td>%s(db_column_name(&st,i))</td> |
| 1188 | } |
| 1189 | } |
| 1190 | @ </tr> |
| 1191 | |
| 1192 | while( SQLITE_ROW == db_step(&st) ){ |
| 1193 | @ <tr> |
| 1194 | for( i = 0; i < colc; ++i ) { |
| 1195 | char * xf = 0; |
| 1196 | char const * xcf = 0; |
| 1197 | xcf = (xform && xform[i]) |
| 1198 | ? (xf=(xform[i])(db_column_text(&st,i))) |
| 1199 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1173,12 +1173,12 @@ | |
| 1173 | { |
| 1174 | @ db_generic_query_view(): Error processing SQL: [%s(sql)] |
| 1175 | return; |
| 1176 | } |
| 1177 | int colc = db_column_count(&st); |
| 1178 | @ <table class='fossil_db_generic_query_view'><tbody> |
| 1179 | @ <tr class='header'> |
| 1180 | for( i = 0; i < colc; ++i ) { |
| 1181 | if( coln ) |
| 1182 | { |
| 1183 | @ <th>%s(coln[i] ? coln[i] : db_column_name(&st,i))</th> |
| 1184 | } |
| @@ -1187,12 +1187,13 @@ | |
| 1187 | @ <td>%s(db_column_name(&st,i))</td> |
| 1188 | } |
| 1189 | } |
| 1190 | @ </tr> |
| 1191 | |
| 1192 | int row = 0; |
| 1193 | while( SQLITE_ROW == db_step(&st) ){ |
| 1194 | @ <tr class='%s( (row++%2) ? "odd" : "even")'> |
| 1195 | for( i = 0; i < colc; ++i ) { |
| 1196 | char * xf = 0; |
| 1197 | char const * xcf = 0; |
| 1198 | xcf = (xform && xform[i]) |
| 1199 | ? (xf=(xform[i])(db_column_text(&st,i))) |
| 1200 |
+21
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -338,10 +338,31 @@ | ||
| 338 | 338 | @ .achtung { |
| 339 | 339 | @ color: #ff0000; |
| 340 | 340 | @ background: #ffff00; |
| 341 | 341 | @ border: 1px solid #ff0000; |
| 342 | 342 | @ } |
| 343 | +@ | |
| 344 | +@ table.fossil_db_generic_query_view { | |
| 345 | +@ border-spacing: 0px; | |
| 346 | +@ border: 0px; | |
| 347 | +@ } | |
| 348 | +@ table.fossil_db_generic_query_view td { | |
| 349 | +@ padding: 2px 1em 2px 1em; | |
| 350 | +@ } | |
| 351 | +@ table.fossil_db_generic_query_view tr { | |
| 352 | +@ } | |
| 353 | +@ table.fossil_db_generic_query_view tr.even { | |
| 354 | +@ background: #ffffff; | |
| 355 | +@ } | |
| 356 | +@ table.fossil_db_generic_query_view tr.odd { | |
| 357 | +@ background: #e5e5e5; | |
| 358 | +@ } | |
| 359 | +@ table.fossil_db_generic_query_view tr.header { | |
| 360 | +@ background: #558195; | |
| 361 | +@ font-size: 1.5em; | |
| 362 | +@ color: #ffffff; | |
| 363 | +@ } | |
| 343 | 364 | ; |
| 344 | 365 | |
| 345 | 366 | /* |
| 346 | 367 | ** WEBPAGE: style.css |
| 347 | 368 | */ |
| 348 | 369 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -338,10 +338,31 @@ | |
| 338 | @ .achtung { |
| 339 | @ color: #ff0000; |
| 340 | @ background: #ffff00; |
| 341 | @ border: 1px solid #ff0000; |
| 342 | @ } |
| 343 | ; |
| 344 | |
| 345 | /* |
| 346 | ** WEBPAGE: style.css |
| 347 | */ |
| 348 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -338,10 +338,31 @@ | |
| 338 | @ .achtung { |
| 339 | @ color: #ff0000; |
| 340 | @ background: #ffff00; |
| 341 | @ border: 1px solid #ff0000; |
| 342 | @ } |
| 343 | @ |
| 344 | @ table.fossil_db_generic_query_view { |
| 345 | @ border-spacing: 0px; |
| 346 | @ border: 0px; |
| 347 | @ } |
| 348 | @ table.fossil_db_generic_query_view td { |
| 349 | @ padding: 2px 1em 2px 1em; |
| 350 | @ } |
| 351 | @ table.fossil_db_generic_query_view tr { |
| 352 | @ } |
| 353 | @ table.fossil_db_generic_query_view tr.even { |
| 354 | @ background: #ffffff; |
| 355 | @ } |
| 356 | @ table.fossil_db_generic_query_view tr.odd { |
| 357 | @ background: #e5e5e5; |
| 358 | @ } |
| 359 | @ table.fossil_db_generic_query_view tr.header { |
| 360 | @ background: #558195; |
| 361 | @ font-size: 1.5em; |
| 362 | @ color: #ffffff; |
| 363 | @ } |
| 364 | ; |
| 365 | |
| 366 | /* |
| 367 | ** WEBPAGE: style.css |
| 368 | */ |
| 369 |