$(document).ready(function() {
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Repozytorium",
/*CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",*/
completefunc: function (xData, Status) {
var output = "";
$(xData.responseXML).SPFilterNode("z:row").each(function() {
var id = $(this).attr("ows_ID");
var title = $(this).attr("ows_Title");
var liHtml = "<h5>"+title+"</h5>";
$().SPServices({
async: false,
operation: "GetAttachmentCollection",
listName: "Repozytorium",
ID: id,
completefunc: function(xData, Status) {
liHtml += "<ul style='list-style: none;'>";
$(xData.responseXML).find("Attachments > Attachment").each(function(i, el) {
var $node = $(this),
filePath = $node.text(),
arrString = filePath.split("/"),
fileName = arrString[arrString.length - 1];
liHtml += "<li><a href='"+ filePath +"' target='_blank'>" + fileName + "</a></li>";
//output += "<a href='" + filePath + "' target='_blank'>" + fileName + "</a><br />";
});
liHtml += "</ul>";
}
});
$("#drop-zone").append(liHtml);
});
//$("#drop-zone").html(output);
}
});
});
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Repozytorium",
/*CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",*/
completefunc: function (xData, Status) {
var output = "";
$(xData.responseXML).SPFilterNode("z:row").each(function() {
var id = $(this).attr("ows_ID");
var title = $(this).attr("ows_Title");
var liHtml = "<h5>"+title+"</h5>";
$().SPServices({
async: false,
operation: "GetAttachmentCollection",
listName: "Repozytorium",
ID: id,
completefunc: function(xData, Status) {
liHtml += "<ul style='list-style: none;'>";
$(xData.responseXML).find("Attachments > Attachment").each(function(i, el) {
var $node = $(this),
filePath = $node.text(),
arrString = filePath.split("/"),
fileName = arrString[arrString.length - 1];
liHtml += "<li><a href='"+ filePath +"' target='_blank'>" + fileName + "</a></li>";
//output += "<a href='" + filePath + "' target='_blank'>" + fileName + "</a><br />";
});
liHtml += "</ul>";
}
});
$("#drop-zone").append(liHtml);
});
//$("#drop-zone").html(output);
}
});
});
No comments:
Post a Comment