Index: urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/rewriting/frontend/plugins/cms/browse/list/UrlRewriterListColumnProviderPlugin_fr.properties IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>windows-1252 =================================================================== --- urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/rewriting/frontend/plugins/cms/browse/list/UrlRewriterListColumnProviderPlugin_fr.properties (revision 281) +++ urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/rewriting/frontend/plugins/cms/browse/list/UrlRewriterListColumnProviderPlugin_fr.properties (revision ) @@ -1,1 +1,4 @@ +doclisting-original-url=Réécrire depuis +doclisting-rewrite-url=Réécrire vers +doclisting-rewrite-type=Type Index: urlrewriter-plugin-repository/src/main/resources/namespace/ajaxawarestring.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- urlrewriter-plugin-repository/src/main/resources/namespace/ajaxawarestring.xml (revision ) +++ urlrewriter-plugin-repository/src/main/resources/namespace/ajaxawarestring.xml (revision ) @@ -0,0 +1,159 @@ + + + + + hipposysedit:templatetype + + + mix:referenceable + editor:editable + hippo:translated + + + 6eaee911-3996-41f4-b550-c1e56ddd18be + + + + hippo:translation + + + nl + + + Korte tekst + + + + + hippo:translation + + + en + + + String + + + + + hippo:handle + + + hippo:hardhandle + + + b4bed651-8c38-41d1-8157-ffecbfb0b0b0 + + + + hipposysedit:nodetype + + + hipposysedit:remodel + + + false + + + internal + + + + + + editor:templateset + + + + frontend:plugincluster + + + mode + size + + + wicket.model + engine + model.compareTo + + + wicket.id + + + + frontend:plugin + + + ${engine} + + + ${mode} + + + ${model.compareTo} + + + org.hippoecm.frontend.editor.plugins.AjaxAwareValueTemplatePlugin + + + ${size} + + + ${wicket.id} + + + ${wicket.model} + + + + + + + hippo:translation + + + fr + + + Texte court + + + + + hippo:translation + + + it + + + Breve testo + + + + + hippo:translation + + + de + + + String + + + Index: urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/BroadcastingStaticDropdownPlugin.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/BroadcastingStaticDropdownPlugin.java (revision ) +++ urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/BroadcastingStaticDropdownPlugin.java (revision ) @@ -0,0 +1,107 @@ +/** + * Copyright (C) 2011 - 2012 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.onehippo.forge.selection.frontend.plugin; + +import java.util.List; + +import org.apache.wicket.Component; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.form.OnChangeAjaxBehavior; +import org.apache.wicket.markup.html.CSSPackageResource; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.DropDownChoice; +import org.apache.wicket.markup.html.panel.Fragment; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.util.string.StringList; +import org.hippoecm.frontend.model.IModelReference; +import org.hippoecm.frontend.plugin.IPluginContext; +import org.hippoecm.frontend.plugin.config.IPluginConfig; +import org.hippoecm.frontend.plugins.standards.diff.TextDiffModel; +import org.hippoecm.frontend.service.render.RenderPlugin; +import org.onehippo.forge.AjaxUpdatesAware; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +//TODO This could be extending StaticDropdownPlugin +public class BroadcastingStaticDropdownPlugin extends RenderPlugin { + + private static final long serialVersionUID = 1L; + + static final Logger log = LoggerFactory.getLogger(BroadcastingStaticDropdownPlugin.class); + + private List options; + + public BroadcastingStaticDropdownPlugin(IPluginContext context, IPluginConfig config) { + super(context, config); + + add(CSSPackageResource.getHeaderContribution(BroadcastingStaticDropdownPlugin.class, "BroadcastingStaticDropdownPlugin.css")); + + String mode = config.getString("mode", "view"); + Fragment fragment = new Fragment("fragment", mode, this); + add(fragment); + + if ("edit".equals(mode)) { + options = StringList.tokenize(config.getString("selectable.options", ""), ",").toList(); + DropDownChoice choice = new DropDownChoice("select", getModel(), options); + choice.add(new OnChangeAjaxBehavior() { + private static final long serialVersionUID = 1L; + + @Override + protected void onUpdate(final AjaxRequestTarget target) { + //TODO Using the RenderPlugin here is not very safe. It would be better if org.hippoecm.frontend.plugin.impl.PluginFactory$LayoutPlugin was used instead, but it is private + BroadcastingStaticDropdownPlugin.this.findParent(RenderPlugin.class).visitChildren(new IVisitor() { + @Override + public Object component(final Component component) { + if (component instanceof AjaxUpdatesAware) { + ((AjaxUpdatesAware) component).onAjaxUpdate(target, BroadcastingStaticDropdownPlugin.this); + } + return null; + } + }); + } + }); + + fragment.add(choice); + } else { + Label label = null; + if ("compare".equals(mode)) { + if (config.containsKey("model.compareTo")) { + IModelReference baseRef = context.getService(config.getString("model.compareTo"), + IModelReference.class); + if (baseRef != null) { + IModel baseModel = baseRef.getModel(); + if (baseModel == null) { + log.info("base model service provides null model"); + baseModel = new Model(null); + } + label = (Label) new Label("selectLabel", new TextDiffModel(baseModel, getModel())) + .setEscapeModelStrings(false); + } else { + log.warn("opened in compare mode, but no base model service is available"); + } + } else { + log.warn("opened in compare mode, but no base model was configured"); + } + } + if (label == null) { + label = new Label("selectLabel", getModel()); + } + fragment.add(label); + } + } + +} \ No newline at end of file Index: urlrewriter-plugin-cms/src/main/java/org/hippoecm/frontend/editor/plugins/AjaxAwareValueTemplatePlugin.html IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- urlrewriter-plugin-cms/src/main/java/org/hippoecm/frontend/editor/plugins/AjaxAwareValueTemplatePlugin.html (revision ) +++ urlrewriter-plugin-cms/src/main/java/org/hippoecm/frontend/editor/plugins/AjaxAwareValueTemplatePlugin.html (revision ) @@ -0,0 +1,24 @@ + + + +
+
[ Field value ]
+
+
+ Index: urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/BroadcastingStaticDropdownPlugin.css IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/BroadcastingStaticDropdownPlugin.css (revision ) +++ urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/BroadcastingStaticDropdownPlugin.css (revision ) @@ -0,0 +1,18 @@ +/** + * Copyright (C) 2011 - 2012 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. + */ +select.dropdown-plugin{ + width: 99%; +} Index: urlrewriter-plugin-repository/src/main/resources/namespace/types/rulecondition.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- urlrewriter-plugin-repository/src/main/resources/namespace/types/rulecondition.xml (revision 281) +++ urlrewriter-plugin-repository/src/main/resources/namespace/types/rulecondition.xml (revision ) @@ -79,7 +79,7 @@ false - String + AjaxAwareString @@ -102,7 +102,7 @@ false - StaticDropdown + BroadcastingStaticDropdown Index: urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/AjaxUpdatesAware.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/AjaxUpdatesAware.java (revision ) +++ urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/AjaxUpdatesAware.java (revision ) @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2011 - 2012 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.onehippo.forge; + +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.hippoecm.frontend.service.render.RenderPlugin; + +/** + * @version $Id$ + */ +public interface AjaxUpdatesAware { + + public void onAjaxUpdate(AjaxRequestTarget target, RenderPlugin invoker); + +} Index: urlrewriter-plugin-cms/src/main/java/org/hippoecm/frontend/editor/plugins/AjaxAwareValueTemplatePlugin.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- urlrewriter-plugin-cms/src/main/java/org/hippoecm/frontend/editor/plugins/AjaxAwareValueTemplatePlugin.java (revision ) +++ urlrewriter-plugin-cms/src/main/java/org/hippoecm/frontend/editor/plugins/AjaxAwareValueTemplatePlugin.java (revision ) @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2011 - 2012 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.frontend.editor.plugins; + +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.Component; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.model.Model; +import org.hippoecm.frontend.PluginRequestTarget; +import org.hippoecm.frontend.plugin.IPluginContext; +import org.hippoecm.frontend.plugin.config.IPluginConfig; +import org.hippoecm.frontend.service.render.RenderPlugin; +import org.onehippo.forge.AjaxUpdatesAware; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Arrays; +import java.util.List; + +public class AjaxAwareValueTemplatePlugin extends ValueTemplatePlugin implements AjaxUpdatesAware { + + private static final long serialVersionUID = 1L; + private static final Logger log = LoggerFactory.getLogger(AjaxAwareValueTemplatePlugin.class); + //TODO List could be configurable but is unlikely to change very often + private static final List nameMustBeSpecifiedFor = Arrays.asList("header", "attribute", "cookie", "parameter", "session-attribute"); + private static final AttributeModifier attributeModifier = new AttributeModifier("disabled", true, new Model("disabled")); + private PluginRequestTarget pluginRequestTarget; + + @Override + public void onAjaxUpdate(AjaxRequestTarget target, RenderPlugin invoker) { + + final Object conditionType = invoker.getModelObject(); + this.visitChildren(new IVisitor() { + @Override + public Object component(Component component) { + if (component.getId().equals("widget")) { + if(conditionType instanceof String){ + if (nameMustBeSpecifiedFor.contains(conditionType)) { + if (component.getBehaviors().contains(attributeModifier)) { + component.remove(attributeModifier); + } + AjaxAwareValueTemplatePlugin.this.redraw(); + } else { + component.add(attributeModifier); + AjaxAwareValueTemplatePlugin.this.setModelObject(""); + AjaxAwareValueTemplatePlugin.this.redraw(); + } + } + return component; + } + return null; + } + }); + target.addComponent(this); + } + + public AjaxAwareValueTemplatePlugin(IPluginContext context, IPluginConfig config) { + super(context, config); + this.setOutputMarkupId(true); + } +} Index: urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/BroadcastingStaticDropdownPlugin.html IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/BroadcastingStaticDropdownPlugin.html (revision ) +++ urlrewriter-plugin-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/BroadcastingStaticDropdownPlugin.html (revision ) @@ -0,0 +1,34 @@ + + + + + + + + + + developer + + + developer + + Index: urlrewriter-plugin-repository/src/main/resources/namespace/broadcastingstaticdropdown.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- urlrewriter-plugin-repository/src/main/resources/namespace/broadcastingstaticdropdown.xml (revision ) +++ urlrewriter-plugin-repository/src/main/resources/namespace/broadcastingstaticdropdown.xml (revision ) @@ -0,0 +1,156 @@ + + + + + hipposysedit:templatetype + + + mix:referenceable + editor:editable + hippo:translated + + + aff8c9b6-68fa-4211-8562-ade1ec3bf04d + + + + hippo:translation + + + nl + + + Statische Dropdown + + + + + hippo:translation + + + en + + + Static Dropdown + + + + + hippo:translation + + + fr + + + Liste déroulante statique + + + + + hippo:translation + + + it + + + Dropdown Statica + + + + + hippo:handle + + + + hipposysedit:nodetype + + + hipposysedit:remodel + + + false + + + String + + + internal + + + + + + editor:templateset + + + + frontend:plugincluster + + + mode + selectable.options + + + wicket.model + model.compareTo + engine + + + wicket.id + + + + frontend:plugin + + + ${engine} + + + ${mode} + + + ${model.compareTo} + + + org.onehippo.forge.selection.frontend.plugin.BroadcastingStaticDropdownPlugin + + + ${selectable.options} + + + ${wicket.id} + + + ${wicket.model} + + + + + + + hippo:translation + + + de + + + Statisches Dropdown + + + Index: urlrewriter-plugin-repository/src/main/resources/hippoecm-extension.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- urlrewriter-plugin-repository/src/main/resources/hippoecm-extension.xml (revision 281) +++ urlrewriter-plugin-repository/src/main/resources/hippoecm-extension.xml (revision ) @@ -81,6 +81,9 @@ /hippo:namespaces/urlrewriter + + true + @@ -298,6 +301,34 @@ /content + + + + + hippo:initializeitem + + + 420080 + + + namespace/broadcastingstaticdropdown.xml + + + /hippo:namespaces/system + + + + + hippo:initializeitem + + + 420080 + + + namespace/ajaxawarestring.xml + + + /hippo:namespaces/system