Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Supply elements in submenus with additional specific CSS classes. For each submenu element a corresponding classname is derived either from the visible label (for hyperlink-like submenu elements) or from the name of the distinguishing query parameter (for other items). |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
e8a051e6a943a26c9c33a30df8ceda06 |
| User & Date: | george 2022-06-04 23:09:02.162 |
Context
|
2022-06-05
| ||
| 04:06 | In the /setup_skin page, add a mention of/link to /skins, per request in the forum. ... (check-in: 0fabc4f356 user: stephan tags: trunk) | |
|
2022-06-04
| ||
| 23:09 | Supply elements in submenus with additional specific CSS classes. For each submenu element a corresponding classname is derived either from the visible label (for hyperlink-like submenu elements) or from the name of the distinguishing query parameter (for other items). ... (check-in: e8a051e6a9 user: george tags: trunk) | |
| 16:21 | Mention the remote-url url overrite by proxy bug fix in the change log. ... (check-in: 5f6093314b user: mgagnon tags: trunk) | |
Changes
Changes to src/style.c.
| ︙ | ︙ | |||
919 920 921 922 923 924 925 926 927 928 929 930 931 932 |
@ window.onload = function(){
cgi_append_content(blob_buffer(&blobOnLoad), blob_size(&blobOnLoad));
cgi_append_content("\n}\n", -1);
}
@ </script>
builtin_fulfill_js_requests();
}
/*
** Invoke this routine after all of the content for a webpage has been
** generated. This routine should be called once for every webpage, at
** or near the end of page generation. This routine does the following:
**
** * Populates the header of the page, including setting up appropriate
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 |
@ window.onload = function(){
cgi_append_content(blob_buffer(&blobOnLoad), blob_size(&blobOnLoad));
cgi_append_content("\n}\n", -1);
}
@ </script>
builtin_fulfill_js_requests();
}
/*
** Transorm input string into a token that is safe for inclusion into
** class attribute. Digits and low-case letter are passed unchanged,
** upper-case letters are transformed to low-case, everything else is
** tranformed into hyphens; consequtive and pending hyphens are squeezed.
** If result does not fit into szOut chars then it is truncated.
** Result is always terminated with null.
*/
void style_derive_classname(const char *zIn, char *zOut, int szOut){
assert( zOut );
assert( szOut>0 );
if( zIn ){
int n = 0; /* number of chars written to zOut */
char c;
for(--szOut; (c=*zIn) && n<szOut; zIn++) {
if( ('a'<=c && c<='z') || ('0'<=c && c<='9') ){
*zOut = c;
}else if( 'A'<=c && c<='Z' ){
*zOut = c - 'A' + 'a';
}else{
if( n==0 || zOut[-1]=='-' ) continue;
*zOut = '-';
}
zOut++;
n++;
}
if( n && zOut[-1]=='-' ) zOut--;
}
*zOut = 0;
}
/*
** Invoke this routine after all of the content for a webpage has been
** generated. This routine should be called once for every webpage, at
** or near the end of page generation. This routine does the following:
**
** * Populates the header of the page, including setting up appropriate
|
| ︙ | ︙ | |||
948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 |
/* Go back and put the submenu at the top of the page. We delay the
** creation of the submenu until the end so that we can add elements
** to the submenu while generating page text.
*/
cgi_destination(CGI_HEADER);
if( submenuEnable && nSubmenu+nSubmenuCtrl>0 ){
int i;
if( nSubmenuCtrl ){
@ <form id='f01' method='GET' action='%R/%s(g.zPath)'>
@ <input type='hidden' name='udc' value='1'>
cgi_tag_query_parameter("udc");
}
@ <div class="submenu">
if( nSubmenu>0 ){
qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
for(i=0; i<nSubmenu; i++){
struct Submenu *p = &aSubmenu[i];
/* switching away from the %h formatting below might be dangerous
** because some places use %s to compose zLabel and zLink;
| > > | | | > > | | | | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 |
/* Go back and put the submenu at the top of the page. We delay the
** creation of the submenu until the end so that we can add elements
** to the submenu while generating page text.
*/
cgi_destination(CGI_HEADER);
if( submenuEnable && nSubmenu+nSubmenuCtrl>0 ){
int i;
char zClass[32]; /* reduced form of the main attribute */
if( nSubmenuCtrl ){
@ <form id='f01' method='GET' action='%R/%s(g.zPath)'>
@ <input type='hidden' name='udc' value='1'>
cgi_tag_query_parameter("udc");
}
@ <div class="submenu">
if( nSubmenu>0 ){
qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
for(i=0; i<nSubmenu; i++){
struct Submenu *p = &aSubmenu[i];
style_derive_classname(p->zLabel, zClass, sizeof zClass);
/* switching away from the %h formatting below might be dangerous
** because some places use %s to compose zLabel and zLink;
** e.g. /rptview page. "sml" stands for submenu link.
*/
if( p->zLink==0 ){
@ <span class="label sml-%s(zClass)">%h(p->zLabel)</span>
}else{
@ <a class="label sml-%s(zClass)" href="%h(p->zLink)">%h(p->zLabel)</a>
}
}
}
strcpy(zClass,"smc-"); /* common prefix for submenu controls */
for(i=0; i<nSubmenuCtrl; i++){
const char *zQPN = aSubmenuCtrl[i].zName;
const char *zDisabled = "";
const char *zXtraClass = "";
if( aSubmenuCtrl[i].eVisible & STYLE_DISABLED ){
zDisabled = " disabled";
}else if( zQPN ){
cgi_tag_query_parameter(zQPN);
}
style_derive_classname(zQPN, zClass+4, sizeof(zClass)-4);
switch( aSubmenuCtrl[i].eType ){
case FF_ENTRY:
@ <span class='submenuctrl%s(zXtraClass) %s(zClass)'>\
@ %h(aSubmenuCtrl[i].zLabel)\
@ <input type='text' name='%s(zQPN)' value='%h(PD(zQPN, ""))' \
if( aSubmenuCtrl[i].iSize<0 ){
@ size='%d(-aSubmenuCtrl[i].iSize)' \
}else if( aSubmenuCtrl[i].iSize>0 ){
@ size='%d(aSubmenuCtrl[i].iSize)' \
@ maxlength='%d(aSubmenuCtrl[i].iSize)' \
}
@ id='submenuctrl-%d(i)'%s(zDisabled)></span>
break;
case FF_MULTI: {
int j;
const char *zVal = P(zQPN);
if( zXtraClass[0] ){
@ <span class='%s(zXtraClass+1) %s(zClass)'>
}
if( aSubmenuCtrl[i].zLabel ){
@ %h(aSubmenuCtrl[i].zLabel)\
}
@ <select class='submenuctrl %s(zClass)' size='1' name='%s(zQPN)' \
@ id='submenuctrl-%d(i)'%s(zDisabled)>
for(j=0; j<aSubmenuCtrl[i].iSize*2; j+=2){
const char *zQPV = aSubmenuCtrl[i].azChoice[j];
@ <option value='%h(zQPV)'\
if( fossil_strcmp(zVal, zQPV)==0 ){
@ selected\
}
|
| ︙ | ︙ | |||
1034 1035 1036 1037 1038 1039 1040 |
@ selected\
}
@ >%h(aSubmenuCtrl[i].zFalse)</option>
@ </select>
break;
}
case FF_CHECKBOX: {
| | | 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 |
@ selected\
}
@ >%h(aSubmenuCtrl[i].zFalse)</option>
@ </select>
break;
}
case FF_CHECKBOX: {
@ <label class='submenuctrl submenuckbox%s(zXtraClass) %s(zClass)'>\
@ <input type='checkbox' name='%s(zQPN)' id='submenuctrl-%d(i)' \
if( PB(zQPN) ){
@ checked \
}
if( aSubmenuCtrl[i].zJS ){
@ data-ctrl='%s(aSubmenuCtrl[i].zJS)'%s(zDisabled)>\
}else{
|
| ︙ | ︙ |