SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie 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추근 문
 

Ähnlich wie 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
 

Kürzlich hochgeladen

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Kürzlich hochgeladen (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

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