aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js180
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js3
2 files changed, 94 insertions, 89 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
index 4b7167314..a220541ee 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
+++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
@@ -129,45 +129,6 @@ function() {
$.log("hideElementWithKarma");
}
- userLoggedCallbackFn=function(user){
- $.log("userLoggedCallbackFn:"+ (user?user.username:null));
-
- if (!user) {
- $("#login-link").show();
- $("#register-link").show();
- $("#change-password-link").hide();
- checkUrlParams();
- } else {
- $("#change-password-link").show();
- $("#logout-link").show();
- $("#register-link").hide();
- $("#login-link").hide();
- decorateMenuWithKarma(user);
- }
- }
-
- checkSecurityLinks=function(){
- userLogged(userLoggedCallbackFn);
- }
-
- checkCreateAdminLink=function(){
- $.ajax("restServices/redbackServices/userService/isAdminUserExists", {
- type: "GET",
- dataType: 'json',
- success: function(data) {
- var adminExists = data;
- if (adminExists == false) {
- $("#create-admin-link").show();
- $("#login-link").hide();
- $("#register-link").hide();
- } else {
- $("#create-admin-link").hide();
- }
- $.log("adminExists:"+adminExists);
- }
- });
- }
-
//------------------------------------//
// Change UI with appearance settings //
//------------------------------------//
@@ -235,58 +196,101 @@ function() {
this.activeMenuId = ko.observable();
window.sammyArchivaApplication = Sammy(function () {
- // #artifact-(optionnal repositoryId)
- // format groupId:artifactId org.apache.maven.plugins:maven-jar-plugin
- // or groupId:artifactId:version org.apache.maven.plugins:maven-jar-plugin:2.3.1
- this.get('#artifact/:groupId/:artifactId',function(context){
- var groupId= this.params['groupId'];
- var artifactId= this.params['artifactId'];
- $.log("get #artifact:"+groupId+":"+artifactId);
- goToBrowseArtifactDetail(groupId,artifactId);//,null,null);
- return;
-
- });
- this.get('#artifact:repositoryId/:groupId/:artifactId/:version',function(context){
-
- var repositoryId = this.params['repositoryId'];
- var groupId= this.params['groupId'];
- var artifactId= this.params['artifactId'];
- var version= this.params['version'];
-
- if(!version){
- displayBrowseArtifactDetail(splitted[0],splitted[1]);//,null,null);
- } else {
- generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId);
- }
- });
- this.get('#browse/:groupId',function(context){
- var groupId = this.params['groupId'];
- if (groupId){
- displayBrowseGroupId(groupId);
- } else {
- displayBrowse(true);
- }
- });
- this.get('#:folder', function () {
- self.activeMenuId(this.params.folder);
- var baseItems = self.artifactMenuItems?self.artifactMenuItems:[];
- ko.utils.arrayFirst(baseItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) {
- if ( p.href == "#"+self.activeMenuId()) {
- p.func();
- return;
- }
- });
-
- });
- this.get('#open-admin-create-box',function(){
- $.log("#open-admin-create-box");
- adminCreateBox();
- });
- //this.get('', function () { this.app.runRoute('get', '#search') });
- } );
+ this.get('#open-admin-create-box',function(){
+ $.log("#open-admin-create-box");
+ adminCreateBox();
+ });
+
+ // #artifact-(optionnal repositoryId)
+ // format groupId:artifactId org.apache.maven.plugins:maven-jar-plugin
+ // or groupId:artifactId:version org.apache.maven.plugins:maven-jar-plugin:2.3.1
+ this.get('#artifact/:groupId/:artifactId',function(context){
+ var groupId= this.params['groupId'];
+ var artifactId= this.params['artifactId'];
+ $.log("get #artifact:"+groupId+":"+artifactId);
+ goToBrowseArtifactDetail(groupId,artifactId);//,null,null);
+ return;
+
+ });
+ this.get('#artifact:repositoryId/:groupId/:artifactId/:version',function(context){
+
+ var repositoryId = this.params['repositoryId'];
+ var groupId= this.params['groupId'];
+ var artifactId= this.params['artifactId'];
+ var version= this.params['version'];
+
+ if(!version){
+ displayBrowseArtifactDetail(splitted[0],splitted[1]);//,null,null);
+ } else {
+ generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId);
+ }
+ });
+ this.get('#browse/:groupId',function(context){
+ var groupId = this.params['groupId'];
+ if (groupId){
+ displayBrowseGroupId(groupId);
+ } else {
+ displayBrowse(true);
+ }
+ });
+ this.get('#:folder', function () {
+ var folder = this.params.folder;
+ self.activeMenuId(folder);
+ var baseItems = self.artifactMenuItems?self.artifactMenuItems:[];
+ ko.utils.arrayFirst(baseItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) {
+ if ( p.href == "#"+self.activeMenuId()) {
+ p.func();
+ return;
+ }
+ });
+ });
+ //this.get('', function () { this.app.runRoute('get', '#search') });
+ });
sammyArchivaApplication.run();
}
+ userLoggedCallbackFn=function(user){
+ $.log("userLoggedCallbackFn:"+ (user?user.username:null));
+
+ if (!user) {
+ $("#login-link").show();
+ $("#register-link").show();
+ $("#change-password-link").hide();
+ checkUrlParams();
+ } else {
+ $("#change-password-link").show();
+ $("#logout-link").show();
+ $("#register-link").hide();
+ $("#login-link").hide();
+ decorateMenuWithKarma(user);
+ }
+ }
+
+ checkSecurityLinks=function(){
+ userLogged(userLoggedCallbackFn);
+ }
+
+ checkCreateAdminLink=function(callbackFn){
+ $.ajax("restServices/redbackServices/userService/isAdminUserExists", {
+ type: "GET",
+ dataType: 'json',
+ success: function(data) {
+ var adminExists = data;
+ if (adminExists == false) {
+ $("#create-admin-link").show();
+ $("#login-link").hide();
+ $("#register-link").hide();
+ } else {
+ $("#create-admin-link").hide();
+ }
+ if(callbackFn){
+ callbackFn()
+ }
+ $.log("adminExists:"+adminExists);
+ }
+ });
+ }
+
startArchivaApplication=function(){
$.log("startArchivaApplication");
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js
index d91bd4dcd..ea11fa92b 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js
+++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js
@@ -296,10 +296,11 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
* open a modal box to create admin user
*/
adminCreateBox=function() {
+ $.log("adminCreateBox");
window.redbackModel.createUser=true;
$("#main-content").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
var viewModel = new AdminUserViewModel();
- ko.applyBindings(viewModel);
+ ko.applyBindings(viewModel,$("#main-content" ).get(0));
$("#user-create").validate({
rules: {
confirmPassword: {