SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
alfresco.js / share.js
Hidden gems in Alfresco Client-Side Javascript
2013-06-27 - Florian Maul (fme AG)
Alfresco.util: Object functions
• arrayToObject, deepCopy, dotNotation*
Alfresco.util: Array manipulation
• findInArray
• arrayContains
• arrayRemove
• arrayIndex
Alfresco.util: Strings / Formatting
• pad, trim, combinePaths
Alfresco.util: Date conversion
Alfresco.util: DOM / HTML
• getScrollPosition = function()
• insertAtCursor = function(el, txt)
• selectText = function(elTextbox, nStart, nEnd)
• isVisible = function (el)
• decodeHTML = function(html)
• encodeHTML = function(text, justified)
• encodeURIPath = function(text)activateLinks = function(text)
• tweetToHTML = function(text)setSelectedIndex = function(selectEl, value)
• setSelectedClass = function(parentEl, selectEl, selectClass)
• useAsButton = function(el, callbackFn, callbackObj, callbackScope)
 Helper function to listen for mouse click and keyboard enter events on an
• element.generateDomId = function(p_el, p_prefix)
 Returns a unique DOM ID for dynamically-created content. Optionally applies the new
ID to an element.
Alfresco.util: YUI
• createYUIButton = function(p_scope, p_name, p_onclick, p_obj,
p_oElement)
• disableYUIButton = function(p_button)
• enableYUIButton = function(p_button)
• createTwister = function(p_controller, p_filterName, p_config)
• createYUIPanel = function(p_el, p_params, p_custom)
• createInfoBalloon = function(p_context, p_params)
• createBalloon = function(p_context, p_params)
• createInsituEditor = function(p_context, p_params, p_callback)
• findEventClass = function(p_eventTarget, p_tagName)
• hasEventInterest = function(p_eventGroup, p_args)
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
Alfresco.util: Insitueditor
Alfresco.util.PopupManager
A.u.PopupManager.displayForm
Alfresco.util.PopupManager.displayForm({
title:"Form Title",
properties:{
itemKind:"type",
mode:"create",
itemId:"cm:content",
destination:"workspace://SpacesStore/34c94d94-6418-42dc-9bc7-038693990408",
success: function() {
console.log(
"Node Created.");}
}
}
);
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:{}
});
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()
Alfresco.util.Ajax.jsonGet
Alfresco.util.Ajax.jsonGet({
url: Alfresco.constants.PROXY_URI + "index",
successCallback: {
fn: function(result) {
console.log(result.serverResponse.responseText);
},
scope: this
}
});
More URL helpers
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)
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");
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();
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();
Alfresco.logger
Use cheat code:
Ctrl, Ctrl, Shift, Shift
Alfresco.constants (1/2)
• Alfresco.constants.DEBUG = true;
• Alfresco.constants.AUTOLOGGING = false;
• Alfresco.constants.PROXY_URI = window.location.protocol + "//" + window.location.host +
"/share/proxy/alfresco/";
• Alfresco.constants.PROXY_URI_RELATIVE = "/share/proxy/alfresco/";
• Alfresco.constants.PROXY_FEED_URI = window.location.protocol + "//" + window.location.host +
"/share/proxy/alfresco-feed/";
• Alfresco.constants.THEME = "fmeTheme";
• Alfresco.constants.URL_CONTEXT = "/share/";
• Alfresco.constants.URL_RESCONTEXT = "/share/res/";
• Alfresco.constants.URL_PAGECONTEXT = "/share/page/";
• Alfresco.constants.URL_SERVICECONTEXT = "/share/service/";
• Alfresco.constants.URL_FEEDSERVICECONTEXT = "/share/feedservice/";
• Alfresco.constants.USERNAME = "admin";
• Alfresco.constants.SITE = "";
• Alfresco.constants.PAGEID = "";
• Alfresco.constants.PORTLET = false;
• Alfresco.constants.PORTLET_URL = unescape("");
• Alfresco.constants.JS_LOCALE = "en_US";
Alfresco.constants (2/2)
Alfresco.constants.URI_TEMPLATES =
{
"sitedashboardpage": "/site/{site}/dashboard",
"sitepage": "/site/{site}/{pageid}",
"userdashboardpage": "/user/{userid}/dashboard",
"userpage": "/user/{userid}/{pageid}",
"userprofilepage": "/user/{userid}/profile",
"userdefaultpage": "/user/{pageid}",
"consoletoolpage": "/console/{pageid}/{toolid}",
"consolepage": "/console/{pageid}"
};
Alfresco.constants.HELP_PAGES =
{
"share-help": "http://docs.alfresco.com/4.1/topic/com.alfresco.enterprise.doc/topics/sh-uh-welcome.html",
"share-tutorial": "http://docs.alfresco.com/4.1/topic/com.alfresco.enterprise.doc/topics/alfresco-video-
tutorials.html"
};
Alfresco.Share
Alfresco.Share.postActivity("swsdp",
"file-liked",
"inv I200-109.png",
"document-details", {
nodeRef: "workspace://SpacesStore/
723a0cff-3fce-495d-baa3-a3cd245ea5dc"});
Alfresco.component.SimpleDocList
• Component to create document lists
• e.g. used in My Documents dashlet
Alfresco.component.Base
Alfresco.component.Base
(function()
{
FME.MyComponent = function(htmlId, options)
{
this.name = "FME.MyComponent";
this.id = htmlId;
this.setOptions(options);
FME.MyComponent.superclass.constructor.call(this,
this.name, this.id,
["button", "container", "connection", "dragdrop", "json" ]);
return this;
};
YAHOO.lang.extend(FME.MyComponent, Alfresco.component.Base,
{
onReady: function FMC_onReady() {
// add you initialization here
}
});
})();
Alfresco.component.Base
• Creates Button and adds listeners
<button type="alfresco-button" name=".onRenameClick"
value="${nodeRef}">${msg("button.rename")}</button>
• Creates Links and creates events
<a href="#" name"@metaDataRefresh"
class="${args.htmlid?js_string}"
rel="${nodeRef}">${msg("link.metaDataRefresh“)}</a>
Alfresco.util.DataTable
Alfresco.util.DataTable
dt = new Alfresco.util.DataTable(
{
dataTable:
{
container: "template_x002e_people-finder_x002e_people-finder_x0023_default-body",
columnDefinitions:
[
{ key: "name", sortable: false, formatter: function(elCell, oRecord, oColumn, oData) {
elCell.innerHTML = oRecord.getData("fileName");
}
},
{ key: "type", sortable: false, formatter: function(elCell, oRecord, oColumn, oData) {
elCell.innerHTML = oRecord.getData("node").type;
}
}
]
},
dataSource:
{
url:
"/share/service/components/documentlibrary/data/doclist/all/node/alfresco/company/home/Data%20Dictionary?filter=path&size=50&po
s=1&sortAsc=true&sortField=cm%3Aname&libraryRoot=alfresco%3A%2F%2Fcompany%2Fhome&view=browse",
config:
{
responseSchema:
{
resultsList: "items",
metaFields:
{
paginationRecordOffset: "startIndex",
totalRecords: "totalRecords",
totalRecordsUpper : "totalRecordsUpper"
}
}
}
},
paginator:
{
config:
{
containers: ["global_x002e_header_x0023_default-userItems"],
rowsPerPage: 10
}
}
});
Alfresco.util.ComponentManager
• Some Alfresco components are registered with the Component Manager:
Alfresco.Deferred
• Wait for multiple events and execute a callback:
Alfresco.util.bind()
• Changes the this context of a function (binds it to a specific object)
Questions, Feedback …?
33
#237191 - © fme AG34

Más contenido relacionado

La actualidad más candente

AST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaAST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaStephen Vance
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium AppsNate Abele
 
Letswift19-clean-architecture
Letswift19-clean-architectureLetswift19-clean-architecture
Letswift19-clean-architectureJung Kim
 
Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Fabien Potencier
 
New SPL Features in PHP 5.3
New SPL Features in PHP 5.3New SPL Features in PHP 5.3
New SPL Features in PHP 5.3Matthew Turland
 
An Intro To ES6
An Intro To ES6An Intro To ES6
An Intro To ES6FITC
 
Odoo - From v7 to v8: the new api
Odoo - From v7 to v8: the new apiOdoo - From v7 to v8: the new api
Odoo - From v7 to v8: the new apiOdoo
 
Your Second iPhone App - Code Listings
Your Second iPhone App - Code ListingsYour Second iPhone App - Code Listings
Your Second iPhone App - Code ListingsVu Tran Lam
 
Learn You a Functional JavaScript for Great Good
Learn You a Functional JavaScript for Great GoodLearn You a Functional JavaScript for Great Good
Learn You a Functional JavaScript for Great GoodMike Harris
 
The state of your own hypertext preprocessor
The state of your own hypertext preprocessorThe state of your own hypertext preprocessor
The state of your own hypertext preprocessorAlessandro Nadalin
 
Swift와 Objective-C를 함께 쓰는 방법
Swift와 Objective-C를 함께 쓰는 방법Swift와 Objective-C를 함께 쓰는 방법
Swift와 Objective-C를 함께 쓰는 방법Jung Kim
 
Webエンジニアから見たiOS5
Webエンジニアから見たiOS5Webエンジニアから見たiOS5
Webエンジニアから見たiOS5Satoshi Asano
 
AST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptAST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptIngvar Stepanyan
 

La actualidad más candente (20)

AST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaAST Rewriting Using recast and esprima
AST Rewriting Using recast and esprima
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
 
Letswift19-clean-architecture
Letswift19-clean-architectureLetswift19-clean-architecture
Letswift19-clean-architecture
 
Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)
 
I os 04
I os 04I os 04
I os 04
 
New SPL Features in PHP 5.3
New SPL Features in PHP 5.3New SPL Features in PHP 5.3
New SPL Features in PHP 5.3
 
An Intro To ES6
An Intro To ES6An Intro To ES6
An Intro To ES6
 
Odoo - From v7 to v8: the new api
Odoo - From v7 to v8: the new apiOdoo - From v7 to v8: the new api
Odoo - From v7 to v8: the new api
 
AkJS Meetup - ES6++
AkJS Meetup -  ES6++AkJS Meetup -  ES6++
AkJS Meetup - ES6++
 
Your Second iPhone App - Code Listings
Your Second iPhone App - Code ListingsYour Second iPhone App - Code Listings
Your Second iPhone App - Code Listings
 
Epic South Disasters
Epic South DisastersEpic South Disasters
Epic South Disasters
 
Rust ⇋ JavaScript
Rust ⇋ JavaScriptRust ⇋ JavaScript
Rust ⇋ JavaScript
 
Learn You a Functional JavaScript for Great Good
Learn You a Functional JavaScript for Great GoodLearn You a Functional JavaScript for Great Good
Learn You a Functional JavaScript for Great Good
 
The state of your own hypertext preprocessor
The state of your own hypertext preprocessorThe state of your own hypertext preprocessor
The state of your own hypertext preprocessor
 
Command Liner with Scala
Command Liner with ScalaCommand Liner with Scala
Command Liner with Scala
 
Swift와 Objective-C를 함께 쓰는 방법
Swift와 Objective-C를 함께 쓰는 방법Swift와 Objective-C를 함께 쓰는 방법
Swift와 Objective-C를 함께 쓰는 방법
 
XQuery Rocks
XQuery RocksXQuery Rocks
XQuery Rocks
 
Webエンジニアから見たiOS5
Webエンジニアから見たiOS5Webエンジニアから見たiOS5
Webエンジニアから見たiOS5
 
AST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptAST - the only true tool for building JavaScript
AST - the only true tool for building JavaScript
 
Intro to The PHP SPL
Intro to The PHP SPLIntro to The PHP SPL
Intro to The PHP SPL
 

Similar a fme Alfresco Day 06-2013 - alfresco.js and share

Art of Javascript
Art of JavascriptArt of Javascript
Art of JavascriptTarek Yehia
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Swift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CSwift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CAlexis Gallagher
 
OOP Adventures with XOOPS
OOP Adventures with XOOPSOOP Adventures with XOOPS
OOP Adventures with XOOPSxoopsproject
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony TechniquesKris Wallsmith
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
Building Smart Async Functions For Mobile
Building Smart Async Functions For MobileBuilding Smart Async Functions For Mobile
Building Smart Async Functions For MobileGlan Thomas
 
Ember background basics
Ember background basicsEmber background basics
Ember background basicsPhilipp Fehre
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almostQuinton Sheppard
 
DjangoCon US 2011 - Monkeying around at New Relic
DjangoCon US 2011 - Monkeying around at New RelicDjangoCon US 2011 - Monkeying around at New Relic
DjangoCon US 2011 - Monkeying around at New RelicGraham Dumpleton
 
Djangocon11: Monkeying around at New Relic
Djangocon11: Monkeying around at New RelicDjangocon11: Monkeying around at New Relic
Djangocon11: Monkeying around at New RelicNew Relic
 
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...Sencha
 
Come on, PHP 5.4!
Come on, PHP 5.4!Come on, PHP 5.4!
Come on, PHP 5.4!paulgao
 
QConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações WebQConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações WebFabio Akita
 
Backbone.js Simple Tutorial
Backbone.js Simple TutorialBackbone.js Simple Tutorial
Backbone.js Simple Tutorial추근 문
 

Similar a fme Alfresco Day 06-2013 - alfresco.js and share (20)

Art of Javascript
Art of JavascriptArt of Javascript
Art of Javascript
 
Gephi Toolkit Tutorial
Gephi Toolkit TutorialGephi Toolkit Tutorial
Gephi Toolkit Tutorial
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Jquery Fundamentals
Jquery FundamentalsJquery Fundamentals
Jquery Fundamentals
 
Swift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CSwift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-C
 
OOP Adventures with XOOPS
OOP Adventures with XOOPSOOP Adventures with XOOPS
OOP Adventures with XOOPS
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony Techniques
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Building Smart Async Functions For Mobile
Building Smart Async Functions For MobileBuilding Smart Async Functions For Mobile
Building Smart Async Functions For Mobile
 
JS Essence
JS EssenceJS Essence
JS Essence
 
Ember background basics
Ember background basicsEmber background basics
Ember background basics
 
Backbone js
Backbone jsBackbone js
Backbone js
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
 
DjangoCon US 2011 - Monkeying around at New Relic
DjangoCon US 2011 - Monkeying around at New RelicDjangoCon US 2011 - Monkeying around at New Relic
DjangoCon US 2011 - Monkeying around at New Relic
 
Djangocon11: Monkeying around at New Relic
Djangocon11: Monkeying around at New RelicDjangocon11: Monkeying around at New Relic
Djangocon11: Monkeying around at New Relic
 
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
 
Come on, PHP 5.4!
Come on, PHP 5.4!Come on, PHP 5.4!
Come on, PHP 5.4!
 
QConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações WebQConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações Web
 
Backbone.js Simple Tutorial
Backbone.js Simple TutorialBackbone.js Simple Tutorial
Backbone.js Simple Tutorial
 

Último

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Último (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

fme Alfresco Day 06-2013 - alfresco.js and share

  • 1. alfresco.js / share.js Hidden gems in Alfresco Client-Side Javascript 2013-06-27 - Florian Maul (fme AG)
  • 2. Alfresco.util: Object functions • arrayToObject, deepCopy, dotNotation*
  • 3. Alfresco.util: Array manipulation • findInArray • arrayContains • arrayRemove • arrayIndex
  • 4. Alfresco.util: Strings / Formatting • pad, trim, combinePaths
  • 6. Alfresco.util: DOM / HTML • getScrollPosition = function() • insertAtCursor = function(el, txt) • selectText = function(elTextbox, nStart, nEnd) • isVisible = function (el) • decodeHTML = function(html) • encodeHTML = function(text, justified) • encodeURIPath = function(text)activateLinks = function(text) • tweetToHTML = function(text)setSelectedIndex = function(selectEl, value) • setSelectedClass = function(parentEl, selectEl, selectClass) • useAsButton = function(el, callbackFn, callbackObj, callbackScope)  Helper function to listen for mouse click and keyboard enter events on an • element.generateDomId = function(p_el, p_prefix)  Returns a unique DOM ID for dynamically-created content. Optionally applies the new ID to an element.
  • 7. Alfresco.util: YUI • createYUIButton = function(p_scope, p_name, p_onclick, p_obj, p_oElement) • disableYUIButton = function(p_button) • enableYUIButton = function(p_button) • createTwister = function(p_controller, p_filterName, p_config) • createYUIPanel = function(p_el, p_params, p_custom) • createInfoBalloon = function(p_context, p_params) • createBalloon = function(p_context, p_params) • createInsituEditor = function(p_context, p_params, p_callback) • findEventClass = function(p_eventTarget, p_tagName) • hasEventInterest = function(p_eventGroup, p_args)
  • 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()
  • 14. Alfresco.util.Ajax.jsonGet Alfresco.util.Ajax.jsonGet({ url: Alfresco.constants.PROXY_URI + "index", successCallback: { fn: function(result) { console.log(result.serverResponse.responseText); }, scope: this } });
  • 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();
  • 21. Alfresco.constants (1/2) • Alfresco.constants.DEBUG = true; • Alfresco.constants.AUTOLOGGING = false; • Alfresco.constants.PROXY_URI = window.location.protocol + "//" + window.location.host + "/share/proxy/alfresco/"; • Alfresco.constants.PROXY_URI_RELATIVE = "/share/proxy/alfresco/"; • Alfresco.constants.PROXY_FEED_URI = window.location.protocol + "//" + window.location.host + "/share/proxy/alfresco-feed/"; • Alfresco.constants.THEME = "fmeTheme"; • Alfresco.constants.URL_CONTEXT = "/share/"; • Alfresco.constants.URL_RESCONTEXT = "/share/res/"; • Alfresco.constants.URL_PAGECONTEXT = "/share/page/"; • Alfresco.constants.URL_SERVICECONTEXT = "/share/service/"; • Alfresco.constants.URL_FEEDSERVICECONTEXT = "/share/feedservice/"; • Alfresco.constants.USERNAME = "admin"; • Alfresco.constants.SITE = ""; • Alfresco.constants.PAGEID = ""; • Alfresco.constants.PORTLET = false; • Alfresco.constants.PORTLET_URL = unescape(""); • Alfresco.constants.JS_LOCALE = "en_US";
  • 22. Alfresco.constants (2/2) Alfresco.constants.URI_TEMPLATES = { "sitedashboardpage": "/site/{site}/dashboard", "sitepage": "/site/{site}/{pageid}", "userdashboardpage": "/user/{userid}/dashboard", "userpage": "/user/{userid}/{pageid}", "userprofilepage": "/user/{userid}/profile", "userdefaultpage": "/user/{pageid}", "consoletoolpage": "/console/{pageid}/{toolid}", "consolepage": "/console/{pageid}" }; Alfresco.constants.HELP_PAGES = { "share-help": "http://docs.alfresco.com/4.1/topic/com.alfresco.enterprise.doc/topics/sh-uh-welcome.html", "share-tutorial": "http://docs.alfresco.com/4.1/topic/com.alfresco.enterprise.doc/topics/alfresco-video- tutorials.html" };
  • 24. Alfresco.component.SimpleDocList • Component to create document lists • e.g. used in My Documents dashlet
  • 26. Alfresco.component.Base (function() { FME.MyComponent = function(htmlId, options) { this.name = "FME.MyComponent"; this.id = htmlId; this.setOptions(options); FME.MyComponent.superclass.constructor.call(this, this.name, this.id, ["button", "container", "connection", "dragdrop", "json" ]); return this; }; YAHOO.lang.extend(FME.MyComponent, Alfresco.component.Base, { onReady: function FMC_onReady() { // add you initialization here } }); })();
  • 27. Alfresco.component.Base • Creates Button and adds listeners <button type="alfresco-button" name=".onRenameClick" value="${nodeRef}">${msg("button.rename")}</button> • Creates Links and creates events <a href="#" name"@metaDataRefresh" class="${args.htmlid?js_string}" rel="${nodeRef}">${msg("link.metaDataRefresh“)}</a>
  • 29. Alfresco.util.DataTable dt = new Alfresco.util.DataTable( { dataTable: { container: "template_x002e_people-finder_x002e_people-finder_x0023_default-body", columnDefinitions: [ { key: "name", sortable: false, formatter: function(elCell, oRecord, oColumn, oData) { elCell.innerHTML = oRecord.getData("fileName"); } }, { key: "type", sortable: false, formatter: function(elCell, oRecord, oColumn, oData) { elCell.innerHTML = oRecord.getData("node").type; } } ] }, dataSource: { url: "/share/service/components/documentlibrary/data/doclist/all/node/alfresco/company/home/Data%20Dictionary?filter=path&size=50&po s=1&sortAsc=true&sortField=cm%3Aname&libraryRoot=alfresco%3A%2F%2Fcompany%2Fhome&view=browse", config: { responseSchema: { resultsList: "items", metaFields: { paginationRecordOffset: "startIndex", totalRecords: "totalRecords", totalRecordsUpper : "totalRecordsUpper" } } } }, paginator: { config: { containers: ["global_x002e_header_x0023_default-userItems"], rowsPerPage: 10 } } });
  • 30. Alfresco.util.ComponentManager • Some Alfresco components are registered with the Component Manager:
  • 31. Alfresco.Deferred • Wait for multiple events and execute a callback:
  • 32. Alfresco.util.bind() • Changes the this context of a function (binds it to a specific object)
  • 34. #237191 - © fme AG34