app.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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"
  36. id="settingForm[app:title]"
  37. type="text"
  38. name="settingForm[app:title]"
  39. value="{{ settingForm['app:title'] | default('') }}"
  40. placeholder="GROWI">
  41. <p class="help-block">{{ t("app_setting.sitename_change") }}</p>
  42. </div>
  43. </div>
  44. <div class="form-group">
  45. <label for="settingForm[app:siteUrl]" class="col-xs-3 control-label">{{ t('app_setting.Site URL') }}</label>
  46. <div class="col-xs-6">
  47. <input class="form-control"
  48. id="settingForm[app:siteUrl]"
  49. type="text"
  50. name="settingForm[app:siteUrl]"
  51. value="{{ settingForm['app:siteUrl'] | default('') }}"
  52. placeholder="e.g. https://my.growi.org">
  53. <p class="help-block">{{ t("app_setting.siteurl_help") }}</p>
  54. </div>
  55. </div>
  56. <div class="form-group">
  57. <label for="settingForm[app:confidential]" class="col-xs-3 control-label">{{ t('app_setting.Confidential name') }}</label>
  58. <div class="col-xs-6">
  59. <input class="form-control"
  60. id="settingForm[app:confidential]"
  61. type="text"
  62. name="settingForm[app:confidential]"
  63. value="{{ settingForm['app:confidential'] }}"
  64. placeholder="{{ t('app_setting. ex): internal use only') }}">
  65. <p class="help-block">{{ t("app_setting.header_content") }}</p>
  66. </div>
  67. </div>
  68. <div class="form-group">
  69. <label class="col-xs-3 control-label">{{ t('app_setting.Default Language for new users') }}</label>
  70. <div class="col-xs-6">
  71. <div class="radio radio-primary radio-inline">
  72. <input type="radio"
  73. id="radioLangEn"
  74. name="settingForm[app:globalLang]"
  75. value="{{ consts.language.LANG_EN_US }}"
  76. {% if appGlobalLang() == consts.language.LANG_EN_US %}checked="checked"{% endif %}>
  77. <label for="radioLangEn">{{ t('English') }}</label>
  78. </div>
  79. <div class="radio radio-primary radio-inline">
  80. <input type="radio"
  81. id="radioLangJa"
  82. name="settingForm[app:globalLang]"
  83. value="{{ consts.language.LANG_JA }}"
  84. {% if appGlobalLang() == consts.language.LANG_JA %}checked="checked"{% endif %}>
  85. <label for="radioLangJa">{{ t('Japanese') }}</label>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="form-group">
  90. <label class="col-xs-3 control-label">{{ t('app_setting.File Uploading') }}</label>
  91. <div class="col-xs-6">
  92. <div class="checkbox checkbox-info">
  93. <input type="checkbox"
  94. id="cbFileUpload"
  95. name="settingForm[app:fileUpload]"
  96. value="1"
  97. {% if settingForm['app:fileUpload'] %}checked{% endif %}
  98. {% if not isUploadable() %}disabled="disabled"{% endif %}>
  99. <label for="cbFileUpload">
  100. {{ t("app_setting.enable_files_except_image") }}
  101. </label>
  102. </div>
  103. <p class="help-block">
  104. {{ t("app_setting.enable_files_except_image") }}<br>
  105. {{ t("app_setting.attach_enable") }}
  106. </p>
  107. </div>
  108. </div>
  109. <div class="form-group">
  110. <div class="col-xs-offset-3 col-xs-6">
  111. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  112. <button type="submit" class="btn btn-primary">{{ t('app_setting.Update') }}</button>
  113. </div>
  114. </div>
  115. </fieldset>
  116. </form>
  117. <form action="/_api/admin/settings/mail" method="post" class="form-horizontal" id="mailSettingForm" role="form">
  118. <fieldset>
  119. <legend>{{ t('app_setting.Mail settings') }}</legend>
  120. <p class="well">{{ t("app_setting.SMTP_used") }} {{ t("app_setting.SMTP_but_AWS") }}<br>{{ t("app_setting.neihter_of") }}</p>
  121. <div class="form-group">
  122. <label for="settingForm[mail.from]" class="col-xs-3 control-label">{{ t('app_setting.From e-mail address') }}</label>
  123. <div class="col-xs-6">
  124. <input class="form-control"
  125. id="settingForm[mail.from]"
  126. type="text"
  127. name="settingForm[mail:from]"
  128. placeholder="例: mail@growi.org"
  129. value="{{ settingForm['mail:from'] }}">
  130. </div>
  131. </div>
  132. <div class="form-group">
  133. <label class="col-xs-3 control-label">{{ t('app_setting.SMTP settings') }}</label>
  134. <div class="col-xs-4">
  135. <label>{{ t('app_setting.Host') }}</label>
  136. <input class="form-control"
  137. type="text"
  138. name="settingForm[mail:smtpHost]"
  139. value="{{ settingForm['mail:smtpHost']|default('') }}">
  140. </div>
  141. <div class="col-xs-2">
  142. <label>{{ t('app_setting.Port') }}</label>
  143. <input class="form-control"
  144. type="text"
  145. name="settingForm[mail:smtpPort]"
  146. value="{{ settingForm['mail:smtpPort']|default('') }}">
  147. </div>
  148. </div>
  149. <div class="form-group">
  150. <div class="col-xs-3 col-xs-offset-3">
  151. <label>{{ t('app_setting.User') }}</label>
  152. <input class="form-control"
  153. type="text"
  154. name="settingForm[mail:smtpUser]"
  155. value="{{ settingForm['mail:smtpUser']|default('') }}">
  156. </div>
  157. <div class="col-xs-3">
  158. <label>{{ t('Password') }}</label>
  159. <input class="form-control"
  160. type="password"
  161. name="settingForm[mail:smtpPassword]"
  162. value="{{ settingForm['mail:smtpPassword']|default('') }}">
  163. </div>
  164. </div>
  165. <div class="form-group">
  166. <div class="col-xs-offset-3 col-xs-6">
  167. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  168. <button type="submit" class="btn btn-primary">{{ t('app_setting.Update') }}</button>
  169. </div>
  170. </div>
  171. </fieldset>
  172. </form>
  173. <form action="/_api/admin/settings/aws" method="post" class="form-horizontal" id="awsSettingForm" role="form">
  174. <fieldset>
  175. <legend>{{ t('app_setting.AWS settings') }}</legend>
  176. <p class="well">{{ t("app_setting.AWS_access") }}<br>
  177. {{ t("app_setting.No_SMTP_setting") }}<br>
  178. <br>
  179. <span class="text-danger"><i class="ti-unlink"></i> {{ t("app_setting.change_setting") }}</span>
  180. </p>
  181. <div class="form-group">
  182. <label for="settingForm[app:region]" class="col-xs-3 control-label">{{ t('app_setting.region') }}</label>
  183. <div class="col-xs-6">
  184. <input class="form-control"
  185. id="settingForm[app:region]"
  186. type="text"
  187. name="settingForm[aws:region]"
  188. placeholder="例: ap-northeast-1"
  189. value="{{ settingForm['aws:region'] }}">
  190. </div>
  191. </div>
  192. <div class="form-group">
  193. <label for="settingForm[aws:bucket]" class="col-xs-3 control-label">{{ t('app_setting.bucket name') }}</label>
  194. <div class="col-xs-6">
  195. <input class="form-control"
  196. id="settingForm[aws:bucket]"
  197. type="text"
  198. name="settingForm[aws:bucket]"
  199. placeholder="例: crowi"
  200. value="{{ settingForm['aws:bucket'] }}">
  201. </div>
  202. </div>
  203. <div class="form-group">
  204. <label for="settingForm[aws:accessKeyId]" class="col-xs-3 control-label">Access Key ID</label>
  205. <div class="col-xs-6">
  206. <input class="form-control"
  207. id="settingForm[aws:accessKeyId]"
  208. type="text"
  209. name="settingForm[aws:accessKeyId]"
  210. value="{{ settingForm['aws:accessKeyId'] }}">
  211. </div>
  212. </div>
  213. <div class="form-group">
  214. <label for="settingForm[aws:secretAccessKey]" class="col-xs-3 control-label">Secret Access Key</label>
  215. <div class="col-xs-6">
  216. <input class="form-control"
  217. id="settingForm[aws:secretAccessKey]"
  218. type="text"
  219. name="settingForm[aws:secretAccessKey]"
  220. value="{{ settingForm['aws:secretAccessKey'] }}">
  221. </div>
  222. </div>
  223. <div class="form-group">
  224. <div class="col-xs-offset-3 col-xs-6">
  225. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  226. <button type="submit" class="btn btn-primary">{{ t('app_setting.Update') }}</button>
  227. </div>
  228. </div>
  229. </fieldset>
  230. </form>
  231. <form action="/_api/admin/settings/plugin" method="post" class="form-horizontal" id="pluginSettingForm" role="form">
  232. <fieldset>
  233. <legend>{{ t('app_setting.Plugin settings') }}</legend>
  234. <p class="well">{{ t('app_setting.Enable plugin loading') }}</p>
  235. <div class="form-group">
  236. <label class="col-xs-3 control-label">{{ t('app_setting.Load plugins') }}</label>
  237. <div class="col-xs-6">
  238. <div class="btn-group btn-toggle" data-toggle="buttons">
  239. <label class="btn btn-default btn-rounded btn-outline {% if settingForm['plugin:isEnabledPlugins'] %}active{% endif %}" data-active-class="primary">
  240. <input name="settingForm[plugin:isEnabledPlugins]"
  241. value="true"
  242. type="radio"
  243. {% if true === settingForm['plugin:isEnabledPlugins'] %}checked{% endif %}>
  244. ON
  245. </label>
  246. <label class="btn btn-default btn-rounded btn-outline {% if !settingForm['plugin:isEnabledPlugins'] %}active{% endif %}" data-active-class="default">
  247. <input name="settingForm[plugin:isEnabledPlugins]"
  248. value="false"
  249. type="radio"
  250. {% if !settingForm['plugin:isEnabledPlugins'] %}checked{% endif %}>
  251. OFF
  252. </label>
  253. </div>
  254. </div>
  255. </div>
  256. <div class="form-group">
  257. <div class="col-xs-offset-3 col-xs-6">
  258. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  259. <button type="submit" class="btn btn-primary">{{ t('app_setting.Update') }}</button>
  260. </div>
  261. </div>
  262. </fieldset>
  263. </form>
  264. </div>
  265. </div>
  266. <script>
  267. $('#appSettingForm, #mailSettingForm, #awsSettingForm, #pluginSettingForm').each(function() {
  268. $(this).submit(function()
  269. {
  270. function showMessage(formId, msg, status) {
  271. $('#' + formId + ' .alert').remove();
  272. if (!status) {
  273. status = 'success';
  274. }
  275. var $message = $('<p class="alert"></p>');
  276. $message.addClass('alert-' + status);
  277. $message.html(msg.replace(/\n/g, '<br>'));
  278. $message.insertAfter('#' + formId + ' legend');
  279. if (status == 'success') {
  280. setTimeout(function()
  281. {
  282. $message.fadeOut({
  283. complete: function() {
  284. $message.remove();
  285. }
  286. });
  287. }, 5000);
  288. }
  289. }
  290. var $form = $(this);
  291. var $id = $form.attr('id');
  292. var $button = $('button', this);
  293. $button.attr('disabled', 'disabled');
  294. var jqxhr = $.post($form.attr('action'), $form.serialize(), function(data)
  295. {
  296. if (data.status) {
  297. showMessage($id, '更新しました');
  298. } else {
  299. showMessage($id, data.message, 'danger');
  300. }
  301. })
  302. .fail(function() {
  303. showMessage($id, 'エラーが発生しました', 'danger');
  304. })
  305. .always(function() {
  306. $button.prop('disabled', false);
  307. });
  308. return false;
  309. });
  310. });
  311. </script>
  312. </div>
  313. {% endblock content_main %}
  314. {% block content_footer %}
  315. {% endblock content_footer %}