Lines 822-828
Link Here
|
822 |
// Columns that require special treatment |
822 |
// Columns that require special treatment |
823 |
var specialCols = { |
823 |
var specialCols = { |
824 |
action: { |
824 |
action: { |
825 |
func: createActionLink |
825 |
func: createActionLink, |
|
|
826 |
skipSanitize: true |
826 |
}, |
827 |
}, |
827 |
borrowernumber: { |
828 |
borrowernumber: { |
828 |
func: createPatronLink |
829 |
func: createPatronLink |
Lines 835-841
Link Here
|
835 |
}, |
836 |
}, |
836 |
biblio_id: { |
837 |
biblio_id: { |
837 |
name: _("Bibliograpic record ID"), |
838 |
name: _("Bibliograpic record ID"), |
838 |
func: createBiblioLink |
839 |
func: createBiblioLink, |
|
|
840 |
skipSanitize: true |
839 |
}, |
841 |
}, |
840 |
metadata_Type: { |
842 |
metadata_Type: { |
841 |
func: createType |
843 |
func: createType |
Lines 845-850
Link Here
|
845 |
}, |
847 |
}, |
846 |
patron_cardnumber: { |
848 |
patron_cardnumber: { |
847 |
name: _("Cardnumber") |
849 |
name: _("Cardnumber") |
|
|
850 |
}, |
851 |
patron: { |
852 |
skipSanitize: true |
848 |
} |
853 |
} |
849 |
}; |
854 |
}; |
850 |
|
855 |
|
Lines 889-894
Link Here
|
889 |
$('#dataPreview').modal({show:true}); |
894 |
$('#dataPreview').modal({show:true}); |
890 |
}); |
895 |
}); |
891 |
|
896 |
|
|
|
897 |
// Allow us to chain Datatable render helpers together, so we |
898 |
// can use our custom functions and render.text(), which |
899 |
// provides us with data sanitization |
900 |
$.fn.dataTable.render.multi = function(renderArray) { |
901 |
return function(d, type, row, meta) { |
902 |
for(var r = 0; r < renderArray.length; r++) { |
903 |
var toCall = renderArray[r].hasOwnProperty('display') ? |
904 |
renderArray[r].display : |
905 |
renderArray[r]; |
906 |
d = toCall(d, type, row, meta); |
907 |
} |
908 |
return d; |
909 |
} |
910 |
} |
911 |
|
892 |
// Get our data from the API and process it prior to passing |
912 |
// Get our data from the API and process it prior to passing |
893 |
// it to datatables |
913 |
// it to datatables |
894 |
var ajax = $.ajax( |
914 |
var ajax = $.ajax( |
Lines 921-929
Link Here
|
921 |
specialCols.hasOwnProperty(colName) && |
941 |
specialCols.hasOwnProperty(colName) && |
922 |
specialCols[colName].hasOwnProperty('func') |
942 |
specialCols[colName].hasOwnProperty('func') |
923 |
) { |
943 |
) { |
924 |
colObj.render = specialCols[colName].func; |
944 |
var renderArray = [ |
|
|
945 |
specialCols[colName].func |
946 |
]; |
947 |
if (!specialCols[colName].skipSanitize) { |
948 |
renderArray.push( |
949 |
$.fn.dataTable.render.text() |
950 |
); |
951 |
} |
952 |
|
953 |
colObj.render = $.fn.dataTable.render.multi( |
954 |
renderArray |
955 |
); |
925 |
} else { |
956 |
} else { |
926 |
colObj.data = colName; |
957 |
colObj.data = colName; |
|
|
958 |
colObj.render = $.fn.dataTable.render.text() |
927 |
} |
959 |
} |
928 |
// Make sure properties that aren't present in the API |
960 |
// Make sure properties that aren't present in the API |
929 |
// response are populated with null to avoid Datatables |
961 |
// response are populated with null to avoid Datatables |
930 |
- |
|
|