From 8efe468e8fae80701639b6587805303d22009871 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sat, 18 Dec 2021 16:17:18 +0200 Subject: [PATCH 01/25] Support: Again fix answers evaluating --- Web/Presenters/templates/Support/AnswerTicket.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Presenters/templates/Support/AnswerTicket.xml b/Web/Presenters/templates/Support/AnswerTicket.xml index 025474c9..7ca11217 100644 --- a/Web/Presenters/templates/Support/AnswerTicket.xml +++ b/Web/Presenters/templates/Support/AnswerTicket.xml @@ -110,7 +110,7 @@ {/if} - {if $comment->getUType() === 1} + {if $comment->getUType() === 1 && !is_null($comment->isLikedByUser())}
{if $comment->isLikedByUser()} From af3dc6608ee368e478045978d6f99d5078d69c50 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sat, 18 Dec 2021 17:08:33 +0200 Subject: [PATCH 02/25] Translate comment reply button text --- Web/Presenters/templates/components/comment.xml | 2 +- locales/en.strings | 2 ++ locales/ru.strings | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Web/Presenters/templates/components/comment.xml b/Web/Presenters/templates/components/comment.xml index 94122ac7..445f60fb 100644 --- a/Web/Presenters/templates/components/comment.xml +++ b/Web/Presenters/templates/components/comment.xml @@ -33,7 +33,7 @@ {if $comment->canBeDeletedBy($thisUser)} {_"delete"} | {/if} - Ответить + {_"reply"}
diff --git a/locales/en.strings b/locales/en.strings index 06c8da0d..7f4a24c7 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -179,6 +179,8 @@ "open_post" = "Open post"; "version_incompatibility" = "This attachment could not be displayed. Probably the database is incompatible with the current version of OpenVK."; +"reply" = "Reply"; + /* Friends */ "friends" = "Friends"; diff --git a/locales/ru.strings b/locales/ru.strings index 7a37653a..05410854 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -182,6 +182,8 @@ "open_post" = "Открыть запись"; "version_incompatibility" = "Не удалось отобразить это вложение. Возможно, база данных несовместима с текущей версией OpenVK."; +"reply" = "Ответить"; + /* Friends */ "friends" = "Друзья"; From cb8c2f683b894a29306d357d51efa1d06ccd33c2 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sat, 18 Dec 2021 20:42:01 +0200 Subject: [PATCH 03/25] Groups: Fix the display of groups for non-logged in users --- Web/Presenters/templates/Group/View.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml index 1dfbbdc3..b7a5d70d 100644 --- a/Web/Presenters/templates/Group/View.xml +++ b/Web/Presenters/templates/Group/View.xml @@ -203,7 +203,7 @@
-
+
{_discussions}
From 3b54c4b878dac26ae7557cef76f84ca7cc70650e Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sun, 19 Dec 2021 14:34:33 +0200 Subject: [PATCH 04/25] Users: Add ability to transfer votes to another user --- .../CoinsTransferNotification.php | 13 ++++++ Web/Models/Repositories/Users.php | 17 +++++++ Web/Presenters/UserPresenter.php | 39 ++++++++++++++++ Web/Presenters/templates/User/Settings.xml | 1 + .../components/notifications/9602/_18_18_.xml | 8 ++++ Web/routes.yml | 2 + Web/static/css/style.css | 6 +++ Web/static/js/openvk.cls.js | 46 +++++++++++++++++++ locales/en.strings | 25 ++++++++++ locales/ru.strings | 27 +++++++++++ 10 files changed, 184 insertions(+) create mode 100644 Web/Models/Entities/Notifications/CoinsTransferNotification.php create mode 100644 Web/Presenters/templates/components/notifications/9602/_18_18_.xml diff --git a/Web/Models/Entities/Notifications/CoinsTransferNotification.php b/Web/Models/Entities/Notifications/CoinsTransferNotification.php new file mode 100644 index 00000000..d515631a --- /dev/null +++ b/Web/Models/Entities/Notifications/CoinsTransferNotification.php @@ -0,0 +1,13 @@ + sizeof((clone $this->users)->where("online >= ?", time() - 900)), ]; } + + function getByAddress(string $address): ?User + { + if(substr_compare($address, "/", -1) === 0) + $address = substr($address, 0, iconv_strlen($address) - 1); + + $serverUrl = ovk_scheme(true) . $_SERVER["SERVER_NAME"]; + if(strpos($address, $serverUrl . "/") === 0) + $address = substr($address, iconv_strlen($serverUrl) + 1); + + if(strpos($address, "id") === 0) { + $user = $this->get((int) substr($address, 2)); + if($user) return $user; + } + + return $this->getByShortUrl($address); + } use \Nette\SmartObject; } diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index f2d1921a..52e1bfee 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -10,6 +10,7 @@ use openvk\Web\Models\Repositories\Videos; use openvk\Web\Models\Repositories\Notes; use openvk\Web\Models\Repositories\Vouchers; use openvk\Web\Util\Validator; +use openvk\Web\Models\Entities\Notifications\CoinsTransferNotification; use Chandler\Security\Authenticator; use lfkeitel\phptotp\{Base32, Totp}; use chillerlan\QRCode\{QRCode, QROptions}; @@ -465,4 +466,42 @@ final class UserPresenter extends OpenVKPresenter $this->user->identity->save(); $this->flashFail("succ", tr("information_-1"), tr("two_factor_authentication_disabled_message")); } + + function renderCoinsTransfer(): void + { + $this->assertUserLoggedIn(); + $this->willExecuteWriteAction(); + + $receiverAddress = $this->postParam("receiver"); + $value = (int) $this->postParam("value"); + $message = $this->postParam("message"); + + if(!$receiverAddress || !$value) + $this->flashFail("err", tr("failed_to_tranfer_points"), tr("not_all_information_has_been_entered")); + + if($value < 0) + $this->flashFail("err", tr("failed_to_tranfer_points"), tr("negative_transfer_value")); + + if(iconv_strlen($message) > 255) + $this->flashFail("err", tr("failed_to_tranfer_points"), tr("message_is_too_long")); + + $receiver = $this->users->getByAddress($receiverAddress); + if(!$receiver) + $this->flashFail("err", tr("failed_to_tranfer_points"), tr("receiver_not_found")); + + if($this->user->identity->getCoins() < $value) + $this->flashFail("err", tr("failed_to_tranfer_points"), tr("you_dont_have_enough_points")); + + if($this->user->id !== $receiver->getId()) { + $this->user->identity->setCoins($this->user->identity->getCoins() - $value); + $this->user->identity->save(); + + $receiver->setCoins($receiver->getCoins() + $value); + $receiver->save(); + + (new CoinsTransferNotification($receiver, $this->user->identity, $value, $message))->emit(); + } + + $this->flashFail("succ", tr("information_-1"), tr("points_transfer_successful", tr("points_amount", $value), $receiver->getURL(), htmlentities($receiver->getCanonicalName()))); + } } diff --git a/Web/Presenters/templates/User/Settings.xml b/Web/Presenters/templates/User/Settings.xml index 948af6eb..daa7a0c3 100644 --- a/Web/Presenters/templates/User/Settings.xml +++ b/Web/Presenters/templates/User/Settings.xml @@ -332,6 +332,7 @@
{presenter "openvk!Support->knowledgeBaseArticle", "points"} +
{tr("also_you_can_transfer_points", $thisUser->getCoins(), rawurlencode($csrfToken))|noescape}

diff --git a/Web/Presenters/templates/components/notifications/9602/_18_18_.xml b/Web/Presenters/templates/components/notifications/9602/_18_18_.xml new file mode 100644 index 00000000..6f3e045b --- /dev/null +++ b/Web/Presenters/templates/components/notifications/9602/_18_18_.xml @@ -0,0 +1,8 @@ +{var sender = $notification->getModel(1)} +{var value = (int) explode(" ", $notification->getData(), 2)[0]} +{var message = explode(" ", $notification->getData(), 2)[1]} + +{$sender->getCanonicalName()} {_transferred_to_you} {tr("points_amount", $value)}. +{if !empty($message)} + {_message}: "{$message}". +{/if} diff --git a/Web/routes.yml b/Web/routes.yml index e4bd8215..9ef0389a 100644 --- a/Web/routes.yml +++ b/Web/routes.yml @@ -59,6 +59,8 @@ routes: handler: "User->twoFactorAuthSettings" - url: "/settings/2fa/disable" handler: "User->disableTwoFactorAuth" + - url: "/coins_transfer" + handler: "User->coinsTransfer" - url: "/id{num}" handler: "User->view" - url: "/friends{num}" diff --git a/Web/static/css/style.css b/Web/static/css/style.css index dd2ea30c..93eb67fb 100644 --- a/Web/static/css/style.css +++ b/Web/static/css/style.css @@ -1687,3 +1687,9 @@ body.scrolled .toTop:hover { border-bottom: #e6e6e6 solid 1px; padding: 4px; } + +.messagebox-content-header { + background: #F7F7F7; + margin: -20px; + padding: 10px; +} diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js index 4195e5e7..13bdafc4 100644 --- a/Web/static/js/openvk.cls.js +++ b/Web/static/js/openvk.cls.js @@ -171,3 +171,49 @@ function setClubAdminComment(clubId, adminId, hash) { Function.noop ]); } + +function showCoinsTransferDialog(coinsCount, hash) { + MessageBox(tr("transfer_poins"), ` +

+ ${tr("points_transfer_dialog_header_1")} + ${tr("points_transfer_dialog_header_2")} ${tr("points_amount", coinsCount)} +
+
+ + + + + + + + + + + + + + + +
+ ${tr("receiver_address")}: + + +
+ ${tr("coins_count")}: + + +
+ ${tr("message")}: + + +
+ +
+ `, [tr("transfer_poins_button"), tr("cancel")], [ + () => { + document.querySelector("#coins_transfer_form").submit(); + }, + Function.noop + ]); +} + diff --git a/locales/en.strings b/locales/en.strings index 7f4a24c7..1ab7b604 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -524,6 +524,31 @@ "usages_total" = "Number of uses"; "usages_left" = "Uses left"; +"points_transfer_dialog_header_1" = "You can send as a gift or transfer part of the votes to another person."; +"points_transfer_dialog_header_2" = "Your current balance:"; + +"points_amount_one" = "1 vote"; +"points_amount_other" = "$1 votes"; + +"transfer_poins" = "Transfer votes"; +"transfer_poins_button" = "Transfer votes"; +"also_you_can_transfer_points" = "You can also transfer votes to another person."; + +"transferred_to_you" = "transferred to you"; + +"receiver_address" = "Receiver address"; +"coins_count" = "Number of votes"; +"message" = "Message"; + +"failed_to_tranfer_points" = "Failed to transfer votes"; + +"points_transfer_successful" = "You have successfully transferred $1 to $3."; +"not_all_information_has_been_entered" = "Not all information has been entered."; +"negative_transfer_value" = "We cannot steal votes from another person, sorry."; +"message_is_too_long" = "The message is too long."; +"receiver_not_found" = "The receiver was not found."; +"you_dont_have_enough_points" = "You don't have enough votes."; + /* Gifts */ "gift" = "Gift"; diff --git a/locales/ru.strings b/locales/ru.strings index 05410854..97900189 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -546,6 +546,33 @@ "usages_total" = "Количество использований"; "usages_left" = "Осталось использований"; +"points_transfer_dialog_header_1" = "Вы можете отправить в подарок или передать часть голосов другому человеку."; +"points_transfer_dialog_header_2" = "Ваш текущий баланс:"; + +"points_amount_one" = "1 голос"; +"points_amount_few" = "$1 голоса"; +"points_amount_many" = "$1 голосов"; +"points_amount_other" = "$1 голосов"; + +"transfer_poins" = "Передача голосов"; +"transfer_poins_button" = "Передать голоса"; +"also_you_can_transfer_points" = "Также вы можете передать голоса другому человеку."; + +"transferred_to_you" = "передал вам"; + +"receiver_address" = "Адрес получателя"; +"coins_count" = "Количество голосов"; +"message" = "Сообщение"; + +"failed_to_tranfer_points" = "Не удалось передать голоса"; + +"points_transfer_successful" = "Вы успешно передали $1 $3."; +"not_all_information_has_been_entered" = "Введена не вся информация."; +"negative_transfer_value" = "Мы не можем украсть голоса у другого человека, извините."; +"message_is_too_long" = "Сообщение слишком длинное."; +"receiver_not_found" = "Получатель не найден."; +"you_dont_have_enough_points" = "У вас недостаточно голосов."; + /* Gifts */ "gift" = "Подарок"; From f902e95cfc1f5ffc457974236968bfa7c8f7392c Mon Sep 17 00:00:00 2001 From: veselcraft Date: Mon, 20 Dec 2021 16:38:07 +0300 Subject: [PATCH 05/25] Wall: Fix big avatars on repost --- Web/Presenters/templates/components/post/microblogpost.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Web/Presenters/templates/components/post/microblogpost.xml b/Web/Presenters/templates/components/post/microblogpost.xml index 5606f790..8c22b51b 100644 --- a/Web/Presenters/templates/components/post/microblogpost.xml +++ b/Web/Presenters/templates/components/post/microblogpost.xml @@ -10,7 +10,8 @@ + width="{ifset $compact}25{else}50{/ifset}" + {ifset $compact}class="cCompactAvatars"{/ifset} /> {if !$post->isPostedOnBehalfOfGroup() && !$compact} {_online} From a7944a1e089f2da85e83d3809ab97cd2bfba5447 Mon Sep 17 00:00:00 2001 From: veselcraft Date: Mon, 20 Dec 2021 18:02:49 +0300 Subject: [PATCH 06/25] User: Friends mini-list redesign Also fixes #180 --- Web/Presenters/templates/Group/View.xml | 33 ++++++---------- Web/Presenters/templates/User/View.xml | 51 ++++++++----------------- Web/static/css/style.css | 42 ++++++++++++++++++++ 3 files changed, 70 insertions(+), 56 deletions(-) diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml index b7a5d70d..f16c435d 100644 --- a/Web/Presenters/templates/Group/View.xml +++ b/Web/Presenters/templates/Group/View.xml @@ -53,27 +53,18 @@ {_all_title}
-
- - - - - - - - - -
- - - -
- {$follower->getFirstName()} -
+
diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index be1dc914..b7149c7e 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -95,21 +95,21 @@ {var subStatus = $user->getSubscriptionStatus($thisUser)} {if $subStatus === 0} -
+
{elseif $subStatus === 1} -
+
{elseif $subStatus === 2} -
+ @@ -117,7 +117,7 @@
{elseif $subStatus === 3} {_"send_message"} -
+ @@ -125,6 +125,7 @@
{/if} {/if} + {tr("followers", $user->getFollowersCount())}
{var completeness = $user->getProfileCompletenessReport()} @@ -196,37 +197,17 @@ {_"all_title"}
- - - -
- {var followersCount = $user->getFollowersCount()} - -
- {_followers} -
-
-
- {tr("followers", $followersCount)} - -
-
- diff --git a/Web/static/css/style.css b/Web/static/css/style.css index 93eb67fb..4fdf6f8f 100644 --- a/Web/static/css/style.css +++ b/Web/static/css/style.css @@ -307,6 +307,10 @@ a { cursor: pointer; } +.profile_link_form { + margin-bottom: 0; +} + #profile_links { margin: 10px 0; } @@ -683,6 +687,44 @@ span { max-height: 63px; } +.content_list { + display: flex; + width: 200px; + flex-wrap: wrap; +} + +.content_list.long { + width: 397px; +} + +.content_list .cl_element { + width: 33%; +} + +.content_list.long .cl_element { + width: 16.5%; +} + +.content_list .cl_element .cl_avatar { + padding: 7px 7px 0 7px; + text-align: center; +} + +.content_list .cl_element .cl_name { + padding: 0 3px; + text-align: center; + display: flex; + flex-direction: column; +} + +.content_list .cl_element .cl_name .cl_lname { + font-size: 7pt; +} + +.ava { + width: 45px; +} + table.User { vertical-align: text-top; } From 3d75e9cd7e0a4d7ee87a71ee8f063c0b842d91ea Mon Sep 17 00:00:00 2001 From: veselcraft Date: Mon, 20 Dec 2021 19:01:34 +0300 Subject: [PATCH 07/25] Gifts: Move gifts to the left side on User's page Fixes #175 --- Web/Presenters/templates/User/View.xml | 55 ++++++++++++++------------ 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index b7149c7e..c8e5ed20 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -91,8 +91,6 @@ {/if} - {_send_gift} - {var subStatus = $user->getSubscriptionStatus($thisUser)} {if $subStatus === 0}

-
-
- {_gifts} -
-
-
- {tr("gifts", $giftCount)} - -
-
-
- {var hideInfo = !is_null($thisUser) ? ($giftDescriptor->anon ? $thisUser->getId() !== $user->getId() : false) : false} - - - {$hideInfo ? tr('gift') : ($giftDescriptor->caption ?? tr('gift'))} - -
-
-
-
{var friendCount = $user->getFriendsCount()} @@ -489,6 +463,35 @@
+ +
+
+ {_gifts} +
+
+
+ {tr("gifts", $giftCount)} +
+ {if OPENVK_ROOT_CONF['openvk']['preferences']['commerce']} + {_send_gift} | + {/if} + {_all_title} +
+
+
+
+ {var hideInfo = !is_null($thisUser) ? ($giftDescriptor->anon ? $thisUser->getId() !== $user->getId() : false) : false} +
+ + {$hideInfo ? tr('gift') : ($giftDescriptor->caption ?? tr('gift'))} + +
+
+
+
+
{presenter "openvk!Wall->wallEmbedded", $user->getId()} From 40b060342919bd42f3ae8af608e6a1ca74443092 Mon Sep 17 00:00:00 2001 From: veselcraft Date: Mon, 20 Dec 2021 19:05:55 +0300 Subject: [PATCH 08/25] Gifts: Increase value of visible gifts on user's page from 3 to 4 Yep, this is a fixup of previous commit --- Web/Presenters/templates/User/View.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index c8e5ed20..f867214c 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -479,7 +479,7 @@
-
+
{var hideInfo = !is_null($thisUser) ? ($giftDescriptor->anon ? $thisUser->getId() !== $user->getId() : false) : false} From 05643e97cd2be4f9a94c2dddab07b752f6fcf0ec Mon Sep 17 00:00:00 2001 From: veselcraft Date: Mon, 20 Dec 2021 23:51:50 +0300 Subject: [PATCH 10/25] Photos: Album view redesign --- Web/Presenters/PhotosPresenter.php | 5 ++-- Web/Presenters/templates/Photos/Album.xml | 33 ++++++++++++----------- Web/static/css/style.css | 29 +++++++++++++++----- 3 files changed, 42 insertions(+), 25 deletions(-) diff --git a/Web/Presenters/PhotosPresenter.php b/Web/Presenters/PhotosPresenter.php index 24531222..56247bde 100644 --- a/Web/Presenters/PhotosPresenter.php +++ b/Web/Presenters/PhotosPresenter.php @@ -138,12 +138,13 @@ final class PhotosPresenter extends OpenVKPresenter } $this->template->album = $album; - $this->template->photos = iterator_to_array( $album->getPhotos( (int) ($this->queryParam("p") ?? 1) ) ); + $this->template->photos = iterator_to_array( $album->getPhotos( (int) ($this->queryParam("p") ?? 1), 20) ); $this->template->paginatorConf = (object) [ "count" => $album->getPhotosCount(), "page" => $this->queryParam("p") ?? 1, "amount" => sizeof($this->template->photos), - "perPage" => OPENVK_DEFAULT_PER_PAGE, + "perPage" => 20, + "atBottom" => true ]; } diff --git a/Web/Presenters/templates/Photos/Album.xml b/Web/Presenters/templates/Photos/Album.xml index d4fe819a..9927c297 100644 --- a/Web/Presenters/templates/Photos/Album.xml +++ b/Web/Presenters/templates/Photos/Album.xml @@ -27,23 +27,24 @@  |  {_"edit_album"} {/if} -
+

{if $album->getPhotosCount() > 0} - {foreach $photos as $photo} - {php if($photo->isDeleted()) continue; } - - {/foreach} - +
+ {foreach $photos as $photo} + {php if($photo->isDeleted()) continue; } + + {/foreach} +
{include "../components/paginator.xml", conf => $paginatorConf} {else} {include "../components/nothing.xml"} diff --git a/Web/static/css/style.css b/Web/static/css/style.css index 4fdf6f8f..489f7b8d 100644 --- a/Web/static/css/style.css +++ b/Web/static/css/style.css @@ -257,23 +257,29 @@ a { .album-photo { position: relative; - background-color: darkgrey; - margin: 4pt; - width: calc(33% - 10pt); - height: 82px; + width: 25%; + max-height: 140px; + margin-bottom: 8px; text-align: center; - vertical-align: text-top; + display: flex; + align-items: center; + justify-content: center; } .album-photo img { - width: 100%; - max-height: 82px; + width: unset; + max-height: 120px !important; + max-width: 83%; vertical-align: top; + border: 1px #ccc solid; + padding: 8px; + background-color: #fff; } .album-photo > .album-photo--delete { position: absolute; right: 0; + top: 0; padding: 5px; margin: 4px; color: #fff; @@ -289,6 +295,11 @@ a { opacity: 1; } +.album-flex { + display: flex; + flex-wrap: wrap; +} + .name-checkmark { margin-left: 2pt; } @@ -738,6 +749,10 @@ table.User { margin-bottom: -12px; } +.container_gray.bottom { + border-bottom: #ebebeb solid 1px; +} + #auth .container_gray { margin-left: -10px; margin-bottom: -10px; From c75ce513a0582919ee17a2e4bb588faaf2fff5c6 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Tue, 21 Dec 2021 17:25:03 +0200 Subject: [PATCH 11/25] Gifts: Return the ability to send gifts to those who did not have them --- Web/Presenters/templates/User/View.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index a5d1b296..46a50eb6 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -91,6 +91,8 @@ {/if} + {_send_gift} + {var subStatus = $user->getSubscriptionStatus($thisUser)} {if $subStatus === 0} From 511afc464cb9d2825e25a4850f3d0d741b5c874b Mon Sep 17 00:00:00 2001 From: veselcraft Date: Wed, 22 Dec 2021 16:26:49 +0300 Subject: [PATCH 12/25] ListView: Add a actions block to the element of the list --- Web/Presenters/templates/@listView.xml | 3 + Web/Presenters/templates/Group/Followers.xml | 84 ++++++++++---------- Web/Presenters/templates/User/Friends.xml | 34 ++++++++ Web/Presenters/templates/User/Groups.xml | 23 ++++-- Web/static/css/style.css | 4 + 5 files changed, 96 insertions(+), 52 deletions(-) diff --git a/Web/Presenters/templates/@listView.xml b/Web/Presenters/templates/@listView.xml index 58d51dff..35c9a2f0 100644 --- a/Web/Presenters/templates/@listView.xml +++ b/Web/Presenters/templates/@listView.xml @@ -29,6 +29,9 @@ {include description, x => $dat} + + {include actions, x => $dat} + diff --git a/Web/Presenters/templates/Group/Followers.xml b/Web/Presenters/templates/Group/Followers.xml index e6409ac4..61daeae6 100644 --- a/Web/Presenters/templates/Group/Followers.xml +++ b/Web/Presenters/templates/Group/Followers.xml @@ -14,10 +14,6 @@ {_only_administrators} {/block} -{block actions} - -{/block} - {* BEGIN ELEMENTS DESCRIPTION *} {block tabs} @@ -81,50 +77,13 @@ {/if} - - {_actions}: - - - {if $manager} - {_devote} - {else} - {_promote_to_admin} - {/if} - - {if $club->getOwner()->getId() != $user->getId() && $manager && $thisUser->getId() == $club->getOwner()->getId()} - | - - {_promote_to_owner} - - {/if} - {if $manager} - | - - {_set_comment} - - {/if} - - {_set_comment} - - {if $manager} - | - - {if $manager->isHidden()}{_hidden_yes}{else}{_hidden_no}{/if} - - {/if} - {if $club->getOwner()->getId() == $user->getId()} - | - - {if $club->isOwnerHidden()}{_hidden_yes}{else}{_hidden_no}{/if} - - {/if} - - + {/block} + +{block actions} + {var user = $x instanceof $Manager ? $x->getUser() : $x} + {var manager = $x instanceof $Manager ? $x : $club->getManager($user, !$club->canBeModifiedBy($thisUser))} + {if $club->canBeModifiedBy($thisUser ?? NULL)} + + {if $manager} + {_devote} + {else} + {_promote_to_admin} + {/if} + + {if $club->getOwner()->getId() != $user->getId() && $manager && $thisUser->getId() == $club->getOwner()->getId()} + + {_promote_to_owner} + + {/if} + {if $manager} + + {_set_comment} + + {/if} + + {_set_comment} + + {if $manager} + + {if $manager->isHidden()}{_hidden_yes}{else}{_hidden_no}{/if} + + {/if} + {if $club->getOwner()->getId() == $user->getId()} + + {if $club->isOwnerHidden()}{_hidden_yes}{else}{_hidden_no}{/if} + + {/if} + {/if} +{/block} \ No newline at end of file diff --git a/Web/Presenters/templates/User/Friends.xml b/Web/Presenters/templates/User/Friends.xml index 117ce1a0..e6c9f50c 100644 --- a/Web/Presenters/templates/User/Friends.xml +++ b/Web/Presenters/templates/User/Friends.xml @@ -79,3 +79,37 @@ {/block} + +{block actions} + {var subStatus = $x->getSubscriptionStatus($thisUser)} + {if $subStatus === 0} + + + + + + + {elseif $subStatus === 1} + + {elseif $subStatus === 2} + + {elseif $subStatus === 3} + {_"send_message"} + + {/if} +{/block} diff --git a/Web/Presenters/templates/User/Groups.xml b/Web/Presenters/templates/User/Groups.xml index e740694d..b2268b6a 100644 --- a/Web/Presenters/templates/User/Groups.xml +++ b/Web/Presenters/templates/User/Groups.xml @@ -50,22 +50,29 @@ {block description} {$x->getDescription()} {if $x->canBeModifiedBy($thisUser ?? NULL)} - {var clubPinned = $thisUser->isClubPinned($x)} +
{_actions}: - - {if $clubPinned} - {_remove_from_left_menu} - {else} - {_add_to_left_menu} - {/if} - +
{/if} {/block} + +{var clubPinned = $thisUser->isClubPinned($x)} +{if $clubPinned || $thisUser->getPinnedClubCount() <= 10} + {block actions} + + {if $clubPinned} + {_remove_from_left_menu} + {else} + {_add_to_left_menu} + {/if} + + {/block} +{/if} \ No newline at end of file diff --git a/Web/static/css/style.css b/Web/static/css/style.css index 489f7b8d..f5abe0c6 100644 --- a/Web/static/css/style.css +++ b/Web/static/css/style.css @@ -330,6 +330,10 @@ a { background: #ECECEC; } +.action_links > .profile_link, .action_links > .profile_link_form > .profile_link { + width: 150px; +} + .page_footer { margin-left: 95px; padding-top: 5px; From 753a282b880c7087d1b69cee70d8f772200ca91b Mon Sep 17 00:00:00 2001 From: veselcraft Date: Wed, 22 Dec 2021 16:29:04 +0300 Subject: [PATCH 13/25] Groups: Delete the leftover lable Actions --- Web/Presenters/templates/User/Groups.xml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/Web/Presenters/templates/User/Groups.xml b/Web/Presenters/templates/User/Groups.xml index b2268b6a..29ad35be 100644 --- a/Web/Presenters/templates/User/Groups.xml +++ b/Web/Presenters/templates/User/Groups.xml @@ -49,23 +49,10 @@ {block description} {$x->getDescription()} - {if $x->canBeModifiedBy($thisUser ?? NULL)} - - - - - - - - -
{_actions}: - -
- {/if} {/block} {var clubPinned = $thisUser->isClubPinned($x)} -{if $clubPinned || $thisUser->getPinnedClubCount() <= 10} +{if $clubPinned || $thisUser->getPinnedClubCount() <= 10 || $x->canBeModifiedBy($thisUser ?? NULL)} {block actions} {if $clubPinned} From 43bfd48fa9091c695025e532d5585c9ea7ae1891 Mon Sep 17 00:00:00 2001 From: veselcraft Date: Wed, 22 Dec 2021 16:42:02 +0300 Subject: [PATCH 14/25] Groups, Users: Fix right for Groups and Friends list --- Web/Presenters/templates/User/Friends.xml | 62 ++++++++++++----------- Web/Presenters/templates/User/Groups.xml | 2 +- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/Web/Presenters/templates/User/Friends.xml b/Web/Presenters/templates/User/Friends.xml index e6c9f50c..94a5f524 100644 --- a/Web/Presenters/templates/User/Friends.xml +++ b/Web/Presenters/templates/User/Friends.xml @@ -81,35 +81,37 @@ {/block} {block actions} - {var subStatus = $x->getSubscriptionStatus($thisUser)} - {if $subStatus === 0} - - {elseif $subStatus === 1} - - {elseif $subStatus === 2} - - {elseif $subStatus === 3} - {_"send_message"} - + {if $x->getId() !== $thisUser->getId()} + {var subStatus = $x->getSubscriptionStatus($thisUser)} + {if $subStatus === 0} + + {elseif $subStatus === 1} + + {elseif $subStatus === 2} + + {elseif $subStatus === 3} + {_"send_message"} + + {/if} {/if} {/block} diff --git a/Web/Presenters/templates/User/Groups.xml b/Web/Presenters/templates/User/Groups.xml index 29ad35be..ad80222c 100644 --- a/Web/Presenters/templates/User/Groups.xml +++ b/Web/Presenters/templates/User/Groups.xml @@ -52,7 +52,7 @@ {/block} {var clubPinned = $thisUser->isClubPinned($x)} -{if $clubPinned || $thisUser->getPinnedClubCount() <= 10 || $x->canBeModifiedBy($thisUser ?? NULL)} +{if $x->canBeModifiedBy($thisUser ?? NULL) || $clubPinned || $thisUser->getPinnedClubCount() <= 10} {block actions} {if $clubPinned} From 601d120771ed4bc5a7e34babe23b1f7969efb09a Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Wed, 22 Dec 2021 16:01:39 +0200 Subject: [PATCH 15/25] Global: Don't highlight mentions if they are part of a word or link --- Web/Models/Entities/Traits/TRichText.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Models/Entities/Traits/TRichText.php b/Web/Models/Entities/Traits/TRichText.php index 76d9ba25..e3e2ce6d 100644 --- a/Web/Models/Entities/Traits/TRichText.php +++ b/Web/Models/Entities/Traits/TRichText.php @@ -60,7 +60,7 @@ trait TRichText $rel = $this->isAd() ? "sponsored" : "ugc"; $text = $this->formatLinks($text); $text = preg_replace("%@([A-Za-z0-9]++) \(([\p{L} 0-9]+)\)%Xu", "[$1|$2]", $text); - $text = preg_replace("%@([A-Za-z0-9]++)%Xu", "[$1|@$1]", $text); + $text = preg_replace("%([\n\r\s]|^)(@([A-Za-z0-9]++))%Xu", "$1[$3|@$3]", $text); $text = preg_replace("%\[([A-Za-z0-9]++)\|([\p{L} 0-9@]+)\]%Xu", "$2", $text); $text = preg_replace("%(#([\p{L}_-]++[0-9]*[\p{L}_-]*))%Xu", "$1", $text); $text = $this->formatEmojis($text); From c8b44ce9a2f45d1f9339d90d987a9862a30edcaa Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Wed, 22 Dec 2021 16:51:13 +0200 Subject: [PATCH 16/25] Notifications: Remove unnecessary links from the list --- Web/Presenters/templates/Notification/Feed.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Web/Presenters/templates/Notification/Feed.xml b/Web/Presenters/templates/Notification/Feed.xml index 848d55e8..cb2474da 100644 --- a/Web/Presenters/templates/Notification/Feed.xml +++ b/Web/Presenters/templates/Notification/Feed.xml @@ -19,13 +19,6 @@
{/block} -{block actions} - -{/block} - {* BEGIN ELEMENTS DESCRIPTION *} {block link|strip|stripHtml} From d2814bef01ec32cc70d21ad5f4e599c880429433 Mon Sep 17 00:00:00 2001 From: WerySkok <15957616+WerySkok@users.noreply.github.com> Date: Wed, 22 Dec 2021 18:04:27 +0300 Subject: [PATCH 17/25] L18n: Set fallback languages for locales Russian as fallback for cyrillic locales and English for other ones --- locales/am.strings | 1 + locales/by.strings | 1 + locales/by_lat.strings | 1 + locales/de.strings | 1 + locales/eo.strings | 1 + locales/kk.strings | 1 + locales/pl.strings | 1 + locales/sr_cyr.strings | 1 + locales/sr_lat.strings | 1 + locales/tr.strings | 1 + locales/ua.strings | 1 + 11 files changed, 11 insertions(+) diff --git a/locales/am.strings b/locales/am.strings index 0c284722..3bcee857 100644 --- a/locales/am.strings +++ b/locales/am.strings @@ -1,5 +1,6 @@ "__locale" = "hy_AM.utf8;hy_AM.UTF-8;Arm"; "__WinEncoding" = "Windows-1251"; +"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/by.strings b/locales/by.strings index 65e44588..5eefa747 100644 --- a/locales/by.strings +++ b/locales/by.strings @@ -1,4 +1,5 @@ "__locale" = "be_BY.UTF-8;Bel"; +"__fallback" = "ru"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/by_lat.strings b/locales/by_lat.strings index 9b77c312..8b032e8d 100644 --- a/locales/by_lat.strings +++ b/locales/by_lat.strings @@ -1,5 +1,6 @@ "__locale" = "be_BY@latin;Bel_Lat"; "__WinEncoding" = "Windows-1251"; +"__fallback" = "ru"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/de.strings b/locales/de.strings index ad7e5614..4c037179 100644 --- a/locales/de.strings +++ b/locales/de.strings @@ -1,4 +1,5 @@ "__locale" = "de_DE.UTF-8;Deu"; +"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/eo.strings b/locales/eo.strings index 8ae94810..e35a7ab3 100644 --- a/locales/eo.strings +++ b/locales/eo.strings @@ -1,4 +1,5 @@ "__locale" = "eo.utf8"; +"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/kk.strings b/locales/kk.strings index 33fd406f..5c6cbbd3 100644 --- a/locales/kk.strings +++ b/locales/kk.strings @@ -1,4 +1,5 @@ "__locale" = "kk_KZ.UTF-8;Kaz"; +"__fallback" = "ru"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/pl.strings b/locales/pl.strings index 4c236bc1..8f6e3da1 100644 --- a/locales/pl.strings +++ b/locales/pl.strings @@ -1,5 +1,6 @@ "__locale" = "pl_PL.utf8;pl_PL.UTF-8;Pol"; "__WinEncoding" = "Windows-1251"; +"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/sr_cyr.strings b/locales/sr_cyr.strings index a25ab905..e9778187 100644 --- a/locales/sr_cyr.strings +++ b/locales/sr_cyr.strings @@ -1,4 +1,5 @@ "__locale" = "sr_CS.UTF-8;Srb"; +"__fallback" = "ru"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/sr_lat.strings b/locales/sr_lat.strings index c34cd3fb..869347ae 100644 --- a/locales/sr_lat.strings +++ b/locales/sr_lat.strings @@ -1,4 +1,5 @@ "__locale" = "sr_CS.UTF-8;Srb_Latin"; +"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/tr.strings b/locales/tr.strings index 35648294..ea7255e8 100644 --- a/locales/tr.strings +++ b/locales/tr.strings @@ -1,4 +1,5 @@ "__locale" = "tr_TR.UTF-8;Tur"; +"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/ua.strings b/locales/ua.strings index fac74089..184eaebb 100644 --- a/locales/ua.strings +++ b/locales/ua.strings @@ -1,5 +1,6 @@ "__locale" = "uk_UA.utf8;Ukr"; "__WinEncoding" = "Windows-1251"; +"__fallback" = "ru"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ From c77fbebd22f4c08f2b4e07a9467240e04039e85c Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Wed, 22 Dec 2021 17:31:58 +0200 Subject: [PATCH 18/25] Discussions: Add ability to turn on the display of a list of topics above the wall --- Web/Models/Entities/Club.php | 5 ++ Web/Presenters/GroupPresenter.php | 1 + Web/Presenters/templates/Group/Edit.xml | 3 +- Web/Presenters/templates/Group/View.xml | 66 ++++++++++++------- .../sqls/00016-place-oftopic-list-setting.sql | 1 + locales/en.strings | 1 + locales/ru.strings | 1 + 7 files changed, 53 insertions(+), 25 deletions(-) create mode 100644 install/sqls/00016-place-oftopic-list-setting.sql diff --git a/Web/Models/Entities/Club.php b/Web/Models/Entities/Club.php index 26748d73..fff811f4 100644 --- a/Web/Models/Entities/Club.php +++ b/Web/Models/Entities/Club.php @@ -135,6 +135,11 @@ class Club extends RowModel return (bool) $this->getRecord()->everyone_can_create_topics; } + function isDisplayTopicsAboveWallEnabled(): bool + { + return (bool) $this->getRecord()->display_topics_above_wall; + } + function getType(): int { return $this->getRecord()->type; diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php index 1af8ef28..7788c09e 100644 --- a/Web/Presenters/GroupPresenter.php +++ b/Web/Presenters/GroupPresenter.php @@ -208,6 +208,7 @@ final class GroupPresenter extends OpenVKPresenter $club->setWall(empty($this->postParam("wall")) ? 0 : 1); $club->setAdministrators_List_Display(empty($this->postParam("administrators_list_display")) ? 0 : $this->postParam("administrators_list_display")); $club->setEveryone_Can_Create_Topics(empty($this->postParam("everyone_can_create_topics")) ? 0 : 1); + $club->setDisplay_Topics_Above_Wall(empty($this->postParam("display_topics_above_wall")) ? 0 : 1);; $website = $this->postParam("website") ?? ""; if(empty($website)) diff --git a/Web/Presenters/templates/Group/Edit.xml b/Web/Presenters/templates/Group/Edit.xml index ecf17393..25c2b3d1 100644 --- a/Web/Presenters/templates/Group/Edit.xml +++ b/Web/Presenters/templates/Group/Edit.xml @@ -82,7 +82,8 @@ {_discussions}: - {_everyone_can_create_topics} + {_everyone_can_create_topics}
+ {_display_list_of_topics_above_wall} diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml index f16c435d..a817b72c 100644 --- a/Web/Presenters/templates/Group/View.xml +++ b/Web/Presenters/templates/Group/View.xml @@ -41,36 +41,54 @@
- {var followersCount = $club->getFollowersCount()} - -
- {_participants} -
-
-
- {tr("participants", $followersCount)} - + {var followersCount = $club->getFollowersCount()} + +
+ {_participants} +
+
+ +
+
+ {_discussions} +
+
+
+ {tr("topics", $topicsCount)} + +
+
+
+ {$topic->getTitle()}
+ {tr("updated_at", $topic->getUpdateTime())} +
+
+
+
{presenter "openvk!Wall->wallEmbedded", -$club->getId()} -
-
+
{_discussions}
diff --git a/install/sqls/00016-place-oftopic-list-setting.sql b/install/sqls/00016-place-oftopic-list-setting.sql new file mode 100644 index 00000000..500f6dff --- /dev/null +++ b/install/sqls/00016-place-oftopic-list-setting.sql @@ -0,0 +1 @@ +ALTER TABLE `groups` ADD COLUMN `display_topics_above_wall` BOOLEAN NOT NULL DEFAULT FALSE AFTER `everyone_can_create_topics`; diff --git a/locales/en.strings b/locales/en.strings index 1ab7b604..dfd47f2c 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -668,6 +668,7 @@ "created" = "Created"; "everyone_can_create_topics" = "Everyone can create topics"; +"display_list_of_topics_above_wall" = "Display a list of topics above the wall"; "topic_changes_saved_comment" = "The updated title and settings will appear on the topic page."; diff --git a/locales/ru.strings b/locales/ru.strings index 97900189..fdec87a6 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -703,6 +703,7 @@ "created" = "Создано"; "everyone_can_create_topics" = "Все могут создавать темы"; +"display_list_of_topics_above_wall" = "Отображать список тем над стеной"; "topic_changes_saved_comment" = "Обновлённый заголовок и настройки появятся на странице с темой."; From 70b4712c9212fddad15ac767ea811595c22227bd Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Wed, 22 Dec 2021 17:53:45 +0200 Subject: [PATCH 19/25] Gifts: Display information about an anonymous gift to the person who sent it --- Web/Presenters/templates/Gifts/UserGifts.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Presenters/templates/Gifts/UserGifts.xml b/Web/Presenters/templates/Gifts/UserGifts.xml index da73e1fb..e6672bf7 100644 --- a/Web/Presenters/templates/Gifts/UserGifts.xml +++ b/Web/Presenters/templates/Gifts/UserGifts.xml @@ -24,7 +24,7 @@ {/block} {block description} - +
From 6ebae054c67e2e8688d1bfd030c583cbbb0701f4 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Wed, 22 Dec 2021 18:21:27 +0200 Subject: [PATCH 20/25] L10n: Remove the ability to specify the fallback language and use includes instead --- Web/Util/Localizator.php | 2 +- locales/am.strings | 3 ++- locales/by.strings | 3 ++- locales/by_lat.strings | 3 ++- locales/de.strings | 3 ++- locales/eo.strings | 3 ++- locales/kk.strings | 3 ++- locales/pl.strings | 3 ++- locales/ru_old.strings | 3 ++- locales/sr_cyr.strings | 3 ++- locales/sr_lat.strings | 3 ++- locales/tr.strings | 3 ++- locales/ua.strings | 3 ++- 13 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Web/Util/Localizator.php b/Web/Util/Localizator.php index fb25b370..d73bec13 100644 --- a/Web/Util/Localizator.php +++ b/Web/Util/Localizator.php @@ -57,7 +57,7 @@ class Localizator $lang = is_null($lang) ? static::DEFAULT_LANG : $lang; $array = @self::parse(dirname(__FILE__) . "/../../locales/$lang.strings"); - return $array[$id] ?? (!empty($array["__fallback"]) ? $this->_($id, $array["__fallback"]) : "@$id"); + return $array[$id] ?? "@$id"; } function export($lang = NULL): ?array diff --git a/locales/am.strings b/locales/am.strings index 3bcee857..437f30a9 100644 --- a/locales/am.strings +++ b/locales/am.strings @@ -1,6 +1,7 @@ +#include + "__locale" = "hy_AM.utf8;hy_AM.UTF-8;Arm"; "__WinEncoding" = "Windows-1251"; -"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/by.strings b/locales/by.strings index 5eefa747..edf272f6 100644 --- a/locales/by.strings +++ b/locales/by.strings @@ -1,5 +1,6 @@ +#include + "__locale" = "be_BY.UTF-8;Bel"; -"__fallback" = "ru"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/by_lat.strings b/locales/by_lat.strings index 8b032e8d..4056999f 100644 --- a/locales/by_lat.strings +++ b/locales/by_lat.strings @@ -1,6 +1,7 @@ +#include + "__locale" = "be_BY@latin;Bel_Lat"; "__WinEncoding" = "Windows-1251"; -"__fallback" = "ru"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/de.strings b/locales/de.strings index 4c037179..0fdf1b38 100644 --- a/locales/de.strings +++ b/locales/de.strings @@ -1,5 +1,6 @@ +#include + "__locale" = "de_DE.UTF-8;Deu"; -"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/eo.strings b/locales/eo.strings index e35a7ab3..14ac78cb 100644 --- a/locales/eo.strings +++ b/locales/eo.strings @@ -1,5 +1,6 @@ +#include + "__locale" = "eo.utf8"; -"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/kk.strings b/locales/kk.strings index 5c6cbbd3..6bb9f5aa 100644 --- a/locales/kk.strings +++ b/locales/kk.strings @@ -1,5 +1,6 @@ +#include + "__locale" = "kk_KZ.UTF-8;Kaz"; -"__fallback" = "ru"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/pl.strings b/locales/pl.strings index 8f6e3da1..1fe5fd0b 100644 --- a/locales/pl.strings +++ b/locales/pl.strings @@ -1,6 +1,7 @@ +#include + "__locale" = "pl_PL.utf8;pl_PL.UTF-8;Pol"; "__WinEncoding" = "Windows-1251"; -"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/ru_old.strings b/locales/ru_old.strings index e4893ade..f4c0193c 100644 --- a/locales/ru_old.strings +++ b/locales/ru_old.strings @@ -1,6 +1,7 @@ +#include + "__locale" = "ru_UA.utf8;ru_RU.UTF-8;Rus"; "__WinEncoding" = "Windows-1251"; -"__fallback" = "ru"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/sr_cyr.strings b/locales/sr_cyr.strings index e9778187..55937634 100644 --- a/locales/sr_cyr.strings +++ b/locales/sr_cyr.strings @@ -1,5 +1,6 @@ +#include + "__locale" = "sr_CS.UTF-8;Srb"; -"__fallback" = "ru"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/sr_lat.strings b/locales/sr_lat.strings index 869347ae..4fd69b31 100644 --- a/locales/sr_lat.strings +++ b/locales/sr_lat.strings @@ -1,5 +1,6 @@ +#include + "__locale" = "sr_CS.UTF-8;Srb_Latin"; -"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/tr.strings b/locales/tr.strings index ea7255e8..1172c4da 100644 --- a/locales/tr.strings +++ b/locales/tr.strings @@ -1,5 +1,6 @@ +#include + "__locale" = "tr_TR.UTF-8;Tur"; -"__fallback" = "en"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ diff --git a/locales/ua.strings b/locales/ua.strings index 184eaebb..a5d45456 100644 --- a/locales/ua.strings +++ b/locales/ua.strings @@ -1,6 +1,7 @@ +#include + "__locale" = "uk_UA.utf8;Ukr"; "__WinEncoding" = "Windows-1251"; -"__fallback" = "ru"; /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ From 3d44361a76ba29671581df1c8b26b7819ad1c4dd Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Wed, 22 Dec 2021 18:21:38 +0200 Subject: [PATCH 21/25] L10n: Improve the work of exporting a language to JS with includes --- Web/Presenters/AboutPresenter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Presenters/AboutPresenter.php b/Web/Presenters/AboutPresenter.php index 4c7f916b..8809a845 100644 --- a/Web/Presenters/AboutPresenter.php +++ b/Web/Presenters/AboutPresenter.php @@ -75,7 +75,7 @@ final class AboutPresenter extends OpenVKPresenter if(is_null($lg)) $this->throwError(404, "Not found", "Language is not found"); header("Content-Type: application/javascript"); - echo "window.lang = " . json_encode($localizer->export($lang)) . ";"; // привет хардкод :DDD + echo "window.lang = " . json_encode(array_unique($localizer->export($lang))) . ";"; // привет хардкод :DDD exit; } From 21b03d3e71d39adafc8b5c9ba9c02c4e2d822c23 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Wed, 22 Dec 2021 19:09:05 +0200 Subject: [PATCH 22/25] L10n: Improve code in JavaScript tr function --- Web/static/js/l10n.js | 47 ++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/Web/static/js/l10n.js b/Web/static/js/l10n.js index 8fb53d20..f24801b8 100755 --- a/Web/static/js/l10n.js +++ b/Web/static/js/l10n.js @@ -1,36 +1,37 @@ -function tr(string, ...arg) { +function tr(string, ...args) { let output = window.lang[string]; - if(arg.length > 0) { - if(typeof arg[0] == 'number') { - let numberedStringId; - let cardinal = arg[0]; + if(args.length > 0) { + if(typeof args[0] === "number") { + const cardinal = args[0]; + let numberedString; + switch(cardinal) { case 0: - numberedString = string + '_zero'; + numberedString = string + "_zero"; break; case 1: - numberedString = string + '_one'; + numberedString = string + "_one"; break; default: - numberedString = string + (cardinal < 5 ? '_few' : '_other'); + numberedString = string + (cardinal < 5 ? "_few" : "_other"); } - let newoutput = window.lang[numberedString]; - if(newoutput === null) { - newoutput = window.lang[string + '_other']; - if(newoutput === null) { - newoutput = output; - } - } + let newOutput = window.lang[numberedString]; + if(newOutput === null) + newOutput = window.lang[string + "_other"]; - output = newoutput; + if(newOutput === null) + newOutput = output; + + output = newOutput; } } - - let i = 1; - arg.forEach(element => { - output = output.replace(RegExp('(\\$' + i + ')'), element); - i++; - }); + + if(output == null) + return "@" + string; + + for(const [ i, element ] of Object.entries(args)) + output = output.replace(RegExp("(\\$" + (Number(i) + 1) + ")"), element); + return output; -} \ No newline at end of file +} From 869873d225a2b535a4969b50810f0152a200462b Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Thu, 23 Dec 2021 12:39:20 +0200 Subject: [PATCH 23/25] About: Some fixes Translate the title and increase the size of the topic status column to fit the text there --- Web/Presenters/templates/About/Version.xml | 6 +++--- locales/en.strings | 4 ++++ locales/ru.strings | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Web/Presenters/templates/About/Version.xml b/Web/Presenters/templates/About/Version.xml index 4974c5dd..ab181dce 100644 --- a/Web/Presenters/templates/About/Version.xml +++ b/Web/Presenters/templates/About/Version.xml @@ -1,9 +1,9 @@ {extends "../@layout.xml"} -{block title}Об OpenVK{/block} +{block title}{_about_openvk}{/block} {block header} - Об OpenVK + {_about_openvk} {/block} {block content} @@ -343,7 +343,7 @@ - + diff --git a/locales/en.strings b/locales/en.strings index dfd47f2c..8410abf7 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -752,6 +752,10 @@ "paginator_page" = "Page $1"; "paginator_next" = "Next"; +/* About */ + +"about_openvk" = "About OpenVK"; + /* Dialogs */ "ok" = "OK"; diff --git a/locales/ru.strings b/locales/ru.strings index fdec87a6..3e90c5c5 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -787,6 +787,10 @@ "paginator_page" = "Страница $1"; "paginator_next" = "Дальше"; +/* About */ + +"about_openvk" = "Об OpenVK"; + /* Dialogs */ "ok" = "ОК"; From 54963cfafce96d3cb26b358be75ba62ab0686709 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Thu, 23 Dec 2021 13:19:54 +0200 Subject: [PATCH 24/25] Revert "L10n: Improve the work of exporting a language to JS with includes" I got a little confused then, it turned out to be unnecessary --- Web/Presenters/AboutPresenter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Presenters/AboutPresenter.php b/Web/Presenters/AboutPresenter.php index 8809a845..4c7f916b 100644 --- a/Web/Presenters/AboutPresenter.php +++ b/Web/Presenters/AboutPresenter.php @@ -75,7 +75,7 @@ final class AboutPresenter extends OpenVKPresenter if(is_null($lg)) $this->throwError(404, "Not found", "Language is not found"); header("Content-Type: application/javascript"); - echo "window.lang = " . json_encode(array_unique($localizer->export($lang))) . ";"; // привет хардкод :DDD + echo "window.lang = " . json_encode($localizer->export($lang)) . ";"; // привет хардкод :DDD exit; } From a95b7e571a96a8a5e6ce85aeb7ec8b17d91f0f10 Mon Sep 17 00:00:00 2001 From: Ilya Prokopenko Date: Fri, 24 Dec 2021 16:28:32 +0700 Subject: [PATCH 25/25] README, Docs: Removed unnecessary actions Submodules were removed anyway --- .gitmodules | 0 README.md | 6 ++---- docs/centos8_install.md | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29b..00000000 diff --git a/README.md b/README.md index f00a179c..72991be0 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ To be honest, we don't even know whether it even works. However, this version is Please use the master branch, as it has the most changes. -Updating the source code is done with this command: `git pull --recurse-submodules` +Updating the source code is done with this command: `git pull` ## Instances @@ -29,7 +29,7 @@ If you want, you can add your instance to the list above so that people can regi * PHP 8 has **not** yet been tested, so you should not expect it to work. 2. Install [commitcaptcha](https://github.com/openvk/commitcaptcha) and OpenVK as Chandler extensions like this: ``` -git clone --recursive https://github.com/openvk/openvk /path/to/chandler/extensions/available/openvk +git clone https://github.com/openvk/openvk /path/to/chandler/extensions/available/openvk git clone https://github.com/openvk/commitcaptcha /path/to/chandler/extensions/available/commitcaptcha ``` 3. And enable them: @@ -44,8 +44,6 @@ ln -s /path/to/chandler/extensions/available/openvk /path/to/chandler/extensions 8. Move to `Web/static/js` and execute `yarn install` 9. Set `openvk` as your root app in `chandler.yml` -**Note**: If OVK submodules were not downloaded beforehand (i.e. `--recursive` was not used during cloning), this command *must be* executed in the `openvk` folder: `git submodule update --init` - Once you are done, you can login as a system administrator on the network itself (no registration required): * **Login**: `admin@localhost.localdomain6` * **Password**: `admin` diff --git a/docs/centos8_install.md b/docs/centos8_install.md index 91770a05..97437858 100644 --- a/docs/centos8_install.md +++ b/docs/centos8_install.md @@ -154,7 +154,7 @@ composer2 install ```bash cd .. -git clone --recursive https://github.com/openvk/openvk.git +git clone https://github.com/openvk/openvk.git cd openvk/ composer2 install cd Web/static/js
{_sender}:
NameStatusStatus Version Description Author