- {$post->getText()|noescape} + {$post->getText()|noescape}
@@ -88,7 +88,7 @@
- {$post->getPublicationTime()} + {$post->getPublicationTime()} @@ -124,6 +124,10 @@ {include "../textArea.xml", route => $commentsURL, postOpts => false, graffiti => (bool) ovkGetQuirk("comments.allow-graffiti"), post => $post, club => $club}
+
+ + +
diff --git a/Web/routes.yml b/Web/routes.yml index d1a0e7ae..2dbc8a2b 100644 --- a/Web/routes.yml +++ b/Web/routes.yml @@ -201,6 +201,10 @@ routes: handler: "Group->admin" - url: "/club{num}/setAdmin" handler: "Group->modifyAdmin" + - url: "/club{num}/suggested" + handler: "Group->suggestedThisUser" + - url: "/club{num}/suggested/all" + handler: "Group->suggestedAll" - url: "/groups{num}" handler: "User->groups" - url: "/groups_pin" diff --git a/Web/static/css/main.css b/Web/static/css/main.css index bbbe4d28..22aa420d 100644 --- a/Web/static/css/main.css +++ b/Web/static/css/main.css @@ -2695,4 +2695,22 @@ body.article .floating_sidebar, body.article .page_content { position: absolute; right: 22px; font-size: 12px; +} + +.sugglist { + padding-bottom: 5px; + padding-top: 5px; + margin-bottom: -5px; + padding-left: 9px; + border-top: 1px solid gray; + background-color: #e6e6e6; + margin-top: 5px; +} + +.sugglist a { + color: #626262; +} + +.suggestionControls { + text-align: center; } \ No newline at end of file diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js index bb349c14..f60a3061 100644 --- a/Web/static/js/al_wall.js +++ b/Web/static/js/al_wall.js @@ -192,7 +192,7 @@ tippy(".client_app", { function addNote(textareaId, nid) { if(nid > 0) { - note.value = nid + document.getElementById("note").value = nid let noteObj = document.querySelector("#nd"+nid) let nortd = document.querySelector("#post-buttons"+textareaId+" .post-has-note"); @@ -200,7 +200,7 @@ function addNote(textareaId, nid) nortd.innerHTML = `${tr("note")} ${escapeHtml(noteObj.dataset.name)}` } else { - note.value = "none" + document.getElementById("note").value = "none" let nortd = document.querySelector("#post-buttons"+textareaId+" .post-has-note"); nortd.style.display = "none" @@ -227,7 +227,7 @@ async function attachNote(id) ${tr("select_or_create_new")}
` - if(note.value != "none") { + if(document.getElementById("note").value != "none") { body += `
${tr("do_not_attach_note")} @@ -262,4 +262,86 @@ async function showArticle(note_id) { u("#articleText").html(`

${note.title}

` + note.html); u("body").removeClass("dimmed"); u("body").addClass("article"); -} \ No newline at end of file +} + +$(document).on("click", "#publish_post", async (e) => { + let id = Number(e.currentTarget.dataset.id) + let post; + let body = ` + + + ` + + MessageBox(tr("publishing_suggested_post"), body, [tr("publish"), tr("cancel")], [(async () => { + let id = Number(e.currentTarget.dataset.id) + let post; + + try { + post = await API.Wall.acceptPost(id, document.getElementById("signatr").checked, document.getElementById("pooblish").value) + } catch(ex) { + switch(ex.code) { + case 11: + MessageBox(tr("error"), tr("error_declining_invalid_post"), [tr("ok")], [Function.noop]); + break; + case 19: + MessageBox(tr("error"), tr("error_declining_not_suggested_post"), [tr("ok")], [Function.noop]); + break; + case 10: + MessageBox(tr("error"), tr("error_declining_declined_post"), [tr("ok")], [Function.noop]); + break; + case 22: + MessageBox(tr("error"), "Access denied", [tr("ok")], [Function.noop]); + break; + default: + MessageBox(tr("error"), "Unknown error "+ex.code+": "+ex.message, [tr("ok")], [Function.noop]); + break; + } + + return 0; + } + + NewNotification(tr("suggestion_succefully_published"), tr("suggestion_press_to_go"), null, () => {window.location.assign("/wall" + post.id)}); + document.getElementById("cound").innerHTML = tr("x_suggested_posts_in_group", post.new_count) + e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.outerHTML = "" + }), Function.noop]); + + document.getElementById("pooblish").innerHTML = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.querySelector(".really_text").innerHTML + document.querySelector(".ovk-diag-body").style.padding = "9px"; +}) + +$(document).on("click", "#decline_post", async (e) => { + let id = Number(e.currentTarget.dataset.id) + let post; + + try { + e.currentTarget.parentNode.parentNode.insertAdjacentHTML("afterbegin", ``) + post = await API.Wall.declinePost(id) + } catch(ex) { + switch(ex.code) { + case 11: + MessageBox(tr("error"), tr("error_declining_invalid_post"), [tr("ok")], [Function.noop]); + break; + case 19: + MessageBox(tr("error"), tr("error_declining_not_suggested_post"), [tr("ok")], [Function.noop]); + break; + case 10: + MessageBox(tr("error"), tr("error_declining_declined_post"), [tr("ok")], [Function.noop]); + break; + case 22: + MessageBox(tr("error"), "Access denied", [tr("ok")], [Function.noop]); + break; + default: + MessageBox(tr("error"), "Unknown error "+ex.code+": "+ex.message, [tr("ok")], [Function.noop]); + break; + } + + return 0; + } finally { + u("#deleteMe").remove() + } + + // а хули + NewNotification(tr("suggestion_succefully_declined"), "", null); + e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.outerHTML = "" + document.getElementById("cound").innerHTML = tr("x_suggested_posts_in_group", post) +}) \ No newline at end of file diff --git a/install/sqls/00039-suggest-posts.sql b/install/sqls/00039-suggest-posts.sql new file mode 100644 index 00000000..321c2a6a --- /dev/null +++ b/install/sqls/00039-suggest-posts.sql @@ -0,0 +1 @@ +ALTER TABLE `posts` ADD `suggested` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0' AFTER `deleted`; \ No newline at end of file diff --git a/locales/en.strings b/locales/en.strings index 4aaa4483..020076a9 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -260,6 +260,7 @@ /* Group */ +"group" = "Group"; "name_group" = "Name"; "subscribe" = "Subscribe"; "unsubscribe" = "Unsubscribe"; @@ -297,8 +298,38 @@ "set_comment" = "Set comment"; "hidden_yes" = "Hidden: Yes"; "hidden_no" = "Hidden: No"; -"group_allow_post_for_everyone" = "Allow posting for everyone"; +"group_allow_post_for_everyone" = "Open"; +"group_limited_post" = "Suggestions"; +"group_closed_post" = "Closed"; +"suggest_new" = "Suggest post"; +"show_suggested_posts" = "$1 suggested posts by you"; +"show_suggested_posts_everyone" = "$1 suggested posts"; "group_hide_from_global_feed" = "Don't display posts in the global feed"; +"suggested_posts_by_you" = "Suggested posts by you"; +"suggested_posts_by_everyone" = "Suggested posts"; +"suggested" = "Suggested"; +"suggested_posts_everyone" = "Suggested by users posts"; +"no_suggested_posts_by_you" = "You haven't suggested posts to this group yet."; +"no_suggested_posts_by_people" = "No posts have been suggested to this group yet."; + +"publish_suggested" = "Accept"; +"decline_suggested" = "Decline"; + +"publishing_suggested_post" = "Publishing suggested post"; +"x_suggested_posts_in_group" = "This group has $1 suggested posts"; +"x_suggested_posts_in_group_by_you" = "You suggested $1 posts to this group"; + +"suggestion_succefully_published" = "Post successfully published"; +"suggestion_succefully_declined" = "Post successfully declined"; +"suggestion_press_to_go" = "Click to show him"; + +"error_declining_invalid_post" = "Error when declining post: post does not exists"; +"error_declining_not_suggested_post" = "Error when declining post: post is not suggested"; +"error_declining_declined_post" = "Error when declining post: post is already declined"; + +"error_accepting_invalid_post" = "Error when accepting post: post does not exists"; +"error_accepting_not_suggested_post" = "Error when accepting post: post is not suggested"; +"error_accepting_declined_post" = "Error when accepting post: cant accept declined post"; "statistics" = "Statistics"; "group_administrators_list" = "Admins list"; "group_display_only_creator" = "Display only group creator"; @@ -331,6 +362,11 @@ "search_by_groups" = "Search by groups"; "search_group_desc" = "Here you can browse through the existing groups and choose a group to suit your needs..."; +"error_suggestions" = "Error accessing to suggestions"; +"error_suggestions_closed" = "This group has closed wall."; +"error_suggestions_open" = "This group has open wall."; +"error_suggestions_access" = "Only group's administrators can view all suggested posts."; + /* Albums */ "create" = "Create"; @@ -675,6 +711,7 @@ "nt_shared_yours" = "shared your"; "nt_commented_yours" = "commented"; "nt_written_on_your_wall" = "wrote on your wall"; +"nt_accepted_your_post" = "accepted your suggested"; "nt_made_you_admin" = "appointed you in the community"; "nt_from" = "from"; @@ -694,6 +731,8 @@ "nt_mention_in_note" = "in discussion of this note"; "nt_mention_in_topic" = "in the discussion"; +"nt_post_small" = "post"; + /* Time */ "time_at_sp" = " at "; diff --git a/locales/ru.strings b/locales/ru.strings index 6faa5e2e..a4f06e47 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -245,6 +245,7 @@ /* Group */ +"group" = "Сообщество"; "name_group" = "Название"; "subscribe" = "Подписаться"; "unsubscribe" = "Отписаться"; @@ -281,8 +282,40 @@ "set_comment" = "Изменить комментарий"; "hidden_yes" = "Скрыт: Да"; "hidden_no" = "Скрыт: Нет"; -"group_allow_post_for_everyone" = "Разрешить публиковать записи всем"; + +"group_allow_post_for_everyone" = "Открытая"; +"group_limited_post" = "Предложка"; +"group_closed_post" = "Закрытая"; +"suggest_new" = "Предложить новость"; +"show_suggested_posts" = "$1 предложенных вами записей"; +"show_suggested_posts_everyone" = "$1 предложенных записей"; "group_hide_from_global_feed" = "Не отображать публикации в глобальной ленте"; +"suggested_posts_by_you" = "Предложенные вами записи"; +"suggested_posts_by_everyone" = "Предложенные записи"; +"suggested" = "Предложено"; +"suggested_posts_everyone" = "Предложенные пользователями записи"; +"no_suggested_posts_by_you" = "Вы ещё не предлагали записей в эту группу."; +"no_suggested_posts_by_people" = "В эту группу ещё не предлагали записей."; + +"publish_suggested" = "Опубликовать запись"; +"decline_suggested" = "Отклонить"; + +"publishing_suggested_post" = "Публикация предложенной записи"; +"x_suggested_posts_in_group" = "В эту группу предложили $1 записей"; +"x_suggested_posts_in_group_by_you" = "Вы предложили в эту группу $1 записей"; + +"suggestion_succefully_published" = "Запись успешно опубликована"; +"suggestion_succefully_declined" = "Запись успешно отклонена"; +"suggestion_press_to_go" = "Нажмите, чтобы перейти к ней"; + +"error_declining_invalid_post" = "Не удалость отклонить пост: поста не существует"; +"error_declining_not_suggested_post" = "Не удалость отклонить пост: пост не из предложки"; +"error_declining_declined_post" = "Не удалость отклонить пост: пост уже отклонён"; + +"error_accepting_invalid_post" = "Не удалость принять пост: поста не существует"; +"error_accepting_not_suggested_post" = "Не удалость принять пост: пост не из предложки"; +"error_accepting_declined_post" = "Не удалость принять пост: пост отклонён"; + "statistics" = "Статистика"; "group_administrators_list" = "Список админов"; "group_display_only_creator" = "Отображать только создателя группы"; @@ -315,6 +348,11 @@ "search_by_groups" = "Поиск по группам"; "search_group_desc" = "Здесь Вы можете просмотреть существующие группы и выбрать группу себе по вкусу..."; +"error_suggestions" = "Ошибка доступа к предложенным"; +"error_suggestions_closed" = "У этой группы закрытая стена."; +"error_suggestions_open" = "У этой группы открытая стена."; +"error_suggestions_access" = "Просматривать все предложенные записи могут только администраторы группы."; + /* Albums */ "create" = "Создать"; @@ -632,6 +670,7 @@ "nt_shared_yours" = "поделился(-ась) вашим"; "nt_commented_yours" = "оставил(а) комментарий под"; "nt_written_on_your_wall" = "написал(а) на вашей стене"; +"nt_accepted_your_post" = "опубликовало вашу предложенную"; "nt_made_you_admin" = "назначил(а) вас руководителем сообщества"; "nt_from" = "от"; "nt_yours_adjective" = "вашим"; @@ -649,6 +688,7 @@ "nt_mention_in_video" = "в обсуждении видеозаписи"; "nt_mention_in_note" = "в обсуждении заметки"; "nt_mention_in_topic" = "в обсуждении"; +"nt_post_small" = "запись"; /* Time */