Author: olamy
Date: Thu Dec 13 15:37:32 2012
New Revision: 1421342
URL: http://svn.apache.org/viewvc?rev=1421342&view=rev
Log:
add some labels
add a modified observer to change save button when something has changed.
Modified:
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html
Modified:
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
URL:
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties?rev=1421342&r1=1421341&r2=1421342&view=diff
==============================================================================
---
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
(original)
+++
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
Thu Dec 13 15:37:32 2012
@@ -593,5 +593,9 @@ redback.runtime.ldap.ssl.label=ssl enabl
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.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
Modified:
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
URL:
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js?rev=1421342&r1=1421341&r2=1421342&view=diff
==============================================================================
---
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
(original)
+++
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
Thu Dec 13 15:37:32 2012
@@ -1152,52 +1152,84 @@ define("archiva.general-admin",["jquery"
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){
@@ -1259,8 +1291,8 @@ define("archiva.general-admin",["jquery"
}
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(){
Modified:
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
URL:
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js?rev=1421342&r1=1421341&r2=1421342&view=diff
==============================================================================
---
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
(original)
+++
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
Thu Dec 13 15:37:32 2012
@@ -355,11 +355,18 @@ require(["jquery","jquery.tmpl","i18n","
* mapping for a java Map entry
* @param key
* @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;
this.key=ko.observable(key);
+ if(subscribeFn){
+ this.key.subscribe(function(newValue){subscribeFn(newValue)});
+ }
this.value=ko.observable(value);
+ if(subscribeFn){
+ this.value.subscribe(function(newValue){$.log("value
modified");subscribeFn(newValue);});
+ }
}
/**
Modified:
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html
URL:
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html?rev=1421342&r1=1421341&r2=1421342&view=diff
==============================================================================
---
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html
(original)
+++
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html
Thu Dec 13 15:37:32 2012
@@ -906,18 +906,16 @@
<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>
@@ -1003,8 +1001,8 @@
<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>
@@ -1026,17 +1024,19 @@
</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}