cancel
Showing results for 
Search instead for 
Did you mean: 

Help:How to acces to Metadatas

marãƒâ_a
Champ in-the-making
Champ in-the-making
Hi!
I’m a beginner using JavaScript. I’ve tried to run an example “test script.jsâ€
7 REPLIES 7

mikeh
Star Contributor
Star Contributor
Hi,

How are you running the script? This particular script needs a document as a context in order to function properly.

For example, if we have a "test.txt" text file in a Company Home/Script Test space, then the script can be run with:
http://myserver:8080/alfresco/command/script/execute?scriptPath=/Company%20Home/Data%20Dictionary/Sc...

Please also read the wiki here: http://wiki.alfresco.com/wiki/JavaScript_API

Thanks,
Mike

marãƒâ_a
Champ in-the-making
Champ in-the-making
Thank you, I've just found the API 5 minutes before reading your post  Smiley Happy . I'm trying to guess what I have to write in the text file. If I get it I’ll post it.
Thanks

María

marãƒâ_a
Champ in-the-making
Champ in-the-making
I’ve read two JavaScript tutorials, but I didn’t find what that text file is. Could anybody post an example please?
Thanks in advantag

mikeh
Star Contributor
Star Contributor
The text file can contain anything for the test script.

Thanks,
Mike

marãƒâ_a
Champ in-the-making
Champ in-the-making
I have an HTML file with calls to functions that I have in a script file. Usually I included in the HTML file something like this:
   <script src …>
But I’ve read in the alfresco API:

“In Alfresco 2.1 the notion of including scripts into existing scripts was added. This feature allows libraries of scripts to be built and utilised by other scripts at runtime. The syntax to import the scripts is specific to Alfresco and not a feature of standard JavaScript - the <script src='…'> syntax you may be familiar with as supported by most web browsers is not part of standard ECMA JavaScript and will not work!
The syntax to import other scripts is strict and must be followed exactly or the import may fail. Import directives must be the first lines in the JavaScript file - no comments or code allowed above those lines. Only the following syntax variants are supported:
Import a script from the repository via name based path:
<import resource="/Company Home/Data Dictionary/Scripts/library.js">
Import a script from the repository via a NodeRef reference:
<import resource="workspace://SpacesStore/6f73de1b-d3b4-11db-80cb-112e6c2ea048">
Import a script from a Java ClassPath location:
<import resource="classpath:alfresco/extension/myutils.js">
Multiple script import of the same script content and circular dependencies are dealt with. A script can import several other scripts from multiple different locations i.e. a script from the repo and another from the classpath.
After the import lines, usual JavaScript code and comments may begin - the imports must be first lines in the file. “

How can I access to my script from my HTML?
Thanks in advantage

mikeh
Star Contributor
Star Contributor
Are you sure you understand the difference between server-side scripts and client-side scripts?

The example I gave above is a server-side script, so you need to send an HTTP GET request in order to execute it. The response can then either be displayed to the user as HTML, or interpreted by client-side javascript maybe to use AJAX techniques to update a panel on the page.

Mike

marãƒâ_a
Champ in-the-making
Champ in-the-making
Ok, sorry
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.