Fossil SCM
Improvements to the Skin setup interface.
Commit
33cc83ffb8550a8b7e78087242e6cf6ec9c06aeaf3c0a2b3040b6b89e13028c8
Parent
24e015de71cfdc7…
2 files changed
+1
-1
+56
-11
+1
-1
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -143,11 +143,11 @@ | ||
| 143 | 143 | setup_menu_entry("Notification", "setup_notification", |
| 144 | 144 | "Automatic notifications of changes via outbound email"); |
| 145 | 145 | setup_menu_entry("Transfers", "xfersetup", |
| 146 | 146 | "Configure the transfer system for this repository"); |
| 147 | 147 | } |
| 148 | - setup_menu_entry("Skins", "setup_skin", | |
| 148 | + setup_menu_entry("Skins", "setup_skin_admin", | |
| 149 | 149 | "Select and/or modify the web interface \"skins\""); |
| 150 | 150 | setup_menu_entry("Moderation", "setup_modreq", |
| 151 | 151 | "Enable/Disable requiring moderator approval of Wiki and/or Ticket" |
| 152 | 152 | " changes and attachments."); |
| 153 | 153 | setup_menu_entry("Ad-Unit", "setup_adunit", |
| 154 | 154 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -143,11 +143,11 @@ | |
| 143 | setup_menu_entry("Notification", "setup_notification", |
| 144 | "Automatic notifications of changes via outbound email"); |
| 145 | setup_menu_entry("Transfers", "xfersetup", |
| 146 | "Configure the transfer system for this repository"); |
| 147 | } |
| 148 | setup_menu_entry("Skins", "setup_skin", |
| 149 | "Select and/or modify the web interface \"skins\""); |
| 150 | setup_menu_entry("Moderation", "setup_modreq", |
| 151 | "Enable/Disable requiring moderator approval of Wiki and/or Ticket" |
| 152 | " changes and attachments."); |
| 153 | setup_menu_entry("Ad-Unit", "setup_adunit", |
| 154 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -143,11 +143,11 @@ | |
| 143 | setup_menu_entry("Notification", "setup_notification", |
| 144 | "Automatic notifications of changes via outbound email"); |
| 145 | setup_menu_entry("Transfers", "xfersetup", |
| 146 | "Configure the transfer system for this repository"); |
| 147 | } |
| 148 | setup_menu_entry("Skins", "setup_skin_admin", |
| 149 | "Select and/or modify the web interface \"skins\""); |
| 150 | setup_menu_entry("Moderation", "setup_modreq", |
| 151 | "Enable/Disable requiring moderator approval of Wiki and/or Ticket" |
| 152 | " changes and attachments."); |
| 153 | setup_menu_entry("Ad-Unit", "setup_adunit", |
| 154 |
+56
-11
| --- src/skins.c | ||
| +++ src/skins.c | ||
| @@ -573,10 +573,12 @@ | ||
| 573 | 573 | const char *zCurrent = 0; /* Current skin */ |
| 574 | 574 | int i; /* Loop counter */ |
| 575 | 575 | Stmt q; |
| 576 | 576 | int seenCurrent = 0; |
| 577 | 577 | int once; |
| 578 | + const char *zInstalled = 0; | |
| 579 | + const char *zOverride = 0; | |
| 578 | 580 | |
| 579 | 581 | login_check_credentials(); |
| 580 | 582 | if( !g.perm.Admin ){ |
| 581 | 583 | login_needed(0); |
| 582 | 584 | return; |
| @@ -615,10 +617,15 @@ | ||
| 615 | 617 | if( sqlite3_strglob("draft[1-9]",zDraft)==0 ){ |
| 616 | 618 | db_unprotect(PROTECT_CONFIG); |
| 617 | 619 | db_multi_exec("DELETE FROM config WHERE name GLOB '%q-*'", zDraft); |
| 618 | 620 | db_protect_pop(); |
| 619 | 621 | } |
| 622 | + } | |
| 623 | + if( P("editdraft")!=0 ){ | |
| 624 | + db_end_transaction(0); | |
| 625 | + cgi_redirectf("%R/setup_skin"); | |
| 626 | + return; | |
| 620 | 627 | } |
| 621 | 628 | if( skinRename() || skinSave(zCurrent) ){ |
| 622 | 629 | db_end_transaction(0); |
| 623 | 630 | return; |
| 624 | 631 | } |
| @@ -678,23 +685,51 @@ | ||
| 678 | 685 | @ <tr><td colspan=4><h2>Built-in Skins:</h2></td></th> |
| 679 | 686 | for(i=0; i<count(aBuiltinSkin); i++){ |
| 680 | 687 | z = aBuiltinSkin[i].zDesc; |
| 681 | 688 | @ <tr><td>%d(i+1).<td>%h(z)<td> <td> |
| 682 | 689 | if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ |
| 683 | - @ (Currently In Use) | |
| 690 | + @ (Installed) | |
| 691 | + zInstalled = z; | |
| 684 | 692 | seenCurrent = 1; |
| 685 | 693 | }else{ |
| 686 | 694 | @ <form action="%R/setup_skin_admin" method="post"> |
| 687 | 695 | @ <input type="hidden" name="sn" value="%h(z)"> |
| 688 | 696 | @ <input type="submit" name="load" value="Install"> |
| 689 | 697 | login_insert_csrf_secret(); |
| 690 | 698 | if( pAltSkin==&aBuiltinSkin[i] ){ |
| 691 | - @ (Current override) | |
| 699 | + zOverride = z; | |
| 700 | + @ (Currently Used) | |
| 692 | 701 | } |
| 693 | 702 | @ </form> |
| 694 | 703 | } |
| 695 | 704 | @ </tr> |
| 705 | + } | |
| 706 | + if( zOverride ){ | |
| 707 | + @ <tr><td> <td colspan="3"> | |
| 708 | + @ <p>Note: Built-in skin "%h(zOverride)" is currently being used because of | |
| 709 | + switch( iSkinSource ){ | |
| 710 | + case SKIN_FROM_CMDLINE: | |
| 711 | + @ the --skin command-line option. | |
| 712 | + break; | |
| 713 | + case SKIN_FROM_CGI: | |
| 714 | + @ the "skin:" option on CGI script. | |
| 715 | + break; | |
| 716 | + case SKIN_FROM_QPARAM: | |
| 717 | + @ the "skin=NAME" query parameter. | |
| 718 | + break; | |
| 719 | + case SKIN_FROM_COOKIE: | |
| 720 | + @ the "skin" value of the | |
| 721 | + @ <a href='./fdscookie'>fossil_display_setting</a> cookie. | |
| 722 | + break; | |
| 723 | + case SKIN_FROM_SETTING: | |
| 724 | + @ the "default-skin" setting. | |
| 725 | + break; | |
| 726 | + default: | |
| 727 | + @ reasons unknown. (Fix me!) | |
| 728 | + break; | |
| 729 | + } | |
| 730 | + @ </tr> | |
| 696 | 731 | } |
| 697 | 732 | db_prepare(&q, |
| 698 | 733 | "SELECT substr(name, 6), value FROM config" |
| 699 | 734 | " WHERE name GLOB 'skin:*'" |
| 700 | 735 | " ORDER BY name" |
| @@ -704,18 +739,19 @@ | ||
| 704 | 739 | const char *zN = db_column_text(&q, 0); |
| 705 | 740 | const char *zV = db_column_text(&q, 1); |
| 706 | 741 | i++; |
| 707 | 742 | if( once ){ |
| 708 | 743 | once = 0; |
| 709 | - @ <tr><td colspan=4><h2>Skins saved as "skin:*' entries \ | |
| 744 | + @ <tr><td colspan=4><h2>Backup skins saved as "skin:*' entries \ | |
| 710 | 745 | @ in the CONFIG table:</h2></td></tr> |
| 711 | 746 | } |
| 712 | 747 | @ <tr><td>%d(i).<td>%h(zN)<td> <td> |
| 713 | 748 | @ <form action="%R/setup_skin_admin" method="post"> |
| 714 | 749 | login_insert_csrf_secret(); |
| 715 | 750 | if( fossil_strcmp(zV, zCurrent)==0 ){ |
| 716 | - @ (Currently In Use) | |
| 751 | + @ (Installed) | |
| 752 | + zInstalled = mprintf("%s", zN); | |
| 717 | 753 | seenCurrent = 1; |
| 718 | 754 | }else{ |
| 719 | 755 | @ <input type="submit" name="load" value="Install"> |
| 720 | 756 | @ <input type="submit" name="del1" value="Delete"> |
| 721 | 757 | } |
| @@ -722,19 +758,25 @@ | ||
| 722 | 758 | @ <input type="submit" name="rename" value="Rename"> |
| 723 | 759 | @ <input type="hidden" name="sn" value="%h(zN)"> |
| 724 | 760 | @ </form></tr> |
| 725 | 761 | } |
| 726 | 762 | db_finalize(&q); |
| 763 | + i++; | |
| 764 | + @ <tr><td colspan=4><h2>Current skin in css/details/footer/header/js \ | |
| 765 | + @ entries in the CONFIG table:</h2></td></tr> | |
| 766 | + @ <tr><td>%d(i).<td><i>Current</i><td> <td> | |
| 767 | + @ <form action="%R/setup_skin_admin" method="post"> | |
| 727 | 768 | if( !seenCurrent ){ |
| 728 | - i++; | |
| 729 | - @ <tr><td colspan=4><h2>Current skin in css/header/footer/details entries \ | |
| 730 | - @ in the CONFIG table:</h2></td></tr> | |
| 731 | - @ <tr><td>%d(i).<td><i>Current</i><td> <td> | |
| 732 | - @ <form action="%R/setup_skin_admin" method="post"> | |
| 733 | 769 | @ <input type="submit" name="save" value="Backup"> |
| 734 | - login_insert_csrf_secret(); | |
| 735 | - @ </form> | |
| 770 | + } | |
| 771 | + @ <input type="submit" name="editdraft" value="Edit"> | |
| 772 | + login_insert_csrf_secret(); | |
| 773 | + @ </form> | |
| 774 | + if( zInstalled ){ | |
| 775 | + @ <tr><td> <td colspan="3"><p> | |
| 776 | + @ Note: The current skin is an exact copy of "%h(zInstalled)". | |
| 777 | + @ </tr> | |
| 736 | 778 | } |
| 737 | 779 | db_prepare(&q, |
| 738 | 780 | "SELECT DISTINCT substr(name, 1, 6) FROM config" |
| 739 | 781 | " WHERE name GLOB 'draft[1-9]-*'" |
| 740 | 782 | " ORDER BY name" |
| @@ -1076,10 +1118,13 @@ | ||
| 1076 | 1118 | skin_publish(iSkin); |
| 1077 | 1119 | } |
| 1078 | 1120 | |
| 1079 | 1121 | style_set_current_feature("skins"); |
| 1080 | 1122 | style_header("Customize Skin"); |
| 1123 | + if( g.perm.Admin ){ | |
| 1124 | + style_submenu_element("Skin-Admin", "%R/setup_skin_admin"); | |
| 1125 | + } | |
| 1081 | 1126 | |
| 1082 | 1127 | @ <p>Customize the look of this Fossil repository by making changes |
| 1083 | 1128 | @ to the CSS, Header, Footer, and Detail Settings in one of nine "draft" |
| 1084 | 1129 | @ configurations. Then, after verifying that all is working correctly, |
| 1085 | 1130 | @ publish the draft to become the new main Skin. Users can select a skin |
| 1086 | 1131 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -573,10 +573,12 @@ | |
| 573 | const char *zCurrent = 0; /* Current skin */ |
| 574 | int i; /* Loop counter */ |
| 575 | Stmt q; |
| 576 | int seenCurrent = 0; |
| 577 | int once; |
| 578 | |
| 579 | login_check_credentials(); |
| 580 | if( !g.perm.Admin ){ |
| 581 | login_needed(0); |
| 582 | return; |
| @@ -615,10 +617,15 @@ | |
| 615 | if( sqlite3_strglob("draft[1-9]",zDraft)==0 ){ |
| 616 | db_unprotect(PROTECT_CONFIG); |
| 617 | db_multi_exec("DELETE FROM config WHERE name GLOB '%q-*'", zDraft); |
| 618 | db_protect_pop(); |
| 619 | } |
| 620 | } |
| 621 | if( skinRename() || skinSave(zCurrent) ){ |
| 622 | db_end_transaction(0); |
| 623 | return; |
| 624 | } |
| @@ -678,23 +685,51 @@ | |
| 678 | @ <tr><td colspan=4><h2>Built-in Skins:</h2></td></th> |
| 679 | for(i=0; i<count(aBuiltinSkin); i++){ |
| 680 | z = aBuiltinSkin[i].zDesc; |
| 681 | @ <tr><td>%d(i+1).<td>%h(z)<td> <td> |
| 682 | if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ |
| 683 | @ (Currently In Use) |
| 684 | seenCurrent = 1; |
| 685 | }else{ |
| 686 | @ <form action="%R/setup_skin_admin" method="post"> |
| 687 | @ <input type="hidden" name="sn" value="%h(z)"> |
| 688 | @ <input type="submit" name="load" value="Install"> |
| 689 | login_insert_csrf_secret(); |
| 690 | if( pAltSkin==&aBuiltinSkin[i] ){ |
| 691 | @ (Current override) |
| 692 | } |
| 693 | @ </form> |
| 694 | } |
| 695 | @ </tr> |
| 696 | } |
| 697 | db_prepare(&q, |
| 698 | "SELECT substr(name, 6), value FROM config" |
| 699 | " WHERE name GLOB 'skin:*'" |
| 700 | " ORDER BY name" |
| @@ -704,18 +739,19 @@ | |
| 704 | const char *zN = db_column_text(&q, 0); |
| 705 | const char *zV = db_column_text(&q, 1); |
| 706 | i++; |
| 707 | if( once ){ |
| 708 | once = 0; |
| 709 | @ <tr><td colspan=4><h2>Skins saved as "skin:*' entries \ |
| 710 | @ in the CONFIG table:</h2></td></tr> |
| 711 | } |
| 712 | @ <tr><td>%d(i).<td>%h(zN)<td> <td> |
| 713 | @ <form action="%R/setup_skin_admin" method="post"> |
| 714 | login_insert_csrf_secret(); |
| 715 | if( fossil_strcmp(zV, zCurrent)==0 ){ |
| 716 | @ (Currently In Use) |
| 717 | seenCurrent = 1; |
| 718 | }else{ |
| 719 | @ <input type="submit" name="load" value="Install"> |
| 720 | @ <input type="submit" name="del1" value="Delete"> |
| 721 | } |
| @@ -722,19 +758,25 @@ | |
| 722 | @ <input type="submit" name="rename" value="Rename"> |
| 723 | @ <input type="hidden" name="sn" value="%h(zN)"> |
| 724 | @ </form></tr> |
| 725 | } |
| 726 | db_finalize(&q); |
| 727 | if( !seenCurrent ){ |
| 728 | i++; |
| 729 | @ <tr><td colspan=4><h2>Current skin in css/header/footer/details entries \ |
| 730 | @ in the CONFIG table:</h2></td></tr> |
| 731 | @ <tr><td>%d(i).<td><i>Current</i><td> <td> |
| 732 | @ <form action="%R/setup_skin_admin" method="post"> |
| 733 | @ <input type="submit" name="save" value="Backup"> |
| 734 | login_insert_csrf_secret(); |
| 735 | @ </form> |
| 736 | } |
| 737 | db_prepare(&q, |
| 738 | "SELECT DISTINCT substr(name, 1, 6) FROM config" |
| 739 | " WHERE name GLOB 'draft[1-9]-*'" |
| 740 | " ORDER BY name" |
| @@ -1076,10 +1118,13 @@ | |
| 1076 | skin_publish(iSkin); |
| 1077 | } |
| 1078 | |
| 1079 | style_set_current_feature("skins"); |
| 1080 | style_header("Customize Skin"); |
| 1081 | |
| 1082 | @ <p>Customize the look of this Fossil repository by making changes |
| 1083 | @ to the CSS, Header, Footer, and Detail Settings in one of nine "draft" |
| 1084 | @ configurations. Then, after verifying that all is working correctly, |
| 1085 | @ publish the draft to become the new main Skin. Users can select a skin |
| 1086 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -573,10 +573,12 @@ | |
| 573 | const char *zCurrent = 0; /* Current skin */ |
| 574 | int i; /* Loop counter */ |
| 575 | Stmt q; |
| 576 | int seenCurrent = 0; |
| 577 | int once; |
| 578 | const char *zInstalled = 0; |
| 579 | const char *zOverride = 0; |
| 580 | |
| 581 | login_check_credentials(); |
| 582 | if( !g.perm.Admin ){ |
| 583 | login_needed(0); |
| 584 | return; |
| @@ -615,10 +617,15 @@ | |
| 617 | if( sqlite3_strglob("draft[1-9]",zDraft)==0 ){ |
| 618 | db_unprotect(PROTECT_CONFIG); |
| 619 | db_multi_exec("DELETE FROM config WHERE name GLOB '%q-*'", zDraft); |
| 620 | db_protect_pop(); |
| 621 | } |
| 622 | } |
| 623 | if( P("editdraft")!=0 ){ |
| 624 | db_end_transaction(0); |
| 625 | cgi_redirectf("%R/setup_skin"); |
| 626 | return; |
| 627 | } |
| 628 | if( skinRename() || skinSave(zCurrent) ){ |
| 629 | db_end_transaction(0); |
| 630 | return; |
| 631 | } |
| @@ -678,23 +685,51 @@ | |
| 685 | @ <tr><td colspan=4><h2>Built-in Skins:</h2></td></th> |
| 686 | for(i=0; i<count(aBuiltinSkin); i++){ |
| 687 | z = aBuiltinSkin[i].zDesc; |
| 688 | @ <tr><td>%d(i+1).<td>%h(z)<td> <td> |
| 689 | if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ |
| 690 | @ (Installed) |
| 691 | zInstalled = z; |
| 692 | seenCurrent = 1; |
| 693 | }else{ |
| 694 | @ <form action="%R/setup_skin_admin" method="post"> |
| 695 | @ <input type="hidden" name="sn" value="%h(z)"> |
| 696 | @ <input type="submit" name="load" value="Install"> |
| 697 | login_insert_csrf_secret(); |
| 698 | if( pAltSkin==&aBuiltinSkin[i] ){ |
| 699 | zOverride = z; |
| 700 | @ (Currently Used) |
| 701 | } |
| 702 | @ </form> |
| 703 | } |
| 704 | @ </tr> |
| 705 | } |
| 706 | if( zOverride ){ |
| 707 | @ <tr><td> <td colspan="3"> |
| 708 | @ <p>Note: Built-in skin "%h(zOverride)" is currently being used because of |
| 709 | switch( iSkinSource ){ |
| 710 | case SKIN_FROM_CMDLINE: |
| 711 | @ the --skin command-line option. |
| 712 | break; |
| 713 | case SKIN_FROM_CGI: |
| 714 | @ the "skin:" option on CGI script. |
| 715 | break; |
| 716 | case SKIN_FROM_QPARAM: |
| 717 | @ the "skin=NAME" query parameter. |
| 718 | break; |
| 719 | case SKIN_FROM_COOKIE: |
| 720 | @ the "skin" value of the |
| 721 | @ <a href='./fdscookie'>fossil_display_setting</a> cookie. |
| 722 | break; |
| 723 | case SKIN_FROM_SETTING: |
| 724 | @ the "default-skin" setting. |
| 725 | break; |
| 726 | default: |
| 727 | @ reasons unknown. (Fix me!) |
| 728 | break; |
| 729 | } |
| 730 | @ </tr> |
| 731 | } |
| 732 | db_prepare(&q, |
| 733 | "SELECT substr(name, 6), value FROM config" |
| 734 | " WHERE name GLOB 'skin:*'" |
| 735 | " ORDER BY name" |
| @@ -704,18 +739,19 @@ | |
| 739 | const char *zN = db_column_text(&q, 0); |
| 740 | const char *zV = db_column_text(&q, 1); |
| 741 | i++; |
| 742 | if( once ){ |
| 743 | once = 0; |
| 744 | @ <tr><td colspan=4><h2>Backup skins saved as "skin:*' entries \ |
| 745 | @ in the CONFIG table:</h2></td></tr> |
| 746 | } |
| 747 | @ <tr><td>%d(i).<td>%h(zN)<td> <td> |
| 748 | @ <form action="%R/setup_skin_admin" method="post"> |
| 749 | login_insert_csrf_secret(); |
| 750 | if( fossil_strcmp(zV, zCurrent)==0 ){ |
| 751 | @ (Installed) |
| 752 | zInstalled = mprintf("%s", zN); |
| 753 | seenCurrent = 1; |
| 754 | }else{ |
| 755 | @ <input type="submit" name="load" value="Install"> |
| 756 | @ <input type="submit" name="del1" value="Delete"> |
| 757 | } |
| @@ -722,19 +758,25 @@ | |
| 758 | @ <input type="submit" name="rename" value="Rename"> |
| 759 | @ <input type="hidden" name="sn" value="%h(zN)"> |
| 760 | @ </form></tr> |
| 761 | } |
| 762 | db_finalize(&q); |
| 763 | i++; |
| 764 | @ <tr><td colspan=4><h2>Current skin in css/details/footer/header/js \ |
| 765 | @ entries in the CONFIG table:</h2></td></tr> |
| 766 | @ <tr><td>%d(i).<td><i>Current</i><td> <td> |
| 767 | @ <form action="%R/setup_skin_admin" method="post"> |
| 768 | if( !seenCurrent ){ |
| 769 | @ <input type="submit" name="save" value="Backup"> |
| 770 | } |
| 771 | @ <input type="submit" name="editdraft" value="Edit"> |
| 772 | login_insert_csrf_secret(); |
| 773 | @ </form> |
| 774 | if( zInstalled ){ |
| 775 | @ <tr><td> <td colspan="3"><p> |
| 776 | @ Note: The current skin is an exact copy of "%h(zInstalled)". |
| 777 | @ </tr> |
| 778 | } |
| 779 | db_prepare(&q, |
| 780 | "SELECT DISTINCT substr(name, 1, 6) FROM config" |
| 781 | " WHERE name GLOB 'draft[1-9]-*'" |
| 782 | " ORDER BY name" |
| @@ -1076,10 +1118,13 @@ | |
| 1118 | skin_publish(iSkin); |
| 1119 | } |
| 1120 | |
| 1121 | style_set_current_feature("skins"); |
| 1122 | style_header("Customize Skin"); |
| 1123 | if( g.perm.Admin ){ |
| 1124 | style_submenu_element("Skin-Admin", "%R/setup_skin_admin"); |
| 1125 | } |
| 1126 | |
| 1127 | @ <p>Customize the look of this Fossil repository by making changes |
| 1128 | @ to the CSS, Header, Footer, and Detail Settings in one of nine "draft" |
| 1129 | @ configurations. Then, after verifying that all is working correctly, |
| 1130 | @ publish the draft to become the new main Skin. Users can select a skin |
| 1131 |