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

(-)a/Koha/CmsPage.pm (-1 / +1 lines)
Lines 39-45 Koha::CmsPage - Koha Page Object class Link Here
39
39
40
=cut
40
=cut
41
41
42
sub type {
42
sub _type {
43
    return 'CmsPage';
43
    return 'CmsPage';
44
}
44
}
45
45
(-)a/Koha/CmsPages.pm (-75 / +49 lines)
Lines 40-46 Koha::CmsPage - Koha CMS Page Object Class Link Here
40
40
41
=cut
41
=cut
42
42
43
sub type {
43
sub _type {
44
    return 'CmsPage';
44
    return 'CmsPage';
45
}
45
}
46
46
Lines 49-75 sub object_class { Link Here
49
}
49
}
50
50
51
=head3 add
51
=head3 add
52
52
Adds a new page to the CMS database based on the input data.
53
Adds a new page to the CMS database based on the input data.
54
53
=cut
55
=cut
54
56
55
sub add {
57
sub add {
56
    my ( $self, $input ) = @_;
58
    my ( $self, $input ) = @_;
57
warn "input: ", scalar $input->param('location');
58
    carp( 'Koha::CmsPages::add() undefined parameter: input' ) unless defined $input;
59
    carp( 'Koha::CmsPages::add() undefined parameter: input' ) unless defined $input;
60
59
    my $data = {
61
    my $data = {
60
        parent     =>   scalar          $input->param( 'parent' )     eq '' ? undef : scalar $input->param( 'parent' ),
62
        parent     => $input->{parent} eq '' ? undef : $input->{parent},
61
        location   =>   scalar          $input->param( 'location' )   eq '' ? undef : scalar $input->param( 'location'),
63
        location   => $input->{location} eq '' ? undef : $input->{location},
62
        branchcode =>   scalar          $input->param( 'branchcode' ) eq '' ? undef : scalar $input->param( 'branchcode' ),
64
        branchcode => $input->{branchcode} eq '' ? undef : $input->{branchcode},
63
        lang       =>   scalar          $input->param( 'lang' ),
65
        lang       => $input->{lang},
64
        sortorder  =>   scalar          $input->param( 'sortorder' ),
66
        sortorder  => $input->{sortorder},
65
        title      =>   scalar          $input->param( 'title' ),
67
        title      => $input->{title},
66
        title_link =>   scalar          $input->param( 'title_link' ),
68
        title_link => $input->{title_link},
67
        publish    =>   defined (scalar $input->param( 'publish' )),
69
        publish    => $input->{publish} eq 'on' ? 1 : 0,
68
        content    =>   scalar          $input->param( 'content' )
70
        content    => $input->{content}
69
    };
71
    };
70
72
71
    if (defined $input->param( 'id' )) {
73
    if (defined $input->{id}){
72
        $data->{'id'} = scalar $input->param( 'id' );
74
        $data->{id} = $input->{id};
75
    }
76
77
    # Ensuring link titles are unique
78
    my $title_link = $input->{title_link};
79
    if ( Koha::CmsPages->find({ title_link => $title_link }) ){
80
        my $link = Koha::CmsPages->find({ title_link => $title_link });
81
        unless ( $link->id eq $input->{id} ){
82
            return;
83
        }
84
    }
85
86
    # Ensuring that, if page has parent, provided location suits parent location
87
    my $parent = Koha::CmsPages->find($input->{parent});
88
    if ( $parent && $parent->location ne "" ){
89
        if ( $parent->location ne $input->{location} ){
90
            return;
91
        }
73
    }
92
    }
74
93
75
    my $new_page = $self->_resultset()->update_or_create( $data, { key => 'primary' });
94
    my $new_page = $self->_resultset()->update_or_create( $data, { key => 'primary' });
Lines 79-100 warn "input: ", scalar $input->param('location'); Link Here
79
98
80
=head3 list
99
=head3 list
81
100
82
Lists pages based input filtering paramters for location, branch and language.
101
Lists pages based input filtering parameters for location, branch and language.
83
102
84
=cut
103
=cut
85
104
86
sub list {
105
sub list {
87
    my ( $self, $id, $disp, $branch, $lang ) = @_;
106
    my ( $self, $id, $disp, $branch, $lang ) = @_;
88
107
89
    my $filter = { };
108
    my %filter;
90
    $filter->{'location'} = $disp   unless not defined $disp;
109
    if ($branch) {
91
    $filter->{'branch'}   = $branch unless not defined $branch;
110
        my $branch_push = [ $branch, undef ];
92
    $filter->{'lang'}     = $lang   unless not defined $lang;
111
        push @{$filter{'branchcode'}}, $branch_push;
112
    }
113
    if ($lang) {
114
        my $lang_push = [ $lang, undef ];
115
        push @{$filter{'lang'}}, $lang_push;
116
    }
117
    if ($disp) {
118
        my $disp_push = [ $disp, undef ];
119
        push @{$filter{'location'}}, $disp_push;
120
    }
93
121
94
    my $pages = $self->_resultset()->search( undef, {
122
    my $pages = $self->_resultset()->search( {}, {
95
        order_by => {
123
        order_by => {
96
		    -asc => [qw/parent location branchcode lang sortorder/]
124
        -asc => [qw/parent location branchcode lang sortorder/]
97
        }, where => $filter
125
        }, where => { %filter }
98
    } );
126
    } );
99
127
100
    my $page_list = [];
128
    my $page_list = [];
Lines 136-195 sub list { Link Here
136
    return ( $page_list, $parent_list, $data );
164
    return ( $page_list, $parent_list, $data );
137
}
165
}
138
166
139
=head3 page
140
141
Retrieves all data to show a single CMS page.
142
143
=cut
144
145
sub page {
146
	my ( $self, $id ) = @_;
147
148
	carp( 'Missing CMS page id parameter in Koha::Pages::page' ) unless defined $id;
149
150
	# Probably want to merge these to a single query:
151
	my $top_links = $self->_resultset()->search(
152
			{ parent => undef }, { qw/id title_link/ });
153
154
	my $page_links = $self->_resultset()->search(
155
			{ parent => $id }, { qw/id title_link/ });
156
157
	my $page_data = $self->_resultset()->find( $id );
158
159
	return ( $top_links, $page_links, $page_data );
160
}
161
162
=head3 child_links
163
164
Lists pages which are children of a specific id (or undef for root).
165
166
=cut
167
168
sub child_links {
169
    my ( $self, $id ) = @_;
170
171
	# 'id' can be undefined if listing top-level links.
172
    my $rs = $self->_resultset()->search({ parent => $id },
173
            { columns => [qw/id title_link/] } );
174
175
    return $rs;
176
}
177
178
=head3 remove
179
180
Removes a page identified by id from the CMS database.
181
182
=cut
183
184
sub remove {
185
    my ( $self, @ids ) = @_;
186
187
    carp( 'Koha::CmsPages::remove() undefined parameter ids' ) unless @ids;
188
189
    my $pages = $self->_resultset()->search({ id => \@ids });
190
    $pages->delete;
191
}
192
193
=head1 AUTHOR
167
=head1 AUTHOR
194
168
195
Martin Persson <xarragon@gmail.com>
169
Martin Persson <xarragon@gmail.com>
(-)a/installer/data/mysql/atomicupdate/bug15326-add_cms_pages_permission.sql (+1 lines)
Line 0 Link Here
1
INSERT IGNORE INTO permissions (`module_bit`, `code`, `description`) VALUES ('13', 'edit_pages', 'Create, edit and delete CMS pages for OPAC and staff interfaces');
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc (-24 / +46 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
<script type="text/javascript">//<![CDATA[
3
    $(document).ready(function() {
4
        var path = location.pathname.substring(1);
5
        if (path.indexOf("labels") >= 0 && path.indexOf("spine") < 0 ) {
6
          $('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').css('font-weight','bold');
7
        } else if (path.indexOf("patroncards") >= 0 ) {
8
          $('#navmenulist a[href$="/cgi-bin/koha/patroncards/home.pl"]').css('font-weight','bold');
9
        } else if (path.indexOf("patron_lists") >= 0 ) {
10
          $('#navmenulist a[href$="/cgi-bin/koha/patron_lists/lists.pl"]').css('font-weight','bold');
11
        } else if ((path+location.search).indexOf("batchMod.pl?del=1") >= 0 ) {
12
          $('#navmenulist a[href$="/cgi-bin/koha/tools/batchMod.pl?del=1"]').css('font-weight','bold');
13
        } else if (path.indexOf("cmspages") >= 0 ) {
14
          $('#navmenulist a[href$="/cgi-bin/koha/tools/cmspages.pl"]').css('font-weight','bold');
15
        } else {
16
          $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold');
17
        }
18
    });
19
//]]>
20
</script>
2
21
3
<div id="navmenu">
22
<div id="navmenu">
4
<div id="navmenulist">
23
<div id="navmenulist">
Lines 11-47 Link Here
11
<h5>Patrons and circulation</h5>
30
<h5>Patrons and circulation</h5>
12
<ul>
31
<ul>
13
    [% IF ( CAN_user_tools_manage_patron_lists ) %]
32
    [% IF ( CAN_user_tools_manage_patron_lists ) %]
14
	<li><a href="/cgi-bin/koha/patron_lists/lists.pl">Patron lists</a></li>
33
        <li><a href="/cgi-bin/koha/patron_lists/lists.pl">Patron lists</a></li>
15
    [% END %]
34
    [% END %]
16
    [% IF (CAN_user_clubs) %]
35
    [% IF (CAN_user_clubs) %]
17
        <li><a href="/cgi-bin/koha/clubs/clubs.pl">Patron clubs</a></li>
36
        <li><a href="/cgi-bin/koha/clubs/clubs.pl">Patron clubs</a></li>
18
    [% END %]
37
    [% END %]
19
    [% IF ( CAN_user_tools_moderate_comments ) %]
38
    [% IF ( CAN_user_tools_moderate_comments ) %]
20
	<li><a href="/cgi-bin/koha/reviews/reviewswaiting.pl">Comments</a></li>
39
        <li><a href="/cgi-bin/koha/reviews/reviewswaiting.pl">Comments</a></li>
21
    [% END %]
40
    [% END %]
22
    [% IF ( CAN_user_tools_import_patrons ) %]
41
    [% IF ( CAN_user_tools_import_patrons ) %]
23
	<li><a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a></li>
42
        <li><a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a></li>
24
    [% END %]
43
    [% END %]
25
    [% IF ( CAN_user_tools_edit_notices ) %]
44
    [% IF ( CAN_user_tools_edit_notices ) %]
26
    <li><a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; slips</a></li>
45
        <li><a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; slips</a></li>
27
    [% END %]
46
    [% END %]
28
    [% IF ( CAN_user_tools_edit_notice_status_triggers ) %]
47
    [% IF ( CAN_user_tools_edit_notice_status_triggers ) %]
29
	<li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li>
48
        <li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li>
30
    [% END %]
49
    [% END %]
31
    [% IF ( CAN_user_tools_label_creator ) %]
50
    [% IF ( CAN_user_tools_label_creator ) %]
32
    <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li>
51
        <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li>
33
    [% END %]
52
    [% END %]
34
    [% IF ( CAN_user_tools_delete_anonymize_patrons ) %]
53
    [% IF ( CAN_user_tools_delete_anonymize_patrons ) %]
35
    <li><a href="/cgi-bin/koha/tools/cleanborrowers.pl">Batch patron deletion/anonymization</a></li>
54
        <li><a href="/cgi-bin/koha/tools/cleanborrowers.pl">Batch patron deletion/anonymization</a></li>
36
    [% END %]
55
    [% END %]
37
    [% IF ( CAN_user_tools_edit_patrons ) %]
56
    [% IF ( CAN_user_tools_edit_patrons ) %]
38
    <li><a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a></li>
57
        <li><a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a></li>
39
    [% END %]
58
    [% END %]
40
    [% IF ( CAN_user_tools_moderate_tags ) %]
59
    [% IF ( CAN_user_tools_moderate_tags ) %]
41
    <li><a href="/cgi-bin/koha/tags/review.pl">Tag moderation</a></li>
60
        <li><a href="/cgi-bin/koha/tags/review.pl">Tag moderation</a></li>
42
    [% END %]
61
    [% END %]
43
    [% IF ( CAN_user_tools_batch_upload_patron_images ) %]
62
    [% IF ( CAN_user_tools_batch_upload_patron_images ) %]
44
	<li><a href="/cgi-bin/koha/tools/picture-upload.pl">Upload patron images</a></li>
63
        <li><a href="/cgi-bin/koha/tools/picture-upload.pl">Upload patron images</a></li>
45
    [% END %]
64
    [% END %]
46
</ul>
65
</ul>
47
[% END %]
66
[% END %]
Lines 54-63 Link Here
54
<h5>Catalog</h5>
73
<h5>Catalog</h5>
55
<ul>
74
<ul>
56
    [% IF ( CAN_user_tools_items_batchdel ) %]
75
    [% IF ( CAN_user_tools_items_batchdel ) %]
57
	<li><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Batch item deletion</a></li>
76
        <li><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Batch item deletion</a></li>
58
    [% END %]
77
    [% END %]
59
    [% IF ( CAN_user_tools_items_batchmod ) %]
78
    [% IF ( CAN_user_tools_items_batchmod ) %]
60
	<li><a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a></li>
79
        <li><a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a></li>
61
    [% END %]
80
    [% END %]
62
    [% IF CAN_user_tools_records_batchdel %]
81
    [% IF CAN_user_tools_records_batchdel %]
63
      <li><a href="/cgi-bin/koha/tools/batch_delete_records.pl">Batch record deletion</a></li>
82
      <li><a href="/cgi-bin/koha/tools/batch_delete_records.pl">Batch record deletion</a></li>
Lines 69-85 Link Here
69
      <li><a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a></li>
88
      <li><a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a></li>
70
    [% END %]
89
    [% END %]
71
    [% IF ( CAN_user_tools_export_catalog ) %]
90
    [% IF ( CAN_user_tools_export_catalog ) %]
72
    <li><a href="/cgi-bin/koha/tools/export.pl">Export data</a></li>
91
        <li><a href="/cgi-bin/koha/tools/export.pl">Export data</a></li>
73
    [% END %]
92
    [% END %]
74
    [% IF ( CAN_user_tools_inventory ) %]
93
    [% IF ( CAN_user_tools_inventory ) %]
75
        <li><a href="/cgi-bin/koha/tools/inventory.pl">Inventory</a></li>
94
        <li><a href="/cgi-bin/koha/tools/inventory.pl">Inventory</a></li>
76
    [% END %]
95
    [% END %]
77
    [% IF ( CAN_user_tools_label_creator ) %]
96
    [% IF ( CAN_user_tools_label_creator ) %]
78
	<li><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></li>
97
        <li><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></li>
79
	<li><a href="/cgi-bin/koha/labels/spinelabel-home.pl">Quick spine label creator</a></li>
98
        <li><a href="/cgi-bin/koha/labels/spinelabel-home.pl">Quick spine label creator</a></li>
80
    [% END %]
99
    [% END %]
81
    [% IF ( CAN_user_tools_rotating_collections ) %]
100
    [% IF ( CAN_user_tools_rotating_collections ) %]
82
    <li><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a></li>
101
        <li><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a></li>
83
    [% END %]
102
    [% END %]
84
    [% IF ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) %]
103
    [% IF ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) %]
85
    <li><a href="/cgi-bin/koha/tools/stockrotation.pl">Stock rotation</a></li>
104
    <li><a href="/cgi-bin/koha/tools/stockrotation.pl">Stock rotation</a></li>
Lines 88-100 Link Here
88
        <li><a href="/cgi-bin/koha/tools/marc_modification_templates.pl">Manage MARC modification templates</a></li>
107
        <li><a href="/cgi-bin/koha/tools/marc_modification_templates.pl">Manage MARC modification templates</a></li>
89
    [% END %]
108
    [% END %]
90
    [% IF ( CAN_user_tools_stage_marc_import ) %]
109
    [% IF ( CAN_user_tools_stage_marc_import ) %]
91
	<li><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC for import</a></li>
110
        <li><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC for import</a></li>
92
    [% END %]
111
    [% END %]
93
    [% IF ( CAN_user_tools_manage_staged_marc ) %]
112
    [% IF ( CAN_user_tools_manage_staged_marc ) %]
94
	<li><a href="/cgi-bin/koha/tools/manage-marc-import.pl">Staged MARC management</a></li>
113
        <li><a href="/cgi-bin/koha/tools/manage-marc-import.pl">Staged MARC management</a></li>
95
    [% END %]
114
    [% END %]
96
    [% IF ( CAN_user_tools_upload_local_cover_images ) %]
115
    [% IF ( CAN_user_tools_upload_local_cover_images ) %]
97
    <li><a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a></li>
116
        <li><a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a></li>
98
    [% END %]
117
    [% END %]
99
</ul>
118
</ul>
100
[% END %]
119
[% END %]
Lines 104-122 Link Here
104
<h5>Additional tools</h5>
123
<h5>Additional tools</h5>
105
<ul>
124
<ul>
106
    [% IF ( CAN_user_tools_edit_calendar ) %]
125
    [% IF ( CAN_user_tools_edit_calendar ) %]
107
	<li><a href="/cgi-bin/koha/tools/holidays.pl">Calendar</a></li>
126
        <li><a href="/cgi-bin/koha/tools/holidays.pl">Calendar</a></li>
108
    [% END %]
127
    [% END %]
109
    [% IF ( CAN_user_tools_manage_csv_profiles ) %]
128
    [% IF ( CAN_user_tools_manage_csv_profiles ) %]
110
	<li><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></li>
129
        <li><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></li>
111
    [% END %]
130
    [% END %]
112
    [% IF ( CAN_user_tools_view_system_logs ) %]
131
    [% IF ( CAN_user_tools_view_system_logs ) %]
113
	<li><a href="/cgi-bin/koha/tools/viewlog.pl">Log viewer</a></li>
132
        <li><a href="/cgi-bin/koha/tools/viewlog.pl">Log viewer</a></li>
114
    [% END %]
133
    [% END %]
115
    [% IF ( CAN_user_tools_edit_news ) %]
134
    [% IF ( CAN_user_tools_edit_news ) %]
116
	<li><a href="/cgi-bin/koha/tools/koha-news.pl">News</a></li>
135
        <li><a href="/cgi-bin/koha/tools/koha-news.pl">News</a></li>
136
    [% END %]
137
    [% IF ( CAN_user_tools_edit_pages ) %]
138
        <li><a href="/cgi-bin/koha/tools/cmspages.pl">Pages</a></li>
117
    [% END %]
139
    [% END %]
118
    [% IF ( CAN_user_tools_schedule_tasks ) %]
140
    [% IF ( CAN_user_tools_schedule_tasks ) %]
119
	<li><a href="/cgi-bin/koha/tools/scheduler.pl">Task scheduler</a></li>
141
        <li><a href="/cgi-bin/koha/tools/scheduler.pl">Task scheduler</a></li>
120
    [% END %]
142
    [% END %]
121
    [% IF ( CAN_user_tools_edit_quotes ) %]
143
    [% IF ( CAN_user_tools_edit_quotes ) %]
122
       <li><a href="/cgi-bin/koha/tools/quotes.pl">Quote editor</a></li>
144
       <li><a href="/cgi-bin/koha/tools/quotes.pl">Quote editor</a></li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt (-94 / +182 lines)
Lines 5-30 Link Here
5
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Koha &rsaquo; Tools &rsaquo; Pages</title>
6
<title>Koha &rsaquo; Tools &rsaquo; Pages</title>
7
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'doc-head-close.inc' %]
8
[% IF ( opac_page_count ) %]
8
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
9
    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
9
[% INCLUDE 'datatables.inc' %]
10
    [% INCLUDE 'datatables.inc' %]
11
    <script type="text/javascript">//<![CDATA[
12
    $(document).ready(function() {
13
        $("#newst").dataTable($.extend(true, {}, dataTablesDefaults, {
14
            "aoColumnDefs": [
15
                { "aTargets": [ 0,-1,-2 ], "bSortable": false },
16
                { "aTargets": [ 0, -1 ], "bSearchable": false },
17
                { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
18
            ],
19
            "sPaginationType": "full_numbers"
20
        }));
21
    });
22
    //]]>
23
    </script>
24
[% END %]
25
<script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script>
10
<script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script>
26
<script type="text/javascript">//<![CDATA[
11
<script type="text/javascript">//<![CDATA[
27
var MSG_CONFIRM_DELETE_PAGE  = _("Are you sure you want to delete the selected page?");
12
$(document).ready(function() {
13
    $("#pages_table").dataTable($.extend(true, {}, dataTablesDefaults, {
14
        "aoColumnDefs": [
15
            { "aTargets": [ 0, -1 ], "bSortable": false, "bSearchable": false },
16
        ],
17
        "sPaginationType": "full_numbers"
18
    }));
19
20
    $("#del_button").on("click",function(){
21
        if ($("input[name='ids'][type='checkbox']:checked").length){
22
            return confirmDelete(_("Are you sure you want to delete the selected page(s)?"));
23
        } else {
24
            alert(_("No pages have been selected."));
25
            return false;
26
        }
27
    });
28
29
    $(".del_single").on("click", function(){
30
        return confirmDelete(_("Are you sure you want to delete this page?"));
31
    });
32
33
    $(".SelectAll").on("click", function(){
34
        $("input[name='ids'][type='checkbox']").prop("checked", true);
35
    });
36
37
    $(".ClearAll").on("click", function(){
38
        $("input[name='ids'][type='checkbox']").prop("checked", false);
39
    });
40
});
28
41
29
tinyMCE.init({
42
tinyMCE.init({
30
    mode : "textareas",
43
    mode : "textareas",
Lines 47-66 tinyMCE.init({ Link Here
47
    width : "700"
60
    width : "700"
48
//]]>
61
//]]>
49
});
62
});
50
//]]>
51
</script>
63
</script>
52
</head>
64
</head>
53
<body id="tools_koha-content" class="tools">
65
<body id="tools_koha-content" class="tools">
54
[% INCLUDE 'header.inc' %]
66
[% INCLUDE 'header.inc' %]
55
[% INCLUDE 'cat-search.inc' %]
67
[% INCLUDE 'cat-search.inc' %]
56
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% IF ( form ) %]<a href="[% link_self %]">Pages</a> &rsaquo; [% IF ( id ) %]
68
<div id="breadcrumbs">
57
Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div>
69
    <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
70
    <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
71
    [% IF ( form ) %]<a href="[% link_self %]">Pages</a> &rsaquo;
72
    [% IF ( id ) %]Edit page[% ELSE %]Add page[% END %]
73
    [% ELSIF ( view ) %]
74
        <a href="[% link_self %]">Pages</a> &rsaquo;
75
        [% IF ( cms_page.parent ) %]
76
             [% FOREACH parent IN parent_list %]
77
                 [% IF parent.id == cms_page.parent %]<a href="[% link_self %]?op=view&amp;id=[% cms_page.parent %]">[% parent.title_link %]</a> &rsaquo;[% END %]
78
             [% END %]
79
         [% END %]
80
    [% cms_page.title_link %]
81
    [% ELSE %]Pages[% END %]
82
</div>
58
83
59
[% IF ( form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
84
[% IF ( form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
60
   <div id="bd">
85
   <div id="bd">
61
    <div id="yui-main">
86
    <div id="yui-main">
62
    <div class="yui-b">
87
    <div class="yui-b">
63
64
[% UNLESS ( link_opac_base && link_self) %]
88
[% UNLESS ( link_opac_base && link_self) %]
65
    <div class="dialog alert">
89
    <div class="dialog alert">
66
    [% UNLESS ( link_opac_base ) %]
90
    [% UNLESS ( link_opac_base ) %]
Lines 70-86 Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div> Link Here
70
    Warning: Variable <em>link_self</em> not set, some links might not work!</div>
94
    Warning: Variable <em>link_self</em> not set, some links might not work!</div>
71
    [% END %]
95
    [% END %]
72
[% END %]
96
[% END %]
73
[% UNLESS ( form ) %]
97
[% UNLESS ( form || view ) %]
74
    [% IF error_message == 'title_missing' %]
75
        <div class="dialog alert">Error: Required page title missing!</div>
76
    [% END %]
77
<div id="toolbar" class="btn-toolbar">
98
<div id="toolbar" class="btn-toolbar">
78
    <a class="btn btn-small" id="newentry" href="[% link_self %]?op=form"><i class="icon-plus"></i> New page</a>
99
    <a class="btn btn-default btn-sm" id="newentry" href="[% link_self %]?op=form"><i class="fa fa-plus"></i> New page</a>
79
</div>
100
</div>
80
[% END %]
101
[% END %]
81
<pre>DEBUG: [% debug %]</pre>
102
[% IF ( failed_add ) %]
82
<pre>DEBUG2: data.location: [% data.location %] data.branchcode: [% data.branchcode %]</pre>
103
<div class="dialog alert">
83
[% IF ( form ) %]
104
    Failed to add page. Check that:
105
    <ul>
106
        <li>Your link title is unique</li>
107
        <li>If specifying a parent page, the location is the same as your new page</li>
108
    </ul>
109
</div>
110
[% END %]
111
[% IF ( view ) %]
112
<div class="yui-ge">
113
<div id="pagesnav" class="yui-u">
114
    [% IF ( links ) %]
115
    <fieldset>
116
        <ul>
117
            <li><a href="[% link_self %]">Pages home</a></li>
118
        </ul>
119
        <h4>Pages</h4>
120
        <ul id="cms_nav">
121
            [% FOREACH link IN links %]
122
            [% IF ( link.location == '' || link.location == '1' ) %]
123
            [% IF ( link.parent != '' ) %]
124
                [% FOREACH parent IN parent_list %]
125
                    [% 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 %]
126
                [% END %]
127
            [% ELSE %]
128
                <li><a href="[% link_self %]?op=view&amp;id=[% link.id %]">[% link.title_link %]</a></li>
129
            [% END %]
130
            [% END %][% END %]
131
        </ul>
132
    </fieldset>
133
    [% END %]
134
</div>
135
<div class="yui-u first">
136
<h1>Pages: [% cms_page.title %]</h1>
137
[% IF ( cms_page.publish == 1 ) %]
138
    [% cms_page.content %]
139
[% ELSE %]
140
    <div class="dialog message">This page has not been published.</div>
141
    [% cms_page.content %]
142
[% END %]
143
</div>
144
</div>
145
[% ELSIF ( form ) %]
84
        <form name="form" method="post" enctype="multipart/form-data" action="[% link_self %]" >
146
        <form name="form" method="post" enctype="multipart/form-data" action="[% link_self %]" >
85
            <input type="hidden" name="op" value="[% op %]" />
147
            <input type="hidden" name="op" value="[% op %]" />
86
            <input type="hidden" name="id" value="[% id %]" />
148
            <input type="hidden" name="id" value="[% id %]" />
Lines 88-126 Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div> Link Here
88
            <legend>Page</legend>
150
            <legend>Page</legend>
89
            <ol>
151
            <ol>
90
            <li>
152
            <li>
91
                <label for="disp">Display location</label>
153
                <label for="disp">Display location:</label>
92
                <select id="disp" name="disp">
154
                <select id="disp" name="disp">
93
                    <option value=""  [% IF ( data.disp == ""  ) %]selected="selected"[% END %]>All</option>
155
                    [% IF ( data.location == "" ) %]<option value="" selected="selected">All</option>[% ELSE %]<option value="">All</option>[% END %]
94
                    <option value="1" [% IF ( data.disp == "1" ) %]selected="selected"[% END %]>Intranet</option>
156
                    [% IF ( data.location == "1" ) %]<option value="1" selected="selected">Staff interface</option>[% ELSE %]<option value="1">Staff interface</option>[% END %]
95
                    <option value="2" [% IF ( data.disp == "2" ) %]selected="selected"[% END %]>OPAC</option>
157
                    [% IF ( data.location == "2" ) %]<option value="2" selected="selected">OPAC</option>[% ELSE %]<option value="2">OPAC</option>[% END %]
96
                </select>
158
                </select>
97
            </li>
159
            </li>
98
            <li>
160
            <li>
99
                <label for="branch">Library: </label>
161
                <label for="branch">Library:</label>
100
                <select id="branch" name="branch">
162
                <select id="branch" name="branch">
101
                    <option value=""[% IF ( data.branchcode == '' ) %] selected="selected"[% END %]>All libraries</option>
163
                    [% IF ( data.branchcode.branchcode == "" ) %]<option value="" selected="selected">All libraries</option>[% ELSE %]<option value="">All libraries</option>[% END %]
102
                [% FOREACH branch_lis IN branch_list %]
164
                    [% FOREACH branch IN branch_list %]
103
                    <option value="[% branch_lis.branchcode %]"[% IF ( branch_lis.branchcode == data.branchcode ) %] selected="selected"[% END %]>[% branch_lis.branchname %]</option>
165
                        [% IF ( branch.branchcode == data.branchcode.branchcode ) %]<option value="[% branch.branchcode %]" selected="selected">[% branch.branchname %]</option>[% ELSE %]<option value="[% branch.branchcode %]">[% branch.branchname %]</option>[% END %]
104
                [% END %]
166
                    [% END %]
105
                </select>
167
                </select>
106
            </li>
168
            </li>
107
            <li>
169
            <li>
108
                <label for="lang">Language</label>
170
                <label for="lang">Language:</label>
109
<pre>LANG: [% lang %]</pre>
110
                <select id="lang" name="lang">
171
                <select id="lang" name="lang">
111
                    <option value="" [% IF ( data.lang == "" ) %]selected="selected"[% END %]>All</option>
172
                    [% IF ( data.lang == "" ) %]<option value="" selected="selected">All</option>[% ELSE %]<option value="">All</option>[% END %]
112
                    [% FOREACH lang_lis IN lang_list %]
173
                    [% FOREACH lang IN lang_list %]
113
                        <option value="[% lang_lis.rfc4646_subtag %]" [% IF ( lang_lis.rfc4646_subtag == data.lang ) %]selected="selected"[% END %]>[% lang_lis.native_description %] ([% lang_lis.rfc4646_subtag %])</option>
174
                        [% IF ( lang.rfc4646_subtag == data.lang ) %]<option value="[% lang.rfc4646_subtag %]" selected="selected">[% lang.native_description %] ([% lang.rfc4646_subtag %])</option>[% ELSE %]<option value="[% lang.rfc4646_subtag %]">[% lang.native_description %] ([% lang.rfc4646_subtag %])</option>[% END %]
114
                    [% END %]
175
                    [% END %]
115
                </select>
176
                </select>
116
            </li>
177
            </li>
117
            <li>
178
            <li>
118
                <label for="parent">Parent page: </label>
179
                <label for="parent">Parent page: </label>
119
                <select id="parent" name="parent">
180
                <select id="parent" name="parent">
120
                    <option value="" [% IF ( data.id == "" ) %]selected="selected"[% END %]>No parent</option>
181
                    [% IF ( data.id == "" ) %]<option value="" selected="selected">No parent</option>[% ELSE %]<option value="">No parent</option>[% END %]
121
                [% FOREACH parent_lis IN parent_list %]
182
                    [% FOREACH parent IN parent_list %]
122
                        <option value="[% parent_lis.id %]" [% IF ( data.parent.id == parent_lis.id ) %]selected="selected"[% END %]>[% parent_lis.title_link %]</option>
183
                        [% IF ( data.parent.id == parent.id ) %]<option value="[% parent.id %]" selected="selected">[% parent.title_link %]</option>[% ELSE %]<option value="[% parent.id %]">[% parent.title_link %]</option>[% END %]
123
                [% END %]
184
                    [% END %]
124
                </select>
185
                </select>
125
            </li>
186
            </li>
126
            <li>
187
            <li>
Lines 133-143 Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div> Link Here
133
            </li>
194
            </li>
134
            <li>
195
            <li>
135
                <label for="number">Appear in position: </label>
196
                <label for="number">Appear in position: </label>
136
                <input id="sortorder" size="3" name="sortorder" type="text" value="[% IF ( data.sortorder ) %][% data.sortorder %][% ELSE %]0[% END %]" />
197
                [% IF ( data.sortorder ) %]<input id="number" size="3" name="number" type="text" value="[% data.sortorder %]" />[% ELSE %]<input id="number" size="3" name="number" type="text" value="0" />[% END %]
137
            </li>
198
            </li>
138
            <li>
199
            <li>
139
                <label for="publish">Publish: </label>
200
                <label for="publish">Publish: </label>
140
                <input type="checkbox" id="publish" name="publish"[% IF ( data.publish ) %] checked="checked"[% END %]/>
201
                [% IF ( data.publish ) %]<input type="checkbox" id="publish" name="publish" checked="checked" />[% ELSE %]<input type="checkbox" id="publish" name="publish" />[% END %]
141
            </li>
202
            </li>
142
            <li><label for="new">Content: </label>
203
            <li><label for="new">Content: </label>
143
            <textarea name="content" id="content" cols="75" rows="10">[% data.content %]</textarea>
204
            <textarea name="content" id="content" cols="75" rows="10">[% data.content %]</textarea>
Lines 147-230 Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div> Link Here
147
            <fieldset class="action"><input class="button" type="submit" value="Save" /> <a class="cancel" href="[% link_self %]">Cancel</a></fieldset>
208
            <fieldset class="action"><input class="button" type="submit" value="Save" /> <a class="cancel" href="[% link_self %]">Cancel</a></fieldset>
148
        </form>
209
        </form>
149
    [% ELSE %]
210
    [% ELSE %]
211
212
    <h1>Pages</h1>
150
        <div style="margin-bottom:5px;">
213
        <div style="margin-bottom:5px;">
151
        <form name="form" method="post" action="[% link_self %]" >
214
        <form name="filter" method="post" action="[% link_self %]">
152
            <label for="disp">Display location:</label>
215
            <label for="disp">Display location:</label>
153
            <select name="disp" id="disp">
216
            <select name="disp" id="disp">
154
                <option value=""  [% IF ( disp == ""  ) %]selected="selected"[% END %]>All</option>
217
                [% IF ( disp == "" ) %]<option value="" selected="selected">All</option>[% ELSE %]<option value="">All</option>[% END %]
155
                <option value="0" [% IF ( disp == "0" ) %]selected="selected"[% END %]>OPAC</option>
218
                [% IF ( disp == "1" ) %]<option value="1" selected="selected">Staff interface</option>[% ELSE %]<option value="1">Staff interface</option>[% END %]
156
                <option value="1" [% IF ( disp == "1" ) %]selected="selected"[% END %]>Librarian interface</option>
219
                [% IF ( disp == "2" ) %]<option value="2" selected="selected">OPAC</option>[% ELSE %]<option value="2">OPAC</option>[% END %]
157
            </select>
220
            </select>
158
221
159
            <label for="branch">Library: </label>
222
            <label for="branch">Library:</label>
160
            <select id="branch" name="branch">
223
            <select id="branch" name="branch">
161
                <option value=""[% IF ( branch == "" ) %] selected="selected"[% END %]>All libraries</option>
224
                [% IF ( branch == "" ) %]<option value="" selected="selected">All libraries</option>[% ELSE %]<option value="">All libraries</option>[% END %]
162
                [% FOREACH branch_lis IN branch_list %]
225
                [% FOREACH br IN branch_list %]
163
                <option value="[% branch_lis.branchcode %]"[% IF ( branch_lis.branchcode == branch ) %] selected="selected"[% END %]>[% branch_lis.branchname %]</option>
226
                    [% IF ( br.branchcode == branch ) %]
227
                          <option value="[% br.branchcode %]" selected="selected">[% br.branchname %]</option>
228
                    [% ELSE %]
229
                        <option value="[% br.branchcode %]">[% br.branchname %]</option>
230
                    [% END %]
164
                [% END %]
231
                [% END %]
165
            </select>
232
            </select>
166
233
167
            <label for="lang">Language:</label>
234
            <label for="lang">Language:</label>
168
            <select name="lang" id="lang">
235
            <select name="lang" id="lang">
169
                <option value="" [% IF ( lang == "" ) %]selected="selected"[% END %]>All</option>
236
                [% IF ( lang == "" ) %]<option value="" selected="selected">All</option>[% ELSE %]<option value="">All</option>[% END %]
170
                [% FOREACH lang_lis IN lang_list %]
237
                [% FOREACH language IN lang_list %]
171
                <option value="[% lang_lis.rfc4646_subtag %]" [% IF ( lang_lis.rfc4646_subtag == lang ) %]selected="selected"[% END %]>[% lang_lis.native_description %] ([% lang_lis.rfc4646_subtag %])</option>
238
                    [% IF ( language.rfc4646_subtag == lang ) %]
239
                        <option value="[% language.rfc4646_subtag %]" selected="selected">[% language.native_description %] ([% language.rfc4646_subtag %])</option>
240
                    [% ELSE %]
241
                        <option value="[% language.rfc4646_subtag %]">[% language.native_description %] ([% language.rfc4646_subtag %])</option>
242
                    [% END %]
172
                [% END %]
243
                [% END %]
173
            </select>
244
            </select>
245
            <input type="hidden" name="op" value="filter" />
174
            <input type="submit" class="button" value="Filter" />
246
            <input type="submit" class="button" value="Filter" />
175
        </form>
247
        </form>
176
        </div>
248
        </div>
177
        [% IF ( page_list_count ) %]
249
        [% IF ( page_list.size ) %]
178
        <form name="del_form" method="post" action="[% link_self %]" onsubmit='return confirm(MSG_CONFIRM_DELETE_PAGE)'>
250
        <form name="del_form" method="post" action="[% link_self %]">
179
                <table id="newst">
251
                <table id="pages_table">
180
                   <thead><tr>
252
                   <thead><tr>
181
                        <th>&nbsp;</th>
253
                        <th>&nbsp;</th>
182
                        <th>Pub.</th>
254
                        <th>Published</th>
183
                        <th>Parent</th>
255
                        <th>Parent</th>
184
                        <th>Loc.</th>
256
                        <th>Location</th>
185
                        <th>Lib.</th>
257
                        <th>Library</th>
186
                        <th>Lang.</th>
258
                        <th>Language</th>
187
                        <th>Num.</th>
259
                        <th>Number</th>
188
                        <th>Link title</th>
260
                        <th>Link title</th>
189
                        <th>Page title</th>
261
                        <th>Page title</th>
190
                        <th>&nbsp;</th>
262
                        <th>&nbsp;</th>
191
                        <th>&nbsp;</th>
192
                    </tr></thead>
263
                    </tr></thead>
193
                    <tbody>[% FOREACH page_lis IN page_list %]
264
                    <tbody>[% FOREACH page IN page_list %]
194
                        <tr>
265
                        <tr>
195
                            <td>
266
                            <td><input type="checkbox" name="ids" id="ids" value="[% page.id %]" /></td>
196
                                <input type="checkbox" name="ids" id="ids" value="[% page_lis.id %]" />
267
                            <td>[% IF ( page.publish ) %]Yes[% ELSE %]No[% END %]</td>
197
                            </td>
268
                            <td>[% page.parent.title_link %]</td>
198
                            <td>[% IF ( page_lis.publish ) %]Yes[% ELSE %]No[% END %]</td>
269
                            <td>[% SWITCH page.location %]
199
                            <td>[% page_lis.parent.title_link %]</td>
200
                            <td>[% SWITCH page_lis.display %]
201
                                [% CASE "0" %]
202
                                    OPAC
203
                                [% CASE "1" %]
204
                                    Staff interface
205
                                [% CASE "" %]
270
                                [% CASE "" %]
206
                                    All
271
                                    All
272
                                [% CASE "1" %]
273
                                    Staff interface
274
                                [% CASE "2" %]
275
                                    OPAC
276
                                [% END %]
277
                            </td>
278
                            <td>[% IF ( page.branchcode == "" ) %]All[% ELSE %][% page.branchcode.branchname %][% END %]</td>
279
                            <td>[% IF ( page.lang == "" ) %]All[% ELSE %]
280
                                [% FOREACH lang IN lang_list %]
281
                                    [% IF ( lang.rfc4646_subtag == page.lang ) %][% lang.native_description %] ([% lang.rfc4646_subtag %])[% END %]
207
                                [% END %]
282
                                [% END %]
283
                            [% END %]</td>
284
                            <td>[% page.sortorder %]</td>
285
                            <td><a href="[% link_self %]?op=form&amp;id=[% page.id %]">[% page.title_link %]</a></td>
286
                            <td>[% page.title %]</td>
287
                            <td class="actions">
288
                                <div class="btn-group">
289
                                    <a class="btn btn-default btn-xs dropdown-toggle" id="opencmspageactions[% page.id %]" role="button" data-toggle="dropdown" href="#">
290
                                        Actions <b class="caret"></b></a>
291
                                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="opencmspageactions[% page.id %]">
292
                                        <li><a href="[% link_self %]?op=form&amp;id=[% page.id %]"><i class="fa fa-pencil"></i> Edit</a></li>
293
                                        <li><a href="[% link_self %]?op=delSingle&amp;id=[% page.id %]" class="del_single"><i class="fa fa-trash"></i> Delete</a></li>
294
                                        [% IF ( page.location == "" ) %]
295
                                            <li><a href="[% link_opac %]?id=[% page.id %]"><i class="fa fa-eye"></i> OPAC</a></li>
296
                                            <li><a href="[% link_self %]?op=view&amp;id=[% page.id %]"><i class="fa fa-eye"></i> Intranet</a></li>
297
                                        [% ELSIF ( page.location == "1" ) %]
298
                                            <li><a href="[% link_self %]?op=view&amp;id=[% page.id %]"><i class="fa fa-eye"></i> Intranet</a></li>
299
                                        [% ELSIF ( page.location == "2" ) %]
300
                                            <li><a href="[% link_opac %]?id=[% page.id %]"><i class="fa fa-eye"></i> OPAC</a></li>
301
                                        [% END %]
302
                                    </ul>
303
                                </div>
208
                            </td>
304
                            </td>
209
                            <td>[% IF ( page_lis.branch == "" ) %]
210
                                All
211
                                [% ELSE %][% page_lis.branchname %]
212
                                [% END %]</td>
213
                            <td>[% IF ( page_lis.langcode == "" ) %]All[% ELSE %]
214
                                [% page_lis.langcode %][% END %]</td>
215
                            <td>[% page_lis.sortorder %]</td>
216
                            <td><a href="[% link_self %]?op=form&amp;id=[% page_lis.id %]">[% page_lis.title_link %]</a></td>
217
                            <td>[% page_lis.title %]</td>
218
                            <td><a href="[% link_self %]?op=form&amp;id=[% page_lis.id %]">Edit</a></td>
219
                            <td><a href="[% link_opac %]?id=[% page_lis.id %]">View</a></td>
220
                        </tr>
305
                        </tr>
221
                    [% END %]</tbody>
306
                    [% END %]</tbody>
222
                </table>
307
                </table>
223
                <input type="hidden" name="op" value="del" />
308
                <input type="hidden" name="op" value="del" />
224
                <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
309
                <fieldset class="action">
310
                    <a class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>&nbsp;
311
                    <input type="submit" class="button" id="del_button" value="Delete selected" />
312
                </fieldset>
225
            </form>
313
            </form>
226
        [% ELSE %]
314
        [% ELSE %]
227
            <p>No pages exists</p>
315
            <div class="dialog message">No pages exist. <a href="[% link_self %]?op=form">Create a new page?</a></div>
228
        [% END %]
316
        [% END %]
229
    [% END %]
317
    [% END %]
230
</div>
318
</div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (-14 lines)
Lines 286-305 Link Here
286
                                    [% END %]
286
                                    [% END %]
287
                                </ul>
287
                                </ul>
288
                            </div> <!-- /#moresearches -->
288
                            </div> <!-- /#moresearches -->
289
                            <div id="cms_nav_top">
290
								[% IF ( cms_nav_top ) %]
291
								<ul>
292
									[% WHILE ( cms_item = cms_nav_top.next ) %]
293
										[% IF ( cms_item.id == cms_page.id ) %]
294
											<li class="cms_nav_top_active">
295
										[% ELSE %]
296
                                            <li>
297
										[% END %]
298
                                        <a href="/cgi-bin/koha/opac-cmspages.pl?id=[% cms_item.id %]">[% cms_item.title_link %]</a></li>
299
									[% END %]
300
								</ul>
301
								[% END %]
302
                            </div>
303
                    </div> <!-- /.row-fluid -->
289
                    </div> <!-- /.row-fluid -->
304
290
305
                [% END # / OpacPublic %]
291
                [% END # / OpacPublic %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/navigation.inc (-8 / +19 lines)
Lines 1-13 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
<div id="opacnav">
2
<div id="opacnav">
3
[% IF ( cms_nav_left ) %]
3
    [% IF ( links ) %]
4
<ul id="cms_nav_left">
4
        <h4>Pages</h4>
5
[% WHILE ( item = cms_nav_left.next ) %]
5
        <ul id="cms_nav">
6
    <li><a href="/cgi-bin/koha/opac-cmspages.pl?id=[% item.id %]">[% item.title_link | html %]</a></li>
6
            [% FOREACH link IN links %]
7
[% END %]
7
                [% IF ( link.publish == '1' || link.publish == '0' && CAN_user_tools_edit_pages ) %]
8
</ul>
8
                [% IF ( link.location == '' || link.location == '2' ) %]
9
[% END %]
9
                    [% IF ( link.parent != '' ) %]
10
[% OpacNav | $raw %]</div>
10
                        [% FOREACH parent IN parent_list %]
11
                            [% IF ( parent.id == link.parent ) %]<li style="margin-left:20px;"><a href="/cgi-bin/koha/opac-cmspages.pl?id=[% link.parent %]">[% parent.title_link | html %]</a> &rsaquo; <a href="/cgi-bin/koha/opac-cmspages.pl?id=[% link.id %]">[% link.title_link | html %]</a></li>[% END %]
12
                        [% END %]
13
                    [% ELSE %]
14
                        <li><a href="/cgi-bin/koha/opac-cmspages.pl?id=[% link.id %]">[% link.title_link | html %]</a></li>
15
                    [% END %]
16
                [% END %][% END %]
17
            [% END %]
18
        </ul>
19
    [% END %]
20
    [% OpacNav | $raw %]
21
</div>
11
[% IF IsPatronPage %]
22
[% IF IsPatronPage %]
12
    <div id="usermenu">[% INCLUDE usermenu.inc %]</div>
23
    <div id="usermenu">[% INCLUDE usermenu.inc %]</div>
13
[% END %]
24
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-cmspages.tt (-42 / +14 lines)
Lines 1-7 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %][% IF (cms_page.title) %] - [% cms_page.title %][% ELSE %] catalog[% END%]</title>
4
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online catalog[% END %][% IF (cms_page.title) %] &rsaquo; [% cms_page.title %][% END%]</title>
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% BLOCK cssinclude %][% END %]
6
[% BLOCK cssinclude %][% END %]
7
</head>
7
</head>
Lines 10-17 Link Here
10
10
11
<div class="main">
11
<div class="main">
12
    <ul class="breadcrumb">
12
    <ul class="breadcrumb">
13
        <li><a href="/cgi-bin/koha/opac-main.pl">Home</a></li>
13
        <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
14
        <li><span class="divider">&rsaquo;</span></li>
14
        [% IF ( cms_page.parent ) %]
15
            [% FOREACH parent IN parents %]
16
                [% IF parent.id == cms_page.parent %]<li><a href="/cgi-bin/koha/opac-cmspages.pl?id=[% cms_page.parent %]">[% parent.title_link %]</a> <span class="divider">&rsaquo;</span></li>[% END %]
17
            [% END %]
18
        [% END %]
15
        <li><a href="#">[% cms_page.title_link %]</a></li>
19
        <li><a href="#">[% cms_page.title_link %]</a></li>
16
    </ul>
20
    </ul>
17
21
Lines 39-86 Link Here
39
    [% ELSE %]
43
    [% ELSE %]
40
        <div class="span9">
44
        <div class="span9">
41
    [% END %]
45
    [% END %]
42
        [% cms_page.content %]
46
47
        [% IF ( cms_page.publish == 1 ) || ( cms_page.publish == 0 && CAN_user_tools_edit_pages ) %]
48
            [% cms_page.content %]
49
        [% ELSE %]
50
            This page has not been published.
51
        [% END %]
52
43
        [% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock">[% OpacMainUserBlock %]</div>[% END %]
53
        [% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock">[% OpacMainUserBlock %]</div>[% END %]
44
        </div> <!-- / .span 7/9 -->
54
        </div> <!-- / .span 7/9 -->
45
55
46
        [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) || OpacNavRight ) %]
47
            <div class="span3">
48
                [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
49
                    [% UNLESS ( loggedinusername ) %]
50
                        [% UNLESS ( casAuthentication || shibbolethAuthentication ) %]
51
                            <div id="login">
52
                                <form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="auth">
53
                                    <input type="hidden" name="koha_login_context" value="opac" />
54
                                    <fieldset class="brief">
55
                                        <legend>Log in to your account:</legend>
56
                                        <label for="userid">Login:</label><input type="text" id="userid" name="userid" />
57
                                        <label for="password">Password:</label><input type="password" id="password" name="password" />
58
                                    <fieldset class="action">
59
                                        <input type="submit" value="Log in" class="btn" />
60
                                    </fieldset>
61
                                    [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]<div id="patronregistration"><p>Don't have an account? <a href="/cgi-bin/koha/opac-memberentry.pl">Register here.</a></p></div>[% END %]
62
                                    </fieldset>
63
                                [% IF Koha.Preference( 'NoLoginInstructions' ) %]
64
                                    <div id="nologininstructions-main">
65
                                        [% Koha.Preference( 'NoLoginInstructions' ) %]
66
                                    </div>
67
                                [% END %]
68
                                </form>
69
                            </div> <!-- /#login -->
70
                        [% END # /casAuthentication %]
71
                        [% IF persona %]
72
                            <a href="#" class="persona-button" id="browserid" ><span>Sign in with your email</span></a>
73
                        [% END # /persona %]
74
                    [% END # / loggedinusername %]
75
                [% END # /opacuserlogin %]
76
                [% IF ( OpacNavRight ) %]
77
                    <div id="opacnavright">
78
                        [% OpacNavRight %]
79
                    </div>
80
                [% END # /OpacNavRight %]
81
            </div> <!-- / .span3 -->
82
        [% END # /opacuserlogin || OpacNavRight %]
83
84
        </div> <!-- /.container-fluid -->
56
        </div> <!-- /.container-fluid -->
85
    </div> <!-- /.row-fluid -->
57
    </div> <!-- /.row-fluid -->
86
</div> <!-- /.main -->
58
</div> <!-- /.main -->
(-)a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less (-31 / +9 lines)
Lines 225-261 td { Link Here
225
}
225
}
226
226
227
#cms_nav_top {
227
#cms_nav_top {
228
	li {
228
    list-style-type: circle;
229
		margin-bottom: -1em;
229
    padding: 0;
230
		display: inline;
230
    margin: 0;
231
		white-space: nowrap;
231
    a {
232
		border-top-left-radius: 5px;
232
        text-decoration: none;
233
		border-top-right-radius: 5px;
233
    }
234
		background-color: #eee;
234
    a:hover {
235
		border: 1px solid #D2D2CF;
235
        text-decoration: underline;
236
		border-bottom: none;
236
    }
237
		padding: 0.1em 0.8em 0em 0.8em;
238
		font-weight: bold;
239
		font-size: 1.2em;
240
		border-bottom: 1px solid #D2D2CF;
241
		a {
242
			text-decoration: none;
243
		}
244
		&.cms_nav_top_active {
245
			background-color: #fff;
246
			border-bottom: 1px solid #FFF;
247
		}
248
	}
249
	ul {
250
		margin: 0;
251
		display: inline;
252
	}
253
	display: inline;
254
}
255
256
ul#cms_nav_left {
257
	list-style-type: none;
258
	padding: 0;
259
}
237
}
260
238
261
#news {
239
#news {
(-)a/opac/opac-cmspages.pl (-5 / +9 lines)
Lines 23-28 use C4::Auth; Link Here
23
use C4::Output;
23
use C4::Output;
24
use C4::Languages qw( getTranslatedLanguages accept_language );
24
use C4::Languages qw( getTranslatedLanguages accept_language );
25
use Koha::CmsPages;
25
use Koha::CmsPages;
26
use Data::Dumper;
26
27
27
my $input  = new CGI;
28
my $input  = new CGI;
28
my $id     = scalar $input->param( 'id' )     // '';
29
my $id     = scalar $input->param( 'id' )     // '';
Lines 42-52 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
42
my ( $theme, $news_lang, $availablethemes ) = C4::Templates::themelanguage(
43
my ( $theme, $news_lang, $availablethemes ) = C4::Templates::themelanguage(
43
    C4::Context->config( 'opachtdocs'), 'opac-cmspages.tt', 'opac', $input );
44
    C4::Context->config( 'opachtdocs'), 'opac-cmspages.tt', 'opac', $input );
44
45
45
my ($cms_nav_top, $cms_nav_left, $cms_data) = Koha::CmsPages->page( $id );
46
# List all pages, if id is set generate parent page list and data.
47
my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id );
48
49
my $links = Koha::CmsPages->search( {}, { order_by => 'sortorder' } );
50
my $cms_data = Koha::CmsPages->find( $id );
46
$template->param(
51
$template->param(
47
	cms_page     => $cms_data,
52
    links       => $links,
48
    cms_nav_top  => $cms_nav_top,
53
    cms_page    => $cms_data,
49
    cms_nav_left => $cms_nav_left,
54
    parent_list => $parent_list,
50
);
55
);
51
52
output_html_with_http_headers $input, $cookie, $template->output;
56
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/opac/opac-main.pl (-3 / +11 lines)
Lines 30-36 use C4::Overdues; Link Here
30
use Koha::Checkouts;
30
use Koha::Checkouts;
31
use Koha::Holds;
31
use Koha::Holds;
32
use Koha::News;
32
use Koha::News;
33
use Koha::CmsPages qw( list );
33
use Koha::CmsPages;
34
34
35
my $input = new CGI;
35
my $input = new CGI;
36
my $dbh   = C4::Context->dbh;
36
my $dbh   = C4::Context->dbh;
Lines 110-118 $template->param( Link Here
110
    daily_quote         => $quote,
110
    daily_quote         => $quote,
111
);
111
);
112
112
113
my $id = scalar $input->param( 'id' ) // '';
114
my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id );
115
my $links = Koha::CmsPages->search( {}, { order_by => 'parent' } );
116
my $cms_data = Koha::CmsPages->page( $id );
113
$template->param(
117
$template->param(
114
    cms_nav_top => Koha::CmsPages->child_links( undef ),
118
    links       => $links,
115
);
119
    cms_page    => $cms_data,
120
    parent_list => $parent_list,
121
    );
122
123
116
124
117
if (C4::Context->preference('GoogleIndicTransliteration')) {
125
if (C4::Context->preference('GoogleIndicTransliteration')) {
118
        $template->param('GoogleIndicTransliteration' => 1);
126
        $template->param('GoogleIndicTransliteration' => 1);
(-)a/t/Pages.t (-31 lines)
Lines 1-31 Link Here
1
#!/usr/bin/perl
2
3
use Modern::Perl;
4
use Carp;
5
use Test::More tests => 2;
6
use Data::Dumper::Concise;
7
8
BEGIN {
9
    use_ok('C4::Content');
10
}
11
12
my $src = [
13
    { id => '1', parent => '' },
14
    { id => '2', parent => '1' },
15
    { id => '3', parent => '1' },
16
    { id => '4', parent => '2' },
17
    { id => '5', parent => '2' },
18
];
19
20
my $expected = [
21
    { id => '1', children => [
22
        { id => '2', children => [
23
            { id => '4', children => [] },
24
            { id => '5', children => [] } ]
25
        },
26
        { id => '3', children => [] } ]
27
    },
28
];
29
30
my $output = C4::Content::_SQLToPerl($src);
31
is_deeply($output, $expected);
(-)a/t/db_dependent/Pages.t (-51 / +72 lines)
Lines 18-92 Link Here
18
18
19
use Modern::Perl;
19
use Modern::Perl;
20
20
21
use Test::More tests => 2;
21
use Test::More tests => 10;
22
use Test::Warn;
22
use Test::Warn;
23
use Data::Dumper::Concise;
24
23
25
use C4::Context;
24
use C4::Context;
26
use Koha::Database;
25
use Koha::Database;
27
use t::lib::TestBuilder;
26
use t::lib::TestBuilder;
28
27
29
BEGIN {
28
BEGIN {
30
    use_ok('Koha::Objects');
31
    use_ok('Koha::CmsPages');
29
    use_ok('Koha::CmsPages');
30
    use_ok('Koha::CmsPage');
32
}
31
}
33
32
34
my $builder = t::lib::TestBuilder->new();
33
my $database = Koha::Database->new();
34
my $schema   = $database->schema();
35
my $dbh      = C4::Context->dbh;
36
my $builder  = t::lib::TestBuilder->new();
35
37
36
# Start transaction
38
$schema->storage->txn_begin();
37
my $dbh = C4::Context->dbh;
39
$dbh->do( 'DELETE FROM cms_pages' );
38
$dbh->{ AutoCommit } = 0;
40
$dbh->do( 'DELETE FROM issues' );
39
$dbh->{ RaiseError } = 1;
40
$dbh->do( 'DELETE FROM items' );
41
$dbh->do( 'DELETE FROM borrowers' );
41
$dbh->do( 'DELETE FROM borrowers' );
42
$dbh->do( 'DELETE FROM items' );
42
$dbh->do( 'DELETE FROM branches' );
43
$dbh->do( 'DELETE FROM branches' );
43
$dbh->do( 'DELETE FROM cms_pages' );
44
44
45
my $branchcode = $builder->build({ source => 'Branch' });
45
my $branchcode = $builder->build({ source => 'Branch' })->{'branchcode'};
46
46
my $borrowernumber = $builder->build({ source => 'Borrower' })->{'borrowernumber'};
47
my $page10 = $builder->build({
47
48
	source => 'CmsPage',
48
# new parent page
49
	value  => {
49
my $parent_page = Koha::CmsPages->add({
50
		parent     => undef,
50
    id => 1,
51
		title_link => 'page 10',
51
    branchcode => $branchcode,
52
		title      => 'full page 10',
52
    location => 2,
53
		published  => 1,
53
    lang => '',
54
		sortorder  => 1,
54
    parent => undef,
55
	}
55
    title_link => 'page1',
56
});
56
    title => 'Page 1',
57
my $page11 = $builder->build({
57
    publish => 0,
58
	source => 'CmsPage',
58
    sortorder => 1,
59
	value  => {
59
    content => "This is the first page.",
60
		parent     => $page10->{'id'},
61
		title_link => 'subpage 11',
62
		title      => 'full subpage 11',
63
		published  => 1,
64
		sortorder  => 0,
65
	}
66
});
60
});
67
my $page12 = $builder->build({
61
68
	source => 'CmsPage',
62
is($parent_page->title, 'Page 1', "First page created");
69
	value  => {
63
70
		parent     => $page10->{'id'},
64
# new child page
71
		title_link => 'subpage 12',
65
my $child_page = Koha::CmsPages->add({
72
		title      => 'full subpage 12',
66
    id => 2,
73
		published  => 1,
67
    branchcode => $branchcode,
74
		sortorder  => 1,
68
    location => 2,
75
	}
69
    lang => '',
70
    parent => $parent_page->id,
71
    title_link => 'page2',
72
    title => 'Page 2',
73
    publish => 1,
74
    sortorder => 2,
75
    content => "This is the second page.",
76
});
76
});
77
my $page20 = $builder->build({
77
78
	source => 'CmsPage',
78
# $page->parent specifies who this page is the parent of
79
	value  => {
79
is(Koha::CmsPages->find($child_page->parent)->title, 'Page 1', 'Child and parent page connected');
80
		parent     => undef,
80
81
		title_link => 'page 20',
81
# Koha::CmsPages->list() with no specified ID should return all pages
82
		title      => 'full page 20',
82
my ( $page_list, $parent_list, $data ) = Koha::CmsPages->list( '' );
83
		published  => 0,
83
is(scalar @{ $page_list }, 2, "Two pages have been created");
84
		sortorder  => 2,
84
85
	}
85
# Koha::CmsPages->list() is used for filtering (filter display location)
86
( $page_list, $parent_list, $data ) = Koha::CmsPages->list( '', 2, '', '' );
87
is(scalar @{ $page_list }, 2, "Both pages can be seen on staff interface");
88
89
is($parent_list->[0]->{id}, $parent_page->id, "Correct page is returned as a parent");
90
is($data, undef, "Data is undefined because no ID was given");
91
92
# Koha::CmsPages->list() is used to show data about a page when given an ID
93
( $page_list, $parent_list, $data ) = Koha::CmsPages->list( 2 );
94
is($data->{content}, "This is the second page.", "Data is defined when given an ID");
95
96
# Try to add a child page under a page where their locations do not match up
97
my $test_page = Koha::CmsPages->add({
98
    id => 3,
99
    branchcode => $branchcode,
100
    location => 1,
101
    lang => '',
102
    parent => $child_page->id,
103
    title_link => 'failedadd',
104
    title => 'Failed add',
105
    publish => 0,
106
    sortorder => 3,
107
    content => "This page should not be added",
86
});
108
});
87
109
88
my $result = Koha::CmsPages->child_links( undef );
110
is($test_page, undef, "Child page cannot be added under a page if their locations do not match");
89
is_deeply( $result, [ $page10, $page20 ]);
90
111
91
$dbh->rollback();
112
$dbh->rollback();
92
113
(-)a/tools/cmspages.pl (-14 / +46 lines)
Lines 23-30 use CGI qw( -utf8 ); Link Here
23
use C4::Auth;
23
use C4::Auth;
24
use C4::Output;
24
use C4::Output;
25
use C4::Languages qw( getTranslatedLanguages );
25
use C4::Languages qw( getTranslatedLanguages );
26
use Koha::Database;
27
use Koha::CmsPages;
26
use Koha::CmsPages;
27
use Koha::Libraries;
28
use Koha::CmsPage;
28
29
29
my $link_self = '/cgi-bin/koha/tools/cmspages.pl';
30
my $link_self = '/cgi-bin/koha/tools/cmspages.pl';
30
31
Lines 50-66 $template->param( Link Here
50
    disp   => $disp
51
    disp   => $disp
51
);
52
);
52
53
53
my $schema = Koha::Database->new->schema;
54
my @branches = $schema->resultset( 'Branch' )->all;
55
$template->param( branch_list => @branches );
56
57
my $lang_list = getTranslatedLanguages;
54
my $lang_list = getTranslatedLanguages;
55
my $branches = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
58
56
59
# List all pages, if id is set generate parent page list and data.
57
# List all pages, if id is set generate parent page list and data.
60
my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id );
58
my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id );
61
59
62
$template->param(
60
$template->param(
63
    page_list_count => scalar $page_list,
61
    branch_list     => $branches,
64
    page_list       => $page_list,
62
    page_list       => $page_list,
65
    parent_list     => $parent_list,
63
    parent_list     => $parent_list,
66
    data            => $page_data,
64
    data            => $page_data,
Lines 74-90 if ( $op eq 'form' ) { Link Here
74
        id   => $id,
72
        id   => $id,
75
        op   => 'add'
73
        op   => 'add'
76
    );
74
    );
77
}
75
} elsif ( $op eq 'add' ) {
78
76
    my $success = Koha::CmsPages->add({
79
if ( $op eq 'add' ) {
77
        id         => scalar $cgi->param('id'),
80
    Koha::CmsPages->add( $cgi );
78
        parent     => scalar $cgi->param('parent'),
79
        location   => scalar $cgi->param('disp'),
80
        branchcode => scalar $cgi->param('branch'),
81
        lang       => scalar $cgi->param('lang'),
82
        sortorder  => scalar $cgi->param('number'),
83
        title      => scalar $cgi->param('title'),
84
        title_link => scalar $cgi->param('title_link'),
85
        publish    => scalar $cgi->param('publish'),
86
        content    => scalar $cgi->param('content'),
87
    });
88
    unless ($success) {
89
        $template->param( failed_add => 1 );
90
    }
91
    if ($success) {
92
        print $cgi->redirect( $link_self );
93
    }
94
} elsif ( $op eq 'delSingle' ) {
95
    Koha::CmsPages->find( $id )->delete();
81
    print $cgi->redirect( $link_self );
96
    print $cgi->redirect( $link_self );
82
83
} elsif ( $op eq 'del' ) {
97
} elsif ( $op eq 'del' ) {
84
    # param => multi_param; no list-ctx warnings
98
    # param => multi_param; no list-ctx warnings
85
    Koha::CmsPages->remove( $cgi->multi_param( 'ids' ) );
99
    my @ids = $cgi->multi_param('ids');
100
    foreach (@ids){
101
        Koha::CmsPages->find($_)->delete;
102
    }
86
    print $cgi->redirect( $link_self );
103
    print $cgi->redirect( $link_self );
104
} elsif ( $op eq 'view' ) {
105
    my $cms_data = Koha::CmsPages->find( $id );
106
    my $links = Koha::CmsPages->search( {}, { order_by => 'sortorder' } );
107
    $template->param(
108
        links    => $links,
109
        cms_page => $cms_data,
110
        view => 1,
111
        id   => $id,
112
        op   => 'view',
113
    );
114
} elsif ( $op eq 'filter' ) {
115
    my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id, $disp, $branch, $lang );
116
    $template->param(
117
        page_list       => $page_list,
118
        parent_list     => $parent_list,
119
        data            => $page_data,
120
    );
87
}
121
}
88
89
$template->param( link_self => $link_self );
122
$template->param( link_self => $link_self );
90
output_html_with_http_headers $cgi, $cookie, $template->output;
123
output_html_with_http_headers $cgi, $cookie, $template->output;
91
- 

Return to bug 15326