[MRM-1629] Add a configuration field for the application url.

add form to setup data.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1342458 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-05-24 22:00:11 +00:00
parent 25b768a317
commit c6f34d133f
3 changed files with 79 additions and 1 deletions

View File

@ -561,7 +561,59 @@ define("archiva.general-admin",["jquery","i18n","order!utils","order!jquery.tmpl
}
//---------------------------
// system status part
// UiConfiguration part
//---------------------------
displayUiConfiguration=function(){
screenChange();
var mainContent=$("#main-content");
mainContent.html(mediumSpinnerImg());
$.ajax("restServices/archivaServices/archivaAdministrationService/getNetworkConfiguration", {
type: "GET",
dataType: 'json',
success: function(data){
mainContent.html($("#ui-configuration-screen").tmpl());
var uiConfiguration=new UiConfiguration(data.showFindArtifacts,data.appletFindEnabled,data.disableEasterEggs,data.applicationUrl);
var uiConfigurationViewModel=new UiConfigurationViewModel(uiConfiguration);
ko.applyBindings(uiConfigurationViewModel,mainContent.get(0));
/*var validator = mainContent.find("#network-configuration-edit-form").validate({
showErrors: function(validator, errorMap, errorList) {
customShowError(mainContent.find("#network-configuration-edit-form" ).get(0),validator,errorMap,errorMap);
}
});*/
}
});
}
UiConfiguration=function(showFindArtifacts,appletFindEnabled,disableEasterEggs,applicationUrl){
this.showFindArtifacts = ko.observable(showFindArtifacts);
this.appletFindEnabled = ko.observable(appletFindEnabled);
this.disableEasterEggs = ko.observable(disableEasterEggs);
this.applicationUrl = ko.observable(applicationUrl);
}
UiConfigurationViewModel=function(uiConfiguration){
this.uiConfiguration=ko.observable(uiConfiguration);
var self=this;
save=function(){
$.ajax("restServices/archivaServices/archivaAdministrationService/setUiConfiguration", {
type: "POST",
contentType: 'application/json',
data: ko.toJSON(self.uiConfiguration),
dataType: 'json',
success: function(data){
displaySuccessMessage( $.i18n.prop("ui-configuration.updated"));
}
});
}
}
//---------------------------
// System status part
//---------------------------
QueueEntry=function(key,entriesNumber){

View File

@ -124,6 +124,10 @@ function() {
displayRepositoriesGrid();
return;
}
if (screen=='ui-configuration'&& hasKarma('archiva-manage-configuration')){
displayUiConfiguration();
return;
}
if (screen=="browse"){
displayBrowse(true);

View File

@ -315,6 +315,28 @@
</form>
</script>
<script id="ui-configuration-screen" type="text/html">
<div class="page-header">
<h4>${$.i18n.prop('ui-configuration.header')}</h4>
</div>
<div id="ui-configuration-form" data-bind='template: {name:"ui-configuration-form-tmpl"}'></div>
</script>
<script id="ui-configuration-form-tmpl" type="text/html">
<form id="ui-configuration-edit-form" class="well form-horizontal">
<fieldset id="ui-configuration-edit-fieldset">
<div class="control-group">
<label class="control-label" for="maxTotal">${$.i18n.prop('ui-configuration.applicationUrl')}</label>
<div class="controls">
<input type="text" class="xlarge required digits" id="applicationUrl" name="applicationUrl" size="8"
data-bind="value: uiConfiguration().applicationUrl"/>
</div>
</div>
</fieldset>
<button id="ui-configuration-btn-save" data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
</form>
</script>
<script id="system-status-main" type="text/html">
<div class="page-header">
<h4>${$.i18n.prop('system-status.header.version.info')}</h4>