2018-02-04 19:29:04 +01:00
|
|
|
//open the url in a liferay popup
|
|
|
|
function showWPPopup(url) {
|
|
|
|
var url = url;
|
|
|
|
// this is one way of calling a pop-up in liferay
|
|
|
|
// this way is specific to liferay
|
|
|
|
Liferay.Util.openWindow(
|
|
|
|
{
|
|
|
|
dialog: {
|
|
|
|
cache: false,
|
2018-02-07 15:36:37 +01:00
|
|
|
width:700,
|
|
|
|
height: 550,
|
2018-02-04 19:29:04 +01:00
|
|
|
modal: true
|
|
|
|
},
|
2018-02-07 15:36:37 +01:00
|
|
|
id: 'testPopupIdUnique',
|
|
|
|
title: 'Select the dataset',
|
2018-02-04 19:29:04 +01:00
|
|
|
uri: url
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-07 15:36:37 +01:00
|
|
|
//handle the event from ws explorer
|
|
|
|
Liferay.on('getSelectedItem', function(event) {
|
|
|
|
var id = event.id;
|
|
|
|
var name = event.name;
|
|
|
|
var chip = $('<span class="badge badge-success" style="margin: 5px; padding:0 5px; line-height: 30px;">'+
|
|
|
|
event.name + ' <button onClick="removeFromParent(this);" class="close">×</button>'+
|
|
|
|
'<input type="hidden" name="selected-attachment" value="'+event.id+'"></span>');
|
|
|
|
$("#attachedFiles").append(chip);
|
|
|
|
});
|
|
|
|
|
|
|
|
function removeFromParent(el) {
|
|
|
|
$(el).parent().remove();
|
|
|
|
}
|