start use strict fixes

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1301520 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-16 14:00:56 +00:00
parent 2a166a799b
commit 5fffe588b9
1 changed files with 17 additions and 13 deletions

View File

@ -18,7 +18,7 @@
*/ */
require( ["order!jquery" ,"order!redback/redback"], require( ["order!jquery" ,"order!redback/redback"],
function($) { function($) {
"use strict"
$(function() { $(function() {
// define a container object with various datas // define a container object with various datas
@ -37,19 +37,19 @@ $(function() {
* reccord a cookie for session with the logged user * reccord a cookie for session with the logged user
* @param user see user.js * @param user see user.js
*/ */
reccordLoginCookie=function(user) { var reccordLoginCookie=function(user) {
$.cookie('redback_login', ko.toJSON(user)); $.cookie('redback_login', ko.toJSON(user));
} }
getUserFromLoginCookie=function(){ var getUserFromLoginCookie=function(){
return $.parseJSON($.cookie('redback_login')); return $.parseJSON($.cookie('redback_login'));
} }
deleteLoginCookie=function(){ var deleteLoginCookie=function(){
$.cookie('redback_login', null); $.cookie('redback_login', null);
} }
logout=function(screenChange){ var logout=function(screenChange){
deleteLoginCookie(); deleteLoginCookie();
$("#login-link").show(); $("#login-link").show();
$("#register-link").show(); $("#register-link").show();
@ -124,17 +124,21 @@ $(function() {
displayRepositoriesGrid(); displayRepositoriesGrid();
return; return;
} }
if (screen=="browse"){
displayBrowse();
return;
}
} }
// by default display search screen // by default display search screen
displaySearch(); displaySearch();
} }
hasKarma=function(karmaName){ var hasKarma=function(karmaName){
return $.inArray(karmaName,window.redbackModel.operatioNames)>=0; return $.inArray(karmaName,window.redbackModel.operatioNames)>=0;
} }
decorateMenuWithKarma=function(user) { var decorateMenuWithKarma=function(user) {
var username = user.username; var username = user.username;
$.log("decorateMenuWithKarma"); $.log("decorateMenuWithKarma");
// we can receive an observable user so take if it's a function or not // we can receive an observable user so take if it's a function or not
@ -163,7 +167,7 @@ $(function() {
}); });
} }
checkElementKarma=function(element){ function checkElementKarma(element){
var bindingValue = $(element).attr("redback-permissions"); var bindingValue = $(element).attr("redback-permissions");
$(element).hide(); $(element).hide();
var neededKarmas = $(eval(bindingValue)).toArray(); var neededKarmas = $(eval(bindingValue)).toArray();
@ -180,7 +184,7 @@ $(function() {
} }
} }
hideElementWithKarma=function(){ var hideElementWithKarma=function(){
$("#topbar-menu-container [redback-permissions]").each(function(element){ $("#topbar-menu-container [redback-permissions]").each(function(element){
$(this).hide(); $(this).hide();
}); });
@ -191,7 +195,7 @@ $(function() {
$.log("hideElementWithKarma"); $.log("hideElementWithKarma");
} }
userLoggedCallbackFn=function(user){ var userLoggedCallbackFn=function(user){
$.log("userLoggedCallbackFn:"+ (user?user.username:null)); $.log("userLoggedCallbackFn:"+ (user?user.username:null));
if (!user) { if (!user) {
@ -208,11 +212,11 @@ $(function() {
} }
} }
checkSecurityLinks=function(){ var checkSecurityLinks=function(){
userLogged(userLoggedCallbackFn); userLogged(userLoggedCallbackFn);
} }
checkCreateAdminLink=function(){ function checkCreateAdminLink(){
$.ajax("restServices/redbackServices/userService/isAdminUserExists", { $.ajax("restServices/redbackServices/userService/isAdminUserExists", {
type: "GET", type: "GET",
dataType: 'json', dataType: 'json',
@ -232,7 +236,7 @@ $(function() {
startArchivaApplication = function(){ function startArchivaApplication(){
$.log("startArchivaApplication"); $.log("startArchivaApplication");
$('#topbar-menu-container').html($("#topbar-menu")); $('#topbar-menu-container').html($("#topbar-menu"));
$('#sidebar-content').html($("#main-menu")); $('#sidebar-content').html($("#main-menu"));