blob: 7babdb66538c68faf9ae80768449464d3583cfa8 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../orion/plugin.js"></script>
<script type="text/javascript" src="UsersService.js"></script>
<script type="text/javascript"
src="../org.dojotoolkit/dojo/dojo.js.uncompressed.js"></script>
<!--Authentication -->
<script>
window.onload = function() {
var usersService = new eclipse.UsersService();
var provider = new eclipse.PluginProvider();
usersService.info = function() {
return {
name : "User profile"
};
};
usersService.getDivContent = function() {
var content = { "actions": [
{"id": "saveProfileButton", "name": "Save Profile", "tooltip": "Save Profile", "action": "saveProfile"},
{"id": "resetProfileButton", "name": "Reset", "tooltip": "Reset Profile Information", "action": "resetProfile"},
{"id": "deleteProfileButton", "name": "Delete Profile", "tooltip": "Delete Profile", "action": "deleteProfile"}
]
};
return content;
};
usersService.initProfile = function(userURI, pluginsEventName, dataEventName){
var userService = this._serviceRegistration;
return this.getUserInfo(userURI, function(json){
userService.dispatchEvent(pluginsEventName, {"plugins": json.Plugins});
userService.dispatchEvent(dataEventName, json);
});
},
usersService.fire = function(action, url, jsonData){
switch(action){
case "saveProfile":
return this.updateUserInfo(url, jsonData, dojo.hitch(this, function(url) {this.initProfile(url, "requiredPluginsChanged", "userInfoChanged"); return {message: "Profile saved!", status: 200};}, url));
break;
case "resetProfile":
return this.getUserInfo(url, "userInfoChanged");
break;
case "deleteProfile":
var login = jsonData.login ? jsonData.login
: url;
if (confirm("Do you really want to delete user "
+ login + "?")) {
return this.deleteUser(url, "userDeleted");
}
break;
default:
return this.updateUserInfo(url, jsonData, dojo.hitch(this, function(url) {this.initProfile(url, "requiredPluginsChanged", "userInfoChanged"); return {message: "Profile saved!", status: 200};}, url));
break;
}
};
usersService._serviceRegistration = provider.registerServiceProvider("orion.core.user", usersService);
usersService.dispatchEvent = provider.dispatchEvent;
provider.connect();
};
</script>
</head>
<body></body>
</html>