Fossil SCM

Improved management of URL parameters in the file browsers. Add file and directory icons to the flat-view.

drh 2015-02-07 02:49 trunk
Commit 7478f9974c6320e4c942b7808ca393fa1540d871
2 files changed +4 -9 +40 -15
+4 -9
--- src/browse.c
+++ src/browse.c
@@ -137,10 +137,11 @@
137137
style_header("File List");
138138
style_adunit_config(ADUNIT_RIGHT_OK);
139139
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
140140
pathelementFunc, 0, 0);
141141
url_initialize(&sURI, "dir");
142
+ cgi_query_parameters_to_url(&sURI);
142143
143144
/* If the name= parameter is an empty string, make it a NULL pointer */
144145
if( zD && strlen(zD)==0 ){ zD = 0; }
145146
146147
/* If a specific check-in is requested, fetch and parse it. If the
@@ -152,20 +153,18 @@
152153
if( pM ){
153154
int trunkRid = symbolic_name_to_rid("tag:trunk", "ci");
154155
linkTrunk = trunkRid && rid != trunkRid;
155156
linkTip = rid != symbolic_name_to_rid("tip", "ci");
156157
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
157
- url_add_parameter(&sURI, "ci", zCI);
158158
}else{
159159
zCI = 0;
160160
}
161161
}
162162
163163
/* Compute the title of the page */
164164
blob_zero(&dirname);
165165
if( zD ){
166
- url_add_parameter(&sURI, "name", zD);
167166
blob_append(&dirname, "in directory ", -1);
168167
hyperlinked_path(zD, &dirname, zCI, "dir", "");
169168
zPrefix = mprintf("%s/", zD);
170169
style_submenu_element("Top-Level", "Top-Level", "%s",
171170
url_render(&sURI, "name", 0, 0, 0));
@@ -548,31 +547,29 @@
548547
if( !g.perm.Read ){ login_needed(); return; }
549548
while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
550549
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
551550
pathelementFunc, 0, 0);
552551
url_initialize(&sURI, "tree");
553
- if( P("nofiles")!=0 ){
552
+ cgi_query_parameters_to_url(&sURI);
553
+ if( PB("nofiles") ){
554554
showDirOnly = 1;
555
- url_add_parameter(&sURI, "nofiles", "1");
556555
style_header("Folder Hierarchy");
557556
}else{
558557
showDirOnly = 0;
559558
style_header("File Tree");
560559
}
561560
style_adunit_config(ADUNIT_RIGHT_OK);
562
- if( P("expand")!=0 ){
561
+ if( PB("expand") ){
563562
startExpanded = 1;
564
- url_add_parameter(&sURI, "expand", "1");
565563
}else{
566564
startExpanded = 0;
567565
}
568566
569567
/* If a regular expression is specified, compile it */
570568
zRE = P("re");
571569
if( zRE ){
572570
re_compile(&pRE, zRE, 0);
573
- url_add_parameter(&sURI, "re", zRE);
574571
zREx = mprintf("&re=%T", zRE);
575572
}
576573
577574
/* If the name= parameter is an empty string, make it a NULL pointer */
578575
if( zD && strlen(zD)==0 ){ zD = 0; }
@@ -586,11 +583,10 @@
586583
if( pM ){
587584
int trunkRid = symbolic_name_to_rid("tag:trunk", "ci");
588585
linkTrunk = trunkRid && rid != trunkRid;
589586
linkTip = rid != symbolic_name_to_rid("tip", "ci");
590587
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
591
- url_add_parameter(&sURI, "ci", zCI);
592588
rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
593589
zNow = db_text("", "SELECT datetime(mtime,'localtime')"
594590
" FROM event WHERE objid=%d", rid);
595591
}else{
596592
zCI = 0;
@@ -602,11 +598,10 @@
602598
}
603599
604600
/* Compute the title of the page */
605601
blob_zero(&dirname);
606602
if( zD ){
607
- url_add_parameter(&sURI, "name", zD);
608603
blob_append(&dirname, "within directory ", -1);
609604
hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
610605
if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
611606
style_submenu_element("Top-Level", "Top-Level", "%s",
612607
url_render(&sURI, "name", 0, 0, 0));
613608
--- src/browse.c
+++ src/browse.c
@@ -137,10 +137,11 @@
137 style_header("File List");
138 style_adunit_config(ADUNIT_RIGHT_OK);
139 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
140 pathelementFunc, 0, 0);
141 url_initialize(&sURI, "dir");
 
142
143 /* If the name= parameter is an empty string, make it a NULL pointer */
144 if( zD && strlen(zD)==0 ){ zD = 0; }
145
146 /* If a specific check-in is requested, fetch and parse it. If the
@@ -152,20 +153,18 @@
152 if( pM ){
153 int trunkRid = symbolic_name_to_rid("tag:trunk", "ci");
154 linkTrunk = trunkRid && rid != trunkRid;
155 linkTip = rid != symbolic_name_to_rid("tip", "ci");
156 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
157 url_add_parameter(&sURI, "ci", zCI);
158 }else{
159 zCI = 0;
160 }
161 }
162
163 /* Compute the title of the page */
164 blob_zero(&dirname);
165 if( zD ){
166 url_add_parameter(&sURI, "name", zD);
167 blob_append(&dirname, "in directory ", -1);
168 hyperlinked_path(zD, &dirname, zCI, "dir", "");
169 zPrefix = mprintf("%s/", zD);
170 style_submenu_element("Top-Level", "Top-Level", "%s",
171 url_render(&sURI, "name", 0, 0, 0));
@@ -548,31 +547,29 @@
548 if( !g.perm.Read ){ login_needed(); return; }
549 while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
550 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
551 pathelementFunc, 0, 0);
552 url_initialize(&sURI, "tree");
553 if( P("nofiles")!=0 ){
 
554 showDirOnly = 1;
555 url_add_parameter(&sURI, "nofiles", "1");
556 style_header("Folder Hierarchy");
557 }else{
558 showDirOnly = 0;
559 style_header("File Tree");
560 }
561 style_adunit_config(ADUNIT_RIGHT_OK);
562 if( P("expand")!=0 ){
563 startExpanded = 1;
564 url_add_parameter(&sURI, "expand", "1");
565 }else{
566 startExpanded = 0;
567 }
568
569 /* If a regular expression is specified, compile it */
570 zRE = P("re");
571 if( zRE ){
572 re_compile(&pRE, zRE, 0);
573 url_add_parameter(&sURI, "re", zRE);
574 zREx = mprintf("&re=%T", zRE);
575 }
576
577 /* If the name= parameter is an empty string, make it a NULL pointer */
578 if( zD && strlen(zD)==0 ){ zD = 0; }
@@ -586,11 +583,10 @@
586 if( pM ){
587 int trunkRid = symbolic_name_to_rid("tag:trunk", "ci");
588 linkTrunk = trunkRid && rid != trunkRid;
589 linkTip = rid != symbolic_name_to_rid("tip", "ci");
590 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
591 url_add_parameter(&sURI, "ci", zCI);
592 rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
593 zNow = db_text("", "SELECT datetime(mtime,'localtime')"
594 " FROM event WHERE objid=%d", rid);
595 }else{
596 zCI = 0;
@@ -602,11 +598,10 @@
602 }
603
604 /* Compute the title of the page */
605 blob_zero(&dirname);
606 if( zD ){
607 url_add_parameter(&sURI, "name", zD);
608 blob_append(&dirname, "within directory ", -1);
609 hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
610 if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
611 style_submenu_element("Top-Level", "Top-Level", "%s",
612 url_render(&sURI, "name", 0, 0, 0));
613
--- src/browse.c
+++ src/browse.c
@@ -137,10 +137,11 @@
137 style_header("File List");
138 style_adunit_config(ADUNIT_RIGHT_OK);
139 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
140 pathelementFunc, 0, 0);
141 url_initialize(&sURI, "dir");
142 cgi_query_parameters_to_url(&sURI);
143
144 /* If the name= parameter is an empty string, make it a NULL pointer */
145 if( zD && strlen(zD)==0 ){ zD = 0; }
146
147 /* If a specific check-in is requested, fetch and parse it. If the
@@ -152,20 +153,18 @@
153 if( pM ){
154 int trunkRid = symbolic_name_to_rid("tag:trunk", "ci");
155 linkTrunk = trunkRid && rid != trunkRid;
156 linkTip = rid != symbolic_name_to_rid("tip", "ci");
157 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
 
158 }else{
159 zCI = 0;
160 }
161 }
162
163 /* Compute the title of the page */
164 blob_zero(&dirname);
165 if( zD ){
 
166 blob_append(&dirname, "in directory ", -1);
167 hyperlinked_path(zD, &dirname, zCI, "dir", "");
168 zPrefix = mprintf("%s/", zD);
169 style_submenu_element("Top-Level", "Top-Level", "%s",
170 url_render(&sURI, "name", 0, 0, 0));
@@ -548,31 +547,29 @@
547 if( !g.perm.Read ){ login_needed(); return; }
548 while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
549 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
550 pathelementFunc, 0, 0);
551 url_initialize(&sURI, "tree");
552 cgi_query_parameters_to_url(&sURI);
553 if( PB("nofiles") ){
554 showDirOnly = 1;
 
555 style_header("Folder Hierarchy");
556 }else{
557 showDirOnly = 0;
558 style_header("File Tree");
559 }
560 style_adunit_config(ADUNIT_RIGHT_OK);
561 if( PB("expand") ){
562 startExpanded = 1;
 
563 }else{
564 startExpanded = 0;
565 }
566
567 /* If a regular expression is specified, compile it */
568 zRE = P("re");
569 if( zRE ){
570 re_compile(&pRE, zRE, 0);
 
571 zREx = mprintf("&re=%T", zRE);
572 }
573
574 /* If the name= parameter is an empty string, make it a NULL pointer */
575 if( zD && strlen(zD)==0 ){ zD = 0; }
@@ -586,11 +583,10 @@
583 if( pM ){
584 int trunkRid = symbolic_name_to_rid("tag:trunk", "ci");
585 linkTrunk = trunkRid && rid != trunkRid;
586 linkTip = rid != symbolic_name_to_rid("tip", "ci");
587 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
 
588 rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
589 zNow = db_text("", "SELECT datetime(mtime,'localtime')"
590 " FROM event WHERE objid=%d", rid);
591 }else{
592 zCI = 0;
@@ -602,11 +598,10 @@
598 }
599
600 /* Compute the title of the page */
601 blob_zero(&dirname);
602 if( zD ){
 
603 blob_append(&dirname, "within directory ", -1);
604 hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
605 if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
606 style_submenu_element("Top-Level", "Top-Level", "%s",
607 url_render(&sURI, "name", 0, 0, 0));
608
+40 -15
--- src/style.c
+++ src/style.c
@@ -735,16 +735,10 @@
735735
{ "td.browser",
736736
"format for cells in the file browser",
737737
@ width: 24%;
738738
@ vertical-align: top;
739739
},
740
- { "ul.browser",
741
- "format for the list in the file browser",
742
- @ margin-left: 0.5em;
743
- @ padding-left: 0.5em;
744
- @ white-space: nowrap;
745
- },
746740
{ ".filetree",
747741
"tree-view file browser",
748742
@ margin: 1em 0;
749743
@ line-height: 1.5;
750744
},
@@ -798,28 +792,59 @@
798792
"hide lines for last-child directories",
799793
@ display: none;
800794
},
801795
{ ".filetree a",
802796
"tree-view links",
803
- @ position: relative;
804
- @ z-index: 1;
805
- @ display: table-cell;
806
- @ min-height: 16px;
807
- @ padding-left: 21px;
808
- @ background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP\/\/\/yEhIf\/\/\/wAAACH5BAEHAAIALAAAAAAQABAAAAIvlIKpxqcfmgOUvoaqDSCxrEEfF14GqFXImJZsu73wepJzVMNxrtNTj3NATMKhpwAAOw==);
809
- @ background-position: center left;
810
- @ background-repeat: no-repeat;
797
+ " position: relative;\n"
798
+ " z-index: 1;\n"
799
+ " display: table-cell;\n"
800
+ " min-height: 16px;\n"
801
+ " padding-left: 21px;\n"
802
+ " background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP"
803
+ "\\/\\/\\/yEhIf\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAIvlIKpxqcfmg"
804
+ "OUvoaqDSCxrEEfF14GqFXImJZsu73wepJzVMNxrtNTj3NATMKhpwAAOw==);\n"
805
+ " background-position: center left;\n"
806
+ " background-repeat: no-repeat;\n"
807
+ },
808
+ { "ul.browser",
809
+ "list of files in the 'flat-view' file browser",
810
+ @ list-style-type: none;
811
+ @ padding: 10px;
812
+ @ margin: 0px;
813
+ @ white-space: nowrap;
814
+ },
815
+ { "ul.browser li.file",
816
+ "List element in the 'flat-view' file browser for a file",
817
+ " background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP"
818
+ "\\/\\/\\/yEhIf\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAIvlIKpxqcfm"
819
+ "gOUvoaqDSCxrEEfF14GqFXImJZsu73wepJzVMNxrtNTj3NATMKhpwAAOw==);\n"
820
+ " background-repeat: no-repeat;\n"
821
+ " background-position: 0px center;\n"
822
+ " padding-left: 20px;\n"
823
+ " padding-top: 2px;\n"
824
+ },
825
+ { "ul.browser li.dir",
826
+ "List element in the 'flat-view file browser for a directory",
827
+ " background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP/WVCIi"
828
+ "Iv\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAInlI9pwa3XYniCgQtkrAFfLXkiFo1jaX"
829
+ "po+jUs6b5Z/K4siDu5RPUFADs=);\n"
830
+ " background-repeat: no-repeat;\n"
831
+ " background-position: 0px center;\n"
832
+ " padding-left: 20px;\n"
833
+ " padding-top: 2px;\n"
811834
},
812835
{ "div.filetreeline",
813836
"line of a file tree",
814837
@ display: table;
815838
@ width: 100%;
816839
@ white-space: nowrap;
817840
},
818841
{ ".filetree .dir > div.filetreeline > a",
819842
"tree-view directory links",
820
- @ background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP/WVCIiIv\/\/\/wAAACH5BAEHAAIALAAAAAAQABAAAAInlI9pwa3XYniCgQtkrAFfLXkiFo1jaXpo+jUs6b5Z/K4siDu5RPUFADs=);
843
+ " background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP/WVCIi"
844
+ "Iv\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAInlI9pwa3XYniCgQtkrAFfLXkiFo1jaXp"
845
+ "o+jUs6b5Z/K4siDu5RPUFADs=);\n"
821846
},
822847
{ "div.filetreeage",
823848
"Last change floating display on the right",
824849
@ display: table-cell;
825850
@ padding-left: 3em;
826851
--- src/style.c
+++ src/style.c
@@ -735,16 +735,10 @@
735 { "td.browser",
736 "format for cells in the file browser",
737 @ width: 24%;
738 @ vertical-align: top;
739 },
740 { "ul.browser",
741 "format for the list in the file browser",
742 @ margin-left: 0.5em;
743 @ padding-left: 0.5em;
744 @ white-space: nowrap;
745 },
746 { ".filetree",
747 "tree-view file browser",
748 @ margin: 1em 0;
749 @ line-height: 1.5;
750 },
@@ -798,28 +792,59 @@
798 "hide lines for last-child directories",
799 @ display: none;
800 },
801 { ".filetree a",
802 "tree-view links",
803 @ position: relative;
804 @ z-index: 1;
805 @ display: table-cell;
806 @ min-height: 16px;
807 @ padding-left: 21px;
808 @ background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP\/\/\/yEhIf\/\/\/wAAACH5BAEHAAIALAAAAAAQABAAAAIvlIKpxqcfmgOUvoaqDSCxrEEfF14GqFXImJZsu73wepJzVMNxrtNTj3NATMKhpwAAOw==);
809 @ background-position: center left;
810 @ background-repeat: no-repeat;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
811 },
812 { "div.filetreeline",
813 "line of a file tree",
814 @ display: table;
815 @ width: 100%;
816 @ white-space: nowrap;
817 },
818 { ".filetree .dir > div.filetreeline > a",
819 "tree-view directory links",
820 @ background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP/WVCIiIv\/\/\/wAAACH5BAEHAAIALAAAAAAQABAAAAInlI9pwa3XYniCgQtkrAFfLXkiFo1jaXpo+jUs6b5Z/K4siDu5RPUFADs=);
 
 
821 },
822 { "div.filetreeage",
823 "Last change floating display on the right",
824 @ display: table-cell;
825 @ padding-left: 3em;
826
--- src/style.c
+++ src/style.c
@@ -735,16 +735,10 @@
735 { "td.browser",
736 "format for cells in the file browser",
737 @ width: 24%;
738 @ vertical-align: top;
739 },
 
 
 
 
 
 
740 { ".filetree",
741 "tree-view file browser",
742 @ margin: 1em 0;
743 @ line-height: 1.5;
744 },
@@ -798,28 +792,59 @@
792 "hide lines for last-child directories",
793 @ display: none;
794 },
795 { ".filetree a",
796 "tree-view links",
797 " position: relative;\n"
798 " z-index: 1;\n"
799 " display: table-cell;\n"
800 " min-height: 16px;\n"
801 " padding-left: 21px;\n"
802 " background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP"
803 "\\/\\/\\/yEhIf\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAIvlIKpxqcfmg"
804 "OUvoaqDSCxrEEfF14GqFXImJZsu73wepJzVMNxrtNTj3NATMKhpwAAOw==);\n"
805 " background-position: center left;\n"
806 " background-repeat: no-repeat;\n"
807 },
808 { "ul.browser",
809 "list of files in the 'flat-view' file browser",
810 @ list-style-type: none;
811 @ padding: 10px;
812 @ margin: 0px;
813 @ white-space: nowrap;
814 },
815 { "ul.browser li.file",
816 "List element in the 'flat-view' file browser for a file",
817 " background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP"
818 "\\/\\/\\/yEhIf\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAIvlIKpxqcfm"
819 "gOUvoaqDSCxrEEfF14GqFXImJZsu73wepJzVMNxrtNTj3NATMKhpwAAOw==);\n"
820 " background-repeat: no-repeat;\n"
821 " background-position: 0px center;\n"
822 " padding-left: 20px;\n"
823 " padding-top: 2px;\n"
824 },
825 { "ul.browser li.dir",
826 "List element in the 'flat-view file browser for a directory",
827 " background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP/WVCIi"
828 "Iv\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAInlI9pwa3XYniCgQtkrAFfLXkiFo1jaX"
829 "po+jUs6b5Z/K4siDu5RPUFADs=);\n"
830 " background-repeat: no-repeat;\n"
831 " background-position: 0px center;\n"
832 " padding-left: 20px;\n"
833 " padding-top: 2px;\n"
834 },
835 { "div.filetreeline",
836 "line of a file tree",
837 @ display: table;
838 @ width: 100%;
839 @ white-space: nowrap;
840 },
841 { ".filetree .dir > div.filetreeline > a",
842 "tree-view directory links",
843 " background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP/WVCIi"
844 "Iv\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAInlI9pwa3XYniCgQtkrAFfLXkiFo1jaXp"
845 "o+jUs6b5Z/K4siDu5RPUFADs=);\n"
846 },
847 { "div.filetreeage",
848 "Last change floating display on the right",
849 @ display: table-cell;
850 @ padding-left: 3em;
851

Keyboard Shortcuts

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