I want to assign a small code string to each document after it is uploaded in alfresco. Something like: '2012/314-39414'.
The code will be generated by a rule that depends on the user that uploaded the document, the time the document is uploaded and a unique number which will be incremented after each document upload.
Can I have help to implement this in Alfresco?
Use OnCreateNodePolicy (java code) to do this the cleanest way.
Search the net or Alfresco forums to look for examples or you could download the SDK and lookup current code which uses it.
Related
Our Share users currently have a static large list of parameters that they need to manually re-input everytime documents needs to be searched.
Is there any way of saving search/queries in Alfresco share?
This function was available in the g'old explorer UI, but unfortunately never got into Alfrescp Share or into Alfresco Digital Workspace. As a work around you may take a look into the Saved Search dashlet ?
There is a dashlet called Saved Search available.You can use that or you can create similar dashlet with your customization.
I have recently started developing with aikau in alfresco share.
I want to achieve a functionality wherein I can export search results to a CSV file.
For that, I can change the back-end repository web script to return csv data.
Now, At alfresco share end - I was successfully able to show the export link by adding a new widget to FCTSRCH_TOP_MENU_BAR. I used alfresco/renderers/PropertyLink to display this link. Now, the missing part for me is - how can I invoke the search web script passing additional param format=csv and alongwith that pass all the query parameters used to retrieve the results.
I am stuck with that. If I use the publishTopic as ALF_CRUD_GET_ALL and provide the URL there then it invokes the sample web script (I created to return sample csv response) and returns the response. However, the csv doesn't come as downloadable response. I am stuck here in order to how to achieve export csv functionality for search results.
It would be great if any of you can help me here and provide your guidance/suggestions.
This blog post provides an example on how you can custom the search page in Share. Although it specifically addresses changing the search queries the basic extension approach is more or less that same in that you will want to change the data that is used to send an XHR request. I think that the major difference here is that you may need to do more in-depth updates to the service - in particular with regards to the switch statement that is used to build the advanced search query object.
If you have extended or replaced the default search REST API then I would expect that you will need to call the same URL, but if you have provided an entirely new REST API to return the CSV data then you'll also need to change the URL that is used by the service.
In terms of providing a link for downloading the content we have previously implemented something in the DragAndDropModelCreationService (see the generateDownload function) but this only works with Chrome due to security limitations and the generation of files to download.
Your best bet may be temporarily store the CSV content on the repository in a hidden location and then use the standard download links to allow it to be downloaded - this would be more complex but would provide better cross browser support. Something similar is done for the "Download as ZIP" action.
OK, with the extra information provided I would do the following...
The information on the process of adding widgets to the search page are quite well detailed here (although you're not adding a view, you can follow the approach to add a new PropertyLink after the widget with the id "FCTSRCH_RESULTS_COUNT_LABEL").
The approach I would take would be to include an additional custom service on the page that subscribes to the "ALF_RETRIEVE_DOCUMENTS_REQUEST_SUCCESS" topic (which is published on a completed search). It should save the the search response in a variable in preparation for users clicking on the PropertyLink.
This custom service should also subscribe to a topic that is published by the PropertyLink (called say "DOWNLOAD_CSV"). This custom service could then generate a file download using the approach described in my previous answer using the CSV data that will have been provided in the payload. As I said though, this may only work with some browsers due to security reasons.
If your custom search WebScript were able to store the CSV data as a node on the Repository then you could just provide a the NodeRef of the CSV data in the search response and the PropertyLink could just publish the "ALF_DOWNLOAD" topic for the DocumentService to handle the download.
Trying to generate a file to download on the client side is going to be an issue for most browsers I think.
I'm trying to get a list of all checked out documents. Unfortunately, I'm new to Alfresco and can't quite figure out how to do this. I found this:
https://wiki.alfresco.com/wiki/CMIS_Web_Scripts_Reference#Get_Checked_Out_Documents_.28getCheckedOutDocs.29
Which is:
Gets the list of documents that are checked out that the user has access to.
But I don't want the checked out documents for just one user, I want the checked out documents of all users. Is there a way to get that?
Any help would be greatly appreciated, thanks!!
What you could do is create your own web script which you would execute with admin privileges (meaning, you'd act as an administrator, you'd see the whole repository, and you'd see all the documents in it).
Now, what you're missing is a way to find all the checked out documents. Well, when you check out a document, a working copy gets created (while the original remains locked). Working copy gets the "cm:workingCopy" aspect, while the original gets the "cm:checkedOut" aspect.
All your web script needs to do is to execute an aspect based query and find what you need. You can use Node Browser to test the query before writing any code.
ASPECT:"cm:checkedOut"
I wonder how to create a PDF or Word document automatically from the repository when I create a new folder in the document library.
Thanks in advance.
I don't really understand what you exactly mean. Buy I guess it can be done by a rule or behaviour.
Create a rule on the root folder where your folders will be created. Set the incoming type to be folder.
As the action execute a JavaScript.
If you look at the JavaScript API Cookbook, there are samples on how to create a file. Creating PDF's or Word from scratch is a bit difficult hence the binary content isn't plain text.
I have requirement where I need to allow users to upload a Word document with place holders for certain fields which can be found in the database. This will be their template. For example the place holders might be prepended with ## or something. For example
Dear ##Title ##Lastname
They then can grab a record and hit export to Word document. This will then let them choose the template. They can select the template and then click continue. I will then get the template and replace the ##Title with the title field in the database for the selected record. I am not sure where to start or what components I need to do this.
From my initial investigation it seems that I can do this with the new open XML standard for Office 2007. So perhaps I should read in the template and save all the contents to a db table somewhere. Then when the use wants to export I get the contents again and then do a search and replace for the ## placeholders and link them properly. Then save the document to the output stream again which will then bring up the save dialog on their browser.
I am using ASP.Net MVC and am in a hosted environment. I was also maybe contemplating dynamically creating a new View type and dynamically creating new views when the user uploads a template. Not sure that this approach will work though.
Is this a good approach?
What tools should I be looking at?
Any other suggestions?
This is similar to an approach we took for inserting data into word documents and then returning them to the user. We opened the .docx file (it's a zip file so easy to extract) extracted the document (in the word folder called document.xml), did the replace and then put the document back into the .docx file and returned it to the user.
An issue we hit were that word inserted tags at strange places, especially things like spell/grammar errors, so we needed to be careful when we did the search/replace.
We decided not to store the fields from the document in a database to allow the documents to be easily updated.
We used dotnetzip component for opening the .docx files
Something we also did was to combine several documents into a single large document to save on the number of downloads. If I remember we used the open xml toolkit to do this merging. The website has also got loads of other information that may be of use.
Check out Scott Guthries blog post about the new view engine code named "Razor" coming out real shortly from Microsoft. In the comments there is talk about it being able to be used in mail merge scenarios like you talk about with ASP.NET MVC views.