<%  
	def defPlugins = [
		[ key: 'jabber:iq:auth', label: 'Non-SASL Authentication', value: true ],
		[ key: 'urn:ietf:params:xml:ns:xmpp-sasl', label: 'SASL Authentication', value: true ],
		[ key: 'urn:ietf:params:xml:ns:xmpp-bind', label: 'Resource Bind', value: true ],
		[ key: 'urn:ietf:params:xml:ns:xmpp-session', label: 'Session bind', value: true ],
		[ key: 'jabber:iq:register', label: 'User registration', value: true ],
		[ key: 'jabber:iq:roster', label: 'Roster management', value: true ],
		[ key: 'presence-state', label: 'Presence management (delivery)', value: true ],
		[ key: 'presence-subscription', label: 'Presence management (subscription)', value: true ],
		[ key: 'basic-filter', label: 'Basic filter', value: true ],
		[ key: 'domain-filter', label: 'Domain filter', value: true ],
		[ key: 'jabber:iq:privacy', label: 'Privacy lists', value: true ],
		[ key: 'jabber:iq:version', label: 'Software version', value: true ],
		[ key: 'http://jabber.org/protocol/stats', label: 'Server statistics', value: true ],
		[ key: 'starttls', label: 'TLS', value: true ],
		[ key: 'msgoffline', label: 'Offline message storage (old)', value: false ],
		[ key: 'vcard-temp', label: 'vCard', value: true ],
		[ key: 'http://jabber.org/protocol/commands', label: 'Ad-hoc commands', value: true ],
		[ key: 'jabber:iq:private', label: 'Private data storage', value: true ],
		[ key: 'urn:xmpp:ping', label: 'Ping', value: true ],
		[ key: 'pep', label: 'Personal eventing (PEP)', value: true ],
		[ key: 'zlib', label: 'Zlib stream compression (new, experimental)', value: true ],
		[ key: 'message-archive-xep-0136', label: 'message-archive-xep-0136 (XEP-0136: Message Archiving support)', value: true ],
		[ key: 'urn:xmpp:mam:1', label: 'urn:xmpp:mam:1 (XEP-0313: Message Archive Management)', value: true ],
		[ key: 'unified-archive', label: 'Unified archive plugin', value: true ],
		[ key: 'amp', label: 'Advanced Message Processing (AMP with offline message store)', value: true ]
	];
	defPlugins = defPlugins.collectEntries { [it.key, it.label] };
%>
${ util.include('header', [title:'Setup: ' + page.title]) }
<% def fieldFn = { q, label, valueControl -> %>
<div class="form-group">
	<label class="col-sm-6 control-label" for='${q.getName()}'><%= label %></label>
	<div class="col-sm-6">
		<% valueControl(q); %>
	</div>
</div>
<% } %>
<div class="panel panel-default">
	<div class="panel-heading panel-xs">
		<h4>Please select/deselect plugins to be loaded by the server.</h4>
	</div>
	<div class="panel-body">
<form class="form-horizontal" method='POST' action="?step=${ page.nextPage() }">
<% page.getPlugins().each { %>
	<% fieldFn(it, it.getLabel() ?: defPlugins[it.getBeanName()] ?: it.getBeanName(), { q1 -> %>
	<input class="form-control" name='${q1.getName()}' type='checkbox' ${ q1.mayBeChanged() ? "" : "disabled" } ${ (q1.mayBeEnabled() && q1.isSelected(q1.getBeanName())) ? "checked" : "" } /><% if (!q1.mayBeEnabled()) { %><span style="color: red;">${q1.getCause()}</span><% } %>
	<% }); %>
<% } %>
	</div>
</div>

<button class="btn btn-default" type="submit">Next</button>

</form>
${ util.include('footer') } 