Fossil SCM

Improvements to the Skin setup interface.

drh 2024-02-23 17:25 trunk
Commit 33cc83ffb8550a8b7e78087242e6cf6ec9c06aeaf3c0a2b3040b6b89e13028c8
2 files changed +1 -1 +56 -11
+1 -1
--- src/setup.c
+++ src/setup.c
@@ -143,11 +143,11 @@
143143
setup_menu_entry("Notification", "setup_notification",
144144
"Automatic notifications of changes via outbound email");
145145
setup_menu_entry("Transfers", "xfersetup",
146146
"Configure the transfer system for this repository");
147147
}
148
- setup_menu_entry("Skins", "setup_skin",
148
+ setup_menu_entry("Skins", "setup_skin_admin",
149149
"Select and/or modify the web interface \"skins\"");
150150
setup_menu_entry("Moderation", "setup_modreq",
151151
"Enable/Disable requiring moderator approval of Wiki and/or Ticket"
152152
" changes and attachments.");
153153
setup_menu_entry("Ad-Unit", "setup_adunit",
154154
--- 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 @@
573573
const char *zCurrent = 0; /* Current skin */
574574
int i; /* Loop counter */
575575
Stmt q;
576576
int seenCurrent = 0;
577577
int once;
578
+ const char *zInstalled = 0;
579
+ const char *zOverride = 0;
578580
579581
login_check_credentials();
580582
if( !g.perm.Admin ){
581583
login_needed(0);
582584
return;
@@ -615,10 +617,15 @@
615617
if( sqlite3_strglob("draft[1-9]",zDraft)==0 ){
616618
db_unprotect(PROTECT_CONFIG);
617619
db_multi_exec("DELETE FROM config WHERE name GLOB '%q-*'", zDraft);
618620
db_protect_pop();
619621
}
622
+ }
623
+ if( P("editdraft")!=0 ){
624
+ db_end_transaction(0);
625
+ cgi_redirectf("%R/setup_skin");
626
+ return;
620627
}
621628
if( skinRename() || skinSave(zCurrent) ){
622629
db_end_transaction(0);
623630
return;
624631
}
@@ -678,23 +685,51 @@
678685
@ <tr><td colspan=4><h2>Built-in Skins:</h2></td></th>
679686
for(i=0; i<count(aBuiltinSkin); i++){
680687
z = aBuiltinSkin[i].zDesc;
681688
@ <tr><td>%d(i+1).<td>%h(z)<td>&nbsp;&nbsp;<td>
682689
if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){
683
- @ (Currently In Use)
690
+ @ (Installed)
691
+ zInstalled = z;
684692
seenCurrent = 1;
685693
}else{
686694
@ <form action="%R/setup_skin_admin" method="post">
687695
@ <input type="hidden" name="sn" value="%h(z)">
688696
@ <input type="submit" name="load" value="Install">
689697
login_insert_csrf_secret();
690698
if( pAltSkin==&aBuiltinSkin[i] ){
691
- @ (Current override)
699
+ zOverride = z;
700
+ @ (Currently Used)
692701
}
693702
@ </form>
694703
}
695704
@ </tr>
705
+ }
706
+ if( zOverride ){
707
+ @ <tr><td>&nbsp;<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>
696731
}
697732
db_prepare(&q,
698733
"SELECT substr(name, 6), value FROM config"
699734
" WHERE name GLOB 'skin:*'"
700735
" ORDER BY name"
@@ -704,18 +739,19 @@
704739
const char *zN = db_column_text(&q, 0);
705740
const char *zV = db_column_text(&q, 1);
706741
i++;
707742
if( once ){
708743
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 \
710745
@ in the CONFIG table:</h2></td></tr>
711746
}
712747
@ <tr><td>%d(i).<td>%h(zN)<td>&nbsp;&nbsp;<td>
713748
@ <form action="%R/setup_skin_admin" method="post">
714749
login_insert_csrf_secret();
715750
if( fossil_strcmp(zV, zCurrent)==0 ){
716
- @ (Currently In Use)
751
+ @ (Installed)
752
+ zInstalled = mprintf("%s", zN);
717753
seenCurrent = 1;
718754
}else{
719755
@ <input type="submit" name="load" value="Install">
720756
@ <input type="submit" name="del1" value="Delete">
721757
}
@@ -722,19 +758,25 @@
722758
@ <input type="submit" name="rename" value="Rename">
723759
@ <input type="hidden" name="sn" value="%h(zN)">
724760
@ </form></tr>
725761
}
726762
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>&nbsp;&nbsp;<td>
767
+ @ <form action="%R/setup_skin_admin" method="post">
727768
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>&nbsp;&nbsp;<td>
732
- @ <form action="%R/setup_skin_admin" method="post">
733769
@ <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>&nbsp;<td colspan="3"><p>
776
+ @ Note: The current skin is an exact copy of "%h(zInstalled)".
777
+ @ </tr>
736778
}
737779
db_prepare(&q,
738780
"SELECT DISTINCT substr(name, 1, 6) FROM config"
739781
" WHERE name GLOB 'draft[1-9]-*'"
740782
" ORDER BY name"
@@ -1076,10 +1118,13 @@
10761118
skin_publish(iSkin);
10771119
}
10781120
10791121
style_set_current_feature("skins");
10801122
style_header("Customize Skin");
1123
+ if( g.perm.Admin ){
1124
+ style_submenu_element("Skin-Admin", "%R/setup_skin_admin");
1125
+ }
10811126
10821127
@ <p>Customize the look of this Fossil repository by making changes
10831128
@ to the CSS, Header, Footer, and Detail Settings in one of nine "draft"
10841129
@ configurations. Then, after verifying that all is working correctly,
10851130
@ publish the draft to become the new main Skin. Users can select a skin
10861131
--- 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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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>&nbsp;<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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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>&nbsp;<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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button