Fossil SCM
Rework the Setup/Skin page so that all edits are done on a draft, then tested, then the draft is published to become the default skin. This specific check-in is just the beginning. Must code needs to be added. This is just an incremental check-in.
Commit
9bafe6cb601b35962d7b0c51c7761a5c813e9547aab93b5438220b7dbaf4314f
Parent
28fd1c1bd4e438b…
1 file changed
+100
-10
+100
-10
| --- src/skins.c | ||
| +++ src/skins.c | ||
| @@ -2,11 +2,11 @@ | ||
| 2 | 2 | ** Copyright (c) 2009 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 Simplified BSD License (also |
| 6 | 6 | ** known as the "2-Clause License" or "FreeBSD License".) |
| 7 | - | |
| 7 | +** | |
| 8 | 8 | ** This program is distributed in the hope that it will be useful, |
| 9 | 9 | ** but without any warranty; without even the implied warranty of |
| 10 | 10 | ** merchantability or fitness for a particular purpose. |
| 11 | 11 | ** |
| 12 | 12 | ** Author contact information: |
| @@ -355,11 +355,11 @@ | ||
| 355 | 355 | style_header("Rename A Skin"); |
| 356 | 356 | if( ex ){ |
| 357 | 357 | @ <p><span class="generalError">There is already another skin |
| 358 | 358 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 359 | 359 | } |
| 360 | - @ <form action="%s(g.zTop)/setup_skin" method="post"><div> | |
| 360 | + @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> | |
| 361 | 361 | @ <table border="0"><tr> |
| 362 | 362 | @ <tr><td align="right">Current name:<td align="left"><b>%h(zOldName)</b> |
| 363 | 363 | @ <tr><td align="right">New name:<td align="left"> |
| 364 | 364 | @ <input type="text" size="35" name="newname" value="%h(zNewName)"> |
| 365 | 365 | @ <tr><td><td> |
| @@ -395,11 +395,11 @@ | ||
| 395 | 395 | style_header("Save Current Skin"); |
| 396 | 396 | if( ex ){ |
| 397 | 397 | @ <p><span class="generalError">There is already another skin |
| 398 | 398 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 399 | 399 | } |
| 400 | - @ <form action="%s(g.zTop)/setup_skin" method="post"><div> | |
| 400 | + @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> | |
| 401 | 401 | @ <table border="0"><tr> |
| 402 | 402 | @ <tr><td align="right">Name for this skin:<td align="left"> |
| 403 | 403 | @ <input type="text" size="35" name="svname" value="%h(zNewName)"> |
| 404 | 404 | @ <tr><td><td> |
| 405 | 405 | @ <input type="submit" name="save" value="Save"> |
| @@ -417,16 +417,16 @@ | ||
| 417 | 417 | ); |
| 418 | 418 | return 0; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | /* |
| 422 | -** WEBPAGE: setup_skin | |
| 422 | +** WEBPAGE: setup_skin_old | |
| 423 | 423 | ** |
| 424 | 424 | ** Show a list of available skins with buttons for selecting which |
| 425 | 425 | ** skin to use. Requires Admin privilege. |
| 426 | 426 | */ |
| 427 | -void setup_skin(void){ | |
| 427 | +void setup_skin_old(void){ | |
| 428 | 428 | const char *z; |
| 429 | 429 | char *zName; |
| 430 | 430 | char *zErr = 0; |
| 431 | 431 | const char *zCurrent = 0; /* Current skin */ |
| 432 | 432 | int i; /* Loop counter */ |
| @@ -445,11 +445,11 @@ | ||
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | /* Process requests to delete a user-defined skin */ |
| 448 | 448 | if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){ |
| 449 | 449 | style_header("Confirm Custom Skin Delete"); |
| 450 | - @ <form action="%s(g.zTop)/setup_skin" method="post"><div> | |
| 450 | + @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> | |
| 451 | 451 | @ <p>Deletion of a custom skin is a permanent action that cannot |
| 452 | 452 | @ be undone. Please confirm that this is what you want to do:</p> |
| 453 | 453 | @ <input type="hidden" name="sn" value="%h(P("sn"))" /> |
| 454 | 454 | @ <input type="submit" name="del2" value="Confirm - Delete The Skin" /> |
| 455 | 455 | @ <input type="submit" name="cancel" value="Cancel - Do Not Delete" /> |
| @@ -531,11 +531,11 @@ | ||
| 531 | 531 | @ <tr><td>%d(i+1).<td>%h(z)<td> <td> |
| 532 | 532 | if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ |
| 533 | 533 | @ (Currently In Use) |
| 534 | 534 | seenCurrent = 1; |
| 535 | 535 | }else{ |
| 536 | - @ <form action="%s(g.zTop)/setup_skin" method="post"> | |
| 536 | + @ <form action="%s(g.zTop)/setup_skin_old" method="post"> | |
| 537 | 537 | @ <input type="hidden" name="sn" value="%h(z)" /> |
| 538 | 538 | @ <input type="submit" name="load" value="Install" /> |
| 539 | 539 | if( pAltSkin==&aBuiltinSkin[i] ){ |
| 540 | 540 | @ (Current override) |
| 541 | 541 | } |
| @@ -551,11 +551,11 @@ | ||
| 551 | 551 | while( db_step(&q)==SQLITE_ROW ){ |
| 552 | 552 | const char *zN = db_column_text(&q, 0); |
| 553 | 553 | const char *zV = db_column_text(&q, 1); |
| 554 | 554 | i++; |
| 555 | 555 | @ <tr><td>%d(i).<td>%h(zN)<td> <td> |
| 556 | - @ <form action="%s(g.zTop)/setup_skin" method="post"> | |
| 556 | + @ <form action="%s(g.zTop)/setup_skin_old" method="post"> | |
| 557 | 557 | if( fossil_strcmp(zV, zCurrent)==0 ){ |
| 558 | 558 | @ (Currently In Use) |
| 559 | 559 | seenCurrent = 1; |
| 560 | 560 | }else{ |
| 561 | 561 | @ <input type="submit" name="load" value="Install"> |
| @@ -567,11 +567,11 @@ | ||
| 567 | 567 | } |
| 568 | 568 | db_finalize(&q); |
| 569 | 569 | if( !seenCurrent ){ |
| 570 | 570 | i++; |
| 571 | 571 | @ <tr><td>%d(i).<td><i>Current Configuration</i><td> <td> |
| 572 | - @ <form action="%s(g.zTop)/setup_skin" method="post"> | |
| 572 | + @ <form action="%s(g.zTop)/setup_skin_old" method="post"> | |
| 573 | 573 | @ <input type="submit" name="save" value="Save"> |
| 574 | 574 | @ </form> |
| 575 | 575 | } |
| 576 | 576 | @ </table> |
| 577 | 577 | style_footer(); |
| @@ -622,11 +622,11 @@ | ||
| 622 | 622 | for(j=0; j<count(aSkinAttr); j++){ |
| 623 | 623 | if( j==ii ) continue; |
| 624 | 624 | style_submenu_element(aSkinAttr[j].zSubmenu, |
| 625 | 625 | "%R/setup_skinedit?w=%d&basis=%h",j,zBasis); |
| 626 | 626 | } |
| 627 | - style_submenu_element("Skins", "%R/setup_skin"); | |
| 627 | + style_submenu_element("Skins", "%R/setup_skin_old"); | |
| 628 | 628 | @ <form action="%s(g.zTop)/setup_skinedit" method="post"><div> |
| 629 | 629 | login_insert_csrf_secret(); |
| 630 | 630 | @ <input type='hidden' name='w' value='%d(ii)'> |
| 631 | 631 | @ <h2>Edit %s(aSkinAttr[ii].zTitle):</h2> |
| 632 | 632 | zContent = textarea_attribute("", 10, 80, aSkinAttr[ii].zFile, |
| @@ -668,5 +668,95 @@ | ||
| 668 | 668 | } |
| 669 | 669 | @ </div></form> |
| 670 | 670 | style_footer(); |
| 671 | 671 | db_end_transaction(0); |
| 672 | 672 | } |
| 673 | + | |
| 674 | +/* | |
| 675 | +** WEBPAGE: setup_skin | |
| 676 | +** | |
| 677 | +** Generate a page showing the steps needed to customize a skin. | |
| 678 | +*/ | |
| 679 | +void setup_skin(void){ | |
| 680 | + int i; /* Loop counter */ | |
| 681 | + int iSkin; /* Which draft skin is being edited */ | |
| 682 | + static const char *azTestPages[] = { | |
| 683 | + "home", | |
| 684 | + "timeline", | |
| 685 | + "dir?ci=tip", | |
| 686 | + "dir?ci=tip&type=tree", | |
| 687 | + "brlist", | |
| 688 | + "info/trunk", | |
| 689 | + }; | |
| 690 | + | |
| 691 | + | |
| 692 | + iSkin = atoi(PD("sk","1")); | |
| 693 | + if( iSkin<1 || iSkin>9 ) iSkin = 1; | |
| 694 | + login_check_credentials(); | |
| 695 | + style_header("Customize Skin"); | |
| 696 | + | |
| 697 | +#if 0 | |
| 698 | + @ <p> | |
| 699 | + cgi_print_all(0); | |
| 700 | + @ </p> | |
| 701 | +#endif | |
| 702 | + | |
| 703 | + @ <p>Customize the look of this Fossil repository by making changes | |
| 704 | + @ to the CSS, Header, Footer, and Detail Settings in one of nine "draft" | |
| 705 | + @ configurations. Then, after verifying that all is working correctly, | |
| 706 | + @ publish the draft to become the new main Skin.<p> | |
| 707 | + @ | |
| 708 | + @ <a name='step1'></a> | |
| 709 | + @ <h1>Step 1: Identify Which Draft To Use</h1> | |
| 710 | + @ | |
| 711 | + @ <p>The main skin of Fossil cannot be edited directly. Instead, | |
| 712 | + @ edits are made to one of nine draft skins. A draft skin can then | |
| 713 | + @ be published to become the default skin. | |
| 714 | + @ Nine separate drafts are available to facilitate A/B testing.</p> | |
| 715 | + @ | |
| 716 | + @ <form method='POST' action='%R/setup_skin#step2' id='f01'> | |
| 717 | + @ <p>Skin to edit: | |
| 718 | + @ <select size='1' name='sk' onchange='gebi("f01").submit()'> | |
| 719 | + for(i=1; i<=9; i++){ | |
| 720 | + if( i==iSkin ){ | |
| 721 | + @ <option value='%d(i)' selected>draft%d(i)</option> | |
| 722 | + }else{ | |
| 723 | + @ <option value='%d(i)'>draft%d(i)</option> | |
| 724 | + } | |
| 725 | + } | |
| 726 | + @ </select> | |
| 727 | + @ </p> | |
| 728 | + @ | |
| 729 | + @ <a name='step2'></a> | |
| 730 | + @ <h1>Step 2: Authenticate | |
| 731 | + @ | |
| 732 | + @ <a name='step3'></a> | |
| 733 | + @ <h1>Step 3: Initialize The Draft</h1> | |
| 734 | + @ | |
| 735 | + @ <a name='step4'></a> | |
| 736 | + @ <h1>Step 4: Make Edits</h1> | |
| 737 | + @ | |
| 738 | + @ <a name='step5'></a> | |
| 739 | + @ <h1>Step 5: Verify The Draft Skin</h1> | |
| 740 | + @ | |
| 741 | + @ <p>To test this draft skin, insert text "/draft%d(iSkin)/" just before the | |
| 742 | + @ operation name in the URL. Here are a few links to try: | |
| 743 | + @ <ul> | |
| 744 | + for(i=0; i<sizeof(azTestPages)/sizeof(azTestPages[0]); i++){ | |
| 745 | + @ <li><a href='%s(g.zBaseURL)/draft%d(iSkin)/%s(azTestPages[i])'>\ | |
| 746 | + @ %s(g.zBaseURL)/draft%d(iSkin)/%s(azTestPages[i])</a> | |
| 747 | + } | |
| 748 | + @ </ul> | |
| 749 | + @ | |
| 750 | + @ <a name='step6'></a> | |
| 751 | + @ <h1>Step 6: Publish The Draft</h1> | |
| 752 | + if( !g.perm.Setup ){ | |
| 753 | + @ <p>Only administrators are allowed to publish draft skins. Contact | |
| 754 | + @ an administrator to get this "draft%d(iSkin)" skin published.</p> | |
| 755 | + }else{ | |
| 756 | + | |
| 757 | + } | |
| 758 | + @ | |
| 759 | + @ <a name='step7'></a> | |
| 760 | + @ <h1>Step 7: Cleanup</h1> | |
| 761 | + style_footer(); | |
| 762 | +} | |
| 673 | 763 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -2,11 +2,11 @@ | |
| 2 | ** Copyright (c) 2009 D. Richard Hipp |
| 3 | ** |
| 4 | ** This program is free software; you can redistribute it and/or |
| 5 | ** modify it under the terms of the Simplified BSD License (also |
| 6 | ** known as the "2-Clause License" or "FreeBSD License".) |
| 7 | |
| 8 | ** This program is distributed in the hope that it will be useful, |
| 9 | ** but without any warranty; without even the implied warranty of |
| 10 | ** merchantability or fitness for a particular purpose. |
| 11 | ** |
| 12 | ** Author contact information: |
| @@ -355,11 +355,11 @@ | |
| 355 | style_header("Rename A Skin"); |
| 356 | if( ex ){ |
| 357 | @ <p><span class="generalError">There is already another skin |
| 358 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 359 | } |
| 360 | @ <form action="%s(g.zTop)/setup_skin" method="post"><div> |
| 361 | @ <table border="0"><tr> |
| 362 | @ <tr><td align="right">Current name:<td align="left"><b>%h(zOldName)</b> |
| 363 | @ <tr><td align="right">New name:<td align="left"> |
| 364 | @ <input type="text" size="35" name="newname" value="%h(zNewName)"> |
| 365 | @ <tr><td><td> |
| @@ -395,11 +395,11 @@ | |
| 395 | style_header("Save Current Skin"); |
| 396 | if( ex ){ |
| 397 | @ <p><span class="generalError">There is already another skin |
| 398 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 399 | } |
| 400 | @ <form action="%s(g.zTop)/setup_skin" method="post"><div> |
| 401 | @ <table border="0"><tr> |
| 402 | @ <tr><td align="right">Name for this skin:<td align="left"> |
| 403 | @ <input type="text" size="35" name="svname" value="%h(zNewName)"> |
| 404 | @ <tr><td><td> |
| 405 | @ <input type="submit" name="save" value="Save"> |
| @@ -417,16 +417,16 @@ | |
| 417 | ); |
| 418 | return 0; |
| 419 | } |
| 420 | |
| 421 | /* |
| 422 | ** WEBPAGE: setup_skin |
| 423 | ** |
| 424 | ** Show a list of available skins with buttons for selecting which |
| 425 | ** skin to use. Requires Admin privilege. |
| 426 | */ |
| 427 | void setup_skin(void){ |
| 428 | const char *z; |
| 429 | char *zName; |
| 430 | char *zErr = 0; |
| 431 | const char *zCurrent = 0; /* Current skin */ |
| 432 | int i; /* Loop counter */ |
| @@ -445,11 +445,11 @@ | |
| 445 | } |
| 446 | |
| 447 | /* Process requests to delete a user-defined skin */ |
| 448 | if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){ |
| 449 | style_header("Confirm Custom Skin Delete"); |
| 450 | @ <form action="%s(g.zTop)/setup_skin" method="post"><div> |
| 451 | @ <p>Deletion of a custom skin is a permanent action that cannot |
| 452 | @ be undone. Please confirm that this is what you want to do:</p> |
| 453 | @ <input type="hidden" name="sn" value="%h(P("sn"))" /> |
| 454 | @ <input type="submit" name="del2" value="Confirm - Delete The Skin" /> |
| 455 | @ <input type="submit" name="cancel" value="Cancel - Do Not Delete" /> |
| @@ -531,11 +531,11 @@ | |
| 531 | @ <tr><td>%d(i+1).<td>%h(z)<td> <td> |
| 532 | if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ |
| 533 | @ (Currently In Use) |
| 534 | seenCurrent = 1; |
| 535 | }else{ |
| 536 | @ <form action="%s(g.zTop)/setup_skin" method="post"> |
| 537 | @ <input type="hidden" name="sn" value="%h(z)" /> |
| 538 | @ <input type="submit" name="load" value="Install" /> |
| 539 | if( pAltSkin==&aBuiltinSkin[i] ){ |
| 540 | @ (Current override) |
| 541 | } |
| @@ -551,11 +551,11 @@ | |
| 551 | while( db_step(&q)==SQLITE_ROW ){ |
| 552 | const char *zN = db_column_text(&q, 0); |
| 553 | const char *zV = db_column_text(&q, 1); |
| 554 | i++; |
| 555 | @ <tr><td>%d(i).<td>%h(zN)<td> <td> |
| 556 | @ <form action="%s(g.zTop)/setup_skin" method="post"> |
| 557 | if( fossil_strcmp(zV, zCurrent)==0 ){ |
| 558 | @ (Currently In Use) |
| 559 | seenCurrent = 1; |
| 560 | }else{ |
| 561 | @ <input type="submit" name="load" value="Install"> |
| @@ -567,11 +567,11 @@ | |
| 567 | } |
| 568 | db_finalize(&q); |
| 569 | if( !seenCurrent ){ |
| 570 | i++; |
| 571 | @ <tr><td>%d(i).<td><i>Current Configuration</i><td> <td> |
| 572 | @ <form action="%s(g.zTop)/setup_skin" method="post"> |
| 573 | @ <input type="submit" name="save" value="Save"> |
| 574 | @ </form> |
| 575 | } |
| 576 | @ </table> |
| 577 | style_footer(); |
| @@ -622,11 +622,11 @@ | |
| 622 | for(j=0; j<count(aSkinAttr); j++){ |
| 623 | if( j==ii ) continue; |
| 624 | style_submenu_element(aSkinAttr[j].zSubmenu, |
| 625 | "%R/setup_skinedit?w=%d&basis=%h",j,zBasis); |
| 626 | } |
| 627 | style_submenu_element("Skins", "%R/setup_skin"); |
| 628 | @ <form action="%s(g.zTop)/setup_skinedit" method="post"><div> |
| 629 | login_insert_csrf_secret(); |
| 630 | @ <input type='hidden' name='w' value='%d(ii)'> |
| 631 | @ <h2>Edit %s(aSkinAttr[ii].zTitle):</h2> |
| 632 | zContent = textarea_attribute("", 10, 80, aSkinAttr[ii].zFile, |
| @@ -668,5 +668,95 @@ | |
| 668 | } |
| 669 | @ </div></form> |
| 670 | style_footer(); |
| 671 | db_end_transaction(0); |
| 672 | } |
| 673 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -2,11 +2,11 @@ | |
| 2 | ** Copyright (c) 2009 D. Richard Hipp |
| 3 | ** |
| 4 | ** This program is free software; you can redistribute it and/or |
| 5 | ** modify it under the terms of the Simplified BSD License (also |
| 6 | ** known as the "2-Clause License" or "FreeBSD License".) |
| 7 | ** |
| 8 | ** This program is distributed in the hope that it will be useful, |
| 9 | ** but without any warranty; without even the implied warranty of |
| 10 | ** merchantability or fitness for a particular purpose. |
| 11 | ** |
| 12 | ** Author contact information: |
| @@ -355,11 +355,11 @@ | |
| 355 | style_header("Rename A Skin"); |
| 356 | if( ex ){ |
| 357 | @ <p><span class="generalError">There is already another skin |
| 358 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 359 | } |
| 360 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> |
| 361 | @ <table border="0"><tr> |
| 362 | @ <tr><td align="right">Current name:<td align="left"><b>%h(zOldName)</b> |
| 363 | @ <tr><td align="right">New name:<td align="left"> |
| 364 | @ <input type="text" size="35" name="newname" value="%h(zNewName)"> |
| 365 | @ <tr><td><td> |
| @@ -395,11 +395,11 @@ | |
| 395 | style_header("Save Current Skin"); |
| 396 | if( ex ){ |
| 397 | @ <p><span class="generalError">There is already another skin |
| 398 | @ named "%h(zNewName)". Choose a different name.</span></p> |
| 399 | } |
| 400 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> |
| 401 | @ <table border="0"><tr> |
| 402 | @ <tr><td align="right">Name for this skin:<td align="left"> |
| 403 | @ <input type="text" size="35" name="svname" value="%h(zNewName)"> |
| 404 | @ <tr><td><td> |
| 405 | @ <input type="submit" name="save" value="Save"> |
| @@ -417,16 +417,16 @@ | |
| 417 | ); |
| 418 | return 0; |
| 419 | } |
| 420 | |
| 421 | /* |
| 422 | ** WEBPAGE: setup_skin_old |
| 423 | ** |
| 424 | ** Show a list of available skins with buttons for selecting which |
| 425 | ** skin to use. Requires Admin privilege. |
| 426 | */ |
| 427 | void setup_skin_old(void){ |
| 428 | const char *z; |
| 429 | char *zName; |
| 430 | char *zErr = 0; |
| 431 | const char *zCurrent = 0; /* Current skin */ |
| 432 | int i; /* Loop counter */ |
| @@ -445,11 +445,11 @@ | |
| 445 | } |
| 446 | |
| 447 | /* Process requests to delete a user-defined skin */ |
| 448 | if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){ |
| 449 | style_header("Confirm Custom Skin Delete"); |
| 450 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> |
| 451 | @ <p>Deletion of a custom skin is a permanent action that cannot |
| 452 | @ be undone. Please confirm that this is what you want to do:</p> |
| 453 | @ <input type="hidden" name="sn" value="%h(P("sn"))" /> |
| 454 | @ <input type="submit" name="del2" value="Confirm - Delete The Skin" /> |
| 455 | @ <input type="submit" name="cancel" value="Cancel - Do Not Delete" /> |
| @@ -531,11 +531,11 @@ | |
| 531 | @ <tr><td>%d(i+1).<td>%h(z)<td> <td> |
| 532 | if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ |
| 533 | @ (Currently In Use) |
| 534 | seenCurrent = 1; |
| 535 | }else{ |
| 536 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"> |
| 537 | @ <input type="hidden" name="sn" value="%h(z)" /> |
| 538 | @ <input type="submit" name="load" value="Install" /> |
| 539 | if( pAltSkin==&aBuiltinSkin[i] ){ |
| 540 | @ (Current override) |
| 541 | } |
| @@ -551,11 +551,11 @@ | |
| 551 | while( db_step(&q)==SQLITE_ROW ){ |
| 552 | const char *zN = db_column_text(&q, 0); |
| 553 | const char *zV = db_column_text(&q, 1); |
| 554 | i++; |
| 555 | @ <tr><td>%d(i).<td>%h(zN)<td> <td> |
| 556 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"> |
| 557 | if( fossil_strcmp(zV, zCurrent)==0 ){ |
| 558 | @ (Currently In Use) |
| 559 | seenCurrent = 1; |
| 560 | }else{ |
| 561 | @ <input type="submit" name="load" value="Install"> |
| @@ -567,11 +567,11 @@ | |
| 567 | } |
| 568 | db_finalize(&q); |
| 569 | if( !seenCurrent ){ |
| 570 | i++; |
| 571 | @ <tr><td>%d(i).<td><i>Current Configuration</i><td> <td> |
| 572 | @ <form action="%s(g.zTop)/setup_skin_old" method="post"> |
| 573 | @ <input type="submit" name="save" value="Save"> |
| 574 | @ </form> |
| 575 | } |
| 576 | @ </table> |
| 577 | style_footer(); |
| @@ -622,11 +622,11 @@ | |
| 622 | for(j=0; j<count(aSkinAttr); j++){ |
| 623 | if( j==ii ) continue; |
| 624 | style_submenu_element(aSkinAttr[j].zSubmenu, |
| 625 | "%R/setup_skinedit?w=%d&basis=%h",j,zBasis); |
| 626 | } |
| 627 | style_submenu_element("Skins", "%R/setup_skin_old"); |
| 628 | @ <form action="%s(g.zTop)/setup_skinedit" method="post"><div> |
| 629 | login_insert_csrf_secret(); |
| 630 | @ <input type='hidden' name='w' value='%d(ii)'> |
| 631 | @ <h2>Edit %s(aSkinAttr[ii].zTitle):</h2> |
| 632 | zContent = textarea_attribute("", 10, 80, aSkinAttr[ii].zFile, |
| @@ -668,5 +668,95 @@ | |
| 668 | } |
| 669 | @ </div></form> |
| 670 | style_footer(); |
| 671 | db_end_transaction(0); |
| 672 | } |
| 673 | |
| 674 | /* |
| 675 | ** WEBPAGE: setup_skin |
| 676 | ** |
| 677 | ** Generate a page showing the steps needed to customize a skin. |
| 678 | */ |
| 679 | void setup_skin(void){ |
| 680 | int i; /* Loop counter */ |
| 681 | int iSkin; /* Which draft skin is being edited */ |
| 682 | static const char *azTestPages[] = { |
| 683 | "home", |
| 684 | "timeline", |
| 685 | "dir?ci=tip", |
| 686 | "dir?ci=tip&type=tree", |
| 687 | "brlist", |
| 688 | "info/trunk", |
| 689 | }; |
| 690 | |
| 691 | |
| 692 | iSkin = atoi(PD("sk","1")); |
| 693 | if( iSkin<1 || iSkin>9 ) iSkin = 1; |
| 694 | login_check_credentials(); |
| 695 | style_header("Customize Skin"); |
| 696 | |
| 697 | #if 0 |
| 698 | @ <p> |
| 699 | cgi_print_all(0); |
| 700 | @ </p> |
| 701 | #endif |
| 702 | |
| 703 | @ <p>Customize the look of this Fossil repository by making changes |
| 704 | @ to the CSS, Header, Footer, and Detail Settings in one of nine "draft" |
| 705 | @ configurations. Then, after verifying that all is working correctly, |
| 706 | @ publish the draft to become the new main Skin.<p> |
| 707 | @ |
| 708 | @ <a name='step1'></a> |
| 709 | @ <h1>Step 1: Identify Which Draft To Use</h1> |
| 710 | @ |
| 711 | @ <p>The main skin of Fossil cannot be edited directly. Instead, |
| 712 | @ edits are made to one of nine draft skins. A draft skin can then |
| 713 | @ be published to become the default skin. |
| 714 | @ Nine separate drafts are available to facilitate A/B testing.</p> |
| 715 | @ |
| 716 | @ <form method='POST' action='%R/setup_skin#step2' id='f01'> |
| 717 | @ <p>Skin to edit: |
| 718 | @ <select size='1' name='sk' onchange='gebi("f01").submit()'> |
| 719 | for(i=1; i<=9; i++){ |
| 720 | if( i==iSkin ){ |
| 721 | @ <option value='%d(i)' selected>draft%d(i)</option> |
| 722 | }else{ |
| 723 | @ <option value='%d(i)'>draft%d(i)</option> |
| 724 | } |
| 725 | } |
| 726 | @ </select> |
| 727 | @ </p> |
| 728 | @ |
| 729 | @ <a name='step2'></a> |
| 730 | @ <h1>Step 2: Authenticate |
| 731 | @ |
| 732 | @ <a name='step3'></a> |
| 733 | @ <h1>Step 3: Initialize The Draft</h1> |
| 734 | @ |
| 735 | @ <a name='step4'></a> |
| 736 | @ <h1>Step 4: Make Edits</h1> |
| 737 | @ |
| 738 | @ <a name='step5'></a> |
| 739 | @ <h1>Step 5: Verify The Draft Skin</h1> |
| 740 | @ |
| 741 | @ <p>To test this draft skin, insert text "/draft%d(iSkin)/" just before the |
| 742 | @ operation name in the URL. Here are a few links to try: |
| 743 | @ <ul> |
| 744 | for(i=0; i<sizeof(azTestPages)/sizeof(azTestPages[0]); i++){ |
| 745 | @ <li><a href='%s(g.zBaseURL)/draft%d(iSkin)/%s(azTestPages[i])'>\ |
| 746 | @ %s(g.zBaseURL)/draft%d(iSkin)/%s(azTestPages[i])</a> |
| 747 | } |
| 748 | @ </ul> |
| 749 | @ |
| 750 | @ <a name='step6'></a> |
| 751 | @ <h1>Step 6: Publish The Draft</h1> |
| 752 | if( !g.perm.Setup ){ |
| 753 | @ <p>Only administrators are allowed to publish draft skins. Contact |
| 754 | @ an administrator to get this "draft%d(iSkin)" skin published.</p> |
| 755 | }else{ |
| 756 | |
| 757 | } |
| 758 | @ |
| 759 | @ <a name='step7'></a> |
| 760 | @ <h1>Step 7: Cleanup</h1> |
| 761 | style_footer(); |
| 762 | } |
| 763 |