code.onehippo.org is currently readonly. We are migrating to code.bloomreach.com, please continue working there on Monday 14/12. See: https://docs.bloomreach.com/display/engineering/GitLab

Commit 2a1ccac8 authored by Ate Douma's avatar Ate Douma

TRIVIAL cleanup master

parent df195bbd
*.iml
.idea/
.project/
.settings
target/
storage/
This diff is collapsed.
Hippo Plugin Dashboard Document Wizard
Copyright 2010-2018 Hippo B.V. (http://www.onehippo.com)
This product includes software developed by:
Hippo B.V., Amsterdam, The Netherlands (http://www.onehippo.com/);
The Apache Software Foundation (http://www.apache.org/).
NOTICE: Only our own original work is licensed under the terms of the
Apache License Version 2.0. The licenses of some libraries might impose
different redistribution or general licensing terms than those stated in the
Apache License. Users and redistributors are hereby requested to verify these
conditions and agree upon them.
# Dashboard Document Wizard Plugin
# This is not the branch you're looking for...
This is the Dashboard Document Wizard plugin for Hippo CMS. Documentation on how to use this
plugin in your Hippo project can be found at:
BloomReach only provides the git trees for the release tags of Hippo CMS, as explained on https://www.onehippo.org/about/open-source-release-policy.html
http://www.onehippo.org/library/concepts/plugins/dashboard-document-wizard/about.html
To checkout the code for a specific release tag, after cloning this repository, use the following:
## Plugin Demo
## to show the available tags
A demo project is provided to see the plugin in action.
git tag
### Requirements
## to checkout a specific tag
* Java 8 JDK
* Maven 3
git checkout <tag name>
### Download, Build and Run the Demo Project
## to modify a project
If you want to make modifications to a project, for example to create a patch, create a new fork branch from the specific tag like this:
1. Download the plugin's source code from https://code.onehippo.org/cms-community/hippo-plugin-dashboard-document-wizard
* Alternatively you can clone the git repository on your local machine.
* Use the latest stable branch named "release/x" (or "demo/x" in case the
demo is tagged seperately) where "x" is the version number.
* If you want to build the master branch demo you must configure the Hippo
Maven snapshot repository. See
http://www.onehippo.org/library/development/build-hippo-cms-from-scratch.html
for instructions.
2. Extract the archive on your local file system.
3. Use Maven to build and run the demo project:
```bash
cd hippo-plugin-dashboard-document-wizard/demo
mvn verify
mvn -P cargo.run
```
4. Hippo CMS will be available at http://localhost:8080/cms/ (login using
credentials `admin`/`admin`).
The demo website will be available at http://localhost:8080/site/.
### Development Branches
To build and run the demo from a development branch you may need to configure
access to the Hippo Maven snapshots repository. For more information see the
following documentation page:
http://www.onehippo.org/library/development/build-hippo-cms-from-scratch.html
git checkout -b forked-<tag name> <tag name>
For the latter, also see the **Build from Source** documentation at https://www.onehippo.org/library/development/build-hippo-cms-from-scratch.html
\ No newline at end of file
This diff is collapsed.
Hippo Plugin Dashboard Document Wizard Demo
Copyright 2010-2016 Hippo B.V. (http://www.onehippo.com)
This product includes software developed by:
Hippo B.V., Amsterdam, The Netherlands (http://www.onehippo.com/);
The Apache Software Foundation (http://www.apache.org/).
NOTICE: Only our own original work is licensed under the terms of the
Apache License Version 2.0. The licenses of some libraries might impose
different redistribution or general licensing terms than those stated in the
Apache License. Users and redistributors are hereby requested to verify these
conditions and agree upon them.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2018 Hippo B.V. (http://www.onehippo.com)
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onehippo.cms7.dashboard-document-wizard-demo</groupId>
<artifactId>hippo-plugin-dashboard-document-wizard-demo</artifactId>
<version>4.3.0-SNAPSHOT</version>
</parent>
<name>Hippo Plugin Dashboard Document Wizard Demo CMS</name>
<description>Hippo Plugin Dashboard Document Wizard Demo CMS</description>
<artifactId>hippo-plugin-dashboard-document-wizard-demo-cms</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.onehippo.cms7.hst.dependencies</groupId>
<artifactId>hst-repository-dependencies</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.onehippo.cms7.hst.dependencies</groupId>
<artifactId>hst-cms-dependencies</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-package-cms-dependencies</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-addon-channel-manager-frontend</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-addon-channel-manager-repository</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7.dashboard-document-wizard-demo</groupId>
<artifactId>hippo-plugin-dashboard-document-wizard-demo-repository-data</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-plugin-gallerypicker</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-plugin-resourcebundle-editor</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-plugin-selections-addon-repository</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-plugin-selections-addon-cms</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-plugin-dashboard-document-wizard</artifactId>
</dependency>
</dependencies>
<build>
<finalName>cms</finalName>
<resources>
<resource>
<filtering>false</filtering>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.html</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Hippo-Release-Version>${hippo.release.version}</Hippo-Release-Version>
<Project-Version>${project.version}</Project-Version>
<Project-Build>${buildNumber}</Project-Build>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<configuration>
<type>runtime</type>
</configuration>
<container>
<type>remote</type>
</container>
</configuration>
</plugin>
<plugin>
<groupId>org.onehippo.cms.l10n</groupId>
<artifactId>hippo-cms-l10n-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
<!--
Copyright 2017 Hippo B.V. (http://www.onehippo.com)
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
-->
<html xmlns:wicket="http://wicket.apache.org/">
<!-- Field added by DocumentChannelWizardPlugin to the parent dialog -->
<wicket:extend>
<div style="margin-top: 16px;">
<div class="label" wicket:id="channel-dropdown-label">[label]</div>
<div><select wicket:id="rootFolders"></select></div>
</div>
</wicket:extend>
</html>
channel-dropdown-label = Target channnel
\ No newline at end of file
/*
* Copyright 2017-2018 Hippo B.V. (http://www.onehippo.com)
*
* 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
*/
package org.onehippo.forge.demo;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import org.apache.wicket.Component;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.StringResourceModel;
import org.hippoecm.frontend.plugin.IPluginContext;
import org.hippoecm.frontend.plugin.config.IPluginConfig;
import org.hippoecm.repository.api.HippoNodeType;
import org.hippoecm.repository.util.JcrUtils;
import org.onehippo.forge.dashboard.documentwizard.NewDocumentWizardPlugin;
import org.onehippo.forge.selection.frontend.model.ListItem;
import org.onehippo.forge.selection.frontend.model.ValueList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This plugin extends from the default document wizard plugin and adds a new field to the dialog.
*
*/
public class DocumentChannelWizardPlugin extends NewDocumentWizardPlugin {
private static final Logger log = LoggerFactory.getLogger(DocumentChannelWizardPlugin.class);
public DocumentChannelWizardPlugin(final IPluginContext context, final IPluginConfig config) {
super(context, config);
}
protected NewDocumentWizardPlugin.Dialog getDialog(final IPluginContext context, final IPluginConfig config, NewDocumentWizardPlugin parent) {
return new Dialog(context, config, parent);
}
public class Dialog extends org.onehippo.forge.dashboard.documentwizard.NewDocumentWizardPlugin.Dialog {
private static final String DOCUMENTFOLDERS_ROOTPATH = "/content/documents";
private String rootFolder;
public Dialog(final IPluginContext context, final IPluginConfig config, final Component parent) {
super(context, config, parent);
// add label
add(new Label("channel-dropdown-label", getString("channel-dropdown-label")));
// add root folder dropdown
rootFolder = "";
final PropertyModel<Object> propModel = new PropertyModel<>(this, "rootFolder");
final ValueList documentRootFolderNames = getDocumentRootFolderNames();
final IChoiceRenderer<Object> choiceRenderer = new ListChoiceRenderer(documentRootFolderNames);
DropDownChoice<Object> rootFoldersField = new DropDownChoice<>("rootFolders", propModel, documentRootFolderNames, choiceRenderer);
rootFoldersField.setRequired(true);
rootFoldersField.setLabel(new StringResourceModel("channel-dropdown-label", this, null));
add(rootFoldersField);
}
private ValueList getDocumentRootFolderNames() {
final ValueList rootFolderNames = new ValueList();
final Session jcrSession = getSession().getJcrSession();
try {
final Node documentsNode = jcrSession.getNode(DOCUMENTFOLDERS_ROOTPATH);
final NodeIterator rootFolderNodes = documentsNode.getNodes();
while (rootFolderNodes.hasNext()) {
final Node rootFolderNode = rootFolderNodes.nextNode();
if(rootFolderNode.isNodeType("hippotranslation:translated")) {
final ListItem listItem = new ListItem(rootFolderNode.getName(),
JcrUtils.getStringProperty(rootFolderNode, HippoNodeType.HIPPO_NAME, rootFolderNode.getName()));
rootFolderNames.add(listItem);
}
}
} catch (RepositoryException e) {
log.error("Error occurred while retrieving root folder names: " + e.getClass().getName() + ": " + e.getMessage());
}
return rootFolderNames;
}
@Override
protected String getFolderPath() {
return DOCUMENTFOLDERS_ROOTPATH + "/" + rootFolder + "/" + baseFolder + list;
}
@Override
protected Node processNewDocumentNode(final Node documentNode) throws RepositoryException {
final Node docNode = super.processNewDocumentNode(documentNode);
// as demo, set a property with a value from the UI
docNode.setProperty("dashboarddocumentwizarddemo:rootfolder", rootFolder);
return docNode;
}
}
private static class ListChoiceRenderer implements IChoiceRenderer<Object> {
private final ValueList list;
public ListChoiceRenderer(ValueList list) {
this.list = list;
}
public Object getDisplayValue(Object object) {
return list.getLabel(object);
}
public String getIdValue(Object object, int index) {
return list.getKey(object);
}
}
}
<!doctype html>
<%--
Copyright 2010-2014 Hippo B.V. (http://www.onehippo.com)
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.
--%>
<%@ page isErrorPage="true" %>
<% response.setStatus(500); %>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>500 error</title>
</head>
<body>
<h1>Server error</h1>
<% out.println("<!-- An unexcepted error occurred. The name of the exception is:"); %>
<%= exception %>
<% out.println("-->"); %>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2017 Hippo B.V. (http://www.onehippo.com)
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.
-->
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0"
id="cms">
<!-- General configuration -->
<display-name>Dashboard Shortcut New Document Wizard Demo CMS</display-name>
<description>Dashboard Shortcut New Document Wizard Demo CMS</description>
<context-param>
<description>The address of the repository</description>
<param-name>repository-address</param-name>
<param-value>vm://</param-value>
</context-param>
<context-param>
<description>The (relative) location where to store files</description>
<param-name>repository-directory</param-name>
<param-value>WEB-INF/storage</param-value>
</context-param>
<context-param>
<description>The location of the repository configuration file. Unless the location
starts with file://, the location is retrieved from within the application package as
resource.</description>
<param-name>repository-config</param-name>
<param-value>repository.xml</param-value>
</context-param>
<!--No concurrent logins-->
<filter>
<filter-name>ConcurrentLogin</filter-name>
<filter-class>org.hippoecm.frontend.plugins.login.ConcurrentLoginFilter</filter-class>
</filter>
<!--Default application-->
<filter>
<filter-name>CMS</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>cms</param-value>
</init-param>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>org.hippoecm.frontend.Main</param-value>
</init-param>
<init-param>
<param-name>filterMappingUrlPattern</param-name>
<param-value>/*</param-value>
</init-param>
<init-param>
<param-name>wicket.configuration</param-name>
<param-value>deployment</param-value>
</init-param>
<init-param>
<param-name>repository-address</param-name>
<param-value>vm://</param-value>
</init-param>
<init-param>
<param-name>upload-limit</param-name>
<param-value>4096k</param-value>
</init-param>
</filter>
<!--Builtin console-->
<filter>
<filter-name>Console</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>org.hippoecm.frontend.Main</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>console</param-value>
</init-param>
<init-param>
<param-name>wicket.configuration</param-name>
<param-value>deployment</param-value>
</init-param>
<init-param>
<param-name>repository-address</param-name>
<param-value>vm://</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ConcurrentLogin</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CMS</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Console</filter-name>
<url-pattern>/console/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.hippoecm.frontend.plugins.login.ConcurrentLoginListener</listener-class>
</listener>
<servlet>
<servlet-name>AngularResourceServlet</servlet-name>
<servlet-class>org.onehippo.cms7.utilities.servlet.SecureCmsResourceServlet</servlet-class>
<init-param>
<param-name>jarPathPrefix</param-name>
<param-value>/angular</param-value>
</init-param>
<init-param>
<param-name>allowedResourcePaths</param-name>
<param-value>
^/.*\..*
</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>CKEditorResourceServlet</servlet-name>
<servlet-class>org.onehippo.cms7.utilities.servlet.SecureCmsResourceServlet</servlet-class>
<init-param>
<param-name>jarPathPrefix</param-name>
<param-value>/ckeditor</param-value>
</init-param>
<init-param>
<param-name>allowedResourcePaths</param-name>
<param-value>
^/.*\..*
</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>SkinResourceServlet</servlet-name>
<servlet-class>org.onehippo.cms7.utilities.servlet.ResourceServlet</servlet-class>
<init-param>
<param-name>jarPathPrefix</param-name>
<param-value>/skin</param-value>
</init-param>
<init-param>
<param-name>allowedResourcePaths</param-name>
<param-value>
^/.*\..*
</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>LoggingServlet</servlet-name>
<servlet-class>org.hippoecm.repository.LoggingServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
<!-- Repository -->
<servlet>
<servlet-name>Repository</servlet-name>
<servlet-class>org.hippoecm.repository.RepositoryServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet>
<servlet-name>PingServlet</servlet-name>
<servlet-class>org.hippoecm.repository.PingServlet</servlet-class>
<init-param>
<param-name>repository-address</param-name>
<param-value>vm://</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>LoggingServlet</servlet-name>
<url-pattern>/logging/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Repository</servlet-name>
<url-pattern>/repository/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>PingServlet</servlet-name>
<url-pattern>/ping/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AngularResourceServlet</servlet-name>
<url-pattern>/angular/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>CKEditorResourceServlet</servlet-name>
<url-pattern>/ckeditor/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SkinResourceServlet</servlet-name>
<url-pattern>/skin/*</url-pattern>
</servlet-mapping>
<!-- Timeout in minutes -->
<session-config>
<session-timeout>10</session-timeout>
<tracking-mode>COOKIE</tracking-mode>
</session-config>
<error-page>
<error-code>500</error-code>
<location>/WEB-INF/error.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/WEB-INF/error.jsp</location>
</error-page>
<env-entry>
<env-entry-name>logging/contextName</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>cms</env-entry-value>
</env-entry>
</web-app>