this.bulkMode=false || bulkMode;
this.save=function(){
- if (!$("#main-content #network-proxy-edit-form").valid()){
+ if (!$("#main-content" ).find("#network-proxy-edit-form").valid()){
return;
}
if (!this.bulkMode){
mainContent.find("#network-proxies-view-tabs").on('show', function (e) {
if ($(e.target).attr("href")=="#network-proxies-edit") {
var viewModel = new NetworkProxyViewModel(new NetworkProxy(),false,networkProxiesViewModel);
- ko.applyBindings(viewModel,$("#main-content #network-proxies-edit").get(0));
+ ko.applyBindings(viewModel,$("#main-content" ).find("#network-proxies-edit").get(0));
activateNetworkProxyFormValidation();
clearUserMessages();
}
if ($(e.target).attr("href")=="#network-proxies-view") {
- $("#main-content #network-proxies-view-tabs-li-edit a").html($.i18n.prop("add"));
+ $("#main-content" ).find("#network-proxies-view-tabs-li-edit a").html($.i18n.prop("add"));
clearUserMessages();
}
],
pageSize: 5,
gridUpdateCallBack: function(networkProxy){
- $("#main-content #networkProxiesTable [title]").tooltip();
+ $("#main-content" ).find("#networkProxiesTable [title]").tooltip();
}
});
- ko.applyBindings(networkProxiesViewModel,$("#main-content #network-proxies-view").get(0));
+ ko.applyBindings(networkProxiesViewModel,$("#main-content" ).find("#network-proxies-view").get(0));
}
)
}
}
activateNetworkProxyFormValidation=function(){
- var editForm=$("#main-content #network-proxy-edit-form");
+ var editForm=$("#main-content" ).find("#network-proxy-edit-form");
var validator = editForm.validate({
rules: {id: {
required: true,
}
changePolicyOption=function(id){
- var selectedOption=$("#main-content #policy-"+id + " option:selected");
+ var selectedOption=$("#main-content").find("#policy-"+id ).find("option:selected");
if (selectedOption.length>0){
var value = selectedOption.val();
$.log("changePolicyOption:"+id+":"+value);
addBlacklistPattern=function(){
- var pattern = $("#main-content #blacklist-value").val();
+ var pattern = $("#main-content").find("#blacklist-value").val();
var tab = self.proxyConnector.blackListPatterns();
tab.push(pattern);
self.proxyConnector.blackListPatterns(tab);
}
addWhitelistPattern=function(){
- var pattern = $("#main-content #whitelist-value").val();
+ var pattern = $("#main-content" ).find("#whitelist-value").val();
var tab = self.proxyConnector.whiteListPatterns();
tab.push(pattern);
self.proxyConnector.whiteListPatterns(tab);
var managedRepository = getManagedRepository(proxyConnector.sourceRepoId());
var proxyConnectorEditOrderViewModel=new ProxyConnectorEditOrderViewModel(proxyConnectors,self,managedRepository);
- ko.applyBindings(proxyConnectorEditOrderViewModel,$("#main-content #proxy-connector-edit-order").get(0));
+ ko.applyBindings(proxyConnectorEditOrderViewModel,$("#main-content").find("#proxy-connector-edit-order").get(0));
activateProxyConnectorsEditOrderTab();
}
data: self.proxyConnectors,
pageSize: 5,
gridUpdateCallBack: function(){
- $("#main-content #proxyConnectorsTable [title]").tooltip();
+ $("#main-content" ).find("#proxyConnectorsTable" ).find("[title]").tooltip();
}
});
var mainContent = $("#main-content");
this.availableLayouts = window.managedRepositoryTypes;
this.save=function(){
- var valid = $("#main-content #managed-repository-edit-form").valid();
+ var valid = $("#main-content").find("#managed-repository-edit-form").valid();
if (valid==false) {
return;
}
}
activateManagedRepositoryFormValidation=function(){
- var validator = $("#main-content #managed-repository-edit-form").validate({
+ var validator = $("#main-content" ).find("#managed-repository-edit-form").validate({
rules: {
daysOlder : {
digits: true,
clearUserMessages();
openDialogConfirm(
function(){
- $("#dialog-confirm-modal #modal-login-footer").append(smallSpinnerImg());
+ $("#dialog-confirm-modal" ).find("#modal-login-footer").append(smallSpinnerImg());
var checked = $("#managed-repository-scan-now-all").get(0).checked;
var url = "restServices/archivaServices/repositoriesService/scanRepositoryNow?";
url += "repositoryId="+encodeURIComponent(managedRepository.id());
clearUserMessages();
openDialogConfirm(
function(){
- $("#dialog-confirm-modal #modal-login-footer").append(smallSpinnerImg());
+ $("#dialog-confirm-modal").find("#modal-login-footer").append(smallSpinnerImg());
var url = "restServices/archivaServices/managedRepositoriesService/deleteManagedRepository?";
url += "repositoryId="+encodeURIComponent(managedRepository.id());
this.availableLayouts = window.managedRepositoryTypes;
this.save=function(){
- var valid = $("#main-content #remote-repository-edit-form").valid();
+ var valid = $("#main-content" ).find("#remote-repository-edit-form").valid();
if (valid==false) {
return;
}
activateRemoteRepositoryFormValidation=function(){
// FIXME find a way to activate cronExpression validation only if downloadRemote is activated !
- var validator = $("#main-content #remote-repository-edit-form").validate({
+ var validator = $("#main-content" ).find("#remote-repository-edit-form").validate({
rules: {
id: {
required: true,
],
pageSize: 5,
gridUpdateCallBack: function(){
- $("#main-content #managed-repositories-table").find("[title]").tooltip();
+ $("#main-content" ).find("#managed-repositories-table").find("[title]").tooltip();
}
});
var mainContent = $("#main-content");
],
pageSize: 5,
gridUpdateCallBack: function(){
- $("#main-content #remote-repositories-table").find("[title]").tooltip();
+ $("#main-content" ).find("#remote-repositories-table").find("[title]").tooltip();
}
});
var mainContent = $("#main-content");
success: function(data) {
var viewModel = new RemoteRepositoryViewModel(new RemoteRepository(),false,remoteRepositoriesViewModel);
viewModel.networkProxies(mapNetworkProxies(data));
- ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0));
+ ko.applyBindings(viewModel,$("#main-content" ).find("#remote-repository-edit").get(0));
activateRemoteRepositoryFormValidation();
}
})
}
if ($(e.target).attr("href")=="#remote-repositories-view") {
- $("#main-content #remote-repository-edit-li a").html($.i18n.prop("add"));
+ $("#main-content" ).find("#remote-repository-edit-li" ).find("a").html($.i18n.prop("add"));
}
});
$.log("editRepositoryGroup:"+repositoryGroup.id()+",repositories:"+repositoryGroup.repositories().length+",managed:"+repositoryGroup.managedRepositories().length);
var repositoryGroupViewModel=new RepositoryGroupViewModel(repositoryGroup,true,self);
activateRepositoryGroupEditTab();
- ko.applyBindings(repositoryGroupViewModel,$("#main-content #repository-groups-edit" ).get(0));
- $("#main-content #repository-groups-view-tabs-li-edit a").html($.i18n.prop("edit"));
+ ko.applyBindings(repositoryGroupViewModel,$("#main-content").find("#repository-groups-edit" ).get(0));
+ $("#main-content" ).find("#repository-groups-view-tabs-li-edit" ).find("a").html($.i18n.prop("edit"));
}
this.saveRepositoryGroup=function(repositoryGroup){
return entries;
}
displayArtifactInfo=function(){
- if ($("#main-content #artifact-info:visible" ).length>0) {
- $("#main-content #artifact-info" ).hide();
+ if ($("#main-content").find("#artifact-info:visible" ).length>0) {
+ $("#main-content").find("#artifact-info" ).hide();
} else {
- $("#main-content #artifact-info" ).show();
+ $("#main-content").find("#artifact-info" ).show();
}
}
success:function(data){
self.artifacts.remove(artifact);
displaySuccessMessage( $.i18n.prop('artifact.deleted'));
- $("#main-content #artifact-details-download-content" ).html(smallSpinnerImg());
+ $("#main-content").find("#artifact-details-download-content" ).html(smallSpinnerImg());
// reload datas from server
var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(self.artifactVersionDetailViewModel.groupId);
artifactDownloadInfosUrl+="/"+encodeURIComponent(self.artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(self.artifactVersionDetailViewModel.version);
if(classifier){
entriesUrl+="&c="+encodeURIComponent(classifier);
}
- $("#main-content #artifact_content_tree").fileTree({
+ $("#main-content").find("#artifact_content_tree").fileTree({
script: entriesUrl,
root: ""
},function(file) {
}
getSelectedBrowsingRepository=function(){
- var selectedOption=$("#main-content #select_browse_repository option:selected" );
+ var selectedOption=$("#main-content").find("#select_browse_repository").find("option:selected" );
if (selectedOption.length>0){
var repoId=selectedOption.val();
return repoId;
if (selectedRepo){
url+="?repositoryId="+encodeURIComponent(selectedRepo);
}
- $( "#main-content #browse-autocomplete" ).autocomplete({
+ $( "#main-content").find("#browse-autocomplete" ).autocomplete({
minLength: 2,
source: function(request, response){
var query = "";
}
applyAutocompleteOnHeader=function(property,resultViewModel){
- $( "#main-content #search-filter-auto-"+property ).autocomplete({
+ $( "#main-content").find("#search-filter-auto-"+property ).autocomplete({
minLength: 0,
source: function(request, response){
var founds=[];
if ($.trim(queryTerm).length<1){
var errorList=[{
message: $.i18n.prop("search.artifact.search.form.terms.empty"),
- element: $("#main-content #search-basic-form #search-terms" ).get(0)
+ element: $("#main-content").find("#search-basic-form").find("#search-terms" ).get(0)
}];
customShowError("#main-content #search-basic-form", null, null, errorList);
return;
}
$("#dialog-confirm-modal-header-title").html(title);
$("#dialog-confirm-modal-body-text").html(bodyText);
+ var dialogConfirmModalOk=$("#dialog-confirm-modal-ok");
if (okMessage){
- $("#dialog-confirm-modal-ok").html(okMessage);
+ dialogConfirmModalOk.html(okMessage);
}
if (cancelMessage){
dialogCancel.html(cancelMessage);
window.modalConfirmDialog.modal('show');
// unbind previous events !!
- var dialogConfirmModalOk=$("#dialog-confirm-modal-ok");
+
dialogConfirmModalOk.off( );
dialogConfirmModalOk.on("click", okFn);
* open the register modal box
*/
registerBox=function(){
+ var modalRegister=$("#modal-register");
if (window.modalRegisterWindow==null) {
- window.modalRegisterWindow = $("#modal-register").modal({backdrop:'static',show:false});
+ window.modalRegisterWindow = modalRegister.modal({backdrop:'static',show:false});
window.modalRegisterWindow.bind('hidden', function () {
$("#modal-register-err-message").hide();
})
customShowError("#user-register-form",validator,errorMap,errorMap);
}
});
- $("#modal-register").delegate("#modal-register-ok", "click keydown keypress", function(e) {
+ modalRegister.delegate("#modal-register-ok", "click keydown keypress", function(e) {
e.preventDefault();
register();
});
}
activateRolesGridTab=function(){
- $("#main-content #roles-view-tabs li").removeClass("active");
- $("#main-content #roles-view-tabs-content div").removeClass("active");
+ $("#main-content").find("#roles-view-tabs").find("li").removeClass("active");
+ $("#main-content").find("#roles-view-tabs-content").find("div").removeClass("active");
// activate roles grid tab
- $("#main-content #roles-view-tabs-content #roles-view").addClass("active");
- $("#main-content #roles-view-tabs-li-roles-grid").addClass("active");
+ $("#main-content").find("#roles-view-tabs-content").find("#roles-view").addClass("active");
+ $("#main-content").find("#roles-view-tabs-li-roles-grid").addClass("active");
}
activateRoleEditTab=function(){
- $("#main-content #roles-view-tabs li").removeClass("active");
- $("#main-content #roles-view-tabs-content div").removeClass("active");
+ $("#main-content").find("#roles-view-tabs").find("li").removeClass("active");
+ $("#main-content").find("#roles-view-tabs-content").find("div").removeClass("active");
// activate role edit tab
- $("#main-content #roles-view-tabs-content #role-edit").addClass("active");
+ $("#main-content").find("#roles-view-tabs-content").find("#role-edit").addClass("active");
$("#roles-view-tabs-li-roles-edit").addClass("active");
}
activateRoleUsersListTab=function(){
- $("#main-content #role-edit-users-li").removeClass("active");
- $("#main-content #role-edit-users").removeClass("active");
+ $("#main-content").find("#role-edit-users-li").removeClass("active");
+ $("#main-content").find("#role-edit-users").removeClass("active");
// activate roles grid tab
- $("#main-content #role-view-users-li").addClass("active");
- $("#main-content #role-view-users").addClass("active");
+ $("#main-content").find("#role-view-users-li").addClass("active");
+ $("#main-content").find("#role-view-users").addClass("active");
}
activateRoleUsersEditTab=function(){
- $("#main-content #role-view-users-li").removeClass("active");
- $("#main-content #role-view-users").removeClass("active");
+ $("#main-content").find("#role-view-users-li").removeClass("active");
+ $("#main-content").find("#role-view-users").removeClass("active");
// activate role edit tab
- $("#main-content #role-edit-users").addClass("active");
+ $("#main-content").find("#role-edit-users").addClass("active");
$("#role-edit-users-li").addClass("active");
}
successFnCallback(currentUser);
}
clearForm("#main-content #user-create");
- $("#main-content #user-create").hide();
+ $("#main-content").find("#user-create").hide();
activateUsersGridTab();
return this;
} else {
if (updated == true) {
clearUserMessages();
displaySuccessMessage($.i18n.prop("user.updated",currentUser.username()));
- $("#main-content #users-view-tabs-li-user-edit a").html($.i18n.prop("add"));
+ $("#main-content").find("#users-view-tabs-li-user-edit").find("a").html($.i18n.prop("add"));
clearForm("#main-content #user-create");
activateUsersGridTab();
return this;
this.save=function(){
$.log("user.save create:"+window.redbackModel.createUser);
if (window.redbackModel.createUser==true){
- var valid = $("#main-content #user-create").valid();
+ var valid = $("#main-content").find("#user-create").valid();
if (valid==false) {
$.log("user#save valid:false");
* open a modal box to create admin user
*/
adminCreateBox=function() {
-
+ var mainContent=$("#main-content");
$.ajax("restServices/redbackServices/userService/isAdminUserExists", {
type: "GET",
if (adminExists == false) {
window.redbackModel.createUser=true;
- $("#main-content").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
+ mainContent.attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
var viewModel = new AdminUserViewModel();
- ko.applyBindings(viewModel,$("#main-content" ).get(0));
+ ko.applyBindings(viewModel,mainContent.get(0));
$.log("adminCreateBox");
$("#user-create").validate({
rules: {
decorateMenuWithKarma(user);
return;
}
- $("#modal-login-err-message").html($.i18n.prop("incorrect.username.password"));
- $("#modal-login-err-message").show();
+ var modalLoginErrMsg=$("#modal-login-err-message");
+ modalLoginErrMsg.html($.i18n.prop("incorrect.username.password"));
+ modalLoginErrMsg.show();
}
/**
}
passwordReset=function(){
- var username = $("#user-login-form-username" ).val();
+ var userLoginFormUsername=$("#user-login-form-username" );
+ var username = userLoginFormUsername.val();
if(username.trim().length<1){
var errorList=[{
message: $.i18n.prop("username.cannot.be.empty"),
- element: $("#user-login-form-username").get(0)
+ element: userLoginFormUsername.get(0)
}];
customShowError("#user-login-form", null, null, errorList);
return;
window.modalEditUserBox.bind('hidden', function () {
$("#modal-user-edit-err-message").hide();
})
- $("#modal-user-edit #modal-user-edit-ok").on( "click keydown keypress", function(e) {
+ $("#modal-user-edit").find("#modal-user-edit-ok").on( "click keydown keypress", function(e) {
e.preventDefault();
$.log("user.js#editUserDetailsBox");
var valid = $("#user-edit-form").valid();
}
var user = {
username:currentUser.username,
- fullName:$("#modal-user-edit #fullname").val(),
- email:$("#modal-user-edit #email").val(),
- previousPassword:$("#modal-user-edit #userEditFormCurrentPassword").val(),
- password:$("#modal-user-edit #userEditFormNewPassword").val(),
- confirmPassword:$("#modal-user-edit #userEditFormNewPasswordConfirm").val()
+ fullName:$("#modal-user-edit").find("#fullname").val(),
+ email:$("#modal-user-edit").find("#email").val(),
+ previousPassword:$("#modal-user-edit").find("#userEditFormCurrentPassword").val(),
+ password:$("#modal-user-edit").find("#userEditFormNewPassword").val(),
+ confirmPassword:$("#modal-user-edit").find("#userEditFormNewPasswordConfirm").val()
};
editUserDetails(user);
});
}
var currentUser = getUserFromLoginCookie();
- $("#modal-user-edit #username").html(currentUser.username);
- $("#modal-user-edit #fullname").val(currentUser.fullName);
- $("#modal-user-edit #email").val(currentUser.email);
+ $("#modal-user-edit").find("#username").html(currentUser.username);
+ $("#modal-user-edit").find("#fullname").val(currentUser.fullName);
+ $("#modal-user-edit").find("#email").val(currentUser.email);
window.modalEditUserBox.modal('show');
$("#user-edit-form").validate({
rules: {
}
saveUser=function(){
- var valid = $("#main-content #user-create").valid();
+ var valid = $("#main-content").find("#user-create").valid();
if (valid==false) {
return;
}