Skip to content
Snippets Groups Projects
Commit ca250084 authored by Anthony Borghi's avatar Anthony Borghi
Browse files

Générateur d'url pour BO

parent c34ae8c2
No related branches found
No related tags found
No related merge requests found
......@@ -542,6 +542,7 @@ nsVmap.nsToolsManager.BasicSelect.prototype.basicSelectController.prototype.repl
nsVmap.nsToolsManager.BasicSelect.prototype.basicSelectController.prototype.displaySelectionPopup = function (aSelection, olPoint) {
oVmap.log('nsVmap.nsToolsManager.BasicSelect.prototype.basicSelectController.prototype.displaySelectionPopup');
var this_ = this;
var scope = this.$scope_;
for (var i = 0; i < aSelection.length; i++) {
......@@ -659,6 +660,51 @@ nsVmap.nsToolsManager.BasicSelect.prototype.basicSelectController.prototype.disp
}
});
}
aSelection[i]['mapPopup'].addAction({
'content': '<span class="fa fa-link"></span> Copier l\'URL de cet objet' ,
'event': angular.bind(this, function(i){
scope.$apply(function () {
// generate url for this object;
var sUrl = this_['properties']['web_server_name'] + "/" + this_['properties']['application'];
if (goog.isDefAndNotNull(this_['properties']['environment'])){
if (this_['properties']['environment'] != ""){
sUrl += "_" + this_['properties']['environment'];
}
}
sUrl += "?mode_id=vmap&";
var oMapCatalog = oVmap.getMapManager().getMapCatalog();
var iMapId = oMapCatalog["maps"][oMapCatalog["usedMap"]]["map_id"];
sUrl += "map_id=" + iMapId + "&";
sUrl += "bo_id=" + aSelection[i]["bo_type"] + "&";
sUrl += "ids=" + aSelection[i]["bo_id_value"];
//copy url to clipboard
var textArea = document.createElement("textarea");
textArea.value = sUrl;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand('copy');
if (successful){
$.notify('L\'URL d\'accés à cette objet a été copié dans votre presse-papier : \n' + sUrl, 'success');
} else {
$.notify('L\'URL d\'accés à cette objet n\'a pas pu être copié dans votre presse-papier : \n' + sUrl, 'error');
}
} catch (err) {
$.notify('L\'URL d\'accés à cette objet n\'a pas pu être copié dans votre presse-papier : \n' + sUrl, 'error');
console.error('Fallback: Oops, unable to copy', err);
}
document.body.removeChild(textArea);
});
}, i)
});
}
// Ajoute les résultats
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment