This document summarizes useful functions in the Alfresco JavaScript utilities (Alfresco.util). It describes functions for array manipulation, string formatting, date conversion, DOM manipulation, YUI widget creation, AJAX requests, and more. It also discusses several Alfresco components like DataTable, Location, Favorite, and InsituEditor that leverage these utility functions.
8. Editor that is used for inline editing in the document library
for document names and tags:
Alfresco.util.createInsituEditor(context, params, callback);
Alfresco.util: Insitueditor
12. A.u.PopupManager.displayWebscript
• Display the html contents of a webscript in a
Dialog
• If you need OK, Cancel Buttons you have to
provide them in the HTML
Alfresco.util.PopupManager.displayWebscript({
title: "Index",
url: Alfresco.constants.PROXY_URI +"index",
properties:{}
});
13. Alfresco.util.Ajax
• Use Alfresco Ajax for CSRF support!
Alfresco.util.Ajax.jsonGet
Alfresco.util.Ajax.jsonPost
Alfresco.util.Ajax.jsonPut
Alfresco.util.Ajax.jsonDelete
• All use: jsonRequest()
16. Alfresco.util.getVar / setVar
Alfresco.util.setVar("fme", "it's possible");
Alfresco.util.getVar("fme");
Caution: Data is stored as a JSON object on window.name and survives page
requests but it is NOT available when the user opens a new tab!
(It‘s used internally for tracking if flash is available in the browser)
17. Alfresco.Location component
• Renders the Breadcrumb
l = new Alfresco.Location("template_x002e_title_x002e_repository");
l.setOptions({rootNode:"workspace://SpacesStore/743b079b-a847-4fc2-9a38-
5b3f38638784"});
l.displayByNodeRef("workspace://SpacesStore/2fc3c755-3e4a-4730-a22e-604c2092746b");
18. Alfresco.Favorite component
• Component to render a Favorite link with action:
f = new Alfresco.Favourite("page_x002e_title_x002e_user_x007e_admin_x007e_dashboard");
f.setOptions({
nodeRef : "workspace://SpacesStore/f3bb5d08-9fd1-46da-a94a-97f20f1ef208"
});
f.render();
19. Alfresco.Like component
• Render a „like“ link with like action (Ajax reload)
l = new Alfresco.Like("page_x002e_title_x002e_user_x007e_admin_x007e_dashboard");
l.setOptions(nodeRef : "workspace://SpacesStore/f3bb5d08-9fd1-46da-a94a-
97f20f1ef208");
l.render();