cancel
Showing results for 
Search instead for 
Did you mean: 

javascript prompt

xerox
Champ in-the-making
Champ in-the-making
I'm trying to do an alert or promp in alfresco with javascript, but this isn't working.
Isn't this possible in Alfresco?

friendly regards,
Nick
14 REPLIES 14

mikeh
Star Contributor
Star Contributor
Hi Nick

Apologies - didn't see you tacked a new question onto that topic!

A "hasPermission" method was added to v1.4.3 - I'm not sure exactly which version you're on?

You should be able to do:
<#if hasPermission(TemplateNode node, String permission) == 1>
… show the link …
</#if>

"permission" would be either "Write" or "AddChildren" depending on your configuration.
<#if hasPermission(space, "Write") == 1>
… show the link …
</#if>


regards,
Mike

xerox
Champ in-the-making
Champ in-the-making
Hi Mike

really thx…
it works…

A last questionSmiley Happy

In my javascript I check if the spacename exists or not…

If the spacename already exists, The space may nog be created(duplicated names).
I did this,but I want to show the user a message that the space wasn't created because it already exists…(an alert isn't working because it's on server side)

Is this possible?

friendly regards,

Nick

mikeh
Star Contributor
Star Contributor
Hi Nick,

I guess there are two ways:

1/ Where you return the HTML "<script>history.back();</script>" at the end of the server-side script, you can optionally add an alert() in there, i.e.
<script>alert('Duplicate space name found'); history.back();</script>
or
2/ Have the Freemarker template walk the child spaces and send an array of strings to do a client-side Javascript check in the createNewProject() function - so the duplicate name isn't allowed to be submitted.

I suspect #1 will be easier, although #2 might give a better user experience.

regards,
Mike

xerox
Champ in-the-making
Champ in-the-making
thx for your help

Everything is working fine now…

friendly regards,
Nick

moschops
Champ in-the-making
Champ in-the-making
Thanks for this post - it was very helpful to me in creating a scripted action with confirmation prompt and alerts.  It would be nicer if there was a way to do this on the server side but I assume that requires adding Java/JSP code.