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 (-27 / +51 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 54-67 Adds a new page to the CMS database based on the input data. Link Here
54
54
55
sub add {
55
sub add {
56
    my ( $self, $input ) = @_;
56
    my ( $self, $input ) = @_;
57
warn "input: ", scalar $input->param('location');
58
    carp( 'Koha::CmsPages::add() undefined parameter: input' ) unless defined $input;
57
    carp( 'Koha::CmsPages::add() undefined parameter: input' ) unless defined $input;
59
    my $data = {
58
    my $data = {
60
        parent     =>   scalar          $input->param( 'parent' )     eq '' ? undef : scalar $input->param( 'parent' ),
59
        parent     =>   scalar          $input->param( 'parent' ) eq '' ? undef : scalar $input->param( 'parent' ),
61
        location   =>   scalar          $input->param( 'location' )   eq '' ? undef : scalar $input->param( 'location'),
60
        location   =>   scalar          $input->param( 'disp' )   eq '' ? undef : scalar $input->param( 'disp'),
62
        branchcode =>   scalar          $input->param( 'branchcode' ) eq '' ? undef : scalar $input->param( 'branchcode' ),
61
        branchcode =>   scalar          $input->param( 'branch' ) eq '' ? undef : scalar $input->param( 'branch' ),
63
        lang       =>   scalar          $input->param( 'lang' ),
62
        lang       =>   scalar          $input->param( 'lang' ),
64
        sortorder  =>   scalar          $input->param( 'sortorder' ),
63
        sortorder  =>   scalar          $input->param( 'number' ),
65
        title      =>   scalar          $input->param( 'title' ),
64
        title      =>   scalar          $input->param( 'title' ),
66
        title_link =>   scalar          $input->param( 'title_link' ),
65
        title_link =>   scalar          $input->param( 'title_link' ),
67
        publish    =>   defined (scalar $input->param( 'publish' )),
66
        publish    =>   defined (scalar $input->param( 'publish' )),
Lines 72-77 warn "input: ", scalar $input->param('location'); Link Here
72
        $data->{'id'} = scalar $input->param( 'id' );
71
        $data->{'id'} = scalar $input->param( 'id' );
73
    }
72
    }
74
73
74
    # Ensuring link titles are unique
75
    my $title_link = $input->param('title_link');
76
    if ( Koha::CmsPages->find({ title_link => $title_link }) ) {
77
        my $existing_link = Koha::CmsPages->find({ title_link => $title_link });
78
        my $link = $existing_link->unblessed;
79
        unless ( $link->{'id'} eq $input->param('id') ) {
80
            return undef;
81
        }
82
    }
83
84
    # Ensuring that, if page has parent, provided location suits parent location
85
    my $parent = $input->param('parent');
86
    my $parent_obj = Koha::CmsPages->find($parent);
87
    if ( $parent_obj ) {
88
        my $parent_unblessed = $parent_obj->unblessed;
89
        if ( $parent_unblessed->{'location'} ne "" ) {
90
            # if parent location is not all interfaces
91
            if ( $parent_unblessed->{'location'} != $input->param('disp') ) {
92
                # if parent location is not the same as provided location
93
                return undef;
94
            }
95
        }
96
    }
97
75
    my $new_page = $self->_resultset()->update_or_create( $data, { key => 'primary' });
98
    my $new_page = $self->_resultset()->update_or_create( $data, { key => 'primary' });
76
99
77
    return $new_page;
100
    return $new_page;
Lines 86-100 Lists pages based input filtering paramters for location, branch and language. Link Here
86
sub list {
109
sub list {
87
    my ( $self, $id, $disp, $branch, $lang ) = @_;
110
    my ( $self, $id, $disp, $branch, $lang ) = @_;
88
111
89
    my $filter = { };
112
    my %filter;
90
    $filter->{'location'} = $disp   unless not defined $disp;
113
    if ($branch) {
91
    $filter->{'branch'}   = $branch unless not defined $branch;
114
        my $branch_push = [ $branch, undef ];
92
    $filter->{'lang'}     = $lang   unless not defined $lang;
115
        push @{$filter{'branchcode'}}, $branch_push;
116
    }
117
    if ($lang) {
118
        my $lang_push = [ $lang, undef ];
119
        push @{$filter{'lang'}}, $lang_push;
120
    }
121
    if ($disp) {
122
        my $disp_push = [ $disp, undef ];
123
        push @{$filter{'location'}}, $disp_push;
124
    }
93
125
94
    my $pages = $self->_resultset()->search( undef, {
126
    my $pages = $self->_resultset()->search( {}, {
95
        order_by => {
127
        order_by => {
96
		    -asc => [qw/parent location branchcode lang sortorder/]
128
        -asc => [qw/parent location branchcode lang sortorder/]
97
        }, where => $filter
129
        }, where => { %filter }
98
    } );
130
    } );
99
131
100
    my $page_list = [];
132
    my $page_list = [];
Lines 143-162 Retrieves all data to show a single CMS page. Link Here
143
=cut
175
=cut
144
176
145
sub page {
177
sub page {
146
	my ( $self, $id ) = @_;
178
    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
179
154
	my $page_links = $self->_resultset()->search(
180
    carp( 'Missing CMS page id parameter in Koha::Pages::page' ) unless defined $id;
155
			{ parent => $id }, { qw/id title_link/ });
156
181
157
	my $page_data = $self->_resultset()->find( $id );
182
    my $page_data = $self->_resultset()->find( $id );
158
183
159
	return ( $top_links, $page_links, $page_data );
184
    return $page_data;
160
}
185
}
161
186
162
=head3 child_links
187
=head3 child_links
Lines 168-176 Lists pages which are children of a specific id (or undef for root). Link Here
168
sub child_links {
193
sub child_links {
169
    my ( $self, $id ) = @_;
194
    my ( $self, $id ) = @_;
170
195
171
	# 'id' can be undefined if listing top-level links.
196
    # 'id' can be undefined if listing top-level links.
172
    my $rs = $self->_resultset()->search({ parent => $id },
197
    my $rs = $self->_resultset()->search({ parent => $id }, { qw/id title_link/ });
173
            { columns => [qw/id title_link/] } );
174
198
175
    return $rs;
199
    return $rs;
176
}
200
}
(-)a/Koha/Schema/Result/Branch.pm (-2 / +17 lines)
Lines 352-357 __PACKAGE__->has_many( Link Here
352
  { cascade_copy => 0, cascade_delete => 0 },
352
  { cascade_copy => 0, cascade_delete => 0 },
353
);
353
);
354
354
355
=head2 cms_pages
356
357
Type: has_many
358
359
Related object: L<Koha::Schema::Result::CmsPage>
360
361
=cut
362
363
__PACKAGE__->has_many(
364
  "cms_pages",
365
  "Koha::Schema::Result::CmsPage",
366
  { "foreign.branchcode" => "self.branchcode" },
367
  { cascade_copy => 0, cascade_delete => 0 },
368
);
369
355
=head2 collections
370
=head2 collections
356
371
357
Type: has_many
372
Type: has_many
Lines 543-550 Composing rels: L</branchrelations> -> categorycode Link Here
543
__PACKAGE__->many_to_many("categorycodes", "branchrelations", "categorycode");
558
__PACKAGE__->many_to_many("categorycodes", "branchrelations", "categorycode");
544
559
545
560
546
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-24 13:56:21
561
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-12 02:41:09
547
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/9YwsU+GXK+fzc6IX2Tj5g
562
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yErr2R015OQyZnTQsdBzWQ
548
563
549
564
550
# You can replace this text with custom code or comments, and it will be preserved on regeneration
565
# You can replace this text with custom code or comments, and it will be preserved on regeneration
(-)a/Koha/Schema/Result/CmsPage.pm (+150 lines)
Line 0 Link Here
1
use utf8;
2
package Koha::Schema::Result::CmsPage;
3
4
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7
=head1 NAME
8
9
Koha::Schema::Result::CmsPage
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<cms_pages>
19
20
=cut
21
22
__PACKAGE__->table("cms_pages");
23
24
=head1 ACCESSORS
25
26
=head2 id
27
28
  data_type: 'integer'
29
  is_auto_increment: 1
30
  is_nullable: 0
31
32
=head2 parent
33
34
  data_type: 'integer'
35
  is_nullable: 1
36
37
=head2 branchcode
38
39
  data_type: 'varchar'
40
  is_foreign_key: 1
41
  is_nullable: 1
42
  size: 10
43
44
=head2 lang
45
46
  data_type: 'varchar'
47
  default_value: (empty string)
48
  is_nullable: 0
49
  size: 25
50
51
=head2 title
52
53
  data_type: 'varchar'
54
  is_nullable: 1
55
  size: 255
56
57
=head2 title_link
58
59
  data_type: 'varchar'
60
  is_nullable: 1
61
  size: 64
62
63
=head2 sortorder
64
65
  data_type: 'integer'
66
  default_value: 0
67
  is_nullable: 0
68
69
=head2 location
70
71
  data_type: 'tinyint'
72
  is_nullable: 1
73
74
=head2 publish
75
76
  data_type: 'tinyint'
77
  default_value: 0
78
  is_nullable: 0
79
80
=head2 content
81
82
  data_type: 'text'
83
  is_nullable: 1
84
85
=cut
86
87
__PACKAGE__->add_columns(
88
  "id",
89
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
90
  "parent",
91
  { data_type => "integer", is_nullable => 1 },
92
  "branchcode",
93
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
94
  "lang",
95
  { data_type => "varchar", default_value => "", is_nullable => 0, size => 25 },
96
  "title",
97
  { data_type => "varchar", is_nullable => 1, size => 255 },
98
  "title_link",
99
  { data_type => "varchar", is_nullable => 1, size => 64 },
100
  "sortorder",
101
  { data_type => "integer", default_value => 0, is_nullable => 0 },
102
  "location",
103
  { data_type => "tinyint", is_nullable => 1 },
104
  "publish",
105
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
106
  "content",
107
  { data_type => "text", is_nullable => 1 },
108
);
109
110
=head1 PRIMARY KEY
111
112
=over 4
113
114
=item * L</id>
115
116
=back
117
118
=cut
119
120
__PACKAGE__->set_primary_key("id");
121
122
=head1 RELATIONS
123
124
=head2 branchcode
125
126
Type: belongs_to
127
128
Related object: L<Koha::Schema::Result::Branch>
129
130
=cut
131
132
__PACKAGE__->belongs_to(
133
  "branchcode",
134
  "Koha::Schema::Result::Branch",
135
  { branchcode => "branchcode" },
136
  {
137
    is_deferrable => 1,
138
    join_type     => "LEFT",
139
    on_delete     => "CASCADE",
140
    on_update     => "CASCADE",
141
  },
142
);
143
144
145
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-12 02:41:09
146
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9044j1OZyypCpGV71FgvYg
147
148
149
# You can replace this text with custom code or comments, and it will be preserved on regeneration
150
1;
(-)a/Koha/Schema/Result/Issue.pm (-2 / +28 lines)
Lines 101-106 __PACKAGE__->table("issues"); Link Here
101
  default_value: 0
101
  default_value: 0
102
  is_nullable: 0
102
  is_nullable: 0
103
103
104
=head2 note
105
106
  data_type: 'mediumtext'
107
  is_nullable: 1
108
109
=head2 notedate
110
111
  data_type: 'datetime'
112
  datetime_undef_if_invalid: 1
113
  is_nullable: 1
114
115
=head2 noteseen
116
117
  data_type: 'integer'
118
  is_nullable: 1
119
104
=cut
120
=cut
105
121
106
__PACKAGE__->add_columns(
122
__PACKAGE__->add_columns(
Lines 151-156 __PACKAGE__->add_columns( Link Here
151
  },
167
  },
152
  "onsite_checkout",
168
  "onsite_checkout",
153
  { data_type => "integer", default_value => 0, is_nullable => 0 },
169
  { data_type => "integer", default_value => 0, is_nullable => 0 },
170
  "note",
171
  { data_type => "mediumtext", is_nullable => 1 },
172
  "notedate",
173
  {
174
    data_type => "datetime",
175
    datetime_undef_if_invalid => 1,
176
    is_nullable => 1,
177
  },
178
  "noteseen",
179
  { data_type => "integer", is_nullable => 1 },
154
);
180
);
155
181
156
=head1 PRIMARY KEY
182
=head1 PRIMARY KEY
Lines 222-229 __PACKAGE__->belongs_to( Link Here
222
);
248
);
223
249
224
250
225
# Created by DBIx::Class::Schema::Loader v0.07039 @ 2015-11-04 12:00:58
251
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-12 02:41:09
226
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kREecsHr6wZPiokS946BHw
252
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZF/YAX9BT1WrgCLUsXSqXQ
227
253
228
__PACKAGE__->belongs_to(
254
__PACKAGE__->belongs_to(
229
    "borrower",
255
    "borrower",
(-)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 (-25 / +30 lines)
Lines 10-17 Link Here
10
          $('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').css('font-weight','bold');
10
          $('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').css('font-weight','bold');
11
        } else if (path.indexOf("patroncards") >= 0 ) {
11
        } else if (path.indexOf("patroncards") >= 0 ) {
12
          $('#navmenulist a[href$="/cgi-bin/koha/patroncards/home.pl"]').css('font-weight','bold');
12
          $('#navmenulist a[href$="/cgi-bin/koha/patroncards/home.pl"]').css('font-weight','bold');
13
       } else if (path.indexOf("patron_lists") >= 0 ) {
13
        } else if (path.indexOf("patron_lists") >= 0 ) {
14
          $('#navmenulist a[href$="/cgi-bin/koha/patron_lists/lists.pl"]').css('font-weight','bold');
14
          $('#navmenulist a[href$="/cgi-bin/koha/patron_lists/lists.pl"]').css('font-weight','bold');
15
        } else if (path.indexOf("cmspages") >= 0 ) {
16
          $('#navmenulist a[href$="/cgi-bin/koha/tools/cmspages.pl"]').css('font-weight','bold');
15
        } else {
17
        } else {
16
          $('#navmenulist a[href$="/' + path + params + '"]').css('font-weight','bold');
18
          $('#navmenulist a[href$="/' + path + params + '"]').css('font-weight','bold');
17
        }
19
        }
Lines 26-68 Link Here
26
<h5>Patrons and circulation</h5>
28
<h5>Patrons and circulation</h5>
27
<ul>
29
<ul>
28
    [% IF ( CAN_user_tools_manage_patron_lists ) %]
30
    [% IF ( CAN_user_tools_manage_patron_lists ) %]
29
	<li><a href="/cgi-bin/koha/patron_lists/lists.pl">Patron lists</a></li>
31
        <li><a href="/cgi-bin/koha/patron_lists/lists.pl">Patron lists</a></li>
30
    [% END %]
32
    [% END %]
31
    [% IF ( CAN_user_tools_moderate_comments ) %]
33
    [% IF ( CAN_user_tools_moderate_comments ) %]
32
	<li><a href="/cgi-bin/koha/reviews/reviewswaiting.pl">Comments</a></li>
34
        <li><a href="/cgi-bin/koha/reviews/reviewswaiting.pl">Comments</a></li>
33
    [% END %]
35
    [% END %]
34
    [% IF ( CAN_user_tools_import_patrons ) %]
36
    [% IF ( CAN_user_tools_import_patrons ) %]
35
	<li><a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a></li>
37
        <li><a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a></li>
36
    [% END %]
38
    [% END %]
37
    [% IF ( CAN_user_tools_edit_notices ) %]
39
    [% IF ( CAN_user_tools_edit_notices ) %]
38
    <li><a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; slips</a></li>
40
        <li><a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; slips</a></li>
39
    [% END %]
41
    [% END %]
40
    [% IF ( CAN_user_tools_edit_notice_status_triggers ) %]
42
    [% IF ( CAN_user_tools_edit_notice_status_triggers ) %]
41
	<li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li>
43
        <li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li>
42
    [% END %]
44
    [% END %]
43
    [% IF ( CAN_user_tools_label_creator ) %]
45
    [% IF ( CAN_user_tools_label_creator ) %]
44
    <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li>
46
        <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li>
45
    [% END %]
47
    [% END %]
46
    [% IF ( CAN_user_tools_delete_anonymize_patrons ) %]
48
    [% IF ( CAN_user_tools_delete_anonymize_patrons ) %]
47
    <li><a href="/cgi-bin/koha/tools/cleanborrowers.pl">Batch patron deletion/anonymization</a></li>
49
        <li><a href="/cgi-bin/koha/tools/cleanborrowers.pl">Batch patron deletion/anonymization</a></li>
48
    [% END %]
50
    [% END %]
49
    [% IF ( CAN_user_tools_edit_patrons ) %]
51
    [% IF ( CAN_user_tools_edit_patrons ) %]
50
    <li><a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a></li>
52
        <li><a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a></li>
51
    [% END %]
53
    [% END %]
52
    [% IF ( CAN_user_tools_moderate_tags ) %]
54
    [% IF ( CAN_user_tools_moderate_tags ) %]
53
    <li><a href="/cgi-bin/koha/tags/review.pl">Tag moderation</a></li>
55
        <li><a href="/cgi-bin/koha/tags/review.pl">Tag moderation</a></li>
54
    [% END %]
56
    [% END %]
55
    [% IF ( CAN_user_tools_batch_upload_patron_images ) %]
57
    [% IF ( CAN_user_tools_batch_upload_patron_images ) %]
56
	<li><a href="/cgi-bin/koha/tools/picture-upload.pl">Upload patron images</a></li>
58
        <li><a href="/cgi-bin/koha/tools/picture-upload.pl">Upload patron images</a></li>
57
    [% END %]
59
    [% END %]
58
</ul>
60
</ul>
59
<h5>Catalog</h5>
61
<h5>Catalog</h5>
60
<ul>
62
<ul>
61
    [% IF ( CAN_user_tools_items_batchdel ) %]
63
    [% IF ( CAN_user_tools_items_batchdel ) %]
62
	<li><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Batch item deletion</a></li>
64
        <li><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Batch item deletion</a></li>
63
    [% END %]
65
    [% END %]
64
    [% IF ( CAN_user_tools_items_batchmod ) %]
66
    [% IF ( CAN_user_tools_items_batchmod ) %]
65
	<li><a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a></li>
67
        <li><a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a></li>
66
    [% END %]
68
    [% END %]
67
    [% IF CAN_user_tools_records_batchdel %]
69
    [% IF CAN_user_tools_records_batchdel %]
68
      <li><a href="/cgi-bin/koha/tools/batch_delete_records.pl">Batch record deletion</a></li>
70
      <li><a href="/cgi-bin/koha/tools/batch_delete_records.pl">Batch record deletion</a></li>
Lines 74-120 Link Here
74
      <li><a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a></li>
76
      <li><a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a></li>
75
    [% END %]
77
    [% END %]
76
    [% IF ( CAN_user_tools_export_catalog ) %]
78
    [% IF ( CAN_user_tools_export_catalog ) %]
77
    <li><a href="/cgi-bin/koha/tools/export.pl">Export data</a></li>
79
        <li><a href="/cgi-bin/koha/tools/export.pl">Export data</a></li>
78
    [% END %]
80
    [% END %]
79
    [% IF ( CAN_user_tools_inventory ) %]
81
    [% IF ( CAN_user_tools_inventory ) %]
80
        <li><a href="/cgi-bin/koha/tools/inventory.pl">Inventory</a></li>
82
        <li><a href="/cgi-bin/koha/tools/inventory.pl">Inventory</a></li>
81
    [% END %]
83
    [% END %]
82
    [% IF ( CAN_user_tools_label_creator ) %]
84
    [% IF ( CAN_user_tools_label_creator ) %]
83
	<li><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></li>
85
        <li><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></li>
84
	<li><a href="/cgi-bin/koha/labels/spinelabel-home.pl">Quick spine label creator</a></li>
86
        <li><a href="/cgi-bin/koha/labels/spinelabel-home.pl">Quick spine label creator</a></li>
85
    [% END %]
87
    [% END %]
86
    [% IF ( CAN_user_tools_rotating_collections ) %]
88
    [% IF ( CAN_user_tools_rotating_collections ) %]
87
    <li><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a></li>
89
        <li><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a></li>
88
    [% END %]
90
    [% END %]
89
    [% IF ( CAN_user_tools_marc_modification_templates ) %]
91
    [% IF ( CAN_user_tools_marc_modification_templates ) %]
90
        <li><a href="/cgi-bin/koha/tools/marc_modification_templates.pl">Manage MARC modification templates</a></li>
92
        <li><a href="/cgi-bin/koha/tools/marc_modification_templates.pl">Manage MARC modification templates</a></li>
91
    [% END %]
93
    [% END %]
92
    [% IF ( CAN_user_tools_stage_marc_import ) %]
94
    [% IF ( CAN_user_tools_stage_marc_import ) %]
93
	<li><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC for import</a></li>
95
        <li><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC for import</a></li>
94
    [% END %]
96
    [% END %]
95
    [% IF ( CAN_user_tools_manage_staged_marc ) %]
97
    [% IF ( CAN_user_tools_manage_staged_marc ) %]
96
	<li><a href="/cgi-bin/koha/tools/manage-marc-import.pl">Staged MARC management</a></li>
98
        <li><a href="/cgi-bin/koha/tools/manage-marc-import.pl">Staged MARC management</a></li>
97
    [% END %]
99
    [% END %]
98
    [% IF ( CAN_user_tools_upload_local_cover_images ) %]
100
    [% IF ( CAN_user_tools_upload_local_cover_images ) %]
99
    <li><a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a></li>
101
        <li><a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a></li>
100
    [% END %]
102
    [% END %]
101
</ul>
103
</ul>
102
<h5>Additional tools</h5>
104
<h5>Additional tools</h5>
103
<ul>
105
<ul>
104
    [% IF ( CAN_user_tools_edit_calendar ) %]
106
    [% IF ( CAN_user_tools_edit_calendar ) %]
105
	<li><a href="/cgi-bin/koha/tools/holidays.pl">Calendar</a></li>
107
        <li><a href="/cgi-bin/koha/tools/holidays.pl">Calendar</a></li>
106
    [% END %]
108
    [% END %]
107
    [% IF ( CAN_user_tools_manage_csv_profiles ) %]
109
    [% IF ( CAN_user_tools_manage_csv_profiles ) %]
108
	<li><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></li>
110
        <li><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></li>
109
    [% END %]
111
    [% END %]
110
    [% IF ( CAN_user_tools_view_system_logs ) %]
112
    [% IF ( CAN_user_tools_view_system_logs ) %]
111
	<li><a href="/cgi-bin/koha/tools/viewlog.pl">Log viewer</a></li>
113
        <li><a href="/cgi-bin/koha/tools/viewlog.pl">Log viewer</a></li>
112
    [% END %]
114
    [% END %]
113
    [% IF ( CAN_user_tools_edit_news ) %]
115
    [% IF ( CAN_user_tools_edit_news ) %]
114
	<li><a href="/cgi-bin/koha/tools/koha-news.pl">News</a></li>
116
        <li><a href="/cgi-bin/koha/tools/koha-news.pl">News</a></li>
117
    [% END %]
118
    [% IF ( CAN_user_tools_edit_pages ) %]
119
        <li><a href="/cgi-bin/koha/tools/cmspages.pl">Pages</a></li>
115
    [% END %]
120
    [% END %]
116
    [% IF ( CAN_user_tools_schedule_tasks ) %]
121
    [% IF ( CAN_user_tools_schedule_tasks ) %]
117
	<li><a href="/cgi-bin/koha/tools/scheduler.pl">Task scheduler</a></li>
122
        <li><a href="/cgi-bin/koha/tools/scheduler.pl">Task scheduler</a></li>
118
    [% END %]
123
    [% END %]
119
    [% IF ( CAN_user_tools_edit_quotes ) %]
124
    [% IF ( CAN_user_tools_edit_quotes ) %]
120
       <li><a href="/cgi-bin/koha/tools/quotes.pl">Quote editor</a></li>
125
       <li><a href="/cgi-bin/koha/tools/quotes.pl">Quote editor</a></li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt (-93 / +166 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
var MSG_CONFIRM_DELETE_PAGE  = _("Are you sure you want to delete the selected page(s)?");
13
14
$(document).ready(function() {
15
    $("#pages_table").dataTable($.extend(true, {}, dataTablesDefaults, {
16
        "aoColumnDefs": [
17
            { "aTargets": [ 0, -1 ], "bSortable": false, "bSearchable": false },
18
        ],
19
        "sPaginationType": "full_numbers"
20
    }));
21
22
    $("#del_button").on("click",function(){
23
        return confirmDelete(MSG_CONFIRM_DELETE_PAGE);
24
    });
25
26
    $(".SelectAll").on("click", function(){
27
        $("input[name='ids'][type='checkbox']").prop("checked", true);
28
    });
29
30
    $(".ClearAll").on("click", function(){
31
        $("input[name='ids'][type='checkbox']").prop("checked", false);
32
    });
33
});
28
34
29
tinyMCE.init({
35
tinyMCE.init({
30
    mode : "textareas",
36
    mode : "textareas",
Lines 47-66 tinyMCE.init({ Link Here
47
    width : "700"
53
    width : "700"
48
//]]>
54
//]]>
49
});
55
});
50
//]]>
51
</script>
56
</script>
52
</head>
57
</head>
53
<body id="tools_koha-content" class="tools">
58
<body id="tools_koha-content" class="tools">
54
[% INCLUDE 'header.inc' %]
59
[% INCLUDE 'header.inc' %]
55
[% INCLUDE 'cat-search.inc' %]
60
[% 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 ) %]
61
<div id="breadcrumbs">
57
Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div>
62
    <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
63
    <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
64
    [% IF ( form ) %]<a href="[% link_self %]">Pages</a> &rsaquo;
65
    [% IF ( id ) %]Edit page[% ELSE %]Add page[% END %]
66
    [% ELSIF ( view ) %]
67
        <a href="[% link_self %]">Pages</a> &rsaquo;
68
        [% IF ( cms_page.parent ) %]
69
             [% FOREACH parent IN parent_list %]
70
                 [% IF parent.id == cms_page.parent %]<a href="[% link_self %]?op=view&amp;id=[% cms_page.parent %]">[% parent.title_link %]</a> &rsaquo;[% END %]
71
             [% END %]
72
         [% END %]
73
    [% cms_page.title_link %]
74
    [% ELSE %]Pages[% END %]
75
</div>
58
76
59
[% IF ( form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
77
[% IF ( form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
60
   <div id="bd">
78
   <div id="bd">
61
    <div id="yui-main">
79
    <div id="yui-main">
62
    <div class="yui-b">
80
    <div class="yui-b">
63
64
[% UNLESS ( link_opac_base && link_self) %]
81
[% UNLESS ( link_opac_base && link_self) %]
65
    <div class="dialog alert">
82
    <div class="dialog alert">
66
    [% UNLESS ( link_opac_base ) %]
83
    [% 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>
87
    Warning: Variable <em>link_self</em> not set, some links might not work!</div>
71
    [% END %]
88
    [% END %]
72
[% END %]
89
[% END %]
73
[% UNLESS ( form ) %]
90
[% 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">
91
<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>
92
    <a class="btn btn-small" id="newentry" href="[% link_self %]?op=form"><i class="fa fa-plus"></i> New page</a>
93
</div>
94
[% END %]
95
[% IF ( failed_add ) %]
96
<div class="dialog alert">
97
    Failed to add page. Check that:
98
    <ul>
99
        <li>Your link title is unique</li>
100
        <li>If specifying a parent page, the location is the same as your new page</li>
101
    </ul>
102
</div>
103
[% END %]
104
[% IF ( view ) %]
105
<div class="yui-ge">
106
<div id="pagesnav" class="yui-u">
107
    [% IF ( links ) %]
108
    <fieldset>
109
        <ul>
110
            <li><a href="[% link_self %]">Pages home</a></li>
111
        </ul>
112
        <h4>Pages</h4>
113
        <ul id="cms_nav">
114
            [% FOREACH link IN links %]
115
            [% IF ( link.location == '' || link.location == '1' ) %]
116
            [% IF ( link.parent != '' ) %]
117
                [% FOREACH parent IN parent_list %]
118
                    [% 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 %]
119
                [% END %]
120
            [% ELSE %]
121
                <li><a href="[% link_self %]?op=view&amp;id=[% link.id %]">[% link.title_link %]</a></li>
122
            [% END %]
123
            [% END %][% END %]
124
        </ul>
125
    </fieldset>
126
    [% END %]
79
</div>
127
</div>
128
<div class="yui-u first">
129
<h1>Pages: [% cms_page.title %]</h1>
130
[% IF ( cms_page.publish == 1 ) %]
131
    [% cms_page.content %]
132
[% ELSE %]
133
    <div class="dialog message">This page has not been published.</div>
134
    [% cms_page.content %]
80
[% END %]
135
[% END %]
81
<pre>DEBUG: [% debug %]</pre>
136
</div>
82
<pre>DEBUG2: data.location: [% data.location %] data.branchcode: [% data.branchcode %]</pre>
137
</div>
83
[% IF ( form ) %]
138
[% ELSIF ( form ) %]
84
        <form name="form" method="post" enctype="multipart/form-data" action="[% link_self %]" >
139
        <form name="form" method="post" enctype="multipart/form-data" action="[% link_self %]" >
85
            <input type="hidden" name="op" value="[% op %]" />
140
            <input type="hidden" name="op" value="[% op %]" />
86
            <input type="hidden" name="id" value="[% id %]" />
141
            <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>
143
            <legend>Page</legend>
89
            <ol>
144
            <ol>
90
            <li>
145
            <li>
91
                <label for="disp">Display location</label>
146
                <label for="disp">Display location:</label>
92
                <select id="disp" name="disp">
147
                <select id="disp" name="disp">
93
                    <option value=""  [% IF ( data.disp == ""  ) %]selected="selected"[% END %]>All</option>
148
                    [% 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>
149
                    [% 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>
150
                    [% IF ( data.location == "2" ) %]<option value="2" selected="selected">OPAC</option>[% ELSE %]<option value="2">OPAC</option>[% END %]
96
                </select>
151
                </select>
97
            </li>
152
            </li>
98
            <li>
153
            <li>
99
                <label for="branch">Library: </label>
154
                <label for="branch">Library: </label>
100
                <select id="branch" name="branch">
155
                <select id="branch" name="branch">
101
                    <option value=""[% IF ( data.branchcode == '' ) %] selected="selected"[% END %]>All libraries</option>
156
                    [% IF ( data.branchcode == "" ) %]<option value="" selected="selected">All libraries</option>[% ELSE %]<option value="">All libraries</option>[% END %]
102
                [% FOREACH branch_lis IN branch_list %]
157
                    [% FOREACH branch IN branch_list %]
103
                    <option value="[% branch_lis.branchcode %]"[% IF ( branch_lis.branchcode == data.branchcode ) %] selected="selected"[% END %]>[% branch_lis.branchname %]</option>
158
                        [% IF ( branch.branchcode == data.branchcode ) %]<option value="[% branch.branchcode %]" selected="selected">[% branch.branchname %]</option>[% ELSE %]<option value="[% branch.branchcode %]">[% branch.branchname %]</option>[% END %]
104
                [% END %]
159
                    [% END %]
105
                </select>
160
                </select>
106
            </li>
161
            </li>
107
            <li>
162
            <li>
108
                <label for="lang">Language</label>
163
                <label for="lang">Language:</label>
109
<pre>LANG: [% lang %]</pre>
110
                <select id="lang" name="lang">
164
                <select id="lang" name="lang">
111
                    <option value="" [% IF ( data.lang == "" ) %]selected="selected"[% END %]>All</option>
165
                    [% IF ( data.lang == "" ) %]<option value="" selected="selected">All</option>[% ELSE %]<option value="">All</option>[% END %]
112
                    [% FOREACH lang_lis IN lang_list %]
166
                    [% 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>
167
                        [% 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 %]
168
                    [% END %]
115
                </select>
169
                </select>
116
            </li>
170
            </li>
117
            <li>
171
            <li>
118
                <label for="parent">Parent page: </label>
172
                <label for="parent">Parent page: </label>
119
                <select id="parent" name="parent">
173
                <select id="parent" name="parent">
120
                    <option value="" [% IF ( data.id == "" ) %]selected="selected"[% END %]>No parent</option>
174
                    [% IF ( data.id == "" ) %]<option value="" selected="selected">No parent</option>[% ELSE %]<option value="">No parent</option>[% END %]
121
                [% FOREACH parent_lis IN parent_list %]
175
                    [% 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>
176
                        [% 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 %]
177
                    [% END %]
124
                </select>
178
                </select>
125
            </li>
179
            </li>
126
            <li>
180
            <li>
Lines 133-143 Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div> Link Here
133
            </li>
187
            </li>
134
            <li>
188
            <li>
135
                <label for="number">Appear in position: </label>
189
                <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 %]" />
190
                [% 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>
191
            </li>
138
            <li>
192
            <li>
139
                <label for="publish">Publish: </label>
193
                <label for="publish">Publish: </label>
140
                <input type="checkbox" id="publish" name="publish"[% IF ( data.publish ) %] checked="checked"[% END %]/>
194
                [% IF ( data.publish ) %]<input type="checkbox" id="publish" name="publish" checked="checked" />[% ELSE %]<input type="checkbox" id="publish" name="publish" />[% END %]
141
            </li>
195
            </li>
142
            <li><label for="new">Content: </label>
196
            <li><label for="new">Content: </label>
143
            <textarea name="content" id="content" cols="75" rows="10">[% data.content %]</textarea>
197
            <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>
201
            <fieldset class="action"><input class="button" type="submit" value="Save" /> <a class="cancel" href="[% link_self %]">Cancel</a></fieldset>
148
        </form>
202
        </form>
149
    [% ELSE %]
203
    [% ELSE %]
204
205
    <h1>Pages</h1>
150
        <div style="margin-bottom:5px;">
206
        <div style="margin-bottom:5px;">
151
        <form name="form" method="post" action="[% link_self %]" >
207
        <form name="filter" method="post" action="[% link_self %]">
152
            <label for="disp">Display location:</label>
208
            <label for="disp">Display location:</label>
153
            <select name="disp" id="disp">
209
            <select name="disp" id="disp">
154
                <option value=""  [% IF ( disp == ""  ) %]selected="selected"[% END %]>All</option>
210
                [% 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>
211
                [% 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>
212
                [% IF ( disp == "2" ) %]<option value="2" selected="selected">OPAC</option>[% ELSE %]<option value="2">OPAC</option>[% END %]
157
            </select>
213
            </select>
158
214
159
            <label for="branch">Library: </label>
215
            <label for="branch">Library: </label>
160
            <select id="branch" name="branch">
216
            <select id="branch" name="branch">
161
                <option value=""[% IF ( branch == "" ) %] selected="selected"[% END %]>All libraries</option>
217
                [% IF ( branch == "" ) %]<option value="" selected="selected">All libraries</option>[% ELSE %]<option value="">All libraries</option>[% END %]
162
                [% FOREACH branch_lis IN branch_list %]
218
                [% FOREACH br IN branch_list %]
163
                <option value="[% branch_lis.branchcode %]"[% IF ( branch_lis.branchcode == branch ) %] selected="selected"[% END %]>[% branch_lis.branchname %]</option>
219
                    [% IF ( br.branchcode == branch ) %]
220
                        <option value="[% br.branchcode %]" selected="selected">[% br.branchname %]</option>
221
                    [% ELSE %]
222
                        <option value="[% br.branchcode %]">[% br.branchname %]</option>
223
                    [% END %]
164
                [% END %]
224
                [% END %]
165
            </select>
225
            </select>
166
226
167
            <label for="lang">Language:</label>
227
            <label for="lang">Language:</label>
168
            <select name="lang" id="lang">
228
            <select name="lang" id="lang">
169
                <option value="" [% IF ( lang == "" ) %]selected="selected"[% END %]>All</option>
229
                [% IF ( lang == "" ) %]<option value="" selected="selected">All</option>[% ELSE %]<option value="">All</option>[% END %]
170
                [% FOREACH lang_lis IN lang_list %]
230
                [% 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>
231
                    [% IF ( language.rfc4646_subtag == lang ) %]
232
                        <option value="[% language.rfc4646_subtag %]" selected="selected">[% language.native_description %] ([% language.rfc4646_subtag %])</option>
233
                    [% ELSE %]
234
                        <option value="[% language.rfc4646_subtag %]">[% language.native_description %] ([% language.rfc4646_subtag %])</option>
235
                    [% END %]
172
                [% END %]
236
                [% END %]
173
            </select>
237
            </select>
238
            <input type="hidden" name="op" value="filter" />
174
            <input type="submit" class="button" value="Filter" />
239
            <input type="submit" class="button" value="Filter" />
175
        </form>
240
        </form>
176
        </div>
241
        </div>
177
        [% IF ( page_list_count ) %]
242
        [% IF ( page_list.size ) %]
178
        <form name="del_form" method="post" action="[% link_self %]" onsubmit='return confirm(MSG_CONFIRM_DELETE_PAGE)'>
243
        <form name="del_form" method="post" action="[% link_self %]">
179
                <table id="newst">
244
                <table id="pages_table">
180
                   <thead><tr>
245
                   <thead><tr>
181
                        <th>&nbsp;</th>
246
                        <th>&nbsp;</th>
182
                        <th>Pub.</th>
247
                        <th>Published</th>
183
                        <th>Parent</th>
248
                        <th>Parent</th>
184
                        <th>Loc.</th>
249
                        <th>Location</th>
185
                        <th>Lib.</th>
250
                        <th>Library</th>
186
                        <th>Lang.</th>
251
                        <th>Language</th>
187
                        <th>Num.</th>
252
                        <th>Number</th>
188
                        <th>Link title</th>
253
                        <th>Link title</th>
189
                        <th>Page title</th>
254
                        <th>Page title</th>
190
                        <th>&nbsp;</th>
255
                        <th>Actions</th>
191
                        <th>&nbsp;</th>
192
                    </tr></thead>
256
                    </tr></thead>
193
                    <tbody>[% FOREACH page_lis IN page_list %]
257
                    <tbody>[% FOREACH page IN page_list %]
194
                        <tr>
258
                        <tr>
195
                            <td>
259
                            <td><input type="checkbox" name="ids" id="ids" value="[% page.id %]" /></td>
196
                                <input type="checkbox" name="ids" id="ids" value="[% page_lis.id %]" />
260
                            <td>[% IF ( page.publish ) %]Yes[% ELSE %]No[% END %]</td>
197
                            </td>
261
                            <td>[% page.parent.title_link %]</td>
198
                            <td>[% IF ( page_lis.publish ) %]Yes[% ELSE %]No[% END %]</td>
262
                            <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 "" %]
263
                                [% CASE "" %]
206
                                    All
264
                                    All
265
                                [% CASE "1" %]
266
                                    Staff interface
267
                                [% CASE "2" %]
268
                                    OPAC
207
                                [% END %]
269
                                [% END %]
208
                            </td>
270
                            </td>
209
                            <td>[% IF ( page_lis.branch == "" ) %]
271
                            <td>[% IF ( page.branchcode == "" ) %]All[% ELSE %][% page.branchcode.branchname %][% END %]</td>
210
                                All
272
                            <td>[% IF ( page.lang == "" ) %]All[% ELSE %]
211
                                [% ELSE %][% page_lis.branchname %]
273
                                [% FOREACH lang IN lang_list %]
212
                                [% END %]</td>
274
                                    [% IF ( lang.rfc4646_subtag == page.lang ) %][% lang.native_description %] ([% lang.rfc4646_subtag %])[% END %]
213
                            <td>[% IF ( page_lis.langcode == "" ) %]All[% ELSE %]
275
                                [% END %]
214
                                [% page_lis.langcode %][% END %]</td>
276
                            [% END %]</td>
215
                            <td>[% page_lis.sortorder %]</td>
277
                            <td>[% page.sortorder %]</td>
216
                            <td><a href="[% link_self %]?op=form&amp;id=[% page_lis.id %]">[% page_lis.title_link %]</a></td>
278
                            <td><a href="[% link_self %]?op=form&amp;id=[% page.id %]">[% page.title_link %]</a></td>
217
                            <td>[% page_lis.title %]</td>
279
                            <td>[% page.title %]</td>
218
                            <td><a href="[% link_self %]?op=form&amp;id=[% page_lis.id %]">Edit</a></td>
280
                            <td class="actions">
219
                            <td><a href="[% link_opac %]?id=[% page_lis.id %]">View</a></td>
281
                                <a href="[% link_self %]?op=form&amp;id=[% page.id %]" class="btn btn-mini"><i class="fa fa-pencil"></i> Edit</a>
282
                                [% IF ( page.location == "" ) %]
283
                                    <a href="[% link_opac %]?id=[% page.id %]" class="btn btn-mini"><i class="fa fa-eye"></i> OPAC</a>
284
                                    <a href="[% link_self %]?op=view&amp;id=[% page.id %]" class="btn btn-mini"><i class="fa fa-eye"></i> Intranet</a>
285
                                [% ELSIF ( page.location == "1" ) %]
286
                                    <a href="[% link_self %]?op=view&amp;id=[% page.id %]" class="btn btn-mini"><i class="fa fa-eye"></i> Intranet</a>
287
                                [% ELSIF ( page.location == "2" ) %]
288
                                    <a href="[% link_opac %]?id=[% page.id %]" class="btn btn-mini"><i class="fa fa-eye"></i> OPAC</a>
289
                                [% END %]
220
                        </tr>
290
                        </tr>
221
                    [% END %]</tbody>
291
                    [% END %]</tbody>
222
                </table>
292
                </table>
223
                <input type="hidden" name="op" value="del" />
293
                <input type="hidden" name="op" value="del" />
224
                <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
294
                <fieldset class="action">
295
                    <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;
296
                    <input type="submit" class="button" id="del_button" value="Delete selected" />
297
                </fieldset>
225
            </form>
298
            </form>
226
        [% ELSE %]
299
        [% ELSE %]
227
            <p>No pages exists</p>
300
            <div class="dialog message">No pages exist. <a href="[% link_self %]?op=form">Create a new page?</a></div>
228
        [% END %]
301
        [% END %]
229
    [% END %]
302
    [% END %]
230
</div>
303
</div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (-14 lines)
Lines 290-309 Link Here
290
                                    [% END %]
290
                                    [% END %]
291
                                </ul>
291
                                </ul>
292
                            </div> <!-- /#moresearches -->
292
                            </div> <!-- /#moresearches -->
293
                            <div id="cms_nav_top">
294
								[% IF ( cms_nav_top ) %]
295
								<ul>
296
									[% WHILE ( cms_item = cms_nav_top.next ) %]
297
										[% IF ( cms_item.id == cms_page.id ) %]
298
											<li class="cms_nav_top_active">
299
										[% ELSE %]
300
                                            <li>
301
										[% END %]
302
                                        <a href="/cgi-bin/koha/opac-cmspages.pl?id=[% cms_item.id %]">[% cms_item.title_link %]</a></li>
303
									[% END %]
304
								</ul>
305
								[% END %]
306
                            </div>
307
                    </div> <!-- /.row-fluid -->
293
                    </div> <!-- /.row-fluid -->
308
294
309
                [% END # / OpacPublic %]
295
                [% END # / OpacPublic %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/navigation.inc (-8 / +19 lines)
Lines 1-12 Link Here
1
<div id="opacnav">
1
<div id="opacnav">
2
[% IF ( cms_nav_left ) %]
2
    [% IF ( links ) %]
3
<ul id="cms_nav_left">
3
        <h4>Pages</h4>
4
[% WHILE ( item = cms_nav_left.next ) %]
4
        <ul id="cms_nav">
5
    <li><a href="/cgi-bin/koha/opac-cmspages.pl?id=[% item.id %]">[% item.title_link %]</a></li>
5
            [% FOREACH link IN links %]
6
[% END %]
6
                [% IF ( link.publish == '1' || link.publish == '0' && CAN_user_tools_edit_pages ) %]
7
</ul>
7
                [% IF ( link.location == '' || link.location == '2' ) %]
8
[% END %]
8
                    [% IF ( link.parent != '' ) %]
9
[% OpacNav %]</div>
9
                        [% FOREACH parent IN parent_list %]
10
                            [% IF ( parent.id == link.parent ) %]<li style="margin-left:20px;"><a href="/cgi-bin/koha/opac-cmspages.pl?id=[% link.parent %]">[% parent.title_link %]</a> &rsaquo; <a href="/cgi-bin/koha/opac-cmspages.pl?id=[% link.id %]">[% link.title_link %]</a></li>[% END %]
11
                        [% END %]
12
                    [% ELSE %]
13
                        <li><a href="/cgi-bin/koha/opac-cmspages.pl?id=[% link.id %]">[% link.title_link %]</a></li>
14
                    [% END %]
15
                [% END %][% END %]
16
            [% END %]
17
        </ul>
18
    [% END %]
19
    [% OpacNav %]
20
</div>
10
[% IF IsPatronPage %]
21
[% IF IsPatronPage %]
11
    <div id="usermenu">[% INCLUDE usermenu.inc %]</div>
22
    <div id="usermenu">[% INCLUDE usermenu.inc %]</div>
12
[% END %]
23
[% 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 221-257 td { Link Here
221
}
221
}
222
222
223
#cms_nav_top {
223
#cms_nav_top {
224
	li {
224
    list-style-type: circle;
225
		margin-bottom: -1em;
225
    padding: 0;
226
		display: inline;
226
    margin: 0;
227
		white-space: nowrap;
227
    a {
228
		border-top-left-radius: 5px;
228
        text-decoration: none;
229
		border-top-right-radius: 5px;
229
    }
230
		background-color: #eee;
230
    a:hover {
231
		border: 1px solid #D2D2CF;
231
        text-decoration: underline;
232
		border-bottom: none;
232
    }
233
		padding: 0.1em 0.8em 0em 0.8em;
234
		font-weight: bold;
235
		font-size: 1.2em;
236
		border-bottom: 1px solid #D2D2CF;
237
		a {
238
			text-decoration: none;
239
		}
240
		&.cms_nav_top_active {
241
			background-color: #fff;
242
			border-bottom: 1px solid #FFF;
243
		}
244
	}
245
	ul {
246
		margin: 0;
247
		display: inline;
248
	}
249
	display: inline;
250
}
251
252
ul#cms_nav_left {
253
	list-style-type: none;
254
	padding: 0;
255
}
233
}
256
234
257
#news {
235
#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->page( $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 25-31 use C4::Output; Link Here
25
use C4::NewsChannels;    # GetNewsToDisplay
25
use C4::NewsChannels;    # GetNewsToDisplay
26
use C4::Languages qw(getTranslatedLanguages accept_language);
26
use C4::Languages qw(getTranslatedLanguages accept_language);
27
use C4::Koha qw( GetDailyQuote );
27
use C4::Koha qw( GetDailyQuote );
28
use Koha::CmsPages qw( list );
28
use Koha::CmsPages;
29
29
30
my $input = new CGI;
30
my $input = new CGI;
31
my $dbh   = C4::Context->dbh;
31
my $dbh   = C4::Context->dbh;
Lines 68-76 $template->param( Link Here
68
    daily_quote         => $quote,
68
    daily_quote         => $quote,
69
);
69
);
70
70
71
my $id = scalar $input->param( 'id' ) // '';
72
my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id );
73
my $links = Koha::CmsPages->search( {}, { order_by => 'parent' } );
74
my $cms_data = Koha::CmsPages->page( $id );
71
$template->param(
75
$template->param(
72
    cms_nav_top => Koha::CmsPages->child_links( undef ),
76
    links       => $links,
73
);
77
    cms_page    => $cms_data,
78
    parent_list => $parent_list,
79
    );
80
81
74
82
75
# If GoogleIndicTransliteration system preference is On Set parameter to load Google's javascript in OPAC search screens
83
# If GoogleIndicTransliteration system preference is On Set parameter to load Google's javascript in OPAC search screens
76
if (C4::Context->preference('GoogleIndicTransliteration')) {
84
if (C4::Context->preference('GoogleIndicTransliteration')) {
(-)a/tools/cmspages.pl (-14 / +28 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
28
29
my $link_self = '/cgi-bin/koha/tools/cmspages.pl';
29
my $link_self = '/cgi-bin/koha/tools/cmspages.pl';
30
30
Lines 50-66 $template->param( Link Here
50
    disp   => $disp
50
    disp   => $disp
51
);
51
);
52
52
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;
53
my $lang_list = getTranslatedLanguages;
54
my $branches = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
58
55
59
# List all pages, if id is set generate parent page list and data.
56
# 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 );
57
my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id );
61
58
62
$template->param(
59
$template->param(
63
    page_list_count => scalar $page_list,
60
    branch_list     => $branches,
64
    page_list       => $page_list,
61
    page_list       => $page_list,
65
    parent_list     => $parent_list,
62
    parent_list     => $parent_list,
66
    data            => $page_data,
63
    data            => $page_data,
Lines 74-90 if ( $op eq 'form' ) { Link Here
74
        id   => $id,
71
        id   => $id,
75
        op   => 'add'
72
        op   => 'add'
76
    );
73
    );
77
}
74
} elsif ( $op eq 'add' ) {
78
75
    my $success = Koha::CmsPages->add( $cgi );
79
if ( $op eq 'add' ) {
76
    unless ($success) {
80
    Koha::CmsPages->add( $cgi );
77
        $template->param( failed_add => 1 );
81
    print $cgi->redirect( $link_self );
78
    }
82
79
    if ($success) {
80
        print $cgi->redirect( $link_self );
81
    }
83
} elsif ( $op eq 'del' ) {
82
} elsif ( $op eq 'del' ) {
84
    # param => multi_param; no list-ctx warnings
83
    # param => multi_param; no list-ctx warnings
85
    Koha::CmsPages->remove( $cgi->multi_param( 'ids' ) );
84
    Koha::CmsPages->remove( $cgi->multi_param( 'ids' ) );
86
    print $cgi->redirect( $link_self );
85
    print $cgi->redirect( $link_self );
86
} elsif ( $op eq 'view' ) {
87
    my $cms_data = Koha::CmsPages->page( $id );
88
    my $links = Koha::CmsPages->search( {}, { order_by => 'sortorder' } );
89
    $template->param(
90
        links    => $links,
91
        cms_page => $cms_data,
92
        view => 1,
93
        id   => $id,
94
        op   => 'view',
95
    );
96
} elsif ( $op eq 'filter' ) {
97
    my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id, $disp, $branch, $lang );
98
    $template->param(
99
        page_list       => $page_list,
100
        parent_list     => $parent_list,
101
        data            => $page_data,
102
    );
87
}
103
}
88
89
$template->param( link_self => $link_self );
104
$template->param( link_self => $link_self );
90
output_html_with_http_headers $cgi, $cookie, $template->output;
105
output_html_with_http_headers $cgi, $cookie, $template->output;
91
- 

Return to bug 15326