Bugzilla – Attachment 50465 Details for
Bug 16308
Remove the use of "onclick" from Z39.50/SRU servers template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16308 - Remove the use of "onclick" from Z39.50/SRU servers template
Bug-16308---Remove-the-use-of-onclick-from-Z3950SR.patch (text/plain), 12.57 KB, created by
Marc Véron
on 2016-04-20 15:07:25 UTC
(
hide
)
Description:
Bug 16308 - Remove the use of "onclick" from Z39.50/SRU servers template
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2016-04-20 15:07:25 UTC
Size:
12.57 KB
patch
obsolete
>From 408709428bf0ca11e8ba35702e09b3e15aa59ce9 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 20 Apr 2016 09:36:20 -0400 >Subject: [PATCH] Bug 16308 - Remove the use of "onclick" from Z39.50/SRU > servers template >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch removes the use of event attributes in the markup in favor of >attaching events in JavaScript. > >This patch also revises the SRU search fields mapping template >considerably while correcting multiple HTML validation issues: > >- Corrected label/id pairs. >- Corrected incorrect capitalization. >- Removed redundant <legend> >- Restructured form so that it displays in two columns. > >Also changed in the z3950 servers template: Replaced empty [% >script_name %] variable with actual path. > >To test, apply the patch and go to Administration -> Z39.50/SRU servers/ > >- In the list of servers, select Actions -> Delete. You should be > prompted to confirm your choice. Test both confirming and cancelling. >- Create or edit an SRU server. > - After entering text in the server name field, moving to the next > field should trigger transformation of that text to upper case. > - On the SRU Search fields mapping line, clicking the "Modify" button > should trigger a popup. > - In the "Modify SRU search fields mapping" popup: > - The fields should display in two columns. > - All labels should be correctly associated with corresponding > inputs. > >Followed test plan, works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> >--- > .../prog/en/modules/admin/sru_modmapping.tt | 98 +++++++++++--------- > .../prog/en/modules/admin/z3950servers.tt | 39 +++++--- > 2 files changed, 76 insertions(+), 61 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sru_modmapping.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sru_modmapping.tt >index 94da006..363ec5e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sru_modmapping.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sru_modmapping.tt >@@ -1,5 +1,5 @@ > [% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › SRU Search fields mapping</title> >+<title>Koha › SRU search fields mapping</title> > [% INCLUDE 'doc-head-close.inc' %] > > <script type="text/javascript"> >@@ -34,53 +34,59 @@ > <div id="custom-doc" class="yui-t7"> > > <div id="bd"> >- <h1>Modify SRU Search fields mapping</h1> >+ <h1>Modify SRU search fields mapping</h1> > <form id="form01" method="post"> > <fieldset class="rows"> >- <legend>Legend </legend> >- <ul> >- <li> >- <label for="Title">Title: </label> >- <input id="title" type="text" value="[% mapping.title %]" /> >- </li> >- <li> >- <label for="ISBN">ISBN: </label> >- <input id="isbn" type="text" value="[% mapping.isbn %]" /> >- </li> >- <li> >- <label for="LCCall">LC Call No: </label> >- <input id="lccall" type="text" value="[% mapping.lccall %]" /> >- </li> >- <li> >- <label for="Control number">Control no: </label> >- <input id="controlnumber" type="text" value="[% mapping.controlnumber %]" /> >- </li> >- <li> >- <label for="Any">Any: </label> >- <input id="srchany" type="text" value="[% mapping.srchany %]" /> >- </li> >- <li> >- <label for="Author">Author: </label> >- <input id="author" type="text" value="[% mapping.author %]" /> >- </li> >- <li> >- <label for="ISSN">ISSN: </label> >- <input id="issn" type="text" value="[% mapping.issn %]" /> >- </li> >- <li> >- <label for="Subject">Subject: </label> >- <input id="subject" type="text" value="[% mapping.subject %]" /> >- </li> >- <li> >- <label for="Dewey">Dewey: </label> >- <input id="dewey" type="text" value="[% mapping.dewey %]" /> >- </li> >- <li> >- <label for="Standard ID">Standard ID: </label> >- <input id="stdid" type="text" value="[% mapping.stdid %]" /> >- </li> >- >- </ul> >+ <div class="yui-g"> >+ <div class="yui-u first"> >+ <ol> >+ <li> >+ <label for="title">Title: </label> >+ <input id="title" type="text" value="[% mapping.title %]" /> >+ </li> >+ <li> >+ <label for="isbn">ISBN: </label> >+ <input id="isbn" type="text" value="[% mapping.isbn %]" /> >+ </li> >+ <li> >+ <label for="lccall">LC call number: </label> >+ <input id="lccall" type="text" value="[% mapping.lccall %]" /> >+ </li> >+ <li> >+ <label for="controlnumber">Control number: </label> >+ <input id="controlnumber" type="text" value="[% mapping.controlnumber %]" /> >+ </li> >+ <li> >+ <label for="srchany">Any: </label> >+ <input id="srchany" type="text" value="[% mapping.srchany %]" /> >+ </li> >+ </ol> >+ </div> >+ <div class="yui-u"> >+ <ol> >+ <li> >+ <label for="author">Author: </label> >+ <input id="author" type="text" value="[% mapping.author %]" /> >+ </li> >+ <li> >+ <label for="issn">ISSN: </label> >+ <input id="issn" type="text" value="[% mapping.issn %]" /> >+ </li> >+ <li> >+ <label for="subject">Subject: </label> >+ <input id="subject" type="text" value="[% mapping.subject %]" /> >+ </li> >+ <li> >+ <label for="dewey">Dewey: </label> >+ <input id="dewey" type="text" value="[% mapping.dewey %]" /> >+ </li> >+ <li> >+ <label for="stdid">Standard ID: </label> >+ <input id="stdid" type="text" value="[% mapping.stdid %]" /> >+ </li> >+ </ol> >+ </div> >+ </div> > </fieldset> > <fieldset class="action"> > <input type="submit" value="Save" class="submit" /> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >index 8131083..7375d8b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >@@ -56,10 +56,16 @@ > // enable recordtype to include field in post > $('#recordtype').prop('disabled',false); > }); >+ $("#servername").on("blur",function(){ >+ toUC(this); >+ }); >+ $("#modify_sru_fields").on("click",function(){ >+ ModMapping(); >+ }); > }); > function ModMapping () { > var map= $('#show_sru_fields').val(); >- window.open('/cgi-bin/koha/admin/sru_modmapping.pl?mapping='+map,'popup','width=800,height=400,resizable=no,toolbar=false,scrollbars=no,top'); >+ window.open('/cgi-bin/koha/admin/sru_modmapping.pl?mapping='+map,'popup','width=800,height=400,resizable=yes,toolbar=false,scrollbars=yes,top'); > } > [% ELSE %] > $(document).ready(function() { >@@ -69,14 +75,15 @@ > ], > "sPaginationType": "four_button" > })); >+ $(".delete").on("click",function(e){ >+ var servername = $(this).data("servername"); >+ if( confirm( _("Are you sure you want to delete server %s?").format(servername) ) ) { >+ return true; >+ } else { >+ e.preventDefault(); >+ } >+ }); > }); >- function ConfirmDelete(name,id) { >- if( confirm( _("Choose OK if you really want to delete server ")+ >- name+'.')) { >- window.location="[% script_name %]?op=delete_confirmed&id="+id; >- } >- return false; >- } > [% END %] > //]]> > </script> >@@ -116,10 +123,12 @@ > <input type="hidden" name="id" value="[% server.id %]" /> > [% ELSE %] > <h1>New [% PROCESS ServerType %] server</h1> >- [% END %] >+ [% END %] > <fieldset class="rows"> > <ol> >- <li><label for="name">Server name: </label><input type="text" name="servername" id="servername" size="65" maxlength="100" onblur="toUC(this)" value="[% server.servername | html %]"/></li> >+ <li><label for="name">Server name: </label> >+ <input type="text" name="servername" id="servername" size="65" maxlength="100" value="[% server.servername | html %]"/> >+ </li> > > <li><label for="host" class="required">Hostname: </label> <input type="text" name="host" id="host" size="30" value="[% server.host %]" required="required" /> <span class="required">Required</span> > [% IF (server.servertype||type) == 'sru' %] >@@ -191,7 +200,7 @@ > <li> > <label for="sru_fields">SRU Search fields mapping: </label> > <input type="hidden" name="sru_fields" id="sru_fields" value="[% server.sru_fields %]" /> >- <input type="text" name="show_sru_fields" id="show_sru_fields" size="100" value="[% server.sru_fields %]" disabled/> <input type="button" value="Modify" onclick="ModMapping()" /> >+ <input type="text" name="show_sru_fields" id="show_sru_fields" size="100" value="[% server.sru_fields %]" disabled="disabled" /> <input type="button" id="modify_sru_fields" value="Modify" /> > </li> > [% END %] > <li> >@@ -224,7 +233,7 @@ > <tbody> > [% FOREACH loo IN loop %] > <tr> >- <td><a href="[% loo.script_name %]?op=edit&id=[% loo.id %]">[% loo.servername %]</a></td><td>[% loo.host %]:[% loo.port %]</td><td>[% loo.db %]</td><td>[% loo.userid %]</td><td>[% IF loo.password %]########[% END %]</td><td>[% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %]</td><td>[% loo.rank %]</td> >+ <td><a href="/cgi-bin/koha/admin/z3950servers.pl?op=edit&id=[% loo.id %]">[% loo.servername %]</a></td><td>[% loo.host %]:[% loo.port %]</td><td>[% loo.db %]</td><td>[% loo.userid %]</td><td>[% IF loo.password %]########[% END %]</td><td>[% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %]</td><td>[% loo.rank %]</td> > <td>[% loo.syntax %]</td><td>[% loo.encoding %]</td><td>[% loo.timeout %]</td> > <td>[% IF ( loo.recordtype == 'biblio' ) %] > <span>Bibliographic</span> >@@ -238,9 +247,9 @@ > Actions <b class="caret"></b> > </a> > <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id %]"> >- <li><a href="[% loo.script_name %]?op=edit&id=[% loo.id %]"><i class="fa fa-pencil"></i> Edit</a></li> >- <li><a href="[% loo.script_name %]?op=add&id=[% loo.id %]"><i class="fa fa-copy"></i> Copy</a></li> >- <li><a href="javascript:void(0);" onclick="ConfirmDelete('[% loo.servername | replace("['\"]","") %]','[% loo.id %]');"><i class="fa fa-remove"></i> Delete</a></li> >+ <li><a href="/cgi-bin/koha/admin/z3950servers.pl?op=edit&id=[% loo.id %]"><i class="fa fa-pencil"></i> Edit</a></li> >+ <li><a href="/cgi-bin/koha/admin/z3950servers.pl?op=add&id=[% loo.id %]"><i class="fa fa-copy"></i> Copy</a></li> >+ <li><a href="/cgi-bin/koha/admin/z3950servers.pl?op=delete_confirmed&id=[% loo.id %]" class="delete" data-servername="[% loo.servername %]"><i class="fa fa-remove"></i> Delete</a></li> > </ul> > </div> > </td> >-- >1.7.10.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 16308
:
50460
|
50465
|
50625