Bugzilla – Attachment 58609 Details for
Bug 15326
Add CMS feature
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15326: [FOLLOW-UP] Add CMS feature
Bug-15326-FOLLOW-UP-Add-CMS-feature.patch (text/plain), 55.46 KB, created by
Aleisha Amohia
on 2017-01-05 01:05:05 UTC
(
hide
)
Description:
Bug 15326: [FOLLOW-UP] Add CMS feature
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2017-01-05 01:05:05 UTC
Size:
55.46 KB
patch
obsolete
>From f4ebf3004cf0c0db3bb7862251d06599a8771ff1 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Mon, 12 Dec 2016 02:41:59 +0000 >Subject: [PATCH] Bug 15326: [FOLLOW-UP] Add CMS feature > >This patch builds on Martin Persson's patch. I made a few changes that >improve the patch and make this feature functional. >The only thing I am not completely satisfied with (and doesn't reliably >work) is the navigation for the CMS pages on both the staff side and the >OPAC side. This needs work. Otherwise the CMS feature works. > >- Make sure you update database after applying patch >- After adding a few pages, confirm that filtering results works (play > with different combinations of display location, library and language) >- Confirm that pages with specific locations ONLY show up in those >locations, i.e. OPAC pages can only be accessed in OPAC and staff interface >pages can only be accessed on staff client >- Confirm that table is showing correct data, particularly language, >location and library >- Confirm that if page has not been published and user does not have >permission to edit pages, page content will not display on OPAC side. On >staff side, a message will show saying that page has not been published >- Confirm pagination for table shows and works >- Confirm deleting pages works as expected (confirm message before >delete) >- Confirm link title must be unique when adding new pages >- Confirm that editing the details of an existing page works >- Confirm that adding a child page will only work if the location of >child page matches location of parent page, i.e., if parent page is an >OPAC page then child page must also be OPAC page. if parent page is in >all locations then child page can be in all or either interface(s) >- Confirm Select All/Clear All toggle works >- Confirm viewing of CMS pages in OPAC and in staff client works and >looks nice > >Sponsored-by: Region Halland >--- > Koha/CmsPage.pm | 2 +- > Koha/CmsPages.pm | 78 ++++--- > Koha/Schema/Result/Branch.pm | 19 +- > Koha/Schema/Result/CmsPage.pm | 150 ++++++++++++ > Koha/Schema/Result/Issue.pm | 30 ++- > .../bug15326-add_cms_pages_permission.sql | 1 + > .../intranet-tmpl/prog/en/includes/tools-menu.inc | 55 +++-- > .../prog/en/modules/tools/cmspages.tt | 259 +++++++++++++-------- > .../opac-tmpl/bootstrap/en/includes/masthead.inc | 14 -- > .../opac-tmpl/bootstrap/en/includes/navigation.inc | 27 ++- > .../bootstrap/en/modules/opac-cmspages.tt | 56 ++--- > koha-tmpl/opac-tmpl/bootstrap/less/opac.less | 40 +--- > opac/opac-cmspages.pl | 14 +- > opac/opac-main.pl | 14 +- > tools/cmspages.pl | 41 ++-- > 15 files changed, 534 insertions(+), 266 deletions(-) > create mode 100644 Koha/Schema/Result/CmsPage.pm > create mode 100644 installer/data/mysql/atomicupdate/bug15326-add_cms_pages_permission.sql > >diff --git a/Koha/CmsPage.pm b/Koha/CmsPage.pm >index fd5b52a..cb333d0 100644 >--- a/Koha/CmsPage.pm >+++ b/Koha/CmsPage.pm >@@ -39,7 +39,7 @@ Koha::CmsPage - Koha Page Object class > > =cut > >-sub type { >+sub _type { > return 'CmsPage'; > } > >diff --git a/Koha/CmsPages.pm b/Koha/CmsPages.pm >index b49881e..85a612f 100644 >--- a/Koha/CmsPages.pm >+++ b/Koha/CmsPages.pm >@@ -40,7 +40,7 @@ Koha::CmsPage - Koha CMS Page Object Class > > =cut > >-sub type { >+sub _type { > return 'CmsPage'; > } > >@@ -54,14 +54,13 @@ Adds a new page to the CMS database based on the input data. > > sub add { > my ( $self, $input ) = @_; >-warn "input: ", scalar $input->param('location'); > carp( 'Koha::CmsPages::add() undefined parameter: input' ) unless defined $input; > my $data = { >- parent => scalar $input->param( 'parent' ) eq '' ? undef : scalar $input->param( 'parent' ), >- location => scalar $input->param( 'location' ) eq '' ? undef : scalar $input->param( 'location'), >- branchcode => scalar $input->param( 'branchcode' ) eq '' ? undef : scalar $input->param( 'branchcode' ), >+ parent => scalar $input->param( 'parent' ) eq '' ? undef : scalar $input->param( 'parent' ), >+ location => scalar $input->param( 'disp' ) eq '' ? undef : scalar $input->param( 'disp'), >+ branchcode => scalar $input->param( 'branch' ) eq '' ? undef : scalar $input->param( 'branch' ), > lang => scalar $input->param( 'lang' ), >- sortorder => scalar $input->param( 'sortorder' ), >+ sortorder => scalar $input->param( 'number' ), > title => scalar $input->param( 'title' ), > title_link => scalar $input->param( 'title_link' ), > publish => defined (scalar $input->param( 'publish' )), >@@ -72,6 +71,30 @@ warn "input: ", scalar $input->param('location'); > $data->{'id'} = scalar $input->param( 'id' ); > } > >+ # Ensuring link titles are unique >+ my $title_link = $input->param('title_link'); >+ if ( Koha::CmsPages->find({ title_link => $title_link }) ) { >+ my $existing_link = Koha::CmsPages->find({ title_link => $title_link }); >+ my $link = $existing_link->unblessed; >+ unless ( $link->{'id'} eq $input->param('id') ) { >+ return undef; >+ } >+ } >+ >+ # Ensuring that, if page has parent, provided location suits parent location >+ my $parent = $input->param('parent'); >+ my $parent_obj = Koha::CmsPages->find($parent); >+ if ( $parent_obj ) { >+ my $parent_unblessed = $parent_obj->unblessed; >+ if ( $parent_unblessed->{'location'} ne "" ) { >+ # if parent location is not all interfaces >+ if ( $parent_unblessed->{'location'} != $input->param('disp') ) { >+ # if parent location is not the same as provided location >+ return undef; >+ } >+ } >+ } >+ > my $new_page = $self->_resultset()->update_or_create( $data, { key => 'primary' }); > > return $new_page; >@@ -86,15 +109,24 @@ Lists pages based input filtering paramters for location, branch and language. > sub list { > my ( $self, $id, $disp, $branch, $lang ) = @_; > >- my $filter = { }; >- $filter->{'location'} = $disp unless not defined $disp; >- $filter->{'branch'} = $branch unless not defined $branch; >- $filter->{'lang'} = $lang unless not defined $lang; >+ my %filter; >+ if ($branch) { >+ my $branch_push = [ $branch, undef ]; >+ push @{$filter{'branchcode'}}, $branch_push; >+ } >+ if ($lang) { >+ my $lang_push = [ $lang, undef ]; >+ push @{$filter{'lang'}}, $lang_push; >+ } >+ if ($disp) { >+ my $disp_push = [ $disp, undef ]; >+ push @{$filter{'location'}}, $disp_push; >+ } > >- my $pages = $self->_resultset()->search( undef, { >+ my $pages = $self->_resultset()->search( {}, { > order_by => { >- -asc => [qw/parent location branchcode lang sortorder/] >- }, where => $filter >+ -asc => [qw/parent location branchcode lang sortorder/] >+ }, where => { %filter } > } ); > > my $page_list = []; >@@ -143,20 +175,13 @@ Retrieves all data to show a single CMS page. > =cut > > sub page { >- my ( $self, $id ) = @_; >- >- carp( 'Missing CMS page id parameter in Koha::Pages::page' ) unless defined $id; >- >- # Probably want to merge these to a single query: >- my $top_links = $self->_resultset()->search( >- { parent => undef }, { qw/id title_link/ }); >+ my ( $self, $id ) = @_; > >- my $page_links = $self->_resultset()->search( >- { parent => $id }, { qw/id title_link/ }); >+ carp( 'Missing CMS page id parameter in Koha::Pages::page' ) unless defined $id; > >- my $page_data = $self->_resultset()->find( $id ); >+ my $page_data = $self->_resultset()->find( $id ); > >- return ( $top_links, $page_links, $page_data ); >+ return $page_data; > } > > =head3 child_links >@@ -168,9 +193,8 @@ Lists pages which are children of a specific id (or undef for root). > sub child_links { > my ( $self, $id ) = @_; > >- # 'id' can be undefined if listing top-level links. >- my $rs = $self->_resultset()->search({ parent => $id }, >- { columns => [qw/id title_link/] } ); >+ # 'id' can be undefined if listing top-level links. >+ my $rs = $self->_resultset()->search({ parent => $id }, { qw/id title_link/ }); > > return $rs; > } >diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm >index ec44cde..99bd794 100644 >--- a/Koha/Schema/Result/Branch.pm >+++ b/Koha/Schema/Result/Branch.pm >@@ -352,6 +352,21 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 cms_pages >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::CmsPage> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "cms_pages", >+ "Koha::Schema::Result::CmsPage", >+ { "foreign.branchcode" => "self.branchcode" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 collections > > Type: has_many >@@ -543,8 +558,8 @@ Composing rels: L</branchrelations> -> categorycode > __PACKAGE__->many_to_many("categorycodes", "branchrelations", "categorycode"); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-24 13:56:21 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/9YwsU+GXK+fzc6IX2Tj5g >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-12 02:41:09 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yErr2R015OQyZnTQsdBzWQ > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/Koha/Schema/Result/CmsPage.pm b/Koha/Schema/Result/CmsPage.pm >new file mode 100644 >index 0000000..1136c1d >--- /dev/null >+++ b/Koha/Schema/Result/CmsPage.pm >@@ -0,0 +1,150 @@ >+use utf8; >+package Koha::Schema::Result::CmsPage; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::CmsPage >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<cms_pages> >+ >+=cut >+ >+__PACKAGE__->table("cms_pages"); >+ >+=head1 ACCESSORS >+ >+=head2 id >+ >+ data_type: 'integer' >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+=head2 parent >+ >+ data_type: 'integer' >+ is_nullable: 1 >+ >+=head2 branchcode >+ >+ data_type: 'varchar' >+ is_foreign_key: 1 >+ is_nullable: 1 >+ size: 10 >+ >+=head2 lang >+ >+ data_type: 'varchar' >+ default_value: (empty string) >+ is_nullable: 0 >+ size: 25 >+ >+=head2 title >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 255 >+ >+=head2 title_link >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 64 >+ >+=head2 sortorder >+ >+ data_type: 'integer' >+ default_value: 0 >+ is_nullable: 0 >+ >+=head2 location >+ >+ data_type: 'tinyint' >+ is_nullable: 1 >+ >+=head2 publish >+ >+ data_type: 'tinyint' >+ default_value: 0 >+ is_nullable: 0 >+ >+=head2 content >+ >+ data_type: 'text' >+ is_nullable: 1 >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "id", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "parent", >+ { data_type => "integer", is_nullable => 1 }, >+ "branchcode", >+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, >+ "lang", >+ { data_type => "varchar", default_value => "", is_nullable => 0, size => 25 }, >+ "title", >+ { data_type => "varchar", is_nullable => 1, size => 255 }, >+ "title_link", >+ { data_type => "varchar", is_nullable => 1, size => 64 }, >+ "sortorder", >+ { data_type => "integer", default_value => 0, is_nullable => 0 }, >+ "location", >+ { data_type => "tinyint", is_nullable => 1 }, >+ "publish", >+ { data_type => "tinyint", default_value => 0, is_nullable => 0 }, >+ "content", >+ { data_type => "text", is_nullable => 1 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("id"); >+ >+=head1 RELATIONS >+ >+=head2 branchcode >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Branch> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "branchcode", >+ "Koha::Schema::Result::Branch", >+ { branchcode => "branchcode" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "CASCADE", >+ on_update => "CASCADE", >+ }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-12 02:41:09 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9044j1OZyypCpGV71FgvYg >+ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >diff --git a/Koha/Schema/Result/Issue.pm b/Koha/Schema/Result/Issue.pm >index 0144a86..eb8b80b 100644 >--- a/Koha/Schema/Result/Issue.pm >+++ b/Koha/Schema/Result/Issue.pm >@@ -101,6 +101,22 @@ __PACKAGE__->table("issues"); > default_value: 0 > is_nullable: 0 > >+=head2 note >+ >+ data_type: 'mediumtext' >+ is_nullable: 1 >+ >+=head2 notedate >+ >+ data_type: 'datetime' >+ datetime_undef_if_invalid: 1 >+ is_nullable: 1 >+ >+=head2 noteseen >+ >+ data_type: 'integer' >+ is_nullable: 1 >+ > =cut > > __PACKAGE__->add_columns( >@@ -151,6 +167,16 @@ __PACKAGE__->add_columns( > }, > "onsite_checkout", > { data_type => "integer", default_value => 0, is_nullable => 0 }, >+ "note", >+ { data_type => "mediumtext", is_nullable => 1 }, >+ "notedate", >+ { >+ data_type => "datetime", >+ datetime_undef_if_invalid => 1, >+ is_nullable => 1, >+ }, >+ "noteseen", >+ { data_type => "integer", is_nullable => 1 }, > ); > > =head1 PRIMARY KEY >@@ -222,8 +248,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07039 @ 2015-11-04 12:00:58 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kREecsHr6wZPiokS946BHw >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-12 02:41:09 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZF/YAX9BT1WrgCLUsXSqXQ > > __PACKAGE__->belongs_to( > "borrower", >diff --git a/installer/data/mysql/atomicupdate/bug15326-add_cms_pages_permission.sql b/installer/data/mysql/atomicupdate/bug15326-add_cms_pages_permission.sql >new file mode 100644 >index 0000000..72ce00f >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug15326-add_cms_pages_permission.sql >@@ -0,0 +1 @@ >+INSERT IGNORE INTO permissions (`module_bit`, `code`, `description`) VALUES ('13', 'edit_pages', 'Create, edit and delete CMS pages for OPAC and staff interfaces'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >index 63c318e..03dfd61 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >@@ -10,8 +10,10 @@ > $('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').css('font-weight','bold'); > } else if (path.indexOf("patroncards") >= 0 ) { > $('#navmenulist a[href$="/cgi-bin/koha/patroncards/home.pl"]').css('font-weight','bold'); >- } else if (path.indexOf("patron_lists") >= 0 ) { >+ } else if (path.indexOf("patron_lists") >= 0 ) { > $('#navmenulist a[href$="/cgi-bin/koha/patron_lists/lists.pl"]').css('font-weight','bold'); >+ } else if (path.indexOf("cmspages") >= 0 ) { >+ $('#navmenulist a[href$="/cgi-bin/koha/tools/cmspages.pl"]').css('font-weight','bold'); > } else { > $('#navmenulist a[href$="/' + path + params + '"]').css('font-weight','bold'); > } >@@ -26,43 +28,43 @@ > <h5>Patrons and circulation</h5> > <ul> > [% IF ( CAN_user_tools_manage_patron_lists ) %] >- <li><a href="/cgi-bin/koha/patron_lists/lists.pl">Patron lists</a></li> >+ <li><a href="/cgi-bin/koha/patron_lists/lists.pl">Patron lists</a></li> > [% END %] > [% IF ( CAN_user_tools_moderate_comments ) %] >- <li><a href="/cgi-bin/koha/reviews/reviewswaiting.pl">Comments</a></li> >+ <li><a href="/cgi-bin/koha/reviews/reviewswaiting.pl">Comments</a></li> > [% END %] > [% IF ( CAN_user_tools_import_patrons ) %] >- <li><a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a></li> >+ <li><a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a></li> > [% END %] > [% IF ( CAN_user_tools_edit_notices ) %] >- <li><a href="/cgi-bin/koha/tools/letter.pl">Notices & slips</a></li> >+ <li><a href="/cgi-bin/koha/tools/letter.pl">Notices & slips</a></li> > [% END %] > [% IF ( CAN_user_tools_edit_notice_status_triggers ) %] >- <li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li> >+ <li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li> > [% END %] > [% IF ( CAN_user_tools_label_creator ) %] >- <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li> >+ <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li> > [% END %] > [% IF ( CAN_user_tools_delete_anonymize_patrons ) %] >- <li><a href="/cgi-bin/koha/tools/cleanborrowers.pl">Batch patron deletion/anonymization</a></li> >+ <li><a href="/cgi-bin/koha/tools/cleanborrowers.pl">Batch patron deletion/anonymization</a></li> > [% END %] > [% IF ( CAN_user_tools_edit_patrons ) %] >- <li><a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a></li> >+ <li><a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a></li> > [% END %] > [% IF ( CAN_user_tools_moderate_tags ) %] >- <li><a href="/cgi-bin/koha/tags/review.pl">Tag moderation</a></li> >+ <li><a href="/cgi-bin/koha/tags/review.pl">Tag moderation</a></li> > [% END %] > [% IF ( CAN_user_tools_batch_upload_patron_images ) %] >- <li><a href="/cgi-bin/koha/tools/picture-upload.pl">Upload patron images</a></li> >+ <li><a href="/cgi-bin/koha/tools/picture-upload.pl">Upload patron images</a></li> > [% END %] > </ul> > <h5>Catalog</h5> > <ul> > [% IF ( CAN_user_tools_items_batchdel ) %] >- <li><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Batch item deletion</a></li> >+ <li><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Batch item deletion</a></li> > [% END %] > [% IF ( CAN_user_tools_items_batchmod ) %] >- <li><a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a></li> >+ <li><a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a></li> > [% END %] > [% IF CAN_user_tools_records_batchdel %] > <li><a href="/cgi-bin/koha/tools/batch_delete_records.pl">Batch record deletion</a></li> >@@ -74,47 +76,50 @@ > <li><a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a></li> > [% END %] > [% IF ( CAN_user_tools_export_catalog ) %] >- <li><a href="/cgi-bin/koha/tools/export.pl">Export data</a></li> >+ <li><a href="/cgi-bin/koha/tools/export.pl">Export data</a></li> > [% END %] > [% IF ( CAN_user_tools_inventory ) %] > <li><a href="/cgi-bin/koha/tools/inventory.pl">Inventory</a></li> > [% END %] > [% IF ( CAN_user_tools_label_creator ) %] >- <li><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></li> >- <li><a href="/cgi-bin/koha/labels/spinelabel-home.pl">Quick spine label creator</a></li> >+ <li><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></li> >+ <li><a href="/cgi-bin/koha/labels/spinelabel-home.pl">Quick spine label creator</a></li> > [% END %] > [% IF ( CAN_user_tools_rotating_collections ) %] >- <li><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a></li> >+ <li><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a></li> > [% END %] > [% IF ( CAN_user_tools_marc_modification_templates ) %] > <li><a href="/cgi-bin/koha/tools/marc_modification_templates.pl">Manage MARC modification templates</a></li> > [% END %] > [% IF ( CAN_user_tools_stage_marc_import ) %] >- <li><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC for import</a></li> >+ <li><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC for import</a></li> > [% END %] > [% IF ( CAN_user_tools_manage_staged_marc ) %] >- <li><a href="/cgi-bin/koha/tools/manage-marc-import.pl">Staged MARC management</a></li> >+ <li><a href="/cgi-bin/koha/tools/manage-marc-import.pl">Staged MARC management</a></li> > [% END %] > [% IF ( CAN_user_tools_upload_local_cover_images ) %] >- <li><a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a></li> >+ <li><a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a></li> > [% END %] > </ul> > <h5>Additional tools</h5> > <ul> > [% IF ( CAN_user_tools_edit_calendar ) %] >- <li><a href="/cgi-bin/koha/tools/holidays.pl">Calendar</a></li> >+ <li><a href="/cgi-bin/koha/tools/holidays.pl">Calendar</a></li> > [% END %] > [% IF ( CAN_user_tools_manage_csv_profiles ) %] >- <li><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></li> >+ <li><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></li> > [% END %] > [% IF ( CAN_user_tools_view_system_logs ) %] >- <li><a href="/cgi-bin/koha/tools/viewlog.pl">Log viewer</a></li> >+ <li><a href="/cgi-bin/koha/tools/viewlog.pl">Log viewer</a></li> > [% END %] > [% IF ( CAN_user_tools_edit_news ) %] >- <li><a href="/cgi-bin/koha/tools/koha-news.pl">News</a></li> >+ <li><a href="/cgi-bin/koha/tools/koha-news.pl">News</a></li> >+ [% END %] >+ [% IF ( CAN_user_tools_edit_pages ) %] >+ <li><a href="/cgi-bin/koha/tools/cmspages.pl">Pages</a></li> > [% END %] > [% IF ( CAN_user_tools_schedule_tasks ) %] >- <li><a href="/cgi-bin/koha/tools/scheduler.pl">Task scheduler</a></li> >+ <li><a href="/cgi-bin/koha/tools/scheduler.pl">Task scheduler</a></li> > [% END %] > [% IF ( CAN_user_tools_edit_quotes ) %] > <li><a href="/cgi-bin/koha/tools/quotes.pl">Quote editor</a></li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt >index 99f539d..901c94d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cmspages.tt >@@ -5,26 +5,32 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Pages</title> > [% INCLUDE 'doc-head-close.inc' %] >-[% IF ( opac_page_count ) %] >- <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> >- [% INCLUDE 'datatables.inc' %] >- <script type="text/javascript">//<![CDATA[ >- $(document).ready(function() { >- $("#newst").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { "aTargets": [ 0,-1,-2 ], "bSortable": false }, >- { "aTargets": [ 0, -1 ], "bSearchable": false }, >- { 'sType': "title-string", 'aTargets' : [ 'title-string'] } >- ], >- "sPaginationType": "full_numbers" >- })); >- }); >- //]]> >- </script> >-[% END %] >+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >+[% INCLUDE 'datatables.inc' %] > <script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script> > <script type="text/javascript">//<![CDATA[ >-var MSG_CONFIRM_DELETE_PAGE = _("Are you sure you want to delete the selected page?"); >+var MSG_CONFIRM_DELETE_PAGE = _("Are you sure you want to delete the selected page(s)?"); >+ >+$(document).ready(function() { >+ $("#pages_table").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ 0, -1 ], "bSortable": false, "bSearchable": false }, >+ ], >+ "sPaginationType": "full_numbers" >+ })); >+ >+ $("#del_button").on("click",function(){ >+ return confirmDelete(MSG_CONFIRM_DELETE_PAGE); >+ }); >+ >+ $(".SelectAll").on("click", function(){ >+ $("input[name='ids'][type='checkbox']").prop("checked", true); >+ }); >+ >+ $(".ClearAll").on("click", function(){ >+ $("input[name='ids'][type='checkbox']").prop("checked", false); >+ }); >+}); > > tinyMCE.init({ > mode : "textareas", >@@ -47,20 +53,31 @@ tinyMCE.init({ > width : "700" > //]]> > }); >-//]]> > </script> > </head> > <body id="tools_koha-content" class="tools"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% IF ( form ) %]<a href="[% link_self %]">Pages</a> › [% IF ( id ) %] >-Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div> >+<div id="breadcrumbs"> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> › >+ <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › >+ [% IF ( form ) %]<a href="[% link_self %]">Pages</a> › >+ [% IF ( id ) %]Edit page[% ELSE %]Add page[% END %] >+ [% ELSIF ( view ) %] >+ <a href="[% link_self %]">Pages</a> › >+ [% IF ( cms_page.parent ) %] >+ [% FOREACH parent IN parent_list %] >+ [% IF parent.id == cms_page.parent %]<a href="[% link_self %]?op=view&id=[% cms_page.parent %]">[% parent.title_link %]</a> ›[% END %] >+ [% END %] >+ [% END %] >+ [% cms_page.title_link %] >+ [% ELSE %]Pages[% END %] >+</div> > > [% IF ( form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %] > <div id="bd"> > <div id="yui-main"> > <div class="yui-b"> >- > [% UNLESS ( link_opac_base && link_self) %] > <div class="dialog alert"> > [% UNLESS ( link_opac_base ) %] >@@ -70,17 +87,55 @@ Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div> > Warning: Variable <em>link_self</em> not set, some links might not work!</div> > [% END %] > [% END %] >-[% UNLESS ( form ) %] >- [% IF error_message == 'title_missing' %] >- <div class="dialog alert">Error: Required page title missing!</div> >- [% END %] >+[% UNLESS ( form || view ) %] > <div id="toolbar" class="btn-toolbar"> >- <a class="btn btn-small" id="newentry" href="[% link_self %]?op=form"><i class="icon-plus"></i> New page</a> >+ <a class="btn btn-small" id="newentry" href="[% link_self %]?op=form"><i class="fa fa-plus"></i> New page</a> >+</div> >+[% END %] >+[% IF ( failed_add ) %] >+<div class="dialog alert"> >+ Failed to add page. Check that: >+ <ul> >+ <li>Your link title is unique</li> >+ <li>If specifying a parent page, the location is the same as your new page</li> >+ </ul> >+</div> >+[% END %] >+[% IF ( view ) %] >+<div class="yui-ge"> >+<div id="pagesnav" class="yui-u"> >+ [% IF ( links ) %] >+ <fieldset> >+ <ul> >+ <li><a href="[% link_self %]">Pages home</a></li> >+ </ul> >+ <h4>Pages</h4> >+ <ul id="cms_nav"> >+ [% FOREACH link IN links %] >+ [% IF ( link.location == '' || link.location == '1' ) %] >+ [% IF ( link.parent != '' ) %] >+ [% FOREACH parent IN parent_list %] >+ [% IF ( parent.id == link.parent ) %]<li style="margin-left:20px;"><a href="[% link_self %]?op=view&id=[% link.parent %]">[% parent.title_link %]</a> › <a href="[% link_self %]?op=view&id=[% link.id %]">[% link.title_link %]</a></li>[% END %] >+ [% END %] >+ [% ELSE %] >+ <li><a href="[% link_self %]?op=view&id=[% link.id %]">[% link.title_link %]</a></li> >+ [% END %] >+ [% END %][% END %] >+ </ul> >+ </fieldset> >+ [% END %] > </div> >+<div class="yui-u first"> >+<h1>Pages: [% cms_page.title %]</h1> >+[% IF ( cms_page.publish == 1 ) %] >+ [% cms_page.content %] >+[% ELSE %] >+ <div class="dialog message">This page has not been published.</div> >+ [% cms_page.content %] > [% END %] >-<pre>DEBUG: [% debug %]</pre> >-<pre>DEBUG2: data.location: [% data.location %] data.branchcode: [% data.branchcode %]</pre> >-[% IF ( form ) %] >+</div> >+</div> >+[% ELSIF ( form ) %] > <form name="form" method="post" enctype="multipart/form-data" action="[% link_self %]" > > <input type="hidden" name="op" value="[% op %]" /> > <input type="hidden" name="id" value="[% id %]" /> >@@ -88,39 +143,38 @@ Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div> > <legend>Page</legend> > <ol> > <li> >- <label for="disp">Display location</label> >+ <label for="disp">Display location:</label> > <select id="disp" name="disp"> >- <option value="" [% IF ( data.disp == "" ) %]selected="selected"[% END %]>All</option> >- <option value="1" [% IF ( data.disp == "1" ) %]selected="selected"[% END %]>Intranet</option> >- <option value="2" [% IF ( data.disp == "2" ) %]selected="selected"[% END %]>OPAC</option> >+ [% IF ( data.location == "" ) %]<option value="" selected="selected">All</option>[% ELSE %]<option value="">All</option>[% END %] >+ [% IF ( data.location == "1" ) %]<option value="1" selected="selected">Staff interface</option>[% ELSE %]<option value="1">Staff interface</option>[% END %] >+ [% IF ( data.location == "2" ) %]<option value="2" selected="selected">OPAC</option>[% ELSE %]<option value="2">OPAC</option>[% END %] > </select> > </li> > <li> > <label for="branch">Library: </label> > <select id="branch" name="branch"> >- <option value=""[% IF ( data.branchcode == '' ) %] selected="selected"[% END %]>All libraries</option> >- [% FOREACH branch_lis IN branch_list %] >- <option value="[% branch_lis.branchcode %]"[% IF ( branch_lis.branchcode == data.branchcode ) %] selected="selected"[% END %]>[% branch_lis.branchname %]</option> >- [% END %] >+ [% IF ( data.branchcode == "" ) %]<option value="" selected="selected">All libraries</option>[% ELSE %]<option value="">All libraries</option>[% END %] >+ [% FOREACH branch IN branch_list %] >+ [% IF ( branch.branchcode == data.branchcode ) %]<option value="[% branch.branchcode %]" selected="selected">[% branch.branchname %]</option>[% ELSE %]<option value="[% branch.branchcode %]">[% branch.branchname %]</option>[% END %] >+ [% END %] > </select> > </li> > <li> >- <label for="lang">Language</label> >-<pre>LANG: [% lang %]</pre> >+ <label for="lang">Language:</label> > <select id="lang" name="lang"> >- <option value="" [% IF ( data.lang == "" ) %]selected="selected"[% END %]>All</option> >- [% FOREACH lang_lis IN lang_list %] >- <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> >+ [% IF ( data.lang == "" ) %]<option value="" selected="selected">All</option>[% ELSE %]<option value="">All</option>[% END %] >+ [% FOREACH lang IN lang_list %] >+ [% 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 %] > [% END %] > </select> > </li> > <li> > <label for="parent">Parent page: </label> > <select id="parent" name="parent"> >- <option value="" [% IF ( data.id == "" ) %]selected="selected"[% END %]>No parent</option> >- [% FOREACH parent_lis IN parent_list %] >- <option value="[% parent_lis.id %]" [% IF ( data.parent.id == parent_lis.id ) %]selected="selected"[% END %]>[% parent_lis.title_link %]</option> >- [% END %] >+ [% IF ( data.id == "" ) %]<option value="" selected="selected">No parent</option>[% ELSE %]<option value="">No parent</option>[% END %] >+ [% FOREACH parent IN parent_list %] >+ [% 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 %] >+ [% END %] > </select> > </li> > <li> >@@ -133,11 +187,11 @@ Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div> > </li> > <li> > <label for="number">Appear in position: </label> >- <input id="sortorder" size="3" name="sortorder" type="text" value="[% IF ( data.sortorder ) %][% data.sortorder %][% ELSE %]0[% END %]" /> >+ [% 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 %] > </li> > <li> > <label for="publish">Publish: </label> >- <input type="checkbox" id="publish" name="publish"[% IF ( data.publish ) %] checked="checked"[% END %]/> >+ [% IF ( data.publish ) %]<input type="checkbox" id="publish" name="publish" checked="checked" />[% ELSE %]<input type="checkbox" id="publish" name="publish" />[% END %] > </li> > <li><label for="new">Content: </label> > <textarea name="content" id="content" cols="75" rows="10">[% data.content %]</textarea> >@@ -147,84 +201,103 @@ Edit page[% ELSE %]Add page[% END %][% ELSE %]Pages[% END %]</div> > <fieldset class="action"><input class="button" type="submit" value="Save" /> <a class="cancel" href="[% link_self %]">Cancel</a></fieldset> > </form> > [% ELSE %] >+ >+ <h1>Pages</h1> > <div style="margin-bottom:5px;"> >- <form name="form" method="post" action="[% link_self %]" > >+ <form name="filter" method="post" action="[% link_self %]"> > <label for="disp">Display location:</label> > <select name="disp" id="disp"> >- <option value="" [% IF ( disp == "" ) %]selected="selected"[% END %]>All</option> >- <option value="0" [% IF ( disp == "0" ) %]selected="selected"[% END %]>OPAC</option> >- <option value="1" [% IF ( disp == "1" ) %]selected="selected"[% END %]>Librarian interface</option> >+ [% IF ( disp == "" ) %]<option value="" selected="selected">All</option>[% ELSE %]<option value="">All</option>[% END %] >+ [% IF ( disp == "1" ) %]<option value="1" selected="selected">Staff interface</option>[% ELSE %]<option value="1">Staff interface</option>[% END %] >+ [% IF ( disp == "2" ) %]<option value="2" selected="selected">OPAC</option>[% ELSE %]<option value="2">OPAC</option>[% END %] > </select> > > <label for="branch">Library: </label> > <select id="branch" name="branch"> >- <option value=""[% IF ( branch == "" ) %] selected="selected"[% END %]>All libraries</option> >- [% FOREACH branch_lis IN branch_list %] >- <option value="[% branch_lis.branchcode %]"[% IF ( branch_lis.branchcode == branch ) %] selected="selected"[% END %]>[% branch_lis.branchname %]</option> >+ [% IF ( branch == "" ) %]<option value="" selected="selected">All libraries</option>[% ELSE %]<option value="">All libraries</option>[% END %] >+ [% FOREACH br IN branch_list %] >+ [% IF ( br.branchcode == branch ) %] >+ <option value="[% br.branchcode %]" selected="selected">[% br.branchname %]</option> >+ [% ELSE %] >+ <option value="[% br.branchcode %]">[% br.branchname %]</option> >+ [% END %] > [% END %] > </select> > > <label for="lang">Language:</label> > <select name="lang" id="lang"> >- <option value="" [% IF ( lang == "" ) %]selected="selected"[% END %]>All</option> >- [% FOREACH lang_lis IN lang_list %] >- <option value="[% lang_lis.rfc4646_subtag %]" [% IF ( lang_lis.rfc4646_subtag == lang ) %]selected="selected"[% END %]>[% lang_lis.native_description %] ([% lang_lis.rfc4646_subtag %])</option> >+ [% IF ( lang == "" ) %]<option value="" selected="selected">All</option>[% ELSE %]<option value="">All</option>[% END %] >+ [% FOREACH language IN lang_list %] >+ [% IF ( language.rfc4646_subtag == lang ) %] >+ <option value="[% language.rfc4646_subtag %]" selected="selected">[% language.native_description %] ([% language.rfc4646_subtag %])</option> >+ [% ELSE %] >+ <option value="[% language.rfc4646_subtag %]">[% language.native_description %] ([% language.rfc4646_subtag %])</option> >+ [% END %] > [% END %] > </select> >+ <input type="hidden" name="op" value="filter" /> > <input type="submit" class="button" value="Filter" /> > </form> > </div> >- [% IF ( page_list_count ) %] >- <form name="del_form" method="post" action="[% link_self %]" onsubmit='return confirm(MSG_CONFIRM_DELETE_PAGE)'> >- <table id="newst"> >+ [% IF ( page_list.size ) %] >+ <form name="del_form" method="post" action="[% link_self %]"> >+ <table id="pages_table"> > <thead><tr> > <th> </th> >- <th>Pub.</th> >+ <th>Published</th> > <th>Parent</th> >- <th>Loc.</th> >- <th>Lib.</th> >- <th>Lang.</th> >- <th>Num.</th> >+ <th>Location</th> >+ <th>Library</th> >+ <th>Language</th> >+ <th>Number</th> > <th>Link title</th> > <th>Page title</th> >- <th> </th> >- <th> </th> >+ <th>Actions</th> > </tr></thead> >- <tbody>[% FOREACH page_lis IN page_list %] >+ <tbody>[% FOREACH page IN page_list %] > <tr> >- <td> >- <input type="checkbox" name="ids" id="ids" value="[% page_lis.id %]" /> >- </td> >- <td>[% IF ( page_lis.publish ) %]Yes[% ELSE %]No[% END %]</td> >- <td>[% page_lis.parent.title_link %]</td> >- <td>[% SWITCH page_lis.display %] >- [% CASE "0" %] >- OPAC >- [% CASE "1" %] >- Staff interface >+ <td><input type="checkbox" name="ids" id="ids" value="[% page.id %]" /></td> >+ <td>[% IF ( page.publish ) %]Yes[% ELSE %]No[% END %]</td> >+ <td>[% page.parent.title_link %]</td> >+ <td>[% SWITCH page.location %] > [% CASE "" %] > All >+ [% CASE "1" %] >+ Staff interface >+ [% CASE "2" %] >+ OPAC > [% END %] > </td> >- <td>[% IF ( page_lis.branch == "" ) %] >- All >- [% ELSE %][% page_lis.branchname %] >- [% END %]</td> >- <td>[% IF ( page_lis.langcode == "" ) %]All[% ELSE %] >- [% page_lis.langcode %][% END %]</td> >- <td>[% page_lis.sortorder %]</td> >- <td><a href="[% link_self %]?op=form&id=[% page_lis.id %]">[% page_lis.title_link %]</a></td> >- <td>[% page_lis.title %]</td> >- <td><a href="[% link_self %]?op=form&id=[% page_lis.id %]">Edit</a></td> >- <td><a href="[% link_opac %]?id=[% page_lis.id %]">View</a></td> >+ <td>[% IF ( page.branchcode == "" ) %]All[% ELSE %][% page.branchcode.branchname %][% END %]</td> >+ <td>[% IF ( page.lang == "" ) %]All[% ELSE %] >+ [% FOREACH lang IN lang_list %] >+ [% IF ( lang.rfc4646_subtag == page.lang ) %][% lang.native_description %] ([% lang.rfc4646_subtag %])[% END %] >+ [% END %] >+ [% END %]</td> >+ <td>[% page.sortorder %]</td> >+ <td><a href="[% link_self %]?op=form&id=[% page.id %]">[% page.title_link %]</a></td> >+ <td>[% page.title %]</td> >+ <td class="actions"> >+ <a href="[% link_self %]?op=form&id=[% page.id %]" class="btn btn-mini"><i class="fa fa-pencil"></i> Edit</a> >+ [% IF ( page.location == "" ) %] >+ <a href="[% link_opac %]?id=[% page.id %]" class="btn btn-mini"><i class="fa fa-eye"></i> OPAC</a> >+ <a href="[% link_self %]?op=view&id=[% page.id %]" class="btn btn-mini"><i class="fa fa-eye"></i> Intranet</a> >+ [% ELSIF ( page.location == "1" ) %] >+ <a href="[% link_self %]?op=view&id=[% page.id %]" class="btn btn-mini"><i class="fa fa-eye"></i> Intranet</a> >+ [% ELSIF ( page.location == "2" ) %] >+ <a href="[% link_opac %]?id=[% page.id %]" class="btn btn-mini"><i class="fa fa-eye"></i> OPAC</a> >+ [% END %] > </tr> > [% END %]</tbody> > </table> > <input type="hidden" name="op" value="del" /> >- <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset> >+ <fieldset class="action"> >+ <a class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a class="ClearAll"><i class="fa fa-remove"></i> Clear all</a> >+ <input type="submit" class="button" id="del_button" value="Delete selected" /> >+ </fieldset> > </form> > [% ELSE %] >- <p>No pages exists</p> >+ <div class="dialog message">No pages exist. <a href="[% link_self %]?op=form">Create a new page?</a></div> > [% END %] > [% END %] > </div> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 87449d3..a778aa9 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -290,20 +290,6 @@ > [% END %] > </ul> > </div> <!-- /#moresearches --> >- <div id="cms_nav_top"> >- [% IF ( cms_nav_top ) %] >- <ul> >- [% WHILE ( cms_item = cms_nav_top.next ) %] >- [% IF ( cms_item.id == cms_page.id ) %] >- <li class="cms_nav_top_active"> >- [% ELSE %] >- <li> >- [% END %] >- <a href="/cgi-bin/koha/opac-cmspages.pl?id=[% cms_item.id %]">[% cms_item.title_link %]</a></li> >- [% END %] >- </ul> >- [% END %] >- </div> > </div> <!-- /.row-fluid --> > > [% END # / OpacPublic %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/navigation.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/navigation.inc >index 89921a0..c0e2d6f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/navigation.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/navigation.inc >@@ -1,12 +1,23 @@ > <div id="opacnav"> >-[% IF ( cms_nav_left ) %] >-<ul id="cms_nav_left"> >-[% WHILE ( item = cms_nav_left.next ) %] >- <li><a href="/cgi-bin/koha/opac-cmspages.pl?id=[% item.id %]">[% item.title_link %]</a></li> >-[% END %] >-</ul> >-[% END %] >-[% OpacNav %]</div> >+ [% IF ( links ) %] >+ <h4>Pages</h4> >+ <ul id="cms_nav"> >+ [% FOREACH link IN links %] >+ [% IF ( link.publish == '1' || link.publish == '0' && CAN_user_tools_edit_pages ) %] >+ [% IF ( link.location == '' || link.location == '2' ) %] >+ [% IF ( link.parent != '' ) %] >+ [% FOREACH parent IN parent_list %] >+ [% 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> › <a href="/cgi-bin/koha/opac-cmspages.pl?id=[% link.id %]">[% link.title_link %]</a></li>[% END %] >+ [% END %] >+ [% ELSE %] >+ <li><a href="/cgi-bin/koha/opac-cmspages.pl?id=[% link.id %]">[% link.title_link %]</a></li> >+ [% END %] >+ [% END %][% END %] >+ [% END %] >+ </ul> >+ [% END %] >+ [% OpacNav %] >+</div> > [% IF IsPatronPage %] > <div id="usermenu">[% INCLUDE usermenu.inc %]</div> > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-cmspages.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-cmspages.tt >index 9bc3e35..88811ef 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-cmspages.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-cmspages.tt >@@ -1,7 +1,7 @@ > [% USE Koha %] > [% USE Branches %] > [% INCLUDE 'doc-head-open.inc' %] >-<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %][% IF (cms_page.title) %] - [% cms_page.title %][% ELSE %] catalog[% END%]</title> >+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online catalog[% END %][% IF (cms_page.title) %] › [% cms_page.title %][% END%]</title> > [% INCLUDE 'doc-head-close.inc' %] > [% BLOCK cssinclude %][% END %] > </head> >@@ -10,8 +10,12 @@ > > <div class="main"> > <ul class="breadcrumb"> >- <li><a href="/cgi-bin/koha/opac-main.pl">Home</a></li> >- <li><span class="divider">›</span></li> >+ <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> >+ [% IF ( cms_page.parent ) %] >+ [% FOREACH parent IN parents %] >+ [% 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">›</span></li>[% END %] >+ [% END %] >+ [% END %] > <li><a href="#">[% cms_page.title_link %]</a></li> > </ul> > >@@ -39,48 +43,16 @@ > [% ELSE %] > <div class="span9"> > [% END %] >- [% cms_page.content %] >+ >+ [% IF ( cms_page.publish == 1 ) || ( cms_page.publish == 0 && CAN_user_tools_edit_pages ) %] >+ [% cms_page.content %] >+ [% ELSE %] >+ This page has not been published. >+ [% END %] >+ > [% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock">[% OpacMainUserBlock %]</div>[% END %] > </div> <!-- / .span 7/9 --> > >- [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) || OpacNavRight ) %] >- <div class="span3"> >- [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] >- [% UNLESS ( loggedinusername ) %] >- [% UNLESS ( casAuthentication || shibbolethAuthentication ) %] >- <div id="login"> >- <form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="auth"> >- <input type="hidden" name="koha_login_context" value="opac" /> >- <fieldset class="brief"> >- <legend>Log in to your account:</legend> >- <label for="userid">Login:</label><input type="text" id="userid" name="userid" /> >- <label for="password">Password:</label><input type="password" id="password" name="password" /> >- <fieldset class="action"> >- <input type="submit" value="Log in" class="btn" /> >- </fieldset> >- [% 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 %] >- </fieldset> >- [% IF Koha.Preference( 'NoLoginInstructions' ) %] >- <div id="nologininstructions-main"> >- [% Koha.Preference( 'NoLoginInstructions' ) %] >- </div> >- [% END %] >- </form> >- </div> <!-- /#login --> >- [% END # /casAuthentication %] >- [% IF persona %] >- <a href="#" class="persona-button" id="browserid" ><span>Sign in with your email</span></a> >- [% END # /persona %] >- [% END # / loggedinusername %] >- [% END # /opacuserlogin %] >- [% IF ( OpacNavRight ) %] >- <div id="opacnavright"> >- [% OpacNavRight %] >- </div> >- [% END # /OpacNavRight %] >- </div> <!-- / .span3 --> >- [% END # /opacuserlogin || OpacNavRight %] >- > </div> <!-- /.container-fluid --> > </div> <!-- /.row-fluid --> > </div> <!-- /.main --> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less b/koha-tmpl/opac-tmpl/bootstrap/less/opac.less >index 001c592..7e34470 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less >+++ b/koha-tmpl/opac-tmpl/bootstrap/less/opac.less >@@ -221,37 +221,15 @@ td { > } > > #cms_nav_top { >- li { >- margin-bottom: -1em; >- display: inline; >- white-space: nowrap; >- border-top-left-radius: 5px; >- border-top-right-radius: 5px; >- background-color: #eee; >- border: 1px solid #D2D2CF; >- border-bottom: none; >- padding: 0.1em 0.8em 0em 0.8em; >- font-weight: bold; >- font-size: 1.2em; >- border-bottom: 1px solid #D2D2CF; >- a { >- text-decoration: none; >- } >- &.cms_nav_top_active { >- background-color: #fff; >- border-bottom: 1px solid #FFF; >- } >- } >- ul { >- margin: 0; >- display: inline; >- } >- display: inline; >-} >- >-ul#cms_nav_left { >- list-style-type: none; >- padding: 0; >+ list-style-type: circle; >+ padding: 0; >+ margin: 0; >+ a { >+ text-decoration: none; >+ } >+ a:hover { >+ text-decoration: underline; >+ } > } > > #news { >diff --git a/opac/opac-cmspages.pl b/opac/opac-cmspages.pl >index eaace18..f93f2b8 100755 >--- a/opac/opac-cmspages.pl >+++ b/opac/opac-cmspages.pl >@@ -23,6 +23,7 @@ use C4::Auth; > use C4::Output; > use C4::Languages qw( getTranslatedLanguages accept_language ); > use Koha::CmsPages; >+use Data::Dumper; > > my $input = new CGI; > my $id = scalar $input->param( 'id' ) // ''; >@@ -42,11 +43,14 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > my ( $theme, $news_lang, $availablethemes ) = C4::Templates::themelanguage( > C4::Context->config( 'opachtdocs'), 'opac-cmspages.tt', 'opac', $input ); > >-my ($cms_nav_top, $cms_nav_left, $cms_data) = Koha::CmsPages->page( $id ); >+# List all pages, if id is set generate parent page list and data. >+my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id ); >+ >+my $links = Koha::CmsPages->search( {}, { order_by => 'sortorder' } ); >+my $cms_data = Koha::CmsPages->page( $id ); > $template->param( >- cms_page => $cms_data, >- cms_nav_top => $cms_nav_top, >- cms_nav_left => $cms_nav_left, >+ links => $links, >+ cms_page => $cms_data, >+ parent_list => $parent_list, > ); >- > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/opac/opac-main.pl b/opac/opac-main.pl >index b0bcc18..ff59a64 100755 >--- a/opac/opac-main.pl >+++ b/opac/opac-main.pl >@@ -25,7 +25,7 @@ use C4::Output; > use C4::NewsChannels; # GetNewsToDisplay > use C4::Languages qw(getTranslatedLanguages accept_language); > use C4::Koha qw( GetDailyQuote ); >-use Koha::CmsPages qw( list ); >+use Koha::CmsPages; > > my $input = new CGI; > my $dbh = C4::Context->dbh; >@@ -68,9 +68,17 @@ $template->param( > daily_quote => $quote, > ); > >+my $id = scalar $input->param( 'id' ) // ''; >+my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id ); >+my $links = Koha::CmsPages->search( {}, { order_by => 'parent' } ); >+my $cms_data = Koha::CmsPages->page( $id ); > $template->param( >- cms_nav_top => Koha::CmsPages->child_links( undef ), >-); >+ links => $links, >+ cms_page => $cms_data, >+ parent_list => $parent_list, >+ ); >+ >+ > > if (C4::Context->preference('GoogleIndicTransliteration')) { > $template->param('GoogleIndicTransliteration' => 1); >diff --git a/tools/cmspages.pl b/tools/cmspages.pl >index 314724a..846f5e1 100755 >--- a/tools/cmspages.pl >+++ b/tools/cmspages.pl >@@ -23,8 +23,8 @@ use CGI qw( -utf8 ); > use C4::Auth; > use C4::Output; > use C4::Languages qw( getTranslatedLanguages ); >-use Koha::Database; > use Koha::CmsPages; >+use Koha::Libraries; > > my $link_self = '/cgi-bin/koha/tools/cmspages.pl'; > >@@ -50,17 +50,14 @@ $template->param( > disp => $disp > ); > >-my $schema = Koha::Database->new->schema; >-my @branches = $schema->resultset( 'Branch' )->all; >-$template->param( branch_list => @branches ); >- > my $lang_list = getTranslatedLanguages; >+my $branches = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); > > # List all pages, if id is set generate parent page list and data. > my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id ); > > $template->param( >- page_list_count => scalar $page_list, >+ branch_list => $branches, > page_list => $page_list, > parent_list => $parent_list, > data => $page_data, >@@ -74,17 +71,35 @@ if ( $op eq 'form' ) { > id => $id, > op => 'add' > ); >-} >- >-if ( $op eq 'add' ) { >- Koha::CmsPages->add( $cgi ); >- print $cgi->redirect( $link_self ); >- >+} elsif ( $op eq 'add' ) { >+ my $success = Koha::CmsPages->add( $cgi ); >+ unless ($success) { >+ $template->param( failed_add => 1 ); >+ } >+ if ($success) { >+ print $cgi->redirect( $link_self ); >+ } > } elsif ( $op eq 'del' ) { > # param => multi_param; no list-ctx warnings > Koha::CmsPages->remove( $cgi->multi_param( 'ids' ) ); > print $cgi->redirect( $link_self ); >+} elsif ( $op eq 'view' ) { >+ my $cms_data = Koha::CmsPages->page( $id ); >+ my $links = Koha::CmsPages->search( {}, { order_by => 'sortorder' } ); >+ $template->param( >+ links => $links, >+ cms_page => $cms_data, >+ view => 1, >+ id => $id, >+ op => 'view', >+ ); >+} elsif ( $op eq 'filter' ) { >+ my ( $page_list, $parent_list, $page_data ) = Koha::CmsPages->list( $id, $disp, $branch, $lang ); >+ $template->param( >+ page_list => $page_list, >+ parent_list => $parent_list, >+ data => $page_data, >+ ); > } >- > $template->param( link_self => $link_self ); > output_html_with_http_headers $cgi, $cookie, $template->output; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15326
:
45621
|
58272
|
58607
|
58608
|
58609
|
58787
|
63904
|
63905
|
64241
|
64941
|
64942
|
66255
|
70866
|
70867
|
70868
|
70869
|
70870
|
70871
|
76387
|
76388
|
76389
|
76390
|
76391
|
76392
|
78232
|
78233
|
78234
|
78235
|
78236
|
78237
|
78238
|
78240
|
79269
|
83318
|
83319
|
83320
|
83321
|
83322
|
83323
|
83324
|
83325
|
83326
|
83404
|
83405
|
83406
|
83407
|
83408
|
83409
|
83410
|
83411
|
83412
|
84682
|
84683
|
84684
|
84685
|
84686
|
84687
|
84688
|
84689
|
84690
|
84691
|
87494
|
87495
|
87496
|
87497
|
87498
|
87499
|
87500
|
87501
|
87502
|
87503
|
87608
|
87609
|
87610
|
87617
|
96084
|
96085
|
96086
|
96087
|
96088
|
96089
|
96090
|
96091
|
96092
|
96093
|
96094
|
96095
|
96096
|
96097
|
96098
|
97237
|
101565
|
101566
|
101567
|
101568
|
101569
|
101570
|
101571
|
101572
|
101573
|
101574
|
101575
|
101576
|
101577
|
101578
|
101579
|
101580
|
128341
|
128342
|
128343
|
128344
|
128345
|
128346
|
128347
|
128348
|
128349
|
128350
|
128351
|
128352
|
128353
|
128354
|
128355
|
128356
|
128357
|
128585
|
128642
|
136432
|
136757
|
136768
|
138489
|
138493
|
139028
|
139029
|
139030
|
139031
|
139111
|
139123
|
139124
|
139125
|
139172
|
139173
|
139174