mirror of https://github.com/apache/archiva.git
[MRM-1722] Use cookie settings from redback for rememberme feature
fix issues on not saved redbackRuntimeConfiguration.properties git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1424183 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d54308934c
commit
0ae2aff01e
|
@ -18,6 +18,8 @@ package org.apache.archiva.web.api;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
|
||||||
|
import org.apache.archiva.rest.api.services.ArchivaRuntimeConfigurationService;
|
||||||
import org.apache.archiva.web.runtime.ArchivaRuntimeInfo;
|
import org.apache.archiva.web.runtime.ArchivaRuntimeInfo;
|
||||||
import org.apache.archiva.web.model.ApplicationRuntimeInfo;
|
import org.apache.archiva.web.model.ApplicationRuntimeInfo;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@ -35,7 +37,7 @@ import java.util.Locale;
|
||||||
/**
|
/**
|
||||||
* @author Olivier Lamy
|
* @author Olivier Lamy
|
||||||
*/
|
*/
|
||||||
@Service( "runtimeInfoService#rest" )
|
@Service("runtimeInfoService#rest")
|
||||||
public class DefaultRuntimeInfoService
|
public class DefaultRuntimeInfoService
|
||||||
implements RuntimeInfoService
|
implements RuntimeInfoService
|
||||||
{
|
{
|
||||||
|
@ -44,6 +46,9 @@ public class DefaultRuntimeInfoService
|
||||||
|
|
||||||
private ArchivaRuntimeInfo archivaRuntimeInfo;
|
private ArchivaRuntimeInfo archivaRuntimeInfo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ArchivaRuntimeConfigurationService archivaRuntimeConfigurationService;
|
||||||
|
|
||||||
@Context
|
@Context
|
||||||
protected HttpServletRequest httpServletRequest;
|
protected HttpServletRequest httpServletRequest;
|
||||||
|
|
||||||
|
@ -54,6 +59,7 @@ public class DefaultRuntimeInfoService
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationRuntimeInfo getApplicationRuntimeInfo( String locale )
|
public ApplicationRuntimeInfo getApplicationRuntimeInfo( String locale )
|
||||||
|
throws ArchivaRestServiceException
|
||||||
{
|
{
|
||||||
ApplicationRuntimeInfo applicationRuntimeInfo = new ApplicationRuntimeInfo();
|
ApplicationRuntimeInfo applicationRuntimeInfo = new ApplicationRuntimeInfo();
|
||||||
applicationRuntimeInfo.setBuildNumber( this.archivaRuntimeInfo.getBuildNumber() );
|
applicationRuntimeInfo.setBuildNumber( this.archivaRuntimeInfo.getBuildNumber() );
|
||||||
|
@ -65,6 +71,9 @@ public class DefaultRuntimeInfoService
|
||||||
new Locale( StringUtils.isEmpty( locale ) ? "en" : locale ) );
|
new Locale( StringUtils.isEmpty( locale ) ? "en" : locale ) );
|
||||||
applicationRuntimeInfo.setTimestampStr( sfd.format( new Date( archivaRuntimeInfo.getTimestamp() ) ) );
|
applicationRuntimeInfo.setTimestampStr( sfd.format( new Date( archivaRuntimeInfo.getTimestamp() ) ) );
|
||||||
|
|
||||||
|
applicationRuntimeInfo.setRedbackRuntimeConfiguration(
|
||||||
|
archivaRuntimeConfigurationService.getRedbackRuntimeConfigurationAdmin() );
|
||||||
|
|
||||||
return applicationRuntimeInfo;
|
return applicationRuntimeInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.archiva.web.api;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
|
||||||
import org.apache.archiva.web.model.ApplicationRuntimeInfo;
|
import org.apache.archiva.web.model.ApplicationRuntimeInfo;
|
||||||
import org.apache.archiva.redback.authorization.RedbackAuthorization;
|
import org.apache.archiva.redback.authorization.RedbackAuthorization;
|
||||||
|
|
||||||
|
@ -32,19 +33,20 @@ import javax.ws.rs.core.MediaType;
|
||||||
* @author Olivier Lamy
|
* @author Olivier Lamy
|
||||||
* @since 1.4-M3
|
* @since 1.4-M3
|
||||||
*/
|
*/
|
||||||
@Path( "/runtimeInfoService/" )
|
@Path("/runtimeInfoService/")
|
||||||
public interface RuntimeInfoService
|
public interface RuntimeInfoService
|
||||||
{
|
{
|
||||||
@Path( "archivaRuntimeInfo/{locale}" )
|
@Path("archivaRuntimeInfo/{locale}")
|
||||||
@GET
|
@GET
|
||||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@RedbackAuthorization( noRestriction = true )
|
@RedbackAuthorization(noRestriction = true)
|
||||||
ApplicationRuntimeInfo getApplicationRuntimeInfo( @PathParam( "locale" ) String locale );
|
ApplicationRuntimeInfo getApplicationRuntimeInfo( @PathParam("locale") String locale )
|
||||||
|
throws ArchivaRestServiceException;
|
||||||
|
|
||||||
|
|
||||||
@Path( "logMissingI18n" )
|
@Path("logMissingI18n")
|
||||||
@GET
|
@GET
|
||||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@RedbackAuthorization( noRestriction = true )
|
@RedbackAuthorization(noRestriction = true)
|
||||||
Boolean logMissingI18n( @QueryParam( "key" ) String key );
|
Boolean logMissingI18n( @QueryParam("key") String key );
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@ package org.apache.archiva.web.model;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
@ -25,7 +27,7 @@ import java.util.Calendar;
|
||||||
* @author Olivier Lamy
|
* @author Olivier Lamy
|
||||||
* @since 1.4-M3
|
* @since 1.4-M3
|
||||||
*/
|
*/
|
||||||
@XmlRootElement( name = "applicationRuntimeInfo" )
|
@XmlRootElement(name = "applicationRuntimeInfo")
|
||||||
public class ApplicationRuntimeInfo
|
public class ApplicationRuntimeInfo
|
||||||
{
|
{
|
||||||
private boolean devMode = false;
|
private boolean devMode = false;
|
||||||
|
@ -46,6 +48,8 @@ public class ApplicationRuntimeInfo
|
||||||
|
|
||||||
private String timestampStr;
|
private String timestampStr;
|
||||||
|
|
||||||
|
private RedbackRuntimeConfiguration redbackRuntimeConfiguration;
|
||||||
|
|
||||||
public ApplicationRuntimeInfo()
|
public ApplicationRuntimeInfo()
|
||||||
{
|
{
|
||||||
this.devMode = Boolean.getBoolean( "archiva.devMode" );
|
this.devMode = Boolean.getBoolean( "archiva.devMode" );
|
||||||
|
@ -147,6 +151,16 @@ public class ApplicationRuntimeInfo
|
||||||
this.timestampStr = timestampStr;
|
this.timestampStr = timestampStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
|
||||||
|
{
|
||||||
|
return redbackRuntimeConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
|
||||||
|
{
|
||||||
|
this.redbackRuntimeConfiguration = redbackRuntimeConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
|
@ -161,6 +175,7 @@ public class ApplicationRuntimeInfo
|
||||||
sb.append( ", logMissingI18n=" ).append( logMissingI18n );
|
sb.append( ", logMissingI18n=" ).append( logMissingI18n );
|
||||||
sb.append( ", baseUrl='" ).append( baseUrl ).append( '\'' );
|
sb.append( ", baseUrl='" ).append( baseUrl ).append( '\'' );
|
||||||
sb.append( ", timestampStr='" ).append( timestampStr ).append( '\'' );
|
sb.append( ", timestampStr='" ).append( timestampStr ).append( '\'' );
|
||||||
|
sb.append( ", redbackRuntimeConfiguration=" ).append( redbackRuntimeConfiguration );
|
||||||
sb.append( '}' );
|
sb.append( '}' );
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,25 +96,30 @@ $.ajax({
|
||||||
"archiva.search": "archiva/search",
|
"archiva.search": "archiva/search",
|
||||||
"archiva.proxy-connectors-rules": "archiva/proxy-connectors-rules",
|
"archiva.proxy-connectors-rules": "archiva/proxy-connectors-rules",
|
||||||
"archiva.docs": "archiva/docs",
|
"archiva.docs": "archiva/docs",
|
||||||
"archiva.main": "archiva/main"
|
"archiva.main": "archiva/main",
|
||||||
|
"archiva.knockout.properties": "archiva/knockout-properties"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils','domReady!','archiva.main'], function () {
|
requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils','domReady!','archiva.main','archiva.general-admin'], function () {
|
||||||
loadi18n(function () {
|
loadi18n(function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(),
|
url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success:function(data){
|
success:function(data){
|
||||||
window.archivaDevMode=data.devMode;
|
window.archivaDevMode=data.devMode;
|
||||||
window.archivaJavascriptLog=data.javascriptLog;
|
window.archivaJavascriptLog=data.javascriptLog;
|
||||||
window.archivaRuntimeInfo=data;
|
window.archivaRuntimeInfo=data;
|
||||||
|
|
||||||
require(['sammy','jquery','i18n','jquery.tmpl','archiva.main','utils','domReady!'],function () {
|
window.redbackRuntimeConfiguration=mapRedbackRuntimeConfiguration(data.redbackRuntimeConfiguration);
|
||||||
startArchivaApplication();
|
|
||||||
$("#loadingDiv").hide();
|
$.log("security.rememberme.enabled key value:"+ window.redbackRuntimeConfiguration.findPropertyValue('security.rememberme.enabled'));
|
||||||
drawQuickSearchAutocomplete();
|
|
||||||
})
|
require(['sammy','jquery','i18n','jquery.tmpl','archiva.main','utils','domReady!'],function () {
|
||||||
|
startArchivaApplication();
|
||||||
|
$("#loadingDiv").hide();
|
||||||
|
drawQuickSearchAutocomplete();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid",
|
define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid",
|
||||||
"knockout.sortable","jquery.validate","bootstrap"]
|
"knockout.sortable","jquery.validate","bootstrap","archiva.knockout.properties"]
|
||||||
, function(jquery,i18n,utils,jqueryTmpl,ko) {
|
, function(jquery,i18n,utils,jqueryTmpl,ko) {
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
@ -1169,6 +1169,16 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
self.modified(true);
|
self.modified(true);
|
||||||
$.log("configurationPropertiesEntries modified")
|
$.log("configurationPropertiesEntries modified")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.findPropertyValue=function(key){
|
||||||
|
for(var i=0;i<self.configurationPropertiesEntries().length;i++){
|
||||||
|
if(self.configurationPropertiesEntries()[i].key==key){
|
||||||
|
var val = self.configurationPropertiesEntries()[i].value;
|
||||||
|
$.log("findPropertyValue " + key + "->" + val);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapRedbackRuntimeConfiguration=function(data){
|
mapRedbackRuntimeConfiguration=function(data){
|
||||||
|
@ -1252,6 +1262,24 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
|
|
||||||
this.usedUserManagerImpls=ko.observableArray([]);
|
this.usedUserManagerImpls=ko.observableArray([]);
|
||||||
|
|
||||||
|
self.gridViewModel = new ko.simpleGrid.viewModel({
|
||||||
|
data: self.redbackRuntimeConfiguration().configurationPropertiesEntries,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
headerText: $.i18n.prop('redback.runtime.properties.key.label'),
|
||||||
|
rowText: "key"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
headerText: $.i18n.prop('redback.runtime.properties.value.label'),
|
||||||
|
rowText: "value"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
pageSize: 10,//self.redbackRuntimeConfiguration().configurationPropertiesEntries.length,
|
||||||
|
gridUpdateCallBack: function(){
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
findUserManagerImplementationInformation=function(id){
|
findUserManagerImplementationInformation=function(id){
|
||||||
for(var i= 0;i<self.userManagerImplementationInformations().length;i++){
|
for(var i= 0;i<self.userManagerImplementationInformations().length;i++){
|
||||||
$.log(id+""+self.userManagerImplementationInformations()[i].beanId);
|
$.log(id+""+self.userManagerImplementationInformations()[i].beanId);
|
||||||
|
@ -1358,14 +1386,13 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
var userMessages=$("#user-messages");
|
var userMessages=$("#user-messages");
|
||||||
userMessages.html(mediumSpinnerImg());
|
userMessages.html(mediumSpinnerImg());
|
||||||
self.redbackRuntimeConfiguration().userManagerImpls=ko.observableArray([]);
|
self.redbackRuntimeConfiguration().userManagerImpls=ko.observableArray([]);
|
||||||
$.log("length:"+self.usedUserManagerImpls().length);
|
|
||||||
for(var i=0;i<self.usedUserManagerImpls().length;i++){
|
for(var i=0;i<self.usedUserManagerImpls().length;i++){
|
||||||
var beanId=self.usedUserManagerImpls()[i].beanId;
|
var beanId=self.usedUserManagerImpls()[i].beanId;
|
||||||
$.log("beanId:"+beanId);
|
$.log("beanId:"+beanId);
|
||||||
self.redbackRuntimeConfiguration().userManagerImpls.push(beanId);
|
self.redbackRuntimeConfiguration().userManagerImpls.push(beanId);
|
||||||
}
|
}
|
||||||
$.log("length:"+self.redbackRuntimeConfiguration().userManagerImpls().length);
|
$.log("rememberme enabled:"+self.redbackRuntimeConfiguration().findPropertyValue("security.rememberme.enabled"));
|
||||||
$.log("json:"+ko.toJSON(self.redbackRuntimeConfiguration));
|
|
||||||
$.ajax("restServices/archivaServices/archivaRuntimeConfigurationService/redbackRuntimeConfiguration",
|
$.ajax("restServices/archivaServices/archivaRuntimeConfigurationService/redbackRuntimeConfiguration",
|
||||||
{
|
{
|
||||||
type: "PUT",
|
type: "PUT",
|
||||||
|
@ -1426,11 +1453,12 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
// TODO use window.redbackRuntimeConfiguration ?
|
||||||
var redbackRuntimeConfiguration = mapRedbackRuntimeConfiguration(data);
|
var redbackRuntimeConfiguration = mapRedbackRuntimeConfiguration(data);
|
||||||
var redbackRuntimeConfigurationViewModel =
|
var redbackRuntimeConfigurationViewModel =
|
||||||
new RedbackRuntimeConfigurationViewModel(redbackRuntimeConfiguration,userManagerImplementationInformations);
|
new RedbackRuntimeConfigurationViewModel(redbackRuntimeConfiguration,userManagerImplementationInformations);
|
||||||
mainContent.html( $( "#runtime-configuration-main" ).tmpl() );
|
mainContent.html( $("#redback-runtime-configuration-main" ).tmpl() );
|
||||||
ko.applyBindings(redbackRuntimeConfigurationViewModel,$("#runtime-configuration-content" ).get(0));
|
ko.applyBindings(redbackRuntimeConfigurationViewModel,$("#redback-runtime-configuration-content" ).get(0));
|
||||||
activatePopoverDoc();
|
activatePopoverDoc();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -359,14 +359,28 @@ require(["jquery","jquery.tmpl","i18n","knockout"], function(jquery,jqueryTmpl,i
|
||||||
*/
|
*/
|
||||||
Entry=function(key,value,subscribeFn){
|
Entry=function(key,value,subscribeFn){
|
||||||
var self=this;
|
var self=this;
|
||||||
|
this.modified=ko.observable(false);
|
||||||
|
this.modified.subscribe(function(newValue){
|
||||||
|
$.log("Entry modified");
|
||||||
|
});
|
||||||
|
|
||||||
this.key=ko.observable(key);
|
this.key=ko.observable(key);
|
||||||
if(subscribeFn){
|
this.key.subscribe(function(newValue){
|
||||||
this.key.subscribe(function(newValue){subscribeFn(newValue)});
|
self.modified(true);
|
||||||
}
|
if(subscribeFn){
|
||||||
|
subscribeFn(newValue)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.value=ko.observable(value);
|
this.value=ko.observable(value);
|
||||||
if(subscribeFn){
|
this.value.subscribe(function(newValue){
|
||||||
this.value.subscribe(function(newValue){$.log("value modified");subscribeFn(newValue);});
|
self.modified(true);
|
||||||
}
|
if(subscribeFn){
|
||||||
|
subscribeFn(newValue)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,76 +11,76 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(function(factory) {
|
(function(factory) {
|
||||||
if (typeof define === "function" && define.amd) {
|
if (typeof define === "function" && define.amd) {
|
||||||
// AMD anonymous module
|
// AMD anonymous module
|
||||||
define("knockout.simpleGrid",["jquery","knockout","utils","i18n"], factory);
|
define("knockout.simpleGrid",["jquery","knockout","utils","i18n"], factory);
|
||||||
} else {
|
} else {
|
||||||
// No module loader (plain <script> tag) - put directly in global namespace
|
// No module loader (plain <script> tag) - put directly in global namespace
|
||||||
factory(window.ko, jQuery);
|
factory(window.ko, jQuery);
|
||||||
}
|
}
|
||||||
})(function ($,ko,utils,i18n) {
|
})(function ($,ko,utils,i18n) {
|
||||||
|
|
||||||
|
|
||||||
ko.simpleGrid = {
|
ko.simpleGrid = {
|
||||||
// Defines a view model class you can use to populate a grid
|
// Defines a view model class you can use to populate a grid
|
||||||
viewModel: function (configuration) {
|
viewModel: function (configuration) {
|
||||||
this.data = configuration.data;
|
this.data = configuration.data;
|
||||||
this.currentPageIndex = ko.observable(0);
|
this.currentPageIndex = ko.observable(0);
|
||||||
this.pageSize = configuration.pageSize || 5;
|
this.pageSize = configuration.pageSize || 5;
|
||||||
this.columns = configuration.columns;
|
this.columns = configuration.columns;
|
||||||
|
|
||||||
this.itemsOnCurrentPage = ko.computed(function () {
|
this.itemsOnCurrentPage = ko.computed(function () {
|
||||||
var startIndex = this.pageSize * this.currentPageIndex();
|
var startIndex = this.pageSize * this.currentPageIndex();
|
||||||
return this.data.slice(startIndex, startIndex + this.pageSize);
|
return this.data.slice(startIndex, startIndex + this.pageSize);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.maxPageIndex = ko.computed(function () {
|
this.maxPageIndex = ko.computed(function () {
|
||||||
return Math.ceil(ko.utils.unwrapObservable(this.data).length / this.pageSize);
|
return Math.ceil(ko.utils.unwrapObservable(this.data).length / this.pageSize);
|
||||||
}, this);
|
}, this);
|
||||||
this.i18n=function(key){
|
this.i18n=function(key){
|
||||||
return $.i18n.prop(key);
|
return $.i18n.prop(key);
|
||||||
};
|
};
|
||||||
this.gridUpdateCallBack = configuration.gridUpdateCallBack;
|
this.gridUpdateCallBack = configuration.gridUpdateCallBack;
|
||||||
this.pageLinksUpdateCallBack = configuration.pageLinksUpdateCallBack;
|
this.pageLinksUpdateCallBack = configuration.pageLinksUpdateCallBack;
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Templates used to render the grid
|
||||||
|
var templateEngine = new ko.jqueryTmplTemplateEngine();
|
||||||
|
|
||||||
|
|
||||||
|
// The "simpleGrid" binding
|
||||||
|
ko.bindingHandlers.simpleGrid = {
|
||||||
|
// This method is called to initialize the node, and will also be called again if you change what the grid is bound to
|
||||||
|
update: function (element, viewModelAccessor, allBindingsAccessor) {
|
||||||
|
var viewModel = viewModelAccessor(), allBindings = allBindingsAccessor();
|
||||||
|
|
||||||
|
// Empty the element
|
||||||
|
while(element.firstChild) {
|
||||||
|
ko.removeNode(element.firstChild);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// Templates used to render the grid
|
// Allow the default templates to be overridden
|
||||||
var templateEngine = new ko.jqueryTmplTemplateEngine();
|
var gridTemplateName = allBindings.simpleGridTemplate || "ko_usersGrid_grid",
|
||||||
|
pageLinksTemplateName = allBindings.simpleGridPagerTemplate || "ko_simpleGrid_pageLinks";
|
||||||
|
|
||||||
|
// Render the main grid
|
||||||
|
var gridContainer = element.appendChild(document.createElement("DIV"));
|
||||||
|
ko.renderTemplate(gridTemplateName, viewModel, { templateEngine: templateEngine }, gridContainer, "replaceNode")
|
||||||
|
.subscribe(viewModel.gridUpdateCallBack?viewModel.gridUpdateCallBack:function(){});
|
||||||
|
|
||||||
// The "simpleGrid" binding
|
if (viewModel.gridUpdateCallBack) viewModel.gridUpdateCallBack();
|
||||||
ko.bindingHandlers.simpleGrid = {
|
|
||||||
// This method is called to initialize the node, and will also be called again if you change what the grid is bound to
|
|
||||||
update: function (element, viewModelAccessor, allBindingsAccessor) {
|
|
||||||
var viewModel = viewModelAccessor(), allBindings = allBindingsAccessor();
|
|
||||||
|
|
||||||
// Empty the element
|
// Render the page links
|
||||||
while(element.firstChild) {
|
var pageLinksContainer = $("#"+allBindings.pageLinksId).get(0);
|
||||||
ko.removeNode(element.firstChild);
|
var renderedTemplate = ko.renderTemplate(pageLinksTemplateName, viewModel, { templateEngine: templateEngine }, pageLinksContainer, "replaceNode");
|
||||||
}
|
if (renderedTemplate.subscribe){
|
||||||
|
renderedTemplate.subscribe(viewModel.pageLinksUpdateCallBack?viewModel.pageLinksUpdateCallBack:function(){});
|
||||||
// Allow the default templates to be overridden
|
}
|
||||||
var gridTemplateName = allBindings.simpleGridTemplate || "ko_usersGrid_grid",
|
if (viewModel.pageLinksUpdateCallBack) viewModel.pageLinksUpdateCallBack();
|
||||||
pageLinksTemplateName = allBindings.simpleGridPagerTemplate || "ko_simpleGrid_pageLinks";
|
}
|
||||||
|
};
|
||||||
// Render the main grid
|
|
||||||
var gridContainer = element.appendChild(document.createElement("DIV"));
|
|
||||||
ko.renderTemplate(gridTemplateName, viewModel, { templateEngine: templateEngine }, gridContainer, "replaceNode")
|
|
||||||
.subscribe(viewModel.gridUpdateCallBack?viewModel.gridUpdateCallBack:function(){});
|
|
||||||
|
|
||||||
if (viewModel.gridUpdateCallBack) viewModel.gridUpdateCallBack();
|
|
||||||
|
|
||||||
// Render the page links
|
|
||||||
var pageLinksContainer = $("#"+allBindings.pageLinksId).get(0);
|
|
||||||
var renderedTemplate = ko.renderTemplate(pageLinksTemplateName, viewModel, { templateEngine: templateEngine }, pageLinksContainer, "replaceNode");
|
|
||||||
if (renderedTemplate.subscribe){
|
|
||||||
renderedTemplate.subscribe(viewModel.pageLinksUpdateCallBack?viewModel.pageLinksUpdateCallBack:function(){});
|
|
||||||
}
|
|
||||||
if (viewModel.pageLinksUpdateCallBack) viewModel.pageLinksUpdateCallBack();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -366,6 +366,16 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) {
|
||||||
$.log("user not in cookie");
|
$.log("user not in cookie");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rememberMe=window.redbackRuntimeConfiguration.findPropertyValue('security.rememberme.enabled');
|
||||||
|
$.log("rememberMe:"+rememberMe);
|
||||||
|
if (rememberMe!='true'){
|
||||||
|
$("#user-login-form-rememberme-label" ).hide();
|
||||||
|
$("#user-login-form-rememberme" ).attr("disabled","true");
|
||||||
|
if($("#user-login-form-rememberme" ).get(0 ).checked){
|
||||||
|
$("#user-login-form-rememberme" ).get(0 ).checked=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var userLoginForm = $("#user-login-form");
|
var userLoginForm = $("#user-login-form");
|
||||||
|
|
||||||
userLoginForm.validate({
|
userLoginForm.validate({
|
||||||
|
|
|
@ -886,11 +886,11 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="runtime-configuration-main">
|
<script type="text/html" id="redback-runtime-configuration-main">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h2>${$.i18n.prop('redback-runtime-configuration.title')}</h2>
|
<h2>${$.i18n.prop('redback-runtime-configuration.title')}</h2>
|
||||||
</div>
|
</div>
|
||||||
<div id="runtime-configuration-content" data-bind='template: {name:"redback-runtime-configuration-content-tmpl"}'>
|
<div id="redback-runtime-configuration-content" data-bind='template: {name:"redback-runtime-configuration-content-tmpl"}'>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1013,44 +1013,46 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane" id="redback-runtime-properties-content">
|
<div class="tab-pane" id="redback-runtime-properties-content">
|
||||||
<div class="well">
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>${$.i18n.prop('redback.runtime.properties.key.label')}</th>
|
|
||||||
<th>${$.i18n.prop('redback.runtime.properties.value.label')}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{{each(i, property) redbackRuntimeConfiguration().configurationPropertiesEntries}}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
{{var key = property.key}}
|
|
||||||
<a class="popover-doc"
|
|
||||||
data-original-title="${$.i18n.prop('redback.runtime.properties.help.title')}"
|
|
||||||
data-content="${$.i18n.prop(key+'.help.content')}">
|
|
||||||
<span class="btn btn-info"><i class="icon-question-sign icon-white"></i></span>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td><input type="text" class="input-xxlarge" value="${property.key}"></td>
|
|
||||||
<td><input type="text" class="input-xlarge" value="${property.value}"></td>
|
|
||||||
</tr>
|
|
||||||
{{/each}}
|
|
||||||
</tbody>
|
|
||||||
|
|
||||||
|
<div class="well">
|
||||||
|
<table id="proxyConnectorsTable"
|
||||||
|
data-bind="simpleGrid: gridViewModel,simpleGridTemplate:'properties-grid',pageLinksId:'properties-grid-pagination'">
|
||||||
</table>
|
</table>
|
||||||
|
<div id="properties-grid-pagination"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button data-bind="click: saveRedbackRuntimeConfiguration,css:{ 'btn-warning': redbackRuntimeConfiguration().modified() | redbackRuntimeConfiguration().ldapConfiguration().modified() }"
|
<button data-bind="click: saveRedbackRuntimeConfiguration,css:{ 'btn-warning': redbackRuntimeConfiguration().modified() | redbackRuntimeConfiguration().ldapConfiguration().modified() }"
|
||||||
id="redback-archiva-runtime-configuration-save"class="btn">${$.i18n.prop('save')}</button>
|
id="redback-runtime-configuration-save"class="btn">${$.i18n.prop('save')}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script id="configurationPropertiesEntries-tmpl" type="text/html">
|
<script id='properties-grid' type='text/html'>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>${$.i18n.prop('redback.runtime.properties.key.label')}</th>
|
||||||
|
<th>${$.i18n.prop('redback.runtime.properties.value.label')}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{each(i, row) itemsOnCurrentPage()}}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{var key = row.key}}
|
||||||
|
<a class="popover-doc"
|
||||||
|
data-original-title="${$.i18n.prop('redback.runtime.properties.help.title')}"
|
||||||
|
data-content="${$.i18n.prop(key+'.help.content')}">
|
||||||
|
<span class="btn btn-info"><i class="icon-question-sign icon-white"></i></span>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>${row.key}</td>
|
||||||
|
<td><input type="text" class="input-xxlarge" data-bind="value: row.value"></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer" id="modal-login-footer">
|
<div class="modal-footer" id="modal-login-footer">
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
<label class="checkbox">
|
<label class="checkbox" id="user-login-form-rememberme-label">
|
||||||
<input type="checkbox" id="user-login-form-rememberme">${$.i18n.prop('rememberme')}
|
<input type="checkbox" id="user-login-form-rememberme">${$.i18n.prop('rememberme')}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue