You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cd.conn.addHeader('Refresh: '+intToStr(1+random(2))); // random for less collisions
3684
+
exit('Please wait, server busy');
3685
+
end;
3686
+
3679
3687
fullEncode:=FALSE;
3680
3688
ofsRelUrl:=length(folder.url(fullEncode))+1;
3681
3689
ofsRelItemUrl:=length(folder.pathTill())+1;
@@ -3693,81 +3701,88 @@ function Tmainfrm.getFolderPage(folder:Tfile; cd:TconnData; otpl:Tobject):string
3693
3701
result:=diffTpl['special:begin'];
3694
3702
tryApplyMacrosAndSymbols(result, md, FALSE);
3695
3703
3696
-
// cache these values
3697
-
fileTpl:=xtpl(diffTpl['file'], table);
3698
-
folderTpl:=xtpl(diffTpl['folder'], table);
3699
-
linkTpl:=xtpl(diffTpl['link'], table);
3700
-
// this may be heavy to calculate, only do it upon request
3701
-
img_file:=pos('~img_file', fileTpl) > 0;
3702
-
3703
-
// build %list% based on dir[]
3704
-
numberFolders:=0; numberFiles:=0; numberLinks:=0;
3705
-
totalBytes:=0;
3706
-
oneAccessible:=FALSE;
3707
-
fast:=TfastStringAppend.Create();
3708
-
listing:=TfileListing.create();
3709
-
hasher:=Thasher.create();
3710
-
if fingerprintsChk.checked then
3711
-
hasher.loadFrom(folder.resource);
3712
-
try
3713
-
listing.fromFolder( folder, cd, recur );
3714
-
listing.sort(cd, if_(recur or (otpl = filelistTpl), '?', diffTpl['sort by']) ); // '?' is just a way to cause the sort to fail in case the sort key is not defined by the connection
3704
+
if useList then
3705
+
begin
3706
+
// cache these values
3707
+
fileTpl:=xtpl(diffTpl['file'], table);
3708
+
folderTpl:=xtpl(diffTpl['folder'], table);
3709
+
linkTpl:=xtpl(diffTpl['link'], table);
3710
+
// this may be heavy to calculate, only do it upon request
3711
+
img_file:=pos('~img_file', fileTpl) > 0;
3715
3712
3716
-
n:=length(listing.dir);
3717
-
for i:=0to n-1do
3718
-
begin
3719
-
f:=listing.dir[i];
3720
-
if f.size > 0then
3721
-
inc(totalBytes, f.size);
3722
-
if f.isLink() then
3723
-
inc(numberLinks)
3724
-
elseif f.isFolder() then
3725
-
inc(numberFolders)
3726
-
else
3727
-
inc(numberFiles);
3728
-
end;
3729
-
{TODO this symbols will be available when executing macros in handleItem. Having
3730
-
them at this stage is useful only in case immediate calculations are required.
3731
-
This may happen seldom, but maybe some template is using it since we got this here.
3732
-
Each symbols is an extra iteration on the template piece and we may be tempted
3733
-
to consider for optimizations. To not risk legacy problems we should consider
3734
-
treating table symbols with a regular expression and a Tdictionary instead.
listing.sort(cd, if_(recur or (otpl = filelistTpl), '?', diffTpl['sort by']) ); // '?' is just a way to cause the sort to fail in case the sort key is not defined by the connection
3747
3725
3748
-
for i:=0to length(listing.dir)-1do
3749
-
begin
3750
-
application.ProcessMessages();
3751
-
if cd.conn.state = HCS_DISCONNECTED then exit;
3752
-
cd.lastActivityTime:=now();
3753
-
handleItem(listing.dir[i])
3726
+
n:=length(listing.dir);
3727
+
for i:=0to n-1do
3728
+
begin
3729
+
f:=listing.dir[i];
3730
+
if f.size > 0then
3731
+
inc(totalBytes, f.size);
3732
+
if f.isLink() then
3733
+
inc(numberLinks)
3734
+
elseif f.isFolder() then
3735
+
inc(numberFolders)
3736
+
else
3737
+
inc(numberFiles);
3738
+
end;
3739
+
{TODO these symbols will be available when executing macros in handleItem. Having
3740
+
them at this stage is useful only in case immediate calculations are required.
3741
+
This may happen seldom, but maybe some template is using it since we got this here.
3742
+
Each symbols is an extra iteration on the template piece and we may be tempted
3743
+
to consider for optimizations. To not risk legacy problems we should consider
3744
+
treating table symbols with a regular expression and a Tdictionary instead.
0 commit comments