Gareth, the modified version of scripty found at 
http://tankut.googlepages.com/home
solved my issue.
Thanks for your help
Sabri

On 10 juin, 02:40, "Mark Holton" <[EMAIL PROTECTED]> wrote:
> Hi Gareth,
> Very cool.  Good luck with your project.  ... the banter is useful in
> triggering thought, for sure!
> cheers,
> Mark
>
> On 6/9/07, Gareth Evans <[EMAIL PROTECTED]> wrote:
>
>
>
> > HI Mark
> > No Problem, thought I better contribute something that actually works on
> > here since I'm always asking questions and my project is a little 'closed
> > off' right now, (i dont want to open it to the world while it's got this
> > many bugs/missing features), and I can't direct people to the site to see
> > the fruits.
>
> > The changes in scripty were easy to identify as they are all commented,
> > they are only in dragdrop.js but I can't generate a patch- I think I need
> > someone's help to figure out how to generate a patch/diff file under
> > windows...
>
> > If someone sorts this out, I will submit it to trac as I think it is
> > something that is possibly quite useful.
>
> > Gareth
>
> > On 6/10/07, Mark Holton <[EMAIL PROTECTED]> wrote:
>
> > > Gareth,
> > > ...many thanks for the informative thread.  If you nail down the
> > > difference between the versions of 
> > > Script.aculo.us<http://script.aculo.us/>and modified Script.aculo.us
> > > <http://script.aculo.us/>you were using, would be interested to know
> > > what they were.
> > > -Mark
>
> > > On 6/9/07, Gareth Evans <[EMAIL PROTECTED] > wrote:
>
> > > > Updated javascript for onload, this one is set up to identify the new
> > > > sort order and save it to the database, as well as a second ajax call to
> > > > send the actual move operation.
> > > > Forget the serverside and database code, that's for your own
> > > > implementation guys :)
>
> > > > The line commented previously,
> > > > //i think this is probably my most awesome line of prototype code
> > > > ever...
> > > > Broke when I actually started testing different scenarios so I had to
> > > > break it into multiple lines ;(
> > > > It was meant to take 2 arrays, and return the only item not in the
> > > > smaller of the two, look that up in the dom, pluck an attribute off 
> > > > it...
>
> > > > var ZoneColumns = $('Zones').getElementsBySelector( ' div.ZoneColumn'
> > > > ).pluck('id');
> > > > $('Zones').getElementsBySelector( 
> > > > 'div.ZoneColumn').each(function(column) {
> > > > if ($F('UserId') != 0)
> > > > {
> > > > Sortable.create(column,{
> > > > tag:'div',
> > > > onChange:function(a,b,c) { },
> > > > onUpdate:function(a,b,c) {
> > > > //new Insertion.Top('debug','new childNodeLength: ' + String(
> > > > a.childNodes.length) + '<br/>');
> > > > //new Insertion.Top('debug', a.id + ' event<br/>');
> > > > //new Insertion.Top('debug','sequenced length of droppable: ' +
> > > > String(Sortable.sequence(a).length) + '<br/>');
> > > > //new Insertion.Top('debug','stored length of droppable: ' + String(
> > > > a.readAttribute('currentOrder')).split(',').without('').length +
> > > > '<br/>');
> > > > var currentSequence = Sortable.sequence(a).invoke('toString');
> > > > var c = $A(String(a.readAttribute('currentOrder')).split(',').without(
> > > > '').invoke('toString'));
> > > > if (currentSequence.length > c.size())
> > > > {
> > > > //new Insertion.Top('debug',String( a.id) + ' is the destination
> > > > div<br/>');
> > > > var n = $A(currentSequence).invoke('toString' );
> > > > var e = n.clone();
> > > > c.each(function (value,index) { e = e.without(value); });
> > > > var element = $( 'Zone_'+e.reduce()).readAttribute( 'zonedataid');
> > > > //new Insertion.Top('debug',element + ' is the draggable div<br/>');
> > > > //alert($A(currentSequence));
> > > > new Ajax.Request('Ajax.aspx' , {method:'post', parameters:
> > > > 'ZoneDataId='+element+ '&action=UpdateUserZoneItemColumn&Column='
> > > > +String( a.id).replace( 'ZoneColumn_',''), onFailure:errFunc });
> > > > a.setAttribute( 'currentOrder' ,Sortable.sequence(a));
> > > > }
> > > > var newOrder = $($A(currentSequence).inject([], function (array,value)
> > > > { array.push($('Zone_'+value).readAttribute('zonedataid' )); 
> > > > returnarray; }));
> > > > new Ajax.Request(" Ajax.aspx", {method: 'post', postBody:
> > > > 'Action=OrderZoneItems&newArray=' + newOrder, onFailure: function 
> > > > (transport)
> > > > { alert('There was an error setting the new order.' ); } });
> > > > //new Insertion.Top ('debug',String(a.id) + 's new order is: ' +
> > > > newOrder + '<br/>');
> > > > },
> > > > dropOnEmpty:'true',
> > > > containment:ZoneColumns,
> > > > constraint:false,
> > > > ghosting: false
> > > > });
> > > > column.setAttribute('currentOrder',Sortable.sequence(column));
> > > > }
> > > > column.getElementsBySelector ('div.zone').each(function(node){
> > > > if (node.id != null){
> > > > if (node.getAttribute( 'ZoneDataId') != null)
> > > > {
> > > > var url = 'RenderZone.aspx';
> > > > var pars = 'ZoneDataId=' + node.getAttribute ('ZoneDataId');
> > > > var myAjax = new Ajax.Updater(node.id, url, {method: 'post',
> > > > parameters: pars, onComplete:processCollapse });
> > > > }
> > > > }
> > > > });
> > > > });
>
> > > > Enjoy, hopefully this is of some use to someone else as well, coming
> > > > up to 6 hours of dev :P
>
> > > > Gareth
>
> > > > On 6/10/07, Gareth Evans <[EMAIL PROTECTED]> wrote:
>
> > > > > As for the changes made,
> > > > > I can see the changes in visual compare but it doesn't have the
> > > > > option to generate a patch file.
> > > > > I installed tortisesvn (i use win xp) and grabbed the latest trunk,
> > > > > copied the changed file in and then used "create patch" but the 
> > > > > resulting
> > > > > patch has - for every line of dragdrop.js and then a + for every
> > > > > line of the new dragdrop.js so I don't know what's going on...
> > > > > How should I go about creating a patch under XP?
> > > > > It doesn't seem like this patch exists in the trac, though it looks
> > > > > fairly comprehensive.
>
> > > > > Gareth
>
> > > > >  On 6/10/07, Gareth Evans <[EMAIL PROTECTED]> wrote:
>
> > > > > > *Christophe: re; Pixel, percent heights.*
>
> > > > > > Element.style.height returns in percentages.
> > > > > > If you use the prototype element method to getHeight, it returns
> > > > > > in pixels, without the px.
>
> > > > > > Test case is below.
>
> > > > > > <html>
> > > > > > <head>
> > > > > >   <script src="javascript/prototype.js"
> > > > > > type="text/javascript"></script>
> > > > > >   <script type="text/javascript">
> > > > > >  function Begin()
> > > > > >  {
> > > > > >   var h = $('percenttest').style.height
> > > > > >   new Insertion.Top('debug','div Percentage height: ' + h +
> > > > > > '<br/>');
> > > > > >   var ch = $('percenttest').getHeight();
> > > > > >   new Insertion.Top ('debug','div Calculated height: ' + ch +
> > > > > > '<br/>');
>
> > > > > >  }
> > > > > >   </script>
> > > > > > </head>
> > > > > > <body style="height:1000px;" onload="Begin();">
> > > > > >  <div id='percenttest'
> > > > > > style="height:70%;background-color:#efefef;">
> > > > > >  </div>
> > > > > >  <div id='debug'>
> > > > > >  </div>
> > > > > > </body>
> > > > > > </html>
>
> > > > > >  On 6/10/07, Gareth Evans <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Okay, continuing on from my previous post which details my
> > > > > > > solution...
>
> > > > > > > here is the new onload
>
> > > > > > > var ZoneColumns = $('Zones').getElementsBySelector( '
> > > > > > > div.ZoneColumn').pluck('id');
> > > > > > > $('Zones').getElementsBySelector( 'div.ZoneColumn').each(
> > > > > > > function (column) {
> > > > > > > if ($F('UserId') != 0)
> > > > > > > {
> > > > > > > Sortable.create(column,{
> > > > > > > tag:'div',
> > > > > > > onChange:function(a,b,c) { },
> > > > > > > onUpdate:function(a,b,c) {
> > > > > > > //new Insertion.Top('debug','new childNodeLength: ' + String(
> > > > > > > a.childNodes.length) + '<br/>');
> > > > > > > //new Insertion.Top('debug', a.id + ' event<br/>');
> > > > > > > //new Insertion.Top('debug','sequenced length of droppable: ' +
> > > > > > > String(Sortable.sequence(a).length) + '<br/>');
> > > > > > > //new Insertion.Top('debug','stored length of droppable: ' +
> > > > > > > String(a.readAttribute('currentOrder')).split(',').without('').length
> > > > > > > + '<br/>');
> > > > > > > if (Sortable.sequence(a).length > String(a.readAttribute(
> > > > > > > 'currentOrder')).split( ',').without('').length)
> > > > > > > {
> > > > > > > //new Insertion.Top ('debug',String( a.id) + ' is the
> > > > > > > destination div<br/>');
> > > > > > > //i think this is probably my most awesome line of prototype
> > > > > > > code ever...
> > > > > > > var element = $('Zone_'+Sortable.sequence(a).without(String(
> > > > > > > a.readAttribute('currentOrder' )).split(',').without( 
> > > > > > > '')).flatten().toString()).readAttribute(
> > > > > > > 'zonedataid');
> > > > > > > //new Insertion.Top('debug',element + ' is the draggable
> > > > > > > div<br/>');
> > > > > > > new Ajax.Request('Ajax.aspx', {method:'post' , parameters:
> > > > > > > 'ZoneDataId='+element+'&action=UpdateUserZoneItemColumn&Column='
> > > > > > > +String(a.id).replace('ZoneColumn_' ,''), onFailure:errFunc });
> > > > > > > a.setAttribute('currentOrder',Sortable.sequence(a));
> > > > > > > }
> > > > > > > },
> > > > > > > dropOnEmpty:'true' ,
> > > > > > > containment:ZoneColumns,
> > > > > > > constraint:false,
> > > > > > > ghosting: false
> > > > > > > });
> > > > > > > //alert(String(Sortable.sequence
> > > > > > > (column)).split(',').flatten().length);
> > > > > > > column.setAttribute ('currentOrder',Sortable.sequence (column));
> > > > > > > }
> > > > > > > column.getElementsBySelector('div.zone' ).each(function(node){
> > > > > > > if ( node.id != null){
> > > > > > > if (node.getAttribute( 'ZoneDataId' ) != null)
> > > > > > > {
> > > > > > > var url = 'RenderZone.aspx ';
> > > > > > > var pars = 'ZoneDataId=' + node.getAttribute( 'ZoneDataId');
> > > > > > > var myAjax = new Ajax.Updater( node.id, url, {method: 'post',
> > > > > > > parameters: pars, onComplete:processCollapse });
> > > > > > > }
> > > > > > > }
> > > > > > > });
> > > > > > > });
>
> > > > > > > *Christophe, *I will check that pixel/percent thing in a sec and
> > > > > > > get back to you.
>
> > > > > > > I will also check this diff between scripty and the version I
> > > > > > > had
>
> ...
>
> plus de détails >>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to