View | Details | Raw Unified | Return to bug 15326
Collapse All | Expand All

(-)a/Koha/CmsPage.pm (+31 lines)
Lines 22-27 use Modern::Perl; Link Here
22
use Carp;
22
use Carp;
23
23
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::CmsPages;
25
26
26
use base qw( Koha::Object );
27
use base qw( Koha::Object );
27
28
Lines 35-40 Koha::CmsPage - Koha Page Object class Link Here
35
36
36
=cut
37
=cut
37
38
39
=head3 parentObj
40
41
my $parent = $page->parentObj
42
43
Return the parent page
44
45
=cut
46
47
sub parentObj {
48
    my ( $self ) = @_;
49
    my $p = $self->parent();
50
    return scalar Koha::CmsPages->find( $p );
51
}
52
53
=head3 isParent
54
55
Returns true if page is a parent
56
57
=cut
58
59
sub isaParent {
60
    my ( $self ) = @_;
61
    my @pages_with_this_parent = Koha::CmsPages->search({ parent => $self->id() });
62
    if ( scalar @pages_with_this_parent > 0 ){
63
        return 1;
64
    } else {
65
        return 0;
66
    }
67
}
68
38
=head3 type
69
=head3 type
39
70
40
=cut
71
=cut
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cms-pages-nav.inc (+16 lines)
Line 0 Link Here
1
[% IF pages %]
2
    <ul id="cms_nav">
3
        [% FOREACH page IN pages %]
4
            [% IF page.parentObj %]
5
                <li><a href="/cgi-bin/koha/tools/cmspages.pl?op=view&id=[% page.parentObj.id %]">[% page.parentObj.title | html %]</a></li>
6
                <ul>
7
                    <li><a href="/cgi-bin/koha/tools/cmspages.pl?op=view&id=[% page.id %]">[% page.title | html %]</a></li>
8
                </ul>
9
            [% ELSE %]
10
                [% UNLESS page.isaParent %]
11
                    <li><a href="/cgi-bin/koha/tools/cmspages.pl?op=view&id=[% page.id %]">[% page.title | html %]</a></li>
12
                [% END %]
13
            [% END %]
14
        [% END %]
15
    </ul>
16
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt (-13 / +2 lines)
Lines 59-82 Link Here
59
[% IF ( view ) %]
59
[% IF ( view ) %]
60
<div class="yui-ge">
60
<div class="yui-ge">
61
<div id="pagesnav" class="yui-u">
61
<div id="pagesnav" class="yui-u">
62
    [% IF ( links ) %]
62
    [% IF ( pages ) %]
63
    <fieldset>
63
    <fieldset>
64
        <ul>
64
        <ul>
65
            <li><a href="[% link_self %]">Pages home</a></li>
65
            <li><a href="[% link_self %]">Pages home</a></li>
66
        </ul>
66
        </ul>
67
        <h4>Pages</h4>
67
        <h4>Pages</h4>
68
        <ul id="cms_nav">
68
        [% INCLUDE 'cms-pages-nav.inc' %]
69
            [% FOREACH link IN links %]
70
            [% IF ( link.location == '' || link.location == '1' ) %]
71
            [% IF ( link.parent != '' ) %]
72
                [% FOREACH parent IN parent_list %]
73
                    [% IF ( parent.id == link.parent ) %]<li style="margin-left:20px;"><a href="[% link_self %]?op=view&amp;id=[% link.parent %]">[% parent.title_link %]</a> &rsaquo; <a href="[% link_self %]?op=view&amp;id=[% link.id %]">[% link.title_link %]</a></li>[% END %]
74
                [% END %]
75
            [% ELSE %]
76
                <li><a href="[% link_self %]?op=view&amp;id=[% link.id %]">[% link.title_link %]</a></li>
77
            [% END %]
78
            [% END %][% END %]
79
        </ul>
80
    </fieldset>
69
    </fieldset>
81
    [% END %]
70
    [% END %]
82
</div>
71
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (+3 lines)
Lines 125-130 Link Here
125
    [% IF ( CAN_user_tools_edit_pages ) %]
125
    [% IF ( CAN_user_tools_edit_pages ) %]
126
    <dt><a href="/cgi-bin/koha/tools/cmspages.pl">Pages</a></dt>
126
    <dt><a href="/cgi-bin/koha/tools/cmspages.pl">Pages</a></dt>
127
    <dd>Create and edit additional content pages</dd>
127
    <dd>Create and edit additional content pages</dd>
128
    <ul>
129
        [% INCLUDE 'cms-pages-nav.inc' %]
130
    </ul>
128
    [% END %]
131
    [% END %]
129
132
130
    [% IF ( CAN_user_tools_schedule_tasks ) %]
133
    [% IF ( CAN_user_tools_schedule_tasks ) %]
(-)a/tools/cmspages.pl (-2 / +2 lines)
Lines 107-115 if ( $op eq 'form' ) { Link Here
107
    print $cgi->redirect( $link_self );
107
    print $cgi->redirect( $link_self );
108
} elsif ( $op eq 'view' ) {
108
} elsif ( $op eq 'view' ) {
109
    my $cms_data = Koha::CmsPages->find( $id );
109
    my $cms_data = Koha::CmsPages->find( $id );
110
    my $links = Koha::CmsPages->search( {}, { order_by => 'sortorder' } );
110
    my $pages = Koha::CmsPages->search({ location => [ 1, { '=', undef } ] }, { order_by => 'sortorder' });
111
    $template->param(
111
    $template->param(
112
        links    => $links,
112
        pages    => $pages,
113
        cms_page => $cms_data,
113
        cms_page => $cms_data,
114
        view => 1,
114
        view => 1,
115
        id   => $id,
115
        id   => $id,
(-)a/tools/tools-home.pl (-2 / +5 lines)
Lines 22-27 use C4::Auth qw( get_template_and_user ); Link Here
22
use C4::Output qw( output_html_with_http_headers );
22
use C4::Output qw( output_html_with_http_headers );
23
use C4::Tags qw( get_count_by_tag_status );
23
use C4::Tags qw( get_count_by_tag_status );
24
use Koha::Reviews;
24
use Koha::Reviews;
25
use Koha::CmsPages;
25
26
26
my $query = CGI->new;
27
my $query = CGI->new;
27
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
28
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 36-44 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
36
my $pendingcomments = Koha::Reviews->search_limited({ approved => 0 })->count;
37
my $pendingcomments = Koha::Reviews->search_limited({ approved => 0 })->count;
37
my $pendingtags = get_count_by_tag_status(0);
38
my $pendingtags = get_count_by_tag_status(0);
38
39
40
my $pages = Koha::CmsPages->search({ location => [ 1, { '=', undef } ] }, { order_by => 'sortorder' });
41
39
$template->param(
42
$template->param(
40
    pendingcomments => $pendingcomments,
43
    pendingcomments => $pendingcomments,
41
    pendingtags     => $pendingtags
44
    pendingtags     => $pendingtags,
45
    pages           => $pages,
42
);
46
);
43
47
44
if ( C4::Context->config('enable_plugins') ) {
48
if ( C4::Context->config('enable_plugins') ) {
45
- 

Return to bug 15326