cancel
Showing results for 
Search instead for 
Did you mean: 

how to add drag and drop in the myspace droplet

seraphon
Champ in-the-making
Champ in-the-making
Hi

May I ask if there is going to be a drag and drop available in the final version  of Alfrescov2.1?
Because right now I m trying to add it but it s not easy.

So here is my first question, will it be better to code the drag and drop myself or to try integrate a drag and drop library like wz_dragdrop.js?

I already tried to integrate it but it is not working.

Here is what i ve done
I ve included the script in myspaces2.get.html.ftl
<script type="text/javascript"
src="/alfresco/service/api/path/content/workspace/SpacesStore/Company%20Home/wz_dragdrop.js"></script>

as for the next part I ll have to explain a bit how I changed my file myspacespanel2.get.html.ftl
I ve made it so that there is a first list in my ftl that display only documents and another list who display spaces.
For the first list I ve change some little things. If the document is an image, then instead of showing the usual picture icon put the image itself.

Now to get back to the drag and drop business, I ve read that by giving unique names to the images we want to be able to drag
by adding
<script type="text/javascript">
<!–

SET_DHTML("name1", "name2");

//–>
</script>
before the </body> in an casual html file

So here is what I tried

      <div class="spaceIcon">
         <#if d.isDocument && (d.mimetype = "image/gif" || d.mimetype = "image/jpeg" || d.mimetype = "image/png")>
            <a href="${url.context}${d.url}" target="new" onclick="event.cancelBubble=true"><img class="spaceIconImage" alt="" width="16" height="16" src="${url.context}${d.url}?${d.size}" border=0></a>
         <div style="display:none"><img name=d.name class="spaceIconImage64" alt="" width="64" height="64" src="${url.context}${d.url}?${d.size}"></div>
      
       <script type="text/javascript">
<!–

SET_DHTML(d.name);

//–>
</script>
      
         <#else>
            <a href="${url.context}${d.url}" target="new" onclick="event.cancelBubble=true"><img class="spaceIconImage" alt="" width="16" height="16" src="${url.context}${d.icon16?replace(".gif",".png")}" border=0></a>
         <div style="display:none"><img class="spaceIconImage64" alt="" width="64" height="64" src="${url.context}${d.icon64}"></div>
       </#if>

But it doesnt work
I m guessing that it cant work anyways because there must be some conflict with the size change animation.
I ve though to change the mouse icon when we click on a picture than drag it, but I dont really know how to code that in javascript..

An advice someone?


Regards
Seraphon
14 REPLIES 14

seraphon
Champ in-the-making
Champ in-the-making
Hi

I must say I am a novice developper and indeed the basic stuff is easy to do with the webscript. But correct me if I m wrong but the job of a developper using webscripts will certainly not be doing simple stuff with webscript.


In my opinion, the strongpoint of webscript is to be able to do a customised GUI that is able to act on Alfresco's repository and to be able to test the webscript instantanously by just clicking on the refresh button of your web browser. But nowadays companies, and most of all the usual users in those companies always want to be able to use a software, with minimal to no knowledge of the said software needed. There are simply users who sometimes know very little of computers.

Indeed those users can be quite bothersome. They always complain about a software not working when its just them not knowing how to use them.
Sadly I must say from the little survey I did in my company, most of my colleagues though Alfresco wasnt intuitive to use. They do not say its not well done nor the that the functionnalities are hard to use. Its just that there were a learning curve to Alfresco and they had to read the little tutorial I made for them. And it seems that before having a massive deployment to more users I have to make Alfresco more user friendly to use the term of my employer, because lets face it, a lot of people are too lazy (or busy if you listen to them) to sacrifice time for that learning curve of Alfresco.
Thats where useful things like webscripts come in.

But here comes my problem which isnt really a problem, which is that to do a friendly customised GUI for the lazy user, is not easy at all, and is certainly not something a novice could do. I dont want to be mean or anything but gavin admit that the myspaces portlet isnt something easy. It is already a complex code by itself. But even though the myspace portlet is nice, it is not really usefull. The animation slow down the application quite a lot and with hundreds of content it gets quite bad. The design is of course a question of taste but is sometime very important, and it wasnt easy at all to change some design in myspaces portlet. And even though it is a little bit more user friendly than the basic Alfresco interface, it is still not enough.

I wont list the crazy stuff my employers want but I repeat that in big companies nowadays the users are very,very hard to please, and from what I ve seen webscript is one way to please them. It is just again my opinion, but it is an opinion based from my experience with Alfresco, pleasing those future users wont be easy. Adding drag and drop which is a difficult task, is considered by most like normal stuff, almost ordinary.
So for a novice, it wont be easy to please the users with webscript (needing expert isnt a bad thing).
But webscript still is a wonderful tool because the alternatives to do custom GUI are as demandin if not worse.

I hope nobody took offence in what I wrote for it was not the aim, I wanted to do a constructive analyse of what webscript could do. But if what I wrote just look like ranting to you than I excuse myself.

Regards
Seraphon
Internship is like a box of chocolate…. You never know what you ll get….

fselendic
Champ in-the-making
Champ in-the-making
+1 on top post. Practically EVERY user we showed or installed Alfresco to, says it is a too click intensive and nonintuitive. We are pushing it hard for some big projects, because it IS a great piece of software, but, it is hard to compete with the guys showing off Sharepoint, which kills Alfresco usability vise. Then we end up with plans for 2-3 months project that we should do for free, trying to match Sharepoint ease of use for end customer.

That's really a shame. Alfreso is fantastic software, just to hard to use for casual users. It is easy when you have a power sponsor or decision maker that orders anyone in company to use it, but it is a VERY tough sell when customer chooses between Sharepoint and Alfresco. Actually, we lost every single fight.

Btw, some head to head comparison paper Alfresco vs Sharepoint would be a great addition for our sales. I looked and couldn't find any.

lintonb
Champ in-the-making
Champ in-the-making
Hi,

Do you have usability findings/reports we could look over?

Thanks,
Linton

fselendic
Champ in-the-making
Champ in-the-making
Hi,

Do you have usability findings/reports we could look over?

Thanks,
Linton

I'll make my american partner to provide one. He was just playing with Sharepoint 2007 or whatever the name of the new one is. And was impressed. I never use or evaluate MS products, but he knows Sharepoint and Alfresco well, which could be of great help.

seraphon
Champ in-the-making
Champ in-the-making
Hi

fselendic: I m also very interested by such an analysis/findings/reports.
I wanted myself to do a comparison between Alfresco and another opensource CMS like plone (though I miss the motivation now).


Anyways back to my topic.
After some hardship and some stubornness I finally managed to make a drag and drop that actually move a file in a space!
It really took me some time and I had to sacrifice many of my braincells but it was worth it. It is quite fulfilling to see a code that actually works and I couldnt have done it without webscript. Webscript is great and I indeed didnt have to do any java at all.

So here is my code in case it interest someone

The only thing I added is a yahoo call to a javascript located in Alfresco's repository inside the 'drop' function of my drag and drop code
      YAHOO.util.Connect.asyncRequest(
         "GET",
         getContextPath() + "/command/script/execute?scriptPath=/Company%20Home/mytest.js&contextPath=" + MySpaces.Npath +"/"+ MySpaces.Nname+"&s="+imgs64[i].getProperty('name'),
         {
            success: function(response)
            {
              
                  alert("cool " + response.responseText);
              
            },
            failure: function(response)
            {
               alert("Error during check out of item: " + response.responseText);
            }
         },
        "noderef=" + MySpaces.Nref
      );
            

and that calls the following file mytest.js
var scriptResult = document.parent.childByNamePath(args.s).name; 
var folder = document.parent.childByNamePath(args.s);
var coool="ca a marche!!"

function result()
{  if (document.move(folder)) scriptResult=coool;
   //var testingFolder = userhome.childByNamePath("QA/Performance/Testing");.
   return (scriptResult);
}
result();

well even though this works I still have a lot of improvements to do such as making spaces draggable. I also made a trashcan that delete files dragged on it but there are some problem afterwards…

I d also like to have some precision on some weird behavior about my code. After many test I saw that for the javascript API on nodes to be aknowledged in mytest.js I had to keep the noderef and add a contextPath argument Why?.

Even though right now there arent many posts about webscripts, do you think there is going to be a forum created for webscripts discussion only?
After this little manipulation I can say webscript really gives a lot of possibilities to Alfresco. It is a really powerful tool because it not only doesnt need java knowledge but what I though was great was that I could test my code right away by just clicking on the refresh button of my web browser.

I hope the Alfresco's engineer will keep improving this really useful side of Alfresco and keep up with their great work.

Regards
Seraphon
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.