Alfresco - View in Browser Html file ignoring style

cancel
Showing results for 
Search instead for 
Did you mean: 
SalmanEdhi
Member II

Re: Alfresco - View in Browser Html file ignoring style

Hi @afaust ,

i followed the steps as is and I am getting the same null pointer exception but it is not resolved after adding ?a=true.

My URL:

http://localhost:8180/share/proxy/alfresco/acosix/workspace/SpacesStore/d83c8c3c-c7ca-49c8-bdc3-3fdd...

 

The LOGS:

my-all-in-one-acs_1 | 2022-05-24 14:43:56,425 ERROR [extensions.webscripts.AbstractRuntime] [http-nio-8080-exec-4] Exception from executeScript: null
my-all-in-one-acs_1 | java.lang.NullPointerException
my-all-in-one-acs_1 | at org.alfresco.repo.web.scripts.content.ContentGet.execute(ContentGet.java:131)
my-all-in-one-acs_1 | at org.alfresco.slingshot.web.scripts.SlingshotContentGet.execute(SlingshotContentGet.java:133)
my-all-in-one-acs_1 | at org.alfresco.repo.web.scripts.RepositoryContainer.lambda$transactionedExecute$2(RepositoryContainer.java:553)
my-all-in-one-acs_1 | at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450)
my-all-in-one-acs_1 | at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:544)
my-all-in-one-acs_1 | at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:685)
my-all-in-one-acs_1 | at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:721)
my-all-in-one-acs_1

afaust
Master

Re: Alfresco - View in Browser Html file ignoring style

Unfortunately Alfresco's base class is missing a null check for a technically optional property} URL template fragment. In your case you are not providing it. Though I do not recognise your URL as a valid URL for either the default ContentGet nor my patched one.

SalmanEdhi
Member II

Re: Alfresco - View in Browser Html file ignoring style

Could you please tell me what are template vars and how I can provide them? 

This is how it is getting the template vars

Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
String contentPart = templateVars.get("property");

 

Also, could you please tell me what is wrong or missing in the URL? because when I clikc on the action "View  in Browser HTML", this is the link I get

http://localhost:8180/share/proxy/alfresco/acosix/workspace/SpacesStore/d83c8c3c-c7ca-49c8-bdc3-3fdd...

 

The URL is different because I copied the project shared by the other member and the webscript configration is as follows:

 

<webscript>
<!-- This is just like the default download.get.desc.xml -->
<!-- Only the URL is remapped to avoid the Slingshot / Share content filtering via the SlingshotRemoteClient -->
<shortname>DownloadContentTEST</shortname>
<url>/acosix/{store_type}/{store_id}/{id}?a={attach?}</url>
<url>/acosix/{store_type}/{store_id}/{id}/content{property}?a={attach?}</url>
<url>/acosix/{store_type}/{store_id}/{id}/{filename}?a={attach?}</url>
<url>/acosix/{store_type}/{store_id}/{id}/content{property}/{filename}?a={attach?}</url>
<format default="">argument</format>

<authentication>user</authentication>
<transaction buffersize="4096" allow="readonly">required</transaction>
<lifecycle>internal</lifecycle>
</webscript>
SalmanEdhi
Member II

Re: Alfresco - View in Browser Html file ignoring style

@afaustI got it to work. So basically, "content" word was required in the url. Otherwise, it does not work

 

http://localhost:8180/share/proxy/alfresco/acosix/workspace/SpacesStore/d83c8c3c-c7ca-49c8-bdc3-3fdd...content/gran.html

 

Now, I have 2 questions if you could answer please,

1. This is done on the View in browser option, Is this possible to do this for the inline editor view that share provides?

2. If yes, is it advised to do this? My client wants to edit HTML documents from wihtin the inline editor and the document viewer.  If this is possible to override, could you please guide me how it could be achieved.

afaust
Master

Re: Alfresco - View in Browser Html file ignoring style

1. Yes - if you are willing to patch / override source code. I am using the alternative URLs at a customer for a custom inline editor, as I did not only want to alter the URL but also provide more capabilities (using Cloud9 editor).

2. "Advised" is such a subjective word. Depending on your ability to cope / deal with the process of making such customisations, including maintenance on updates etc. it can be either. Editing HTML in the viewer itself I would not advise - it clearly is meant to be a read-only view, and as such should not have editing capabilities unless an expliict "I want to edit now" button is clicked - which is the "Edit Inline" action already present. But I know that in the end customers' wishes have to be met somehow, and one could certainly implement a viewer which can toggle between read/write mode without changing the page, and which transparently saves the changes, and reloads the metadata (which may be changed indirectly by the content update).

SalmanEdhi
Member II

Re: Alfresco - View in Browser Html file ignoring style

The custom inline editor that you have used, is it integrated in share (do you access it from within share) or you are using it as a different system? I managed to get the HTML document to display the correct content, it was not displaying images correctly in both the view document online and the inline-editor. I want to make changes in the inline-editor and provide more functionalities such as uploading videos etc. Can you suggest how that can/should be done using the inline-editor provided by share. For editing the inline-editor would I have to make changes in the source code directly or these changes can also be made using the all-in-one project and the sdk4.1. I see that in the alfresco-share-community they have seperate projects for the web-editor. Also, the inline-edit page opens the editor as a form andthat code is present in web-framework-commons. So the code is mixed up over multiple projects. Could you guide or if possible share any docs on editing/updating the inline-editor.

EDIT:

the inline editor is the tinyMCE editor which alfresco uses. Could you give me any insights on how to extend the functionality of this editor? My exact scenario that I want to achieve is, from within the editor when I click on the add image action, I can select and image from the directory, convert it into base64 and then save it in editor.