Commit abf65924 authored by Ate Douma's avatar Ate Douma

TRIVIAL cleanup master

parent f42fd677
*.iml
/.idea/
.project/
.settings
target/
This diff is collapsed.
Hippo Plugin Resourcebundle Editor
Copyright 2007-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.
# This is not the branch you're looking for...
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
To checkout the code for a specific release tag, after cloning this repository, use the following:
## to show the available tags
git tag
## to checkout a specific tag
git checkout <tag name>
## 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:
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
<?xml version="1.0"?>
<!--
Copyright 2013-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</groupId>
<artifactId>hippo-cms7-project</artifactId>
<version>29.4-SNAPSHOT</version>
</parent>
<inceptionYear>2013</inceptionYear>
<artifactId>hippo-plugin-resourcebundle-editor</artifactId>
<name>Hippo Plugin Resourcebundle Editor</name>
<version>4.3.0-SNAPSHOT</version>
<scm>
<connection>scm:git:https://code.onehippo.org/cms-community/hippo-plugin-resourcebundle-editor.git</connection>
<developerConnection>scm:git:git@code.onehippo.org:cms-community/hippo-plugin-resourcebundle-editor.git</developerConnection>
<url>https://code.onehippo.org/cms-community/hippo-plugin-resourcebundle-editor</url>
</scm>
<properties>
<hippo.cms.version>5.3.0-SNAPSHOT</hippo.cms.version>
</properties>
<repositories>
<repository>
<id>hippo</id>
<name>Hippo Maven 2</name>
<url>https://maven.onehippo.com/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
</repositories>
<issueManagement>
<system>Jira</system>
<url>https://issues.onehippo.com/browse/HIPPLUG/component/15446</url>
</issueManagement>
<dependencies>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-cms-api</artifactId>
<version>${hippo.cms.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>package</defaultGoal>
<resources>
<resource>
<filtering>false</filtering>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.html</include>
<include>**/*.css</include>
<include>**/*.png</include>
<include>**/*.properties</include>
</includes>
</resource>
<resource>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/*.yaml</include>
<include>**/*.xml</include>
<include>**/*.json</include>
</includes>
</resource>
</resources>
</build>
<profiles>
<profile>
<id>pedantic</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<excludes combine.children="append">
<!-- repository content XML -->
<exclude>src/main/resources/*.xml</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
<!--
Copyright 2013 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/">
<wicket:panel>
<div class="hippo-editor-field">
<div class="hippo-editor-field-title" wicket:id="value-set-editor">
<wicket:message key="plugin.display.valueset.label"/>
&nbsp;
<a class="add-16 icon-16" wicket:id="value-set-add" style="display: inline;"></a>
<a class="rename-16 icon-16" wicket:id="value-set-rename"></a>
<a class="delete-16 icon-16" wicket:id="value-set-delete"></a>
</div>
</div>
<div class="resourcebundle-plugin">
<table>
<thead class="">
<tr>
<th class="desc">
<!-- empty in header -->
</th>
<th>
<span wicket:id="enabled-label"></span>
</th>
<th>
<span wicket:id="key-label"></span>
</th>
<th>
<wicket:message key="plugin.display.dropdown.label"/>
<select wicket:id="valueset-dropdown"></select>
</th>
<th>
<span wicket:id="index-label"></span>
</th>
<th>
<wicket:message key="plugin.display.action.label"/>
</th>
</tr>
</thead>
<tbody wicket:id="display" class="list-data-table-body">
<wicket:container wicket:id="repeater">
<tr wicket:id="resource"/>
</wicket:container>
</tbody>
<tfoot>
<tr>
<td>
<a wicket:id="resource-add" class="add-16 icon-16"></a>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
</wicket:panel>
<wicket:fragment wicket:id="edit-resource">
<td>
<img wicket:id="desc"/>
</td>
<td>
<input type="checkbox" wicket:id="action-enabled"/>
</td>
<td>
<span wicket:id="anchor"></span>
</td>
<td>
<span wicket:id="value"></span>
</td>
<td>
<span wicket:id="index"></span>
</td>
<td>
<a wicket:id="action-edit" class="edit-16 icon-16"></a>
<a wicket:id="action-copy" class="copy-16 icon-16"></a>
<a wicket:id="action-delete" class="delete-16 icon-16"></a>
</td>
</wicket:fragment>
<wicket:fragment wicket:id="view-resource">
<td>
<img wicket:id="desc"/>
</td>
<td>
<span wicket:id="action-enabled"/>
</td>
<td>
<span wicket:id="anchor"></span>
</td>
<td>
<span wicket:id="value"></span>
</td>
<td>
<span wicket:id="index"></span>
</td>
<td>
<a wicket:id="action-view" class="document-16 icon-16"></a>
</td>
</wicket:fragment>
</html>
\ No newline at end of file
plugin.display.keys.label=Keys
plugin.display.enabled.label=Overridden
plugin.display.enabled.label.title=If unchecked, the value [<missing>] is shown implying fallback resource bundle is tried
plugin.display.dropdown.label=Value Set
plugin.display.index.label=Index
plugin.display.index.label.title=Indicates the order in which the resources get processed. A resource's value can "interpolate" another resource's value if that other resource is processed before (lower index) this resource.
plugin.display.action.label=Actions
plugin.display.valueset.label=Manage value sets:
plugin.display.valueset.default=[default]
plugin.valueset.action.add=Add
plugin.valueset.action.rename=Rename
plugin.valueset.action.delete=Delete
plugin.resource.action.add=Add
plugin.resource.action.view=View all values
plugin.resource.action.edit=Edit
plugin.resource.action.copy=Copy
plugin.resource.action.delete=Delete
plugin.resource.action.enable=Enable/Disable
dialog.resource.key.label=Key:
dialog.resource.value.label=Value
dialog.resource.desc.label=Description:
dialog.resource.view.title=Resource View Dialog
dialog.resource.add.title=Resource Add Dialog
dialog.resource.edit.title=Resource Edit Dialog
dialog.resource.edit.key.hint=Editing a resource key is a dangerous thing to do. Use the copy functionality to effectuate key changes.
dialog.resource.copy.title=Resource Copy Dialog
dialog.resource.delete.title=Resource Delete Dialog
dialog.resource.delete.warning=You are about to delete the resource with key '${key}'. Are you sure?
dialog.valueset.add.label=Value set name:
dialog.valueset.add.title=Value Set Add Dialog
dialog.valueset.delete.label=Select value set to delete:
dialog.valueset.delete.title=Value Set Delete Dialog
dialog.valueset.rename.label=Select value set to rename:
dialog.valueset.rename.title=Value Set Rename Dialog
validation.resource.key.empty=Resource key must not be blank
validation.resource.key.duplicate=Resource key must not be duplicate
validation.valueset.name.empty=Value set name must not be blank
validation.valueset.name.duplicate=Value set name must not be duplicate
validation.valueset.name.reserved=Value set name value is reserved, try a different one
/*
* Copyright 2013 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.cms7.resourcebundle.data;
import java.io.Serializable;
import java.util.Map;
/**
* A resource represents a key + value-set of a resource bundle.
*/
public class Resource implements Comparable<Resource>, Serializable {
private Bundle bundle; // Reference to parent bundle
private String key; // Resource key
private String description; // Description of the purpose of the resource
private Map<String, String> valueMap; // map of {ValueSetName, Value}.
Resource(Bundle bundle, String key, String description, Map<String, String> valueMap) {
this.bundle = bundle;
this.key = key;
this.description = description;
this.valueMap = valueMap;
}
public Bundle getBundle() {
return bundle;
}
public String getKey() {
return key;
}
public String getDescription() {
return description;
}
public Map<String, String> getValueMap() {
return valueMap;
}
public String getValue(String valueSetName) {
return valueMap.get(valueSetName);
}
public String deleteValue(String valueSetName) {
return valueMap.remove(valueSetName);
}
public void setValue(String valueSet, String value) {
valueMap.put(valueSet, value);
}
public int compareTo(Resource other) {
return key.compareTo(other.getKey());
}
}
/*
* Copyright 2013 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.cms7.resourcebundle.data;
import java.io.Serializable;
/**
* A value set represents a (often language dependent) set of resource bundle values. The
* values themselves are not stored here (other than being available through the property),
* but in the resource's valueMap.
*/
public class ValueSet implements Comparable<ValueSet>, Serializable {
private Bundle bundle;
private String name;
private String displayName;
ValueSet(Bundle bundle, String name, String defaultDisplayName) {
this.bundle = bundle;
this.name = name;
if (name.equals(Bundle.PROP_VALUES_PREFIX)) {
displayName = defaultDisplayName;
} else if (name.startsWith(Bundle.PROP_VALUES_PREFIX)) {
displayName = name.substring(Bundle.PROP_VALUES_PREFIX.length() + 1);
} else {
displayName = name; // unrecognized pattern, don't invent display name.
}
}
public Bundle getBundle() {
return bundle;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String makeName() {
return Bundle.PROP_VALUES_PREFIX + "_" + displayName;
}
public int compareTo(ValueSet other) {
return displayName.compareTo(other.getDisplayName());
}
}
<!DOCTYPE html>
<!--
Copyright 2013-2015 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/">
<wicket:extend>
<div class="hippo-dialog-body">
<div class="label">
<span wicket:id="key-label"></span>
</div>
<div class="input">
<input wicket:id="key-value" type="text"/>
</div>
<div wicket:id="repeater">
<div class="label">
<span wicket:id="value-label"></span> (<span wicket:id="value-set-label"></span>):
</div>
<div class="input">
<input wicket:id="value-set-value" type="text"/>
</div>
</div>
<div class="label">
<span wicket:id="desc-label"></span>
</div>
<div class="input">
<textarea wicket:id="desc-value" rows="10"></textarea>
</div>
</div>
</wicket:extend>
</html>
\ No newline at end of file
/*
* Copyright 2013-2015 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.cms7.resourcebundle.dialogs;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.StringResourceModel;
import org.hippoecm.frontend.dialog.Dialog;
import org.hippoecm.frontend.dialog.DialogConstants;
import org.onehippo.cms7.resourcebundle.ResourceBundlePlugin;
import org.onehippo.cms7.resourcebundle.data.Bundle;
import org.onehippo.cms7.resourcebundle.data.Resource;
import org.onehippo.cms7.resourcebundle.data.ValueSet;
import org.onehippo.cms7.resourcebundle.validators.ResourceKeyValidator;
public class ResourceCopyDialog extends Dialog<Resource> {
private ResourceBundlePlugin plugin;
private boolean isAdd;
private Resource resource;
public ResourceCopyDialog(final ResourceBundlePlugin plugin, Bundle bundle, Resource originalResource) {
this.plugin = plugin;
setSize(DialogConstants.MEDIUM_AUTO);
isAdd = originalResource == null;
resource = isAdd ? bundle.newResource() : bundle.copyResource(originalResource);
final String valueLabel = new StringResourceModel("dialog.resource.value.label", plugin, null).getObject();
add(new Label("key-label", new StringResourceModel("dialog.resource.key.label", plugin, null)));
add(new TextField<>("key-value", new PropertyModel<String>(resource, "key")).setRequired(true)
.add(new ResourceKeyValidator(plugin, resource)));
add(new Label("desc-label", new StringResourceModel("dialog.resource.desc.label", plugin, null)));
add(new TextArea<>("desc-value", new PropertyModel<>(resource, "description")));
add(new ListView<ValueSet>("repeater", bundle.getValueSets()) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<ValueSet> item) {
final ValueSet valueSet = item.getModelObject();
item.add(new Label("value-label", valueLabel));
item.add(new Label("value-set-label", valueSet.getDisplayName()));
item.add(new TextField<>("value-set-value", new Model<String>() {
@Override
public String getObject() {
return resource.getValue(valueSet.getName());
}
@Override
public void setObject(String value) {
resource.setValue(valueSet.getName(), value);
}
}));
item.setRenderBodyOnly(true);
}
});
setFocusOnCancel();
}
public IModel<String> getTitle() {
String key = isAdd ? "dialog.resource.add.title" : "dialog.resource.copy.title";
return new StringResourceModel(key, plugin, null);
}
protected Resource getResource() {
return resource;
}
}
<!DOCTYPE html>
<!--
Copyright 2013-2015 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/">
<wicket:extend>
<div class="hippo-dialog-body">
<label wicket:id="warning"></label>
</div>
</wicket:extend>
</html>
\ No newline at end of file
/*
* Copyright 2013-2015 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.cms7.resourcebundle.dialogs;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.StringResourceModel;
import org.hippoecm.frontend.dialog.Dialog;
import org.hippoecm.frontend.dialog.DialogConstants;
import org.onehippo.cms7.resourcebundle.ResourceBundlePlugin;
import org.onehippo.cms7.resourcebundle.data.Resource;
public class ResourceDeleteDialog extends Dialog<Resource> {
private ResourceBundlePlugin plugin;
public ResourceDeleteDialog(final ResourceBundlePlugin plugin, final Resource resource) {
this.plugin = plugin;
setSize(DialogConstants.MEDIUM_AUTO);
// interpolate the string
String warning = new StringResourceModel("dialog.resource.delete.warning", plugin, null).getObject();
warning = warning.replaceAll("\\$\\{key\\}", resource.getKey());
add(new Label("warning", warning));
setFocusOnCancel();
}
public IModel<String> getTitle() {
return new StringResourceModel("dialog.resource.delete.title", plugin, null);
}
}
<!DOCTYPE html>
<!--
Copyright 2013-2015 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/">
<wicket:extend>
<div class="hippo-dialog-body">
<div class="input">
<span wicket:id="key-label"></span>&nbsp;<span wicket:id="key-value"></span>
</div>
<div wicket:id="repeater">