0

Link to Project: https://github.com/raystorm/Alfresco-Smalgyax

I am trying to:

  1. Upload Documents into Alfresco/Share
  2. Set a custom Document Type
  3. Set Metadata
  4. Use a Form that matches the Look/Feel of Alfresco/Share

I have Added a menu Item to the Create... menu. The link points to the create-content Page. I was unable to upload the the file with that page. I set a custom file input field, but could not upload the file. I was unable to get a custom form template to work.

I have now switched tactics.
I have a custom share service that can:

  1. Upload the file
  2. Set Document Type
  3. Set Metadata.
  4. Bare-bones HTML page. Note: Does not match the Alfresco/Share look/feel.

How can I set the Share service page template to actually look like the create-content page?


UPDATE

I reset the get page to match the hello-world template.

the first line of the file:

<#include "/org/alfresco/include/alfresco-template.ftl" />

threw the following error:

smalgyax-share_1     | Caused by: freemarker.template.TemplateNotFoundException: Template not found for name "org/alfresco/include/alfresco-template.ftl".
smalgyax-share_1     | The name was interpreted by this TemplateLoader: MultiTemplateLoader(loader1 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@3471b524, loader2 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@e944270, loader3 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@4a121f1c, loader4 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@6aa5340e, loader5 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@53c474eb, loader6 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@7fef2b21, loader7 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@255f313f, loader8 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@661974de, loader9 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@168a37da, loader10 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@103ab009, loader11 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@4c30bdf8, loader12 = org.springframework.extensions.webscripts.ClassPathStore$ClassPathTemplateLoader@61228f24).

The error occurs from both
service: http//:localhost:8180/share/service/hayts
and
Page: http://localhost:8180/share/page/upload-smalgyax-document

Raystorm
  • 6,180
  • 4
  • 35
  • 62

2 Answers2

3

I have downloaded your source code and customized the share project and added a custom share page, it works perfectly for me without any issues.

Your project doesn't have the required css files that's the reason it doesn't looks like as like other alfresco pages.

Please follow the below project in github it will work, let me know if you face any issues. https://github.com/Alfresco/alfresco-sdk-samples/tree/alfresco-51/all-in-one/add-surf-dashlet-and-page-share

Custom Share Page Folder Structure

Update:

TemplateFolderMissing GitStructure

UPDATE:

Please add a entry in share-config-custom.xml and change the name from hayts.xml to helloworldhome.xml under /site-data/pages.

 <config evaluator="string-compare" condition="SitePages">
        <pages>
            <page id="helloworldhome">helloworldhome</page>
        </pages>
    </config>
Arjun
  • 624
  • 2
  • 6
  • I've tried mimicking the repository, but share can't find some of the template files. Can you tell what I am doing wrong? – Raystorm Dec 10 '20 at 23:23
  • I looked into your source code, looks like template folder is missing under /web-extension. I have pasted the screenshots in the actual reply. Also please update your Git project if anything is missing i will take a look. Thank you! – Arjun Dec 11 '20 at 18:07
  • Both http://localhost:8180/share/page/upload-smalgyax-document and http://localhost:8180/share/service/hayts produce the same error about being unable to find the template. I've updated my project with the missing template folders and file – Raystorm Dec 11 '20 at 21:20
  • Looks like you are missing two steps here. 1. Please change the name under /site-data/pages to helloworldhome.xml instead of hayts.xml. 2. Add a entry in share-config-custom.xml for the helloworldhome. – Arjun Dec 11 '20 at 22:01
  • Please see the updated comments in the original answer. Thank you – Arjun Dec 11 '20 at 22:11
  • You have been a great help. I've accepted this answer. However, the service that worked when added manually isn't working when setup inside my AIO project. I've asked a new question https://stackoverflow.com/q/65262074/659354 can you look please. Thank you so much, – Raystorm Dec 12 '20 at 06:00
1

You can place below line in share-config-custom.xml or you can create share extension module.

Change item id as per your custom type instead of cm:content.

You custom type form control should be properly configured in share-config-custom.xml.

<config evaluator="string-compare" condition="DocumentLibrary">
                    <create-content>
                        <content id="acme-plain-text" label="Custom Menu" icon="text" type="pagelink">
                            <param name="page">create-content?destination={nodeRef}&amp;itemId=cm:content&amp;mimeType=text/plain</param>
                        </content>
                    </create-content>
                </config>
Sanjay
  • 2,481
  • 1
  • 13
  • 28
  • I have that link in the menu to the `create-content` page That's not the question. I have a service http://localhost:8180/share/service/hayst and that service has a file hayst.get.html.ftl when I load that page, directly (or from a link in the menu like your answer) How can I make it look like a normal share page? – Raystorm Dec 09 '20 at 13:27