Lines 795-801
Link Here
|
795 |
// Columns that require special treatment |
795 |
// Columns that require special treatment |
796 |
var specialCols = { |
796 |
var specialCols = { |
797 |
action: { |
797 |
action: { |
798 |
func: createActionLink |
798 |
func: createActionLink, |
|
|
799 |
skipSanitize: true |
799 |
}, |
800 |
}, |
800 |
borrowernumber: { |
801 |
borrowernumber: { |
801 |
func: createPatronLink |
802 |
func: createPatronLink |
Lines 808-814
Link Here
|
808 |
}, |
809 |
}, |
809 |
biblio_id: { |
810 |
biblio_id: { |
810 |
name: _("Bibliograpic record ID"), |
811 |
name: _("Bibliograpic record ID"), |
811 |
func: createBiblioLink |
812 |
func: createBiblioLink, |
|
|
813 |
skipSanitize: true |
812 |
}, |
814 |
}, |
813 |
metadata_Type: { |
815 |
metadata_Type: { |
814 |
func: createType |
816 |
func: createType |
Lines 818-823
Link Here
|
818 |
}, |
820 |
}, |
819 |
patron_cardnumber: { |
821 |
patron_cardnumber: { |
820 |
name: _("Cardnumber") |
822 |
name: _("Cardnumber") |
|
|
823 |
}, |
824 |
patron: { |
825 |
skipSanitize: true |
821 |
} |
826 |
} |
822 |
}; |
827 |
}; |
823 |
|
828 |
|
Lines 855-860
Link Here
|
855 |
e.preventDefault(); |
860 |
e.preventDefault(); |
856 |
$('#dataPreview').modal({show:true}); |
861 |
$('#dataPreview').modal({show:true}); |
857 |
}); |
862 |
}); |
|
|
863 |
|
864 |
// Allow us to chain Datatable render helpers together, so we |
865 |
// can use our custom functions and render.text(), which |
866 |
// provides us with data sanitization |
867 |
$.fn.dataTable.render.multi = function(renderArray) { |
868 |
return function(d, type, row, meta) { |
869 |
for(var r = 0; r < renderArray.length; r++) { |
870 |
var toCall = renderArray[r].hasOwnProperty('display') ? |
871 |
renderArray[r].display : |
872 |
renderArray[r]; |
873 |
d = toCall(d, type, row, meta); |
874 |
} |
875 |
return d; |
876 |
} |
877 |
} |
858 |
|
878 |
|
859 |
// Get our data from the API and process it prior to passing |
879 |
// Get our data from the API and process it prior to passing |
860 |
// it to datatables |
880 |
// it to datatables |
Lines 888-896
Link Here
|
888 |
specialCols.hasOwnProperty(colName) && |
908 |
specialCols.hasOwnProperty(colName) && |
889 |
specialCols[colName].hasOwnProperty('func') |
909 |
specialCols[colName].hasOwnProperty('func') |
890 |
) { |
910 |
) { |
891 |
colObj.render = specialCols[colName].func; |
911 |
var renderArray = [ |
|
|
912 |
specialCols[colName].func |
913 |
]; |
914 |
if (!specialCols[colName].skipSanitize) { |
915 |
renderArray.push( |
916 |
$.fn.dataTable.render.text() |
917 |
); |
918 |
} |
919 |
|
920 |
colObj.render = $.fn.dataTable.render.multi( |
921 |
renderArray |
922 |
); |
892 |
} else { |
923 |
} else { |
893 |
colObj.data = colName; |
924 |
colObj.data = colName; |
|
|
925 |
colObj.render = $.fn.dataTable.render.text() |
894 |
} |
926 |
} |
895 |
// Make sure properties that aren't present in the API |
927 |
// Make sure properties that aren't present in the API |
896 |
// response are populated with null to avoid Datatables |
928 |
// response are populated with null to avoid Datatables |
897 |
- |
|
|