Bugzilla – Attachment 100700 Details for
Bug 24789
Remove 'ITS' macro format
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24789: Remove ITS macro format
Bug-24789-Remove-ITS-macro-format.patch (text/plain), 12.47 KB, created by
Katrin Fischer
on 2020-03-15 14:14:55 UTC
(
hide
)
Description:
Bug 24789: Remove ITS macro format
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-03-15 14:14:55 UTC
Size:
12.47 KB
patch
obsolete
>From 304c1b5ecbc077710da6309062ba0e8c9a5cdb1c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 3 Mar 2020 13:26:02 +0000 >Subject: [PATCH] Bug 24789: Remove ITS macro format > >To test: >1 - Apply patches >2 - Confirm you can save, load, and run macros >3 - Confirm you have no choice of format > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../intranet-tmpl/lib/koha/cateditor/macros.js | 6 +- > .../intranet-tmpl/lib/koha/cateditor/macros/its.js | 208 --------------------- > .../prog/en/includes/cateditor-ui.inc | 15 +- > .../prog/en/modules/cataloguing/editor.tt | 1 - > 4 files changed, 3 insertions(+), 227 deletions(-) > delete mode 100644 koha-tmpl/intranet-tmpl/lib/koha/cateditor/macros/its.js > >diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/macros.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/macros.js >index 4d747f944f..160d5975a1 100644 >--- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/macros.js >+++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/macros.js >@@ -17,13 +17,9 @@ > * along with Koha; if not, see <http://www.gnu.org/licenses>. > */ > >-define( [ 'macros/its', 'macros/rancor' ], function( ITSMacro, RancorMacro ) { >+define( [ 'macros/rancor' ], function( RancorMacro ) { > var Macros = { > formats: { >- its: { >- description: 'TLC® ITS', >- Run: ITSMacro.Run, >- }, > rancor: { > description: 'Rancor', > Run: RancorMacro.Run, >diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/macros/its.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/macros/its.js >deleted file mode 100644 >index 07bfbeb6d0..0000000000 >--- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/macros/its.js >+++ /dev/null >@@ -1,208 +0,0 @@ >-/** >- * Copyright 2015 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>. >- */ >- >-define( function() { >- var NAV_FAILED = new Object(); >- var NAV_SUCCEEDED = new Object(); >- >- var _commandGenerators = [ >- [ /^copy field data$/i, function() { >- return function( editor, state ) { >- if ( state.field == null ) return; >- >- return state.field.getText(); >- }; >- } ], >- [ /^copy subfield data$/i, function() { >- return function( editor, state ) { >- if ( state.field == null ) return; >- >- var cur = editor.getCursor(); >- var subfields = state.field.getSubfields(); >- >- for (var i = 0; i < subfields.length; i++) { >- if ( cur.ch > subfields[i].end ) continue; >- >- state.clipboard = subfields[i].text; >- return; >- } >- >- return false; >- } >- } ], >- [ /^del(ete)? field$/i, function() { >- return function( editor, state ) { >- if ( state.field == null ) return; >- >- state.field.delete(); >- return NAV_FAILED; >- } >- } ], >- [ /^goto field end$/i, function() { >- return function( editor, state ) { >- if ( state.field == null ) return NAV_FAILED; >- var cur = editor.cm.getCursor(); >- >- editor.cm.setCursor( { line: cur.line } ); >- return NAV_SUCCEEDED; >- } >- } ], >- [ /^goto field (\w{3})$/i, function(tag) { >- return function( editor, state ) { >- var field = editor.getFirstField(tag); >- if ( field == null ) return NAV_FAILED; >- >- field.focus(); >- return NAV_SUCCEEDED; >- } >- } ], >- [ /^goto subfield end$/i, function() { >- return function( editor, state ) { >- if ( state.field == null ) return NAV_FAILED; >- >- var cur = editor.getCursor(); >- var subfields = state.field.getSubfields(); >- >- for (var i = 0; i < subfields.length; i++) { >- if ( cur.ch > subfields[i].end ) continue; >- >- subfield.focusEnd(); >- return NAV_SUCCEEDED; >- } >- >- return NAV_FAILED; >- } >- } ], >- [ /^goto subfield (\w)$/i, function( code ) { >- return function( editor, state ) { >- if ( state.field == null ) return NAV_FAILED; >- >- var subfield = state.field.getFirstSubfield( code ); >- if ( subfield == null ) return NAV_FAILED; >- >- subfield.focus(); >- return NAV_SUCCEEDED; >- } >- } ], >- [ /^insert (new )?field (\w{3}) data=(.*)/i, function(undef, tag, text) { >- text = text.replace(/\\([0-9a-z])/g, '$$$1 '); >- return function( editor, state ) { >- editor.createFieldGrouped(tag).setText(text).focus(); >- return NAV_SUCCEEDED; >- } >- } ], >- [ /^insert (new )?subfield (\w) data=(.*)/i, function(undef, code, text) { >- return function( editor, state ) { >- if ( state.field == null ) return; >- >- state.field.appendSubfield(code).setText(text); >- } >- } ], >- [ /^paste$/i, function() { >- return function( editor, state ) { >- var cur = editor.cm.getCursor(); >- >- editor.cm.replaceRange( state.clipboard, cur, null, 'marcAware' ); >- } >- } ], >- [ /^set indicator([12])=([ _0-9])$/i, function( ind, value ) { >- return function( editor, state ) { >- if ( state.field == null ) return; >- if ( state.field.isControlField ) return false; >- >- if ( ind == '1' ) { >- state.field.setIndicator1(value); >- return true; >- } else if ( ind == '2' ) { >- state.field.setIndicator2(value); >- return true; >- } else { >- return false; >- } >- } >- } ], >- [ /^set indicators=([ _0-9])([ _0-9])?$/i, function( ind1, ind2 ) { >- return function( editor, state ) { >- if ( state.field == null ) return; >- if ( state.field.isControlField ) return false; >- >- state.field.setIndicator1(ind1); >- state.field.setIndicator2(ind2 || '_'); >- } >- } ], >- ]; >- >- var ITSMacro = { >- Compile: function( macro ) { >- var result = { commands: [], errors: [] }; >- >- $.each( macro.split(/\r\n|\n/), function( line, contents ) { >- var command; >- >- if ( contents.match(/^\s*$/) ) return; >- >- $.each( _commandGenerators, function( undef, gen ) { >- var match; >- >- if ( !( match = gen[0].exec( contents ) ) ) return; >- >- command = gen[1].apply(null, match.slice(1)); >- return false; >- } ); >- >- if ( !command ) { >- result.errors.push( { line: line, error: 'unrecognized' } ); >- } >- >- result.commands.push( { func: command, orig: contents, line: line } ); >- } ); >- >- return result; >- }, >- Run: function( editor, macro ) { >- var compiled = ITSMacro.Compile(macro); >- if ( compiled.errors.length ) return { errors: compiled.errors }; >- var state = { >- clipboard: '', >- field: null, >- }; >- >- var run_result = { errors: [] }; >- >- editor.cm.operation( function() { >- $.each( compiled.commands, function( undef, command ) { >- var result = command.func( editor, state ); >- >- if ( result == NAV_FAILED ) { >- state.field = null; >- } else if ( result == NAV_SUCCEEDED ) { >- state.field = editor.getCurrentField(); >- } else if ( result === false ) { >- run_result.errors.push( { line: command.line, error: 'failed' } ); >- return false; >- } >- } ); >- } ); >- >- return run_result; >- }, >- }; >- >- return ITSMacro; >-} ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >index a37bd5f03f..6b680a31fa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >@@ -706,7 +706,6 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > var macro = Preferences.user.macros[name]; > macroEditor.setValue( macro.contents ); > macroEditor.setOption( 'readOnly', false ); >- $( '#macro-format' ).val( macro.format || 'its' ); > if ( macro.history ) macroEditor.setHistory( macro.history ); > } > >@@ -763,7 +762,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > if ( !name || macroEditor.savedGeneration == macroEditor.changeGeneration() ) return; > > macroEditor.savedGeneration = macroEditor.changeGeneration(); >- storeMacro( name, { contents: macroEditor.getValue(), modified: (new Date()).valueOf(), history: macroEditor.getHistory(), format: $('#macro-format').val() } ); >+// storeMacro( name, { contents: macroEditor.getValue(), modified: (new Date()).valueOf(), history: macroEditor.getHistory(), format: $('#macro-format').val() } ); > $('#macro-save-message').text(_("Saved")); > showSavedMacros(); > } >@@ -862,16 +861,6 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > $( '#save-dropdown' ).append( '<li><a href="#" data-backend="' + backend[1] + '">' + backend[0] + '</a></li>' ); > } ); > >- var macro_format_list = $.map( Macros.formats, function( format, name ) { >- return $.extend( { name: name }, format ); >- } ); >- macro_format_list.sort( function( a, b ) { >- return a.description.localeCompare(b.description); >- } ); >- $.each( macro_format_list, function() { >- $('#macro-format').append( '<option value="' + this.name + '">' + this.description + '</option>' ); >- } ); >- > // Click bindings > $( '#save-record, #save-dropdown a' ).click( function() { > $( '#save-record' ).find('i').attr( 'class', 'fa fa-spinner fa-spin' ).siblings( 'span' ).text( _("Saving...") ); >@@ -978,7 +967,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > } ); > > $('#run-macro').click( function() { >- var result = Macros.Run( editor, $('#macro-format').val(), macroEditor.getValue() ); >+ var result = Macros.Run( editor, 'rancor', macroEditor.getValue() ); > > if ( !result.errors.length ) { > $('#macro-ui').modal('hide'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt >index 253792bdda..a4a2b4d71e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt >@@ -264,7 +264,6 @@ > <div id="macro-toolbar" class="btn-toolbar"> > <button class="btn btn-default" id="run-macro" title="Run and edit macros"><i class="fa fa-play"></i> Run macro</button> > <button class="btn btn-default" id="delete-macro" title="Delete macro"><i class="fa fa-trash"></i> Delete macro</button> >- <label for="macro-format">Format: </label> <select id="macro-format"></select> > <div id="macro-save-message"></div> > </div> > </div> >-- >2.11.0
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 24789
:
100005
|
100578
| 100700 |
100757