mirror of
https://github.com/owncloud/bookmarks.git
synced 2024-11-29 04:24:11 +01:00
ae81b9dcd2
Dependency Injection for user and db is used througout the controllers The Routing features a consistent rest api The Routing provides some legacy routes, so that for exampe the Android Bookmarks App still works. There is a publicly available api that provides access to bookmarks per user. (This is usefull in connection with the WP Plugin https://github.com/mario-nolte/oc2wp-bookmarks)
63 lines
1.3 KiB
JavaScript
63 lines
1.3 KiB
JavaScript
function attachSettingEvent(event) {
|
|
event.preventDefault();
|
|
fileUpload($(this).closest('form'), $('#upload'));
|
|
}
|
|
|
|
function exportBm() {
|
|
window.location = $(this).attr('href');
|
|
}
|
|
|
|
function fileUpload(form, resultDiv) {
|
|
|
|
var uploadEventHandler = function () {
|
|
var data = {};
|
|
try {
|
|
data = $.parseJSON(iframe.contents().text());
|
|
} catch (e) {
|
|
}
|
|
if (!data) {
|
|
resultDiv.text(t('bookmark', 'Import error'));
|
|
return;
|
|
}
|
|
if (data.status == 'error') {
|
|
var list = $("<ul></ul>").addClass('setting_error_list');
|
|
console.log(data);
|
|
$.each(data.data, function (index, item) {
|
|
list.append($("<li></li>").text(item));
|
|
});
|
|
resultDiv.html(list);
|
|
} else {
|
|
resultDiv.text(t('bookmark', 'Import completed successfully.'));
|
|
getBookmarks();
|
|
}
|
|
};
|
|
|
|
// Create the iframe...
|
|
var iframe;
|
|
if ($('#upload_iframe').length === 1)
|
|
iframe = $('#upload_iframe');
|
|
else {
|
|
iframe = $('<iframe></iframe>').attr({
|
|
id: 'upload_iframe',
|
|
name: 'upload_iframe',
|
|
width: '0',
|
|
height: '0',
|
|
border: '0',
|
|
style: 'display:none'
|
|
}).bind('load', uploadEventHandler);
|
|
form.append(iframe);
|
|
}
|
|
|
|
// Set properties of form...
|
|
form.attr({
|
|
target: 'upload_iframe',
|
|
method: 'post',
|
|
enctype: 'multipart/form-data',
|
|
encoding: 'multipart/form-data'
|
|
});
|
|
|
|
// Submit the form...
|
|
form.submit();
|
|
|
|
resultDiv.text(t('bookmark', 'Uploading...'));
|
|
} |