Просмотр исходного кода

Merge pull request #5761 from unacms/feat/profile-type-menu-info

Add-profile menu and create-profile block describe themselves (info, description, icon)
Anton 2 недель назад
Родитель
Сommit
94b14dd867

+ 5 - 2
install/sql/system.sql

@@ -6373,8 +6373,6 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `
 
 ('sys_account_settings_delete', 1, 'system', '', '_sys_page_block_title_account_settings_delete', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:28:"account_settings_del_account";s:6:"params";a:0:{}s:5:"class";s:19:"TemplServiceAccount";}', 0, 1, 1, 1),
 
-('sys_account_profile_switcher', 1, 'system', '', '_sys_page_block_title_account_profile_create', 11, 0, 0, 2147483647, 'menu', 'sys_add_profile', 0, 1, 1, 1),
-
 ('sys_account_profile_switcher', 1, 'system', '', '_sys_page_block_title_account_profile_switcher', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:28:"account_profile_switcher_all";s:6:"params";a:0:{}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 2),
 
 ('sys_profile_settings_cfilter', 1, 'system', '', '_sys_page_block_title_profile_settings_cfilter', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:24:"profile_settings_cfilter";s:6:"params";a:0:{}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 2),
@@ -6406,6 +6404,11 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `
 
 ('sys_ntfs_context_invitations', 1, 'system', '', '_sys_page_block_title_ntfs_context_invitations', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:18:"browse_invitations";s:6:"params";a:2:{i:0;s:19:"{logged_profile_id}";i:1;a:1:{s:13:"empty_message";b:1;}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1);
 
+-- The "create profile" block describes itself: title, description and icon are shown by
+-- API clients (NEO) in the block header and can be changed in Studio.
+INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `description`, `icon`, `designbox_id`, `tabs`, `async`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
+('sys_account_profile_switcher', 1, 'system', '', '_sys_page_block_title_account_profile_create', '_sys_page_block_desc_account_profile_create', 'user-plus', 11, 0, 0, 2147483647, 'menu', 'sys_add_profile', 0, 1, 1, 1);
+
 -- studio dashboard blocks
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `icon`, `designbox_id`, `class`, `tabs`, `async`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
 ('sys_std_dashboard', 1, 'system', '', '_sys_page_block_title_std_dash_version', 'package', 11, 'bx-dbd-block-medium', 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:17:"get_block_version";s:6:"params";a:0:{}s:5:"class";s:20:"TemplStudioDashboard";}', 0, 0, 1, 1),

+ 2 - 1
modules/boonex/english/data/langs/system/en.xml

@@ -3857,7 +3857,7 @@
     <string name="_sys_page_content_ph_text_units_list"><![CDATA[With text units list placeholder]]></string>
     <string name="_sys_page_content_ph_text_units_gallery"><![CDATA[With text units gallery placeholder]]></string>
     <string name="_sys_page_block_title_about"><![CDATA[About]]></string>
-    <string name="_sys_page_block_title_account_profile_create"><![CDATA[Create a profile...]]></string>
+    <string name="_sys_page_block_title_account_profile_create"><![CDATA[Create your profile]]></string>
     <string name="_sys_page_block_title_account_profile_switcher"><![CDATA[Use site as ...]]></string>
     <string name="_sys_page_block_title_account_settings_delete"><![CDATA[Delete Account]]></string>
     <string name="_sys_page_block_title_account_settings_email"><![CDATA[Email Settings]]></string>
@@ -3907,6 +3907,7 @@
     <string name="_sys_page_block_title_sys_search_ai"><![CDATA[AI Search]]></string>
     <string name="_sys_page_block_title_search_ai"><![CDATA[Search]]></string>
     <string name="_sys_page_block_title_membership_stats"><![CDATA[Membership Limits]]></string>
+    <string name="_sys_page_block_desc_account_profile_create"><![CDATA[Your account doesn’t have a profile yet. Choose a profile type to get started.]]></string>
     <string name="_sys_page_block_system_title_login"><![CDATA[Log in with Sign up link]]></string>
     <string name="_sys_page_block_system_title_login_step2"><![CDATA[Log in - step2]]></string>
     <string name="_sys_page_block_system_title_login_step3"><![CDATA[Log in - step3]]></string>

+ 1 - 0
modules/boonex/organizations/install/langs/en.xml

@@ -305,6 +305,7 @@
     <string name="_bx_orgs_menu_set_title_entries_my"><![CDATA[Profile Organizations Menu]]></string>
     <string name="_bx_orgs_menu_set_title_manage_tools"><![CDATA[Manage Tools Submenu]]></string>
     <string name="_bx_orgs_menu_title_manage_tools"><![CDATA[Manage Tools Submenu]]></string>
+    <string name="_bx_orgs_menu_item_info_create_profile"><![CDATA[For a company, team or community you run.]]></string>
     <string name="_bx_orgs_menu_item_title_system_delete_with_content"><![CDATA[Delete with Data]]></string>
     <string name="_bx_orgs_menu_item_title_delete_with_content"><![CDATA[Delete with Data]]></string>
     <string name="_bx_orgs_menu_item_title_system_clear_reports"><![CDATA[Clear reports]]></string>

+ 2 - 2
modules/boonex/organizations/install/sql/enable.sql

@@ -288,8 +288,8 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit
 
 -- MENU: add to create profile menu
 SET @iAddMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_add_profile_links' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
-INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
-('sys_add_profile_links', 'bx_organizations', 'create-organization-profile', '_bx_orgs_menu_item_title_system_create_profile', '_bx_orgs_menu_item_title_create_profile', 'page.php?i=create-organization-profile', '', '', 'building', '', 2147483647, 1, 1, IFNULL(@iAddMenuOrder, 0) + 1);
+INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `info`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
+('sys_add_profile_links', 'bx_organizations', 'create-organization-profile', '_bx_orgs_menu_item_title_system_create_profile', '_bx_orgs_menu_item_title_create_profile', '_bx_orgs_menu_item_info_create_profile', 'page.php?i=create-organization-profile', '', '', 'building', '', 2147483647, 1, 1, IFNULL(@iAddMenuOrder, 0) + 1);
 
 -- MENU: view actions
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 

+ 1 - 0
modules/boonex/persons/install/langs/en.xml

@@ -227,6 +227,7 @@
     <string name="_bx_persons_menu_title_view_profile_submenu"><![CDATA[View Person Submenu]]></string>
     <string name="_bx_persons_menu_set_title_manage_tools"><![CDATA[Manage Tools Submenu]]></string>
     <string name="_bx_persons_menu_title_manage_tools"><![CDATA[Manage Tools Submenu]]></string>
+    <string name="_bx_persons_menu_item_info_create_profile"><![CDATA[For yourself, with your own feed and connections.]]></string>
     <string name="_bx_persons_menu_item_title_system_delete_with_content"><![CDATA[Delete with Data]]></string>
     <string name="_bx_persons_menu_item_title_delete_with_content"><![CDATA[Delete with Data]]></string>
     <string name="_bx_persons_menu_item_title_system_clear_reports"><![CDATA[Clear reports]]></string>

+ 2 - 2
modules/boonex/persons/install/sql/enable.sql

@@ -223,8 +223,8 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit
 -- ('sys_profiles_create', 'bx_persons', 'create-person-profile', '_bx_persons_menu_item_title_system_profile_type', '_bx_persons_menu_item_title_profile_type', 'page.php?i=create-persons-profile', '', '', 'user', '', 2147483647, 1, 1, IFNULL(@iCreateProfileMenuOrder, 0) + 1);
 
 SET @iAddMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_add_profile_links' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
-INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
-('sys_add_profile_links', 'bx_persons', 'create-persons-profile', '_bx_persons_menu_item_title_system_create_profile', '_bx_persons_menu_item_title_create_profile', 'page.php?i=create-persons-profile', '', '', 'user', '', 2147483647, 1, 1, IFNULL(@iAddMenuOrder, 0) + 1);
+INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `info`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
+('sys_add_profile_links', 'bx_persons', 'create-persons-profile', '_bx_persons_menu_item_title_system_create_profile', '_bx_persons_menu_item_title_create_profile', '_bx_persons_menu_item_info_create_profile', 'page.php?i=create-persons-profile', '', '', 'user', '', 2147483647, 1, 1, IFNULL(@iAddMenuOrder, 0) + 1);
 
 -- MENU: view actions
 

+ 1 - 0
modules/boonex/russian/data/langs/bx_organizations/ru.xml

@@ -299,6 +299,7 @@
     <string name="_bx_orgs_menu_set_title_entries_my"><![CDATA[Организации профиля - Меню]]></string>
     <string name="_bx_orgs_menu_set_title_manage_tools"><![CDATA[Инструменты управления - Подменю]]></string>
     <string name="_bx_orgs_menu_title_manage_tools"><![CDATA[Инструменты управления - Подменю]]></string>
+    <string name="_bx_orgs_menu_item_info_create_profile"><![CDATA[Для компании, команды или сообщества, которыми вы управляете.]]></string>
     <string name="_bx_orgs_menu_item_title_system_delete_with_content"><![CDATA[Удалить с данными]]></string>
     <string name="_bx_orgs_menu_item_title_delete_with_content"><![CDATA[Удалить с данными]]></string>
     <string name="_bx_orgs_menu_item_title_system_clear_reports"><![CDATA[Очистить жалобы]]></string>

+ 1 - 0
modules/boonex/russian/data/langs/bx_persons/ru.xml

@@ -213,6 +213,7 @@
     <string name="_bx_persons_menu_title_view_profile_submenu"><![CDATA[Подменю просмотра персоны]]></string>
     <string name="_bx_persons_menu_set_title_manage_tools"><![CDATA[Инструменты управления - Подменю]]></string>
     <string name="_bx_persons_menu_title_manage_tools"><![CDATA[Инструменты управления - Подменю]]></string>
+    <string name="_bx_persons_menu_item_info_create_profile"><![CDATA[Для себя: собственная лента и связи.]]></string>
     <string name="_bx_persons_menu_item_title_system_delete_with_content"><![CDATA[Удалить с данными]]></string>
     <string name="_bx_persons_menu_item_title_delete_with_content"><![CDATA[Удалить с данными]]></string>
     <string name="_bx_persons_menu_item_title_system_clear_reports"><![CDATA[Очистить жалобы]]></string>

+ 2 - 1
modules/boonex/russian/data/langs/system/ru.xml

@@ -3814,7 +3814,7 @@
     <string name="_sys_page_content_ph_text_units_list"><![CDATA[С заполнителем в виде списка текстовых блоков]]></string>
     <string name="_sys_page_content_ph_text_units_gallery"><![CDATA[С заполнителем в виде галереи текстовых блоков]]></string>
 	<string name="_sys_page_block_title_about"><![CDATA[Об...]]></string>
-	<string name="_sys_page_block_title_account_profile_create"><![CDATA[Создать профиль...]]></string>
+	<string name="_sys_page_block_title_account_profile_create"><![CDATA[Создайте профиль]]></string>
 	<string name="_sys_page_block_title_account_profile_switcher"><![CDATA[Использовать сайт как ...]]></string>
 	<string name="_sys_page_block_title_account_settings_delete"><![CDATA[Удалить аккаунт]]></string>
 	<string name="_sys_page_block_title_account_settings_email"><![CDATA[Настройки email-а]]></string>
@@ -3864,6 +3864,7 @@
         <string name="_sys_page_block_title_sys_search_ai"><![CDATA[AI поиск]]></string>
         <string name="_sys_page_block_title_search_ai"><![CDATA[Поиск]]></string>
         <string name="_sys_page_block_title_membership_stats"><![CDATA[Лимиты членства]]></string>
+	<string name="_sys_page_block_desc_account_profile_create"><![CDATA[У вашей учётной записи ещё нет профиля. Выберите тип профиля, чтобы начать.]]></string>
 	<string name="_sys_page_block_system_title_login"><![CDATA[Вход с линкой регистрации]]></string>
 	<string name="_sys_page_block_system_title_login_step2"><![CDATA[Вход - шаг 2]]></string>
 	<string name="_sys_page_block_system_title_login_step3"><![CDATA[Вход - шаг 3]]></string>

+ 18 - 3
scripts/add_lang_key.php

@@ -16,6 +16,9 @@
  * A translation of "-" is read from stdin. A single trailing newline on
  * stdin is removed; newlines inside the text are kept.
  *
+ * When the key prefix doesn't name the module (bx_organizations uses _bx_orgs_),
+ * set ADD_LANG_KEY_MODULE=<module name>.
+ *
  * Run inside the php container:
  *   docker exec -i una-php-1 php /opt/una/scripts/add_lang_key.php en _sys_example "Hello"
  */
@@ -66,9 +69,21 @@ $sRoot = dirname(__DIR__) . '/';
 $aModules = loadModules($sRoot);
 $aLangModules = loadLanguageModules($sRoot);
 
-$aModule = findModuleByExistingKey($sRoot, $sKey, $aModules);
-if (!$aModule)
-    $aModule = inferModule($sKey, $aModules);
+// ADD_LANG_KEY_MODULE=<module name> picks the module when the key prefix can't tell
+// (e.g. _bx_orgs_ keys belong to bx_organizations).
+$sForced = getenv('ADD_LANG_KEY_MODULE');
+if ($sForced !== false && $sForced !== '') {
+    if (!isset($aModules[$sForced])) {
+        fwrite(STDERR, "Unknown module '$sForced'\n");
+        exit(2);
+    }
+    $aModule = $aModules[$sForced];
+}
+else {
+    $aModule = findModuleByExistingKey($sRoot, $sKey, $aModules);
+    if (!$aModule)
+        $aModule = inferModule($sKey, $aModules);
+}
 
 $sFile = resolveLangFile($sRoot, $sLang, $aModule, $aLangModules);
 $sRel = ltrim(str_replace('\\', '/', substr($sFile, strlen($sRoot))), '/');