cancel
Showing results for 
Search instead for 
Did you mean: 

Alternative to the object Alert in Javascript

ktavasalo
Champ on-the-rise
Champ on-the-rise
Hello everyone. I just want to know if there are alternatives in creating dialog  boxes(e.g. alert boxes) in Javascript. Unfortunately, I learned over the net that Alert object is not included here. So, do you know any?

My practicum supervisor asked me to have a dialog box whenever a file in a user space has the same filename with other file. So, it will ask if it overwrite the existing file or rename it. So, what do I do? Please help me. Thank you very very much!!
6 REPLIES 6

afaust
Legendary Innovator
Legendary Innovator
Hello,

Alfresco provides a utility popup manager on Share client side JS that can be used to simple short message or require active confirmation of an error message. See <a href="http://sharextras.org/jsdoc/share/community-4.0.d/symbols/Alfresco.util.PopupManager.html">the JSDoc</a> for details.

Regards
Axel

ktavasalo
Champ on-the-rise
Champ on-the-rise
Thank you very much Axel.. I will try this one.

ktavasalo
Champ on-the-rise
Champ on-the-rise
Hello.. Sorry if my question is stupid but I am so lost. How can I use the class Alfresco.util.PopupManager in my alfresco? Can I use it in the script I am working on and save in  Company Home/Data Dictionary/Scripts ?Please Help me.. Thank you very much!

zladuric
Champ on-the-rise
Champ on-the-rise
Alfresco.util.PopupManager is actually a client-side code for Alfresco Share collaboration frontend.
Do you use Share?

Yes, I use Share.. So, how to do it? Please help me. Thank you very much. I am thinking to write a script including this popupmanager in Explorer that will trigger when files in Share repository have the same filename..

zladuric
Champ on-the-rise
Champ on-the-rise
Well, for share dashlets and other components, there is client-side and server-side javascript. Ie. anything under
share/WEB-INF/classes/alfresco/site-webscripts
are server side components. You can't use "alert" there. You can only use logger.log("some message") there - just make sure your logging levels are set.

Now, alert-type popups are done in client-side javascript. Basically, anything you find in
/share/components/*
will be executed on the browser.

You can add something like this in one of the files. Look for the "onReady" method in your dashlet and add:
Alfresco.util.PopupManager.displayMessage({ title: "Some text", text: "This is your message"});


You could even include your own javascript and have use of this, just make sure that /share/js/alfresco.js (or share/js/share.js, not sure) are loaded. Check one of those files to see more options - you can use this to display prompts, errors, whatever.