Bugzilla – Attachment 52565 Details for
Bug 15707
Add ability to define hierarchical groups of libraries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15707 - Add editor
Bug-15707---Add-editor.patch (text/plain), 16.78 KB, created by
Kyle M Hall (khall)
on 2016-06-20 11:46:50 UTC
(
hide
)
Description:
Bug 15707 - Add editor
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-06-20 11:46:50 UTC
Size:
16.78 KB
patch
obsolete
>From 4f37455dbb14109e4ac90c13299f19f24e3fae45 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Sun, 31 Jan 2016 11:22:51 +0000 >Subject: [PATCH] Bug 15707 - Add editor > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > admin/library_groups.pl | 102 ++++++++ > .../intranet-tmpl/prog/en/includes/admin-menu.inc | 1 + > .../prog/en/modules/admin/admin-home.tt | 2 + > .../prog/en/modules/admin/library_groups.tt | 266 +++++++++++++++++++++ > 4 files changed, 371 insertions(+) > create mode 100755 admin/library_groups.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt > >diff --git a/admin/library_groups.pl b/admin/library_groups.pl >new file mode 100755 >index 0000000..e506d48 >--- /dev/null >+++ b/admin/library_groups.pl >@@ -0,0 +1,102 @@ >+#! /usr/bin/perl >+ >+# Copyright 2016 ByWater Solutions >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use CGI qw ( -utf8 ); >+use C4::Context; >+use C4::Auth; >+use C4::Output; >+ >+use Koha::Libraries; >+use Koha::Library::Group; >+use Koha::Library::Groups; >+ >+my $cgi = new CGI; >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "admin/library_groups.tt", >+ query => $cgi, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { parameters => 'parameters_remaining_permissions' }, >+ debug => 1, >+ } >+); >+ >+my $action = $cgi->param('action') || q{}; >+ >+if ( $action eq 'add' ) { >+ my $parent_id = $cgi->param('parent_id') || undef; >+ my $title = $cgi->param('title') || undef; >+ my $description = $cgi->param('description') || undef; >+ my $branchcode = $cgi->param('branchcode') || undef; >+ >+ my $group = Koha::Library::Group->new( >+ { >+ parent_id => $parent_id, >+ title => $title, >+ description => $description, >+ branchcode => $branchcode, >+ } >+ )->store(); >+ >+ $template->param( added => $group ); >+} >+elsif ( $action eq 'edit' ) { >+ my $id = $cgi->param('id') || undef; >+ my $title = $cgi->param('title') || undef; >+ my $description = $cgi->param('description') || undef; >+ >+ if ($id) { >+ my $group = Koha::Library::Groups->find($id); >+ >+ $group->set( >+ { >+ title => $title, >+ description => $description, >+ } >+ )->store(); >+ >+ $template->param( edited => $group ); >+ } >+} >+elsif ( $action eq 'delete' ) { >+ my $id = $cgi->param('id'); >+ >+ my $group = Koha::Library::Groups->find($id); >+ >+ if ($group) { >+ $group->delete(); >+ $template->param( >+ deleted => { >+ title => $group->title(), >+ library => $group->library() >+ ? $group->library()->branchname >+ : undef >+ } >+ ); >+ } >+} >+ >+my $root_groups = Koha::Library::Groups->get_root_groups(); >+ >+$template->param( root_groups => $root_groups, ); >+ >+output_html_with_http_headers $cgi, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >index e736272..9a5a1cb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >@@ -21,6 +21,7 @@ > <h5>Basic parameters</h5> > <ul> > <li><a href="/cgi-bin/koha/admin/branches.pl">Libraries and groups</a></li> >+ <li><a href="/cgi-bin/koha/admin/library_groups.pl">Library groups</a></li> > <li><a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a></li> > <li><a href="/cgi-bin/koha/admin/authorised_values.pl">Authorized values</a></li> > </ul> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >index bd951bc..06007ea 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >@@ -31,6 +31,8 @@ > <dl> > <dt><a href="/cgi-bin/koha/admin/branches.pl">Libraries and groups</a></dt> > <dd>Define libraries and groups.</dd> >+ <dt><a href="/cgi-bin/koha/admin/library_groups.pl">Library groups</a></dt> >+ <dd>Define library hierarchies.</dd> > <dt><a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a></dt> > <dd>Define item types used for circulation rules.</dd> > <dt><a href="/cgi-bin/koha/admin/authorised_values.pl">Authorized values</a></dt> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt >new file mode 100644 >index 0000000..4e25a54 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt >@@ -0,0 +1,266 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Administration › Library groups</title> >+[% INCLUDE 'doc-head-close.inc' %] >+<script type="text/javascript" src="[% interface %]/lib/jquery-treegrid/js/jquery.treegrid.min.js"></script> >+<script type="text/javascript" src="[% interface %]/lib/jquery-treegrid/js/jquery.treegrid.bootstrap2.js"></script> >+<link rel="stylesheet" href="[% interface %]/lib/jquery-treegrid/css/jquery.treegrid.css"> >+<script type="text/javascript"> >+//<![CDATA[ >+ $(document).ready(function() { >+ $('#library-groups').treegrid( >+ { >+ 'saveState': true >+ } >+ ); >+ }); >+ >+ function add_group( parent_id ) { >+ $('#add-group-modal-parent-id').val( parent_id ); >+ >+ $('#add-group-modal-description').val(""); >+ $('#add-group-modal-title').val(""); >+ >+ $('#add-group-modal').on('shown', function() { >+ $('#add-group-modal-title').focus(); >+ }); >+ >+ $('#add-group-modal').modal('show'); >+ } >+ >+ function edit_group( id, title, description ) { >+ $('#edit-group-modal-id').val( id ); >+ $('#edit-group-modal-title').val( title ); >+ $('#edit-group-modal-description').val( description ); >+ >+ $('#edit-group-modal').on('shown', function() { >+ $('#edit-group-modal-title').focus(); >+ }); >+ >+ $('#edit-group-modal').modal('show'); >+ } >+ >+ function remove_library( id ) { >+ $('#remove-library-modal-id').val( id ); >+ $('#remove-library-modal').modal('show'); >+ } >+ >+ function delete_group( id ) { >+ $('#delete-group-modal-id').val( id ); >+ $('#delete-group-modal').modal('show'); >+ } >+//]]> >+</script> >+</head> >+<body id="admin_library_groups" class="admin"> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'cities-admin-search.inc' %] >+ >+<div id="breadcrumbs"> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> >+ › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> >+ › <a href="/cgi-bin/koha/admin/library_groups.pl">Library groups</a> >+</div> >+ >+[% IF added %] >+ <div class="dialog alert group-added"> >+ [% IF added.branchcode %] >+ <i>[% added.library.branchname %]</i> added to group. >+ [% ELSE %] >+ Group <i>[% added.title %]</i> created. >+ [% END %] >+ </div> >+[% ELSIF deleted %] >+ <div class="dialog alert group-deleted"> >+ [% IF deleted.title %] >+ Group <i>[% deleted.title %]</i> has been deleted. >+ [% ELSE %] >+ <i>[% deleted.library %]</i> has been removed from group. >+ [% END %] >+ </div> >+[% END %] >+ >+<div id="doc3" class="yui-t2"> >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ <div class="yui-g"> >+ <div id="toolbar" class="btn-toolbar"> >+ <div class="btn-group"> >+ <a id="add-group-[% group.id %]" class="btn btn-small" href="#" onclick="add_group()"> >+ <i class="fa fa-plus-circle"></i> Add group >+ </a> >+ </div> >+ </div> >+ </div> >+ >+ [% FOREACH root_group IN root_groups %] >+ <table id="library-groups" class="tree"> >+ <tr> >+ <th> </th> >+ <th>Description</th> >+ <th> </th> >+ </tr> >+ [% PROCESS tree group=root_group %] >+ </table> >+ [% END %] >+ </div> >+ </div> >+ >+ <div class="yui-b"> >+ [% INCLUDE 'admin-menu.inc' %] >+ </div> >+ >+ <div id="add-group-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="add-group-modal-label" aria-hidden="true"> >+ <form id="add-group-form" action="/cgi-bin/koha/admin/library_groups.pl" class="form-horizontal"> >+ <div class="modal-header"> >+ <h3 id="add-group-modal-label">Add group</h3> >+ </div> >+ <div class="modal-body"> >+ <input type="hidden" id="add-group-modal-parent-id" name="parent_id" value="" /> >+ <input type="hidden" id="add-group-modal-action" name="action" value="add"> >+ >+ <p> >+ <label for="title">Title: </label> >+ <input type="text" name="title" id="add-group-modal-title" required="required" /> >+ <i>required</i> >+ </p> >+ >+ <p> >+ <label for="description">Description: </label> >+ <input type="text" name="description" id="add-group-modal-description" /> >+ </p> >+ </div> >+ <div class="modal-footer"> >+ <button type="submit" class="btn btn-primary">Save</button> >+ <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button> >+ </div> >+ </form> >+ </div> >+ >+ <div id="edit-group-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="edit-library-modal-label" aria-hidden="true"> >+ <form id="edit-group-form" action="/cgi-bin/koha/admin/library_groups.pl" class="form-horizontal"> >+ <div class="modal-header"> >+ <h3 id="edit-group-modal-label">Edit group</h3> >+ </div> >+ <div class="modal-body"> >+ <input type="hidden" id="edit-group-modal-id" name="id" value="" /> >+ <input type="hidden" id="edit-group-modal-action" name="action" value="edit" /> >+ >+ <p> >+ <label for="title">Title: </label> >+ <input type="text" id="edit-group-modal-title" name="title" value="" required="required" /> >+ <i>required</i> >+ </p> >+ >+ <p> >+ <label for="description">Description: </label> >+ <input type="text" id="edit-group-modal-description" name="description" value="" /> >+ </p> >+ </div> >+ <div class="modal-footer"> >+ <button type="submit" class="btn btn-primary">Update</button> >+ <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button> >+ </div> >+ </form> >+ </div> >+ >+ <div id="delete-group-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="delete-group-modal-label" aria-hidden="true"> >+ <form action="/cgi-bin/koha/admin/library_groups.pl" /> >+ <input id="delete-group-modal-action" type="hidden" name="action" value="delete" /> >+ <input id="delete-group-modal-id" type="hidden" name="id" value="" /> >+ <div class="modal-header"> >+ <h3 id="delete-group-modal-label">Delete group or library</h3> >+ </div> >+ <div class="modal-body"> >+ Are you sure you want to delete this? >+ </div> >+ <div class="modal-footer"> >+ <button type="submit" class="btn btn-danger"><i class="fa fa-trash"></i> Delete</button> >+ <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button> >+ </div> >+ </form> >+ </div> >+ >+ <div id="remove-library-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="remove-library-modal-label" aria-hidden="true"> >+ <form action="/cgi-bin/koha/admin/library_groups.pl" /> >+ <input id="remove-library-modal-action" type="hidden" name="action" value="delete" /> >+ <input id="remove-library-modal-id" type="hidden" name="id" value="" /> >+ <div class="modal-header"> >+ <h3 id="remove-library-modal-label">Remove library from group</h3> >+ </div> >+ <div class="modal-body"> >+ Are you sure you want to remove this library? >+ </div> >+ <div class="modal-footer"> >+ <button type="submit" class="btn btn-danger"><i class="fa fa-minus-circle"></i> Remove</button> >+ <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button> >+ </div> >+ </form> >+ </div> >+ >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >+ >+[% BLOCK tree %] >+ <tr class="treegrid-[% group.id %] treegrid-parent-[% group.parent_id %]"> >+ <td> >+ [% IF group.branchcode %] >+ <i class="fa fa-home"></i> [% group.branchcode %] >+ [% ELSE %] >+ <i class="fa fa-object-group"></i> [% group.title %] >+ [% END %] >+ </td> >+ <td> >+ [% IF group.branchcode %] >+ [% group.library.branchname %] >+ [% ELSE %] >+ [% group.description %] >+ [% END %] >+ </td> >+ <td> >+ [% IF group.branchcode %] >+ <button class="btn btn-small delete-library" onclick="remove_library([% group.id %])"><i class="fa fa-minus-circle"></i> Remove from group</button> >+ [% ELSE %] >+ <div class="btn-group"> >+ <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="fa fa-wrench"></i> Actions <span class="caret"></span></button> >+ <ul class="dropdown-menu"> >+ <li> >+ <a id="add-group-[% group.id %]" href="#" onclick="add_group([% group.id %])"> >+ <i class="fa fa-plus-circle"></i> Add sub-group >+ </a> >+ </li> >+ >+ <li> >+ <a class="delete-group" id="delete-group-[% group.id %]" href="#" onclick="edit_group([% group.id %], '[% group.title | replace('\'', '\\\'') | html %]', '[% group.description | replace('\'', '\\\'') | html %]')"> >+ <i class="fa fa-edit"></i> Edit >+ </a> >+ </li> >+ >+ <li> >+ <a class="delete-group" id="delete-group-[% group.id %]" href="#" onclick="delete_group([% group.id %])"> >+ <i class="fa fa-trash"></i> Delete >+ </a> >+ </li> >+ </ul> >+ </div> >+ >+ <div class="btn-group"> >+ <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="fa fa-home"></i> Add library <span class="caret"></span></button> >+ <ul class="dropdown-menu"> >+ [% FOREACH library IN group.libraries_not_direct_children %] >+ <li> >+ <a class="add-library" id="add-library-[% group.id %]" href="/cgi-bin/koha/admin/library_groups.pl?action=add&parent_id=[% group.id %]&branchcode=[% library.id %]"> >+ [% library.branchname %] >+ </a> >+ </li> >+ [% END %] >+ </ul> >+ </div> >+ [% END %] >+ </td> >+ </tr> >+ >+ [% FOREACH g IN group.children %] >+ [% PROCESS tree group=g %] >+ [% END %] >+[% END %] >-- >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 15707
:
47479
|
47480
|
47481
|
47482
|
47483
|
47484
|
47728
|
47729
|
47730
|
47731
|
47732
|
47733
|
47734
|
47849
|
47850
|
47851
|
47852
|
47853
|
47854
|
47855
|
47868
|
47869
|
47870
|
47871
|
47872
|
47873
|
47874
|
48072
|
50400
|
50401
|
50402
|
50403
|
50404
|
50405
|
50406
|
50407
|
50408
|
52267
|
52268
|
52269
|
52270
|
52271
|
52272
|
52273
|
52274
|
52275
|
52367
|
52370
|
52562
|
52563
|
52564
|
52565
|
52566
|
52567
|
52568
|
52569
|
52570
|
52571
|
52572
|
52573
|
52574
|
52575
|
57080
|
57081
|
57082
|
57083
|
57084
|
57085
|
57086
|
57087
|
57088
|
57089
|
57090
|
57091
|
57092
|
57093
|
58086
|
60504
|
60505
|
60506
|
60507
|
60508
|
60509
|
60510
|
60511
|
60512
|
60513
|
60514
|
60515
|
60516
|
60517
|
60518
|
60572
|
60573
|
60574
|
60575
|
60576
|
60577
|
60578
|
60579
|
60580
|
60581
|
60582
|
60583
|
60584
|
60585
|
60586
|
60587
|
60755
|
60756
|
60757
|
60758
|
60759
|
60760
|
60761
|
60762
|
60763
|
60764
|
60765
|
60766
|
60767
|
60768
|
60769
|
60770
|
60771
|
65666
|
65667
|
65668
|
65669
|
65670
|
65671
|
65672
|
65673
|
65674
|
65675
|
65676
|
65677
|
65678
|
65679
|
65680
|
65681
|
69514
|
69515
|
69516
|
69517
|
69518
|
69519
|
69520
|
69521
|
69522
|
69523
|
69524
|
69525
|
69526
|
69527
|
69528
|
69529
|
69573
|
69574
|
69575
|
69576
|
69577
|
69578
|
69579
|
69580
|
69581
|
69582
|
69583
|
69584
|
69585
|
69586
|
69587
|
69588
|
69589