Examples of TMLForm


Examples of de.innovationgate.wgpublisher.webtml.utils.TMLForm

        } else {
            // try to retrieve from current post-request
            data = retrieveMultipartFormData(request);
        }           
        // create TMLForm if data is available
        TMLForm form = null;
        if (data != null) {
          // F00004936
          // check if this request contains a tmlform ($forminfo is present)
          // otherwise this is an standard multipart request and multipartData will be transported
          // as raw data within the tmlvar "multipartData"
          boolean isTMLForm = false;
          Iterator multipartItems = data.iterator();
          while (multipartItems.hasNext()) {
            FileItem fi = (FileItem) multipartItems.next();
            if (fi.getFieldName().equals("$forminfo")) {
              isTMLForm = true;
            }
          }
         
          if (isTMLForm) {
                //create a tml form object
                form = processTMLForm(request, data)
          } else {
            // put multipartdata in request for custom processing
            // used by CM for multi file uploads
            getTMLContext().setvar("multipartData", data);
          }
        }
       
       
       
        // Process WebTML var parameters
        String varParam = request.getParameter(URLPARAM_VARS);
        if (varParam != null) {
            try {
                processVarParams(varParam);
            }
            catch (Exception e) {
                log.error("Exception processing var params", e);
                addWarning("Unable to process var params: " + e.getMessage());         
            }      
        }

        // eventually execute action
        boolean actioncalled = false;
        try {
          actioncalled = processAction(request, form, status._ajax);
        }
        catch (Exception e) {
          log.error("Exception processing WebTML action", e);
          addWarning("Unable to process WebTML action: " + e.getMessage());         
        }
                   
        // if an action was called
        if (actioncalled) {
            // if keepOnValidate is true and form was validated once and form was not validated
            // in this request
            if (form != null) {
                FormInfo formInfo = form.getforminfo();
                if (formInfo.isValidated() && formInfo.keepOnValidate() && !form.wasValidatedInThisRequest()) {
                    form.validate();
                }
            }
        }
       
        if (status._ajax) {
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLForm

   
    private TMLForm processTMLForm(HttpServletRequest request, List multipartData) {
       
        Status status = (Status) getStatus();
       
        TMLForm form = null;
        try {
            form = new TMLForm(multipartData, this.getTMLContext(), this.getCore().getLog(), request);
        } catch (TMLException e) {
            this.getTMLContext().addwarning("Error creating TMLForm object bc. of exception: " + e.getClass().getName() + " message: " + e.getMessage(), true);
            return null;
        } catch (WGAPIException e) {
            this.getTMLContext().addwarning("Error creating TMLForm object bc. of exception: " + e.getClass().getName() + " message: " + e.getMessage(), true);
            return null;
        } catch (UnsupportedEncodingException e) {
            this.getTMLContext().addwarning("Error creating TMLForm object bc. of exception: " + e.getClass().getName() + " message: " + e.getMessage() + " - ensure that you have configured a valid 'characterEncoding'", true);
            return null;
        }
       
        // Eventually merge with persistent form
        TMLForm persistentForm = (TMLForm) getTMLContext().getPersistentForms().get(form.getformid());
        if (persistentForm != null) {
            persistentForm.importForm(form);
            form = persistentForm;             
        }
        else {
            getTMLContext().registerForm(form, false);         
        }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLForm

           
            if (getPageContext().getRequest().getAttribute(REQUEST_ATTRIB_IS_AJAX_SUBFORM) != null &&
                (Boolean)getPageContext().getRequest().getAttribute(REQUEST_ATTRIB_IS_AJAX_SUBFORM)) {
              String formId = status.getRelevantForm();
              if (formId != null) {
                TMLForm form = getTMLContext().tmlformbyid(formId);
                if (form != null) {
                  try {
              String serializedInfo = FormBase.serializeFormInfo(form.getforminfo(), getTMLContext());
                    StringBuffer javaScript = new StringBuffer();
                    if (!status._isAjaxNoRefreshCall) {
                        javaScript.append("<script type=\"text/javascript\">");
                    }
                javaScript.append("var form = document.forms['" + form.getformid() + "'];");
                javaScript.append("if( form ) {");
                javaScript.append("form.$forminfo.value = \"" + serializedInfo +"\";");
                javaScript.append("form.removeAttribute('target');");
                javaScript.append("form.removeAttribute('action');");
                javaScript.append("}");
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLForm

            this.getTMLContext().addwarning("Could not find corresponding formtag.", true);
            return;           
        }               
       
        String formId = formTag.formInfo.getFormId();
        TMLForm _tmlForm = this.getTMLContext().tmlformbyid(formId);
        // show message in body only if condition failed
        if (!_tmlForm.conditionFailed(condition)) {
            this.setResultOutput(false);
        } else {
            // resolve scriptlets
            RhinoExpressionEngine engine = (RhinoExpressionEngine) ExpressionEngineFactory.getEngine(ExpressionEngineFactory.ENGINE_TMLSCRIPT);
            if (engine == null) {
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLForm

        return;
      }
      result = portlet.itemlist(itemName);
    }
        else if (type.equals("tmlform")) {
            TMLForm form = tmlContext.gettmlform();
            if (form == null) {
                addWarning("There is no current WebTML form at this position in the current request");
                return;
            }
            result = form.fieldlist(itemName);
        }
   
        // The item does not exist or is empty. Treat as empty list.
    if (result == null) {
      result = new ArrayList();;
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLForm

               
                model.getHdb().assignContentUID(newContent, params.getCreateContentID());
                newContent.setItemValue(HDBModel.ITEM_ID, params.getCreateContentID());

                // Transfer eventual form data
                TMLForm form = params.getForm();
                if (form != null) {
                    form.transfertodocument(newContent);
                    form.attach(event.getContent());
                }
               
                // We need to save here once, so submodel initialisations have access to the data on this content
                newContent.save();
               
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLForm

          if (customListener != null) {
            customListener.preCreateContent(event);
          }       
      }
       
        TMLForm form = params.getForm();
        if (form != null) {
            // validate form
            if (!form.validate()) {
                form.gettargetcontext().addwarning("Form validation during storeindocument() failed. Formdata not saved.", false);
                event.cancel("Form validation failed");
            }       
         }
       
    }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLForm

            Map<String, Object> processParams = new HashMap<String, Object>();
            processParams.put("hdbEvent", "event");
            params.getProcess().run(event.getContent(), processParams);
          }
           
            TMLForm form = params.getForm();
            if (form != null) {
                // validate form
                if (!form.validate()) {
                    form.gettargetcontext().addwarning("Form validation during storeindocument() failed. Formdata not saved.", false);
                    event.cancel("Form validation failed");
                    return;
                }       

                // Transfer form data
                form.transfertodocument(event.getContent());
            }
        }
     
    }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLForm

        // Register with form (or item for BI-CustomEditor) parent (if present) and retrieve item values from it;
        FormInputRegistrator formBase = (FormInputRegistrator) getStatus().getAncestorTag(FormBase.class);
       
        if (formBase == null && isAjaxRequest()) {
          // try to retrieve form from ajax call
          final TMLForm form = getTMLContext().gettmlform();
          if (form != null) {
            formBase = new AjaxFormInputRegistrator(form);
          }
        }
       
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLForm

         * if (tmlForm != null && tmlForm.isEditable()) { return
         * tmlForm.getformid(); }
         */
        Boolean subForm = (Boolean) tmlContext.getrequest().getAttribute(Root.REQUEST_ATTRIB_IS_AJAX_SUBFORM);
        if (subForm != null && subForm) {
            TMLForm tmlform = tmlContext.gettmlform();
            if (tmlform != null) {
                return tmlform.getformid();
            }
        }
        return null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.