cetra3 / etherpad-alfresco

Alfresco to Etherpad integration
www.parashift.com.au
Other
5 stars 5 forks source link

Enable etherpad in create content #3

Open iwkse opened 9 years ago

iwkse commented 9 years ago

Hi @cetra3 I would like to ask you if it's possible to also have the ability to create a document directly from the Create menu, I think it's more intuitive because if could also be created a content specific for realtime collaboration. Is it possible or it's a problematic solution? regards

cetra3 commented 9 years ago

Definitely possible! Would need to find out where you can stick in another entry to that "Create" menu, and add it in. Would you imagine that you'd still need to prompt for a file name?

iwkse commented 9 years ago

Well to find it out it's easy. There's the create-content section in share-config{,-custom}.xml where you can add it like this:

<content id="html" label="create-content.html" type="pagelink" index="20">
  <param name="page">create-content?destination={nodeRef}&amp;itemId=cm:content&amp;mimeType=text/html</param>
</content>

and from ../alfresco/site-data/template-instances/create-content.xml

 <!-- Create Content Form -->
      <component>
         <region-id>create-content</region-id>
         <url>/components/form?mimeType={mimeType}&amp;destination={destination}&amp;formId={formId}</url>
         <properties>
            <itemKind>type</itemKind>
            <itemId>{itemId}</itemId>
            <mode>create</mode>
            <submitType>json</submitType>
            <showCaption>true</showCaption>
            <showCancelButton>true</showCancelButton>
            <editInline>true</editInline>
         </properties>
      </component>

It should point to a function where eptherpad is launched. To avoid the prompt for file name and other stuff maybe it could be used the HTML create content as starting point and substitute the default editor to etherpad? Do you think is it feasible? Also another small thing needed is a feedback while clicking on the button Save Back (also save back could be moved to properties files) for example a tooltip saying document saved or something like that. I'd like to help with that but I'm rather new in Alfresco development but if you direction me it can also be positive for me as I can learn by doing.

cetra3 commented 9 years ago

When you click Create HTML... then what happens is it goes to another page. The difference is that this node ref in the URL is the parent UUID rather than the noderef UUID. As the node hasn't been created yet, this means there needs to be an alternative workflow to the edit etherpad page.

There will need to be a few changes made

Server Side (share)

The page currently expects that nodeRef is set as a URL argument. It calls Alfresco and updates the etherpad pad with the existing html content.

This would need to be expanded to include another URL argument, such as destination to indicate that rather than loading content from an existing node, this is actually the folder where we want the new content to go. If the destination argument is set, then basically we still need to create a temporary pad, but without any content.

Last bit of the puzzle would be to expose and include a form for the Name of the node on the etherpad page.

The server side component can be found here:

https://github.com/cetra3/etherpad-alfresco/tree/master/share/src/main/resources/alfresco/site-webscripts/com/parashift

Client Side

This would also need to be changed to check whether the destination URL argument is set. If it is, we'd need to invoke a separate API to create the node rather than update an existing one. When you hit save back, it should save the resulting node ref, so that if you hit save back again you're not creating a completely new node every time.

Client side scripts are here:

https://github.com/cetra3/etherpad-alfresco/tree/master/share/src/main/resources/META-INF/components/etherpad

iwkse commented 9 years ago

Thanks @cetra3 for the hints, I'm reading the code and also look at alfresco sources I will let you know as soon as I have something or if I'm stuck!

iwkse commented 8 years ago

Hi @cetra3 I'm writing here to ask you something for the integration plugins (both Etherpad and OnlyOffice). I've see for both of them you have used actions to "modify" an existing file. Did you follow this route because using the create-content way has some issues? I've been working on this and collected several information to go for that route, if you're interested about my work we can discuss about it, just probably in a different place than bug reports. Let me know, regards

cetra3 commented 8 years ago

Hi @iwkse, happy to discuss this.

Our website (on my profile) has a contact email, so best avenue is through there.