From dafc18c11804954a734b1bbbe10d92e04c09edda Mon Sep 17 00:00:00 2001 From: lalka2016 <99399973+lalka2016@users.noreply.github.com> Date: Fri, 11 Aug 2023 10:01:54 +0300 Subject: [PATCH 1/5] Maybe it works --- Web/Models/Entities/User.php | 5 ++ Web/Presenters/PhotosPresenter.php | 4 +- Web/Presenters/UserPresenter.php | 3 + Web/Presenters/templates/@listView.xml | 4 +- Web/Presenters/templates/Notes/List.xml | 4 +- Web/Presenters/templates/User/Settings.xml | 11 ++++ Web/Presenters/templates/Wall/Feed.xml | 8 ++- Web/Presenters/templates/Wall/HashtagFeed.xml | 2 +- Web/Presenters/templates/Wall/Wall.xml | 2 +- .../templates/components/comment.xml | 2 +- .../templates/components/comments.xml | 2 + .../templates/components/paginator.xml | 17 ++---- .../templates/components/paginators/new.xml | 5 ++ .../templates/components/paginators/old.xml | 12 ++++ Web/Presenters/templates/components/post.xml | 2 + Web/Presenters/templates/components/wall.xml | 2 +- Web/static/css/main.css | 20 +++++++ Web/static/js/al_comments.js | 2 +- Web/static/js/al_mentions.js | 5 ++ Web/static/js/al_wall.js | 59 ++++++++++++++++++- install/sqls/000XX-better-paginator.sql | 1 + locales/en.strings | 9 +++ locales/ru.strings | 8 +++ 23 files changed, 163 insertions(+), 26 deletions(-) create mode 100644 Web/Presenters/templates/components/paginators/new.xml create mode 100644 Web/Presenters/templates/components/paginators/old.xml create mode 100644 install/sqls/000XX-better-paginator.sql diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index d132e015..215c7cba 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -1113,6 +1113,11 @@ class User extends RowModel return true; } + function getPaginatorType() + { + return $this->getRecord()->paginator_type; + } + function toVkApiStruct(): object { $res = (object) []; diff --git a/Web/Presenters/PhotosPresenter.php b/Web/Presenters/PhotosPresenter.php index 345b2c60..5aea8a7e 100644 --- a/Web/Presenters/PhotosPresenter.php +++ b/Web/Presenters/PhotosPresenter.php @@ -27,7 +27,7 @@ final class PhotosPresenter extends OpenVKPresenter if(!$user) $this->notFound(); if (!$user->getPrivacyPermission('photos.read', $this->user->identity ?? NULL)) $this->flashFail("err", tr("forbidden"), tr("forbidden_comment")); - $this->template->albums = $this->albums->getUserAlbums($user, $this->queryParam("p") ?? 1); + $this->template->albums = $this->albums->getUserAlbums($user, (int)($this->queryParam("p") ?? 1)); $this->template->count = $this->albums->getUserAlbumsCount($user); $this->template->owner = $user; $this->template->canEdit = false; @@ -36,7 +36,7 @@ final class PhotosPresenter extends OpenVKPresenter } else { $club = (new Clubs)->get(abs($owner)); if(!$club) $this->notFound(); - $this->template->albums = $this->albums->getClubAlbums($club, $this->queryParam("p") ?? 1); + $this->template->albums = $this->albums->getClubAlbums($club, (int)($this->queryParam("p") ?? 1)); $this->template->count = $this->albums->getClubAlbumsCount($club); $this->template->owner = $club; $this->template->canEdit = false; diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 9cfa3654..ada4652a 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -471,6 +471,9 @@ final class UserPresenter extends OpenVKPresenter if(in_array($this->postParam("main_page"), [0, 1])) $user->setMain_Page((int) $this->postParam("main_page")); + + if(in_array($this->postParam("paginator"), [0, 1])) + $user->setPaginator_type((int) $this->postParam("paginator")); } else if($_GET['act'] === "lMenu") { $settings = [ "menu_bildoj" => "photos", diff --git a/Web/Presenters/templates/@listView.xml b/Web/Presenters/templates/@listView.xml index 34739b59..decd1cd0 100644 --- a/Web/Presenters/templates/@listView.xml +++ b/Web/Presenters/templates/@listView.xml @@ -15,11 +15,11 @@ {ifset specpage} {include specpage, x => $dat} {else} -