Commit 140cb864 authored by Unico Hommes's avatar Unico Hommes

CMS7-6531 move faceted date addon frontend module to cms core

parent 6994d6f2
......@@ -1174,6 +1174,13 @@ editor/frontend/src/main/java/org/hippoecm/editor/type/JcrTypeLocator.java svneo
editor/frontend/src/main/java/org/hippoecm/editor/type/JcrTypeStore.java -text
editor/frontend/src/main/java/org/hippoecm/editor/type/PlainJcrTypeStore.java -text
editor/frontend/src/main/java/org/hippoecm/editor/type/PseudoTypeDescriptor.java svneol=native#text/plain
editor/frontend/src/main/java/org/hippoecm/faceteddate/editor/DatePickerPlugin.html -text
editor/frontend/src/main/java/org/hippoecm/faceteddate/editor/DatePickerPlugin.java -text
editor/frontend/src/main/java/org/hippoecm/faceteddate/editor/DatePickerPlugin.properties -text
editor/frontend/src/main/java/org/hippoecm/faceteddate/editor/DatePickerPlugin_de.properties -text
editor/frontend/src/main/java/org/hippoecm/faceteddate/editor/DatePickerPlugin_fr.properties -text
editor/frontend/src/main/java/org/hippoecm/faceteddate/editor/DatePickerPlugin_it.properties -text
editor/frontend/src/main/java/org/hippoecm/faceteddate/editor/DatePickerPlugin_nl.properties -text
editor/frontend/src/main/java/org/hippoecm/frontend/editor/builder/BuilderException.java -text
editor/frontend/src/main/java/org/hippoecm/frontend/editor/builder/ExtensionPointLocator.java -text
editor/frontend/src/main/java/org/hippoecm/frontend/editor/builder/FieldEditor.html -text svneol=unset#text/plain
......
......@@ -123,6 +123,7 @@ editor/common/tm.out.1
editor/common/tm.out.lck
editor/common/tmlog.lck
editor/common/wdbp-error-log.txt
editor/datanucleus.log
editor/frontend/*.tmp
editor/frontend/.classpath
editor/frontend/.project
......
<!--
* Copyright 2007 Hippo
*
* 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-datepicker" wicket:id="value">[ Value ]</div>
</wicket:panel>
<wicket:fragment wicket:id="view">
<span wicket:id="label">[Label]</span>
<wicket:message key="week-label"/> <span wicket:id="weekofyear">[Week of year]</span><wicket:message key="weekday-label"/> <span wicket:id="dayofweek">[Day of week]</span><wicket:message key="yearday-label"/> <span wicket:id="dayofyear">[Day of year]</span> <wicket:message key="close-label"/>
</wicket:fragment>
</html>
/*
* Copyright 2008 Hippo.
*
* 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.hippoecm.faceteddate.editor;
import java.util.Date;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import org.apache.wicket.datetime.StyleDateConverter;
import org.apache.wicket.datetime.markup.html.basic.DateLabel;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.model.Model;
import org.hippoecm.frontend.i18n.types.TypeTranslator;
import org.hippoecm.frontend.model.JcrNodeModel;
import org.hippoecm.frontend.model.nodetypes.JcrNodeTypeModel;
import org.hippoecm.frontend.model.properties.JcrPropertyModel;
import org.hippoecm.frontend.model.properties.JcrPropertyValueModel;
import org.hippoecm.frontend.plugin.IPluginContext;
import org.hippoecm.frontend.plugin.config.IPluginConfig;
import org.hippoecm.frontend.plugins.yui.datetime.DateFieldWidget;
import org.hippoecm.frontend.service.render.RenderPlugin;
import static org.hippoecm.repository.HippoStdNodeType.HIPPOSTD_DATE;
import static org.hippoecm.repository.HippoStdNodeType.HIPPOSTD_DAYOFWEEK;
import static org.hippoecm.repository.HippoStdNodeType.HIPPOSTD_DAYOFYEAR;
import static org.hippoecm.repository.HippoStdNodeType.HIPPOSTD_WEEKOFYEAR;
public class DatePickerPlugin extends RenderPlugin<Date> {
private static final long serialVersionUID = 1L;
public DatePickerPlugin(IPluginContext context, IPluginConfig config) throws RepositoryException {
super(context, config);
setOutputMarkupId(true);
Node dateNode = ((JcrNodeModel) getDefaultModel()).getNode();
JcrPropertyValueModel<Date> valueModel = new JcrPropertyValueModel<Date>(
new JcrPropertyModel(dateNode.getProperty(HIPPOSTD_DATE)));
String mode = config.getString("mode", "view");
add("view".equals(mode) ? new View("value", dateNode, valueModel) : new DateFieldWidget("value",
valueModel, context, config));
}
class View extends Fragment {
public View(String id, Node dateNode, JcrPropertyValueModel<Date> valueModel) throws RepositoryException {
super(id, "view", DatePickerPlugin.this);
add(new DateLabel("label", valueModel, new StyleDateConverter(true)));
String weekOfYear = dateNode.hasProperty(HIPPOSTD_WEEKOFYEAR) ? dateNode.getProperty(HIPPOSTD_WEEKOFYEAR).getString() : "-";
add(new Label("weekofyear", weekOfYear));
if (dateNode.hasProperty(HIPPOSTD_DAYOFWEEK)) {
add(new Label("dayofweek", new TypeTranslator(new JcrNodeTypeModel(HIPPOSTD_DATE)).getValueName(
HIPPOSTD_DAYOFWEEK, new Model<String>(dateNode.getProperty(HIPPOSTD_DAYOFWEEK).getString()))));
} else {
add(new Label("dayofweek", "-"));
}
String dayOfYear = dateNode.hasProperty(HIPPOSTD_DAYOFYEAR) ? dateNode.getProperty(HIPPOSTD_DAYOFYEAR).getString() : "-";
add(new Label("dayofyear", dayOfYear));
}
}
}
week-label=(week
weekday-label=,
yearday-label=, day
close-label=of the year)
week-label=(Woche
weekday-label=,
yearday-label=, Tag
close-label=des Jahres)
week-label=(semaine
weekday-label=,
yearday-label=, jour
close-label=de l'ann\u00e9e)
week-label=(settimana
weekday-label=,
yearday-label=, giorno
close-label=dell\u00b4anno)
week-label=(week
weekday-label=,
yearday-label=, dag
close-label=van het jaar)
......@@ -125,4 +125,145 @@
</sv:node>
</sv:node>
<sv:node sv:name="date" h:merge="combine">
<sv:node sv:name="hippo:translation">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hippo:translation</sv:value>
</sv:property>
<sv:property sv:name="hippo:language" sv:type="String">
<sv:value>de</sv:value>
</sv:property>
<sv:property sv:name="hippo:message" sv:type="String">
<sv:value>Faceted Datum</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="hippo:translation">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hippo:translation</sv:value>
</sv:property>
<sv:property sv:name="hippo:language" sv:type="String">
<sv:value>de</sv:value>
</sv:property>
<sv:property sv:name="hippo:message" sv:type="String">
<sv:value>Montag</sv:value>
</sv:property>
<sv:property sv:name="hippo:property" sv:type="String">
<sv:value>hippostd:dayofweek</sv:value>
</sv:property>
<sv:property sv:name="hippo:value" sv:type="String">
<sv:value>1</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="hippo:translation">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hippo:translation</sv:value>
</sv:property>
<sv:property sv:name="hippo:language" sv:type="String">
<sv:value>de</sv:value>
</sv:property>
<sv:property sv:name="hippo:message" sv:type="String">
<sv:value>Dienstag</sv:value>
</sv:property>
<sv:property sv:name="hippo:property" sv:type="String">
<sv:value>hippostd:dayofweek</sv:value>
</sv:property>
<sv:property sv:name="hippo:value" sv:type="String">
<sv:value>2</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="hippo:translation">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hippo:translation</sv:value>
</sv:property>
<sv:property sv:name="hippo:language" sv:type="String">
<sv:value>de</sv:value>
</sv:property>
<sv:property sv:name="hippo:message" sv:type="String">
<sv:value>Mittwoch</sv:value>
</sv:property>
<sv:property sv:name="hippo:property" sv:type="String">
<sv:value>hippostd:dayofweek</sv:value>
</sv:property>
<sv:property sv:name="hippo:value" sv:type="String">
<sv:value>3</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="hippo:translation">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hippo:translation</sv:value>
</sv:property>
<sv:property sv:name="hippo:language" sv:type="String">
<sv:value>de</sv:value>
</sv:property>
<sv:property sv:name="hippo:message" sv:type="String">
<sv:value>Donnerstag</sv:value>
</sv:property>
<sv:property sv:name="hippo:property" sv:type="String">
<sv:value>hippostd:dayofweek</sv:value>
</sv:property>
<sv:property sv:name="hippo:value" sv:type="String">
<sv:value>4</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="hippo:translation">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hippo:translation</sv:value>
</sv:property>
<sv:property sv:name="hippo:language" sv:type="String">
<sv:value>de</sv:value>
</sv:property>
<sv:property sv:name="hippo:message" sv:type="String">
<sv:value>Freitag</sv:value>
</sv:property>
<sv:property sv:name="hippo:property" sv:type="String">
<sv:value>hippostd:dayofweek</sv:value>
</sv:property>
<sv:property sv:name="hippo:value" sv:type="String">
<sv:value>5</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="hippo:translation">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hippo:translation</sv:value>
</sv:property>
<sv:property sv:name="hippo:language" sv:type="String">
<sv:value>de</sv:value>
</sv:property>
<sv:property sv:name="hippo:message" sv:type="String">
<sv:value>Samstag</sv:value>
</sv:property>
<sv:property sv:name="hippo:property" sv:type="String">
<sv:value>hippostd:dayofweek</sv:value>
</sv:property>
<sv:property sv:name="hippo:value" sv:type="String">
<sv:value>6</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="hippo:translation">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hippo:translation</sv:value>
</sv:property>
<sv:property sv:name="hippo:language" sv:type="String">
<sv:value>de</sv:value>
</sv:property>
<sv:property sv:name="hippo:message" sv:type="String">
<sv:value>Sonntag</sv:value>
</sv:property>
<sv:property sv:name="hippo:property" sv:type="String">
<sv:value>hippostd:dayofweek</sv:value>
</sv:property>
<sv:property sv:name="hippo:value" sv:type="String">
<sv:value>7</sv:value>
</sv:property>
</sv:node>
</sv:node>
</sv:node>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment