summaryrefslogtreecommitdiffstats
path: root/modules-available/baseconfig_partitions_cdn/templates/_page.html
blob: 2cb3f2a6be10be8e4ee852106c6380847ac9ad1a (plain) (blame)
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
<h1>{{lang_partitionManagement}}</h1>

<p>{{lang_explanationText}}</p>

<form action="?do=BaseConfig_Partitions_CDN" method="post">
	<input type="hidden" name="token" value="{{token}}">
	<div class='list-group'>
		{{#partitions}}
		<div class='list-group-item'>
			<div class='row'>
				<div class='col-sm-2'>
					<input name='partition-{{id}}-partition_id' type='text' class='form-control' value='{{partition_id}}' placeholder='{{lang_partitionId}}'>
				</div>
				<div class='col-sm-2'>
					<input name='partition-{{id}}-size' type='text' class='form-control' value='{{size}}' placeholder='{{lang_partitionSize}}'>
				</div>
				<div class='col-sm-4 col-md-3'>
					<input name='partition-{{id}}-mount_point' type='text' class='form-control' value='{{mount_point}}' placeholder='{{lang_partitionMountPoint}}'/>
				</div>
				<div class='col-sm-3'>
					<input name='partition-{{id}}-options' type='text' class='form-control' size='30' value='{{options}}' placeholder='{{lang_partitionOptions}}'/>
				</div>
				<div class='col-sm-1 col-md-2'>
					<a class='btn btn-danger btn-sm {{allowedToDelete}}disabled{{allowedToDelete}}' href='?do=BaseConfig_Partitions_CDN&amp;deletePartition={{id}}&amp;token={{token}}'>
						<span class='glyphicon glyphicon-trash'></span>
					</a>
				</div>
			</div>
		</div>
		{{/partitions}}
		<div class='list-group-item clearfix'>
			<div class="pull-right">
				<button {{^allowedToAdd}}disabled{{/allowedToAdd}} type="button" class='btn btn-success' data-toggle='modal' data-target='#add-partition'>
					<span class='glyphicon glyphicon-plus'></span> {{lang_newPartition}}
				</button>
			</div>
		</div>
	</div>
	<div class="pull-right">
		<button type="button" class="btn btn-default" data-toggle="modal" data-target="#downloadModal"><span class="glyphicon glyphicon-download-alt"></span> Download</button>
		<button class="btn btn-warning" type="reset"><span class="glyphicon glyphicon-refresh"></span> {{lang_discardChanges}}</button>
		<button {{^allowedToEdit}}disabled{{/allowedToEdit}} class="btn btn-primary" type="submit"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button>
	</div>

	<div class ="modal fade" id="downloadModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		<div class="modal-dialog" style="width: 400px" role="document">
			<div class="modal-content">
				<div class="modal-body">
					{{lang_confirm}}
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
					<button type="button" onclick="saveConfig()" class="btn btn-primary" name="download">
						<span class="glyphicon glyphicon-download-alt"></span> Download
					</button>
				</div>
			</div>
		</div>
	</div>
</form>

<form method="post" action="?do=BaseConfig_Partitions_CDN">
	<input type="hidden" name="token" value="{{token}}">
	<input type="hidden" name="action" value="reset">
	<button {{^allowedToReset}}disabled{{/allowedToReset}} class="btn btn-danger" type="button" data-toggle="modal" data-target="#resetDefaultModal">{{lang_resetDefault}}</button>

	<div class ="modal fade" id="resetDefaultModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		<div class="modal-dialog" style="width: 400px" role="document">
			<div class="modal-content">
				<div class="modal-body">
					{{lang_areYouSureNoUndo}}
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
					<button type="submit" class="btn btn-danger" name="resetDefault"> {{lang_resetDefault}}</button>
				</div>
			</div>
		</div>
	</div>
</form>

<!-- Create Partition Window -->
<form id="createPartitionForm" action="?do=BaseConfig_Partitions_CDN" method="post">
	<div class="modal fade" id="add-partition" tabindex="-1" role="dialog">
		<div class="modal-dialog">

			<div class="modal-content">
				<div class="modal-header">
					<h4><b>{{lang_newPartition}}</b></h4>
				</div>

				<div class="modal-body">
					<div class="input-group">
						<span class="input-group-addon" style="min-width:140px;">{{lang_partitionId}} *</span>
						<input name="new-partition-id" class="form-control" type="text">
					</div>
					<p class="help-block">{{lang_helpId}}</p>
					<div class="input-group">
						<span class="input-group-addon" style="min-width:140px;">{{lang_partitionSize}} *</span>
						<input name="new-partition-size" class="form-control" type="text">
					</div>
					<p class="help-block">{{lang_helpSize}}</p>
					<div class="input-group">
						<span class="input-group-addon" style="min-width:140px;">{{lang_partitionMountPoint}}</span>
						<input name="new-partition-mount-point" class="form-control" type="text">
					</div>
					<p class="help-block">{{lang_helpMountPoint}}</p>
					<div class="input-group">
						<span class="input-group-addon" style="min-width:140px;">{{lang_partitionOptions}}</span>
						<input name="new-partition-options" class="form-control" type="text">
					</div>
					<p class="help-block">{{lang_helpOptions}}</p>
				</div>

				<div class="modal-footer">
					<button class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
					<button type="submit" class="btn btn-success">
						<span class='glyphicon glyphicon-plus'></span> {{lang_create}}
					</button>
				</div>
			</div>
		</div>
	</div>
	<input type="hidden" name="action" value="new_partition">
	<input type="hidden" name="token" value="{{token}}">
</form>

<script type="text/javascript">
	document.addEventListener("DOMContentLoaded", function () {
		$("#createPartitionForm").submit(function () {
			var input1 = $("input[name=new-partition-id]");
			var input2 = $("input[name=new-partition-size]");
			var id = $.trim(input1.val());
			var size = $.trim(input2.val());
			if (!id) {
				input1.addClass("missingInput");
			}
			if (!size) {
				input2.addClass("missingInput");
			}
			if (!id || !size) {
				return false;
			}
		});
	});


	function saveConfig(){
		window.location = 'api.php?do=baseconfig&user={{user}}&save=true';
	}
</script>