View | Details | Raw Unified | Return to bug 17179
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_17179_add_keyboard_shortcuts.perl (+13 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q|
4
        INSERT IGNORE INTO keyboard_shortcuts (shortcut_name, shortcut_keys) VALUES
5
        ("copy_line","Ctrl-C"),
6
        ("copy_subfield","Shift-Ctrl-C"),
7
        ("paste_line","Ctrl-P"),
8
        ("insert_line","Ctrl-I")
9
        ;
10
    |);
11
    SetVersion( $DBversion );
12
    print "Upgrade to $DBversion done (Bug 17179 - Add additional keyboard_shortcuts)\n";
13
}
(-)a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js (-2 / +46 lines)
Lines 160-165 define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], Link Here
160
    _editorKeys[delete_field] =  function( cm ) {
160
    _editorKeys[delete_field] =  function( cm ) {
161
            // Delete line (or cut)
161
            // Delete line (or cut)
162
            if ( cm.somethingSelected() ) return true;
162
            if ( cm.somethingSelected() ) return true;
163
            var curLine = cm.getLine( cm.getCursor().line );
164
165
            $("#clipboard").prepend('<option>'+curLine+'</option>');
163
166
164
            cm.execCommand('deleteLine');
167
            cm.execCommand('deleteLine');
165
        }
168
        }
Lines 193-200 define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], Link Here
193
            var field = cm.marceditor.getCurrentField();
196
            var field = cm.marceditor.getCurrentField();
194
            if ( !field ) return;
197
            if ( !field ) return;
195
198
196
            var subfield = field.getSubfieldAt( cm.getCursor().ch );
199
            var curCursor = cm.getCursor();
197
            if ( subfield ) subfield.delete();
200
            var subfield = field.getSubfieldAt( curCursor().ch );
201
            var subfieldText= cm.getRange({line:curCursor.line,ch:subfield.start},{line:curCursor.line,ch:subfield.end});
202
            if ( subfield ) {
203
                $("#clipboard").prepend('<option>'+subfieldText+'</option>');
204
                subfield.delete();
205
            }
206
        }
207
208
    _editorKeys[copy_line] = function( cm ) {
209
            // Copy line
210
            if ( cm.somethingSelected() ) return true;
211
            var curLine = cm.getLine( cm.getCursor().line );
212
            $("#clipboard").prepend('<option>'+curLine+'</option>');
213
        }
214
215
    _editorKeys[copy_subfield] = function( cm ) {
216
            // Copy subfield
217
            var field = cm.marceditor.getCurrentField();
218
            if ( !field ) return;
219
220
            var curCursor = cm.getCursor();
221
            var subfield = field.getSubfieldAt( curCursor().ch );
222
            var subfieldText= cm.getRange({line:curCursor.line,ch:subfield.start},{line:curCursor.line,ch:subfield.end});
223
            if ( subfield ) {
224
                $("#clipboard").prepend('<option>'+subfieldText+'</option>');
225
            }
226
        }
227
228
    _editorKeys[paste_line] = function( cm ) {
229
            // Paste line from "clipboard"
230
            if ( cm.somethingSelected() ) return true;
231
            var cBoard = document.getElementById("clipboard");
232
            var strUser = cBoard.options[cBoard.selectedIndex].text;
233
            cm.replaceRange( strUser, cm.getCursor(), null );
234
        }
235
236
    _editorKeys[insert_line] = function( cm ) {
237
            // Copy line and insert below
238
            if ( cm.somethingSelected() ) return true;
239
            var curLine = cm.getLine( cm.getCursor().line );
240
            cm.execCommand('newlineAndIndent');
241
            cm.replaceRange( curLine, cm.getCursor(), null );
198
        }
242
        }
199
243
200
     _editorKeys[next_position] =  function( cm ) {
244
     _editorKeys[next_position] =  function( cm ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/keyboard_shortcuts.inc (-2 / +6 lines)
Lines 5-16 Link Here
5
    [%- CASE 'insert_delimiter' -%]<span>Insert delimiter (‡)</span>
5
    [%- CASE 'insert_delimiter' -%]<span>Insert delimiter (‡)</span>
6
    [%- CASE 'subfield_help' -%]<span>Get help on current subfield</span>
6
    [%- CASE 'subfield_help' -%]<span>Get help on current subfield</span>
7
    [%- CASE 'link_authorities' -%]<span>Link field to authorities</span>
7
    [%- CASE 'link_authorities' -%]<span>Link field to authorities</span>
8
    [%- CASE 'delete_field' -%]<span>Delete current field</span>
8
    [%- CASE 'delete_field' -%]<span>Delete current field and copy to 'clipboard'</span>
9
    [%- CASE 'delete_subfield' -%]<span>Delete current subfield</span>
9
    [%- CASE 'delete_subfield' -%]<span>Delete current subfield and copy to 'clipboard'</span>
10
    [%- CASE 'new_line' -%]<span>New field on next line</span>
10
    [%- CASE 'new_line' -%]<span>New field on next line</span>
11
    [%- CASE 'line_break' -%]<span>Insert line break</span>
11
    [%- CASE 'line_break' -%]<span>Insert line break</span>
12
    [%- CASE 'next_position' -%]<span>Move to next position</span>
12
    [%- CASE 'next_position' -%]<span>Move to next position</span>
13
    [%- CASE 'prev_position' -%]<span>Move to previous position</span>
13
    [%- CASE 'prev_position' -%]<span>Move to previous position</span>
14
    [%- CASE 'toggle_keyboard' -%]<span>Toggle Keyboard</span>
14
    [%- CASE 'toggle_keyboard' -%]<span>Toggle Keyboard</span>
15
    [%- CASE 'copy_line' -%]<span>Copy current field</span>
16
    [%- CASE 'copy_subfield' -%]<span>Copy current subfield</span>
17
    [%- CASE 'paste_line' -%]<span>Paste selection from 'clipboard'</span>
18
    [%- CASE 'insert_line' -%]<span>Copy current field on next line</span>
15
    [%- END -%]
19
    [%- END -%]
16
[%- END -%]
20
[%- END -%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt (-1 / +5 lines)
Lines 109-114 Link Here
109
                        <li><a href="#" id="show-advanced-search" title="Show advanced search (Ctrl-Alt-S)">Advanced &raquo;</a></li>
109
                        <li><a href="#" id="show-advanced-search" title="Show advanced search (Ctrl-Alt-S)">Advanced &raquo;</a></li>
110
                    </fieldset>
110
                    </fieldset>
111
                </form>
111
                </form>
112
                <h3>Clipboard</h3>
113
                <fieldset class="brief">
114
                    <select id="clipboard" name="clipboard" size=10>
115
                    </select>
116
                </fieldset>
112
            </aside>
117
            </aside>
113
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
118
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
114
     </div> <!-- /.row -->
119
     </div> <!-- /.row -->
115
- 

Return to bug 17179