check that the value returned is an url. This effectively close bug #13, but really is a hack where the value should be tested to belong to a given thesaurus.
--- a/src/p4l/static/p4l/js/p4l.js Mon Dec 02 18:17:21 2013 +0100
+++ b/src/p4l/static/p4l/js/p4l.js Mon Dec 02 23:26:46 2013 +0100
@@ -153,7 +153,7 @@
$scope.list[$scope.editedIndex] = $scope.editedObj;
}
else {
- $scope.list.push($scope.editedObj);
+ $scope.list.push($scope.editedObj);
}
$scope.setEditedObject(null, -1);
@@ -161,7 +161,7 @@
}
$scope.onCancel = function() {
- $scope.setEditedObject(null, -1);
+ $scope.setEditedObject(null, -1);
}
}
};
@@ -205,8 +205,11 @@
$scope.uriInDict = false;
$scope.addUriToList = function() {
- $scope.list.push($scope.addUriText);
- $scope.addUriText = '';
+ //TODO: really check that the $scope.addUriText belong to the correct thesaurus.
+ if($scope.addUriText.match("^http://")) {
+ $scope.list.push($scope.addUriText);
+ $scope.addUriText = '';
+ }
};
$scope.removeFromList = function(obj) {
var i = $scope.list.indexOf(obj);
@@ -241,7 +244,7 @@
link: function($scope, $element, $attrs) {
// Get queries attributes from $scope listname and context query dict
var attr_dict = context.query_dicts[$scope.listname];
- angular.extend($scope, attr_dict);
+ angular.extend($scope, attr_dict);
$scope.formVisible = false;
// initalize autocomplete and browse thesaurus events
@@ -259,7 +262,10 @@
$scope.uriInDict = false;
$scope.updateVal = function() {
- $scope.val = $scope.addUriText;
+ // TODO: really check that the $scope.addUriText belong to the correct thesaurus.
+ if($scope.addUriText.match("^http://")) {
+ $scope.val = $scope.addUriText;
+ }
};
$scope.updateUriLabelDict = function(k,v) {