<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<title>Igor Home Page</title>
</head>
<body>
	<h1>Igor Home Page</h1>
	
	<p>
		This is your Igor home automation server, version {{igor.database.getValue('/data/services/igor/version', token)}}, 
		running on host {{igor.database.getValue('/data/services/igor/host', token)}}, 
		port {{igor.database.getValue('/data/services/igor/port', token)}}. Welcome!
	</p>
	<p>
		It has been running since {{igor.database.getValue('igor_dateTime(/data/services/igor/startTime)', token)}},
		and was rebooted {{igor.database.getValue('/data/services/igor/rebootCount', token)}} times during its lifetime.
	</p>
	
	{% set user = igor.app.getSessionItem('user', None) %}
	{% if user %}
		<p>
			You are logged in as {{user}}. To log out (or log in with different credentials) please visit the <a href="/login">login page</a>.
		</p>
	{% else %}
		<p>You are not logged in. To log in please visit the <a href="/login">login page</a>.</p>
	{% endif %}

	<h1>Igor Status</h1>

	{% if igor.plugins.exists('systemHealth') %}
		<p>For a general overview of the health of the various systems monitored by Igor see <a href="/plugin/systemHealth/page/index.html">Igor system health</a>.</p>
	{% endif %}
	{% if igor.internal.accessControl('hasCapabilitySupport') %}
		<p>To view accesses failures caused by missing capabilities see the <a href="/accessErrors.html">access error page</a>.</p>
	{% endif %}
	
	<h1>Igor Administration</h1>

	<p>To view installed plugins (and add or remove them) see the <a href="/plugins.html">plugins page</a>.</p>

	{% if igor.plugins.exists('user') %}
		<p>
		To view the list of users (and possibly add or remove users) see the <a href="/plugin/user/page/index.html">users page</a>.
		{% if user %}
			To change the password for user {{user}} see the <a href="/plugin/user/page/_password.html?username={{user}}">password form</a>.
		{% endif %}
		</p>
	{% endif %}

	{% if igor.plugins.exists('device') %}
		<p>To view known devices (and add or remove them) see the <a href="/plugin/device/page/index.html">devices page</a>.</p>
	{% endif %}

	{% if igor.plugins.exists('actions') %}
		<p>To view known actions (and add or remove them) see the <a href="/plugin/actions/page/index.html">action editor</a>.</p>
	{% endif %}

	{% if igor.internal.accessControl('hasCapabilitySupport') %}
		<p>To view your capabilities and perform operations on them see the <a href="/capabilities.html">capability page</a>.</p>
	{% endif %}
	
	<h2>Database access</h2>
	
	<p>
		Your raw database in XML can be found at <a href="/data/">/data/</a> (and you can see even more detail at <a href="/data/?.VARIANT=raw">/data/?.VARIANT=raw</a>)
		You can append a path (technically: an XPath expression that resolves to a single node) to view a subsection of the database.
	</p>
	
	<p>
		You can also run general XPath expressions by appending them to <a href="/evaluate/">/evaluate/</a>.
	</p>
	
	{% if igor.plugins.exists('editData') %}
		<p>To edit the database there is a rudimentary <a href="/plugin/editData/page/index.html">data editor</a> available.</p>
	{% endif %}

	<p>
		You can run
		individual actions by prefixing with <a href="/action/">/action/</a> (for example <a href="/action/save">/action/save</a>),
		plugins by prefixing with <a href="/plugin/">/plugin/</a> and a specific script for a specific plugin by constructing the url 
		<tt>/plugin/<i>pluginname</i>/script/<i>scriptname</i></tt>.
	</p>
		
	<h2>Debugging</h2>

	<p>
		For testing purposes you can run internal commands by prefixing them with <a href="/internal/">/internal/</a>, for example:
	</p>

	<ul>
		<li><a href="/internal/log">/internal/log</a> shows the httpd-style log file</li>
		<li><a href="/internal/dump">/internal/dump</a> dumps all runnable actions and the action storage datastructure with next runtimes</li>
	</ul>

</body>
</html>
