mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
get xforms instance data saved to the workspace.
get radios and comboboxes calling into setFormValue get editor working marginally better get edit to work git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3503 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -23,6 +23,7 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import javax.faces.context.ResponseWriter;
|
import javax.faces.context.ResponseWriter;
|
||||||
|
import javax.faces.context.ExternalContext;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@@ -39,6 +40,7 @@ import org.chiba.xml.xforms.events.XFormsEventFactory;
|
|||||||
import org.w3c.dom.events.Event;
|
import org.w3c.dom.events.Event;
|
||||||
import org.w3c.dom.events.EventListener;
|
import org.w3c.dom.events.EventListener;
|
||||||
import org.w3c.dom.events.EventTarget;
|
import org.w3c.dom.events.EventTarget;
|
||||||
|
import org.chiba.xml.xforms.connector.http.AbstractHTTPConnector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@@ -48,9 +50,8 @@ public class XFormsBean
|
|||||||
private static final Log LOGGER = LogFactory.getLog(XFormsBean.class);
|
private static final Log LOGGER = LogFactory.getLog(XFormsBean.class);
|
||||||
|
|
||||||
private TemplateType tt;
|
private TemplateType tt;
|
||||||
private Document instanceData = null;
|
private InstanceData instanceData = null;
|
||||||
private ChibaBean chibaBean;
|
private ChibaBean chibaBean;
|
||||||
private Map context = new HashMap();
|
|
||||||
|
|
||||||
public TemplateType getTemplateType()
|
public TemplateType getTemplateType()
|
||||||
{
|
{
|
||||||
@@ -62,7 +63,7 @@ public class XFormsBean
|
|||||||
this.tt = tt;
|
this.tt = tt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInstanceData(final Document instanceData)
|
public void setInstanceData(final InstanceData instanceData)
|
||||||
{
|
{
|
||||||
this.instanceData = instanceData;
|
this.instanceData = instanceData;
|
||||||
}
|
}
|
||||||
@@ -71,15 +72,18 @@ public class XFormsBean
|
|||||||
throws XFormsException
|
throws XFormsException
|
||||||
{
|
{
|
||||||
this.chibaBean = new ChibaBean();
|
this.chibaBean = new ChibaBean();
|
||||||
this.chibaBean.setContext(context);
|
final FacesContext facesContext = FacesContext.getCurrentInstance();
|
||||||
|
final ExternalContext externalContext = facesContext.getExternalContext();
|
||||||
|
final HttpServletRequest request = (HttpServletRequest)
|
||||||
|
externalContext.getRequest();
|
||||||
|
XFormsBean.storeCookies(request.getCookies(), this.chibaBean);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LOGGER.debug("initializing " + this +
|
LOGGER.debug("initializing " + this +
|
||||||
" with tt " + tt.getName());
|
" with tt " + tt.getName());
|
||||||
final XFormsInputMethod tim = (XFormsInputMethod)
|
final XFormsInputMethod tim = (XFormsInputMethod)
|
||||||
tt.getInputMethods().get(0);
|
tt.getInputMethods().get(0);
|
||||||
final Document form = tim.getXForm(instanceData, tt);
|
final Document form = tim.getXForm(instanceData.getContent(), tt);
|
||||||
this.chibaBean.setXMLContainer(form);
|
this.chibaBean.setXMLContainer(form);
|
||||||
this.chibaBean.init();
|
this.chibaBean.init();
|
||||||
EventTarget et = (EventTarget)
|
EventTarget et = (EventTarget)
|
||||||
@@ -123,7 +127,7 @@ public class XFormsBean
|
|||||||
* @return the list of events that may result through this action
|
* @return the list of events that may result through this action
|
||||||
*/
|
*/
|
||||||
public void setXFormsValue()
|
public void setXFormsValue()
|
||||||
throws XFormsException
|
throws XFormsException, IOException
|
||||||
{
|
{
|
||||||
final FacesContext context = FacesContext.getCurrentInstance();
|
final FacesContext context = FacesContext.getCurrentInstance();
|
||||||
final Map requestParameters = context.getExternalContext().getRequestParameterMap();
|
final Map requestParameters = context.getExternalContext().getRequestParameterMap();
|
||||||
@@ -132,6 +136,9 @@ public class XFormsBean
|
|||||||
|
|
||||||
LOGGER.debug(this + " setXFormsValue(" + id + ", " + value + ")");
|
LOGGER.debug(this + " setXFormsValue(" + id + ", " + value + ")");
|
||||||
this.chibaBean.updateControlValue(id, value);
|
this.chibaBean.updateControlValue(id, value);
|
||||||
|
final ResponseWriter out = context.getResponseWriter();
|
||||||
|
out.write("<todo/>");
|
||||||
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,7 +149,7 @@ public class XFormsBean
|
|||||||
* @return the list of events that may result through this action
|
* @return the list of events that may result through this action
|
||||||
*/
|
*/
|
||||||
public void fireAction()
|
public void fireAction()
|
||||||
throws XFormsException
|
throws XFormsException, IOException
|
||||||
{
|
{
|
||||||
final FacesContext context = FacesContext.getCurrentInstance();
|
final FacesContext context = FacesContext.getCurrentInstance();
|
||||||
final Map requestParameters = context.getExternalContext().getRequestParameterMap();
|
final Map requestParameters = context.getExternalContext().getRequestParameterMap();
|
||||||
@@ -150,6 +157,9 @@ public class XFormsBean
|
|||||||
|
|
||||||
LOGGER.debug(this + " fireAction(" + id + ")");
|
LOGGER.debug(this + " fireAction(" + id + ")");
|
||||||
this.chibaBean.dispatch(id, XFormsEventFactory.DOM_ACTIVATE);
|
this.chibaBean.dispatch(id, XFormsEventFactory.DOM_ACTIVATE);
|
||||||
|
final ResponseWriter out = context.getResponseWriter();
|
||||||
|
out.write("<todo/>");
|
||||||
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,23 +172,15 @@ public class XFormsBean
|
|||||||
public void handleAction()
|
public void handleAction()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
LOGGER.debug(this + " handleAction");
|
||||||
final FacesContext context = FacesContext.getCurrentInstance();
|
final FacesContext context = FacesContext.getCurrentInstance();
|
||||||
final HttpServletRequest request = (HttpServletRequest)
|
final HttpServletRequest request = (HttpServletRequest)
|
||||||
context.getExternalContext().getRequest();
|
context.getExternalContext().getRequest();
|
||||||
BufferedReader bufferedReader = request.getReader();
|
final TemplatingService ts = TemplatingService.getInstance();
|
||||||
StringBuffer sb = new StringBuffer();
|
final Document result = ts.parseXML(request.getInputStream());
|
||||||
do
|
this.instanceData.setContent(result);
|
||||||
{
|
|
||||||
String s = bufferedReader.readLine();
|
|
||||||
if (s == null)
|
|
||||||
break;
|
|
||||||
sb.append(s).append('\n');
|
|
||||||
}
|
|
||||||
while (true);
|
|
||||||
String xml = sb.toString();
|
|
||||||
System.out.println("you submitting " + xml);
|
|
||||||
final ResponseWriter out = context.getResponseWriter();
|
final ResponseWriter out = context.getResponseWriter();
|
||||||
out.write(xml);
|
ts.writeXML(result, out);
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,4 +188,31 @@ public class XFormsBean
|
|||||||
{
|
{
|
||||||
LOGGER.debug("handleEvent " + e);
|
LOGGER.debug("handleEvent " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stores cookies that may exist in request and passes them on to processor for usage in
|
||||||
|
* HTTPConnectors. Instance loading and submission then uses these cookies. Important for
|
||||||
|
* applications using auth.
|
||||||
|
*
|
||||||
|
* @param request the servlet request
|
||||||
|
* @param adapter the Chiba adapter instance
|
||||||
|
*/
|
||||||
|
private static void storeCookies(final javax.servlet.http.Cookie[] cookiesIn,
|
||||||
|
final ChibaBean chibaBean){
|
||||||
|
if (cookiesIn != null) {
|
||||||
|
org.apache.commons.httpclient.Cookie[] commonsCookies =
|
||||||
|
new org.apache.commons.httpclient.Cookie[cookiesIn.length];
|
||||||
|
for (int i = 0; i < cookiesIn.length; i += 1) {
|
||||||
|
commonsCookies[i] =
|
||||||
|
new org.apache.commons.httpclient.Cookie(cookiesIn[i].getDomain(),
|
||||||
|
cookiesIn[i].getName(),
|
||||||
|
cookiesIn[i].getValue(),
|
||||||
|
cookiesIn[i].getPath(),
|
||||||
|
cookiesIn[i].getMaxAge(),
|
||||||
|
cookiesIn[i].getSecure());
|
||||||
|
}
|
||||||
|
chibaBean.getContext().put(AbstractHTTPConnector.REQUEST_COOKIE,
|
||||||
|
commonsCookies);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
26
source/java/org/alfresco/web/templating/InstanceData.java
Normal file
26
source/java/org/alfresco/web/templating/InstanceData.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* 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.alfresco.web.templating;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
|
public interface InstanceData
|
||||||
|
{
|
||||||
|
public Document getContent();
|
||||||
|
|
||||||
|
public void setContent(final Document d);
|
||||||
|
}
|
@@ -21,7 +21,7 @@ import java.io.Writer;
|
|||||||
|
|
||||||
public interface TemplateInputMethod
|
public interface TemplateInputMethod
|
||||||
{
|
{
|
||||||
public void generate(final Document xmlContent,
|
public void generate(final InstanceData instanceData,
|
||||||
final TemplateType tt,
|
final TemplateType tt,
|
||||||
final Writer out);
|
final Writer out);
|
||||||
|
|
||||||
|
@@ -129,6 +129,13 @@ public class TemplatingService
|
|||||||
this.writeXML(n, new FileWriter(output));
|
this.writeXML(n, new FileWriter(output));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String writeXMLToString(final Node n)
|
||||||
|
{
|
||||||
|
final StringWriter result = new StringWriter();
|
||||||
|
this.writeXML(n, result);
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public Document parseXML(final String source)
|
public Document parseXML(final String source)
|
||||||
throws ParserConfigurationException,
|
throws ParserConfigurationException,
|
||||||
SAXException,
|
SAXException,
|
||||||
|
@@ -44,7 +44,7 @@ public class XFormsInputMethod
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generate(final Document xmlContent,
|
public void generate(final InstanceData instanceData,
|
||||||
final TemplateType tt,
|
final TemplateType tt,
|
||||||
final Writer out)
|
final Writer out)
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ public class XFormsInputMethod
|
|||||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
final XFormsBean xforms = (XFormsBean)
|
final XFormsBean xforms = (XFormsBean)
|
||||||
FacesHelper.getManagedBean(fc, "XFormsBean");
|
FacesHelper.getManagedBean(fc, "XFormsBean");
|
||||||
xforms.setInstanceData(xmlContent);
|
xforms.setInstanceData(instanceData);
|
||||||
xforms.setTemplateType(tt);
|
xforms.setTemplateType(tt);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -21,12 +21,33 @@
|
|||||||
<%@ page import="org.alfresco.web.app.Application" %>
|
<%@ page import="org.alfresco.web.app.Application" %>
|
||||||
<%@ page import="org.alfresco.web.templating.*" %>
|
<%@ page import="org.alfresco.web.templating.*" %>
|
||||||
<%@ page import="org.alfresco.web.bean.content.CreateContentWizard" %>
|
<%@ page import="org.alfresco.web.bean.content.CreateContentWizard" %>
|
||||||
|
<%@ page import="org.w3c.dom.Document" %>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
CreateContentWizard wiz = (CreateContentWizard)
|
final CreateContentWizard wiz = (CreateContentWizard)
|
||||||
Application.getWizardManager().getBean();
|
Application.getWizardManager().getBean();
|
||||||
TemplateType tt = wiz.getTemplateType();
|
TemplateType tt = wiz.getTemplateType();
|
||||||
TemplateInputMethod tim = tt.getInputMethods().get(0);
|
TemplateInputMethod tim = tt.getInputMethods().get(0);
|
||||||
TemplatingService ts = TemplatingService.getInstance();
|
final TemplatingService ts = TemplatingService.getInstance();
|
||||||
tim.generate(wiz.getContent() != null ? ts.parseXML(wiz.getContent()) : null, tt, out);
|
final InstanceData instanceData = new InstanceData() {
|
||||||
|
|
||||||
|
public Document getContent()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return wiz.getContent() != null ? ts.parseXML(wiz.getContent()) : null;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(final Document d)
|
||||||
|
{
|
||||||
|
wiz.setContent(ts.writeXMLToString(d));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
tim.generate(instanceData, tt, out);
|
||||||
%>
|
%>
|
||||||
|
@@ -22,11 +22,15 @@
|
|||||||
<%@ page import="org.alfresco.web.app.Application" %>
|
<%@ page import="org.alfresco.web.app.Application" %>
|
||||||
<%@ page import="org.alfresco.web.bean.content.CreateXmlContentTypeWizard" %>
|
<%@ page import="org.alfresco.web.bean.content.CreateXmlContentTypeWizard" %>
|
||||||
<%@ page import="org.alfresco.web.templating.*" %>
|
<%@ page import="org.alfresco.web.templating.*" %>
|
||||||
|
<%@ page import="org.w3c.dom.Document" %>
|
||||||
<%
|
<%
|
||||||
CreateXmlContentTypeWizard wiz = (CreateXmlContentTypeWizard)
|
CreateXmlContentTypeWizard wiz = (CreateXmlContentTypeWizard)
|
||||||
Application.getWizardManager().getBean();
|
Application.getWizardManager().getBean();
|
||||||
TemplateType tt = wiz.getTemplateType();
|
TemplateType tt = wiz.getTemplateType();
|
||||||
TemplateInputMethod tim = tt.getInputMethods().get(0);
|
TemplateInputMethod tim = tt.getInputMethods().get(0);
|
||||||
tim.generate(null, tt, out);
|
final InstanceData instanceData = new InstanceData() {
|
||||||
|
public Document getContent() { return null; }
|
||||||
|
public void setContent(Document d) { }
|
||||||
|
};
|
||||||
|
tim.generate(instanceData, tt, out);
|
||||||
%>
|
%>
|
||||||
|
@@ -27,17 +27,41 @@
|
|||||||
org.alfresco.service.cmr.repository.*,
|
org.alfresco.service.cmr.repository.*,
|
||||||
org.alfresco.web.bean.content.*,
|
org.alfresco.web.bean.content.*,
|
||||||
org.alfresco.web.templating.*" %>
|
org.alfresco.web.templating.*" %>
|
||||||
|
<%@ page import="java.io.*" %>
|
||||||
|
<%@ page import="org.alfresco.web.app.Application" %>
|
||||||
|
<%@ page import="org.alfresco.web.bean.content.CreateXmlContentTypeWizard" %>
|
||||||
|
<%@ page import="org.alfresco.web.templating.*" %>
|
||||||
|
<%@ page import="org.w3c.dom.Document" %>
|
||||||
<%
|
<%
|
||||||
CheckinCheckoutBean ccb = (CheckinCheckoutBean)session.getAttribute("CheckinCheckoutBean");
|
final CheckinCheckoutBean ccb = (CheckinCheckoutBean)
|
||||||
|
session.getAttribute("CheckinCheckoutBean");
|
||||||
NodeRef nr = ccb.getDocument().getNodeRef();
|
NodeRef nr = ccb.getDocument().getNodeRef();
|
||||||
String ttName = (String)ccb.getNodeService().getProperty(nr, CreateContentWizard.TT_QNAME);
|
String ttName = (String)ccb.getNodeService().getProperty(nr, CreateContentWizard.TT_QNAME);
|
||||||
TemplatingService ts = TemplatingService.getInstance();
|
final TemplatingService ts = TemplatingService.getInstance();
|
||||||
TemplateType tt = ts.getTemplateType(ttName);
|
final TemplateType tt = ts.getTemplateType(ttName);
|
||||||
System.out.println("tt " + tt);
|
|
||||||
TemplateInputMethod tim = tt.getInputMethods().get(0);
|
TemplateInputMethod tim = tt.getInputMethods().get(0);
|
||||||
String url = tim.getInputURL(ts.parseXML(ccb.getDocumentContent()), tt);
|
final InstanceData instanceData = new InstanceData() {
|
||||||
System.out.println("inputurl " + url);
|
|
||||||
|
public Document getContent()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return ccb.getDocumentContent() != null ? ts.parseXML(ccb.getDocumentContent()) : null;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(final Document d)
|
||||||
|
{
|
||||||
|
ccb.setEditorOutput(ts.writeXMLToString(d));
|
||||||
|
}
|
||||||
|
};
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<r:page titleId="title_edit_text_inline">
|
<r:page titleId="title_edit_text_inline">
|
||||||
|
|
||||||
<f:view>
|
<f:view>
|
||||||
@@ -152,8 +176,8 @@ System.out.println("inputurl " + url);
|
|||||||
<tr>
|
<tr>
|
||||||
<td width="100%" valign="top" height="360px">
|
<td width="100%" valign="top" height="360px">
|
||||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
|
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
|
||||||
<iframe id="editor" style="width: 100%; height: 360px" src="<%= url %>">
|
<% tim.generate(instanceData, tt, out); %>
|
||||||
</iframe>
|
|
||||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
|
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -110,7 +110,30 @@ function load_body(body, ui_element_stack)
|
|||||||
var nodeRef = document.createElement("div");
|
var nodeRef = document.createElement("div");
|
||||||
nodeRef.setAttribute("style", "height: 200px; border: solid 1px black;");
|
nodeRef.setAttribute("style", "height: 200px; border: solid 1px black;");
|
||||||
cell.appendChild(nodeRef);
|
cell.appendChild(nodeRef);
|
||||||
var w = dojo.widget.createWidget("Editor", { items: ["|", "bold", "italic", "underline", "strikethrough", "|", "colorGroup", "|", "createLink", "insertImage" ] }, nodeRef);
|
var id = o.getAttribute("id");
|
||||||
|
var initial_value = get_initial_value(o);
|
||||||
|
nodeRef.appendChild(document.createTextNode(initial_value));
|
||||||
|
var w = dojo.widget.createWidget("Editor",
|
||||||
|
{
|
||||||
|
widgetId: id,
|
||||||
|
focusOnLoad: false,
|
||||||
|
items: [ "|", "bold", "italic", "underline", "strikethrough", "|", "colorGroup", "|", "createLink", "insertImage" ]
|
||||||
|
},
|
||||||
|
nodeRef);
|
||||||
|
dojo.event.connect(w,
|
||||||
|
"setRichText",
|
||||||
|
function(event)
|
||||||
|
{
|
||||||
|
dojo.event.connect(w._richText,
|
||||||
|
"onBlur",
|
||||||
|
function()
|
||||||
|
{
|
||||||
|
setXFormsValue(w.widgetId,
|
||||||
|
w._richText.getEditorContent());
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "xforms:input":
|
case "xforms:input":
|
||||||
var id = o.getAttribute("id");
|
var id = o.getAttribute("id");
|
||||||
@@ -266,11 +289,17 @@ function load_body(body, ui_element_stack)
|
|||||||
for (var i in values)
|
for (var i in values)
|
||||||
{
|
{
|
||||||
var radio = document.createElement("input");
|
var radio = document.createElement("input");
|
||||||
|
radio.setAttribute("id", o.getAttribute("id"));
|
||||||
radio.setAttribute("name", o.getAttribute("id"));
|
radio.setAttribute("name", o.getAttribute("id"));
|
||||||
radio.setAttribute("type", "radio");
|
radio.setAttribute("type", "radio");
|
||||||
radio.setAttribute("value", values[i].value);
|
radio.setAttribute("value", values[i].value);
|
||||||
if (values[i].value == initial_value)
|
if (values[i].value == initial_value)
|
||||||
radio.setAttribute("checked", "true");
|
radio.setAttribute("checked", "true");
|
||||||
|
radio.onclick = function(event)
|
||||||
|
{
|
||||||
|
setXFormsValue(this.getAttribute("id"),
|
||||||
|
this.value);
|
||||||
|
}
|
||||||
nodeRef.appendChild(radio);
|
nodeRef.appendChild(radio);
|
||||||
nodeRef.appendChild(document.createTextNode(values[i].label));
|
nodeRef.appendChild(document.createTextNode(values[i].label));
|
||||||
}
|
}
|
||||||
@@ -278,6 +307,7 @@ function load_body(body, ui_element_stack)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var combobox = document.createElement("select");
|
var combobox = document.createElement("select");
|
||||||
|
combobox.setAttribute("id", o.getAttribute("id"));
|
||||||
nodeRef.appendChild(combobox);
|
nodeRef.appendChild(combobox);
|
||||||
for (var i in values)
|
for (var i in values)
|
||||||
{
|
{
|
||||||
@@ -288,6 +318,11 @@ function load_body(body, ui_element_stack)
|
|||||||
option.setAttribute("selected", "true");
|
option.setAttribute("selected", "true");
|
||||||
combobox.appendChild(option);
|
combobox.appendChild(option);
|
||||||
}
|
}
|
||||||
|
combobox.onchange = function(event)
|
||||||
|
{
|
||||||
|
setXFormsValue(this.getAttribute("id"),
|
||||||
|
this.options[this.selectedIndex].value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "xforms:submit":
|
case "xforms:submit":
|
||||||
@@ -414,7 +449,7 @@ function fireAction(id)
|
|||||||
mimetype: "text/xml",
|
mimetype: "text/xml",
|
||||||
load: function(type, data, evt)
|
load: function(type, data, evt)
|
||||||
{
|
{
|
||||||
alert("fired action " + id);
|
// alert("fired action " + id);
|
||||||
},
|
},
|
||||||
error: function(type, e)
|
error: function(type, e)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user