Bugzilla – Attachment 87502 Details for
Bug 15326
Add CMS feature
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15326: (follow-up) Pages navigation fixes
Bug-15326-follow-up-Pages-navigation-fixes.patch (text/plain), 6.32 KB, created by
Martin Renvoize (ashimema)
on 2019-04-08 11:16:48 UTC
(
hide
)
Description:
Bug 15326: (follow-up) Pages navigation fixes
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-04-08 11:16:48 UTC
Size:
6.32 KB
patch
obsolete
>From 7b7f187b1e1db74b2f087a77ee5e85db9683a443 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 8 Apr 2019 12:15:09 +0100 >Subject: [PATCH] Bug 15326: (follow-up) Pages navigation fixes > >This is the best I've managed to do with the navigation. Would be happy >for someone else to give it a go because I'm aware that some parent >links repeat. > >Signed-off-by: Michal Denar <black23@gmail.com> > >Signed-off-by: Michal Denar <black23@gmail.com> >Rebased-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/CmsPage.pm | 31 +++++++++++++++++++ > .../prog/en/includes/cms-pages-nav.inc | 16 ++++++++++ > .../prog/en/modules/tools/cmspages.tt | 15 ++------- > .../prog/en/modules/tools/tools-home.tt | 3 ++ > tools/cmspages.pl | 4 +-- > tools/tools-home.pl | 6 +++- > 6 files changed, 59 insertions(+), 16 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/cms-pages-nav.inc > >diff --git a/Koha/CmsPage.pm b/Koha/CmsPage.pm >index cb333d0e74..498404ca20 100644 >--- a/Koha/CmsPage.pm >+++ b/Koha/CmsPage.pm >@@ -22,6 +22,7 @@ use Modern::Perl; > use Carp; > > use Koha::Database; >+use Koha::CmsPages; > > use base qw( Koha::Object ); > >@@ -35,6 +36,36 @@ Koha::CmsPage - Koha Page Object class > > =cut > >+=head3 parentObj >+ >+my $parent = $page->parentObj >+ >+Return the parent page >+ >+=cut >+ >+sub parentObj { >+ my ( $self ) = @_; >+ my $p = $self->parent(); >+ return scalar Koha::CmsPages->find( $p ); >+} >+ >+=head3 isParent >+ >+Returns true if page is a parent >+ >+=cut >+ >+sub isaParent { >+ my ( $self ) = @_; >+ my @pages_with_this_parent = Koha::CmsPages->search({ parent => $self->id() }); >+ if ( scalar @pages_with_this_parent > 0 ){ >+ return 1; >+ } else { >+ return 0; >+ } >+} >+ > =head3 type > > =cut >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cms-pages-nav.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cms-pages-nav.inc >new file mode 100644 >index 0000000000..0abbfcb36d >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cms-pages-nav.inc >@@ -0,0 +1,16 @@ >+[% IF pages %] >+ <ul id="cms_nav"> >+ [% FOREACH page IN pages %] >+ [% IF page.parentObj %] >+ <li><a href="/cgi-bin/koha/tools/cmspages.pl?op=view&id=[% page.parentObj.id %]">[% page.parentObj.title | html %]</a></li> >+ <ul> >+ <li><a href="/cgi-bin/koha/tools/cmspages.pl?op=view&id=[% page.id %]">[% page.title | html %]</a></li> >+ </ul> >+ [% ELSE %] >+ [% UNLESS page.isaParent %] >+ <li><a href="/cgi-bin/koha/tools/cmspages.pl?op=view&id=[% page.id %]">[% page.title | html %]</a></li> >+ [% END %] >+ [% END %] >+ [% END %] >+ </ul> >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt >index fb24bd7a3d..32898d6354 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt >@@ -59,24 +59,13 @@ > [% IF ( view ) %] > <div class="yui-ge"> > <div id="pagesnav" class="yui-u"> >- [% IF ( links ) %] >+ [% IF ( pages ) %] > <fieldset> > <ul> > <li><a href="[% link_self %]">Pages home</a></li> > </ul> > <h4>Pages</h4> >- <ul id="cms_nav"> >- [% FOREACH link IN links %] >- [% IF ( link.location == '' || link.location == '1' ) %] >- [% IF ( link.parent != '' ) %] >- [% FOREACH parent IN parent_list %] >- [% IF ( parent.id == link.parent ) %]<li style="margin-left:20px;"><a href="[% link_self %]?op=view&id=[% link.parent %]">[% parent.title_link %]</a> › <a href="[% link_self %]?op=view&id=[% link.id %]">[% link.title_link %]</a></li>[% END %] >- [% END %] >- [% ELSE %] >- <li><a href="[% link_self %]?op=view&id=[% link.id %]">[% link.title_link %]</a></li> >- [% END %] >- [% END %][% END %] >- </ul> >+ [% INCLUDE 'cms-pages-nav.inc' %] > </fieldset> > [% END %] > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >index f4e8341cc2..4a17eee05e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >@@ -107,6 +107,9 @@ > [% IF ( CAN_user_tools_edit_pages ) %] > <dt><a href="/cgi-bin/koha/tools/cmspages.pl">Pages</a></dt> > <dd>Create and edit additional content pages</dd> >+ <ul> >+ [% INCLUDE 'cms-pages-nav.inc' %] >+ </ul> > [% END %] > > [% IF ( CAN_user_tools_schedule_tasks ) %] >diff --git a/tools/cmspages.pl b/tools/cmspages.pl >index 3a1f5977e5..a8fd7421be 100755 >--- a/tools/cmspages.pl >+++ b/tools/cmspages.pl >@@ -107,9 +107,9 @@ if ( $op eq 'form' ) { > print $cgi->redirect( $link_self ); > } elsif ( $op eq 'view' ) { > my $cms_data = Koha::CmsPages->find( $id ); >- my $links = Koha::CmsPages->search( {}, { order_by => 'sortorder' } ); >+ my $pages = Koha::CmsPages->search({ location => [ 1, { '=', undef } ] }, { order_by => 'sortorder' }); > $template->param( >- links => $links, >+ pages => $pages, > cms_page => $cms_data, > view => 1, > id => $id, >diff --git a/tools/tools-home.pl b/tools/tools-home.pl >index 99fde6391d..bdb07df4f2 100755 >--- a/tools/tools-home.pl >+++ b/tools/tools-home.pl >@@ -22,6 +22,7 @@ use C4::Auth; > use C4::Output; > use C4::Tags qw/get_count_by_tag_status/; > use Koha::Reviews; >+use Koha::CmsPages; > > my $query = new CGI; > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -38,9 +39,12 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > my $pendingcomments = Koha::Reviews->search_limited({ approved => 0 })->count; > my $pendingtags = get_count_by_tag_status(0); > >+my $pages = Koha::CmsPages->search({ location => [ 1, { '=', undef } ] }, { order_by => 'sortorder' }); >+ > $template->param( > pendingcomments => $pendingcomments, >- pendingtags => $pendingtags >+ pendingtags => $pendingtags, >+ pages => $pages, > ); > > output_html_with_http_headers $query, $cookie, $template->output; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15326
:
45621
|
58272
|
58607
|
58608
|
58609
|
58787
|
63904
|
63905
|
64241
|
64941
|
64942
|
66255
|
70866
|
70867
|
70868
|
70869
|
70870
|
70871
|
76387
|
76388
|
76389
|
76390
|
76391
|
76392
|
78232
|
78233
|
78234
|
78235
|
78236
|
78237
|
78238
|
78240
|
79269
|
83318
|
83319
|
83320
|
83321
|
83322
|
83323
|
83324
|
83325
|
83326
|
83404
|
83405
|
83406
|
83407
|
83408
|
83409
|
83410
|
83411
|
83412
|
84682
|
84683
|
84684
|
84685
|
84686
|
84687
|
84688
|
84689
|
84690
|
84691
|
87494
|
87495
|
87496
|
87497
|
87498
|
87499
|
87500
|
87501
|
87502
|
87503
|
87608
|
87609
|
87610
|
87617
|
96084
|
96085
|
96086
|
96087
|
96088
|
96089
|
96090
|
96091
|
96092
|
96093
|
96094
|
96095
|
96096
|
96097
|
96098
|
97237
|
101565
|
101566
|
101567
|
101568
|
101569
|
101570
|
101571
|
101572
|
101573
|
101574
|
101575
|
101576
|
101577
|
101578
|
101579
|
101580
|
128341
|
128342
|
128343
|
128344
|
128345
|
128346
|
128347
|
128348
|
128349
|
128350
|
128351
|
128352
|
128353
|
128354
|
128355
|
128356
|
128357
|
128585
|
128642
|
136432
|
136757
|
136768
|
138489
|
138493
|
139028
|
139029
|
139030
|
139031
|
139111
|
139123
|
139124
|
139125
|
139172
|
139173
|
139174