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