|
Lines 714-720
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
| 714 |
showSavedMacros(); |
714 |
showSavedMacros(); |
| 715 |
}) |
715 |
}) |
| 716 |
.fail(function(err) { |
716 |
.fail(function(err) { |
| 717 |
humanMsg.displayAlert( _("Failed to delete macro:") + err.responseText, { className: 'humanError' } ); |
717 |
var err_message; |
|
|
718 |
if( err.status == "404" ){ |
| 719 |
err_message = "Macro not found"; |
| 720 |
} else if ( err.status == "403" ){ |
| 721 |
err_message = _("You do not have permission to delete this macro"); |
| 722 |
} else { |
| 723 |
err_message = _("There was a problem, please check the logs"); |
| 724 |
} |
| 725 |
humanMsg.displayAlert( _("Failed to delete macro: " + err_message), { className: 'humanError' } ); |
| 718 |
}); |
726 |
}); |
| 719 |
} |
727 |
} |
| 720 |
|
728 |
|
|
Lines 760-766
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
| 760 |
macroEditor.activeMacroShared = result.shared; |
768 |
macroEditor.activeMacroShared = result.shared; |
| 761 |
}) |
769 |
}) |
| 762 |
.fail(function(err) { |
770 |
.fail(function(err) { |
| 763 |
humanMsg.displayAlert( _("Failed to load macros:") + err.responseText, { className: 'humanError' } ); |
771 |
var err_message; |
|
|
772 |
if( err.status == "404" ){ |
| 773 |
err_message = "Macro not found"; |
| 774 |
} else if ( err.status == "403" ){ |
| 775 |
err_message = _("You do not have permission to access this macro"); |
| 776 |
} else { |
| 777 |
err_message = _("There was a problem, please check the logs"); |
| 778 |
} |
| 779 |
humanMsg.displayAlert( _("Failed to load macros: ") + err_message, { className: 'humanError' } ); |
| 764 |
}); |
780 |
}); |
| 765 |
|
781 |
|
| 766 |
} |
782 |
} |
|
Lines 795-801
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
| 795 |
|
811 |
|
| 796 |
}) |
812 |
}) |
| 797 |
.fail(function(err) { |
813 |
.fail(function(err) { |
| 798 |
humanMsg.displayAlert( _("Failed to create macro:") + err.responseText, { className: 'humanError' } ); |
814 |
var err_message; |
|
|
815 |
if( err.status == "403" ){ |
| 816 |
err_message = _("You do not have permission to create this macro"); |
| 817 |
} else { |
| 818 |
err_message = _("There was a problem, please check the logs"); |
| 819 |
} |
| 820 |
humanMsg.displayAlert( _("Failed to create macro: ") + err_message, { className: 'humanError' } ); |
| 799 |
}); |
821 |
}); |
| 800 |
} ); |
822 |
} ); |
| 801 |
} |
823 |
} |
|
Lines 832-838
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
| 832 |
}); |
854 |
}); |
| 833 |
}) |
855 |
}) |
| 834 |
.fail(function(err) { |
856 |
.fail(function(err) { |
| 835 |
humanMsg.displayAlert( _("Failed to load macros:") + err.responseText, { className: 'humanError' } ); |
857 |
var err_message = _("There was a problem, please check the logs"); |
|
|
858 |
humanMsg.displayAlert( _("Failed to load macros: ") + err_message, { className: 'humanError' } ); |
| 836 |
}); |
859 |
}); |
| 837 |
var $new_li = $( '<li class="new-macro"><a href="#">' + _("New macro...") + '</a></li>' ); |
860 |
var $new_li = $( '<li class="new-macro"><a href="#">' + _("New macro...") + '</a></li>' ); |
| 838 |
$new_li.click( function() { |
861 |
$new_li.click( function() { |
|
Lines 858-864
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
| 858 |
loadMacro( result.name, result.macro_id ); |
881 |
loadMacro( result.name, result.macro_id ); |
| 859 |
}) |
882 |
}) |
| 860 |
.fail(function(err) { |
883 |
.fail(function(err) { |
| 861 |
humanMsg.displayAlert( _("Failed to create macro:") + err.responseText, { className: 'humanError' } ); |
884 |
var err_message; |
|
|
885 |
if( err.status == "403" ){ |
| 886 |
err_message = _("You do not have permission to access this macro"); |
| 887 |
} else { |
| 888 |
err_message = _("There was a problem, please check the logs"); |
| 889 |
} |
| 890 |
humanMsg.displayAlert( _("Failed to create macro: ") + err_message, { className: 'humanError' } ); |
| 862 |
}); |
891 |
}); |
| 863 |
} ); |
892 |
} ); |
| 864 |
$('#macro-list').append($new_li); |
893 |
$('#macro-list').append($new_li); |
|
Lines 894-900
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
| 894 |
showSavedMacros(); |
923 |
showSavedMacros(); |
| 895 |
}) |
924 |
}) |
| 896 |
.fail(function(err) { |
925 |
.fail(function(err) { |
| 897 |
humanMsg.displayAlert( _("Failed to save macro:") + err.responseText, { className: 'humanError' } ); |
926 |
var err_message; |
|
|
927 |
if( err.status == "404" ){ |
| 928 |
err_message = _("Macro not found"); |
| 929 |
} else if ( err.status ="403" ){ |
| 930 |
err_message = _("You do not have permission to access this macro"); |
| 931 |
} else { |
| 932 |
err_message = _("There was a problem, please check the logs"); |
| 933 |
} |
| 934 |
humanMsg.displayAlert( _("Failed to save macro: ") + err_message, { className: 'humanError' } ); |
| 898 |
}); |
935 |
}); |
| 899 |
} |
936 |
} |
| 900 |
|
937 |
|
| 901 |
- |
|
|