From dd97ded32606707d7617a1b83aabd654f8bbcec3 Mon Sep 17 00:00:00 2001 From: lalka2018 <99399973+lalka2016@users.noreply.github.com> Date: Tue, 13 Jun 2023 20:57:49 +0300 Subject: [PATCH] Search: some fixes (#896) --- Web/Models/Repositories/Videos.php | 2 +- Web/Presenters/templates/Search/Index.xml | 30 ++++++++++--------- .../templates/components/comment.xml | 16 +++++++++- Web/static/js/openvk.cls.js | 2 +- locales/en.strings | 3 ++ locales/ru.strings | 3 ++ locales/ru_old.strings | 3 ++ locales/ru_sov.strings | 3 ++ 8 files changed, 45 insertions(+), 17 deletions(-) diff --git a/Web/Models/Repositories/Videos.php b/Web/Models/Repositories/Videos.php index 30753371..63273349 100644 --- a/Web/Models/Repositories/Videos.php +++ b/Web/Models/Repositories/Videos.php @@ -58,7 +58,7 @@ class Videos else $paramValue != NULL ? $notNullParams+=["$paramName" => "$paramValue"] : NULL; - $result = $this->videos->where("name OR description LIKE ?", $query)->where("deleted", 0); + $result = $this->videos->where("CONCAT_WS(' ', name, description) LIKE ?", $query)->where("deleted", 0); $nnparamsCount = sizeof($notNullParams); if($nnparamsCount > 0) { diff --git a/Web/Presenters/templates/Search/Index.xml b/Web/Presenters/templates/Search/Index.xml index 828ffe62..4d629890 100644 --- a/Web/Presenters/templates/Search/Index.xml +++ b/Web/Presenters/templates/Search/Index.xml @@ -89,7 +89,7 @@ {if !is_null($_GET['address']) && $_GET['address'] != "" && $x->getPrivacySetting("page.info.read") > 1} {_address}: - {$x->getPhysicalAddress()} + {$x->getPhysicalAddress()} {/if} {if $x->getPrivacySetting("page.info.read") > 1} @@ -114,7 +114,7 @@ {_description}: {/if} - + {$x->getDescription() ?? '(' . tr("none") . ')'} @@ -204,13 +204,9 @@ {elseif $type == "videos"} {foreach $data as $dat} - {if $dat->getOwner()->isDeleted()} - {php continue;} - {else}
{include "../components/video.xml", video => $dat}
- {/if} {/foreach} {elseif $type == "audios"} хуй @@ -239,9 +235,7 @@
  • {_s_comments} {if $type === "comments"}({$count}){/if}
  • {_s_posts} {if $type === "posts"} ({$count}){/if}
  • {_s_videos} {if $type === "videos"} ({$count}){/if}
  • -
  • {_s_apps} {if $type === "apps"} ({$count}){/if}
  • -
    @@ -262,11 +256,15 @@
    - {if $type !== "groups" && $type !== "apps"} {* В OpenVK не сохраняется дата создания группы *} + {if $type !== "groups" && $type !== "apps"} {* В OpenVK не сохраняется дата создания групп и приложений *}
    {_s_by_date}
    -

    {_s_date_before}:
    + {if $type != "users"} +

    {_s_date_before}:
    + {else} +

    {_s_registered_before}:
    + {/if}

    -

    {_s_date_after}:
    + {if $type != "users"} +

    {_s_date_after}:
    + {else} +

    {_s_registered_after}:
    + {/if}

    {_gender}
    -

    {_male}

    -

    {_female}

    -

    {_s_any}

    +

    {_male}

    +

    {_female}

    +

    {_s_any}

    diff --git a/Web/Presenters/templates/components/comment.xml b/Web/Presenters/templates/components/comment.xml index 0c725714..0016e4e5 100644 --- a/Web/Presenters/templates/components/comment.xml +++ b/Web/Presenters/templates/components/comment.xml @@ -29,7 +29,21 @@
    - {$comment->getPublicationTime()} | + {var $target = "wall"} + + {if get_class($comment->getTarget()) == "openvk\Web\Models\Entities\Note"} + {php $target = "note"} + {elseif get_class($comment->getTarget()) == "openvk\Web\Models\Entities\Post"} + {php $target = "wall"} + {elseif get_class($comment->getTarget()) == "openvk\Web\Models\Entities\Photo"} + {php $target = "photo"} + {elseif get_class($comment->getTarget()) == "openvk\Web\Models\Entities\Video"} + {php $target = "video"} + {elseif get_class($comment->getTarget()) == "openvk\Web\Models\Entities\Topic"} + {php $target = "topic"} + {/if} + + {$comment->getPublicationTime()} | {if $comment->canBeDeletedBy($thisUser)} {_delete} | {/if} diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js index 19eff78f..31b7aa5d 100644 --- a/Web/static/js/openvk.cls.js +++ b/Web/static/js/openvk.cls.js @@ -629,7 +629,7 @@ function resetSearch() for(const input of inputs) { - if(input != dnt) { + if(input != dnt && input != gend && input != gend1 && input != gend2) { input.value = "" } } diff --git a/locales/en.strings b/locales/en.strings index b36ec078..ab53f054 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -485,6 +485,7 @@ "search_for_videos" = "Search for videos"; "search_for_apps" = "Search for apps"; "search_for_notes" = "Search for notes"; +"search_for_audios" = "Search for music"; "search_button" = "Find"; "search_placeholder" = "Start typing any name, title or word"; "results_zero" = "No results"; @@ -1487,6 +1488,8 @@ "s_order_invert" = "Invert"; "s_by_date" = "By date"; +"s_registered_before" = "Registered before"; +"s_registered_after" = "Registered after"; "s_date_before" = "Before"; "s_date_after" = "After"; diff --git a/locales/ru.strings b/locales/ru.strings index dd3157e2..2ef821a0 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -459,6 +459,7 @@ "search_for_videos" = "Поиск видео"; "search_for_apps" = "Поиск приложений"; "search_for_notes" = "Поиск записок"; +"search_for_audios" = "Поиск музыки"; "search_button" = "Найти"; "search_placeholder" = "Начните вводить любое имя, название или слово"; "results_zero" = "Ни одного результата"; @@ -1381,6 +1382,8 @@ "s_order_invert" = "Инвертировать"; "s_by_date" = "По дате"; +"s_registered_before" = "Зарегистрирован до"; +"s_registered_after" = "Зарегистрирован после"; "s_date_before" = "До"; "s_date_after" = "После"; diff --git a/locales/ru_old.strings b/locales/ru_old.strings index c75889db..d0917f65 100644 --- a/locales/ru_old.strings +++ b/locales/ru_old.strings @@ -414,6 +414,7 @@ "search_for_videos" = "Поискъ синематографовъ"; "search_for_apps" = "Поискъ забав"; "search_for_notes" = "Поискъ запiсокъ"; +"search_for_audios" = "Поиск музыкъ"; "search_button" = "Найти"; "results_zero" = "Ни одного результата"; "results_one" = "Одинъ результатъ"; @@ -757,6 +758,8 @@ "s_order_invert" = "Отразiть"; "s_by_date" = "По датѣ"; +"s_registered_before" = "Зарѣгистрированъ до"; +"s_registered_after" = "Зарѣгистрированъ после"; "s_date_before" = "До"; "s_date_after" = "После"; diff --git a/locales/ru_sov.strings b/locales/ru_sov.strings index 56b3cffe..903910a1 100644 --- a/locales/ru_sov.strings +++ b/locales/ru_sov.strings @@ -433,6 +433,7 @@ "search_for_videos" = "Розыск кинолент"; "search_for_apps" = "Розыск приложений"; "search_for_notes" = "Розыск записок"; +"search_for_audios" = "Розыск аудио"; "search_button" = "Найти"; "search_placeholder" = "Начните вводить любое имя, название или слово"; @@ -962,6 +963,8 @@ "s_order_invert" = "Отразить"; "s_by_date" = "По дате"; +"s_registered_before" = "Зарегистрирован до"; +"s_registered_after" = "Зарегистрирован после"; "s_date_before" = "До"; "s_date_after" = "После";