Skip to content

Commit

Permalink
add DOCUMENT support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrilyew committed Jan 12, 2025
1 parent bde6a27 commit 7721ee0
Show file tree
Hide file tree
Showing 13 changed files with 478 additions and 17 deletions.
172 changes: 170 additions & 2 deletions stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
16 changes: 11 additions & 5 deletions tpl/@layout.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<div class="bluebar"></div>

<html n:if="!isset($parentModule) || substr($parentModule, 0, 21) === 'libchandler:absolute.'">

<head>
Expand All @@ -12,7 +10,7 @@
<meta name="application-name" content="OpenVK" />
<meta n:ifset="$csrfToken" name="csrf" value="{$csrfToken}" />

<link rel="stylesheet" href="/themepack/mobile_ovk/0.0.1.0/stylesheet/styles.css?v=51" />
<link rel="stylesheet" href="/themepack/mobile_ovk/0.0.1.0/stylesheet/styles.css?v=52" />
<link rel="stylesheet" href="/themepack/mobile_ovk/0.0.1.0/resource/vendor/pure-grid.css" />
<script src="/language/{php echo getLanguage()}.js" crossorigin="anonymous"></script>
{script "js/l10n.js"}
Expand All @@ -31,6 +29,7 @@


<body class="app_layer">
<div class="bluebar"></div>
<div class="app">
<div class="navigation">
<div class="headername">
Expand Down Expand Up @@ -99,7 +98,7 @@
<a n:if="$thisUser->getLeftMenuItemStatus('videos')" href="/videos{$thisUser->getId()}"><div class="mobile_icons" id="video">{_mobile_videos} </div></a>
</li>
<li class="element prmenu">
<a n:if="$thisUser->getLeftMenuItemStatus('notes')" href="/notes{$thisUser->getId()}"><div class="mobile_icons" id="notfg">{_mobile_notes} </div></a>
<a n:if="$thisUser->getLeftMenuItemStatus('docs')" href="/docs"><div class="mobile_icons" id="notfg">{_documents} </div></a>
</li>
<li class="element prmenu">
<a n:if="$thisUser->getLeftMenuItemStatus('messages')" href="/im">
Expand Down Expand Up @@ -150,7 +149,14 @@
<a href="/logout?hash={urlencode($csrfToken)}"> <div class="mobile_icons" id="exit">{_mobile_log_out}</div></a>
</li>
</ul>

{if $thisUser->getPinnedClubCount() > 0}
<div class="space_menu"></div>
<ul class="menu">
<li n:foreach="$thisUser->getPinnedClubs() as $club" class="element prmenu gray">
<a href="{$club->getURL()}"><div class="mobile_icons" id="fr">{ovk_proc_strtr($club->getName(), 14)}</div></a>
</li>
</ul>
{/if}
</div>


Expand Down
9 changes: 9 additions & 0 deletions tpl/Documents/ApiGetContext.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<input type="hidden" name="count" value="{$count}">
<input type="hidden" name="pagesCount" value="{$pagesCount}">
<input type="hidden" name="page" value="{$page}">

{foreach $docs as $doc}
<div class='display_flex_row _content' data-attachmentdata="{$doc->getVirtualId()}_{$doc->getId()}_{$doc->getAccessKey()}" data-name='{$doc->getName()}'>
{include "components/doc.xml", doc => $doc, hideButtons => true}
</div>
{/foreach}
65 changes: 65 additions & 0 deletions tpl/Documents/List.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{extends "../@layout.xml"}

{block title}
{if !isset($group)}
{_my_documents_objectively}
{else}
{_documents_of_group}
{/if}
{/block}

{block header}
{if !isset($group)}
{_my_documents}
{else}
<a href="{$group->getURL()}">{$group->getCanonicalName()}</a> »
{_my_documents}
{/if}
{/block}

{block body}
{var $is_gallery = $current_tab == 3 || $current_tab == 4}
<div id="docs_page_wrapper">
<div class="docs_page_search">
<form action="/search" method="get" style="margin: 11px 0px;">
<input type="hidden" name="section" value="docs">
<input type="search" name="q" class="input_with_search_icon" placeholder="{_search_by_documents}">
</form>
<a n:if="$canUpload" href="/docs/upload{if isset($group)}?gid={$group->getId()}{/if}"><input id="upload_entry_point" class="button" type="button" value="{_upload_button}"></a>
</div>
<div n:if="sizeof($tabs) > 1" class="docs_page_tabs" style="padding: 15px 10px;">
<div class="mb_tabs">
<div class="tab" n:attr="id => $current_tab == 0 ? activetabs">
<a href="?tab=0">{_document_type_0}</a>
</div>
<div n:foreach="$tabs as $tab" class="tab" n:attr="id => $tab['type'] == $current_tab ? activetabs">
<a href="?tab={$tab['type']}" n:attr="id => $tab['type'] == $current_tab ? act_tab_a">
{$tab["name"]}
<span n:if="$tab['count'] > 1" class="special_counter">{$tab["count"]}</span>
</a>
</div>
</div>
</div>
<div n:class="docs_page_content, $is_gallery ? docs_page_gallery">
<div class="summaryBar display_flex_row display_flex_space_between" style="padding: 7px 11px;">
<b class="summary">{tr($locale_string, $count)}.</b>
</div>
<div n:attr="id => !$is_gallery && sizeof($tags) > 0 ? search_page">
<div n:class="container_white, scroll_container, !$is_gallery && sizeof($tags) > 0 ? page_wrap_content_main">
{if $count > 0}
{foreach $docs as $doc}
{if $is_gallery}
{include "components/image.xml", doc => $doc, scroll_context => true, club => isset($group) ? $group : NULL}
{else}
{include "components/doc.xml", doc => $doc, scroll_context => true, club => isset($group) ? $group : NULL}
{/if}
{/foreach}
{else}
{include "../components/error.xml", description => tr("there_is_no_documents_alright")}
{/if}
</div>
</div>
{include "../components/paginator.xml", conf => $paginatorConf}
</div>
</div>
{/block}
56 changes: 56 additions & 0 deletions tpl/Documents/Page.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{extends "../@layout.xml"}

{block title}
{_document} "{ovk_proc_strtr($doc->getName(), 20)}"
{/block}

{block header}
{$doc->getName()}
{/block}

{block body}
<div class='media-page-wrapper photo-page-wrapper'>
<div class='photo-page-wrapper-photo'>
{if $is_image}
<img alt="doc image" src="{$doc->getURL()}" />
{else}
<a href="{$doc->getURL()}" download="{downloadable_name($doc->getName())}">
<input class="button" type="button" value="{_download_file}">
</a>
{/if}
</div>

<div class='ovk-photo-details'>
<div class='media-page-wrapper-description' style="padding: 10px 20px;">
<p n:if='sizeof($tags) > 0'>
{foreach $tags as $tag}
<a href="/search?section=docs&tags={urlencode($tag)}">
{$tag}{if $tag != $tags[sizeof($tags) - 1]},{/if}
</a>
{/foreach}
</p>
<div class='upload_time'>
{_info_upload_date}: {$doc->getPublicationTime()}
</div>
</div>

<hr/>

<div class="media-page-wrapper-details">
<div class='media-page-wrapper-comments'></div>
<div class='media-page-wrapper-actions docMainItem' data-context="page" data-id="{$doc->getPrettiestId()}">
{if !$doc->isOwnerHidden()}
{var $owner = $doc->getOwner()}
<a href="{$owner->getURL()}" class='media-page-author-block'>
<img class='cCompactAvatars' src="{$owner->getAvatarURL('miniscule')}">

<div class='media-page-author-block-name'>
<b>{$owner->getCanonicalName()}</b>
</div>
</a>
{/if}
</div>
</div>
</div>
</div>
{/block}
Loading

0 comments on commit 7721ee0

Please sign in to comment.