	{# 	
	Keosu is an open source CMS for mobile app
	Copyright (C) 2014  Vincent Le Borgne, Pockeit

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    #}
{% extends '::root.html.twig' %}
{% block skeleton %}
<section id="main-content">
	<div class="container-fluid">
		{% block maincontent %}
		<div class="row">
			<div class="col-md-2 leftcol">
				<div class="leftcol">
					<section id="leftmenu" class="leftcol">
						<div class="sidebar leftcol">

						<div class="sidemenu leftcol">	
							{% block leftmenu %}
								<div class="logotop" style="text-align:center;">KEOSU</div>
								<br/>

								<div class="dropdown" id="applist">
									{{ appListMenu() }}
								</div>
								<div class="separator">&nbsp;</div>
								<!-- content -->
								{% block contentmenu %}
									<div>
								{% endblock %}
										<div class="sidebartitle">
											<a href="{{ path('keosu_core_homepage') }}">
												Content <span class="glyphicon glyphicon-chevron-right"></span>
											</a>
										</div>
										<div>
											<a class="sidebarlink" href="{{ path('keosu_ReaderManager_manage') }}">
												Import remote
											</a>
										</div>
										{{ appListContent() }}
									</div>
								
								<div class="separator">&nbsp;</div>
								<!-- Page menu -->
								<div class="sidebartitle">
									 <a href="{{ path('keosu_core_page') }}">
											Pages <span class="glyphicon glyphicon-chevron-right"></span>
									</a>
								</div>
								<div>
									<a class="sidebarlink" href="{{ path('keosu_core_views_page_manage') }}">
										Manage pages
									</a>
								</div>
								{{ appListPage() }}
								<div class="separator">&nbsp;</div>

								<div class="sidebartitle">
									<a id="simulator" target="_blank" class="mainnavel" href="http://emulate.phonegap.com?url={{url_base}}/keosu/export/simulator/www/index.html">
										Preview <span class="glyphicon glyphicon-chevron-right"></span>
									</a>
								</div>

								<div class="separator">&nbsp;</div>

								<div class="sidebartitle">
									<a href="{{ path('keosu_core_publish') }}"> 
										Publish <span class="glyphicon glyphicon-chevron-right"></span>
									</a>
								</div>

								<div class="separator">&nbsp;</div>

								{# active with activesidebartitle #}
								<div class="sidebartitle menuTitle">
									<a href="{{ path('keosu_core_configuration') }}"> 
										 Config <span class="glyphicon glyphicon-chevron-right"></span>
									</a>
								</div>
								<div class="menuContent">
									<div>
										<a class="sidebarlink" href="{{ path('keosu_core_app_manage') }}">Apps</a>
									</div>
									<div>
										<a class="sidebarlink" href="{{ path('keosu_core_theme_manage') }}">Themes</a>
									</div>
									{{ addItemToMenuConfiguration() }}
								</div>
								<div class="separator">&nbsp;</div>	
							{% endblock %}
						</div>
						</div>
					</section>
				</div>
			</div>
			<div class="col-md-10">
				<div class="container">
					<div class="row-fluid">
							<div class="span6 pull-right logininfo" style="text-align:right">
								<span class="glyphicon glyphicon-user"></span>
								Hello {{ app.user.username }}
								<a href="{{ path('fos_user_security_logout') }}">
									(Logout)
								</a>
							</div>
					</div>
				</div>
				<div>
					<section id="body">{% block body %}{% endblock %}</section>
				</div>
			</div>
		</div>
		{% endblock %}
	</div>

</section>

<div id="dialog" title="Confirmation Required">
	Are you sure about this? All your modification will be lost
</div>
<script>
$(document).ready(function() {
	    $("#dialog").dialog({
	      autoOpen: false,
	      modal: true
	    });
	  });

	  $(".confirmModal").click(function(e) {
	    e.preventDefault();
	    var targetUrl = $(this).attr("href");

	    $("#dialog").dialog({
	      buttons : {
	        "Confirm" : function() {
	          window.location.href = targetUrl;
	        },
	        "Cancel" : function() {
	          $(this).dialog("close");
	        }
	      }
	    });

	    $("#dialog").dialog("open");
	  });
</script>

{% endblock %}
