如何从Spring MVC应用程序使用Alfresco“在线编辑”功能 [英] How to use Alfresco 'Edit Online' functionality from Spring MVC application

查看:193
本文介绍了如何从Spring MVC应用程序使用Alfresco“在线编辑”功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在调查Alfresco的Sharepoint功能。
我安装了Alfresco 3.4,并按照 Web快速入门安装进行操作。

I am currently investigating Alfresco's Sharepoint functionality. I installed Alfresco 3.4 and followed the Web Quick Start Installation.

然后我将Word文档上载到Alfresco,并可以在浏览器中导航到它。我的网址是 http:// localhost:8080 / share / page / site / webqs / document-details?nodeRef = workspace:// SpacesStore / f7f5881e-320e-4d73-85e4-b62752fef1b8

I then uploaded a word document to Alfresco and can navigate to it in a browser. My URL is http://localhost:8080/share/page/site/webqs/document-details?nodeRef=workspace://SpacesStore/f7f5881e-320e-4d73-85e4-b62752fef1b8

使用Internet Explorer,在文档操作部分下有一个在线编辑按钮。遗憾的是,此按钮不适用于Firefox或Google Chrome。按钮的HTML源代码对我没有多大帮助,因为我可以看到一个URL:

Using Internet Explorer there is an 'Edit Online' button under the 'Document Actions' section. Sadly this button is not available with firefox or google chrome. The HTML source for the button doesn't help me much as I can see a URL:

<div class="onActionEditOnline">
  <a rel="edit,online-edit" href="" class="action-link" title="Edit Online">
    <span>Edit Online</span>
  </a>
</div>

在露天场所进行研究时,人们建议学习 Spring Surf ,因为它是使用Alfresco / share应用程序编写的。 Spring Surf教程使用 Roo ,这又包含一个Spring Surf插件,我无法运行它,由其他人此处报告。

While researching thing at the alfresco site people recommended learning Spring Surf as the Alfresco /share application was written using it. The Spring Surf tutorial uses Roo, this in turn has a Spring Surf addin, which I could not get running, reported by someone else here.

返回在线编辑按钮本身;当我单击它时,在客户端计算机上的Word中打开了Word文档,我可以对其进行编辑
,然后单击保存在Word中,使用Sharepoint协议将文档正确地保存回Alfresco。

Back to the 'Edit Online' button itself; when I click it the word document is opened in Word on my client machine, I can edit it and click save in Word, using the Sharepoint protocol the document is correctly saved back to Alfresco.

我的问题是如何从自己的Spring MVC应用程序访问此在线编辑功能?我希望
在我的一个JSP上显示此在线编辑按钮,但我不知道如何与Alfresco进行交互。
有人这样做吗?

My question is how can I access this 'Edit Online' functionality from my own Spring MVC application? I would like to have this 'Edit Online' button visible on one of my JSPs but I don't know how to interact with Alfresco. Has anyone done this? Any help appreciated!

推荐答案

Alfresco中的Sharepoint集成利用了运行Sharepoint服务器的嵌入式Jetty服务器。如果您查看在线编辑的URL,它将显示与所有Alfresco网页不同的端口号(默认为7070)。

The Sharepoint integration in Alfresco makes use of an embedded Jetty server running the Sharepoint server. If you look at the URL that the "Edit Online", it will show a different port number than all Alfresco web pages (7070 by default).

我从没有运行过对此主题进行了深入的研究,但是由于Sharepoint是HTTP的WebDAV扩展,可能使用一些特殊的标头或内置的浏览器插件/功能,为了在您的站点中创建在线编辑功能,您只需提供Alfresco为在线编辑创建的相同URL,并确保用户正在运行IE。这会将用户定向到 VTI服务器,从而几乎完全将SpringMVC排除在图片之外(您可以只是必须生成正确的URL。)

I never ran any deep investigation on the subject, but since Sharepoint is a WebDAV-like extension of HTTP, possibly using some special headers or built in browser plugin/feature, in order to create an "Edit online" functionality in your site you just have to offer the same URLs Alfresco creates for online editing, and make sure the user is running IE. This will direct the user to the VTI server, thus almost completely leaving SpringMVC out of the picture (you just have to generate proper URLs).

编辑:露天演出如何生成VTI URL

how alfresco generates VTI URLs

看看 actions.js ,它实际上是在共享中生成在线编辑链接下面的URL。 _launchOnlineEditor 方法是处理对您看到的那些空链接的点击的方法,它还提供了创建URL的逻辑:

Have a look at actions.js, which is actually generating the URLs underlying the Edit Online links in Share. The _launchOnlineEditor method is what handles clicks to those empty links you saw, and it also provides the logic that creates the url:

        // Ensure we have the record's onlineEditUrl populated
        if (!Alfresco.util.isValueSet(record.onlineEditUrl))
        {
           var onlineEditUrl = this.doclistMetadata.custom.vtiServer.host + ":" +
                 this.doclistMetadata.custom.vtiServer.port + "/" +
                 $combine("alfresco", loc.site.name, loc.container.name, loc.path, loc.file);

           if (!(/^(http|https):\/\//).test(onlineEditUrl))
           {
              // VTI server now supports HTTPS directly http://issues.alfresco.com/jira/browse/DOC-227
              onlineEditUrl = window.location.protocol + "//" + onlineEditUrl;
           }
           record.onlineEditUrl = onlineEditUrl;
        }

如果我们有例如:

loc.site.name == mySite
loc.container.name == documentLibrary
loc.path == /images
loc.file == logo.png

具有VTI服务器的默认值,它将产生以下URL:

with default values for the VTI server it would produce the following URL:

http://localhost:7070/alfresco/mySite/documentLibrary/images/logo.png

如果您还继续阅读该方法,事实证明我完全错了:将Office应用程序与特定应用程序相关联的不仅仅是简单的MS魔术网址,而是在您的浏览器中创建的 ActiveX控件正确的调用:

If you also continue reading that method, it turns out that I was totally wrong: it's not just simple MS magic that associate Office applications to specific URLs, but rather an ActiveX control being created on your browser that results in the proper invocation:

var controlProgID = "SharePoint.OpenDocuments",
//...
activeXControl = new ActiveXObject(controlProgID + ".3");
return activeXControl.EditDocument3(window, record.onlineEditUrl, true, appProgID);

这应该完整说明如何从自定义应用程序创建Sharepoint链接,并指向正确的位置在Alfresco存储库中。

This should complete the picture of how to create Sharepoint links from your custom applications, pointing to the right location in the Alfresco repository.

这篇关于如何从Spring MVC应用程序使用Alfresco“在线编辑”功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆