表单级别的 Orbeon 自定义元数据

Orbeon Custom metadata at form level

我想在表单级别配置成功消息(successMessageTextBox)和下载链接(linkTextbox) (元数据)通过 formBuilder,以便管理员可以随时更改和发布。 properties-local.xml 文件也可以访问这些值以配置 success-message.

例如:

navigate(uri="{xxf:instance('fr-parameters-instance')//linkTextbox}")

success-message(message = "{xxf:instance('fr-parameters-instance')//successMessageTextBox}")

如有任何建议,我们将不胜感激!!

更新 :-

1>元数据

  if (exists(xxf:instance('fr-form-metadata')/linkTextbox)‌​) 
            then navigate(uri="{xxf:instance('fr-form-metadata')/linkTextbox}")
            else nop

2>Formfeild

if (exists(xxf:instance('fr-form-instance')//linkTextbox)‌​) 
        then success-message(message = "{xxf:instance('fr-form-instance')//linkTextbox}") 
        else then success-message("save-success") 

存在代码快照

 <property as="xs:string"  name="oxf.fr.detail.process.save-final.*.*">
            require-uploads
            then validate-all
            then save
            if (exists(xxf:instance('fr-form-instance')//linkTextbox)‌​) 
            then navigate(uri="{xxf:instance('fr-form-instance')//linkTextbox}")
            else nop
            recover error-message("database-error") 
  </property>

代码快照为空

    <property as="xs:string"  name="oxf.fr.detail.process.save-final.*.*">
                    require-uploads
                    then validate-all
                    then save
                   then
                   (
                     if ("not(xxf:is-blank(xxf:instance('fr-form-instance')//msg))") 
                     then success-message(message = "{xxf:instance('fr-form-instance')//msg}")
                     else nop
                    )
                    recover error-message("database-error") 
          </property>

错误日志 :-

2016-09-26 23:06:44,925 INFO  lifecycle  - event: {"request": "21", "session": "AA57957F553E16581E264D06E3241BFD", "source": "fr", "message": "start: process", "uuid": "3bd78eb64e035d7d710a74049c972aca086b095a", "scope": "oxf.fr.detail.process", "name": "save-final-custom"}
2016-09-26 23:06:45,302 ERROR XFormsServer  - 
+----------------------------------------------------------------------------------------------------------------------+
|An Error has Occurred                                                                                                 |
|----------------------------------------------------------------------------------------------------------------------|
|Invalid source:                                                                                                       |
|Invalid input 'f', expected OptWhiteSpace or ')' (line 9, pos 39):                                                    |
|  if ('not(xxf:is-blank(xxf:instanc                                                                                   |
|e('fr-form-instance')//msg))')                                                                                        |
|                                      ^                                                                               |
|----------------------------------------------------------------------------------------------------------------------|
|Application Call Stack                                                                                                |
|----------------------------------------------------------------------------------------------------------------------|
|----------------------------------------------------------------------------------------------------------------------|
|Exception: org.parboiled.errors.ParsingException                                                                      |
|----------------------------------------------------------------------------------------------------------------------|
|org.orbeon.oxf.fr.process.ProcessParser$           |parse                         |ProcessParser.scala           | 121|
|nterpreter$ProcessRuntime$$anonfun$parseProcess|apply                         |ProcessInterpreter.scala      | 201|
|nterpreter$ProcessRuntime$$anonfun$parseProcess|apply                         |ProcessInterpreter.scala      | 201|
|org.orbeon.oxf.util.ScalaUtils$BooleanWrapper$     |option$extension              |ScalaUtils.scala              | 115|
|n.oxf.fr.process.ProcessInterpreter$ProcessRuntime$|parseProcess                |ProcessInterpreter.scala      | 201|
|n.oxf.fr.process.ProcessInterpreter$ProcessRuntime$|runSubProcess                 |ProcessInterpreter.scala      | 203|
|nonfun$apply$$anonfun$apply$$anonfun$apply|apply                         |ProcessInterpreter.scala      | 235|
|nonfun$apply$$anonfun$apply$$anonfun$apply|apply                         |ProcessInterpreter.scala      | 235|
|scala.util.control.Breaks$$anon                  |catchBreak                    |Breaks.scala                  |  63|
|un$runProcess$$anonfun$apply$$anonfun$apply|apply                         |ProcessInterpreter.scala      | 236|
|un$runProcess$$anonfun$apply$$anonfun$apply|apply                         |ProcessInterpreter.scala      | 233|
|scala.util.Success                                 |flatMap                       |Try.scala                     | 231|
|Interpreter$$anonfun$runProcess$$anonfun$apply|apply                         |ProcessInterpreter.scala      | 233|
|Interpreter$$anonfun$runProcess$$anonfun$apply|apply                         |ProcessInterpreter.scala      | 241|
|org.orbeon.oxf.util.DynamicVariable                |withValue                     |DynamicVariable.scala         |  42|
|n.oxf.fr.process.ProcessInterpreter$ProcessRuntime$|withEmptyStack                |ProcessInterpreter.scala      |  96|
|fr.process.ProcessInterpreter$$anonfun$runProcess|apply                         |ProcessInterpreter.scala      | 232|
|fr.process.ProcessInterpreter$$anonfun$runProcess|apply                         |ProcessInterpreter.scala      | 232|
+----------------------------------------------------------------------------------------------------------------------+
2016-09-26 23:06:45,396 INFO  lifecycle  - event: {"request": "21", "session": "AA57957F553E16581E264D06E3241BFD", "source": "fr", "message": "end: process", "time": "471 ms"}
2016-09-26 23:06:45,593 INFO  lifecycle  - event: {"request": "21", "session": "AA57957F553E16581E264D06E3241BFD", "source": "xforms", "message": "after cacheOrStore", "document cache current size": "1", "document cache max size": "50"}
2016-09-26 23:06:45,594 INFO  ProcessorService  - /xforms-server - Timing: 1198

我宁愿将其添加到 fr-form-metadata 实例中,例如通过在 Form Builder 中编辑表单的源代码,并在 <metadata>:

中添加一个 <success-message>
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
    <metadata>
        ...
        <success-message>Submitted, all good!</success-message>
    </metadata>
</xf:instance>

然后,在您的流程中,您可以显示该消息:

success-message(message = "{xxf:instance('fr-form-metadata')/success-message}")