<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      lang="en"
      i18n:domain="plone">

<head>
  <meta http-equiv="content-type" content="text/html;charset=utf-8" />

  <title i18n:translate="" i18n:domain="senaite.core">Install SENAITE</title>

  <link rel="stylesheet" type="text/css"
        tal:attributes="href string:${context/absolute_url}/++resource++plone-admin-ui.css"
        href="/++resource++plone-admin-ui.css" />

  <script type="text/javascript">
   function install_focus() {
     var siteid = document.getElementById('site_id');
     siteid.value = "senaite";
     var extension = document.getElementById('bika.lims:default');
     extension.checked = true;
     var submit = document.getElementsByName('submit')[0];
     submit.focus();
   }
   window.onload = install_focus;
  </script>

</head>
<body>

  <img src="/++resource++senaite-core-logo.png"
       width="400"
       tal:attributes="src string:${context/absolute_url}/++resource++senaite-core-logo.png" />

  <h1 i18n:translate="" i18n:domain="senaite.core">Install SENAITE</h1>

  <form action="#"
        method="post"
        tal:attributes="action string:${context/absolute_url}/@@plone-addsite"
        tal:define="profiles view/profiles;
                    base_profiles profiles/base;
                    default_profile profiles/default;
                    extension_profiles profiles/extensions;
                    advanced request/advanced|nothing;">

      <div class="field">
        <label for="site_id" i18n:translate="">
          Path identifier
        </label>

        <div class="formHelp" i18n:translate="">
          The id of the site. This ends up as part of the URL.<br />
          No special characters are allowed.
        </div>

        <div class="formHelp" i18n:translate="" i18n:domain="senaite.core">
          Please use <em>senaite</em> or <em>senaitelims</em> as your site name.
        </div>

        <input type="text" name="site_id" size="20" id="site_id"/>
      </div>

      <div class="field">
        <label for="title" i18n:translate="label_title">Title</label>

        <div class="formHelp" i18n:translate="">
          A short title for the site. This will be shown in the title of the
          browser window on each page.
        </div>

        <input type="text" name="title" size="30" value="SENAITE" />
      </div>

      <div class="field">
        <label for="default_language" i18n:translate="">Language</label>

        <div class="formHelp" i18n:translate="">
          The main language of the site.
        </div>

        <select name="default_language"
                tal:define="browser_language view/browser_language;
                            languages python:view.languages(browser_language)">
            <option value="en"
                    tal:repeat="lang languages"
                    tal:attributes="value python:lang[0];
                                    selected python:lang[0]==browser_language"
                    tal:content="python: lang[1]">
                English
            </option>
        </select>
      </div>

      <div class="field" tal:condition="advanced">
        <label for="setup_content" i18n:translate="">Example content</label>

        <div class="formHelp" />

        <input type="checkbox" name="setup_content:boolean" />

        <span i18n:translate="">
            Should the default example content be added to the site?
        </span>
      </div>
      <tal:content tal:condition="not:advanced">
        <input type="hidden" name="setup_content:boolean" value="true" />
      </tal:content>

      <tal:baseprofile condition="python: len(base_profiles) > 1">
        <div class="field">
          <label for="profile_id" i18n:translate="">
            Base configuration
          </label>

          <div class="formHelp" i18n:translate="">
            You normally don't need to change anything here unless you have
            specific reasons and know what you are doing.
          </div>

          <dl>
            <tal:bases tal:repeat="info base_profiles">
              <dt>
                <input type="radio"
                       name="profile_id:string"
                       value="profile"
                       tal:attributes="id info/id;
                                       value info/id;
                                       checked python: default_profile==info['id'] and 'checked' or nothing"
                       />
                <label tal:attributes="for info/id"
                       tal:content="info/title">
                    Profile title
                </label>
              </dt>
              <dd tal:content="info/description">
                Profile description
              </dd>
            </tal:bases>
          </dl>
        </div>
      </tal:baseprofile>

          <tal:extensionprofiles condition="python:extension_profiles">
            <fieldset id="add-on-list">
              <legend i18n:translate="">
                Add-ons
              </legend>

              <div class="formHelp" i18n:translate="">
                  Select one of the following configurations of SENAITE. You can  also de/activate the add-ons once the site has been created from the Plone's add-ons setup view
              </div>

              <dl id="extension_ids">
                <tal:addons tal:repeat="info extension_profiles">
                  <tal:info tal:define="selected info/selected|nothing;
                                        infostyle python:'' if info['id'].startswith('bika.') else 'display:none';">
                    <tal:normal tal:condition="python: not selected or advanced">
                      <dt tal:attributes="style infostyle">
                        <input type="checkbox" name="extension_ids:list" value=""
                               tal:attributes="value info/id;
                                               id info/id;
                                               checked info/selected|nothing;"/>
                        <label
                            tal:attributes="for info/id"
                            tal:content="info/title">
                          profile title
                        </label>
                      </dt>
                      <dd tal:content="info/description"
                          tal:attributes="style infostyle">
                        profile description
                      </dd>
                    </tal:normal>
                    <tal:hidden tal:condition="python: selected and not advanced">
                      <input type="hidden" name="extension_ids:list" value=""
                             tal:attributes="value info/id;
                                             checked info/selected|nothing;" />
                    </tal:hidden>
                  </tal:info>
                </tal:addons>
              </dl>
            </fieldset>
          </tal:extensionprofiles>
      <div class="formControls">
        <input type="hidden" name="form.submitted:boolean" value="True" />
        <input type="submit" name="submit" value="Install"
               i18n:attributes="value;" i18n:domain="senaite.core" />
      </div>

  </form>
  </body>
</html>
