mirror of
https://github.com/openvk/openvk
synced 2024-12-22 08:31:18 +03:00
Compare commits
2 commits
a714a0aa16
...
ba5e2dba3c
Author | SHA1 | Date | |
---|---|---|---|
|
ba5e2dba3c | ||
|
959a6d6ac3 |
10 changed files with 58 additions and 6 deletions
|
@ -639,7 +639,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
$res['name'] = 'Geopoint';
|
||||
}
|
||||
|
||||
$post->setGeo(json_encode($res));
|
||||
$post->setGeo($res);
|
||||
$post->setGeo_Lat($latitude);
|
||||
$post->setGeo_Lon($longitude);
|
||||
}
|
||||
|
|
|
@ -463,6 +463,21 @@ class Post extends Postable
|
|||
return (object) json_decode($this->getRecord()->geo, true, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
function setGeo($encoded_object): void
|
||||
{
|
||||
$final_geo = $encoded_object['name'];
|
||||
$neutral_names = ["Россия", "Russia", "Росія", "Россія", "Украина", "Ukraine", "Україна", "Украіна"];
|
||||
foreach($neutral_names as $name) {
|
||||
if(str_contains($final_geo, $name.", ")) {
|
||||
$final_geo = str_replace($name.", ", "", $final_geo);
|
||||
}
|
||||
}
|
||||
|
||||
$encoded_object['name'] = ovk_proc_strtr($final_geo, 255);
|
||||
$encoded = json_encode($encoded_object);
|
||||
$this->stateChanges("geo", $encoded);
|
||||
}
|
||||
|
||||
function getLat(): ?float
|
||||
{
|
||||
return (float) $this->getRecord()->geo_lat ?? NULL;
|
||||
|
@ -478,6 +493,7 @@ class Post extends Postable
|
|||
return (object) [
|
||||
'type' => 'point',
|
||||
'coordinates' => $this->getLat() . ',' . $this->getLon(),
|
||||
'name' => $this->getGeo()->name,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ final class WallPresenter extends OpenVKPresenter
|
|||
$post->setSuggested(1);
|
||||
|
||||
if ($geo) {
|
||||
$post->setGeo(json_encode($geo));
|
||||
$post->setGeo($geo);
|
||||
$post->setGeo_Lat($latitude);
|
||||
$post->setGeo_Lon($longitude);
|
||||
}
|
||||
|
|
|
@ -856,6 +856,10 @@ h4 {
|
|||
padding: 0 4px;
|
||||
}
|
||||
|
||||
#geo-name {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.post-signature span {
|
||||
color: grey;
|
||||
}
|
||||
|
@ -2852,7 +2856,7 @@ a.poll-retract-vote {
|
|||
.page_header.search_expanded .header_navigation #search_box #searchBoxFastTips.shown {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
z-index: 2;
|
||||
z-index: 11;
|
||||
}
|
||||
|
||||
.page_header.search_expanded_at_all .header_navigation #search_box #searchBoxFastTips.shown {
|
||||
|
|
|
@ -138,7 +138,7 @@ u(`#search_box input[type='search']`).on('input', async (e) => {
|
|||
u('#searchBoxFastTips').html('')
|
||||
json_result.items.forEach(item => {
|
||||
u('#searchBoxFastTips').append(`
|
||||
<a href='${item['url']}'>
|
||||
<a href='${item['url']}' ${section == 'videos' ? `id='videoOpen' data-id="${item['owner_id']}_${item['id']}"` : ''}>
|
||||
<img src='${item['preview']}' class='search_tip_preview_block'>
|
||||
<div class='search_tip_info_block'>
|
||||
<b>${ovk_proc_strtr(item['name'].escapeHtml(), 50)}</b>
|
||||
|
|
|
@ -2634,7 +2634,7 @@ u(document).on('click', "#__geoAttacher", async (e) => {
|
|||
const marker = {
|
||||
lat: currentMarker._latlng.lat,
|
||||
lng: currentMarker._latlng.lng,
|
||||
name: escapeHtml(geo_name)
|
||||
name: geo_name
|
||||
}
|
||||
buttons.find(`input[name='geo']`).nodes[0].value = JSON.stringify(marker)
|
||||
buttons.find(`.post-has-geo`).html(`
|
||||
|
@ -2712,6 +2712,25 @@ u(document).on('click', '.post-has-geo #small_remove_button', (e) => {
|
|||
form.find(`input[name='geo']`).nodes[0].value = ''
|
||||
})
|
||||
|
||||
u(document).on('click', '#geo-name', (e) => {
|
||||
const current_value = escapeHtml(e.target.innerHTML)
|
||||
const msg = new CMessageBox({
|
||||
title: tr('change_geo_name'),
|
||||
unique_name: 'geo_change_name_menu',
|
||||
body: `
|
||||
<div>
|
||||
<input type="text" maxlength="255" name="final_value" placeholder="${tr('change_geo_name_new')}" value="${current_value}">
|
||||
</div>
|
||||
`,
|
||||
buttons: [tr('save'), tr('cancel')],
|
||||
callbacks: [() => {
|
||||
const new_value = u(`input[name='final_value']`).nodes[0].value
|
||||
u('#geo-name').html(escapeHtml(new_value))
|
||||
}, Function.noop]
|
||||
})
|
||||
u(`input[name='final_value']`).nodes[0].focus()
|
||||
})
|
||||
|
||||
function openGeo(data, owner_id, virtual_id) {
|
||||
MessageBox(tr("geotag"), "<div id=\"osm-map\"></div>", [tr("nearest_posts"), tr("close")], [async () => {
|
||||
const posts = await OVKAPI.call('wall.getNearby', {owner_id: owner_id, post_id: virtual_id})
|
||||
|
|
|
@ -102,6 +102,8 @@ window.router = new class {
|
|||
} else {
|
||||
if(u('.page_header').hasClass('search_expanded_at_all')) {
|
||||
u('.page_header').removeClass('search_expanded_at_all').removeClass('search_expanded')
|
||||
} else {
|
||||
u('.page_header').removeClass('search_expanded')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -298,13 +298,18 @@ function short_geo_name(address_osm)
|
|||
final_arr.push(address_osm.state_district)
|
||||
}
|
||||
if(address_osm.city) {
|
||||
final_arr.push(address_osm.city)
|
||||
if(address_osm.city != address_osm.state) {
|
||||
final_arr.push(address_osm.city)
|
||||
}
|
||||
} else if(address_osm.town) {
|
||||
final_arr.push(address_osm.town)
|
||||
}
|
||||
if(address_osm.city_district) {
|
||||
final_arr.push(address_osm.city_district)
|
||||
}
|
||||
if(address_osm.village) {
|
||||
final_arr.push(address_osm.village)
|
||||
}
|
||||
if(address_osm.road) {
|
||||
final_arr.push(address_osm.road)
|
||||
}
|
||||
|
|
|
@ -291,6 +291,9 @@
|
|||
"no_nearest_posts" = "No nearby posts";
|
||||
"shown_last_nearest_posts" = "Showing last $1 posts per month";
|
||||
|
||||
"change_geo_name" = "Change geo name";
|
||||
"change_geo_name_new" = "New name";
|
||||
|
||||
/* Friends */
|
||||
|
||||
"friends" = "Friends";
|
||||
|
|
|
@ -270,6 +270,9 @@
|
|||
"no_nearest_posts" = "Нет ближайших постов";
|
||||
"shown_last_nearest_posts" = "Показаны последние $1 постов за месяц";
|
||||
|
||||
"change_geo_name" = "Изменить название точки";
|
||||
"change_geo_name_new" = "Новое название";
|
||||
|
||||
/* Friends */
|
||||
|
||||
"friends" = "Друзья";
|
||||
|
|
Loading…
Reference in a new issue