@Path( "getOrganisationInformation" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
+ @RedbackAuthorization( noPermission = true, noRestriction = true)
OrganisationInformation getOrganisationInformation()
throws ArchivaRestServiceException;
menu.legacy-artifact-support=Legacy Support
menu.repository-scanning=Repository Scanning
menu.system-status=System Status
+menu.appearance-configuration=Appearance
#user
user.change.password.required=Change password required
system-status.scanning.consumers.grid.header.average=Average
system-status.scanning.consumers.grid.header.invocations.time=Invocations time
-
-
+# appearance configuration
+appearance-configuration.title-page=Configure appearance
+appearance-configuration.organisation-details=Details
+apperance-configuration.details-description=Enter the details of your organization below.
+appearance-configuration.name-label=Name
+appearance-configuration.url-label=URL
+appearance-configuration.logoLocation-label=Logo Location
+appearance-configuration.updated=Appearance has been updated
+appearance-configuration.updating-error=Error during appearance setting
displayServerTime();
}
+ //---------------------------
+ // network configuration part
+ //---------------------------
+ OrganisationInformation=function(name,url,logoLocation){
+ this.name=ko.observable(name);
+ this.url=ko.observable(url);
+ this.logoLocation=ko.observable(logoLocation);
+ }
+ mapOrganisationInformation=function(data){
+ return new OrganisationInformation(data.name, data.url, data.logoLocation);
+ }
+ mapOrganisationInformations=function(data){
+ if (data!=null){
+ return $.isArray(data)? $.map(data, function(item){
+ return mapOrganisationInformation(item);
+ }):[mapOrganisationInformation(data)];
+ }
+ }
+ activateOrganisationInformationFormValidation=function(){
+ var validate = $("#main-content #appearance-configuration-form-id").validate({
+ rules: {
+ name: {
+ required: true
+ },
+ url: {
+ required:true,
+ url:true
+ },
+ logoLocation: {
+ required:false,
+ url:true
+ }
+ },
+ showErrors: function(validator, errorMap, errorList) {
+ customShowError("#main-content #appearance-configuration-form-id", validator, errorMap, errorMap);
+ }
+ })
+ }
+ OrganisationInformationViewModel=function(organisationInformation){
+ activateOrganisationInformationFormValidation();
+ this.organisationInformation=ko.observable(organisationInformation);
+ this.save=function(){
+ if (!$("#main-content #appearance-configuration-form-id").valid()) {
+ return;
+ }
+ clearUserMessages();
+ $.ajax("restServices/archivaServices/archivaAdministrationService/setOrganisationInformation", {
+ type: "POST",
+ contentType: "application/json",
+ data: ko.toJSON(this.organisationInformation),
+ dataType: "json",
+ success: function(data){
+ displaySuccessMessage($.i18n.prop('appearance-configuration.updated'));
+ updateAppearanceToolBar();
+ },
+ error: function(data){
+ displayErrorMessage($.i18n.prop('appearance-configuration.updating-error'));
+ }
+ });
+ }
+ }
+ displayAppearanceConfiguration=function(){
+ screenChange();
+ var mainContent=$("#main-content");
+ mainContent.html($("#changeAppearance").tmpl());
+
+ $.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.get(0));
+ var validator = $("#main-content #appearance-configuration-form-id").validate({
+ showErrors: function(validator,errorMap,errorList) {
+ customShowError(mainContent.find("#appearance-configuration-form-id").get(0),validator,errorMap,errorMap);
+ }
+ });
+ }
+ });
+ }
});
\ No newline at end of file
displayBrowse(true);
return;
}
+ if (screen=='appearance-configuration'&& hasKarma('archiva-manage-configuration')){
+ displayAppearanceConfiguration();
+ return
+ }
}
// by default display search screen
displaySearch();
});
}
+ //------------------------------------//
+ // Change UI with appearance settings //
+ //------------------------------------//
+ updateAppearanceToolBar=function() {
+ $.ajax("restServices/archivaServices/archivaAdministrationService/getOrganisationInformation", {
+ type: "GET",
+ dataType: 'json',
+ success: function(data) {
+ if(data.url){
+ var url = data.url.startsWith("http://") || data.url.startsWith("https://") ? data.url : "http://"+data.url;
+ var link="<a href='"+url+"' class='brand'>";
+ if (data.logoLocation) {
+ link+="<img src='"+data.logoLocation+"' style='max-height: 30px'/>";
+ } else if (data.name) {
+ link+=data.name;
+ } else {
+ link+="Archiva";
+ }
+ link+="</a>";
+ $("#organisation-logo").html(link);
+ }
+ if (!data.url && data.name){
+ $("#organisation-logo").html("<a href='/' class='brand'>"+data.name+"</a>");
+ }
+ if (!data.url && !data.name){
+ $("#organisation-logo").html("<a href='/' class='brand'>Archiva</a>");
+ }
+ },
+ error: function() {
+ $("#organisation-logo").html("<a href='/' class='brand'>Archiva</a>");
+ }
+ });
+ }
startArchivaApplication=function(){
.append( "<a>" + item.artifactId + "</a>" )
.appendTo( ul );
};;
+ updateAppearanceToolBar();
}
startArchivaApplication();
{{/if}}
</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>
+
+ <p>
+ ${$.i18n.prop('apperance-configuration.details-description')}
+ </p>
+
+ <form id="appearance-configuration-form-id" class="well form-horizontal">
+ <fieldset id="appearance-configuration-fielset-id">
+ <div class="control-group">
+ <label class="control-label" for="name">${$.i18n.prop('appearance-configuration.name-label')}</label>
+ <div class="controls">
+ <input type="text" class="xlarge required" id="name" name="name" size="50"
+ data-bind="value: organisationInformation().name"/>
+ </div>
+ </div>
+ <div class="control-group">
+ <label class="control-label" for="name">${$.i18n.prop('appearance-configuration.url-label')}</label>
+ <div class="controls">
+ <input type="text" class="xlarge required" id="url" name="url" size="50"
+ data-bind="value: organisationInformation().url"/>
+ </div>
+ </div>
+ <div class="control-group">
+ <label class="control-label"
+ for="name">${$.i18n.prop('appearance-configuration.logoLocation-label')}</label>
+ <div class="controls">
+ <input type="text" class="xlarge" id="logoLocation" name="logoLocation" size="50"
+ data-bind="value: organisationInformation().logoLocation"/>
+ </div>
+ </div>
+ </fieldset>
+ <button id="appearance-configuration-btn-save" data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
+ </form>
+</script>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-system-status-list-a" onclick="displaySystemStatus()">${$.i18n.prop('menu.system-status')}</a>
</li>
+ <li style="display:none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
+ <a href="#" id="menu-appearance-list-a" onclick="displayAppearanceConfiguration()">${$.i18n.prop('menu.appearance-configuration')}</a>
+ </li>
</ul>
<div style="max-height: 40px" class="navbar-inner">
<div class="container-fluid">
- <a class="brand pull-left" href="index.html">Archiva</a>
+ <div id="organisation-logo" class="pull-left"></div>
<div class="nav-collapse">
<ul class="nav pull-right">
<li id="create-admin-link" class="pull-right" style="display: none">