ArchivaRuntimeConfiguration=function(userManagerImpls,ldapConfiguration,migratedFromRedbackConfiguration,configurationPropertiesEntries){
+ var self=this;
+ this.modified=ko.observable(false);
+ this.modified.subscribe(function(newValue){$.log("ArchivaRuntimeConfiguration modified")});
+
this.userManagerImpls=ko.observableArray(userManagerImpls);
+ this.userManagerImpls.subscribe(function(newValue){self.modified(true)});
+
this.ldapConfiguration=ko.observable(ldapConfiguration);
+ this.ldapConfiguration.subscribe(function(newValue){self.modified(true)});
+
this.migratedFromRedbackConfiguration=ko.observable(migratedFromRedbackConfiguration);
+
this.configurationPropertiesEntries=ko.observableArray(configurationPropertiesEntries?configurationPropertiesEntries:[]);
+ this.configurationPropertiesEntries.subscribe(function(newValue){
+ self.modified(true);
+ $.log("configurationPropertiesEntries modified")
+ });
}
mapArchivaRuntimeConfiguration=function(data){
+ var archivaRuntimeConfiguration =
+ new ArchivaRuntimeConfiguration(data.userManagerImpls,mapLdapConfiguration(data.ldapConfiguration),data.migratedFromRedbackConfiguration);
+
var configurationPropertiesEntries = data.configurationPropertiesEntries == null ? []: $.each(data.configurationPropertiesEntries,function(item){
- return new Entry(item.key, item.value);
+ return new Entry(item.key, item.value,function(newValue){
+ archivaRuntimeConfiguration.modified(true);
+ });
});
if (!$.isArray(configurationPropertiesEntries)){
- configurationPropertiesEntries=[];
+ configurationPropertiesEntries=[];
}
+ archivaRuntimeConfiguration.configurationPropertiesEntries(configurationPropertiesEntries);
+ archivaRuntimeConfiguration.modified(false);
+ return archivaRuntimeConfiguration;
- return new ArchivaRuntimeConfiguration(data.userManagerImpls,mapLdapConfiguration(data.ldapConfiguration),data.migratedFromRedbackConfiguration,
- configurationPropertiesEntries);
}
LdapConfiguration=function(hostName,port,ssl,baseDn,contextFactory,bindDn,password,authenticationMethod,
extraPropertiesEntries){
+
+ var self=this;
+ this.modified=ko.observable(false);
+
//private String hostName;
this.hostName=ko.observable(hostName);
+ this.hostName.subscribe(function(newValue){self.modified(true)});
//private String port;
this.port=ko.observable(port);
+ this.port.subscribe(function(newValue){self.modified(true)});
//private boolean ssl = false;
this.ssl=ko.observable(ssl);
+ this.ssl.subscribe(function(newValue){self.modified(true)});
//private String baseDn;
this.baseDn=ko.observable(baseDn);
+ this.baseDn.subscribe(function(newValue){self.modified(true)});
//private String contextFactory;
this.contextFactory=ko.observable(contextFactory);
+ this.contextFactory.subscribe(function(newValue){self.modified(true)});
//private String bindDn;
this.bindDn=ko.observable(bindDn);
+ this.bindDn.subscribe(function(newValue){self.modified(true)});
//private String password;
this.password=ko.observable(password);
+ this.password.subscribe(function(newValue){self.modified(true)});
//private String authenticationMethod;
this.authenticationMethod=ko.observable(authenticationMethod);
+ this.authenticationMethod.subscribe(function(newValue){self.modified(true)});
this.extraPropertiesEntries=ko.observableArray(extraPropertiesEntries);
+ this.extraPropertiesEntries.subscribe(function(newValue){self.modified(true)});
}
mapLdapConfiguration=function(data){
}
userManagerImplMoved=function(arg){
- $.log("userManagerImplMoved:"+arg.sourceIndex+" to " + arg.targetIndex);
- //self.usedUserManagerImpls().push(self.availableUserManagerImpls()[arg.sourceIndex]);
+ $.log("userManagerImplMoved");
+ self.archivaRuntimeConfiguration().modified(true);
}
saveArchivaRuntimeConfiguration=function(){
<div class="well">
<div class="row-fluid">
<div class="span4 dotted">
- <h5></h5>
- <hr/>
+ <h5>${$.i18n.prop('redback.runtime.user-managers.impls.choosed')}</h5>
<div style="min-height: 40px" id="user-mananagers-sortables-choosed"
- data-bind="sortable: { template: 'redback-runtime-general-content-usermanagers', data:usedUserManagerImpls}">
+ data-bind="sortable: { template: 'redback-runtime-general-content-usermanagers', data:usedUserManagerImpls,afterMove: userManagerImplMoved}">
</div>
</div>
<div class="span4 dotted">
- <h5></h5>
- <hr/>
+ <h5>${$.i18n.prop('redback.runtime.user-managers.impls.available')}</h5>
<div style="min-height: 40px"id="user-mananagers-sortables-availables"
- data-bind="sortable: {template: 'redback-runtime-general-content-usermanagers',data:availableUserManagerImpls}">
+ data-bind="sortable: {template: 'redback-runtime-general-content-usermanagers',data:availableUserManagerImpls,afterMove: userManagerImplMoved}">
</div>
</div>
</div>
<thead>
<tr>
<th></th>
- <th>key</th>
- <th>value</th>
+ <th>${$.i18n.prop('redback.runtime.properties.key.label')}</th>
+ <th>${$.i18n.prop('redback.runtime.properties.value.label')}</th>
</tr>
</thead>
<tbody>
</table>
</div>
- </div>
</div>
<div>
- <button data-bind="click: saveArchivaRuntimeConfiguration" id="archiva-runtime-configuration-save"
- class="btn">${$.i18n.prop('save')}
- </button>
+ <button data-bind="click: saveArchivaRuntimeConfiguration,css:{ 'btn-warning': archivaRuntimeConfiguration().modified() | archivaRuntimeConfiguration().ldapConfiguration().modified() }"
+ id="archiva-runtime-configuration-save"class="btn">${$.i18n.prop('save')}</button>
</div>
</script>
+<script id="configurationPropertiesEntries-tmpl" type="text/html">
+
+</script>
+
<script id="redback-runtime-general-content-usermanagers" type="text/html">
<div class="well draggable-item">
${$data.description}