Combobox 我们如何使用WebScript在Alfresco中将输出格式转换为CSV而不是HTML?

Combobox 我们如何使用WebScript在Alfresco中将输出格式转换为CSV而不是HTML?,combobox,alfresco,Combobox,Alfresco,我们如何使用WebScript在Alfresco中将输出格式更改为CSV而不是HTML 下面是我对应的FTL和Webscript文件 recursive.get.html.ftl 您可以指定默认输出为csv。将其放入webscript描述文件(.desc.xml) 延伸 然后添加一个recursive.get.xml.ftl,它将创建csv输出。您可以指定默认输出为csv。将其放入webscript描述文件(.desc.xml) 延伸 然后添加一个recursive.get.xml.ftl,它

我们如何使用WebScript在Alfresco中将输出格式更改为CSV而不是HTML

下面是我对应的FTL和Webscript文件


recursive.get.html.ftl


您可以指定默认输出为csv。将其放入webscript描述文件(.desc.xml) 延伸


然后添加一个recursive.get.xml.ftl,它将创建csv输出。

您可以指定默认输出为csv。将其放入webscript描述文件(.desc.xml) 延伸


然后添加一个recursive.get.xml.ftl,它将创建csv输出。

是的,可以输出csv。指

您需要将desc文件更改为:

 <webscript>
  <shortname>recurcive</shortname>
  <description>Recursive</description>
  <url>/sample/recursive/{recursive}</url>
  <format default="csv">extension</format>
  <authentication>guest</authentication>
 </webscript>

驱邪的
递归的
/sample/recursive/{recursive}
延伸
客人
或者,如果您想将html作为默认格式,您可以使用csv扩展名(alfresco/service/recursive/blabla.csv)或format参数?format=csv调用脚本

然后创建一个递归的.get.csv.ftl文件,如下所示:

    <#macro recurse_macro node depth>
      <#if node.isContainer>       
            ${node.properties.name}
       <#list node.children as child>         
         <#if child.isContainer>
         ,         
         <@recurse_macro node=child depth=depth+1/>        
          <#list child.children as child2> 
            <#if child2.isDocument>
                ${child2.properties.name}
               <#if child2_has_next>,</#if>
            </#if>
          </#list>            
         </#if>
            \n        
       </#list>
      </#if>
    </#macro>

${node.properties.name}
,         
${child2.properties.name}
,
\n

我还没有测试代码,但我假设您理解这样的想法,即在每个主节点的末尾,您需要断开连接线,并且在每个子节点(最后一个除外)之后,您需要昏迷。

是的,可以输出csv。指

您需要将desc文件更改为:

 <webscript>
  <shortname>recurcive</shortname>
  <description>Recursive</description>
  <url>/sample/recursive/{recursive}</url>
  <format default="csv">extension</format>
  <authentication>guest</authentication>
 </webscript>

驱邪的
递归的
/sample/recursive/{recursive}
延伸
客人
或者,如果您想将html作为默认格式,您可以使用csv扩展名(alfresco/service/recursive/blabla.csv)或format参数?format=csv调用脚本

然后创建一个递归的.get.csv.ftl文件,如下所示:

    <#macro recurse_macro node depth>
      <#if node.isContainer>       
            ${node.properties.name}
       <#list node.children as child>         
         <#if child.isContainer>
         ,         
         <@recurse_macro node=child depth=depth+1/>        
          <#list child.children as child2> 
            <#if child2.isDocument>
                ${child2.properties.name}
               <#if child2_has_next>,</#if>
            </#if>
          </#list>            
         </#if>
            \n        
       </#list>
      </#if>
    </#macro>

${node.properties.name}
,         
${child2.properties.name}
,
\n
我还没有测试代码,但我假设您理解这样的想法,即在每个主节点的末尾,您需要断开连接线,在每个子节点之后(最后一个除外),您需要昏迷

    <#macro recurse_macro node depth>
      <#if node.isContainer>       
            ${node.properties.name}
       <#list node.children as child>         
         <#if child.isContainer>
         ,         
         <@recurse_macro node=child depth=depth+1/>        
          <#list child.children as child2> 
            <#if child2.isDocument>
                ${child2.properties.name}
               <#if child2_has_next>,</#if>
            </#if>
          </#list>            
         </#if>
            \n        
       </#list>
      </#if>
    </#macro>