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 99-104 Link Here
99
    [% IF ( CAN_user_tools_edit_pages ) %]
99
    [% IF ( CAN_user_tools_edit_pages ) %]
100
    <dt><a href="/cgi-bin/koha/tools/cmspages.pl">Pages</a></dt>
100
    <dt><a href="/cgi-bin/koha/tools/cmspages.pl">Pages</a></dt>
101
    <dd>Create and edit additional content pages</dd>
101
    <dd>Create and edit additional content pages</dd>
102
    <ul>
103
        [% INCLUDE 'cms-pages-nav.inc' %]
104
    </ul>
102
    [% END %]
105
    [% END %]
103
106
104
    [% IF ( CAN_user_tools_schedule_tasks ) %]
107
    [% 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; Link Here
22
use C4::Output;
22
use C4::Output;
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 = new CGI;
27
my $query = new CGI;
27
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
28
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 38-46 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
38
my $pendingcomments = Koha::Reviews->search_limited({ approved => 0 })->count;
39
my $pendingcomments = Koha::Reviews->search_limited({ approved => 0 })->count;
39
my $pendingtags = get_count_by_tag_status(0);
40
my $pendingtags = get_count_by_tag_status(0);
40
41
42
my $pages = Koha::CmsPages->search({ location => [ 1, { '=', undef } ] }, { order_by => 'sortorder' });
43
41
$template->param(
44
$template->param(
42
    pendingcomments => $pendingcomments,
45
    pendingcomments => $pendingcomments,
43
    pendingtags     => $pendingtags
46
    pendingtags     => $pendingtags,
47
    pages           => $pages,
44
);
48
);
45
49
46
output_html_with_http_headers $query, $cookie, $template->output;
50
output_html_with_http_headers $query, $cookie, $template->output;
47
- 

Return to bug 15326