app.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. {% extends '../layout/admin.html' %}
  2. {% block html_title %}{{ customTitle(t('App settings')) }}{% endblock %}
  3. {% block content_header %}
  4. <div class="header-wrap">
  5. <header id="page-header">
  6. <h1 id="admin-title" class="title">{{ t('App settings') }}</h1>
  7. </header>
  8. </div>
  9. {% endblock %}
  10. {% block content_main %}
  11. <div class="content-main">
  12. {% set smessage = req.flash('successMessage') %}
  13. {% if smessage.length %}
  14. <div class="alert alert-success">
  15. {{ smessage }}
  16. </div>
  17. {% endif %}
  18. {% set emessage = req.flash('errorMessage') %}
  19. {% if emessage.length %}
  20. <div class="alert alert-danger">
  21. {{ emessage }}
  22. </div>
  23. {% endif %}
  24. <div class="row">
  25. <div class="col-md-3">
  26. {% include './widget/menu.html' with {current: 'app'} %}
  27. </div>
  28. <div class="col-md-9">
  29. <form action="/_api/admin/settings/app" method="post" class="form-horizontal" id="appSettingForm" role="form">
  30. <fieldset>
  31. <legend>{{ t('App settings') }}</legend>
  32. <div class="form-group">
  33. <label for="settingForm[app:title]" class="col-xs-3 control-label">{{ t('app_setting.Site Name') }}</label>
  34. <div class="col-xs-6">
  35. <input class="form-control" type="text" name="settingForm[app:title]" value="{{ settingForm['app:title'] | default('') }}" placeholder="GROWI">
  36. <p class="help-block">{{ t("app_setting.sitename_change") }}</p>
  37. </div>
  38. </div>
  39. <div class="form-group">
  40. <label for="settingForm[app:siteUrl]" class="col-xs-3 control-label">{{ t('app_setting.Site URL') }}</label>
  41. <div class="col-xs-6">
  42. <input class="form-control" type="text" name="settingForm[app:siteUrl]" value="{{ settingForm['app:siteUrl'] | default('') }}" placeholder="e.g. https://my.growi.org">
  43. <p class="help-block">{{ t("app_setting.siteurl_help") }}</p>
  44. </div>
  45. </div>
  46. <div class="form-group">
  47. <label for="settingForm[app:confidential]" class="col-xs-3 control-label">{{ t('app_setting.Confidential name') }}</label>
  48. <div class="col-xs-6">
  49. <input class="form-control" type="text" name="settingForm[app:confidential]" value="{{ settingForm['app:confidential'] }}" placeholder="{{ t('app_setting. ex): internal use only') }}">
  50. <p class="help-block">{{ t("app_setting.header_content") }}</p>
  51. </div>
  52. </div>
  53. <div class="form-group">
  54. <label class="col-xs-3 control-label">{{ t('app_setting.Default Language for new users') }}</label>
  55. <div class="col-xs-6">
  56. <div class="radio radio-primary radio-inline">
  57. <input type="radio" id="radioLangEn" name="settingForm[app:globalLang]" value="{{ consts.language.LANG_EN_US }}" {% if appGlobalLang() == consts.language.LANG_EN_US %}checked="checked"{% endif %}>
  58. <label for="radioLangEn">{{ t('English') }}</label>
  59. </div>
  60. <div class="radio radio-primary radio-inline">
  61. <input type="radio" id="radioLangJa" name="settingForm[app:globalLang]" value="{{ consts.language.LANG_JA }}" {% if appGlobalLang() == consts.language.LANG_JA %}checked="checked"{% endif %}>
  62. <label for="radioLangJa">{{ t('Japanese') }}</label>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="form-group">
  67. <label class="col-xs-3 control-label">{{ t('app_setting.File Uploading') }}</label>
  68. <div class="col-xs-6">
  69. <div class="checkbox checkbox-info">
  70. <input type="checkbox" id="cbFileUpload" name="settingForm[app:fileUpload]" value="1"
  71. {% if settingForm['app:fileUpload'] %}
  72. checked
  73. {% endif %}
  74. {% if not isUploadable() %}
  75. disabled="disabled"
  76. {% else %}
  77. {% endif %}
  78. >
  79. <label for="cbFileUpload">
  80. {{ t("app_setting.enable_files_except_image") }}
  81. </label>
  82. </div>
  83. <p class="help-block">
  84. {{ t("app_setting.enable_files_except_image") }}<br>
  85. {{ t("app_setting.attach_enable") }}
  86. </p>
  87. </div>
  88. </div>
  89. <div class="form-group">
  90. <div class="col-xs-offset-3 col-xs-6">
  91. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  92. <button type="submit" class="btn btn-primary">{{ t('app_setting.Update') }}</button>
  93. </div>
  94. </div>
  95. </fieldset>
  96. </form>
  97. <form action="/_api/admin/settings/mail" method="post" class="form-horizontal" id="mailSettingForm" role="form">
  98. <fieldset>
  99. <legend>{{ t('app_setting.Mail settings') }}</legend>
  100. <p class="well">{{ t("app_setting.SMTP_used") }} {{ t("app_setting.SMTP_but_AWS") }}<br>{{ t("app_setting.neihter_of") }}</p>
  101. <div class="form-group">
  102. <label for="settingForm[mail.from]" class="col-xs-3 control-label">{{ t('app_setting.From e-mail address') }}</label>
  103. <div class="col-xs-6">
  104. <input class="form-control" type="text" name="settingForm[mail:from]" placeholder="例: mail@growi.org" value="{{ settingForm['mail:from'] }}">
  105. </div>
  106. </div>
  107. <div class="form-group">
  108. <label class="col-xs-3 control-label">{{ t('app_setting.SMTP settings') }}</label>
  109. <div class="col-xs-4">
  110. <label for="">{{ t('app_setting.Host') }}</label>
  111. <input class="form-control" type="text" name="settingForm[mail:smtpHost]" value="{{ settingForm['mail:smtpHost']|default('') }}">
  112. </div>
  113. <div class="col-xs-2">
  114. <label for="">{{ t('app_setting.Port') }}</label>
  115. <input class="form-control" type="text" name="settingForm[mail:smtpPort]" value="{{ settingForm['mail:smtpPort']|default('') }}">
  116. </div>
  117. </div>
  118. <div class="form-group">
  119. <div class="col-xs-3 col-xs-offset-3">
  120. <label for="">{{ t('app_setting.User') }}</label>
  121. <input class="form-control" type="text" name="settingForm[mail:smtpUser]" value="{{ settingForm['mail:smtpUser']|default('') }}">
  122. </div>
  123. <div class="col-xs-3">
  124. <label for="">{{ t('Password') }}</label>
  125. <input class="form-control" type="password" name="settingForm[mail:smtpPassword]" value="{{ settingForm['mail:smtpPassword']|default('') }}">
  126. </div>
  127. </div>
  128. <div class="form-group">
  129. <div class="col-xs-offset-3 col-xs-6">
  130. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  131. <button type="submit" class="btn btn-primary">{{ t('app_setting.Update') }}</button>
  132. </div>
  133. </div>
  134. </fieldset>
  135. </form>
  136. <form action="/_api/admin/settings/aws" method="post" class="form-horizontal" id="awsSettingForm" role="form">
  137. <fieldset>
  138. <legend>{{ t('app_setting.AWS settings') }}</legend>
  139. <p class="well">{{ t("app_setting.AWS_access") }}<br>
  140. {{ t("app_setting.No_SMTP_setting") }}<br>
  141. <br>
  142. <span class="text-danger"><i class="ti-unlink"></i> {{ t("app_setting.change_setting") }}</span>
  143. </p>
  144. <div class="form-group">
  145. <label for="settingForm[app.region]" class="col-xs-3 control-label">{{ t('app_setting.region') }}</label>
  146. <div class="col-xs-6">
  147. <input class="form-control" type="text" name="settingForm[aws:region]" placeholder="例: ap-northeast-1" value="{{ settingForm['aws:region'] }}">
  148. </div>
  149. </div>
  150. <div class="form-group">
  151. <label for="settingForm[aws:bucket]" class="col-xs-3 control-label">{{ t('app_setting.bucket name') }}</label>
  152. <div class="col-xs-6">
  153. <input class="form-control" type="text" name="settingForm[aws:bucket]" placeholder="例: crowi" value="{{ settingForm['aws:bucket'] }}">
  154. </div>
  155. </div>
  156. <div class="form-group">
  157. <label for="settingForm[aws:accessKeyId]" class="col-xs-3 control-label">Access Key ID</label>
  158. <div class="col-xs-6">
  159. <input class="form-control" type="text" name="settingForm[aws:accessKeyId]" value="{{ settingForm['aws:accessKeyId'] }}">
  160. </div>
  161. </div>
  162. <div class="form-group">
  163. <label for="settingForm[aws:secretAccessKey]" class="col-xs-3 control-label">Secret Access Key</label>
  164. <div class="col-xs-6">
  165. <input class="form-control" type="text" name="settingForm[aws:secretAccessKey]" value="{{ settingForm['aws:secretAccessKey'] }}">
  166. </div>
  167. </div>
  168. <div class="form-group">
  169. <div class="col-xs-offset-3 col-xs-6">
  170. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  171. <button type="submit" class="btn btn-primary">{{ t('app_setting.Update') }}</button>
  172. </div>
  173. </div>
  174. </fieldset>
  175. </form>
  176. <form action="/_api/admin/settings/plugin" method="post" class="form-horizontal" id="pluginSettingForm" role="form">
  177. <fieldset>
  178. <legend>{{ t('app_setting.Plugin settings') }}</legend>
  179. <p class="well">{{ t('app_setting.Enable plugin loading') }}</p>
  180. <div class="form-group">
  181. <label for="settingForm[plugin:isEnabledPlugins]" class="col-xs-3 control-label">{{ t('app_setting.Load plugins') }}</label>
  182. <div class="col-xs-6">
  183. <div class="btn-group btn-toggle" data-toggle="buttons">
  184. <label class="btn btn-default btn-rounded btn-outline {% if settingForm['plugin:isEnabledPlugins'] %}active{% endif %}" data-active-class="primary">
  185. <input name="settingForm[plugin:isEnabledPlugins]" value="true" type="radio"
  186. {% if true === settingForm['plugin:isEnabledPlugins'] %}checked{% endif %}> ON
  187. </label>
  188. <label class="btn btn-default btn-rounded btn-outline {% if !settingForm['plugin:isEnabledPlugins'] %}active{% endif %}" data-active-class="default">
  189. <input name="settingForm[plugin:isEnabledPlugins]" value="false" type="radio"
  190. {% if !settingForm['plugin:isEnabledPlugins'] %}checked{% endif %}> OFF
  191. </label>
  192. </div>
  193. </div>
  194. </div>
  195. <div class="form-group">
  196. <div class="col-xs-offset-3 col-xs-6">
  197. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  198. <button type="submit" class="btn btn-primary">{{ t('app_setting.Update') }}</button>
  199. </div>
  200. </div>
  201. </fieldset>
  202. </form>
  203. </div>
  204. </div>
  205. <script>
  206. $('#appSettingForm, #mailSettingForm, #awsSettingForm, #pluginSettingForm').each(function() {
  207. $(this).submit(function()
  208. {
  209. function showMessage(formId, msg, status) {
  210. $('#' + formId + ' .alert').remove();
  211. if (!status) {
  212. status = 'success';
  213. }
  214. var $message = $('<p class="alert"></p>');
  215. $message.addClass('alert-' + status);
  216. $message.html(msg.replace(/\n/g, '<br>'));
  217. $message.insertAfter('#' + formId + ' legend');
  218. if (status == 'success') {
  219. setTimeout(function()
  220. {
  221. $message.fadeOut({
  222. complete: function() {
  223. $message.remove();
  224. }
  225. });
  226. }, 5000);
  227. }
  228. }
  229. var $form = $(this);
  230. var $id = $form.attr('id');
  231. var $button = $('button', this);
  232. $button.attr('disabled', 'disabled');
  233. var jqxhr = $.post($form.attr('action'), $form.serialize(), function(data)
  234. {
  235. if (data.status) {
  236. showMessage($id, '更新しました');
  237. } else {
  238. showMessage($id, data.message, 'danger');
  239. }
  240. })
  241. .fail(function() {
  242. showMessage($id, 'エラーが発生しました', 'danger');
  243. })
  244. .always(function() {
  245. $button.prop('disabled', false);
  246. });
  247. return false;
  248. });
  249. });
  250. </script>
  251. </div>
  252. {% endblock content_main %}
  253. {% block content_footer %}
  254. {% endblock content_footer %}