Alfresco
We have developed a custom page in Alfresco to list specific types of documents and to rate each of the listed documents.
The page displays the metadata of each of the documents along with the options to rate the document as shown below.
The reference code for the same is given below for the Alfresco developers.
1 /** Code Description: Creating drop-down with a list of ratings. The user can choose one rating from the drop-down. */
function displayDropdown(nodeRef, name, type, value, id) { var data ='' +'Select' +'1' +'2' +'3' +'4' +'5'; return data; }; 2 /** Code Description: This popup is required to get input from the user before submitting a rating. It prevents user to submit the rating by mistake. */ // showPopup() method function showPopup(nodeRef, name, type, value, id){ var disable = false; Alfresco.util.PopupManager.displayPrompt( { title: "Rating Confirmation", text: "Are you sure, you want to submit Rating?", buttons: [ { text: "Submit", handler: function close_screen() { storeValue(nodeRef, name, type, value, id); console.log("After Submit"); this.destroy(); } }, { text: "Cancel", handler: function close_cancel() { document.getElementById(type).value = ""; console.log("Cancel button clicked"); this.destroy(); }, isDefault: true }] }); } 3 /** Code Description: This method will invoke Web script to save the rating in the back-end. */ function storeValue(nodeRef, name, type, value, id){ var statusParam = { "type" : type, "nodeRef" : nodeRef, "rating": value, "contentName" : name }; Alfresco.util.Ajax.request({ url : Alfresco.constants.PROXY_URI+ "/trams/changeRating", method : Alfresco.util.Ajax.POST, dataObj : statusParam, requestContentType : Alfresco.util.Ajax.JSON, successCallback : { fn : function(res) { console.log(res); displayResults(id); }, scope : this }, failureCallback : { fn : function(res) { }, scope : this } }); } 4 Web-script Controller /** Code Description: This method will extract the values from a JSON object and save the rating in the back-end. */ //change-rating.post.js function main() { var rating = json.get('rating'); var nodeRef = json.get('nodeRef'); var type = json.get('type'); var contentName = json.get('contentName'); var nodeObject = search.findNode(nodeRef); if(type == contentName+'-manager'){ nodeObject.properties['pc:managersRating'] = rating; } else if(type == contentName+'-editor'){ nodeObject.properties['pc:editorsRating'] = rating; } nodeObject.save(); } main(); If you find any challenge in implementing the same, feel free to Contact Us
The technology has been a pioneer in speeding up the data analysis of customers for enterprises.
17 Jul 2024
Learn about Alfresco development and its benefits for businesses. Discover how leveraging Alfresco can enhance efficiency and collaboration.
17 Jul 2024
Mastering Alfresco Development: Essential Tips for Success in ECM Solutions” provides crucial insights and strategies for developers to excel in…
17 Jul 2024
401, One World West, Nr. Ambli T-Junction 200, S P Ring Road, Bopal, Ahmedabad, Gujarat 380058
Kemp House 160 City Road, London, United Kingdom EC1V 2NX
Nürnberger Str. 46 90579 Langenzenn Deutschland
Level 36 Riparian Plaza, 71 Eagle Street, Brisbane, QLD 4000
4411 Suwanee Dam road, Bld. 300 Ste. 350 Suwanee GA, 30024
Cube Work Space, 24 Hans Strijdom Avenue, Cape Town
B 503 Sama Tower, Sheikh Zayed Road, United Arab Emirates
34 Applegrove Ct. Brampton ON L6R 2Y8
We use cookies to improve your browsing experience.
OKAYThis website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.
If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.