<!DOCTYPE html>
<%= render 'layouts/script_url' %>
<%= render 'layouts/image_url' %>
<%= render 'layouts/validate' %>
<html>
  <head>
    <title>DECO Drive</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>

    <%= yield :head %>

    <link rel="manifest" href="/manifest.json">
    <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
    <%= stylesheet_link_tag "address_books" %>
    <%= stylesheet_link_tag "jquery.multiselect2side" %>
    <%= stylesheet_link_tag "jquery-ui" %>
    <%= stylesheet_link_tag "jquery-ui-timepicker-addon" %>
    <%= stylesheet_link_tag "os" %>
    <%= stylesheet_link_tag "receiver_list_import" %>
    <%= stylesheet_link_tag "styles" %>
    <%= stylesheet_link_tag "system.styles" %>
    <%= stylesheet_link_tag "template" %>
    <%= stylesheet_link_tag "uploadfile" %>
    <%= stylesheet_link_tag "user_log" %>
    <%= stylesheet_link_tag "user_management" %>
    <%= stylesheet_link_tag "validationEngine.jquery" %>
    <%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
    <%= javascript_include_tag "jquery" %>
    <%= javascript_include_tag "jquery-ui" %>
    <%= javascript_include_tag "import_csv" %>
    <%= javascript_include_tag "jquery.form" %>
    <%= javascript_include_tag "jquery.multiselect2side" %>
    <%= javascript_include_tag "jquery.simplemodal.1.4.4.min" %>
    <%= javascript_include_tag "jquery.uploadfile" %>
    <%= javascript_include_tag "jquery.validationEngine" %>
    <%= javascript_include_tag "jquery.ui.datepicker-ja" %>
    <%= javascript_include_tag "jquery-ui.timepicker-addon" %>
    <%= javascript_include_tag "jquery-ui.timepicker-ja" %>
    <%= javascript_include_tag "deco" %>
  </head>

<% if controller.controller_name == 'top' %>
  <body class="top">
<% elsif controller.controller_name == 'file_send'%>
  <body class="sen">
<% elsif controller.controller_name == 'file_request'%>
  <body class="req">
<% elsif controller.action_name == 'about'%>
  <body class="srv">
<% elsif controller.action_name == 'usage'%>
  <body class="use">
<% elsif controller.action_name == 'constitution'%>
  <body class="rul">
<% elsif controller.action_name == 'ask'%>
  <body class="con">
<% else %>
  <body>
<% end %>
<% @content_frames = ContentFrame.where(:master_frame => 0).order('content_frame_order') -%>
    <div id="header">
      <%= image_tag('common/deco_logo01.jpg', :alt => "DECO Drive", :border => 0) %>
    </div>
    <br />
    <div id="global-nav">
      <ul>
      <% case session[:site_category]
         when "file_receive" %>
        <li id="p_top">
          <%= link_to 'トップページ', :controller => 'file_receive' %>
        </li>
        <li></li>
        <li></li>
      <% when "requested_file_send" %>
        <li id="p_top">
          <%= link_to 'トップページ', :controller => 'requested_file_send', :action => 'login', :id => session[:request_send_url_code].present? ? session[:request_send_url_code] : '' %>
        </li>
        <li></li>
        <li></li>
      <% when "requested_file_receive" %>
        <li id="p_top">
          <%= link_to 'トップページ', :controller => 'requested_file_receive', :action => 'login', :id => session[:request_receive_url_code].present? ? session[:request_receive_url_code] : '' %>
        </li>
        <li></li>
        <li></li>
      <% when "system" %>
      <% else %>
        <li id="p_top">
          <%= link_to 'トップページ', root_path %>
        </li>
        <li id="p_sen">
          <%= link_to 'ファイル送信', :controller => 'file_send' %>
        </li>
        <li id="p_req">
          <%= link_to 'ファイル依頼', :controller => 'file_request' %>
        </li>
      <% end %>
      <% @content_frames.each.with_index do |content_frame, count| %>
        <li id="p_srv">
        <% if content_frame.expression_flag == 1 %>
          <%= link_to content_frame.title, :controller => 'content', :action => 'load', :id => content_frame.id %>
        <% end %>
        </li>
      <% end %>
      </ul>
    </div>
    <div id="status">
      <%= t('views.login_state.src_ip_address') %>:<%= @access_ip %>
      <%- unless session[:site_category] -%>
        <%= render 'layouts/loginuser' %>
      <%- end -%>
    </div>
    <div id="main">
    <% if flash[:notice] -%>
      <div id="hint">
        <%=h flash[:notice] %>
      </div>
    <% end -%>
    <% if session[:site_category] == 'system' -%>
      <div id="sys-main">
        <div id="sys-menu">
        </div>
        <div id="sys-cont">
          <%= yield %>
        </div>
      </div>
    <% else -%>
      <%= yield %>
    <% end -%>
    </div>
    <div id="footer">
      <font color="#778899">Powered by</font> <a href="https://www.deco-project.org", target="_blank"><%= image_tag('common/deco_s2.jpg', :alt => "powered by DECO", :align => "bottom", :style => "vertical-align: middle;", :border => 0) %></a>
    </div>
  </body>
</html>
