-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhfs.tpl
1507 lines (1366 loc) · 48.4 KB
/
hfs.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
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
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Welcome! This is the default template for HFS 2.3
template revision TR2.
Here below you'll find some options affecting the template.
Consider 1 is used for "yes", and 0 is used for "no".
DO NOT EDIT this template just to change options. It's a very bad way to do it, and you'll pay for it!
Correct way: in Virtual file system, right click on home/root, properties, diff template,
put this text [+special:strings]
and following all the options you want to change, using the same syntax you see here.
[+special:strings]
option.paged=1
COMMENT this option causes your file list to be paged by default
option.newfolder=1
option.move=1
option.comment=1
option.rename=1
COMMENT with these you can disable some features of the template. Please note this is not about user permissions, this is global!
[]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>{.!HFS.} %folder%</title>
<link rel="stylesheet" href="/?mode=section&id=style.css" type="text/css">
<script type="text/javascript" src="/?mode=jquery"></script>
<link rel="shortcut icon" href="/favicon.ico">
<style class='trash-me'>
.onlyscript, button[onclick] { display:none; }
</style>
<script>
// this object will store some %symbols% in the javascript space, so that libs can read them
HFS = { folder:'{.js encode|%folder%.}', number:%number%, paged:{.!option.paged.} };
</script>
<script type="text/javascript" src="/?mode=section&id=lib.js"></script>
</head>
<body>
<!--{.comment|--><h1 style='margin-bottom:100em'>WARNING: this template is only to be used with HFS 2.3 (and macros enabled)</h1> <!--.} -->
{.$box panel.}
{.$list.}
</body>
</html>
<!-- Build-time: %build-time% -->
[list]
<div id='files_outer'>
<div style='height:1.6em;'></div> {.comment| this is quite ugly, i know, but if i use any vertical padding with height:100% i'll get a scrollbar .}
{.if not| %number% |{: <div style='font-size:200%; padding:1em;'>{.!No {.if|{.length|{.?search.}.}|results|files.}.}</div> :}|{:
<form method='post'>
<table id='files'>
{.set|sortlink| {:<a href="{.trim|
{.get|url|sort=$1| {.if| {.{.?sort.} = $1.} | rev={.not|{.?rev.} .} /if.} /get.}
/trim.}">{.!$2.}{.if| {.{.?sort.} = $1.} | &{.if|{.?rev.}|u|d.}Arr;.}</a>:} .}
<th>{.^sortlink|n|Name.}{.^sortlink|e|.extension.}
<th>{.^sortlink|s|Size.}
<th>{.^sortlink|t|Timestamp.}
<th>{.^sortlink|d|Hits.}
%list%
</table>
</form>
:}.}
</div>
[box panel]
<div id='panel'>
{.$box messages.}
{.$box login.}
{.$box folder.}
{.$box search.}
{.$box selection.}
{.$box upload.}
{.$box actions.}
{.$box server info.}
</div>
[box messages]
<fieldset id='msgs'>
<legend><img src="/~img10"> {.!Messages.}</legend>
<ul style='padding-left:2em'>
</ul>
</fieldset>
[box login]
<fieldset id='login'>
<legend><img src="/~img27"> {.!User.}</legend>
<center>
{.if| {.length|%user%.} |{:
%user%
{.if|{.can change pwd.} |
<button onclick='changePwd.call(this)' style='font-size:x-small;'>{.!Change password.}</button>
.}
:}
| <a href="~login">Login</a>
.}
</center>
</fieldset>
[box folder]
<fieldset id='folder'>
<legend><img src="/~img8"> {.!Folder.}</legend>
<div style='float:right; position:relative; top:-1em; font-weight:bold;'>
{.if| {.length|{.?search.}.} | <a href="."><img src="/~img14"> {.!Back.}</a>
| {.if| {.%folder% != / .} | <a href=".."><img src="/~img14"> {.!Up.}</a> .}
/if.}
</div>
<div id='breadcrumbs'>
{.comment|we need this to start from 1 {.count|folder levels.}.}
{.breadcrumbs|{:<a href="%bread-url%" {.if|{.length|%bread-name%.}|style='padding-left:{.calc|{.count|folder levels.}*0.7.}em;'.} /> {.if|{.length|%bread-name%.}|» %bread-name%|<img src="/~img1"> {.!Home.}.}</a>:} .}
</div>
<div id='folder-stats'>%number-folders% {.!folders.}, %number-files% {.!files.}, {.add bytes|%total-size%.}
</div>
{.123 if 2| <div id='foldercomment'>|{.commentNL|%folder-item-comment%.}|</div> .}
</fieldset>
[box search]
{.if| {.get|can recur.} |
<fieldset id='search'>
<legend><img src="/~img3"> {.!Search.}</legend>
<form style='text-align:center'>
<input name='search' size='15' value="{.escape attr|{.?search.}.}">
<input type='submit' value="{.!go.}">
</form>
<div style='margin-top:0.5em;' class='hidden popup'>
<fieldset>
<legend>{.!Where to search.}</legend>
<input type='radio' name='where' value='fromhere' checked='true' /> {.!this folder and sub-folders.}
<br><input type='radio' name='where' value='here' /> {.!this folder only.}
<br><input type='radio' name='where' value='anywhere' /> {.!entire server.}
</fieldset>
</div>
</fieldset>
/if.}
[box selection]
<fieldset id='select' class='onlyscript'>
<legend><img src="/~img15"> {.!Select.}</legend>
<center>
<button onclick="
var x = $('#files .selector');
if (x.size() > x.filter(':checked').size())
x.attr('checked', true).closest('tr').addClass('selected');
else
x.attr('checked', false).closest('tr').removeClass('selected');
selectedChanged();
">{.!All.}</button>
<button onclick="
$('#files .selector').attr('checked', function(i,v){ return !v }).closest('tr').toggleClass('selected');
selectedChanged();
">{.!Invert.}</button>
<button onclick='selectionMask.call(this)'>{.!Mask.}</button>
<p style='display:none; margin-top:1em;'><span id='selected-number'>0</span> items selected</p>
</center>
</fieldset>
[box upload]
{.if| {.get|can upload.} |{:
<fieldset id='upload'>
<legend><img src="/~img32"> {.!Upload.}</legend>
<form action="." method='post' enctype="multipart/form-data" style='text-align:right;'>
<input type='file' name='file' multiple style='display:block;' />
<input type='submit' value='{.!Upload.}' style='margin-top:0.5em;' />
</form>
</fieldset>
:}.}
[box actions]
<fieldset id='actions'>
<legend><img src="/~img18"> {.!Actions.}</legend>
<center>
{.if|{.can mkdir.}|
<button id='newfolderBtn' onclick='ezprompt(this.innerHTML, {type:"text"}, function(s){
ajax("mkdir", {name:s});
});'>{.!New folder.}</button>
.}
{.if|{.can comment.}|
<button id='commentBtn' onclick='setComment.call(this)'>{.!Comment.}</button>
.}
{.if|{.get|can delete.}|
<button id='deleteBtn' onclick='if (confirm("{.!confirm.}")) submit({action:"delete"}, "{.get|url.}")'>{.!Delete.}</button>
{.if|{.and|{.!option.move.}|{.can move.}.}| <button id='moveBtn' onclick='moveClicked()'>{.!Move.}</button> .}
.}
{.if|{.can rename.}|
<button id='renameBtn' onclick='
var a = selectedItems();
if (a.size() != 1)
return alert("You must select a single item to rename");
ezprompt(this.innerHTML, {type:"text"}, function(s){
ajax("rename", {from:getItemName(a[0]), to:s});
});'>{.!Rename.}</button>
.}
{.if|{.get|can archive.}|
<button id='archiveBtn' onclick='if (confirm("{.!confirm.}")) submit({}, "{.get|url|mode=archive|recursive.}")'>{.!Archive.}</button>
.}
<a href="{.get|url|tpl=list|sort=|{.if not|{.length|{.?search.}.}|{:folders-filter=\|recursive:}.}.}">{.!Get list.}</a>
</center>
</fieldset>
[box server info]
<fieldset id='serverinfo'>
<legend><img src="/~img0"> {.!Server information.}</legend>
<a href="http://www.rejetto.com/hfs/">HttpFileServer %version%</a>
<br />{.!Server time.}: %timestamp%
<br />{.!Server uptime.}: %uptime%
</fieldset>
[+special:strings]
max s dl msg=There is a limit on the number of <b>simultaneous</b> downloads on this server.<br>This limit has been reached. Retry later.
retry later=Please, retry later.
item folder=in folder
no files=No files in this folder
no results=No items match your search query
confirm=Are you sure?
[style.css|no log]
body { font-family:tahoma, verdana, arial, helvetica, sans; font-weight:normal; font-size:9pt; background-color:#eef; }
html, body { padding:0; border:0; height:100%; }
html, body, p, form { margin:0 }
a { text-decoration:none; color:#47c; border:1px solid transparent; padding:0 0.1em; }
a:visited { color:#55F; }
a:hover { background-color:#fff; border-color:#47c; }
img { border-style:none }
fieldset { margin-bottom:0.7em; text-align:left; padding:0.6em; }
#panel { float:left; margin-top:1em; margin-left:1em; max-width:250px; }
#panel hr { width:80%; margin:1em auto; }
#files_outer { height:100%; overflow:auto; text-align:left; padding:0 1.6em; }
#files { background:#ddf; border:0; }
#files tr { background:#fff; }
#files tr.even { background:#eef; }
#files tr.selected { background:#bcf; }
#files td { padding:0.2em 0.5em; text-align:right; }
#files tr td:first-child { text-align:left; }
#files th { padding:0.5em 1em; background:#47c; text-align:center; }
#files th a { color:white; font-size:130%; }
#files th a:hover { background:transparent; border-color:#fff; color:#fff; font-size:130%; }
#files td:first-child { text-align:left; }
#files td.nosize { text-align:center; font-style:italic; }
#files .selector { display:none; }
#actions button { margin:0.2em; }
#breadcrumbs { margin-top:1em; padding-left:0.5em; }
#breadcrumbs a { padding:0.15em 0; border-width:2px; display:block; word-break:break-all; }
#folder-stats, #foldercomment { margin-top:1em; padding-top:0.5em; border-top:1px solid #666; }
#folder-stats { color:#666; text-align:center; }
#msgs { display:none; }
#msgs li:first-child { font-weight:bold; }
#pages span { padding-left:0.5em; padding-right:0.5em; cursor:pointer; }
#pages button { font-size:smaller; }
.selectedPage { font-weight:bold; font-size:larger; }
.hidden { display:none; }
[file=folder=link|private]
<tr class='{.if|{.mod|{.count|row.}|2.}|even.}'><td>
<input type='checkbox' class='selector' name='selection' value="%item-url%" {.if not|{.or|{.get|can delete.}|{.get|can access.}|{.get|can archive item.}.}|disabled='disabled'.} />
{.if|{.get|is new.}|<span class='flag'> NEW </span>.}
{.if not|{.get|can access.}|<img src='/~img_lock'>.}
<a href="%item-url%"><img src="%item-icon%"> %item-name%</a>
{.if| {.length|{.?search.}.} |{:{.123 if 2|<div class='item-folder'>{.!item folder.} |{.breadcrumbs|{:<a href="%bread-url%">%bread-name%/</a>:}|from={.count substring|/|%folder%.}/breadcrumbs.}|</div>.}:} .}
{.123 if 2|<div class='comment'>|{.commentNL|%item-comment%.}|</div>.}
[+file]
<td>%item-size%B<td>%item-modified%<td>%item-dl-count%
[+folder]
<td class='nosize'>folder<td>%item-modified%<td>%item-dl-count%
[+link]
<td class='nosize'>link<td colspan='2'>
[error-page]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
{.$style.css.}
</style>
</head>
<body>
%content%
<hr>
<div style="font-family:tahoma, verdana, arial, helvetica, sans; font-size:8pt;">
<a href="http://www.rejetto.com/hfs/">HttpFileServer %version%</a>
<br>%timestamp%
</div>
</body>
</html>
[not found]
<h1>{.!Not found.}</h1>
<a href="/">{.!go to root.}</a>
[overload]
<h1>{.!Server Too Busy.}</h1>
{.!The server is too busy to handle your request at this time. Retry later.}
[max contemp downloads]
<h1>{.!Download limit.}</h1>
{.!max s dl msg.}
<br>({.disconnection reason.})
[unauthorized]
<h1>{.!Unauthorized.}</h1>
{.!Either your user name and password do not match, or you are not permitted to access this resource..}
[deny]
<h1>{.!Forbidden.}</h1>
{.or|%reason%|{.!This resource is not accessible..}.}
[ban]
<h1>{.!You are banned.}</h1>
%reason%
[upload]
[upload-file]
[upload-results]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>HFS %folder%</title>
<link rel="stylesheet" href="/?mode=section&id=style.css" type="text/css">
<style>
li {list-style-image:url(/~img7); padding-bottom:1em; }
li.bad { list-style-image:url(/~img11); }
ul { border:1px solid #999; border-left:0; border-right:0; padding-top:1em; }
a.back { display: block; width: 10em; white-space:nowrap; padding:0.3em 0.5em; margin-top:1em; }
</style>
</head>
<body style='margin:2em;'>
<h1>{.!Upload results.}</h1>
{.or|{.^ok.}|0.} {.!files uploaded correctly..}
{.123 if 2|<br /> |{.^ko.}| files failed..}
<a href="." class='back'><img src="/~img14"> {.!Back.}</a>
{.^back.}
<ul>
%uploaded-files%
</ul>
<a href="." class='back'><img src="/~img14"> {.!Back.}</a>
</body>
</html>
[upload-success]
{.inc|ok.}
<li> <a href="%item-url%">%item-name%</a>
<br />%item-size% @ %smart-speed%B/s
{.if| {.length|%user%.} |{: {.append| %folder-resource%\hfs.comments.txt |{.filename|%item-resource%.}=uploaded by %user%
/append.} :}/if.}
[upload-failed]
{.inc|ko.}
<li class='bad'>%item-name%
<br />{.!%reason%.}
[progress|no log]
<style>
#progress .fn { font-weight:bold; }
.out_bar { margin-top:0.25em; width:100px; font-size:15px; background:#fff; border:#555 1px solid; margin-right:5px; float:left; }
.in_bar { height:0.5em; background:#47c; }
</style>
<ul style='padding-left:1.5em;'>
%progress-files%
</ul>
[progress-nofiles]
{.!No file exchange in progress..}
[progress-upload-file]
{.if not|{.{.?only.} = down.}|{:
<li> Uploading %total% @ %speed-kb% KB/s
<br /><span class='fn'>%filename%</span>
<br />{.!Time left.} %time-left%"
<br /><div class='out_bar'><div class='in_bar' style="width:%perc%px"></div></div> %perc%%
:}.}
[progress-download-file]
{.if not|{.{.?only.} = up.}|{:
<li> Downloading %total% @ %speed-kb% KB/s
<br /><span class='fn'>%filename%</span>
<br />{.!Time left.} %time-left%"
<br><div class='out_bar'><div class='in_bar' style="width:%perc%px"></div></div> %perc%%
:}.}
[ajax.mkdir|no log]
{.check session.}
{.set|x|{.postvar|name.}.}
{.break|if={.pos|\|var=x.}{.pos|/|var=x.}|result=forbidden.}
{.break|if={.not|{.can mkdir.}.}|result=not authorized.}
{.set|x|{.force ansi|%folder%{.^x.}.}.}
{.break|if={.exists|{.^x.}.}|result=exists.}
{.break|if={.not|{.length|{.mkdir|{.^x.}.}.}.}|result=failed.}
{.add to log|User %user% created folder "{.^x.}".}
{.pipe|ok.}
[ajax.rename|no log]
{.check session.}
{.break|if={.not|{.can rename.}.}|result=forbidden.}
{.break|if={.is file protected|{.postvar|from.}.}|result=forbidden.}
{.break|if={.is file protected|{.postvar|to.}.}|result=forbidden.}
{.set|x|{.force ansi|%folder%{.postvar|from.}.}.}
{.set|y|{.force ansi|%folder%{.postvar|to.}.}.}
{.break|if={.not|{.exists|{.^x.}.}.}|result=not found.}
{.break|if={.exists|{.^y.}.}|result=exists.}
{.break|if={.not|{.length|{.rename|{.^x.}|{.^y.}.}.}.}|result=failed.}
{.add to log|User %user% renamed "{.^x.}" to "{.^y.}".}
{.pipe|ok.}
[ajax.move|no log]
{.check session.}
{.set|dst|{.force ansi|{.postvar|dst.}.}.}
{.break|if={.not|{.and|{.can move.}|{.get|can delete.}|{.get|can upload|path={.^dst.}.}/and.}.} |result={.!forbidden.}.}
{.set|log|{.!Moving items to.} {.^dst.}.}
{.for each|fn|{.replace|:|{.no pipe||.}|{.force ansi|{.postvar|files.}.}.}|{:
{.break|if={.is file protected|var=fn.}|result=forbidden.}
{.set|x|{.force ansi|%folder%.}{.^fn.}.}
{.set|y|{.^dst.}/{.^fn.}.}
{.if not |{.exists|{.^x.}.}|{.^x.}: {.!not found.}|{:
{.if|{.exists|{.^y.}.}|{.^y.}: {.!already exists.}|{:
{.set|comment| {.get item|{.^x.}|comment.} .}
{.set item|{.^x.}|comment=.} {.comment| this must be done before moving, or it will fail.}
{.if|{.length|{.move|{.^x.}|{.^y.}.}.} |{:
{.move|{.^x.}.md5|{.^y.}.md5.}
{.set|log|{.chr|13.}{.^fn.}|mode=append.}
{.set item|{.^y.}|comment={.^comment.}.}
:} | {:
{.set|log|{.chr|13.}{.^fn.} (failed)|mode=append.}
{.maybe utf8|{.^fn.}.}: {.!not moved.}
:}/if.}
:}/if.}
:}.}
;
:}.}
{.add to log|{.^log.}.}
[ajax.comment|no log]
{.check session.}
{.break|if={.not|{.can comment.}.} |result=forbidden.}
{.for each|fn|{.replace|:|{.no pipe||.}|{.postvar|files.}.}|{:
{.break|if={.is file protected|var=fn.}|result=forbidden.}
{.set item|{.force ansi|%folder%{.^fn.}.}|comment={.encode html|{.force ansi|{.postvar|text.}.}.}.}
:}.}
{.pipe|ok.}
[ajax.changepwd|no log]
{.check session.}
{.break|if={.not|{.can change pwd.}.} |result=forbidden.}
{.if|{.length|{.set account||password={.force ansi|{.postvar|new.}.}.}/length.}|ok|failed.}
[special:alias]
check session=if|{.{.cookie|HFS_SID_.} != {.postvar|token.}.}|{:{.cookie|HFS_SID_|value=|expires=-1.} {.break|result=bad session}:}
can mkdir=and|{.get|can upload.}|{.!option.newfolder.}
can comment=and|{.get|can upload.}|{.!option.comment.}
can rename=and|{.get|can delete.}|{.!option.rename.}
can change pwd=member of|can change password
can move=or|1|1
escape attr=replace|"|"|$1
commentNL=if|{.pos|<br|$1.}|$1|{.replace|{.chr|10.}|<br />|$1.}
add bytes=switch|{.cut|-1||$1.}|,|0,1,2,3,4,5,6,7,8,9|$1 Bytes|K,M,G,T|$1Bytes
quote={:"$1":}
[special:import]
{.new account|can change password|enabled=1|is group=1|notes=accounts members of this group will be allowed to change their password.}
[lib.js|no log]
// <script> // this is here for the syntax highlighter
function outsideV(e, additionalMargin) {
outsideV.w || (outsideV.w = $(window));
if (!(e instanceof $))
e = $(e);
return e.offset().top + e.height() > outsideV.w.height() - (additionalMargin || 0) - 17;
} // outsideV
function quotedString(s) { return '"'+s.replace(/(['"\\])/g, "\\$1")+'"' }
$(function(){
// make these links into buttons for homogeneity
$('#actions a').replaceWith(function(){ return "<button onclick='location = "+quotedString(this.getAttribute('href'))+"'>"+this.innerHTML+"</button>"; });
// selecting functionality
$('#files .selector').show().change(function(){
$(this).closest('tr').toggleClass('selected');
selectedChanged();
});
$('.trash-me').detach(); // this was hiding things for those w/o js capabilities
// infinite upload fields available
var x = $('input[type=file]');
x.change(function(){
if ($(this).data('fired')) return;
$(this).data('fired',1);
fileTpl.clone(true).insertAfter(this).css('display','block');
});
// we must create an empty "template", by cloning before it's set to a file, because on some browsers (Opera 10) emptying the value run-time is not allowed.
// this must be done after the above instruction, so we'll clone also the behavior.
var fileTpl = x.clone(true).css('display','none');
var x = $('#upload');
if (x.size()) {
// make it popup by button, so we save some vertical space and avoid some scrollbar
x.hide();
$('#actions button:first').before(
$("<button>{.!Upload.}</button>").click(function(){
$(this).slideUp(); x.fadeIn();
})
);
// on submit
x.find('form').submit(function(){
if (!$("[name=file]").val()) return false; // no file, no submit
$(this).hide(); // we don't need the form anymore, make space for the progress bars
// build the gui
x.append("<div id='progress'>in progress...</div>");
x.append($("<button style='float:right'>{.!Cancel.}</button>").click(function(){
// stop submit/upload
if (typeof stop == 'function')
stop();
else
document.execCommand("Stop");
$(this).add($("#progress")).remove(); // remove progress indicators and this button too
$("#upload form").slideDown(); // re-show the form
}));
// refresh information
function updateProgress() {
var now = new Date();
if (now-updateProgress.last < updateProgress.refresh*3) return; // until the request is fulfilled, we give it 3 times the refresh time
updateProgress.last = now;
$.get('/?mode=section&id=progress&only=up', function(txt) {
if (!txt) return;
var x = $('#progress');
if (!x.size()) return clearInterval(updateProgress.handle);
if (txt.indexOf('<li>') >= 0) x.html(txt);
updateProgress.last = 0;
});
}//updateProgress
updateProgress.refresh = 3; // choose the time, in seconds
updateProgress.refresh *= 1000; // javascript wants it in milliseconds
updateProgress.handle = setInterval(updateProgress, updateProgress.refresh);
return true;
});
}
// search options appear when it gets focus
$('#search').focusin(function(evt){
inSearch = 1;
if (evt.target.getAttribute('type') == 'submit') return; // the submitter button won't expand the popup, but sets the flag to avoid the popup to be closed
$("#search .popup").slideDown();
}).focusout(function(evt){
inSearch = 0;
setTimeout(function(){
if (!inSearch)
$("#search .popup").fadeOut();
});
});
$('#search form').submit(function(){
var s = $(this).find('[name=search]').val();
var a = '';
var ps = [];
switch ($('[name=where]:checked').val()) {
case 'anywhere':
a = '/';
case 'fromhere':
ps.push('search='+s);
break;
case 'here':
if (s.indexOf('*') < 0) s = '*'+s+'*';
ps.push('files-filter='+s);
ps.push('folders-filter='+s);
break;
}
location = a+'?'+ps.join('&');
return false;
});
// workaround for those browsers not supporting :first-child selector used in style
if ($('#files td:first').css('text-align') != 'left')
$('#files tr td:first-child').css('text-align','left');
// here we make some changes trying to make the panel fit the window
var removed = 0;
var e = $('#panel');
while (outsideV(e)) {
switch (++removed) {
case 1: $('#serverinfo').hide(); continue;
case 2: $('#select').hide(); continue;
case 3: $('#breadcrumbs a').css({display:'inline',paddingLeft:0}); continue;
case 4: $('#login').replaceWith($('#login center').prepend('<img src="/~img27">')); continue;
}
break; // give up
}
if (HFS.paged)
if (getCookie('paged') == 'no')
addPagingButton('#actions button:first');
else
pageIt();
{.$more onload.}
selectedChanged();
// darn you ie6!
if (!$.browser.msie || $.browser.version > 6) return;
$('fieldset').width('250px').after('<br>');
$('#panel').css('margin-right','1.5em');
$('a').css('border-width','0');
setTimeout(pageIt, 500); // at this time the page is not correctly formatted in IE6
});//onload
function ajax(method, data, cb) {
if (!data)
data = {};
data.token = "{.cookie|HFS_SID_.}";
return $.post("?mode=section&id=ajax."+method, data, cb||getStdAjaxCB());
}//ajax
function addPagingButton(where) {
$("<button>{.!Paged list.}</button>").insertBefore(where || '#files').click(function(){
$(this).remove();
pageIt(true);
delCookie('paged');
});
}//addPagingButton
function pageIt(anim) {
var rows = $('#files tr');
if (!rows.size()) return;
page = 0; // this is global
var pages = $("<div id='pages'>{.!Page.} </div>").css('visibility','hidden').insertBefore('#files');
var pageSize = 0;
while (!outsideV(rows[pageSize], 20))
if (++pageSize >= rows.size())
return pages.remove();
if (pageSize == 0) return; // this happens when the page is not formatted at this exact time, and the table is misplaced
Npages = Math.ceil(HFS.number / pageSize);
if (Npages == 1)
return pages.remove();
$('#files').width($('#files').width()); // hold it still
var s = '';
for (var i=1; i <= Npages; i++)
s += '<span>'+i+'</span> ';
s = $(s);
s.appendTo(pages).click(function(){
page = Number(this.innerHTML)-1;
$('#files tr:gt(0):visible').hide();
$('#files tr:gt('+(page*pageSize)+'):lt('+pageSize+')').show();
pages.find('span').removeClass('selectedPage').filter(':nth('+page+')').addClass('selectedPage');
});
s.first().addClass('selectedPage');
$('#files tr:gt('+((page+1)*pageSize)+')').hide();
pages.append($("<button type='button'>{.!No pages.}</button>").click(function(){
pages.slideUp(function(){ pages.remove(); });
$('#files tr:hidden').show();
addPagingButton();
setCookie('paged', 'no');
}));
pages.css({visibility:'', display:'none'});
if (anim) pages.slideDown()
else pages.show();
}//pageIt
function selectedChanged() {
$("#selected-number").text( selectedItems().size() ).parent().show();
} // selectedChanged
function getItemName(el) {
if (typeof el == 'undefined')
return false;
// we handle elements, not jquery sets
if (el.jquery)
if (el.size())
el = el[0];
else
return false;
// take the url, and ignore any #anchor part
var s = el.getAttribute('href') || el.getAttribute('value');
s = s.split('#')[0];
// remove protocol and hostname
var i = s.indexOf('://');
if (i > 0)
s = s.slice(s.indexOf('/',i+3));
// current folder is specified. Remove it.
if (s.indexOf(HFS.folder) == 0)
s = s.slice(HFS.folder.length);
// folders have a trailing slash that's not truly part of the name
if (s.slice(-1) == '/')
s = s.slice(0,-1);
// it is encoded
s = (decodeURIComponent || unescape)(s);
return s;
} // getItemName
function submit(data, url) {
var f = $('#files').closest('form');
if (url) f.attr('action', url);
f.find('.temp').remove();
for (var k in data)
f.append("<input class='temp' type='hidden' name='"+k+"' value='"+data[k]+"' />");
f.submit();
}//submit
function putMsg(txt, time) {
if (!time) time = 4000;
var msgs = $('#msgs');
msgs.slideDown();
if (msgs.find('ul li:first').html() == txt)
clearTimeout(lastTimeoutID);
else
msgs.find('ul').prepend("<li>"+txt+"</li>");
lastTimeoutID = setTimeout("$('#msgs li:last').fadeOut(function(){$(this).detach(); if (!$('#msgs li').size()) $('#msgs').slideUp(); });", time);
}//putMsg
RegExp.escape = function(text) {
if (!arguments.callee.sRE) {
var specials = '/.*+?|()[]{}\\'.split('');
arguments.callee.sRE = new RegExp('(\\' + specials.join('|\\') + ')', 'g');
}
return text.replace(arguments.callee.sRE, '\\$1');
}//escape
function include(url, type) {
$.ajaxSetup({async: false}); // we'll wait.
if (!type)
type = /[^.]+$/.exec(url);
var res;
if (type == 'js')
res = $.getScript(url);
else res = $.get(url, function(){
if (type == 'css')
$('head').append('<link rel="stylesheet" href="'+url+'" type="text/css" />');
});
$.ajaxSetup({async: true}); // restore it
return res.responseText;
}//include
function ezprompt(msg, options, cb) {
// 2 parameters means "options" is missing
if (arguments.length == 2) {
cb = options;
options = {};
}
if (!$.prompt) { // load on demand
include('/?mode=section&id=impromptu.css');
include('/?mode=section&id=jquery.impromptu.js');
}
var v;
if (v = options.type) {
msg += '<br />';
if (v == 'textarea')
msg += '<textarea name="txt" cols="30" rows="8">'+options['default']+'</textarea>';
else
msg += '<input name="txt" type="'+v+'"'
+ ((v = options['default']) ? ' value="'+v+'"' : '')
+ ' />';
}
$.prompt(msg, {
opacity: 0.9,
overlayspeed: 'fast',
loaded: function(){
$('#jqibox').find(':input').keypress(function (e) {
var c = (e.keyCode || e.which);
if (options.keypress && options.keypress(c, this, e) === false) return;
if (c != 13 || this.tagName == 'TEXTAREA') return; // ENTER key is like submit, but not in textarea
$('.jqibuttons button:first').click();
return false;
}).filter(':first').focus()[0].select();
},
submit: function(val,div,form) {
var res = cb(options.type ? form.txt : form, $('#jqibox'), options.cbData );
if (res === false) {
$('#jqibox').find(':input:first').focus();
return false;
}
return true;
},
fadeClicked: function() { $('#jqibox').find(':input:first').focus(); }
});
}//ezprompt
// this is a factory for ajax request handlers
function getStdAjaxCB(what2do) {
if (!arguments.length)
what2do = true;
return function(res){
res = $.trim(res);
if (res !== "ok") {
alert("{.!Error.}: "+res);
if (res === 'bad session')
location.reload();
return;
}
// what2do is a list of actions we are supposed to do if the ajax result is "ok"
if (typeof what2do == 'undefined')
return;
if (!$.isArray(what2do))
what2do = [what2do];
for (var i=0; i<what2do.length; i++) {
var w = what2do[i];
switch (typeof w) {
case 'function': w(); break; // you specify exactly what to do
case 'string':
switch (w[0]) {
case '!': alert(w.substr(1)); break;
case '>': location = w.substr(1); break;
default: putMsg(w); break;
}
case 'boolean': if (w) location = location; break;
}
}
}
}//getStdAjaxCB
function changePwd() {
ezprompt(this.innerHTML, {type:'password'}, function(s){
if (s) ajax('changepwd', {'new':s}, getStdAjaxCB([
"!{.!Password changed, you'll have to login again..}",
'>~login'
]));
});
}//changePwd
function selectedItems() { return $('#files .selector:checked') }
function selectedFilesAsStr() {
var a = [];
selectedItems().each(function(){
a.push(getItemName(this));
});
return a.join(":");
}//selectedFilesAsStr
function setComment() {
var sel = selectedItems();
if (!sel.size())
return putMsg("{.!No file selected.}");
var def = sel.closest('tr').find('.comment').html() || '';
ezprompt(this.innerHTML, {type:'textarea', 'default':def}, function(s){
if (s == def && sel.size() == 1) return true; // there s no work to do
ajax('comment', {text:s, files:selectedFilesAsStr()});
});
}//setComment
function moveClicked() {
ezprompt("{.!Enter the destination folder.}", {type:'text'}, function(s){
ajax('move', {dst:s, files:selectedFilesAsStr()}, function(res){
var a = res.split(";");
if (a.length < 2)
return alert($.trim(res));
var failed = 0;
var ok = 0;
var msg = "";
for (var i=0; i<a.length-1; i++) {
var s = $.trim(a[i]);
if (!s.length) {
ok++;
continue;
}
failed++;
msg += s+"\n";
}
if (failed)
msg = "{.!We met the following problems:.}\n"+msg;
msg = (ok ? ok+" {.!files were moved..}\n" : "{.!No file was moved..}\n")+msg;
alert(msg);
if (ok) location = location; // reload
});
});
}//moveClicked
function selectionMask() {
ezprompt('{.!Please enter the file mask to select.}', {'type':'text', 'default':'*'}, function(s){
if (!s) return false;
var re = s.match('^/([^/]+)/([a-zA-Z]*)');
if (re)
re = new RegExp(re[1], re[2]);
else {
var n = s.match(/^(\\*)/)[0].length;
s = s.substring(n);
var invert = !!(n % 2); // a leading "\" will invert the logic
s = RegExp.escape(s).replace(/[?]/g,".");;
if (s.match(/\\\*/)) {
s = s.replace(/\\\*/g,".*");
s = "^ *"+s+" *$"; // in this case let the user decide exactly how it is placed in the string
}
re = new RegExp(s, "i");
}
$("#files .selector")
.filter(function(){ return invert ^ re.test(getItemName(this)); })
.closest('tr').addClass("selected").find('.selector').attr('checked',true);
selectedChanged();
});
}//selectionMask
function setCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
} // setCookie
function getCookie(name) {
var a = document.cookie.match(new RegExp('(^|;\s*)('+name+'=)([^;]*)'));
return (a && a[2]) ? a[3] : null;
} // getCookie
function delCookie(name) {
setCookie(name,"",-1);
} // delCookie
[jquery.impromptu.js|no log]
/*
* jQuery Impromptu
* By: Trent Richardson [http://trentrichardson.com]
* Version 2.7
* Last Modified: 6/7/2009
*
* Copyright 2009 Trent Richardson
* Dual licensed under the MIT and GPL licenses.
* http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
*
*/
(function($) {
$.prompt = function(message, options) {
options = $.extend({},$.prompt.defaults,options);
$.prompt.currentPrefix = options.prefix;
var ie6 = ($.browser.msie && $.browser.version < 7);
var $body = $(document.body);
var $window = $(window);
//build the box and fade
var msgbox = '<div class="'+ options.prefix +'box" id="'+ options.prefix +'box">';
if(options.useiframe && (($('object, applet').length > 0) || ie6)) {
msgbox += '<iframe src="javascript:false;" style="display:block;position:absolute;z-index:-1;" class="'+ options.prefix +'fade" id="'+ options.prefix +'fade"></iframe>';
} else {
if(ie6) {
$('select').css('visibility','hidden');
}
msgbox +='<div class="'+ options.prefix +'fade" id="'+ options.prefix +'fade"></div>';
}
msgbox += '<div class="'+ options.prefix +'" id="'+ options.prefix +'"><div class="'+ options.prefix +'container"><div class="';
msgbox += options.prefix +'close">X</div><div id="'+ options.prefix +'states"></div>';
msgbox += '</div></div></div>';
var $jqib = $(msgbox).appendTo($body);
var $jqi = $jqib.children('#'+ options.prefix);
var $jqif = $jqib.children('#'+ options.prefix +'fade');
//if a string was passed, convert to a single state
if(message.constructor == String){
message = {
state0: {
html: message,
buttons: options.buttons,
focus: options.focus,
submit: options.submit
}
};
}
//build the states
var states = "";
$.each(message,function(statename,stateobj){
stateobj = $.extend({},$.prompt.defaults.state,stateobj);
message[statename] = stateobj;
states += '<div id="'+ options.prefix +'_state_'+ statename +'" class="'+ options.prefix + '_state" style="display:none;"><div class="'+ options.prefix +'message">' + stateobj.html +'</div><div class="'+ options.prefix +'buttons">';
$.each(stateobj.buttons, function(k, v){
states += '<button name="' + options.prefix + '_' + statename + '_button' + k + '" id="' + options.prefix + '_' + statename + '_button' + k + '" value="' + v + '">' + k + '</button>';
});
states += '</div></div>';
});
//insert the states...
$jqi.find('#'+ options.prefix +'states').html(states).children('.'+ options.prefix +'_state:first').css('display','block');
$jqi.find('.'+ options.prefix +'buttons:empty').css('display','none');
//Events
$.each(message,function(statename,stateobj){
var $state = $jqi.find('#'+ options.prefix +'_state_'+ statename);
$state.children('.'+ options.prefix +'buttons').children('button').click(function(){
var msg = $state.children('.'+ options.prefix +'message');
var clicked = stateobj.buttons[$(this).text()];