-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShareEdit.page
112 lines (78 loc) · 2.96 KB
/
ShareEdit.page
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
Icon="icons/sharesettings.png"
Menu="Share:1"
Title="Share Settings"
---
<?
if ($name == "") {
/* default values when adding new share */
$share = array( "nameOrig" => "",
"name" => "",
"comment" => "",
"allocator" => "highwater",
"floor" => "0",
"splitLevel" => "",
"include" => "",
"exclude" => "",
"useCache" => "no");
}
else if (array_key_exists( $name, $shares)) {
/* edit existing share */
$share = $shares[$name];
}
else {
/* handle share deleted case */
echo "<p class='notice'>Share $name has been deleted. <button type='button' onClick='done();'>OK</button></p>";
return;
}
/* check for empty share */
function shareEmpty($name) {
return (($files = @scandir('/mnt/user/' . $name)) && (count($files) <= 2));
}
?>
<form markdown="1" method="POST" action="/update.htm" target="progressFrame">
Name:
: <input type="text" name="shareName" maxlength="40" value="<?=$share['name'];?>">
Comments:
: <input type="text" name="shareComment" maxlength="256" value="<?=$share['comment'];?>">
Allocation method:
: <select name="shareAllocator" size="1">
<?=mk_option($share['allocator'], "highwater", "High-water");?>
<?=mk_option($share['allocator'], "mostfree", "Most-free");?>
<?=mk_option($share['allocator'], "fillup", "Fill-up");?>
</select>
Min. free space:
: <input type="text" name="shareFloor" maxlength="16" value="<?=$share['floor'];?>">
Split level:
: <input type="text" name="shareSplitLevel" maxlength="256" value="<?=$share['splitLevel'];?>">
Included disk(s):
: <input type="text" name="shareInclude" maxlength="256" value="<?=$share['include'];?>">
Excluded disk(s):
: <input type="text" name="shareExclude" maxlength="256" value="<?=$share['exclude'];?>">
<? if ($var['cacheActive']=="yes"): ?>
Use cache disk:
: <select name="shareUseCache" size="1">
<?=mk_option($share['useCache'], "no", "No");?>
<?=mk_option($share['useCache'], "yes", "Yes");?>
<?=mk_option($share['useCache'], "only", "Only");?>
</select>
<? endif; ?>
<? if ($share['name'] == ""): ?>
: <input type="submit" name="cmdEditShare" value="Add Share">
<button type="button" onClick="done();">Cancel</button>
<? elseif (shareEmpty($share['name'])): ?>
Share empty?
: Yes
Delete<input type="checkbox" name="confirmDelete" onChange="chkDelete(this.form, this.form.cmdEditShare);">
: <input type="hidden" name="shareNameOrig" value="<?=$share['nameOrig'];?>">
<input type="submit" name="cmdEditShare" value="Apply">
<button type="button" onClick="done();">Done</button>
<? else: ?>
Share empty?
: No
: <input type="hidden" name="shareNameOrig" value="<?=$share['nameOrig'];?>">
<input type="submit" name="cmdEditShare" value="Apply">
<button type="button" onClick="done();">Done</button>
<? endif; ?>
</form>