Fossil SCM
On the Skins admin page, add Step 8 which gives administrators a link to the legacy Skin control page, with updates to deal with drafts.
Commit
49d923bd819329662ae44c3fc301d6a3e75b8eb63f07076133f59355b0b0c36a
Parent
38762b9f6c56ad3…
1 file changed
+62
-33
+62
-33
| --- src/skins.c | ||
| +++ src/skins.c | ||
| @@ -379,11 +379,11 @@ | ||
| 379 | 379 | style_header("Rename A Skin"); |
| 380 | 380 | if( ex ){ |
| 381 | 381 | @ <p><span class="generalError">There is already another skin |
| 382 | 382 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 383 | 383 | } |
| 384 | - @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> | |
| 384 | + @ <form action="%s(g.zTop)/setup_skin_admin" method="post"><div> | |
| 385 | 385 | @ <table border="0"><tr> |
| 386 | 386 | @ <tr><td align="right">Current name:<td align="left"><b>%h(zOldName)</b> |
| 387 | 387 | @ <tr><td align="right">New name:<td align="left"> |
| 388 | 388 | @ <input type="text" size="35" name="newname" value="%h(zNewName)"> |
| 389 | 389 | @ <tr><td><td> |
| @@ -419,11 +419,11 @@ | ||
| 419 | 419 | style_header("Save Current Skin"); |
| 420 | 420 | if( ex ){ |
| 421 | 421 | @ <p><span class="generalError">There is already another skin |
| 422 | 422 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 423 | 423 | } |
| 424 | - @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> | |
| 424 | + @ <form action="%s(g.zTop)/setup_skin_admin" method="post"><div> | |
| 425 | 425 | @ <table border="0"><tr> |
| 426 | 426 | @ <tr><td align="right">Name for this skin:<td align="left"> |
| 427 | 427 | @ <input type="text" size="35" name="svname" value="%h(zNewName)"> |
| 428 | 428 | @ <tr><td><td> |
| 429 | 429 | @ <input type="submit" name="save" value="Save"> |
| @@ -440,25 +440,24 @@ | ||
| 440 | 440 | zNewName, zCurrent |
| 441 | 441 | ); |
| 442 | 442 | return 0; |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | -#if 0 | |
| 446 | 445 | /* |
| 447 | -** WEB**PAGE: setup_skin_old | |
| 446 | +** WEBPAGE: setup_skin_admin | |
| 448 | 447 | ** |
| 449 | -** Show a list of available skins with buttons for selecting which | |
| 450 | -** skin to use. Requires Setup privilege. | |
| 448 | +** Administrative actions on skins. For administrators only. | |
| 451 | 449 | */ |
| 452 | -void setup_skin_old(void){ | |
| 450 | +void setup_skin_admin(void){ | |
| 453 | 451 | const char *z; |
| 454 | 452 | char *zName; |
| 455 | 453 | char *zErr = 0; |
| 456 | 454 | const char *zCurrent = 0; /* Current skin */ |
| 457 | 455 | int i; /* Loop counter */ |
| 458 | 456 | Stmt q; |
| 459 | 457 | int seenCurrent = 0; |
| 458 | + int once; | |
| 460 | 459 | |
| 461 | 460 | login_check_credentials(); |
| 462 | 461 | if( !g.perm.Setup ){ |
| 463 | 462 | login_needed(0); |
| 464 | 463 | return; |
| @@ -470,11 +469,11 @@ | ||
| 470 | 469 | } |
| 471 | 470 | |
| 472 | 471 | /* Process requests to delete a user-defined skin */ |
| 473 | 472 | if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){ |
| 474 | 473 | style_header("Confirm Custom Skin Delete"); |
| 475 | - @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> | |
| 474 | + @ <form action="%s(g.zTop)/setup_skin_admin" method="post"><div> | |
| 476 | 475 | @ <p>Deletion of a custom skin is a permanent action that cannot |
| 477 | 476 | @ be undone. Please confirm that this is what you want to do:</p> |
| 478 | 477 | @ <input type="hidden" name="sn" value="%h(P("sn"))" /> |
| 479 | 478 | @ <input type="submit" name="del2" value="Confirm - Delete The Skin" /> |
| 480 | 479 | @ <input type="submit" name="cancel" value="Cancel - Do Not Delete" /> |
| @@ -483,10 +482,16 @@ | ||
| 483 | 482 | style_footer(); |
| 484 | 483 | return; |
| 485 | 484 | } |
| 486 | 485 | if( P("del2")!=0 && (zName = skinVarName(P("sn"), 1))!=0 ){ |
| 487 | 486 | db_multi_exec("DELETE FROM config WHERE name=%Q", zName); |
| 487 | + } | |
| 488 | + if( P("draftdel")!=0 ){ | |
| 489 | + const char *zDraft = P("name"); | |
| 490 | + if( sqlite3_strglob("draft[1-9]",zDraft)==0 ){ | |
| 491 | + db_multi_exec("DELETE FROM config WHERE name GLOB '%q-*'", zDraft); | |
| 492 | + } | |
| 488 | 493 | } |
| 489 | 494 | if( skinRename() ) return; |
| 490 | 495 | if( skinSave(zCurrent) ) return; |
| 491 | 496 | |
| 492 | 497 | /* The user pressed one of the "Install" buttons. */ |
| @@ -531,36 +536,20 @@ | ||
| 531 | 536 | |
| 532 | 537 | style_header("Skins"); |
| 533 | 538 | if( zErr ){ |
| 534 | 539 | @ <p style="color:red">%h(zErr)</p> |
| 535 | 540 | } |
| 536 | - @ <p>A "skin" is a combination of | |
| 537 | - @ <a href="setup_skinedit?w=0">CSS</a>, | |
| 538 | - @ <a href="setup_skinedit?w=2">Header</a>, | |
| 539 | - @ <a href="setup_skinedit?w=1">Footer</a>, and | |
| 540 | - @ <a href="setup_skinedit?w=3">Details</a> | |
| 541 | - @ that determines the look and feel | |
| 542 | - @ of the web interface.</p> | |
| 543 | - @ | |
| 544 | - if( pAltSkin ){ | |
| 545 | - @ <p class="generalError"> | |
| 546 | - @ This page is generated using an skin override named | |
| 547 | - @ "%h(pAltSkin->zLabel)". You can change the skin configuration | |
| 548 | - @ below, but the changes will not take effect until the Fossil server | |
| 549 | - @ is restarted without the override.</p> | |
| 550 | - @ | |
| 551 | - } | |
| 552 | - @ <h2>Available Skins:</h2> | |
| 553 | 541 | @ <table border="0"> |
| 542 | + @ <tr><td colspan=4><h2>Built-in Skins:</h2></td></th> | |
| 554 | 543 | for(i=0; i<count(aBuiltinSkin); i++){ |
| 555 | 544 | z = aBuiltinSkin[i].zDesc; |
| 556 | 545 | @ <tr><td>%d(i+1).<td>%h(z)<td> <td> |
| 557 | 546 | if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ |
| 558 | 547 | @ (Currently In Use) |
| 559 | 548 | seenCurrent = 1; |
| 560 | 549 | }else{ |
| 561 | - @ <form action="%s(g.zTop)/setup_skin_old" method="post"> | |
| 550 | + @ <form action="%s(g.zTop)/setup_skin_admin" method="post"> | |
| 562 | 551 | @ <input type="hidden" name="sn" value="%h(z)" /> |
| 563 | 552 | @ <input type="submit" name="load" value="Install" /> |
| 564 | 553 | if( pAltSkin==&aBuiltinSkin[i] ){ |
| 565 | 554 | @ (Current override) |
| 566 | 555 | } |
| @@ -571,16 +560,22 @@ | ||
| 571 | 560 | db_prepare(&q, |
| 572 | 561 | "SELECT substr(name, 6), value FROM config" |
| 573 | 562 | " WHERE name GLOB 'skin:*'" |
| 574 | 563 | " ORDER BY name" |
| 575 | 564 | ); |
| 565 | + once = 1; | |
| 576 | 566 | while( db_step(&q)==SQLITE_ROW ){ |
| 577 | 567 | const char *zN = db_column_text(&q, 0); |
| 578 | 568 | const char *zV = db_column_text(&q, 1); |
| 579 | 569 | i++; |
| 570 | + if( once ){ | |
| 571 | + once = 0; | |
| 572 | + @ <tr><td colspan=4><h2>Skins saved as "skin:*' entries \ | |
| 573 | + @ in the CONFIG table:</h2></td></tr> | |
| 574 | + } | |
| 580 | 575 | @ <tr><td>%d(i).<td>%h(zN)<td> <td> |
| 581 | - @ <form action="%s(g.zTop)/setup_skin_old" method="post"> | |
| 576 | + @ <form action="%s(g.zTop)/setup_skin_admin" method="post"> | |
| 582 | 577 | if( fossil_strcmp(zV, zCurrent)==0 ){ |
| 583 | 578 | @ (Currently In Use) |
| 584 | 579 | seenCurrent = 1; |
| 585 | 580 | }else{ |
| 586 | 581 | @ <input type="submit" name="load" value="Install"> |
| @@ -591,20 +586,43 @@ | ||
| 591 | 586 | @ </form></tr> |
| 592 | 587 | } |
| 593 | 588 | db_finalize(&q); |
| 594 | 589 | if( !seenCurrent ){ |
| 595 | 590 | i++; |
| 596 | - @ <tr><td>%d(i).<td><i>Current Configuration</i><td> <td> | |
| 597 | - @ <form action="%s(g.zTop)/setup_skin_old" method="post"> | |
| 598 | - @ <input type="submit" name="save" value="Save"> | |
| 591 | + @ <tr><td colspan=4><h2>Current skin in css/header/footer/details entries \ | |
| 592 | + @ in the CONFIG table:</h2></td></tr> | |
| 593 | + @ <tr><td>%d(i).<td><i>Current</i><td> <td> | |
| 594 | + @ <form action="%s(g.zTop)/setup_skin_admin" method="post"> | |
| 595 | + @ <input type="submit" name="save" value="Backup"> | |
| 599 | 596 | @ </form> |
| 600 | 597 | } |
| 598 | + db_prepare(&q, | |
| 599 | + "SELECT DISTINCT substr(name, 1, 6) FROM config" | |
| 600 | + " WHERE name GLOB 'draft[1-9]-*'" | |
| 601 | + " ORDER BY name" | |
| 602 | + ); | |
| 603 | + once = 1; | |
| 604 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 605 | + const char *zN = db_column_text(&q, 0); | |
| 606 | + i++; | |
| 607 | + if( once ){ | |
| 608 | + once = 0; | |
| 609 | + @ <tr><td colspan=4><h2>Draft skins stored as "draft[1-9]-*' entries \ | |
| 610 | + @ in the CONFIG table:</h2></td></tr> | |
| 611 | + } | |
| 612 | + @ <tr><td>%d(i).<td>%h(zN)<td> <td> | |
| 613 | + @ <form action="%s(g.zTop)/setup_skin_admin" method="post"> | |
| 614 | + @ <input type="submit" name="draftdel" value="Delete"> | |
| 615 | + @ <input type="hidden" name="name" value="%h(zN)"> | |
| 616 | + @ </form></tr> | |
| 617 | + } | |
| 618 | + db_finalize(&q); | |
| 619 | + | |
| 601 | 620 | @ </table> |
| 602 | 621 | style_footer(); |
| 603 | 622 | db_end_transaction(0); |
| 604 | 623 | } |
| 605 | -#endif | |
| 606 | 624 | |
| 607 | 625 | /* |
| 608 | 626 | ** WEBPAGE: setup_skinedit |
| 609 | 627 | ** |
| 610 | 628 | ** Edit aspects of a skin determined by the w= query parameter. |
| @@ -965,12 +983,12 @@ | ||
| 965 | 983 | @ |
| 966 | 984 | @ <p>Repeat <a href='#step4'>step 4</a> and |
| 967 | 985 | @ <a href='#step5'>step 5</a> as many times as necessary to create |
| 968 | 986 | @ a production-ready skin. |
| 969 | 987 | @ |
| 970 | - @ <a name='step6'></a> | |
| 971 | - @ <h1>Step 7: Publish The Draft</h1> | |
| 988 | + @ <a name='step7'></a> | |
| 989 | + @ <h1>Step 7: Publish</h1> | |
| 972 | 990 | @ |
| 973 | 991 | if( !g.perm.Setup ){ |
| 974 | 992 | @ <p>Only administrators are allowed to publish draft skins. Contact |
| 975 | 993 | @ an administrator to get this "draft%d(iSkin)" skin published.</p> |
| 976 | 994 | }else{ |
| @@ -989,7 +1007,18 @@ | ||
| 989 | 1007 | @ </p></form> |
| 990 | 1008 | @ |
| 991 | 1009 | @ <p>You will probably need to press Reload on your browser after |
| 992 | 1010 | @ publishing the new skin.</p> |
| 993 | 1011 | } |
| 1012 | + @ | |
| 1013 | + @ <a name='step8'></a> | |
| 1014 | + @ <h1>Step 8: Cleanup and Undo Actions</h1> | |
| 1015 | + @ | |
| 1016 | + if( !g.perm.Setup ){ | |
| 1017 | + @ <p>Administrators can optionally remove save legacy skins, or | |
| 1018 | + @ undo a prior publish | |
| 1019 | + }else{ | |
| 1020 | + @ <p>Visit the <a href='%R/setup_skin_admin'>Skin Admin</a> page | |
| 1021 | + @ for cleanup and recovery actions. | |
| 1022 | + } | |
| 994 | 1023 | style_footer(); |
| 995 | 1024 | } |
| 996 | 1025 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -379,11 +379,11 @@ | |
| 379 | style_header("Rename A Skin"); |
| 380 | if( ex ){ |
| 381 | @ <p><span class="generalError">There is already another skin |
| 382 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 383 | } |
| 384 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> |
| 385 | @ <table border="0"><tr> |
| 386 | @ <tr><td align="right">Current name:<td align="left"><b>%h(zOldName)</b> |
| 387 | @ <tr><td align="right">New name:<td align="left"> |
| 388 | @ <input type="text" size="35" name="newname" value="%h(zNewName)"> |
| 389 | @ <tr><td><td> |
| @@ -419,11 +419,11 @@ | |
| 419 | style_header("Save Current Skin"); |
| 420 | if( ex ){ |
| 421 | @ <p><span class="generalError">There is already another skin |
| 422 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 423 | } |
| 424 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> |
| 425 | @ <table border="0"><tr> |
| 426 | @ <tr><td align="right">Name for this skin:<td align="left"> |
| 427 | @ <input type="text" size="35" name="svname" value="%h(zNewName)"> |
| 428 | @ <tr><td><td> |
| 429 | @ <input type="submit" name="save" value="Save"> |
| @@ -440,25 +440,24 @@ | |
| 440 | zNewName, zCurrent |
| 441 | ); |
| 442 | return 0; |
| 443 | } |
| 444 | |
| 445 | #if 0 |
| 446 | /* |
| 447 | ** WEB**PAGE: setup_skin_old |
| 448 | ** |
| 449 | ** Show a list of available skins with buttons for selecting which |
| 450 | ** skin to use. Requires Setup privilege. |
| 451 | */ |
| 452 | void setup_skin_old(void){ |
| 453 | const char *z; |
| 454 | char *zName; |
| 455 | char *zErr = 0; |
| 456 | const char *zCurrent = 0; /* Current skin */ |
| 457 | int i; /* Loop counter */ |
| 458 | Stmt q; |
| 459 | int seenCurrent = 0; |
| 460 | |
| 461 | login_check_credentials(); |
| 462 | if( !g.perm.Setup ){ |
| 463 | login_needed(0); |
| 464 | return; |
| @@ -470,11 +469,11 @@ | |
| 470 | } |
| 471 | |
| 472 | /* Process requests to delete a user-defined skin */ |
| 473 | if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){ |
| 474 | style_header("Confirm Custom Skin Delete"); |
| 475 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> |
| 476 | @ <p>Deletion of a custom skin is a permanent action that cannot |
| 477 | @ be undone. Please confirm that this is what you want to do:</p> |
| 478 | @ <input type="hidden" name="sn" value="%h(P("sn"))" /> |
| 479 | @ <input type="submit" name="del2" value="Confirm - Delete The Skin" /> |
| 480 | @ <input type="submit" name="cancel" value="Cancel - Do Not Delete" /> |
| @@ -483,10 +482,16 @@ | |
| 483 | style_footer(); |
| 484 | return; |
| 485 | } |
| 486 | if( P("del2")!=0 && (zName = skinVarName(P("sn"), 1))!=0 ){ |
| 487 | db_multi_exec("DELETE FROM config WHERE name=%Q", zName); |
| 488 | } |
| 489 | if( skinRename() ) return; |
| 490 | if( skinSave(zCurrent) ) return; |
| 491 | |
| 492 | /* The user pressed one of the "Install" buttons. */ |
| @@ -531,36 +536,20 @@ | |
| 531 | |
| 532 | style_header("Skins"); |
| 533 | if( zErr ){ |
| 534 | @ <p style="color:red">%h(zErr)</p> |
| 535 | } |
| 536 | @ <p>A "skin" is a combination of |
| 537 | @ <a href="setup_skinedit?w=0">CSS</a>, |
| 538 | @ <a href="setup_skinedit?w=2">Header</a>, |
| 539 | @ <a href="setup_skinedit?w=1">Footer</a>, and |
| 540 | @ <a href="setup_skinedit?w=3">Details</a> |
| 541 | @ that determines the look and feel |
| 542 | @ of the web interface.</p> |
| 543 | @ |
| 544 | if( pAltSkin ){ |
| 545 | @ <p class="generalError"> |
| 546 | @ This page is generated using an skin override named |
| 547 | @ "%h(pAltSkin->zLabel)". You can change the skin configuration |
| 548 | @ below, but the changes will not take effect until the Fossil server |
| 549 | @ is restarted without the override.</p> |
| 550 | @ |
| 551 | } |
| 552 | @ <h2>Available Skins:</h2> |
| 553 | @ <table border="0"> |
| 554 | for(i=0; i<count(aBuiltinSkin); i++){ |
| 555 | z = aBuiltinSkin[i].zDesc; |
| 556 | @ <tr><td>%d(i+1).<td>%h(z)<td> <td> |
| 557 | if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ |
| 558 | @ (Currently In Use) |
| 559 | seenCurrent = 1; |
| 560 | }else{ |
| 561 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"> |
| 562 | @ <input type="hidden" name="sn" value="%h(z)" /> |
| 563 | @ <input type="submit" name="load" value="Install" /> |
| 564 | if( pAltSkin==&aBuiltinSkin[i] ){ |
| 565 | @ (Current override) |
| 566 | } |
| @@ -571,16 +560,22 @@ | |
| 571 | db_prepare(&q, |
| 572 | "SELECT substr(name, 6), value FROM config" |
| 573 | " WHERE name GLOB 'skin:*'" |
| 574 | " ORDER BY name" |
| 575 | ); |
| 576 | while( db_step(&q)==SQLITE_ROW ){ |
| 577 | const char *zN = db_column_text(&q, 0); |
| 578 | const char *zV = db_column_text(&q, 1); |
| 579 | i++; |
| 580 | @ <tr><td>%d(i).<td>%h(zN)<td> <td> |
| 581 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"> |
| 582 | if( fossil_strcmp(zV, zCurrent)==0 ){ |
| 583 | @ (Currently In Use) |
| 584 | seenCurrent = 1; |
| 585 | }else{ |
| 586 | @ <input type="submit" name="load" value="Install"> |
| @@ -591,20 +586,43 @@ | |
| 591 | @ </form></tr> |
| 592 | } |
| 593 | db_finalize(&q); |
| 594 | if( !seenCurrent ){ |
| 595 | i++; |
| 596 | @ <tr><td>%d(i).<td><i>Current Configuration</i><td> <td> |
| 597 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"> |
| 598 | @ <input type="submit" name="save" value="Save"> |
| 599 | @ </form> |
| 600 | } |
| 601 | @ </table> |
| 602 | style_footer(); |
| 603 | db_end_transaction(0); |
| 604 | } |
| 605 | #endif |
| 606 | |
| 607 | /* |
| 608 | ** WEBPAGE: setup_skinedit |
| 609 | ** |
| 610 | ** Edit aspects of a skin determined by the w= query parameter. |
| @@ -965,12 +983,12 @@ | |
| 965 | @ |
| 966 | @ <p>Repeat <a href='#step4'>step 4</a> and |
| 967 | @ <a href='#step5'>step 5</a> as many times as necessary to create |
| 968 | @ a production-ready skin. |
| 969 | @ |
| 970 | @ <a name='step6'></a> |
| 971 | @ <h1>Step 7: Publish The Draft</h1> |
| 972 | @ |
| 973 | if( !g.perm.Setup ){ |
| 974 | @ <p>Only administrators are allowed to publish draft skins. Contact |
| 975 | @ an administrator to get this "draft%d(iSkin)" skin published.</p> |
| 976 | }else{ |
| @@ -989,7 +1007,18 @@ | |
| 989 | @ </p></form> |
| 990 | @ |
| 991 | @ <p>You will probably need to press Reload on your browser after |
| 992 | @ publishing the new skin.</p> |
| 993 | } |
| 994 | style_footer(); |
| 995 | } |
| 996 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -379,11 +379,11 @@ | |
| 379 | style_header("Rename A Skin"); |
| 380 | if( ex ){ |
| 381 | @ <p><span class="generalError">There is already another skin |
| 382 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 383 | } |
| 384 | @ <form action="%s(g.zTop)/setup_skin_admin" method="post"><div> |
| 385 | @ <table border="0"><tr> |
| 386 | @ <tr><td align="right">Current name:<td align="left"><b>%h(zOldName)</b> |
| 387 | @ <tr><td align="right">New name:<td align="left"> |
| 388 | @ <input type="text" size="35" name="newname" value="%h(zNewName)"> |
| 389 | @ <tr><td><td> |
| @@ -419,11 +419,11 @@ | |
| 419 | style_header("Save Current Skin"); |
| 420 | if( ex ){ |
| 421 | @ <p><span class="generalError">There is already another skin |
| 422 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 423 | } |
| 424 | @ <form action="%s(g.zTop)/setup_skin_admin" method="post"><div> |
| 425 | @ <table border="0"><tr> |
| 426 | @ <tr><td align="right">Name for this skin:<td align="left"> |
| 427 | @ <input type="text" size="35" name="svname" value="%h(zNewName)"> |
| 428 | @ <tr><td><td> |
| 429 | @ <input type="submit" name="save" value="Save"> |
| @@ -440,25 +440,24 @@ | |
| 440 | zNewName, zCurrent |
| 441 | ); |
| 442 | return 0; |
| 443 | } |
| 444 | |
| 445 | /* |
| 446 | ** WEBPAGE: setup_skin_admin |
| 447 | ** |
| 448 | ** Administrative actions on skins. For administrators only. |
| 449 | */ |
| 450 | void setup_skin_admin(void){ |
| 451 | const char *z; |
| 452 | char *zName; |
| 453 | char *zErr = 0; |
| 454 | const char *zCurrent = 0; /* Current skin */ |
| 455 | int i; /* Loop counter */ |
| 456 | Stmt q; |
| 457 | int seenCurrent = 0; |
| 458 | int once; |
| 459 | |
| 460 | login_check_credentials(); |
| 461 | if( !g.perm.Setup ){ |
| 462 | login_needed(0); |
| 463 | return; |
| @@ -470,11 +469,11 @@ | |
| 469 | } |
| 470 | |
| 471 | /* Process requests to delete a user-defined skin */ |
| 472 | if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){ |
| 473 | style_header("Confirm Custom Skin Delete"); |
| 474 | @ <form action="%s(g.zTop)/setup_skin_admin" method="post"><div> |
| 475 | @ <p>Deletion of a custom skin is a permanent action that cannot |
| 476 | @ be undone. Please confirm that this is what you want to do:</p> |
| 477 | @ <input type="hidden" name="sn" value="%h(P("sn"))" /> |
| 478 | @ <input type="submit" name="del2" value="Confirm - Delete The Skin" /> |
| 479 | @ <input type="submit" name="cancel" value="Cancel - Do Not Delete" /> |
| @@ -483,10 +482,16 @@ | |
| 482 | style_footer(); |
| 483 | return; |
| 484 | } |
| 485 | if( P("del2")!=0 && (zName = skinVarName(P("sn"), 1))!=0 ){ |
| 486 | db_multi_exec("DELETE FROM config WHERE name=%Q", zName); |
| 487 | } |
| 488 | if( P("draftdel")!=0 ){ |
| 489 | const char *zDraft = P("name"); |
| 490 | if( sqlite3_strglob("draft[1-9]",zDraft)==0 ){ |
| 491 | db_multi_exec("DELETE FROM config WHERE name GLOB '%q-*'", zDraft); |
| 492 | } |
| 493 | } |
| 494 | if( skinRename() ) return; |
| 495 | if( skinSave(zCurrent) ) return; |
| 496 | |
| 497 | /* The user pressed one of the "Install" buttons. */ |
| @@ -531,36 +536,20 @@ | |
| 536 | |
| 537 | style_header("Skins"); |
| 538 | if( zErr ){ |
| 539 | @ <p style="color:red">%h(zErr)</p> |
| 540 | } |
| 541 | @ <table border="0"> |
| 542 | @ <tr><td colspan=4><h2>Built-in Skins:</h2></td></th> |
| 543 | for(i=0; i<count(aBuiltinSkin); i++){ |
| 544 | z = aBuiltinSkin[i].zDesc; |
| 545 | @ <tr><td>%d(i+1).<td>%h(z)<td> <td> |
| 546 | if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ |
| 547 | @ (Currently In Use) |
| 548 | seenCurrent = 1; |
| 549 | }else{ |
| 550 | @ <form action="%s(g.zTop)/setup_skin_admin" method="post"> |
| 551 | @ <input type="hidden" name="sn" value="%h(z)" /> |
| 552 | @ <input type="submit" name="load" value="Install" /> |
| 553 | if( pAltSkin==&aBuiltinSkin[i] ){ |
| 554 | @ (Current override) |
| 555 | } |
| @@ -571,16 +560,22 @@ | |
| 560 | db_prepare(&q, |
| 561 | "SELECT substr(name, 6), value FROM config" |
| 562 | " WHERE name GLOB 'skin:*'" |
| 563 | " ORDER BY name" |
| 564 | ); |
| 565 | once = 1; |
| 566 | while( db_step(&q)==SQLITE_ROW ){ |
| 567 | const char *zN = db_column_text(&q, 0); |
| 568 | const char *zV = db_column_text(&q, 1); |
| 569 | i++; |
| 570 | if( once ){ |
| 571 | once = 0; |
| 572 | @ <tr><td colspan=4><h2>Skins saved as "skin:*' entries \ |
| 573 | @ in the CONFIG table:</h2></td></tr> |
| 574 | } |
| 575 | @ <tr><td>%d(i).<td>%h(zN)<td> <td> |
| 576 | @ <form action="%s(g.zTop)/setup_skin_admin" method="post"> |
| 577 | if( fossil_strcmp(zV, zCurrent)==0 ){ |
| 578 | @ (Currently In Use) |
| 579 | seenCurrent = 1; |
| 580 | }else{ |
| 581 | @ <input type="submit" name="load" value="Install"> |
| @@ -591,20 +586,43 @@ | |
| 586 | @ </form></tr> |
| 587 | } |
| 588 | db_finalize(&q); |
| 589 | if( !seenCurrent ){ |
| 590 | i++; |
| 591 | @ <tr><td colspan=4><h2>Current skin in css/header/footer/details entries \ |
| 592 | @ in the CONFIG table:</h2></td></tr> |
| 593 | @ <tr><td>%d(i).<td><i>Current</i><td> <td> |
| 594 | @ <form action="%s(g.zTop)/setup_skin_admin" method="post"> |
| 595 | @ <input type="submit" name="save" value="Backup"> |
| 596 | @ </form> |
| 597 | } |
| 598 | db_prepare(&q, |
| 599 | "SELECT DISTINCT substr(name, 1, 6) FROM config" |
| 600 | " WHERE name GLOB 'draft[1-9]-*'" |
| 601 | " ORDER BY name" |
| 602 | ); |
| 603 | once = 1; |
| 604 | while( db_step(&q)==SQLITE_ROW ){ |
| 605 | const char *zN = db_column_text(&q, 0); |
| 606 | i++; |
| 607 | if( once ){ |
| 608 | once = 0; |
| 609 | @ <tr><td colspan=4><h2>Draft skins stored as "draft[1-9]-*' entries \ |
| 610 | @ in the CONFIG table:</h2></td></tr> |
| 611 | } |
| 612 | @ <tr><td>%d(i).<td>%h(zN)<td> <td> |
| 613 | @ <form action="%s(g.zTop)/setup_skin_admin" method="post"> |
| 614 | @ <input type="submit" name="draftdel" value="Delete"> |
| 615 | @ <input type="hidden" name="name" value="%h(zN)"> |
| 616 | @ </form></tr> |
| 617 | } |
| 618 | db_finalize(&q); |
| 619 | |
| 620 | @ </table> |
| 621 | style_footer(); |
| 622 | db_end_transaction(0); |
| 623 | } |
| 624 | |
| 625 | /* |
| 626 | ** WEBPAGE: setup_skinedit |
| 627 | ** |
| 628 | ** Edit aspects of a skin determined by the w= query parameter. |
| @@ -965,12 +983,12 @@ | |
| 983 | @ |
| 984 | @ <p>Repeat <a href='#step4'>step 4</a> and |
| 985 | @ <a href='#step5'>step 5</a> as many times as necessary to create |
| 986 | @ a production-ready skin. |
| 987 | @ |
| 988 | @ <a name='step7'></a> |
| 989 | @ <h1>Step 7: Publish</h1> |
| 990 | @ |
| 991 | if( !g.perm.Setup ){ |
| 992 | @ <p>Only administrators are allowed to publish draft skins. Contact |
| 993 | @ an administrator to get this "draft%d(iSkin)" skin published.</p> |
| 994 | }else{ |
| @@ -989,7 +1007,18 @@ | |
| 1007 | @ </p></form> |
| 1008 | @ |
| 1009 | @ <p>You will probably need to press Reload on your browser after |
| 1010 | @ publishing the new skin.</p> |
| 1011 | } |
| 1012 | @ |
| 1013 | @ <a name='step8'></a> |
| 1014 | @ <h1>Step 8: Cleanup and Undo Actions</h1> |
| 1015 | @ |
| 1016 | if( !g.perm.Setup ){ |
| 1017 | @ <p>Administrators can optionally remove save legacy skins, or |
| 1018 | @ undo a prior publish |
| 1019 | }else{ |
| 1020 | @ <p>Visit the <a href='%R/setup_skin_admin'>Skin Admin</a> page |
| 1021 | @ for cleanup and recovery actions. |
| 1022 | } |
| 1023 | style_footer(); |
| 1024 | } |
| 1025 |