Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 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. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | skin-setup-refactor |
Files: | files | file ages | folders |
SHA3-256: |
9bafe6cb601b35962d7b0c51c7761a5c |
User & Date: | drh 2017-12-02 14:39:54.405 |
Context
2017-12-02
| ||
16:22 | The URL parser now understands the /draftN/ prefix. Draft skins can now be initialized from built-ins. Another incremental check-in. ... (check-in: 0cba37ec user: drh tags: skin-setup-refactor) | |
14:39 | 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. ... (check-in: 9bafe6cb user: drh tags: skin-setup-refactor) | |
2017-11-30
| ||
19:42 | Fix an 'auto.def' issue that prevented using --with-tcl of a static Tcl with --static. ... (check-in: 28fd1c1b user: mistachkin tags: trunk) | |
Changes
Changes to src/skins.c.
1 2 3 4 5 6 | /* ** Copyright (c) 2009 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* ** Copyright (c) 2009 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) ** ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ |
︙ | ︙ | |||
353 354 355 356 357 358 359 | if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){ if( zNewName==0 ) zNewName = zOldName; style_header("Rename A Skin"); if( ex ){ @ <p><span class="generalError">There is already another skin @ named "%h(zNewName)". Choose a different name.</span></p> } | | | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){ if( zNewName==0 ) zNewName = zOldName; style_header("Rename A Skin"); if( ex ){ @ <p><span class="generalError">There is already another skin @ named "%h(zNewName)". Choose a different name.</span></p> } @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> @ <table border="0"><tr> @ <tr><td align="right">Current name:<td align="left"><b>%h(zOldName)</b> @ <tr><td align="right">New name:<td align="left"> @ <input type="text" size="35" name="newname" value="%h(zNewName)"> @ <tr><td><td> @ <input type="hidden" name="sn" value="%h(zOldName)"> @ <input type="submit" name="rename" value="Rename"> |
︙ | ︙ | |||
393 394 395 396 397 398 399 | if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){ if( zNewName==0 ) zNewName = ""; style_header("Save Current Skin"); if( ex ){ @ <p><span class="generalError">There is already another skin @ named "%h(zNewName)". Choose a different name.</span></p> } | | | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){ if( zNewName==0 ) zNewName = ""; style_header("Save Current Skin"); if( ex ){ @ <p><span class="generalError">There is already another skin @ named "%h(zNewName)". Choose a different name.</span></p> } @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> @ <table border="0"><tr> @ <tr><td align="right">Name for this skin:<td align="left"> @ <input type="text" size="35" name="svname" value="%h(zNewName)"> @ <tr><td><td> @ <input type="submit" name="save" value="Save"> @ <input type="submit" name="cansave" value="Cancel"> @ </table> |
︙ | ︙ | |||
415 416 417 418 419 420 421 | "VALUES('skin:%q',%Q,now())", zNewName, zCurrent ); return 0; } /* | | | | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | "VALUES('skin:%q',%Q,now())", zNewName, zCurrent ); return 0; } /* ** WEBPAGE: setup_skin_old ** ** Show a list of available skins with buttons for selecting which ** skin to use. Requires Admin privilege. */ void setup_skin_old(void){ const char *z; char *zName; char *zErr = 0; const char *zCurrent = 0; /* Current skin */ int i; /* Loop counter */ Stmt q; int seenCurrent = 0; |
︙ | ︙ | |||
443 444 445 446 447 448 449 | for(i=0; i<count(aBuiltinSkin); i++){ aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel); } /* Process requests to delete a user-defined skin */ if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){ style_header("Confirm Custom Skin Delete"); | | | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | for(i=0; i<count(aBuiltinSkin); i++){ aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel); } /* Process requests to delete a user-defined skin */ if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){ style_header("Confirm Custom Skin Delete"); @ <form action="%s(g.zTop)/setup_skin_old" method="post"><div> @ <p>Deletion of a custom skin is a permanent action that cannot @ be undone. Please confirm that this is what you want to do:</p> @ <input type="hidden" name="sn" value="%h(P("sn"))" /> @ <input type="submit" name="del2" value="Confirm - Delete The Skin" /> @ <input type="submit" name="cancel" value="Cancel - Do Not Delete" /> login_insert_csrf_secret(); @ </div></form> |
︙ | ︙ | |||
529 530 531 532 533 534 535 | for(i=0; i<count(aBuiltinSkin); i++){ z = aBuiltinSkin[i].zDesc; @ <tr><td>%d(i+1).<td>%h(z)<td> <td> if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ @ (Currently In Use) seenCurrent = 1; }else{ | | | | | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | for(i=0; i<count(aBuiltinSkin); i++){ z = aBuiltinSkin[i].zDesc; @ <tr><td>%d(i+1).<td>%h(z)<td> <td> if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ @ (Currently In Use) seenCurrent = 1; }else{ @ <form action="%s(g.zTop)/setup_skin_old" method="post"> @ <input type="hidden" name="sn" value="%h(z)" /> @ <input type="submit" name="load" value="Install" /> if( pAltSkin==&aBuiltinSkin[i] ){ @ (Current override) } @ </form> } @ </tr> } db_prepare(&q, "SELECT substr(name, 6), value FROM config" " WHERE name GLOB 'skin:*'" " ORDER BY name" ); while( db_step(&q)==SQLITE_ROW ){ const char *zN = db_column_text(&q, 0); const char *zV = db_column_text(&q, 1); i++; @ <tr><td>%d(i).<td>%h(zN)<td> <td> @ <form action="%s(g.zTop)/setup_skin_old" method="post"> if( fossil_strcmp(zV, zCurrent)==0 ){ @ (Currently In Use) seenCurrent = 1; }else{ @ <input type="submit" name="load" value="Install"> @ <input type="submit" name="del1" value="Delete"> } @ <input type="submit" name="rename" value="Rename"> @ <input type="hidden" name="sn" value="%h(zN)"> @ </form></tr> } db_finalize(&q); if( !seenCurrent ){ i++; @ <tr><td>%d(i).<td><i>Current Configuration</i><td> <td> @ <form action="%s(g.zTop)/setup_skin_old" method="post"> @ <input type="submit" name="save" value="Save"> @ </form> } @ </table> style_footer(); db_end_transaction(0); } |
︙ | ︙ | |||
620 621 622 623 624 625 626 | } style_header("%s", aSkinAttr[ii].zTitle); for(j=0; j<count(aSkinAttr); j++){ if( j==ii ) continue; style_submenu_element(aSkinAttr[j].zSubmenu, "%R/setup_skinedit?w=%d&basis=%h",j,zBasis); } | | | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | } style_header("%s", aSkinAttr[ii].zTitle); for(j=0; j<count(aSkinAttr); j++){ if( j==ii ) continue; style_submenu_element(aSkinAttr[j].zSubmenu, "%R/setup_skinedit?w=%d&basis=%h",j,zBasis); } style_submenu_element("Skins", "%R/setup_skin_old"); @ <form action="%s(g.zTop)/setup_skinedit" method="post"><div> login_insert_csrf_secret(); @ <input type='hidden' name='w' value='%d(ii)'> @ <h2>Edit %s(aSkinAttr[ii].zTitle):</h2> zContent = textarea_attribute("", 10, 80, aSkinAttr[ii].zFile, aSkinAttr[ii].zFile, builtin_text(zDflt), 0); @ <br /> |
︙ | ︙ | |||
666 667 668 669 670 671 672 | blob_reset(&to); blob_reset(&out); } @ </div></form> style_footer(); db_end_transaction(0); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | blob_reset(&to); blob_reset(&out); } @ </div></form> style_footer(); db_end_transaction(0); } /* ** WEBPAGE: setup_skin ** ** Generate a page showing the steps needed to customize a skin. */ void setup_skin(void){ int i; /* Loop counter */ int iSkin; /* Which draft skin is being edited */ static const char *azTestPages[] = { "home", "timeline", "dir?ci=tip", "dir?ci=tip&type=tree", "brlist", "info/trunk", }; iSkin = atoi(PD("sk","1")); if( iSkin<1 || iSkin>9 ) iSkin = 1; login_check_credentials(); style_header("Customize Skin"); #if 0 @ <p> cgi_print_all(0); @ </p> #endif @ <p>Customize the look of this Fossil repository by making changes @ to the CSS, Header, Footer, and Detail Settings in one of nine "draft" @ configurations. Then, after verifying that all is working correctly, @ publish the draft to become the new main Skin.<p> @ @ <a name='step1'></a> @ <h1>Step 1: Identify Which Draft To Use</h1> @ @ <p>The main skin of Fossil cannot be edited directly. Instead, @ edits are made to one of nine draft skins. A draft skin can then @ be published to become the default skin. @ Nine separate drafts are available to facilitate A/B testing.</p> @ @ <form method='POST' action='%R/setup_skin#step2' id='f01'> @ <p>Skin to edit: @ <select size='1' name='sk' onchange='gebi("f01").submit()'> for(i=1; i<=9; i++){ if( i==iSkin ){ @ <option value='%d(i)' selected>draft%d(i)</option> }else{ @ <option value='%d(i)'>draft%d(i)</option> } } @ </select> @ </p> @ @ <a name='step2'></a> @ <h1>Step 2: Authenticate @ @ <a name='step3'></a> @ <h1>Step 3: Initialize The Draft</h1> @ @ <a name='step4'></a> @ <h1>Step 4: Make Edits</h1> @ @ <a name='step5'></a> @ <h1>Step 5: Verify The Draft Skin</h1> @ @ <p>To test this draft skin, insert text "/draft%d(iSkin)/" just before the @ operation name in the URL. Here are a few links to try: @ <ul> for(i=0; i<sizeof(azTestPages)/sizeof(azTestPages[0]); i++){ @ <li><a href='%s(g.zBaseURL)/draft%d(iSkin)/%s(azTestPages[i])'>\ @ %s(g.zBaseURL)/draft%d(iSkin)/%s(azTestPages[i])</a> } @ </ul> @ @ <a name='step6'></a> @ <h1>Step 6: Publish The Draft</h1> if( !g.perm.Setup ){ @ <p>Only administrators are allowed to publish draft skins. Contact @ an administrator to get this "draft%d(iSkin)" skin published.</p> }else{ } @ @ <a name='step7'></a> @ <h1>Step 7: Cleanup</h1> style_footer(); } |