src/Eccube/Resource/template/admin/Store/plugin_table_official.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. <script>
  9. $(function() {
  10.     var currentPlugin = null;
  11.     var modal = $('#officialPluginDeleteModal');
  12.     modal.on('show.bs.modal', function(e) {
  13.         currentPlugin = $(e.relatedTarget).data();
  14.     });
  15.     $('#officialPluginDeleteButton').on('click', function() {
  16.         var footer = $('div.modal-footer', modal).hide();
  17.         var message = $('div.modal-body p', modal).text('「' + currentPlugin.name + ' (' + currentPlugin.version + ')」を削除中。この処理には数分かかる場合があります。画面をリロードせずにこのままお待ち下さい。')
  18.         var progress = $('div.progress', modal).show();
  19.         $.ajax({url: currentPlugin['deleteUrl'], type: 'delete'}).then(
  20.             function(data) {
  21.                 $.post("{{ url('admin_disable_maintenance', { 'mode': 'auto_maintenance' }) }}").then(function() {
  22.                     message.text('削除が完了しました。');
  23.                     $('#deleteLog').text(data.log);
  24.                     $('#deleteLogPane').show();
  25.                     progress.hide();
  26.                     footer.show().find('button').toggle();
  27.                 });
  28.             },
  29.             function(res) {
  30.                 if (res.responseJSON.message) {
  31.                     message.text(res.responseJSON.message);
  32.                 } else {
  33.                     message.text('削除に失敗しました。');
  34.                 }
  35.                 if (res.responseJSON.log) {
  36.                     $('#deleteLog').text(res.responseJSON.log);
  37.                 }
  38.                 $('#deleteLogPane').show();
  39.                 progress.hide();
  40.                 footer.show().find('button').toggle();
  41.             }
  42.         );
  43.     });
  44.     {% if app.flashes('eccube.admin.disable_maintenance') %}
  45.         // メンテナンスモード解除
  46.         $.post("{{ url('admin_disable_maintenance', { 'mode': 'auto_maintenance' }) }}");
  47.     {% endif %}
  48. });
  49. </script>
  50. {% if Plugins|length > 0 %}
  51.     <div class="card-body p-0">
  52.         <table class="table table-sm">
  53.             <thead>
  54.             <tr>
  55.                 <th class="border-top-0 ps-3 pt-2 pb-2">{{ 'admin.store.plugin_table_official.901'|trans }}</th>
  56.                 <th class="border-top-0 pt-2 pb-2">{{ 'admin.store.unregistered_plugin_table.942'|trans }}</th>
  57.                 <th class="border-top-0 pt-2 pb-2">{{ 'admin.store.unregistered_plugin_table.943'|trans }}</th>
  58.                 <th class="border-top-0 pt-2 pb-2">{{ 'admin.store.plugin_table.901'|trans }}</th>
  59.                 <th class="border-top-0 pt-2 pb-2">{{ 'admin.store.plugin_table_official.905'|trans }}</th>
  60.                 <th class="border-top-0 pt-2 pb-2">&nbsp;</th>
  61.             </tr>
  62.             </thead>
  63.             <tbody>
  64.             {% for key,Plugin in Plugins %}
  65.                 {% set pluginDetail = officialPluginsDetail[key]|default(NULL) %}
  66.                 <tr class="{% if Plugin.enabled == false %}active{% endif %}">
  67.                     <td class="align-middle">
  68.                         <div class="align-center-items ps-3 d-flex">
  69.                             <a href="#" target="_blank" class="plugin-image pe-3 d-block float-start">
  70.                                 <img height="60" src="{{ pluginDetail ? pluginDetail.image : asset('noimage_plugin_list.png', 'save_image') }}" alt="">
  71.                             </a>
  72.                             <span>{{ Plugin.name }}</span>
  73.                         </div>
  74.                     </td>
  75.                     <td class="align-middle">{{ Plugin.version }}</td>
  76.                     <td class="align-middle"><p class="mb-0">{{ Plugin.code }}</p></td>
  77.                     <td class="align-middle">
  78.                         {% if Plugin.id %}
  79.                             {% if Plugin.enabled %}
  80.                                 <span class="text-success">{{ 'common.enabled'|trans }}</span>
  81.                             {% else %}
  82.                                 <span class="text-secondary">{{ 'common.disabled'|trans }}</span>
  83.                             {% endif %}
  84.                         {% endif %}
  85.                     </td>
  86.                     <td class="align-middle">
  87.                         {% if pluginDetail %}
  88.                             {% if Plugin.id %}
  89.                                 {% if pluginDetail.update_status == 3 %}
  90.                                     <a href="{{ url('admin_store_plugin_update_confirm', {'id': Plugin.id}) }}"
  91.                                        class="btn btn-ec-regular">{{ 'admin.store.plugin_table_official.916'|trans }}</a>
  92.                                     <ul class="plugin-meta dl-horizontal">
  93.                                         <li class="plugin-version">{{ 'admin.store.plugin_table_official.917'|trans({'%version%' : pluginDetail.version}) }}</li>
  94.                                         <li class="plugin-version">
  95.                                             {% set versions = '' %}
  96.                                             {% for version in pluginDetail.supported_versions %}
  97.                                                 {% set versions = versions ~ version %}
  98.                                                 {%- if loop.last == false%}{% set versions = versions ~ ',' %}{% endif -%}
  99.                                             {% endfor %}
  100.                                             {{ 'admin.store.plugin_table_official.918'|trans({'%versions%' : versions}) }}
  101.                                         </li>
  102.                                         <li class="plugin-update">{{ 'admin.store.plugin_table_official.919'|trans({'%update_date%' : pluginDetail.update_date|time_ago}) }}</li>
  103.                                     </ul>
  104.                                 {% else %}
  105.                                     <p class="mb-0">{{ 'admin.store.plugin_table_official.920'|trans }}。</p>
  106.                                 {% endif %}
  107.                             {% else %}
  108.                                 <a href="{{ url('admin_store_plugin_install_confirm', {'id': Plugin.source}) }}" class="btn btn-ec-regular">{{ 'admin.store.plugin.install'|trans }}</a>
  109.                             {% endif %}
  110.                         {% endif %}
  111.                     </td>
  112.                     <td class="align-middle">
  113.                         {% if Plugin.id %}
  114.                             <div class="row m-0">
  115.                                 <div class="col-4">
  116.                                     {% if Plugin.enabled == false %}
  117.                                         <a href="#"
  118.                                            data-bs-toggle="modal"
  119.                                            data-bs-target="#officialPluginDeleteModal"
  120.                                            data-id="{{ Plugin.id }}"
  121.                                            data-delete-url="{{ url('admin_store_plugin_api_uninstall', { id: Plugin.id }) }}"
  122.                                            data-name="{{ Plugin.name }}"
  123.                                            data-version="{{ Plugin.version }}"
  124.                                            class="btn btn-ec-actionIcon">
  125.                                             <i class="fa fa-close fa-lg text-secondary" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ 'admin.common.delete'|trans }}"></i>
  126.                                         </a>
  127.                                     {% endif %}
  128.                                 </div>
  129.                                 <div class="col-4">
  130.                                     {% if Plugin.enabled %}
  131.                                         <a href="{{ url('admin_store_plugin_disable', { id : Plugin.id }) }}" {{ csrf_token_for_anchor() }}
  132.                                            class="btn btn-ec-actionIcon"
  133.                                            data-method="post" data-confirm="false">
  134.                                             <i class="fa fa-pause fa-lg text-secondary" data-bs-toggle="tooltip"
  135.                                                data-bs-placement="top" title="{{ 'admin.store.plugin_table_official.925'|trans }}"></i>
  136.                                         </a>
  137.                                     {% else %}
  138.                                         <a href="{{ url('admin_store_plugin_enable', { id : Plugin.id }) }}" {{ csrf_token_for_anchor() }}
  139.                                            class="btn btn-ec-actionIcon"
  140.                                            data-method="post" data-confirm="false">
  141.                                             <i class="fa fa-play fa-lg text-secondary" data-bs-toggle="tooltip"
  142.                                                data-bs-placement="top" title="{{ 'admin.store.plugin_table_official.924'|trans }}"></i>
  143.                                         </a>
  144.                                     {% endif %}
  145.                                 </div>
  146.                                 <div class="col-4">
  147.                                     {% if configPages[Plugin.code] is defined %}
  148.                                         <a class="btn btn-ec-actionIcon" href="{{ configPages[Plugin.code] }}">
  149.                                             <i class="fa fa-cog fa-lg text-secondary" data-bs-toggle="tooltip"
  150.                                                data-bs-placement="top" title="{{ 'admin.store.plugin_table_official.906'|trans }}"></i>
  151.                                         </a>
  152.                                     {% endif %}
  153.                                 </div>
  154.                             </div>
  155.                         {% endif %}
  156.                     </td>
  157.                 </tr>
  158.             {% endfor %}
  159.             </tbody>
  160.         </table>
  161.     </div>
  162.     {% if officialPluginsDetail|length == 0 %}
  163.         <p class="ml-3">{{ 'admin.store.plugin.help'|trans }}</p>
  164.     {% endif %}
  165. {% else %}
  166.     <div class="card-body">
  167.         <div class="text-danger">
  168.             {{ 'admin.store.plugin_table_official.923'|trans }}
  169.         </div>
  170.     </div>
  171. {% endif %}
  172. <div class="modal fade" id="officialPluginDeleteModal" tabindex="-1" role="dialog"
  173.      aria-labelledby="officialPluginDeleteModal" aria-hidden="true"
  174.      data-bs-keyboard="false" data-bs-backdrop="static">
  175.     <div class="modal-dialog" role="document">
  176.         <div class="modal-content">
  177.             <div class="modal-header">
  178.                 <h5 class="modal-title fw-bold">
  179.                     {{ 'admin.store.plugin.popup.delete.confirm.title'|trans }}</h5>
  180.             </div>
  181.             <div class="modal-body text-start">
  182.                 <p class="text-start">{{ 'admin.store.plugin.popup.delete.confirm.message'|trans }}</p>
  183.                 <div class="progress" style="display: none">
  184.                     <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 100%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
  185.                 </div>
  186.                 <div id="deleteLogPane" style="display: none;">
  187.                     <div class="d-inline-block collapsed" data-bs-toggle="collapse" href="#deleteLog" aria-expanded="false" aria-controls="deleteLog">
  188.                         <a><i class="fa fw-bold me-1 fa-plus-square-o"></i><span class="fw-bold">ログを確認</span></a>
  189.                     </div>
  190.                     <pre class="collapsed collapse" id="deleteLog"></pre>
  191.                 </div>
  192.             </div>
  193.             <div class="modal-footer">
  194.                 <button class="btn btn-ec-sub" type="button" data-bs-dismiss="modal">{{ 'admin.common.cancel'|trans }}</button>
  195.                 <button id="officialPluginDeleteButton" class="btn btn-ec-delete" type="button">{{ 'admin.common.delete'|trans }}</button>
  196.                 <button class="btn btn-ec-sub" style="display: none" onclick="location.reload(true);">完了</button>
  197.             </div>
  198.         </div>
  199.     </div>
  200. </div>