Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#9253 Add site announcements #564

Open
wants to merge 2 commits into
base: stable-3_4_0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 36 files
+115 −59 api/v1/announcements/PKPAnnouncementHandler.php
+64 −0 classes/announcement/Announcement.php
+19 −11 classes/announcement/AnnouncementTypeDAO.php
+50 −1 classes/announcement/Collector.php
+164 −1 classes/announcement/Repository.php
+20 −2 classes/announcement/maps/Schema.php
+1 −1 classes/author/Author.php
+5 −3 classes/cliTool/CommandLineTool.php
+43 −19 classes/components/forms/announcement/PKPAnnouncementForm.php
+3 −2 classes/components/forms/context/PKPAnnouncementSettingsForm.php
+0 −11 classes/components/listPanels/PKPAnnouncementsListPanel.php
+33 −31 classes/core/DataObject.php
+16 −0 classes/core/PKPRequest.php
+39 −0 classes/core/exceptions/StoreTemporaryFileException.php
+2 −2 classes/core/maps/Schema.php
+13 −0 classes/file/PKPPublicFileManager.php
+1 −48 classes/identity/Identity.php
+46 −0 classes/migration/upgrade/v3_5_0/I9253_SiteAnnouncements.php
+4 −38 classes/publication/PKPPublication.php
+4 −1 classes/services/PKPNavigationMenuService.php
+3 −32 classes/submission/PKPSubmission.php
+18 −18 classes/submissionFile/Repository.php
+4 −34 classes/submissionFile/SubmissionFile.php
+14 −15 controllers/grid/announcements/AnnouncementTypeGridHandler.php
+2 −2 controllers/grid/announcements/form/AnnouncementTypeForm.php
+3 −0 locale/en/api.po
+3 −0 locale/en/installer.po
+6 −0 locale/en/manager.po
+53 −0 pages/admin/AdminHandler.php
+40 −26 pages/announcement/AnnouncementHandler.php
+15 −7 pages/index/PKPIndexHandler.php
+24 −2 pages/management/ManagementHandler.php
+31 −3 schemas/announcement.json
+20 −0 schemas/site.json
+31 −0 templates/admin/settings.tpl
+42 −0 templates/frontend/objects/announcements_list.tpl
3 changes: 1 addition & 2 deletions pages/index/IndexHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function index($args, $request)
$this->setupTemplate($request);
$router = $request->getRouter();
$templateMgr = TemplateManager::getManager($request);
$this->_setupAnnouncements($server, $templateMgr);
if ($server) {
// OPS: sections
$sections = Repo::section()->getCollector()->filterByContextIds([$server->getId()])->getMany();
Expand Down Expand Up @@ -92,8 +93,6 @@ public function index($args, $request)
'authorUserGroups' => Repo::userGroup()->getCollector()->filterByRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR])->filterByContextIds([$server->getId()])->getMany()->remember(),
]);

$this->_setupAnnouncements($server, $templateMgr);

$templateMgr->display('frontend/pages/indexServer.tpl');
event(new UsageEvent(Application::ASSOC_TYPE_SERVER, $server));
return;
Expand Down
3 changes: 2 additions & 1 deletion plugins/themes/default/styles/components.less
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@
}

// Announcements
.cmp_announcements {
// Double class rule overrides .pkp_structure_main ul
.cmp_announcements.cmp_announcements {
&:extend(.pkp_unstyled_list);
margin-left: -@base;
margin-right: -@base;
Expand Down
31 changes: 1 addition & 30 deletions templates/frontend/pages/indexServer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,36 +49,7 @@
</section>
{/if}

{* Announcements *}
{if $numAnnouncementsHomepage && $announcements|@count}
<section class="cmp_announcements highlight_first">
<a id="homepageAnnouncements"></a>
<h2>
{translate key="announcement.announcements"}
</h2>
{foreach name=announcements from=$announcements item=announcement}
{if $smarty.foreach.announcements.iteration > $numAnnouncementsHomepage}
{break}
{/if}
{if $smarty.foreach.announcements.iteration == 1}
{include file="frontend/objects/announcement_summary.tpl" heading="h3"}
<div class="more">
{else}
<article class="obj_announcement_summary">
<h4>
<a href="{url router=PKPApplication::ROUTE_PAGE page="announcement" op="view" path=$announcement->getId()}">
{$announcement->getLocalizedTitle()|escape}
</a>
</h4>
<div class="date">
{$announcement->getDatePosted()|date_format:$dateFormatShort}
</div>
</article>
{/if}
{/foreach}
</div><!-- .more -->
</section>
{/if}
{include file="frontend/objects/announcements_list.tpl" numAnnouncements=$numAnnouncementsHomepage}

{* Additional Homepage Content *}
{if $additionalHomeContent}
Expand Down
2 changes: 2 additions & 0 deletions templates/frontend/pages/indexSite.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
</div>
{/if}

{include file="frontend/objects/announcements_list.tpl" numAnnouncements=$numAnnouncementsHomepage}

<div class="servers">
<h2>
{translate key="context.contexts"}
Expand Down