merge screens in the same

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1426732 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-12-29 09:57:26 +00:00
parent 92b2b98183
commit 8e7b524cbc
3 changed files with 88 additions and 62 deletions

View File

@ -609,15 +609,17 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
}
},
showErrors: function(validator, errorMap, errorList) {
customShowError("#main-content #appearance-configuration-form-id", validator, errorMap, errorMap);
$.log("activateOrganisationInformationFormValidation#customShowError");
customShowError($("#main-content" ).find("#appearance-configuration-form-id"), validator, errorMap, errorMap);
}
});
}
OrganisationInformationViewModel=function(organisationInformation){
activateOrganisationInformationFormValidation();
this.organisationInformation=ko.observable(organisationInformation);
this.save=function(){
$.log("OrganisationInformationViewModel#save");
var mainContent=$("#main-content" );
if (!mainContent.find("#appearance-configuration-form-id").valid()) {
return;
@ -645,34 +647,13 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
});
}
}
displayAppearanceConfiguration=function(){
screenChange();
var mainContent=$("#main-content");
mainContent.html(mediumSpinnerImg());
$.ajax("restServices/archivaServices/archivaAdministrationService/getOrganisationInformation", {
type: "GET",
dataType: 'json',
success: function(data) {
mainContent.html($("#changeAppearance").tmpl());
var organisationInformation=new OrganisationInformation(data.name,data.url,data.logoLocation);
var organisationInformationViewModel=new OrganisationInformationViewModel(organisationInformation);
ko.applyBindings(organisationInformationViewModel, mainContent.get(0));
var validator = $("#main-content" ).find("#appearance-configuration-form-id")
.validate({
showErrors: function(validator,errorMap,errorList) {
customShowError(mainContent.find("#appearance-configuration-form-id").get(0),validator,errorMap,errorMap);
}
});
}
});
}
//---------------------------
// UiConfiguration part
//---------------------------
displayUiConfiguration=function(){
displayUiConfigurationOnly=function(){
screenChange();
var mainContent=$("#main-content");
mainContent.html(mediumSpinnerImg());
@ -726,6 +707,35 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
}
}
displayUiConfiguration=function(){
var mainContent=$("#main-content");
mainContent.html($("#ui-configuration" ).tmpl());
mainContent.find("#ui-configuration-form").html(mediumSpinnerImg());
$.ajax("restServices/archivaServices/archivaAdministrationService/getUiConfiguration", {
type: "GET",
dataType: 'json',
success: function(data){
var uiConfiguration=new UiConfiguration(data.showFindArtifacts,data.appletFindEnabled,data.disableEasterEggs,
data.applicationUrl,data.disableRegistration);
var uiConfigurationViewModel=new UiConfigurationViewModel(uiConfiguration);
ko.applyBindings(uiConfigurationViewModel,mainContent.find("#ui-configuration-form").get(0));
}
});
$.ajax("restServices/archivaServices/archivaAdministrationService/getOrganisationInformation", {
type: "GET",
dataType: 'json',
success: function(data) {
var organisationInformation=new OrganisationInformation(data.name,data.url,data.logoLocation);
var organisationInformationViewModel=new OrganisationInformationViewModel(organisationInformation);
ko.applyBindings(organisationInformationViewModel, mainContent.find("#change-appearance-form").get(0));
activateOrganisationInformationFormValidation();
}
});
}
//---------------------------
// System status part

View File

@ -228,7 +228,6 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
{ text : $.i18n.prop('menu.repository-scanning') , id: "menu-repository-scanning-list-a" , href: "#scanningList" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryScanning()}},
{ text : $.i18n.prop('menu.network-configuration') , id: "menu-network-configuration-list-a" , href: "#network" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayNetworkConfiguration()}},
{ text : $.i18n.prop('menu.system-status') , id: "menu-system-status-list-a" , href: "#status" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displaySystemStatus()}},
{ text : $.i18n.prop('menu.appearance-configuration') , id: "menu-appearance-list-a" , href: "#appearance" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayAppearanceConfiguration()}},
{ text : $.i18n.prop('menu.ui-configuration') , id: "menu-ui-configuration-list-a" , href: "#uiconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration()}},
{ text : $.i18n.prop('menu.reports') , id: "menu-report-list-a" , href: "#reports" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayReportsPage()}}
]);

View File

@ -316,36 +316,6 @@
</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="input-xxlarge required digits" id="applicationUrl" name="applicationUrl" size="8"
data-bind="value: uiConfiguration().applicationUrl"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="disableRegistration">${$.i18n.prop('ui-configuration.disableRegistration')}</label>
<div class="controls">
<input type="checkbox" id="disableRegistration" name="disableRegistration" data-bind="checked: uiConfiguration().disableRegistration"/>
</div>
</div>
</fieldset>
<button id="ui-configuration-btn-save" data-bind="click: save" class="btn" data-loading-text="${$.i18n.prop('common.loading')}">${$.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>
@ -505,15 +475,10 @@
</script>
<script id="changeAppearance" type="text/html">
<div class="page-header">
<h2>${$.i18n.prop('appearance-configuration.title-page')}</h2>
</div>
<h2>${$.i18n.prop('appearance-configuration.organisation-details')}</h2>
<h4>${$.i18n.prop('appearance-configuration.organisation-details')}</h4>
<p>
${$.i18n.prop('apperance-configuration.details-description')}
</p>
<p>${$.i18n.prop('apperance-configuration.details-description')}</p>
<form id="appearance-configuration-form-id" class="well form-horizontal">
<fieldset id="appearance-configuration-fielset-id">
@ -544,6 +509,58 @@
</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="input-xxlarge required digits" id="applicationUrl" name="applicationUrl" size="8"
data-bind="value: uiConfiguration().applicationUrl"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="disableRegistration">${$.i18n.prop('ui-configuration.disableRegistration')}</label>
<div class="controls">
<input type="checkbox" id="disableRegistration" name="disableRegistration" data-bind="checked: uiConfiguration().disableRegistration"/>
</div>
</div>
</fieldset>
<button id="ui-configuration-btn-save" data-bind="click: save" class="btn" data-loading-text="${$.i18n.prop('common.loading')}">${$.i18n.prop('save')}</button>
</form>
</script>
<script id="ui-configuration" type="text/html">
<div class="page-header">
<h4>${$.i18n.prop('ui-configuration.header')}</h4>
</div>
<ul class="nav nav-tabs">
<li class="active" id="ui-configuration-form-li"><a href="#ui-configuration-tab" data-toggle="tab">${$.i18n.prop('ui-configuration.header')}</a></li>
<li id="change-appearance-form-li"><a href="#change-appearance-form-tab" data-toggle="tab">${$.i18n.prop('appearance-configuration.title-page')}</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="ui-configuration-tab">
<div id="ui-configuration-form" data-bind='template: {name:"ui-configuration-form-tmpl"}'></div>
</div>
<div class="tab-pane" id="change-appearance-form-tab">
<div id="change-appearance-form" data-bind='template: {name:"changeAppearance"}'></div>
</div>
</div>
</script>
<script id="file-upload-screen" type="text/html">
<div id="file-upload-main" data-bind='template:{name:"file-upload-tmpl"}'></div>