config.html.twig 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. {% extends 'partials/base.html.twig' %}
  2. {% set config_slug = uri.basename|e %}
  3. {% set isInfo = (config_slug == 'info') %}
  4. {% set tab_title_string = "PLUGIN_ADMIN." ~ config_slug|upper %}
  5. {% set tab_title = (tab_title_string|tu == tab_title_string ? config_slug|capitalize : tab_title_string|tu) %}
  6. {% set title = "PLUGIN_ADMIN.CONFIGURATION"|tu ~ ": " ~ tab_title %}
  7. {% set config_ignores = ['scheduler', 'backups'] %}
  8. {% if not isInfo %}
  9. {% set data = admin.data('config/' ~ config_slug) %}
  10. {% endif %}
  11. {% block stylesheets %}
  12. {% do assets.addCss(theme_url ~ '/css/codemirror/codemirror.css') %}
  13. {{ parent() }}
  14. {% endblock %}
  15. {% block javascripts %}
  16. {{ parent() }}
  17. {% endblock %}
  18. {% block titlebar %}
  19. <div class="button-bar">
  20. <a class="button" href="{{ base_url }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|tu }}</a>
  21. {% if data.file.filename %}
  22. <button class="button" type="submit" name="task" value="save" form="blueprints"><i class="fa fa-check"></i> {{ "PLUGIN_ADMIN.SAVE"|tu }}</button>
  23. {% endif %}
  24. </div>
  25. <h1><i class="fa fa-fw fa-wrench"></i> {{ "PLUGIN_ADMIN.CONFIGURATION"|tu }} - {{ tab_title }}</h1>
  26. {% endblock %}
  27. {% block content_top %}
  28. {% if data.file.filename %}
  29. <div class="alert notice">{{ "PLUGIN_ADMIN.SAVE_LOCATION"|tu }}: <b>{{ data.file.filename|replace({(base_path):''}) }}</b></div>
  30. {% endif %}
  31. <div class="form-tabs">
  32. <div class="tabs-nav">
  33. {% if authorize(['admin.configuration_system', 'admin.super']) %}
  34. <a {% if config_slug == 'system' %}class="active"{% endif %} href="{{ base_url_relative }}/config/system">
  35. <span>{{ "PLUGIN_ADMIN.SYSTEM"|tu }}</span>
  36. </a>
  37. {% endif %}
  38. {% if authorize(['admin.configuration_site', 'admin.super']) %}
  39. <a {% if config_slug == 'site' %}class="active"{% endif %} href="{{ base_url_relative }}/config/site">
  40. <span>{{ "PLUGIN_ADMIN.SITE"|tu }}</span>
  41. </a>
  42. {% endif %}
  43. {% for configuration in admin.configurations if (configuration not in config_ignores) %}
  44. {% if authorize(['admin.configuration_' ~ configuration, 'admin.super']) %}
  45. {% set current_blueprints = admin.data('config/' ~ configuration).blueprints.toArray() %}
  46. {% if configuration != 'system' and configuration != 'site' and not current_blueprints.form.hidden and (current_blueprints.form.fields is not empty or current_blueprints.form.field is not empty) %}
  47. <a {% if config_slug == configuration %}class="active"{% endif %} href="{{ base_url_relative }}/config/{{configuration}}">
  48. {% set configuration_string = "PLUGIN_ADMIN." ~ configuration|upper %}
  49. <span>{{ (configuration_string|tu == configuration_string ? configuration|capitalize : configuration_string|tu) }}</span>
  50. </a>
  51. {% endif %}
  52. {% endif %}
  53. {% endfor %}
  54. {% if authorize(['admin.configuration_info', 'admin.super']) %}
  55. <a {% if config_slug == 'info' %}class="active"{% endif %} href="{{ base_url_relative }}/config/info">
  56. <span>{{ "PLUGIN_ADMIN.INFO"|tu }}</span>
  57. </a>
  58. {% endif %}
  59. </div>
  60. </div>
  61. {% endblock %}
  62. {% block content %}
  63. {% if authorize(['admin.configuration_' ~ config_slug, 'admin.super']) %}
  64. {% if isInfo %}
  65. <div id="phpinfo">
  66. {{ admin.phpinfo|raw }}
  67. </div>
  68. {% else %}
  69. <div class="config-wrapper-{{ config_slug }}">
  70. {% include 'partials/blueprints.html.twig' with { blueprints: data.blueprints, data: data } %}
  71. </div>
  72. {% endif %}
  73. {% endif %}
  74. {% include 'partials/modal-changes-detected.html.twig' %}
  75. {% endblock %}