Bugzilla – Attachment 44756 Details for
Bug 9525
Add option to define float groups and rules for float
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9525 - group floating rules, floating rule tester :)
Bug-9525---group-floating-rules-floating-rule-test.patch (text/plain), 9.71 KB, created by
Olli-Antti Kivilahti
on 2015-11-11 13:14:30 UTC
(
hide
)
Description:
Bug 9525 - group floating rules, floating rule tester :)
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2015-11-11 13:14:30 UTC
Size:
9.71 KB
patch
obsolete
>From 9cb4388a37d6eeb3003bce8e151ff4fb866d1e49 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Wed, 11 Nov 2015 15:10:49 +0200 >Subject: [PATCH] Bug 9525 - group floating rules, floating rule tester :) > >Implemented a tester to floating-matrix.pl to more easily test the changes in >the floating rules matrix "FloMax". >--- > admin/floating-matrix-api.pl | 10 +++ > .../prog/en/css/admin/floating-matrix-loader.css | 78 ++++++++++++++++++++++ > .../prog/en/css/admin/floating-matrix.css | 8 +++ > .../prog/en/js/admin/floating-matrix.js | 64 ++++++++++++++++++ > .../prog/en/modules/admin/floating-matrix.tt | 27 ++++++++ > 5 files changed, 187 insertions(+) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/css/admin/floating-matrix-loader.css > >diff --git a/admin/floating-matrix-api.pl b/admin/floating-matrix-api.pl >index 47cfe8d..27a69be 100755 >--- a/admin/floating-matrix-api.pl >+++ b/admin/floating-matrix-api.pl >@@ -25,6 +25,7 @@ use JSON::XS; > use C4::Context; > use C4::Output; > use C4::Auth qw(check_cookie_auth); >+use C4::Items; > > use Koha::FloatingMatrix; > >@@ -52,6 +53,15 @@ if ($data) { > $fm->deleteBranchRule($data->{fromBranch}, $data->{toBranch}); > $fm->store(); > } >+ elsif ($data->{test}) { >+ my $item = C4::Items::GetItem(undef, $data->{barcode}); >+ if ($data->{barcode} && $item) { >+ $data->{testResult} = $fm->checkFloating($item, $data->{fromBranch}, $data->{toBranch}); >+ } >+ else { >+ Koha::Exception::BadParameter->throw(error => "No Item found using barcode '".$data->{barcode}."'"); >+ } >+ } > ##If we are getting a POST-request, we UPSERT > else { > $fm->upsertBranchRule($data); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/admin/floating-matrix-loader.css b/koha-tmpl/intranet-tmpl/prog/en/css/admin/floating-matrix-loader.css >new file mode 100644 >index 0000000..70e69a0 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/css/admin/floating-matrix-loader.css >@@ -0,0 +1,78 @@ >+.cssload-loader { >+ position: relative; >+ left: calc(50% - 8px); >+ width: 16px; >+ height: 16px; >+ border-radius: 50%; >+ -moz-border-radius: 50%; >+ perspective: 200px; >+ margin-top: 3px; >+ visibility: hidden; >+} >+ >+.cssload-inner { >+ position: absolute; >+ width: 100%; >+ height: 100%; >+ box-sizing: border-box; >+ -moz-box-sizing: border-box; >+ border-radius: 50%; >+ -moz-border-radius: 50%; >+} >+ >+.cssload-inner.cssload-one { >+ left: 0%; >+ top: 0%; >+ animation: cssload-rotate-one 1.3s linear infinite; >+ -moz-animation: cssload-rotate-one 1.3s linear infinite; >+ border-bottom: 2px solid rgb(0,0,0); >+} >+ >+.cssload-inner.cssload-two { >+ right: 0%; >+ top: 0%; >+ animation: cssload-rotate-two 1.3s linear infinite; >+ -moz-animation: cssload-rotate-two 1.3s linear infinite; >+ border-right: 2px solid rgb(0,0,0); >+} >+ >+.cssload-inner.cssload-three { >+ right: 0%; >+ bottom: 0%; >+ animation: cssload-rotate-three 1.3s linear infinite; >+ -moz-animation: cssload-rotate-three 1.3s linear infinite; >+ border-top: 2px solid rgba(0,0,0,0.99); >+} >+ >+ >+ >+ >+ >+ >+ >+@keyframes cssload-rotate-one { >+ 0% { >+ transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg); >+ } >+ 100% { >+ transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg); >+ } >+} >+ >+@keyframes cssload-rotate-two { >+ 0% { >+ transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg); >+ } >+ 100% { >+ transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg); >+ } >+} >+ >+@keyframes cssload-rotate-three { >+ 0% { >+ transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg); >+ } >+ 100% { >+ transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg); >+ } >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/admin/floating-matrix.css b/koha-tmpl/intranet-tmpl/prog/en/css/admin/floating-matrix.css >index de8df9a..14da50b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/css/admin/floating-matrix.css >+++ b/koha-tmpl/intranet-tmpl/prog/en/css/admin/floating-matrix.css >@@ -1,6 +1,14 @@ > .disabled-transfer { > background-color: #FF8888; > } >+ >+#testResulDisplay { width: 20px; >+ height: 22px; >+ background-color: #B9D8D9; >+ vertical-align: middle; >+ display: inline-block; >+} >+ > .branchRule select { width: 100%; } > .branchRule select {padding: 0px; margin: 5px 0px;} > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/admin/floating-matrix.js b/koha-tmpl/intranet-tmpl/prog/en/js/admin/floating-matrix.js >index 1547f9e..09b669d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/admin/floating-matrix.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/admin/floating-matrix.js >@@ -1,5 +1,6 @@ > ////Create javascript namespace > var FloMax = FloMax || {}; >+FloMax.Tester = FloMax.Tester || {}; > > //// DOCUMENT READY INIT SCRIPTS > >@@ -15,6 +16,13 @@ $(document).ready(function() { > FloMax.changeBranchRuleColor(this); > }); > >+ //Bind actions to the FloMax Tester >+ $("#floatingRuleTester input[type='submit']").bind({ >+ click: function() { >+ FloMax.Tester.testFloating(); >+ } >+ }); >+ > //Bind action listeners to the floating matrix > $(".branchRule").bind({ > click: function() { >@@ -183,4 +191,60 @@ FloMax.persistBranchRule = function (brJSON, branchRule) { > alert("Saving floating rule "+brJSON.fromBranch+"-"+brJSON.toBranch+" failed, because of the following error:\n"+data.status+" "+data.statusText+"\n"+"More specific error: "+error.error); > }); > } >+} >+ >+FloMax.Tester.defaultTestResultColor = "#B9D8D9"; >+ >+FloMax.Tester.testFloating = function() { >+ var testCase = FloMax.Tester.buildTestCaseFromHTML(); >+ $(".cssload-loader").css('visibility', 'visible'); >+ >+ $.ajax('floating-matrix-api.pl', >+ {method : 'POST', >+ data : testCase, >+ dataType : 'json', >+ }).done(function(data, textStatus, jqXHR){ >+ >+ FloMax.Tester.displayTestResult(data.testResult); >+ >+ }).fail(function (data, textStatus, jqXHR) { >+ var error = $.parseJSON(data.responseText); //Pass the error as JSON so we don't trigger the default Koha error pages. >+ alert("Testing floating rule "+testCase.fromBranch+"-"+testCase.toBranch+" failed, because of the following error:\n"+data.status+" "+data.statusText+"\n"+"More specific error: "+error.error); >+ FloMax.Tester.displayTestResult("error"); >+ }); >+} >+FloMax.Tester.buildTestCaseFromHTML = function () { >+ var fromBranch = $("#floatingRuleTester #testerFromBranch").val(); >+ var toBranch = $("#floatingRuleTester #testerToBranch").val(); >+ var barcode = $("#floatingRuleTester #testerBarcode").val(); >+ >+ var testCase = { >+ 'fromBranch' : fromBranch, >+ 'toBranch' : toBranch, >+ 'barcode' : barcode, >+ 'test': true, >+ }; >+ return testCase; >+} >+FloMax.Tester.displayTestResult = function (testResult) { >+ $(".cssload-loader").css('visibility', 'hidden'); >+ var color; >+ if (testResult == null) { >+ color = FloMax.branchRuleDisabledColor; >+ } >+ else if (testResult == 'ALWAYS') { >+ color = FloMax.branchRuleAlwaysColor; >+ } >+ else if (testResult == 'POSSIBLE') { >+ color = FloMax.branchRulePossibleColor; >+ } >+ else if (testResult == "error") { >+ color = FloMax.Tester.defaultTestResultColor; >+ } >+ else { >+ color = FloMax.Tester.defaultTestResultColor; >+ alert("Couldn't display test result '"+testResult+"'. Value is unknown."); >+ } >+ >+ $("#testResulDisplay").css('background-color', color); > } >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/floating-matrix.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/floating-matrix.tt >index 1d113a3..27d6a16 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/floating-matrix.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/floating-matrix.tt >@@ -1,6 +1,7 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › Floating matrix</title> > <link rel="stylesheet" type="text/css" href="[% themelang %]/css/admin/floating-matrix.css" /> >+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/admin/floating-matrix-loader.css" /> > [% INCLUDE 'doc-head-close.inc' %] > > </head> >@@ -38,6 +39,32 @@ > </ul> > </div> > >+ <fieldset> >+ <legend>Floating rule tester</legend> >+ <div id="floatingRuleTester"> >+ <label for="testerFromBranch">Choose the origin library:</label> >+ <select id="testerFromBranch"> >+ [% FOR branchcode IN branches.keys.sort; branch = branches.$branchcode %] >+ <option value="[% branch.branchcode %]">[% branch.branchcode %]</option> >+ [% END %] >+ </select> >+ <label for="testerToBranch">Choose the destination library:</label> >+ <select id="testerToBranch"> >+ [% FOR branchcode IN branches.keys.sort; branch = branches.$branchcode %] >+ <option value="[% branch.branchcode %]">[% branch.branchcode %]</option> >+ [% END %] >+ </select> >+ <input id="testerBarcode" type="test" width="12"/> >+ <input id="tester" type="submit" value="Test"/> >+ <span id="testResulDisplay"/> >+ <div class="cssload-loader"> >+ <div class="cssload-inner cssload-one"></div> >+ <div class="cssload-inner cssload-two"></div> >+ <div class="cssload-inner cssload-three"></div> >+ </div> >+ </div> >+ </fieldset> >+ > <table id="floatingMatrix"> > <tr id="fmHeaderRow"> > <th>From \ To</th> >-- >1.9.1
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 9525
:
40077
|
40102
|
40103
|
44754
|
44756
|
44760
|
48310
|
100420
|
100421
|
100422
|
100741
|
100742
|
100743
|
103828
|
103829
|
103830
|
103831
|
112550
|
112551
|
112552
|
112553
|
124825
|
124826
|
124827
|
133071
|
133072
|
133073
|
139024
|
139025
|
139026
|
143740
|
143741
|
143742
|
143743
|
150241
|
150242
|
150243
|
150244
|
150245
|
150246
|
156330
|
156331
|
156332
|
156333
|
156334
|
156335
|
156336