<%namespace name="model" module="adhocracy.model"
/><%namespace name="components" file="/components.html"
/><%namespace name="navigation" file="/navigation.html"
/><%namespace name="debug" file="/debug/tiles.html"
/><%def name="breadcrumbs()">&nbsp;</%def><%def name="title()"></%def><?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE html>
<html id="top" class="no-js" lang="${c.locale.language}">
  <head>
      <%block name="head">
      ${components.head(self.title)}
      </%block>

      %if h.config.get('adhocracy.debug.sql'):
      ${debug.styles()}
      %endif
  </head>

<body lang="${c.locale.language}" class="${u" ".join(c.body_css_classes)}"
    data-baseurl="${h.base_url()}"
    data-stats-baseurl="${c.page_stats_url}"
    %if c.monitor_page_time_interval:
    data-stats-interval="${c.monitor_page_time_interval}"
    %if c.monitor_browser_values:
    data-stats-browser-values="${c.monitor_browser_values}"
    %endif
    %if c.monitor_extended:
    data-stats-extended="${c.monitor_extended}"
    %endif
    %if c.monitor_page_performance:
    data-stats-page-performance="${c.monitor_page_performance}"
    %endif
    %endif
    %if c.monitor_external_links_url:
    data-stats-monitor_external_links_url="${c.monitor_external_links_url}"
    %endif
    %if c.monitor_pager_clicks:
    data-stats-pager-clicks="${c.monitor_pager_clicks}"
    %endif
    >

    <!--[if lte IE 7]>
      <strong><a href="http://www.browser-update.org/update.html" class="ie-message">${_('You are using an outdated web browser. Click here to update.')}</a></strong>
    <![endif]-->
    <noscript>
      <strong class="ie-message">${_('Adhocracy works best with JavaScript enabled.')}</strong>
    </noscript>
    %if h.overlay_link():
    <noscript>
        <strong class="ie-message">${_('We could not display an overlay. See <a href="%s">here</a> what it would have displayed.') % h.overlay_link()|n}</strong>
    </noscript>
    %endif
    %if h.config.get_bool(u'adhocracy.readonly'):
    <%
        msg = h.config.get(u'adhocracy.readonly.message')
        if msg == u'__default__':
            # translation happens twice in this case, but there should be no problem
            msg = _(u'This installation of adhocracy has been frozen. You can look at all content but editing is disabled.')
    %>
    %if msg:
    <strong class="ie-message">${_(msg)}</strong>
    %endif
    %endif

    <div class="overlay" id="overlay-default">
      <a class="close only-js"></a>
      <!-- the external content is loaded inside this tag -->
      <div class="contentWrap"></div>
    </div>
    <div class="overlay" id="overlay-big">
      <a class="close only-js"></a>
      <!-- the external content is loaded inside this tag -->
      <div class="contentWrap"></div>
    </div>
    %if c.user and c.user.welcome_code:
      <form id="user_welcome" action="${h.entity_url(c.user, member='set_password')}" method="post" data-success-message="${_('Password has been set. Have fun!')}">
      ${h.field_token()|n}
      <label><span>${_('Welcome back!') if c.user.password else _('Welcome to %s!') % h.site.name()} ${_('Please choose a password:')}</span>
      <input type="password" name="password" autofocus="autofocus" required="required" pattern=".{6,}" title="${_('Please pick a secure password')}" x-moz-errormessage="${_('Please pick a secure password')}"/>
      <input type="submit" value="${_('Set Password')}" />
      </label>
      </form>
    %endif
    %if c.user is None:
    <div class="overlay" id="overlay-login">
      <a class="close only-js"></a>
      <div class="contentWrap">
         %if config.get('adhocracy.login_style', 'default') == 'alternate':
             <%include file="/user/login_form_alternate.html"/>
         %else:
             <%include file="/user/login_form.html"/>
         %endif
      </div>
    </div>
    %elif c.instance and can.instance.join(c.instance):
    <div class="overlay" id="overlay-join">
      <a class="close only-js"></a>
      <div class="contentWrap">
         <div class="register">
             <p class="patch_description">
                 ${_('Join this instance to start contributing.')}
             </p>
             <a class="button ${components.add_patch_camefrom_class()}" href="${h.entity_url(c.instance, member='join')}?${h.url_token()}">${_("join")}</a>
         </div>
      </div>
    </div>
    %elif c.instance and c.instance.require_valid_email and c.user and not c.user.is_email_activated():
    <div class="overlay" id="overlay-validate">
      <a class="close only-js"></a>
      <div class="contentWrap">
         <div class="register">
             <p class="patch_description">
                 ${_('Validate email to start contributing.')}
             </p>
             <a class="button large patch_camefrom" href="${h.user.activation_url()}" title="${_('Resend validation email to %s')%c.user.email}">${_('Send activation link')}</a>
             ${_("or")}
             <a class="more_uppercase" href="${h.entity_url(c.user, instance=c.instance, member='edit')}">${_("Edit profile")}</a>
         </div>
      </div>
    </div>
    %endif
    %if c.instance and c.instance.frozen:
    <div class="overlay">
      <a class="close only-js"></a>
      <div class="contentWrap">
      ${_('This instance has been frozen - you can not edit or post anything.')}
      </div>
    </div>
    %endif
  <!-- begin: header -->
  <header id="header">
    <div class="page_wrapper">
      <!-- begin: top navi -->
      <div id="topnav">
        <!-- start: skip link navigation -->
        <a class="skip" title="skip link" href="#navigation">Skip to the navigation</a><span class="hideme">.</span>
        <a class="skip" title="skip link" href="#main">Skip to the content</a><span class="hideme">.</span>
        <!-- end: skip link navigation -->
        %if h.config.get('adhocracy.twitter.profile_url'):
        <a href="${h.config.get('adhocracy.twitter.profile_url')}" class="icon_link follow">Follow us!</a>
        %endif
      </div>

      <%include file="logo.html" />
      ${navigation.global_nav(c.active_global_nav)}
    </div>
  </header>

  <%block name="attention_getter">
  ${components.attention_getter()}
  </%block>

  %if c.instance:
  ${navigation.subheader_instance_navigation(c.active_subheader_nav)}
  %endif

  <%block name="welcome">
  <div id="welcome_message">
      <div class="page_wrapper">
          <%block name="flashmessages"></%block>
          <%block name="infoboxes"></%block>

          %if c.tutorial and h.tutorial.show(c.tutorial, c.user):
          <div class="only-js" id="tutorial-banner">
              <%components:build_infobox>
              <div id="tutorial-intro">
                  ${c.tutorial_intro|n}
              </div>
              %if not c.tutorial_hide_start_button:
              <a id="start-tutorial-button"
                 href="#"
                 class="button"
                 data-next="${_('Next')}"
                 data-previous="${_('Previous')}">
                  ${_('start_this_tutorial')}
              </a>
              %endif
              <a href="#" id="disable-this-tutorial"
                 class="disable-link">
                  ${_('disable_this_tutorial')}
              </a>
              <a href="#" id="disable-all-tutorials"
                 class="disable-link">
                  ${_('disable_all_tutorials')}
              </a>
              </%components:build_infobox>
          </div>
          %endif
      </div>
  </div>

  </%block>
  <div id="main" class="default_content">
    <div class="page_wrapper">
      <%block name="main" />
    </div>
  </div>

  <!-- Fixme: Here to render error pages -->
  ${self.body()}

  <%include file="piwik.html"/>
  <%include file="footer.html"/>

    <!-- Dummy tag to merge in wordpress scripts -->
    <div id="external_scripts"></div>

    %if h.config.get('adhocracy.debug.sql'):
    ${debug.queries()}
    %endif

    %if h.feedback.is_configured():
    %if can.proposal.create(instance=h.feedback.get_feedback_instance()):
      ${components.feedback()}
    %endif
    %endif

  </body>
</html>
