This free marker template generates document actions of each document in Alfresco. The best place for button that visualizes pop up for editing document fields is there.
The new code:
The second one save edited value by request to the same web script.
The other code is just HTML and CSS for visualizing the pop up.
This code is situated in the share project not in the alfresco itsefl.
The first file is edit.get.desc.xml.
This is an XML file with URL for accessing web script via HTTP requests, the responce format of the HTTP request (JSON, XML etc.) and web script permissions (each user could access that script).
The second file is edit.get.json.ftl
This is another FTL file that shapes the responce of the web script.
The third one is edit-service-context.xml.
This file contains information about the java code that will implement the web script functionality.
There are 2 properties that will be initializes with the specified values.
Web script files location:
It is required to add setter and setters of the two fields: searchService and nodeService. Otherwise they won't be initialized.
That class extends org.springframework.extensions.webscripts.DeclarativeWebScript that implements most of the functionality that we need for web scripts. We could override only executeImpl nethod for our needs. The return type of the method is map that will be used by free marker to generate HTTP responce by using our edit.get.json.ftl file. There is a LUCENE search implemented in this file. The only param,eter is the ID of the document.
Every thing you have to do is to disable the access to the default wiki, blog and forum and redirect to the custom ones.
This is the code of wiki-page.ftl that redirects to xwiki application. Everything is presented in iframe. There is a code for login/logout/registration with the same account as the alfresco one that the user uses. There are three extensions of xwiki for blog, forum and sample wiki.
('+' - what is good and '-' - what is bad for each solution)
+ data could be stored in semantic repository (e.g. owlim) and/or relational database (e.g. mysql). The only thing to do is to add after or just replace the code for storing alfresco data in relational database.
- there are lots of code for overriding. There are about 20 services and may be few custom ones that should be overridden. The number of methods in each service is between 50 and 100. Policies are between 50 and 100 but they have just 1 method.
- we can not be sure that all the code that is invoked in service methods is completed on the end of the methods: new transactions could be ran and they may not be finished until the end of the method (new thread is started and it does not depend on the code that had started it)