Fossil SCM
Add the hash-color-test webpage.
Commit
748f975345d75f064502d8e20a91c9e7ba2355af
Parent
a87eaae301b9574…
1 file changed
+38
+38
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -169,10 +169,48 @@ | ||
| 169 | 169 | int i; |
| 170 | 170 | for(i=2; i<g.argc; i++){ |
| 171 | 171 | fossil_print("%20s: %s\n", g.argv[i], hash_color(g.argv[i])); |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | + | |
| 175 | +/* | |
| 176 | +** WEBPAGE: hash-color-test | |
| 177 | +** | |
| 178 | +** Print out the color names associated with each tag. Used for | |
| 179 | +** testing the hash_color() function. | |
| 180 | +*/ | |
| 181 | +void test_hash_color_page(void){ | |
| 182 | + const char *zBr; | |
| 183 | + char zNm[10]; | |
| 184 | + int i, cnt; | |
| 185 | + login_check_credentials(); | |
| 186 | + if( !g.perm.Read ){ login_needed(); return; } | |
| 187 | + | |
| 188 | + style_header("Hash Color Test"); | |
| 189 | + for(i=cnt=0; i<10; i++){ | |
| 190 | + sqlite3_snprintf(sizeof(zNm),zNm,"b%d",i); | |
| 191 | + zBr = P(zNm); | |
| 192 | + if( zBr && zBr[0] ){ | |
| 193 | + @ <p style='border:1px solid;background-color:%s(hash_color(zBr));'> | |
| 194 | + @ %h(zBr) - Omnes nos quasi oves erravimus unusquisque in viam | |
| 195 | + @ suam declinavit.</p> | |
| 196 | + cnt++; | |
| 197 | + } | |
| 198 | + } | |
| 199 | + if( cnt ){ | |
| 200 | + @ <hr> | |
| 201 | + } | |
| 202 | + @ <form method="post" action="%s(g.zTop)/hash-color-test"> | |
| 203 | + @ <p>Enter candidate branch names below and see them displayed in their | |
| 204 | + @ default background colors above.</p> | |
| 205 | + for(i=0; i<10; i++){ | |
| 206 | + @ <input type="text" size="30" name="b%d(i)"><br /> | |
| 207 | + } | |
| 208 | + @ <input type="submit"> | |
| 209 | + @ </form> | |
| 210 | + style_footer(); | |
| 211 | +} | |
| 174 | 212 | |
| 175 | 213 | /* |
| 176 | 214 | ** Output a timeline in the web format given a query. The query |
| 177 | 215 | ** should return these columns: |
| 178 | 216 | ** |
| 179 | 217 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -169,10 +169,48 @@ | |
| 169 | int i; |
| 170 | for(i=2; i<g.argc; i++){ |
| 171 | fossil_print("%20s: %s\n", g.argv[i], hash_color(g.argv[i])); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | /* |
| 176 | ** Output a timeline in the web format given a query. The query |
| 177 | ** should return these columns: |
| 178 | ** |
| 179 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -169,10 +169,48 @@ | |
| 169 | int i; |
| 170 | for(i=2; i<g.argc; i++){ |
| 171 | fossil_print("%20s: %s\n", g.argv[i], hash_color(g.argv[i])); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | /* |
| 176 | ** WEBPAGE: hash-color-test |
| 177 | ** |
| 178 | ** Print out the color names associated with each tag. Used for |
| 179 | ** testing the hash_color() function. |
| 180 | */ |
| 181 | void test_hash_color_page(void){ |
| 182 | const char *zBr; |
| 183 | char zNm[10]; |
| 184 | int i, cnt; |
| 185 | login_check_credentials(); |
| 186 | if( !g.perm.Read ){ login_needed(); return; } |
| 187 | |
| 188 | style_header("Hash Color Test"); |
| 189 | for(i=cnt=0; i<10; i++){ |
| 190 | sqlite3_snprintf(sizeof(zNm),zNm,"b%d",i); |
| 191 | zBr = P(zNm); |
| 192 | if( zBr && zBr[0] ){ |
| 193 | @ <p style='border:1px solid;background-color:%s(hash_color(zBr));'> |
| 194 | @ %h(zBr) - Omnes nos quasi oves erravimus unusquisque in viam |
| 195 | @ suam declinavit.</p> |
| 196 | cnt++; |
| 197 | } |
| 198 | } |
| 199 | if( cnt ){ |
| 200 | @ <hr> |
| 201 | } |
| 202 | @ <form method="post" action="%s(g.zTop)/hash-color-test"> |
| 203 | @ <p>Enter candidate branch names below and see them displayed in their |
| 204 | @ default background colors above.</p> |
| 205 | for(i=0; i<10; i++){ |
| 206 | @ <input type="text" size="30" name="b%d(i)"><br /> |
| 207 | } |
| 208 | @ <input type="submit"> |
| 209 | @ </form> |
| 210 | style_footer(); |
| 211 | } |
| 212 | |
| 213 | /* |
| 214 | ** Output a timeline in the web format given a query. The query |
| 215 | ** should return these columns: |
| 216 | ** |
| 217 |