From 7721ee0c918903e0fd4de56f914de680bd84b987 Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Sun, 12 Jan 2025 21:54:03 +0300 Subject: [PATCH] add DOCUMENT support --- stylesheet.css | 172 ++++++++++++++++++++++++++++- tpl/@layout.xml | 16 ++- tpl/Documents/ApiGetContext.xml | 9 ++ tpl/Documents/List.xml | 65 +++++++++++ tpl/Documents/Page.xml | 56 ++++++++++ tpl/Documents/Upload.xml | 65 +++++++++++ tpl/Documents/components/doc.xml | 37 +++++++ tpl/Documents/components/image.xml | 19 ++++ tpl/Search/Index.xml | 9 ++ tpl/User/Edit.xml | 9 +- tpl/User/Friends.xml | 18 ++- tpl/User/View.xml | 12 ++ tpl/components/attachment.xml | 8 ++ 13 files changed, 478 insertions(+), 17 deletions(-) create mode 100644 tpl/Documents/ApiGetContext.xml create mode 100644 tpl/Documents/List.xml create mode 100644 tpl/Documents/Page.xml create mode 100644 tpl/Documents/Upload.xml create mode 100644 tpl/Documents/components/doc.xml create mode 100644 tpl/Documents/components/image.xml diff --git a/stylesheet.css b/stylesheet.css index 1feeafc..912f885 100755 --- a/stylesheet.css +++ b/stylesheet.css @@ -923,9 +923,9 @@ img.rounded, .real_post > .author .ava { max-width:200px; text-overflow: ellipsis; } -/* Подписывайтесь на мой YouTube: youtube.com/DanielM */ +/* Подписывайтесь на мой YouTube: youtube.com/@DanielM */ -/*.spisochek { +/*.spisochek { я обожаю блять транслит width: 100%; } .spisochek .spisok .ava { @@ -2824,3 +2824,171 @@ select { .ovk-diag-action > .button { margin-left: 10px; } + +#docs_page_wrapper { + display: block; +} + +#docs_page_wrapper .docs_page_search { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + gap: 10px; + border-bottom: 1px solid #CCCCCC; + background: #F0F0F0; + padding: 0px 10px; +} + +#docs_page_wrapper .docs_page_search input[type="search"], .attachment_selector .attachment_search input { + width: 100%; + background: url('/assets/packages/static/openvk/img/search_icon.png') no-repeat 3px 5px; + background-color: #fff; + padding-left: 18px !important; +} + +#docs_page_wrapper .container_white { + display: flex; + flex-direction: column; + padding: 5px 10px; +} + +#docs_page_wrapper .docs_page_content.docs_page_gallery .scroll_container { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); + gap: 10px; + padding: 10px 10px; +} + +.docGalleryItem { + height: 200px; + cursor: pointer; + position: relative; + /*width: 200px;*/ +} + +.docGalleryItem img { + width: 100%; + height: 100%; + display: block; + object-fit: cover; +} + +.docGalleryItem .doc_bottom_panel { + position: absolute; + bottom: 0px; + background: rgba(1, 1, 1, 0.7); + padding: 6px 6px; + width: 100%; + + display: grid; + grid-template-columns: 1fr 0fr; +} + +.docGalleryItem .doc_bottom_panel span { + color: white; +} + +.docGalleryItem .doc_bottom_panel .doc_bottom_panel_size { + max-width: 60px; + width: max-content; +} + +.docListViewItem { + min-height: 38px; + display: grid; + grid-template-columns: 0fr 1fr 0fr; + gap: 10px; + padding: 7px 7px; + border-bottom: 1px solid #EDEDED; +} + +.docs_page_content .docListViewItem:last-of-type { + border-bottom: unset !important; +} + +.docListViewItem:hover, .attachButton:hover { + background: #f7f7f7; +} + +.docListViewItem .doc_icon { + width: 50px; + height: 38px; + background: #E6E6E6; + user-select: none; + object-fit: cover; + border-radius: 2px; +} + +.docListViewItem .doc_content { + display: flex; + flex-direction: column; + margin-top: 1px; + /*gap: 5px;*/ +} + +.docListViewItem .doc_content b { + color: black; +} + +.docListViewItem .doc_content .doc_content_info, .docListViewItem .doc_content span { + color: #6d6d6d; +} + +.docListViewItem .doc_icon.no_image { + display: flex; + align-items: center; + justify-content: center; + border-radius: 2px; + height: 17px; + padding: 2px 0px; +} + +.docListViewItem .doc_icon.no_image span { + color: #6b6b6b; +} + +.docListViewItem .doc_icon img { + width: 100%; + height: 100%; + object-fit: cover; +} + +.docListViewItem .doc_volume { + display: flex; + align-items: center; + gap: 5px; + visibility: hidden; +} + +.docListViewItem .doc_volume > div { + width: 20px; + height: 20px; + background: url('/assets/packages/static/openvk/img/docs_controls.png?v=8'); +} + +.media-page-wrapper .photo-page-wrapper-photo { + margin-bottom: 8pt; + text-align: center; +} + +.media-page-wrapper .video-page-wrapper-video iframe { + width: 100%; +} + +.media-page-wrapper .photo-page-wrapper-photo img { + max-width: 85%; + max-height: 60vh; +} + +.media-page-author-block { + display: flex; + align-items: center; + gap: 7px; + margin-bottom: 5px; + padding: 0px 14px; +} + +.media-page-author-block img { + width: 30px; +} diff --git a/tpl/@layout.xml b/tpl/@layout.xml index 2b5cc23..7f10c73 100755 --- a/tpl/@layout.xml +++ b/tpl/@layout.xml @@ -1,5 +1,3 @@ -
- @@ -12,7 +10,7 @@ - + {script "js/l10n.js"} @@ -31,6 +29,7 @@ +
+
+ + {_s_documents} + +
@@ -218,6 +223,10 @@ + {elseif $section === 'docs'} +
+ {include "../Documents/components/doc.xml", doc => $dat, copyImportance => true} +
{/if} {include "../components/paginator.xml", conf => (object) [ "page" => $page, diff --git a/tpl/User/Edit.xml b/tpl/User/Edit.xml index 2c9dd37..79cc3d9 100755 --- a/tpl/User/Edit.xml +++ b/tpl/User/Edit.xml @@ -89,10 +89,11 @@
- - + + +
diff --git a/tpl/User/Friends.xml b/tpl/User/Friends.xml index 02ee08c..8288030 100755 --- a/tpl/User/Friends.xml +++ b/tpl/User/Friends.xml @@ -4,14 +4,20 @@ {var act = $_GET["act"] ?? "friends"} {if $act == "incoming"} - {var iterator = iterator_to_array($user->getFollowers($page))} - {var count = $user->getFollowersCount()} + {var $iterator = iterator_to_array($user->getRequests($page))} + {var $count = $user->getRequestsCount()} {elseif $act == "outcoming"} - {var iterator = iterator_to_array($user->getSubscriptions($page))} - {var count = $user->getSubscriptionsCount()} + {var $iterator = iterator_to_array($user->getSubscriptions($page))} + {var $count = $user->getSubscriptionsCount()} +{elseif $act == "followers"} + {var $iterator = iterator_to_array($user->getFollowers($page))} + {var $count = $user->getFollowersCount()} +{elseif $act == "online"} + {var $iterator = iterator_to_array($user->getFriendsOnline($page))} + {var $count = $user->getFriendsOnlineCount()} {else} - {var iterator = iterator_to_array($user->getFriends($page))} - {var count = $user->getFriendsCount()} + {var $iterator = iterator_to_array($user->getFriends($page))} + {var $count = $user->getFriendsCount()} {/if} {block title} diff --git a/tpl/User/View.xml b/tpl/User/View.xml index 04060b6..f43c500 100755 --- a/tpl/User/View.xml +++ b/tpl/User/View.xml @@ -198,6 +198,12 @@ {_address}: {$user->getPhysicalAddress()} + {if $additionalFields} + + {$field->getName()}: + {$field->getContent()} + + {/if}
@@ -225,6 +231,12 @@ {_favorite_quotes}: {$user->getFavoriteQuote()} + {if $additionalFields} + + {$field->getName()}: + {$field->getContent()} + + {/if} {_information_about}: {$user->getDescription()} diff --git a/tpl/components/attachment.xml b/tpl/components/attachment.xml index 882a8ca..70a7b7e 100755 --- a/tpl/components/attachment.xml +++ b/tpl/components/attachment.xml @@ -39,6 +39,14 @@ {include "../Audio/player.xml", audio => $attachment} {elseif $attachment instanceof \openvk\Web\Models\Entities\Poll} {presenter "openvk!Poll->view", $attachment->getId()} +{elseif $attachment instanceof \openvk\Web\Models\Entities\Document} +
+ {if $attachment->isImage()} + {include "../Documents/components/image.xml", doc => $attachment, copyImportance => true, showInfo => true} + {else} + {include "../Documents/components/doc.xml", doc => $attachment, copyImportance => true, noTags => true} + {/if} +
{else} {_"version_incompatibility"} {/if}