3
* Spring Signage Ltd - http://www.springsignage.com
4
* Copyright (C) 2015 Spring Signage Ltd
9
{% extends "authed.twig" %}
10
{% import "forms.twig" as forms %}
12
{% block actionMenu %}
13
<ul class="nav nav-pills pull-right">
14
{% if settings.SETTING_IMPORT_ENABLED %}
15
<li class="btn btn-success btn-xs"><a id="layoutUploadForm" class="btns" title="{% trans "Import a database" %}" href="#"> <i class="fa fa-cloud-download" aria-hidden="true"></i> {% trans "Import" %}</a></li>
18
<li class="btn btn-info btn-xs" ><a class="XiboFormButton btns" title="{% trans "Export database" %}" href="{{ urlFor("maintenance.export.form") }}"> <i class="fa fa-cloud-upload" aria-hidden="true"></i> {% trans "Export" %}</a></li>
20
{% if settings.SETTING_LIBRARY_TIDY_ENABLED %}
21
<li class="btn btn-danger btn-xs"><a class="XiboFormButton btns" title="{% trans "Run through the library and remove unused and unnecessary files" %}" href="{{ urlFor("maintenance.libraryTidy.form") }}"> <i class="fa fa-trash" aria-hidden="true"></i> {% trans "Tidy Library" %}</a></li>
26
{% block pageContent %}
28
<div class="widget-title">{% trans "Settings" %}</div>
29
<div class="widget-body">
31
<div class="col-md-12">
32
<ul class="nav nav-tabs" role="tablist">
33
{% set first = true %}
34
{% for category in categories %}
35
{% set transCatTabName = category.tabName %}
36
<li {% if first %}class="active"{% endif %}><a href="#{{ category.tabId }}" role="tab" data-toggle="tab"><span>{% trans transCatTabName %}</span></a></li>
37
{% set first = false %}
40
<form id="SettingsForm" class="XiboForm form-horizontal" method="put" action="{{ urlFor("settings.update") }}">
41
<div class="tab-content">
42
{% for field in fields %}
43
{% if currentCat != field.cat %}
44
{% if currentCat != "" %}
48
<div class="tab-pane {% if currentCat == "" %}active{% endif %}" id="{{ field.catId }}">
49
{% set currentCat = field.cat %}
50
{% set transFieldCat = field.cat %}
51
<h3 class="section-heading">{% trans transFieldCat %}</h3>
53
{# Now we have to output the relevant form field #}
54
{% if field.enabled != 1 %}
55
{{ forms.disabled(field.name, field.title, field.value, field.helpText) }}
56
{% elseif field.fieldType == "text" %}
57
{{ forms.input(field.name, field.title, field.value, field.helpText) }}
58
{% elseif field.fieldType == "number" %}
59
{{ forms.number(field.name, field.title, field.value, field.helpText) }}
60
{% elseif field.fieldType == "email" %}
61
{{ forms.email(field.name, field.title, field.value, field.helpText) }}
62
{% elseif field.fieldType == "checkbox" %}
63
{{ forms.checkbox(field.name, field.title, field.value, field.helpText) }}
64
{% elseif field.fieldType == "dropdown" %}
65
{{ forms.dropdown(field.name, "single", field.title, field.value, field.options, "id", "value", field.helpText) }}
66
{% elseif field.fieldType == "timezone" %}
67
{{ forms.dropdown(field.name, "single", field.title, field.value, field.options, "id", "value", field.helpText) }}
68
{% elseif field.fieldType == "datetime" %}
69
{{ forms.datetime(field.name, field.title, field.value, field.helpText) }}
73
<button class="btn btn-save btn-block btn-success" href="#"><span>{% trans "Save" %}</span></button>
81
{% block javaScript %}
82
<script type="text/javascript">
83
$("#layoutUploadForm").click(function() {
85
var template = Handlebars.compile($("#template-backup-upload").html());
87
// Handle bars and open a dialog
91
addFiles: "{% trans "Add Backup File" %}",
92
startUpload: "{% trans "Start upload" %}",
93
cancelUpload: "{% trans "Cancel upload" %}"
96
maxSize: {{ libraryUpload.maxSize }},
97
maxSizeMessage: "{{ libraryUpload.maxSizeMessage }}",
98
validExt: "{{ libraryUpload.validExt }}"
101
title: "{% trans "Upload Backup" %}",
104
label: "{% trans "Done" %}",
105
className: "btn-primary",
106
callback: function() {
111
}).on('shown.bs.modal', function() {
112
// Configure the upload form
113
var url = "{{ urlFor("maintenance.import") }}";
114
var form = $(this).find("form");
116
// Initialize the jQuery File Upload widget:
119
disableImageResize: true
122
// Upload server status check for browsers with CORS support:
123
if ($.support.cors) {
127
}).fail(function () {
128
$('<span class="alert alert-error"/>')
129
.text('Upload server currently unavailable - ' + new Date())
134
// Enable iframe cross-domain access via redirect option:
138
window.location.href.replace(
140
'/cors/result.html?%s'
144
form.bind('fileuploadsubmit', function (e, data) {
145
var inputs = data.context.find(':input');
146
if (inputs.filter('[required][value=""]').first().focus().length) {
149
data.formData = inputs.serializeArray().concat(form.serializeArray());
151
inputs.filter("input").prop("disabled", true);
158
{% block javaScriptTemplates %}
163
<script type="text/x-handlebars-template" id="template-backup-upload">
164
<form method="post" enctype="multipart/form-data" data-max-file-size="{{ upload.maxSize }}" data-accept-file-types="/(\.|\/)tar.gz/i">
165
<div class="row fileupload-buttonbar">
166
<div class="col-md-7">
168
{{ upload.maxSizeMessage }}
170
<!-- The fileinput-button span is used to style the file input field as button -->
171
<span class="btn btn-success fileinput-button">
172
<i class="glyphicon glyphicon-plus glyphicon glyphicon-white"></i>
173
<span>{{ trans.addFiles }}</span>
174
<input type="file" name="files[]">
176
<button type="submit" class="btn btn-primary start">
177
<i class="glyphicon glyphicon-upload glyphicon glyphicon-white"></i>
178
<span>{{ trans.startUpload }}</span>
180
<button type="reset" class="btn btn-warning cancel">
181
<i class="glyphicon glyphicon-ban-circle glyphicon glyphicon-white"></i>
182
<span>{{ trans.cancelUpload }}</span>
184
<!-- The loading indicator is shown during file processing -->
185
<span class="fileupload-loading"></span>
187
<!-- The global progress information -->
188
<div class="col-md-4 fileupload-progress fade">
189
<!-- The global progress bar -->
190
<div class="progress">
191
<div class="progress-bar progress-bar-success progress-bar-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" style="width:0%;">
192
<div class="sr-only"></div>
195
<!-- The extended global progress information -->
196
<div class="progress-extended"> </div>
199
<!-- The table listing the files available for upload/download -->
200
<table role="presentation" class="table table-striped"><tbody class="files"></tbody></table>
204
<!-- The template to display files available for upload -->
205
<script id="template-backup-upload" type="text/x-tmpl">
206
{% for (var i=0, file; file=o.files[i]; i++) { %}
207
<tr class="template-upload fade">
209
<span class="fileupload-preview"></span>
212
{% if (file.error) { %}
213
<div><span class="label label-danger">{%=file.error%}</span></div>
215
{% if (!file.error) { %}
216
<label for="name[]"><input name="name[]" type="text" id="name" value="" /></label>
220
<p class="size">{%=o.formatFileSize(file.size)%}</p>
221
{% if (!o.files.error) { %}
222
<div class="progress">
223
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" style="width:0%;">
224
<div class="sr-only"></div>
231
{% if (!o.files.error && !i && !o.options.autoUpload) { %}
232
<button class="btn btn-primary start">
233
<i class="glyphicon glyphicon-upload glyphicon glyphicon-white"></i>
237
<button class="btn btn-warning cancel">
238
<i class="glyphicon glyphicon-ban-circle glyphicon glyphicon-white"></i>
245
<!-- The template to display files available for download -->
246
<script id="template-backup-download" type="text/x-tmpl">
247
{% for (var i=0, file; file=o.files[i]; i++) { %}
248
<tr class="template-download fade">
250
<p class="name" id="{%=file.storedas%}" status="{% if (file.error) { %}error{% } %}">
253
{% if (file.error) { %}
254
<div><span class="label label-danger">{%=file.error%}</span></div>
258
<span class="size">{%=o.formatFileSize(file.size)%}</span>
b'\\ No newline at end of file'