You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/03/26 03:20:17 UTC

svn commit: r641112 - in /lenya/trunk/src/modules-core: metadata/ metadata/config/ metadata/config/cocoon-xconf/ metadata/java/src/org/apache/lenya/modules/metadata/ metadata/usecases/ sitemanagement/config/cocoon-xconf/tab/ sitemanagement/resources/i1...

Author: andreas
Date: Tue Mar 25 19:20:14 2008
New Revision: 641112

URL: http://svn.apache.org/viewvc?rev=641112&view=rev
Log:
Save meta data using Dojo to avoid creating continuations.

Added:
    lenya/trunk/src/modules-core/metadata/config/cocoon-xconf/usecase-change.xconf
    lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/ChangeMetaData.java
    lenya/trunk/src/modules-core/metadata/usecases/
    lenya/trunk/src/modules-core/metadata/usecases/change.jx
    lenya/trunk/src/modules-core/sitemanagement/resources/javascript/metadata.js
Modified:
    lenya/trunk/src/modules-core/metadata/config/module.xml
    lenya/trunk/src/modules-core/metadata/sitemap.xmap
    lenya/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-meta.xconf
    lenya/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui.xml
    lenya/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui_de.xml
    lenya/trunk/src/modules-core/sitemanagement/usecases/tab/head.jx
    lenya/trunk/src/modules-core/sitemanagement/usecases/tab/meta.jx

Added: lenya/trunk/src/modules-core/metadata/config/cocoon-xconf/usecase-change.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/metadata/config/cocoon-xconf/usecase-change.xconf?rev=641112&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/metadata/config/cocoon-xconf/usecase-change.xconf (added)
+++ lenya/trunk/src/modules-core/metadata/config/cocoon-xconf/usecase-change.xconf Tue Mar 25 19:20:14 2008
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
+<!--
+    This file defines the publication specific use-cases
+-->
+
+  <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'metadata.change']">
+    <component-instance name="metadata.change" logger="lenya.metadata" class="org.apache.lenya.modules.metadata.ChangeMetaData">
+      <view uri="cocoon://modules/metadata/change" createContinuation="false"/>
+    </component-instance>
+  </xconf>

Modified: lenya/trunk/src/modules-core/metadata/config/module.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/metadata/config/module.xml?rev=641112&r1=641111&r2=641112&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/metadata/config/module.xml (original)
+++ lenya/trunk/src/modules-core/metadata/config/module.xml Tue Mar 25 19:20:14 2008
@@ -18,6 +18,7 @@
 <module xmlns="http://apache.org/lenya/module/1.0">
   <id>org.apache.lenya.modules.metadata</id>
   <export package="org.apache.lenya.modules.metadata"/>
+  <depends module="org.apache.lenya.modules.usecase"/>
   <package>org.apache.lenya.modules</package>
   <version>2.0.2-dev</version>
   <name>Meta Data</name>

Added: lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/ChangeMetaData.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/ChangeMetaData.java?rev=641112&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/ChangeMetaData.java (added)
+++ lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/ChangeMetaData.java Tue Mar 25 19:20:14 2008
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.lenya.modules.metadata;
+
+import org.apache.lenya.cms.metadata.MetaData;
+import org.apache.lenya.cms.usecase.DocumentUsecase;
+import org.apache.lenya.cms.usecase.UsecaseInvoker;
+import org.apache.lenya.util.Assert;
+
+/**
+ * Save a meta data element.
+ */
+public class ChangeMetaData extends DocumentUsecase {
+    
+    protected static final String PARAM_NAMESPACE = "namespace";
+    protected static final String PARAM_ELEMENT = "element";
+    protected static final String PARAM_VALUE = "value";
+    protected static final String PARAM_OLD_VALUE = "oldValue";
+    
+    protected void prepareView() throws Exception {
+        super.prepareView();
+        UsecaseInvoker invoker = null;
+        try {
+            invoker = (UsecaseInvoker) this.manager.lookup(UsecaseInvoker.ROLE);
+            invoker.invoke(getSourceURL(), getName(), getParameters());
+        }
+        finally {
+            if (invoker != null) {
+                this.manager.release(invoker);
+            }
+        }
+    }
+
+    protected void doCheckPreconditions() throws Exception {
+        super.doCheckPreconditions();
+        String namespace = getParameterAsString(PARAM_NAMESPACE);
+        Assert.notNull("namespace", namespace);
+        String element = getParameterAsString(PARAM_ELEMENT);
+        Assert.notNull("element", element);
+        String value = getParameterAsString(PARAM_VALUE);
+        Assert.notNull("value", value);
+        String oldValue = getParameterAsString(PARAM_OLD_VALUE);
+        Assert.notNull("old value", oldValue);
+        
+        MetaData meta = getSourceDocument().getMetaData(namespace);
+        
+        String currentValue = meta.getFirstValue(element);
+        if (currentValue == null) {
+            currentValue = "";
+        }
+        
+        if (!oldValue.equals(currentValue)) {
+            addErrorMessage("concurrent-change");
+        }
+    }
+
+    protected void doExecute() throws Exception {
+        
+        String namespace = getParameterAsString(PARAM_NAMESPACE);
+        Assert.notNull("namespace", namespace);
+        String element = getParameterAsString(PARAM_ELEMENT);
+        Assert.notNull("element", element);
+        String value = getParameterAsString(PARAM_VALUE);
+        Assert.notNull("value", value);
+        String oldValue = getParameterAsString(PARAM_OLD_VALUE);
+        Assert.notNull("old value", oldValue);
+        
+        MetaData meta = getSourceDocument().getMetaData(namespace);
+        meta.setValue(element, value);
+    }
+
+}

Modified: lenya/trunk/src/modules-core/metadata/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/metadata/sitemap.xmap?rev=641112&r1=641111&r2=641112&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/metadata/sitemap.xmap (original)
+++ lenya/trunk/src/modules-core/metadata/sitemap.xmap Tue Mar 25 19:20:14 2008
@@ -28,6 +28,11 @@
         <map:serialize type="xml"/>
       </map:match>
       
+      <map:match pattern="change">
+        <map:generate type="jx" src="fallback://lenya/modules/metadata/usecases/change.jx"/>
+        <map:serialize type="text"/>
+      </map:match>
+      
     </map:pipeline>
     
   </map:pipelines>

Added: lenya/trunk/src/modules-core/metadata/usecases/change.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/metadata/usecases/change.jx?rev=641112&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/metadata/usecases/change.jx (added)
+++ lenya/trunk/src/modules-core/metadata/usecases/change.jx Tue Mar 25 19:20:14 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<!-- $Id: revisions.jx 564507 2007-08-10 08:33:31Z andreas $ -->
+
+<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+  <jx:choose>
+    <jx:when test="${usecase.hasErrors()}">
+      <jx:forEach var="message" items="${usecase.getErrorMessages()}">
+        ${message}
+      </jx:forEach>
+    </jx:when>
+    <jx:otherwise>${usecase.getParameter('element')}@${usecase.getParameter('namespace')}</jx:otherwise>
+  </jx:choose>
+</jx:template>
\ No newline at end of file

Modified: lenya/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-meta.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-meta.xconf?rev=641112&r1=641111&r2=641112&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-meta.xconf (original)
+++ lenya/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-meta.xconf Tue Mar 25 19:20:14 2008
@@ -23,7 +23,7 @@
 
   <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'tab.meta']">
     <component-instance name="tab.meta" logger="lenya.site" class="org.apache.lenya.cms.metadata.usecases.Metadata">
-      <view uri="modules/sitemanagement/usecases/tab/meta.jx" menu="true">
+      <view uri="modules/sitemanagement/usecases/tab/meta.jx" menu="true" createContinuation="false">
         <tab group="site" name="meta"/>
       </view>
       <exit usecase="tab.meta" />

Modified: lenya/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui.xml?rev=641112&r1=641111&r2=641112&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui.xml (original)
+++ lenya/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui.xml Tue Mar 25 19:20:14 2008
@@ -92,5 +92,8 @@
   <message key="force-checkin-question">Do you really want to check-in the document '{0}'?</message>
   <message key="user-logged-in">The user '{0}' is still logged in.</message>
   <message key="user-not-logged-in">The user '{0}' is not logged in anymore.</message>
-  <message key="not-checked-out">The document '{0}' is not checked out.</message>
+  <message key="not-checked-out">The document '{0}' is not checked out.</message>
+  
+  <!-- meta data -->
+  <message key="saved">Saved</message>
 </catalogue>

Modified: lenya/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui_de.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui_de.xml?rev=641112&r1=641111&r2=641112&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui_de.xml (original)
+++ lenya/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui_de.xml Tue Mar 25 19:20:14 2008
@@ -94,5 +94,8 @@
   <message key="user-logged-in">Der Nutzer "{0}" ist noch eingeloggt.</message>
   <message key="user-not-logged-in">Der Nutzer "{0}" ist nicht mehr eingeloggt.</message>
   <message key="not-checked-out">Das Dokument "{0}" ist nicht ausgecheckt.</message>
+
+  <!-- meta data -->
+  <message key="saved">Gespeichert</message>
 </catalogue>
 

Added: lenya/trunk/src/modules-core/sitemanagement/resources/javascript/metadata.js
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/resources/javascript/metadata.js?rev=641112&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/resources/javascript/metadata.js (added)
+++ lenya/trunk/src/modules-core/sitemanagement/resources/javascript/metadata.js Tue Mar 25 19:20:14 2008
@@ -0,0 +1,79 @@
+/*
+* 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.
+*/
+
+  dojo.require("dojo.io.*");
+  dojo.require("dojo.event.*");
+
+  function saveMetaData(namespace, element) {
+    var id = element + "@" + namespace;
+    var bindArgs = {
+      url: URL,
+      content: {
+        "lenya.usecase": 'metadata.change',
+        namespace: namespace,
+        element: element,
+        oldValue: dojo.byId("oldValue_" + id).value,
+        value: dojo.byId("input_" + id).value,
+      },
+      method: "post",
+      encoding: "utf-8",
+      error: function(type, data, evt) {
+        alert("An error occurred.");
+      },
+      load: function(type, data, evt) {
+        var result = data.replace(/\s/g, "");
+        if (result == "concurrent-change") {
+          alert("Value can't be saved, concurrent change detected.");
+        }
+        else {
+          var successIndicator = dojo.byId("saved_" + result);
+          successIndicator.style.visibility = "visible";
+          
+          var inputField = dojo.byId("input_" + result);
+          var oldValueField = dojo.byId("oldValue_" + result);
+          oldValueField.value = inputField.value;
+        }
+      },
+      mimetype: "text/plain"
+    };
+    dojo.io.bind(bindArgs);
+  }
+
+  /*
+  function saveMetaData(namespace, element, oldValue) {
+    var id = element + "@" + namespace;
+    var bindArgs = {
+      method: "post",
+      error: function(type, data, evt) {
+        alert("An error occurred.");
+      },
+      load: function(type, data, evt) {
+        var result = data.replace(/\s/g, "");
+        if (result = "concurrent-change") {
+          alert("Value can't be saved, concurrent change detected.");
+        }
+        else {
+          var successIndicator = dojo.byId(id);
+          successIndicator.style.visibility = "visible";
+        }
+      },
+      mimetype: "text/plain",
+      formNode: dojo.byId("form_" + id)
+    };
+    dojo.io.bind(bindArgs);
+  }
+*/
\ No newline at end of file

Modified: lenya/trunk/src/modules-core/sitemanagement/usecases/tab/head.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/usecases/tab/head.jx?rev=641112&r1=641111&r2=641112&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/usecases/tab/head.jx (original)
+++ lenya/trunk/src/modules-core/sitemanagement/usecases/tab/head.jx Tue Mar 25 19:20:14 2008
@@ -33,5 +33,11 @@
     <script src="/modules/sitetree/javascript/lenyatree.js"/>
     <script src="/modules/sitetree/javascript/navtree.js"/>
     <script src="/modules/sitemanagement/javascript/lenyaTabs.js"/>
+    <script type="text/javascript">
+      djConfig = { isDebug: false, bindEncoding: "UTF-8" };
+      URL = "${usecase.getParameter('private.sourceUrl')}";
+    </script>
+    <script type="text/javascript" src="/modules/menubar/dojo/dojo.js">&#160;</script>
+    <script src="/modules/sitemanagement/javascript/metadata.js"/>
   </page:head>
 </jx:template>

Modified: lenya/trunk/src/modules-core/sitemanagement/usecases/tab/meta.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/usecases/tab/meta.jx?rev=641112&r1=641111&r2=641112&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/usecases/tab/meta.jx (original)
+++ lenya/trunk/src/modules-core/sitemanagement/usecases/tab/meta.jx Tue Mar 25 19:20:14 2008
@@ -6,9 +6,9 @@
   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
-
+  
+  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.
@@ -19,9 +19,9 @@
 <!-- $Id$ -->
 
 <page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0" 
-           xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0" 
-           xmlns="http://www.w3.org/1999/xhtml" 
-           xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
+  xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0" 
+  xmlns="http://www.w3.org/1999/xhtml" 
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
   <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/head.jx"/>
   
   <jx:set var="count" value="${usecase.getParameter('numbers').size()}"/>
@@ -30,75 +30,71 @@
     <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
     <div id="contentblock1" class="lenya-tab-sitetree">
       <h1 id="form-meta" style="width: 600px"><i18n:text>Meta Data</i18n:text></h1>
-      <form>
-        
-        <jx:set var="num2namespace" value="${usecase.getParameter('namespaces')}"/>
-        
-        <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
-        
-        <jx:set var="count" value="${usecase.getParameter('numbers').size()}"/>
-        <jx:forEach var="num" items="${usecase.getParameter('numbers')}">
-          <div class="lenyaTabTitle" id="lenyaTabTitle${num}" onclick="lenyaToggleTab(${count}, ${num})">
-            <!--<i18n:text>Namespace</i18n:text>:-->
-            <a><i18n:text><jx:out value="${num2namespace.get(num)}"/></i18n:text></a>
-          </div>
-        </jx:forEach>
-        <jx:forEach var="num" items="${usecase.getParameter('numbers')}">
-            <div class="lenyaTabBody" id="lenyaTabBody${num}">
-              <table class="lenya-table-list-noborder">
-                <jx:forEach var="key" items="${usecase.getParameter('keys')}">
-                  <jx:if test="${key.startsWith('ns' + num + '.')}">
-                    <tr>
-                      <td class="lenya-entry-caption">
-                        <label for="${key}"><i18n:text><jx:out value="${key.substring(key.indexOf('.')).substring(1)}"/></i18n:text>:</label>
-                      </td>
-                      <td>
-                        <jx:set var="wrapper" value="${usecase.getParameter(key)}"/>
-                        <jx:set var="values" value="${wrapper.getValues()}"/>
+      
+      <jx:set var="num2namespace" value="${usecase.getParameter('namespaces')}"/>
+      
+      <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
+      
+      <jx:set var="count" value="${usecase.getParameter('numbers').size()}"/>
+      <jx:forEach var="num" items="${usecase.getParameter('numbers')}">
+        <div class="lenyaTabTitle" id="lenyaTabTitle${num}" onclick="lenyaToggleTab(${count}, ${num})">
+          <!--<i18n:text>Namespace</i18n:text>:-->
+          <a><i18n:text><jx:out value="${num2namespace.get(num)}"/></i18n:text></a>
+        </div>
+      </jx:forEach>
+      <jx:forEach var="num" items="${usecase.getParameter('numbers')}">
+        <jx:set var="namespace" value="${num2namespace.get(num)}"/>
+        <div class="lenyaTabBody" id="lenyaTabBody${num}">
+          <table class="lenya-table-list-noborder">
+            <jx:forEach var="key" items="${usecase.getParameter('keys')}">
+              <jx:set var="element" value="${key.substring(key.indexOf('.')).substring(1)}"/>
+              <jx:if test="${key.startsWith('ns' + num + '.')}">
+                <tr>
+                  <td class="lenya-entry-caption">
+                    <label for="${key}"><i18n:text><jx:out value="${element}"/></i18n:text>:</label>
+                  </td>
+                  <td>
+                    <jx:set var="wrapper" value="${usecase.getParameter(key)}"/>
+                    <jx:set var="values" value="${wrapper.getValues()}"/>
+                    <jx:set var="id" value="${element + '@' + namespace}"/>
+                    <jx:choose>
+                      <jx:when test="${wrapper.getElement().isEditable()}">
                         <jx:choose>
-                          <jx:when test="${wrapper.getElement().isEditable()}">
-                            <jx:choose>
-                              <jx:when test="${values.size() &gt; 0}">
-                                <input type="text" id="${key}" name="${key}" class="lenya-form-element" value="${values[0]}"/>
-                              </jx:when>
-                              <jx:otherwise>
-                                <input type="text" id="${key}" name="${key}" class="lenya-form-element" value=""/>
-                              </jx:otherwise>
-                            </jx:choose>
+                          <jx:when test="${values.size() &gt; 0}">
+                            <input type="hidden" id="oldValue_${id}" value="${values[0]}"/>
+                            <input type="text" id="input_${id}" name="value" class="lenya-form-element" value="${values[0]}"
+                              onchange="javascript:saveMetaData('${namespace}', '${element}');"
+                              onfocus="javascript:document.getElementById('saved_${id}').style.visibility = 'hidden';"/>
                           </jx:when>
                           <jx:otherwise>
-                            <jx:set var="value" value="${wrapper.getValue()}"/>
-                            <jx:choose>
-                              <jx:when test="${values.size() == 0}"><em><i18n:text>value-not-set</i18n:text></em></jx:when>
-                              <jx:otherwise>
-                                <jx:forEach var="value" items="${values}">
-                                  ${value}<br/>
-                                </jx:forEach>
-                              </jx:otherwise>
-                            </jx:choose>
+                            <input type="hidden" id="oldValue_${id}" value=""/>
+                            <input type="text" id="input_${id}" name="value" class="lenya-form-element" value=""
+                              onchange="javascript:saveMetaData('${namespace}', '${element}');"
+                              onfocus="javascript:document.getElementById('saved_${id}').style.visibility = 'hidden';"/>
                           </jx:otherwise>
                         </jx:choose>
-                      </td>
-                    </tr>
-                  </jx:if>
-                </jx:forEach>
-              </table>
-            </div>
-        </jx:forEach>
-
-        <jx:choose>
-          <jx:when
-            test="${usecase.getParameter('document').getArea().equals('authoring') &amp;&amp; ! usecase.hasErrors()}">
-            <input i18n:attr="value" name="submit" type="submit" value="Save"/>
-          </jx:when>
-          <jx:otherwise>
-            <input i18n:attr="value" name="submit" type="submit" disabled="disabled" value="Save"/>
-          </jx:otherwise>
-        </jx:choose>
-        
-        <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-        <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
-      </form>
+                        <span id="saved_${id}" style="visibility: hidden;"><i18n:text>saved</i18n:text></span>
+                      </jx:when>
+                      <jx:otherwise>
+                        <jx:set var="value" value="${wrapper.getValue()}"/>
+                        <jx:choose>
+                          <jx:when test="${values.size() == 0}"><em><i18n:text>value-not-set</i18n:text></em></jx:when>
+                          <jx:otherwise>
+                            <jx:forEach var="value" items="${values}">
+                              ${value}<br/>
+                            </jx:forEach>
+                          </jx:otherwise>
+                        </jx:choose>
+                      </jx:otherwise>
+                    </jx:choose>
+                  </td>
+                </tr>
+              </jx:if>
+            </jx:forEach>
+          </table>
+        </div>
+      </jx:forEach>
+      
     </div>
   </page:body>
 </page:page>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org