]> source.dussan.org Git - archiva.git/commitdiff
adding the company logo logic
authorBrett Porter <brett@apache.org>
Thu, 7 Dec 2006 16:48:29 +0000 (16:48 +0000)
committerBrett Porter <brett@apache.org>
Thu, 7 Dec 2006 16:48:29 +0000 (16:48 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@483543 13f79535-47bb-0310-9956-ffa450edef68

15 files changed:
archiva-core/src/main/java/org/apache/maven/archiva/configuration/DefaultConfiguredRepositoryFactory.java
archiva-webapp/pom.xml
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractConfiguredAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAppearanceAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/EditPomAction.java [new file with mode: 0644]
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/component/CompanyInfoAction.java [new file with mode: 0644]
archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureAppearance-validation.xml [new file with mode: 0644]
archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureAppearance.properties [new file with mode: 0644]
archiva-webapp/src/main/resources/xwork.xml
archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/appearance.jsp [new file with mode: 0644]
archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editAppearance.jsp [new file with mode: 0644]
archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editPom.jsp [new file with mode: 0644]
archiva-webapp/src/main/webapp/WEB-INF/jsp/components/companyLogo.jsp [new file with mode: 0644]
archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
pom.xml

index 51ba2d703f6db7e7c050213996e7bdc7313bcac4..d7b16fa9d4516425aacd40f7eb78047ec799b17c 100644 (file)
@@ -16,12 +16,12 @@ package org.apache.maven.archiva.configuration;
  * limitations under the License.
  */
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.proxy.ProxiedArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.commons.lang.StringUtils;
 
 import java.io.File;
 import java.util.ArrayList;
index 6962926ca47b2774fe5638a2188252ea144722d4..0ad8580ac7c5beb41d48ea4a35f65036ca0dd808 100644 (file)
       <artifactId>jstl</artifactId>
       <version>1.1.2</version>
     </dependency>
-    <!--
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-xwork-integration</artifactId>
-      <version>1.0-alpha-2</version>
-    </dependency>
     <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-log4j-logging</artifactId>
-      <version>1.1-alpha-2</version>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-app-configuration-model</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
-      <version>1.0.4</version>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-app-configuration-web</artifactId>
     </dependency>
-     -->
+    <!--
+   <dependency>
+     <groupId>org.codehaus.plexus</groupId>
+     <artifactId>plexus-xwork-integration</artifactId>
+     <version>1.0-alpha-2</version>
+   </dependency>
+   <dependency>
+     <groupId>org.codehaus.plexus</groupId>
+     <artifactId>plexus-log4j-logging</artifactId>
+     <version>1.1-alpha-2</version>
+   </dependency>
+   <dependency>
+     <groupId>commons-logging</groupId>
+     <artifactId>commons-logging</artifactId>
+     <version>1.0.4</version>
+   </dependency>
+    -->
     <dependency>
       <groupId>org.apache.maven.wagon</groupId>
       <artifactId>wagon-http-lightweight</artifactId>
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractConfiguredAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractConfiguredAction.java
new file mode 100644 (file)
index 0000000..2870fff
--- /dev/null
@@ -0,0 +1,49 @@
+package org.apache.maven.archiva.web.action;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ConfigurationStore;
+import org.apache.maven.archiva.configuration.ConfigurationStoreException;
+import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
+
+public abstract class AbstractConfiguredAction
+    extends PlexusActionSupport
+{
+    /**
+     * @plexus.requirement
+     */
+    private ConfiguredRepositoryFactory repositoryFactory;
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore configurationStore;
+
+    protected ArtifactRepository createLocalRepository()
+        throws ConfigurationStoreException
+    {
+        Configuration configuration = configurationStore.getConfigurationFromStore();
+
+        return repositoryFactory.createLocalRepository( configuration );
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAppearanceAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAppearanceAction.java
new file mode 100644 (file)
index 0000000..3d74184
--- /dev/null
@@ -0,0 +1,105 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.opensymphony.xwork.ModelDriven;
+import com.opensymphony.xwork.Preparable;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.apache.maven.archiva.web.action.AbstractConfiguredAction;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.model.Model;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.shared.app.company.CompanyPomHandler;
+import org.apache.maven.shared.app.configuration.Configuration;
+import org.apache.maven.shared.app.configuration.ConfigurationChangeException;
+import org.apache.maven.shared.app.configuration.ConfigurationStore;
+import org.apache.maven.shared.app.configuration.ConfigurationStoreException;
+import org.apache.maven.shared.app.configuration.InvalidConfigurationException;
+import org.codehaus.plexus.security.rbac.Resource;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
+
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id: ConfigurationAction.java 480950 2006-11-30 14:58:35Z evenisse $
+ * @plexus.component role="com.opensymphony.xwork.Action"
+ * role-hint="configureAppearance"
+ */
+public class ConfigureAppearanceAction
+    extends AbstractConfiguredAction
+    implements ModelDriven, SecureAction, Preparable
+{
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore appConfigurationStore;
+
+    /**
+     * The configuration.
+     */
+    private Configuration configuration;
+
+    private Model companyModel;
+
+    /**
+     * @plexus.requirement
+     */
+    private CompanyPomHandler companyPomHandler;
+
+    public String execute()
+        throws IOException, ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException
+    {
+        appConfigurationStore.storeConfiguration( configuration );
+
+        return SUCCESS;
+    }
+
+    public Object getModel()
+    {
+        return configuration;
+    }
+
+    public void prepare()
+        throws ConfigurationStoreException, ProjectBuildingException, ArtifactMetadataRetrievalException,
+        org.apache.maven.archiva.configuration.ConfigurationStoreException
+    {
+        configuration = appConfigurationStore.getConfigurationFromStore();
+
+        companyModel = companyPomHandler.getCompanyPomModel( configuration.getCompanyPom(), createLocalRepository() );
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+        bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
+
+        return bundle;
+    }
+
+    public Model getCompanyModel()
+    {
+        return companyModel;
+    }
+}
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/EditPomAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/EditPomAction.java
new file mode 100644 (file)
index 0000000..4d10f26
--- /dev/null
@@ -0,0 +1,128 @@
+package org.apache.maven.archiva.web.action.admin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.opensymphony.xwork.ModelDriven;
+import com.opensymphony.xwork.Preparable;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.apache.maven.archiva.web.action.AbstractConfiguredAction;
+import org.apache.maven.artifact.installer.ArtifactInstallationException;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.model.Model;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.shared.app.company.CompanyPomHandler;
+import org.apache.maven.shared.app.configuration.CompanyPom;
+import org.apache.maven.shared.app.configuration.Configuration;
+import org.apache.maven.shared.app.configuration.ConfigurationChangeException;
+import org.apache.maven.shared.app.configuration.ConfigurationStore;
+import org.apache.maven.shared.app.configuration.ConfigurationStoreException;
+import org.apache.maven.shared.app.configuration.InvalidConfigurationException;
+import org.codehaus.plexus.security.rbac.Resource;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
+
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id: ConfigurationAction.java 480950 2006-11-30 14:58:35Z evenisse $
+ * @plexus.component role="com.opensymphony.xwork.Action"
+ * role-hint="editPom"
+ */
+public class EditPomAction
+    extends AbstractConfiguredAction
+    implements ModelDriven, SecureAction, Preparable
+{
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore appConfigurationStore;
+
+    /**
+     * The configuration.
+     */
+    private Configuration configuration;
+
+    /**
+     * @plexus.requirement
+     */
+    private CompanyPomHandler companyPomHandler;
+
+    private Model companyModel;
+
+    public String execute()
+        throws IOException, ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException,
+        ArtifactInstallationException, org.apache.maven.archiva.configuration.ConfigurationStoreException
+    {
+        // TODO: hack for passed in String[]
+        String[] logo = (String[]) companyModel.getProperties().get( "organization.logo" );
+        if ( logo != null )
+        {
+            companyModel.getProperties().put( "organization.logo", logo[0] );
+        }
+
+        companyPomHandler.save( companyModel, createLocalRepository() );
+
+        return SUCCESS;
+    }
+
+    public Object getModel()
+    {
+        return companyModel;
+    }
+
+    public void prepare()
+        throws ConfigurationStoreException, ProjectBuildingException, ArtifactMetadataRetrievalException,
+        org.apache.maven.archiva.configuration.ConfigurationStoreException
+    {
+        configuration = appConfigurationStore.getConfigurationFromStore();
+
+        CompanyPom companyPom = configuration.getCompanyPom();
+        companyModel = companyPomHandler.getCompanyPomModel( companyPom, createLocalRepository() );
+
+        if ( companyModel == null )
+        {
+            companyModel = new Model();
+            companyModel.setModelVersion( "4.0.0" );
+
+            if ( companyPom != null )
+            {
+                companyModel.setGroupId( companyPom.getGroupId() );
+                companyModel.setArtifactId( companyPom.getArtifactId() );
+            }
+        }
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+        bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
+
+        return bundle;
+    }
+
+    public Model getCompanyModel()
+    {
+        return companyModel;
+    }
+}
\ No newline at end of file
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/component/CompanyInfoAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/component/CompanyInfoAction.java
new file mode 100644 (file)
index 0000000..c5ecfcd
--- /dev/null
@@ -0,0 +1,85 @@
+package org.apache.maven.archiva.web.action.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.web.action.AbstractConfiguredAction;
+import org.apache.maven.model.Model;
+import org.apache.maven.shared.app.company.CompanyPomHandler;
+import org.apache.maven.shared.app.configuration.ConfigurationStore;
+
+/**
+ * Stores the company information for displaying on the page.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="companyInfo"
+ */
+public class CompanyInfoAction
+    extends AbstractConfiguredAction
+{
+    private String companyLogo;
+
+    private String companyUrl;
+
+    private String companyName;
+
+    /**
+     * @plexus.requirement
+     */
+    private CompanyPomHandler handler;
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore appConfigurationStore;
+
+    public String execute()
+        throws Exception
+    {
+        Model model = handler.getCompanyPomModel( appConfigurationStore.getConfigurationFromStore().getCompanyPom(),
+                                                  createLocalRepository() );
+
+        if ( model != null )
+        {
+            if ( model.getOrganization() != null )
+            {
+                companyName = model.getOrganization().getName();
+                companyUrl = model.getOrganization().getUrl();
+            }
+
+            companyLogo = model.getProperties().getProperty( "organization.logo" );
+        }
+
+        return SUCCESS;
+    }
+
+    public String getCompanyLogo()
+    {
+        return companyLogo;
+    }
+
+    public String getCompanyUrl()
+    {
+        return companyUrl;
+    }
+
+    public String getCompanyName()
+    {
+        return companyName;
+    }
+}
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureAppearance-validation.xml b/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureAppearance-validation.xml
new file mode 100644 (file)
index 0000000..0628a0d
--- /dev/null
@@ -0,0 +1,35 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<!DOCTYPE validators PUBLIC
+    "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="companyPom.groupId">
+    <field-validator type="requiredstring">
+      <message key="appearance.groupId.required"/>
+    </field-validator>
+  </field>
+  <field name="companyPom.artifactId">
+    <field-validator type="requiredstring">
+      <message key="appearance.artifactId.required"/>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureAppearance.properties b/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/ConfigureAppearance.properties
new file mode 100644 (file)
index 0000000..bfcaf5b
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+appearance.groupId.required = You must define a group identifier.
+appearance.artifactId.required = You must define an artifact identifier.
\ No newline at end of file
index b996394c3d11cafa652a106d34ccf4b74c07228e..3e487716b088dae10a25eef8df469ad232ebacf7 100644 (file)
@@ -78,7 +78,7 @@
       <result name="security-login-cancel" type="redirect-action">index</result>
       <result name="security-login-locked" type="redirect-action">
         <param name="infoMessage">Account Locked</param>
-        <param name="actionName">index</param>           
+        <param name="actionName">index</param>
       </result>
       <result name="security-logout" type="redirect-action">index</result>
       <result name="requires-authentication" type="redirect-action">
     </action>
   </package>
 
+  <package name="components" namespace="/components" extends="default">
+    <action name="companyInfo" class="companyInfo">
+      <result>/WEB-INF/jsp/components/companyLogo.jsp</result>
+    </action>
+  </package>
+
   <!-- Configuration for the admin package. -->
   <package name="admin" namespace="/admin" extends="base">
 
       <result name="wait" type="redirect">/admin/reports.action?reportGroup=${reportGroup}&amp;repositoryId=${repositoryId}&amp;filter=${filter}</result>
       <result name="success" type="redirect">/admin/reports.action?reportGroup=${reportGroup}&amp;repositoryId=${repositoryId}&amp;filter=${filter}</result>
     </action>
+
+    <action name="configureAppearance" class="configureAppearance" method="input">
+      <result name="input">/WEB-INF/jsp/admin/appearance.jsp</result>
+    </action>
+
+    <action name="editAppearance" class="configureAppearance" method="input">
+      <result name="input">/WEB-INF/jsp/admin/editAppearance.jsp</result>
+    </action>
+
+    <action name="saveAppearance" class="configureAppearance">
+      <result name="input">/WEB-INF/jsp/admin/editAppearance.jsp</result>
+      <result type="redirect-action">
+        <param name="actionName">configureAppearance</param>
+        <param name="namespace">/admin</param>
+      </result>
+    </action>
+
+    <action name="editCompanyPom" class="editPom" method="input">
+      <result name="input">/WEB-INF/jsp/admin/editPom.jsp</result>
+    </action>
+
+    <action name="saveCompanyPom" class="editPom">
+      <result name="input">/WEB-INF/jsp/admin/editPom.jsp</result>
+      <result type="redirect-action">
+        <param name="actionName">configureAppearance</param>
+        <param name="namespace">/admin</param>
+      </result>
+    </action>
   </package>
 </xwork>
 
diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/appearance.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/appearance.jsp
new file mode 100644 (file)
index 0000000..9cd84c2
--- /dev/null
@@ -0,0 +1,96 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+
+<%@ taglib prefix="ww" uri="/webwork" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<html>
+<head>
+  <title>Configure Appearance</title>
+  <ww:head/>
+</head>
+
+<body>
+<h1>Appearance</h1>
+
+<div style="float: right">
+  <a href="<ww:url action='editAppearance' />">Edit</a>
+</div>
+<h2>Company Details</h2>
+
+<p>
+  The logo in the top right of the screen is controlled by your selected 'company POM'.
+</p>
+
+<ww:set name="companyPom" value="companyPom"/>
+
+<c:if test="${empty(companyPom)}">
+  <p>
+    You have not yet specified a company POM. <a href="<ww:url action='editAppearance' />">Select a Company POM</a>
+  </p>
+</c:if>
+
+<c:if test="${!empty(companyPom)}">
+  <p>
+    Your selected company POM is below. If you would like to change the organization name, url or logo, you can
+    <a href="<ww:url action='editCompanyPom'/>">edit the POM</a>.
+  </p>
+
+  <ww:set name="companyModel" value="companyModel"/>
+  <table>
+    <ww:label name="companyPom.groupId" label="Group ID"/>
+    <ww:label name="companyPom.artifactId" label="Artifact ID"/>
+    <c:if test="${companyModel != null}">
+      <ww:label name="companyModel.version" label="Version"/>
+    </c:if>
+  </table>
+
+  <div style="float: right">
+    <a href="<ww:url action='editCompanyPom' />">Edit Company POM</a>
+  </div>
+  <h3>POM Information</h3>
+
+  <c:choose>
+    <c:when test="${companyModel != null}">
+      <table>
+        <tr>
+          <th>Name</th>
+          <td>${companyModel.organization.name}</td>
+        </tr>
+        <tr>
+          <th>URL</th>
+          <td><a href="${companyModel.organization.url}">
+            <code>${companyModel.organization.url}</code>
+          </a></td>
+        </tr>
+        <tr>
+          <th>Logo URL</th>
+          <td>
+            <code>${companyModel.properties['organization.logo']}</code>
+          </td>
+        </tr>
+      </table>
+    </c:when>
+    <c:otherwise>
+      Company POM '${companyPom.groupId}:${companyPom.artifactId}' doesn't exist.
+      <a href="<ww:url action='editCompanyPom' />">Create company POM</a>
+    </c:otherwise>
+  </c:choose>
+</c:if>
+</body>
+</html>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editAppearance.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editAppearance.jsp
new file mode 100644 (file)
index 0000000..9061a31
--- /dev/null
@@ -0,0 +1,45 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+
+<%@ taglib prefix="ww" uri="/webwork" %>
+<html>
+<head>
+  <title>Configure Appearance</title>
+  <ww:head/>
+</head>
+
+<body>
+<h1>Appearance</h1>
+
+<h2>Company Details</h2>
+
+<p>
+  Enter the details of the company super POM below. If it exists, the organization name, URL and logo will be read
+  from it.
+</p>
+
+<ww:actionmessage/>
+<ww:form method="post" action="saveAppearance" namespace="/admin" validate="true" theme="xhtml">
+  <ww:textfield name="companyPom.groupId" label="Group ID"/>
+  <ww:textfield name="companyPom.artifactId" label="Artifact ID"/>
+  <ww:submit value="Save"/>
+</ww:form>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editPom.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editPom.jsp
new file mode 100644 (file)
index 0000000..05ffb44
--- /dev/null
@@ -0,0 +1,50 @@
+<%--
+  ~ Copyright 2006 Mergere, Inc.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  --%>
+
+<%@ taglib prefix="ww" uri="/webwork" %>
+<html>
+<head>
+  <title>Edit Company POM</title>
+  <ww:head/>
+</head>
+
+<body>
+<h1>Company POM</h1>
+
+<ww:actionmessage/>
+<ww:form method="post" action="saveCompanyPom" namespace="/admin" validate="true" theme="xhtml">
+  <ww:label name="companyModel.groupId" label="Group ID"/>
+  <ww:label name="companyModel.artifactId" label="Artifact ID"/>
+  <tr>
+    <td>Version</td>
+    <td>
+      <ww:property value="companyModel.version"/>
+      <i>(The version will automatically be incremented when you save this form)</i>
+    </td>
+  </tr>
+  <tr>
+    <td></td>
+    <td><h2>Organization</h2></td>
+  </tr>
+  <ww:textfield name="companyModel.organization.name" size="40" label="Name"/>
+  <ww:textfield name="companyModel.organization.url" size="70" label="URL"/>
+  <%-- TODO: how to get it to be a string, not a String[]? --%>
+  <ww:textfield name="companyModel.properties['organization.logo']" size="70" label="Logo URL"/>
+  <ww:submit value="Save"/>
+</ww:form>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/components/companyLogo.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/components/companyLogo.jsp
new file mode 100644 (file)
index 0000000..c967cf0
--- /dev/null
@@ -0,0 +1,16 @@
+<%@ taglib uri="/webwork" prefix="ww" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<ww:set name="companyLogo" value="companyLogo"/>
+<c:if test="${!empty(companyLogo)}">
+  <ww:set name="companyUrl" value="companyUrl"/>
+  <c:choose>
+    <c:when test="${!empty(companyUrl)}">
+      <a href="${companyUrl}">
+        <img src="${companyLogo}" title="${companyName}" border="0" alt=""/>
+      </a>
+    </c:when>
+    <c:otherwise>
+      <img src="${companyLogo}" title="${companyName}" border="0" alt=""/>
+    </c:otherwise>
+  </c:choose>
+</c:if>
index 37c38a0d17992142e696bdbc7fdc00c5edd6748a..43bb827e55aa9aad6e4fe2fabeb01df1c9b23454 100644 (file)
     </a>
   </span>
   <span id="bannerRight">
-    <%-- TODO: configured corporate banner
-        <a href="http://www.apache.org/">
-          <img src="http://www.apache.org/images/asf_logo_wide.gif" alt="" width="537" height="51" />
-        </a>
-    --%>
+    <ww:action namespace="/components" name="companyInfo" executeResult="true"/>
   </span>
 
   <div class="clear">
           </li>
         </pss:ifAuthorized>
         <pss:ifAuthorized permission="archiva-manage-configuration">
+          <li class="none">
+            <my:currentWWUrl action="configureAppearance" namespace="/admin">Appearance</my:currentWWUrl>
+          </li>
           <li class="expanded">
             <my:currentWWUrl action="index" namespace="/admin">Administration</my:currentWWUrl>
 
     </pss:ifAnyAuthorized>
 
     <c:if test="${sessionScope.securitySession.authenticated}">
-    <h5>My Account</h5>
-    <li class="none">
-      <my:currentWWUrl action="account" namespace="/">Edit user info</my:currentWWUrl>
-    </li>
+      <h5>My Account</h5>
+      <li class="none">
+        <my:currentWWUrl action="account" namespace="/">Edit user info</my:currentWWUrl>
+      </li>
     </c:if>
 
   </div>
 </div>
 
 <%
-    int inceptionYear = 2005;
-    int currentYear = Calendar.getInstance().get( Calendar.YEAR );
-    String copyrightRange = String.valueOf( inceptionYear );
-    if ( inceptionYear != currentYear )
-    {
-        copyrightRange = copyrightRange + "-" + String.valueOf( currentYear );
-    }
+  int inceptionYear = 2005;
+  int currentYear = Calendar.getInstance().get( Calendar.YEAR );
+  String copyrightRange = String.valueOf( inceptionYear );
+  if ( inceptionYear != currentYear )
+  {
+    copyrightRange = copyrightRange + "-" + String.valueOf( currentYear );
+  }
 %>
 <div id="footer">
   <div class="xright">&#169;
diff --git a/pom.xml b/pom.xml
index 6f106215da08113c20f544ee284aab9540632af4..6b48fc8abbb4f8f224d29ef59afa23a26b9d1448 100644 (file)
--- a/pom.xml
+++ b/pom.xml
   </dependencies>
   <dependencyManagement>
     <dependencies>
+      <dependency>
+        <groupId>org.apache.maven.shared</groupId>
+        <artifactId>maven-app-configuration-model</artifactId>
+        <version>1.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven.shared</groupId>
+        <artifactId>maven-app-configuration-web</artifactId>
+        <version>1.0-SNAPSHOT</version>
+      </dependency>
       <dependency>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-container-default</artifactId>