summaryrefslogblamecommitdiffstats
path: root/modules-available/baseconfig/templates/_page.html
blob: 46fccac640c64892195806ee40a69f409238b16e (plain) (tree)
1
2
3
4
5
6
7
                                    
             
                       

                                                               

                                            




                                                                      

                                                                                                                                      












                                                                                     
                                                                                 
                                                                                                                        
                                                                                
                                                              




                                                                                                                                                              
                                                      

                                                                      



                                                                                                                           








                                                                                                                                                                                                  




                                                                                                                                         
                                                                                                       
                                                      
                                              
                                      
                                             

                              
              
                       
                                
                                                                                                                                               









                                                                                                                                                                           
       



                               

                                         
                                      





                                                          
 








                                                                                      
                 
         




                                                                






                                                                           
 
                                 










                                                  

                                                                                            

         
<h1>{{lang_basicConfiguration}}</h1>
{{#override}}
<h2>{{subheading}}</h2>
<div class="alert alert-info">{{lang_editOverrideNotice}}</div>
{{/override}}
<p>{{lang_clientRelatedConfig}}</p>
<form action="?do=BaseConfig" method="post">
	<input type="hidden" name="token" value="{{token}}">
	{{#override}}
	<input name="module" type="hidden" value="{{target_module}}">
	<input name="{{field}}" type="hidden" value="{{field_value}}">
	{{/override}}
	<input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="position:absolute;top:-2000px" tabindex="-1">
	<input type="password" name="password_fake" id="password_fake" value="" style="position:absolute;top:-2000px" tabindex="-1">
	{{#categories}}
	<div class="panel panel-default">
		<div class="panel-heading" role="tab" id="heading{{category_id}}">
			<a name="category_{{category_id}}"></a>
			{{category_name}}
		</div>
		<div class="panel-body">
			<div class="list-group">
				{{#settings}}
				<div class="list-group-item">
					<div class="row">
						<div class="col-md-5 slx-cfg-toggle">
							<div>{{setting}}</div>
							<div class="slx-default">
								{{#defaultvalue}}{{lang_defaultValue}}:{{/defaultvalue}}
								{{defaultvalue}}
							</div>
							<input class="bs-switch" name="override[{{setting}}]" id="CB_{{setting}}" type="checkbox" {{checked}}>
							<label for="CB_{{setting}}">
								{{#override}}{{lang_enableOverride}}{{/override}}
								{{^override}}{{lang_settingActive}}{{/override}}
							</label>
						</div>
						<div class="col-md-5">
							{{{item}}}
							<div class="slx-default">
								{{#defaultsource}}{{lang_inheritSource}}:{{/defaultsource}}
								{{defaultsource}}
							</div>
						</div>
						<div class="col-md-2">
							<a class="btn btn-default" data-toggle="modal" data-target="#help-{{setting}}"><span class="glyphicon glyphicon-question-sign"></span></a>
						</div>
					</div>
				</div>
				<div class="modal fade" id="help-{{setting}}" tabindex="-1" role="dialog">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal">&times;</button>
								<h4 class="modal-title"><b>{{setting}}</b></h4>

							</div>
							<div class="modal-body">{{{description}}}</div>
						</div>
					</div>
				</div>
				{{/settings}}
			</div>
		</div>
	</div>
	{{/categories}}
	<div class="text-right">
		<button class="btn btn-warning" type="reset"><span class="glyphicon glyphicon-refresh"></span> {{lang_discardChanges}}</button>
		{{^override}}
		<a class="btn btn-default" href="api.php?do=baseconfig&amp;user={{userid}}"><span class="glyphicon glyphicon-download-alt"></span> Download</a>
		{{/override}}
		{{#override}}
		<a class="btn btn-default" href="api.php?do=baseconfig&amp;user={{userid}}&amp;module={{target_module}}&amp;value={{field_value}}&amp;force=1">Download</a>
		{{/override}}
		<button class="btn btn-primary" type="submit"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button>
	</div>
	<br/>

</form>

<script type="text/javascript">

function updateShadows(e) {
	var rules = $(e).data('shadows');
	if (!rules) return;
	var currentValue = $(e).val();
	for (var triggerVal in rules) {
		var targets = rules[triggerVal];
		for (var i = 0; i < targets.length; ++i) {
			var target = targets[i];
			var inp = $('#' + target);
			var selitem = inp.data('selitem');

			if (currentValue === triggerVal) {
				inp.prop('disabled', true);
				if (selitem) selitem.disable();
				$('#' + target + '.multilist').multiselect('disable');
			} else {
				inp.prop('disabled', false);
				if (selitem) selitem.enable();
				$('#' + target + '.multilist').multiselect('enable');
			}
		}
	}
}


document.addEventListener("DOMContentLoaded", function () {
	/* apply selectize on all multiinput-selectize inputs */
	$("input.multiinput").each(function (idx, elem) {
		var e = $(elem);
		e.data('selitem', e.selectize({
			delimiter: ' ',
			create: true,
			plugins: ['restore_on_backspace', 'remove_button'],
			maxItems: 10000

		})[0].selectize);
	});

	var $multilists = $("select.multilist");
	$multilists.multiselect({
		includeSelectAllOption: true,
		buttonWidth: '100%',
		buttonClass: 'form-control'
	});

	/* data-shadowing bindings */
	$allShadowingFields = $('[data-shadows]');
	$allShadowingFields.on('change', function (event) { updateShadows(event.target); });
	$allShadowingFields.each(function (idx, elem) { updateShadows(elem); });
});
</script>