summaryrefslogtreecommitdiffstats
path: root/modules-available/sysconfig/templates/screensaver-text.html
blob: 68adc8f71ff64045601d11a30a879c5838dd11a4 (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
<form role="form" enctype="multipart/form-data" method="post" action="?do=SysConfig&amp;action=addmodule&amp;step={{step}}">
	<input type="hidden" name="token" value="{{token}}">
	<input type="hidden" id="next" name="next" value="{{next}}">
	<input type="hidden" name="id" value="{{id}}">
	<input type="hidden" name="edit" value="{{edit}}">

	<div class="form-group">
		<h4><label>{{title}}</label></h4>
		<h5>{{description}}</h5>

		<h4>{{lang_screenUnlocked}}</h4>
		<div class="input-group">
			<span class="input-group-addon slx-ga">{{lang_title}}</span>
			<input type="text" tabindex="1" name="msg_value" value="{{msg_value}}" class="form-control">
		</div>
	</div>

	<div class="form-group">
		<span class="input-group-addon top-addon">{{lang_screenText}}</span>
		<textarea class="form-control summernote" id ="text-id" name="text_value" rows="5" cols="30">{{text_value}}</textarea>
	</div>
	<hr>
	<h4>{{lang_screenLocked}}</h4>
	<input type="hidden" id="inherit_locked" name="inherit_locked" value="{{inherit_locked}}">
	<div class="form-group">
		<div class="input-group btn-group">
			<span class="input-group-addon">{{lang_screenTextInherit}}</span>
			<a class="btn btn-default" id="btn-inherit-on" type="button" onclick="switchMode(true)" tabindex="2">
				<span class="glyphicon glyphicon-ok"></span>
			</a>
			<a class="btn btn-default active" id="btn-inherit-off" onclick="switchMode(false)" tabindex="3">
				<span class="glyphicon glyphicon-remove"></span>
			</a>
		</div>
	</div>

	<div class="form-group">
		<div class="input-group">
			<span class="input-group-addon slx-ga">{{lang_title}}</span>
			<input type="text" id="msg-locked-id" tabindex="4" name="msg_locked_value" value="{{msg_locked_value}}" class="form-control">
		</div>
	</div>

	<div class="form-group">
		<span class="input-group-addon top-addon">{{lang_screenText}}</span>
		<textarea class="form-control summernote" id ="text-locked-id" name="text_locked_value" rows="5" cols="30">{{text_locked_value}}</textarea>
	</div>

	<div class="btn-group">
		<button class="btn btn-default" type="submit" onclick="goBack()" tabindex="5">{{lang_back}}</button>
	</div>
	<div class="btn-group pull-right">
		<button type="submit" class="btn btn-primary" tabindex="6">
			{{#lastStep}}
			<span class="glyphicon glyphicon-floppy-disk"></span>
			{{lang_save}}
			{{/lastStep}}
			{{^lastStep}}{{lang_next}} &raquo;{{/lastStep}}
		</button>
	</div>
	<div class="clearfix"></div>
</form>

<script type="text/javascript">
	document.addEventListener("DOMContentLoaded", function () {
		// Init summernote to e.g. disable video because xscreensaver can't handle it
		$('.summernote').summernote({
			toolbar: [
				// [groupName, [list of button]]
				['style', ['bold', 'italic', 'underline', 'clear']],
				['font', ['strikethrough', 'superscript', 'subscript']],
				['fontsize', ['fontsize']],
				['color', ['color']],
				['para', ['style', 'ul', 'ol', 'paragraph']],
				['height', ['height']],
				['insert', ['picture', 'link', 'table', 'hr']],
				['misc', ['undo', 'redo', 'codeview', 'fullscreen']]
			]
		});
		switchMode({{inherit_locked}});
	}, false);

	function switchMode(mode) {
		// true = inherit on
		// false = inherit off
		if (mode) {
			$('#msg-locked-id').prop('disabled', true);
			$('#text-locked-id').summernote('disable');
			$('#btn-inherit-on').addClass('active');
			$('#btn-inherit-off').removeClass('active');
			$('#inherit_locked').val(true);
		} else {
			$('#msg-locked-id').prop('disabled', false);
			$('#text-locked-id').summernote('enable');
			$('#btn-inherit-on').removeClass('active');
			$('#btn-inherit-off').addClass('active');
			$('#inherit_locked').val(false);
		}
	}

	function goBack() {
		$('#next').val('{{prev}}');
	}
</script>

<style>
	.top-addon {
		border-right: 1px solid #ccc !important;
		border-top-right-radius: 4px !important;
		border-bottom-left-radius: 0 !important;
		border-bottom-right-radius: 0 !important;
		border-bottom: 0 !important;
	}

	/* Used to override some summernote css to get a proper addon header */
	.note-editor.note-frame {
		border-color: #ccc !important;
		border-top-left-radius: 0 !important;
		border-top-right-radius: 0 !important;
	}
</style>