2019-11-02 00:06:25 +01:00
|
|
|
const render_admin_tab = require('../templates/admin_tab.hbs');
|
2019-07-09 21:24:00 +02:00
|
|
|
|
2019-11-02 00:06:25 +01:00
|
|
|
const admin_settings_label = {
|
2018-05-30 19:03:39 +02:00
|
|
|
// Organization settings
|
|
|
|
realm_allow_community_topic_editing: i18n.t("Users can edit the topic of any message"),
|
|
|
|
realm_allow_edit_history: i18n.t("Enable message edit history"),
|
|
|
|
realm_mandatory_topics: i18n.t("Require topics in stream messages"),
|
|
|
|
realm_inline_image_preview: i18n.t("Show previews of uploaded and linked images"),
|
|
|
|
realm_inline_url_embed_preview: i18n.t("Show previews of linked websites"),
|
2019-07-30 09:52:06 +02:00
|
|
|
realm_default_twenty_four_hour_time: i18n.t("Time format"),
|
2018-05-30 19:03:39 +02:00
|
|
|
realm_send_welcome_emails: i18n.t("Send emails introducing Zulip to new users"),
|
2019-01-14 14:04:08 +01:00
|
|
|
realm_message_content_allowed_in_email_notifications:
|
|
|
|
i18n.t("Allow message content in missed message emails"),
|
2019-04-06 06:34:49 +02:00
|
|
|
realm_digest_emails_enabled: i18n.t("Send weekly digest emails to inactive users"),
|
2018-05-30 19:03:39 +02:00
|
|
|
|
|
|
|
// Organization permissions
|
|
|
|
realm_name_changes_disabled: i18n.t("Prevent users from changing their name"),
|
2018-12-18 19:34:45 +01:00
|
|
|
realm_email_changes_disabled: i18n.t("Prevent users from changing their email address"),
|
2019-04-23 04:51:04 +02:00
|
|
|
realm_avatar_changes_disabled: i18n.t("Prevent users from changing their avatar"),
|
2018-05-30 19:03:39 +02:00
|
|
|
};
|
|
|
|
|
2018-12-06 19:56:28 +01:00
|
|
|
exports.build_page = function () {
|
2019-11-02 00:06:25 +01:00
|
|
|
const options = {
|
2017-12-14 05:51:45 +01:00
|
|
|
custom_profile_field_types: page_params.custom_profile_field_types,
|
2016-07-28 06:17:31 +02:00
|
|
|
realm_name: page_params.realm_name,
|
2018-04-23 14:51:30 +02:00
|
|
|
realm_available_video_chat_providers: page_params.realm_available_video_chat_providers,
|
2017-03-18 20:19:44 +01:00
|
|
|
realm_description: page_params.realm_description,
|
2017-03-13 14:42:03 +01:00
|
|
|
realm_inline_image_preview: page_params.realm_inline_image_preview,
|
|
|
|
server_inline_image_preview: page_params.server_inline_image_preview,
|
|
|
|
realm_inline_url_embed_preview: page_params.realm_inline_url_embed_preview,
|
|
|
|
server_inline_url_embed_preview: page_params.server_inline_url_embed_preview,
|
2019-07-30 09:52:06 +02:00
|
|
|
realm_default_twenty_four_hour_time_values: settings_display.twenty_four_hour_time_values,
|
2016-11-02 21:51:56 +01:00
|
|
|
realm_authentication_methods: page_params.realm_authentication_methods,
|
2019-05-06 16:34:31 +02:00
|
|
|
realm_create_stream_policy: page_params.realm_create_stream_policy,
|
2019-05-14 23:37:24 +02:00
|
|
|
realm_invite_to_stream_policy: page_params.realm_invite_to_stream_policy,
|
2019-11-02 17:58:55 +01:00
|
|
|
realm_user_group_edit_policy: page_params.realm_user_group_edit_policy,
|
|
|
|
USER_GROUP_EDIT_POLICY_MEMBERS: 1,
|
2017-03-13 18:33:49 +01:00
|
|
|
realm_name_changes_disabled: page_params.realm_name_changes_disabled,
|
2017-03-04 06:39:45 +01:00
|
|
|
realm_email_changes_disabled: page_params.realm_email_changes_disabled,
|
2019-04-23 04:51:04 +02:00
|
|
|
realm_avatar_changes_disabled: page_params.realm_avatar_changes_disabled,
|
2016-12-20 15:41:30 +01:00
|
|
|
realm_add_emoji_by_admins_only: page_params.realm_add_emoji_by_admins_only,
|
2018-06-08 15:30:44 +02:00
|
|
|
can_add_emojis: settings_emoji.can_add_emoji(),
|
2018-04-21 19:30:32 +02:00
|
|
|
realm_allow_community_topic_editing: page_params.realm_allow_community_topic_editing,
|
2016-12-02 15:16:33 +01:00
|
|
|
realm_message_content_edit_limit_minutes:
|
2018-04-28 15:35:14 +02:00
|
|
|
settings_org.get_realm_time_limits_in_minutes('realm_message_content_edit_limit_seconds'),
|
2017-11-26 09:12:10 +01:00
|
|
|
realm_message_content_delete_limit_minutes:
|
2018-04-28 15:35:14 +02:00
|
|
|
settings_org.get_realm_time_limits_in_minutes('realm_message_content_delete_limit_seconds'),
|
2016-11-30 10:42:58 +01:00
|
|
|
realm_message_retention_days: page_params.realm_message_retention_days,
|
2017-07-16 11:00:44 +02:00
|
|
|
realm_allow_edit_history: page_params.realm_allow_edit_history,
|
2016-08-04 17:32:41 +02:00
|
|
|
language_list: page_params.language_list,
|
2016-11-29 08:57:35 +01:00
|
|
|
realm_default_language: page_params.realm_default_language,
|
2017-01-12 00:17:43 +01:00
|
|
|
realm_waiting_period_threshold: page_params.realm_waiting_period_threshold,
|
2017-06-10 07:03:53 +02:00
|
|
|
realm_notifications_stream_id: page_params.realm_notifications_stream_id,
|
2017-10-20 16:55:04 +02:00
|
|
|
realm_signup_notifications_stream_id: page_params.realm_signup_notifications_stream_id,
|
2017-02-21 21:34:13 +01:00
|
|
|
is_admin: page_params.is_admin,
|
2018-06-08 14:43:27 +02:00
|
|
|
is_guest: page_params.is_guest,
|
2017-02-21 03:41:20 +01:00
|
|
|
realm_icon_source: page_params.realm_icon_source,
|
2017-02-26 20:35:23 +01:00
|
|
|
realm_icon_url: page_params.realm_icon_url,
|
2018-08-16 01:26:55 +02:00
|
|
|
realm_logo_source: page_params.realm_logo_source,
|
|
|
|
realm_logo_url: page_params.realm_logo_url,
|
2019-01-27 08:25:10 +01:00
|
|
|
realm_night_logo_source: page_params.realm_night_logo_source,
|
|
|
|
realm_night_logo_url: page_params.realm_night_logo_url,
|
2017-07-04 20:04:27 +02:00
|
|
|
realm_mandatory_topics: page_params.realm_mandatory_topics,
|
2018-02-18 09:34:54 +01:00
|
|
|
realm_send_welcome_emails: page_params.realm_send_welcome_emails,
|
2019-01-14 14:04:08 +01:00
|
|
|
realm_message_content_allowed_in_email_notifications:
|
|
|
|
page_params.realm_message_content_allowed_in_email_notifications,
|
2019-04-06 06:34:49 +02:00
|
|
|
settings_send_digest_emails: page_params.settings_send_digest_emails,
|
|
|
|
realm_digest_emails_enabled: page_params.realm_digest_emails_enabled,
|
2019-03-31 12:13:42 +02:00
|
|
|
realm_digest_weekday: page_params.realm_digest_weekday,
|
2019-06-20 14:58:28 +02:00
|
|
|
show_email: settings_org.show_email(),
|
2018-08-03 22:52:21 +02:00
|
|
|
development: page_params.development_environment,
|
2019-06-12 14:22:37 +02:00
|
|
|
plan_includes_wide_organization_logo: page_params.plan_includes_wide_organization_logo,
|
|
|
|
upgrade_text_for_wide_organization_logo:
|
|
|
|
page_params.upgrade_text_for_wide_organization_logo,
|
2019-05-27 10:59:55 +02:00
|
|
|
realm_default_external_accounts: page_params.realm_default_external_accounts,
|
2015-08-20 02:38:32 +02:00
|
|
|
};
|
2016-12-03 01:12:52 +01:00
|
|
|
|
2018-05-30 19:03:39 +02:00
|
|
|
options.admin_settings_label = admin_settings_label;
|
2018-04-02 11:18:40 +02:00
|
|
|
options.msg_edit_limit_dropdown_values = settings_org.msg_edit_limit_dropdown_values;
|
2017-11-26 09:12:10 +01:00
|
|
|
options.msg_delete_limit_dropdown_values = settings_org.msg_delete_limit_dropdown_values;
|
2018-01-29 16:10:54 +01:00
|
|
|
options.bot_creation_policy_values = settings_bots.bot_creation_policy_values;
|
2018-08-03 22:52:21 +02:00
|
|
|
options.email_address_visibility_values = settings_org.email_address_visibility_values;
|
2019-02-21 02:55:48 +01:00
|
|
|
|
|
|
|
if (options.realm_logo_source !== 'D' && options.realm_night_logo_source === 'D') {
|
|
|
|
// If no night mode logo is specified but a day mode one is,
|
|
|
|
// use the day mode one. See also similar code in realm_logo.js.
|
|
|
|
options.realm_night_logo_url = options.realm_logo_url;
|
|
|
|
}
|
|
|
|
|
2019-11-02 00:06:25 +01:00
|
|
|
const rendered_admin_tab = render_admin_tab(options);
|
2018-03-22 22:10:08 +01:00
|
|
|
$("#settings_content .organization-box").html(rendered_admin_tab);
|
2017-03-23 20:37:08 +01:00
|
|
|
$("#settings_content .alert").removeClass("show");
|
2014-01-27 21:48:23 +01:00
|
|
|
|
2018-01-29 16:10:54 +01:00
|
|
|
settings_bots.update_bot_settings_tip();
|
|
|
|
$("#id_realm_bot_creation_policy").val(page_params.realm_bot_creation_policy);
|
2018-08-03 22:52:21 +02:00
|
|
|
$("#id_realm_email_address_visibility").val(page_params.realm_email_address_visibility);
|
2018-01-29 16:10:54 +01:00
|
|
|
|
2018-12-06 18:09:09 +01:00
|
|
|
$("#id_realm_default_language").val(page_params.realm_default_language);
|
2019-03-31 12:13:42 +02:00
|
|
|
$("#id_realm_digest_weekday").val(options.realm_digest_weekday);
|
2019-07-30 09:52:06 +02:00
|
|
|
|
|
|
|
// default_twenty_four_hour time is a boolean in the API but a
|
|
|
|
// dropdown, so we need to convert the value to a string for
|
|
|
|
// storage in the browser's DOM.
|
|
|
|
$("#id_realm_default_twenty_four_hour_time").val(JSON.stringify(
|
|
|
|
page_params.realm_default_twenty_four_hour_time));
|
2018-12-06 19:56:28 +01:00
|
|
|
};
|
|
|
|
|
2016-12-03 01:12:52 +01:00
|
|
|
|
2018-12-06 20:18:56 +01:00
|
|
|
exports.launch = function (section) {
|
|
|
|
settings.build_page();
|
|
|
|
exports.build_page();
|
2018-12-08 19:28:26 +01:00
|
|
|
settings_sections.reset_sections();
|
2016-06-10 09:03:36 +02:00
|
|
|
|
2017-05-27 15:40:54 +02:00
|
|
|
overlays.open_settings();
|
2018-12-02 21:37:16 +01:00
|
|
|
settings_panel_menu.org_settings.activate_section(section);
|
2018-12-06 20:18:56 +01:00
|
|
|
settings_toggle.highlight_toggle('organization');
|
2016-12-03 01:12:52 +01:00
|
|
|
};
|
|
|
|
|
2019-10-25 09:45:13 +02:00
|
|
|
window.admin = exports;
|