add some labels

add a modified observer to change save button when something has changed.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1421342 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-12-13 15:37:32 +00:00
parent 7627b9d8b7
commit fedd25bc10
4 changed files with 62 additions and 19 deletions

View File

@ -593,5 +593,9 @@ redback.runtime.ldap.ssl.label=ssl enabled
redback.runtime.ldap.authenticationMethod.label=authenticationMethod redback.runtime.ldap.authenticationMethod.label=authenticationMethod
ldap.bind.authenticator.enabled.help.content=Will toggle the use of authenticator that will authenticate using the bind operation. ldap.bind.authenticator.enabled.help.content=Will toggle the use of authenticator that will authenticate using the bind operation.
ldap.bind.authenticator.allowEmptyPasswords.help.content=Allow to use empty password with Ldap authenticator. ldap.bind.authenticator.allowEmptyPasswords.help.content=Allow to use empty password with Ldap authenticator.
redback.runtime.properties.key.label=Key
redback.runtime.properties.value.label=Value
redback.runtime.user-managers.impls.choosed=UserManager(s) choosed
redback.runtime.user-managers.impls.available=UserManager(s) availables

View File

@ -1152,52 +1152,84 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
ArchivaRuntimeConfiguration=function(userManagerImpls,ldapConfiguration,migratedFromRedbackConfiguration,configurationPropertiesEntries){ 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=ko.observableArray(userManagerImpls);
this.userManagerImpls.subscribe(function(newValue){self.modified(true)});
this.ldapConfiguration=ko.observable(ldapConfiguration); this.ldapConfiguration=ko.observable(ldapConfiguration);
this.ldapConfiguration.subscribe(function(newValue){self.modified(true)});
this.migratedFromRedbackConfiguration=ko.observable(migratedFromRedbackConfiguration); this.migratedFromRedbackConfiguration=ko.observable(migratedFromRedbackConfiguration);
this.configurationPropertiesEntries=ko.observableArray(configurationPropertiesEntries?configurationPropertiesEntries:[]); this.configurationPropertiesEntries=ko.observableArray(configurationPropertiesEntries?configurationPropertiesEntries:[]);
this.configurationPropertiesEntries.subscribe(function(newValue){
self.modified(true);
$.log("configurationPropertiesEntries modified")
});
} }
mapArchivaRuntimeConfiguration=function(data){ mapArchivaRuntimeConfiguration=function(data){
var archivaRuntimeConfiguration =
new ArchivaRuntimeConfiguration(data.userManagerImpls,mapLdapConfiguration(data.ldapConfiguration),data.migratedFromRedbackConfiguration);
var configurationPropertiesEntries = data.configurationPropertiesEntries == null ? []: $.each(data.configurationPropertiesEntries,function(item){ 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)){ 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, LdapConfiguration=function(hostName,port,ssl,baseDn,contextFactory,bindDn,password,authenticationMethod,
extraPropertiesEntries){ extraPropertiesEntries){
var self=this;
this.modified=ko.observable(false);
//private String hostName; //private String hostName;
this.hostName=ko.observable(hostName); this.hostName=ko.observable(hostName);
this.hostName.subscribe(function(newValue){self.modified(true)});
//private String port; //private String port;
this.port=ko.observable(port); this.port=ko.observable(port);
this.port.subscribe(function(newValue){self.modified(true)});
//private boolean ssl = false; //private boolean ssl = false;
this.ssl=ko.observable(ssl); this.ssl=ko.observable(ssl);
this.ssl.subscribe(function(newValue){self.modified(true)});
//private String baseDn; //private String baseDn;
this.baseDn=ko.observable(baseDn); this.baseDn=ko.observable(baseDn);
this.baseDn.subscribe(function(newValue){self.modified(true)});
//private String contextFactory; //private String contextFactory;
this.contextFactory=ko.observable(contextFactory); this.contextFactory=ko.observable(contextFactory);
this.contextFactory.subscribe(function(newValue){self.modified(true)});
//private String bindDn; //private String bindDn;
this.bindDn=ko.observable(bindDn); this.bindDn=ko.observable(bindDn);
this.bindDn.subscribe(function(newValue){self.modified(true)});
//private String password; //private String password;
this.password=ko.observable(password); this.password=ko.observable(password);
this.password.subscribe(function(newValue){self.modified(true)});
//private String authenticationMethod; //private String authenticationMethod;
this.authenticationMethod=ko.observable(authenticationMethod); this.authenticationMethod=ko.observable(authenticationMethod);
this.authenticationMethod.subscribe(function(newValue){self.modified(true)});
this.extraPropertiesEntries=ko.observableArray(extraPropertiesEntries); this.extraPropertiesEntries=ko.observableArray(extraPropertiesEntries);
this.extraPropertiesEntries.subscribe(function(newValue){self.modified(true)});
} }
mapLdapConfiguration=function(data){ mapLdapConfiguration=function(data){
@ -1259,8 +1291,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
} }
userManagerImplMoved=function(arg){ userManagerImplMoved=function(arg){
$.log("userManagerImplMoved:"+arg.sourceIndex+" to " + arg.targetIndex); $.log("userManagerImplMoved");
//self.usedUserManagerImpls().push(self.availableUserManagerImpls()[arg.sourceIndex]); self.archivaRuntimeConfiguration().modified(true);
} }
saveArchivaRuntimeConfiguration=function(){ saveArchivaRuntimeConfiguration=function(){

View File

@ -355,11 +355,18 @@ require(["jquery","jquery.tmpl","i18n","knockout"], function(jquery,jqueryTmpl,i
* mapping for a java Map entry * mapping for a java Map entry
* @param key * @param key
* @param value * @param value
* @param subscribeFn if any will be called as subscrible function field
*/ */
Entry=function(key,value){ Entry=function(key,value,subscribeFn){
var self=this; var self=this;
this.key=ko.observable(key); this.key=ko.observable(key);
if(subscribeFn){
this.key.subscribe(function(newValue){subscribeFn(newValue)});
}
this.value=ko.observable(value); this.value=ko.observable(value);
if(subscribeFn){
this.value.subscribe(function(newValue){$.log("value modified");subscribeFn(newValue);});
}
} }
/** /**

View File

@ -906,18 +906,16 @@
<div class="well"> <div class="well">
<div class="row-fluid"> <div class="row-fluid">
<div class="span4 dotted"> <div class="span4 dotted">
<h5></h5> <h5>${$.i18n.prop('redback.runtime.user-managers.impls.choosed')}</h5>
<hr/>
<div style="min-height: 40px" id="user-mananagers-sortables-choosed" <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> </div>
<div class="span4 dotted"> <div class="span4 dotted">
<h5></h5> <h5>${$.i18n.prop('redback.runtime.user-managers.impls.available')}</h5>
<hr/>
<div style="min-height: 40px"id="user-mananagers-sortables-availables" <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> </div>
</div> </div>
@ -1003,8 +1001,8 @@
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
<th>key</th> <th>${$.i18n.prop('redback.runtime.properties.key.label')}</th>
<th>value</th> <th>${$.i18n.prop('redback.runtime.properties.value.label')}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -1027,16 +1025,18 @@
</table> </table>
</div> </div>
</div> </div>
</div>
<div> <div>
<button data-bind="click: saveArchivaRuntimeConfiguration" id="archiva-runtime-configuration-save" <button data-bind="click: saveArchivaRuntimeConfiguration,css:{ 'btn-warning': archivaRuntimeConfiguration().modified() | archivaRuntimeConfiguration().ldapConfiguration().modified() }"
class="btn">${$.i18n.prop('save')} id="archiva-runtime-configuration-save"class="btn">${$.i18n.prop('save')}</button>
</button>
</div> </div>
</script> </script>
<script id="configurationPropertiesEntries-tmpl" type="text/html">
</script>
<script id="redback-runtime-general-content-usermanagers" type="text/html"> <script id="redback-runtime-general-content-usermanagers" type="text/html">
<div class="well draggable-item"> <div class="well draggable-item">
${$data.description} ${$data.description}