AnsweredAssumed Answered

Using the WebDAV prompt for Edit Online documents

Question asked by bengrah on Apr 15, 2011
Hi all

We've got a customisation in place (which started here; http://forums.alfresco.com/en/viewtopic.php?f=48&t=38273) where when you click on the document link in Share it does an Edit Online instead of taking you to the document details. Basically we've changed the code so that it uses a different variable that is the WebDAV link of that document:

In documentlist.js we make the following addition to getActionURLs:
            
editOnlineUrl: "http://alfresco:8080/alfresco/webdav/" + loc.path + loc.displayName,
downloadUrl: Alfresco.constants.PROXY_URI + contentUrl + "?a=true",
viewUrl:  Alfresco.constants.PROXY_URI + contentUrl + "\" target=\"_blank",

Then in Alfresco.DocumentList.generateFileFolderLinkMarkup you change the value of HTML to get the editOnlineUrl instead:
Alfresco.DocumentList.generateFileFolderLinkMarkup = function DL_generateFileFolderLinkMarkup(scope, oRecord)
   {
      var record = oRecord.getData(),
         html;

      if (record.isLink && scope.options.workingMode === Alfresco.doclib.MODE_SITE && record.location.site !== scope.options.siteId)
      {
         if (record.isFolder)
         {
            html = $siteURL("documentlibrary?path=" + encodeURIComponent(record.location.path),
            {
               site: record.location.site
            });
         }
         else
         {
            html = scope.getActionUrls(record, record.location.site).editOnlineUrl;
         }
      }
      else
      {
         if (record.isFolder)
         {
            html = '#" class="filter-change" rel="' + Alfresco.DocumentList.generatePathMarkup(record.location);
         }
         else
         {
            html = scope.getActionUrls(record).editOnlineUrl;
         }
      }

      return '<a href="' + html + '">';
   };

This then calls the WebDAV link of that document. Once clicked on, the user gets an IE prompt with three controls; Open, Cancel and Save. Open opens the document in WebDAV and locks the document while it's being edited.

This prompt is our issue. If you click the Edit Online action via Document Details or in document library, you get a simpler prompt that gives you two options; Open or Cancel. We would like this prompt instead as it leaves less room for error on the user's part.

So after doing a bit of digging I noticed that when the Edit Online action is called, the URL to be used to get the document is constructed and put in a variable called "onlineEditURL". This variable is then later used in actions.js, in order to trigger some ActiveXObjects that interact with the Sharepoint module. I'm not exactly sure what is done at this point, but I believe this is where the aformentioned "simpler" prompt comes from.

Does anyone have any ideas how we can retain our functionality of clicking on a document link to trigger and Edit Online, AND obtain the prompt that only appears when using Edit Online through actions?

Thanks! Apologies for the verbose post.

Outcomes