[Proto-Scripty] Ghosting

2010-03-31 Thread WLQ
I have to sortable menus, with drag and drop on one other. When I drag
the element from the list with ghosting=true to another element, you
don't see where you gonna drop the item (between which items). How can
ghosting be true but the menu still work like false.

Thanks, Yan

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: Variabalized containment

2009-10-11 Thread WLQ

I have no idea on how it could be done, looking through the Url
provided, this is as far I've gone.

var setupSortable = function(){
  Sortable.create = $$('new Selector(123',{
   containment: $$('Selector#findElements(root)'),


 http://prototypejs.org

 On Oct 6, 7:45 am, WLQ maybe...@gmail.com wrote:



  Sounds plausible, I would like to have more information on that
  please.

  On 5 Okt., 08:14, Alex McAuley webmas...@thecarmarketplace.com
  wrote:

   Why not give your list a class name thats specific to the list and select
   with $$
   Alex Mcauleyhttp://www.thevacancymarket.com

   - Original Message -
   From: WLQ maybe...@gmail.com
   To: Prototype  script.aculo.us 
   prototype-scriptaculous@googlegroups.com
   Sent: Sunday, October 04, 2009 3:05 PM
   Subject: [Proto-Scripty] Variabalized containment

The question is, how can I tell containment to include all lists with
Id's of someid_somenumber.
Somenumber being any number, let's say I've got 20 lists with the Id
of someid_{ID}.
So I don't really know the full ID of the list. I want to be able to
receive items from the lists id of which includes someid_ regardless
of what number goes after.

Thanks, Yan- Skjul tekst i anførselstegn -

   - Vis tekst i anførselstegn -- Skjul tekst i anførselstegn -

 - Vis tekst i anførselstegn -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Variabalized containment

2009-10-04 Thread WLQ

The question is, how can I tell containment to include all lists with
Id's of someid_somenumber.
Somenumber being any number, let's say I've got 20 lists with the Id
of someid_{ID}.
So I don't really know the full ID of the list. I want to be able to
receive items from the lists id of which includes someid_ regardless
of what number goes after.

Thanks, Yan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-17 Thread WLQ

So many non related posts here, so I've thought of throwing in one
too. It's about the script you gave me.
Now I've tried to manipulate it as far as I could, but still could't
get the results I was waiting for. Because you know it better and
really I have no idea in how to accomplish it, for a long  time
thinking about trying everything, I thought you could help me a
little.

http://pastie.org/549275
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Scripty Drag and Drop Examples

2009-07-10 Thread WLQ

Should you not open another question? As it's not related to the
current question of this post.


 Hello,

 I'm nearing the end of a decent sized project for a hardware company where
 I've been creating a virtual display rack filler.  They'd pick what items
 they want from the floor, and drag them onto the rack, later can be turned
 into an order, a quote, etc. Anyways, the problem is that it looks fantastic
 in Chrome, Firefox, Safari..but IE8  7 really chugs on anything DnD to the
 point where it is almost unusable, especially when there's a fair amount of
 items.

 Rather than advice at this point (as this is my first real AJAX project, I
 know for sure it isn't optimized, something I'll have to look into myself)
 I'm curious if some of you fine people can give me some examples of a
 website where scriptaculous is used to create some decent drag and drop
 functionality I can take a peak at.  I've seen some demo pages, but nothing
 as deep as I would like. I guess I need some faith that IE can handle this
 sort of thing decently, as I know its javascript performance isn't nearly as
 great as the previously mentioned browsers.

 Thanks in advance,

 Mitchell
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-04 Thread WLQ

But anyway, there is still something wrong with the self javascript,
as the item created freezes (you can't drag it after the clone)


 I use the classname clone to hook the javascript to later, you can  
 call these whatever you like, just be sure you tidy up and make  
 everything match on the JS side, too. I put the remove first, because  
 it's floated right in my layout, and you get more consistent results  
 with right floats if you set them as the first thing inside the parent  
 container. You can change these in the JavaScript at the bottom of  
 index.php, that's where they're coming from.

 Walter

 On Jul 3, 2009, at 1:43 PM, WLQ wrote:



  Right, also line number 34.

  Now here is how its outputting in html:
  li class=clone id=item_92span class=remove(x)/spanclone3/
  li

  When it should output it like:
  li id=item_92clone3span class=remove(x)/span

  Why does it give it a class of clone? And switching the places of
  remove class and the id (line:117+).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-03 Thread WLQ

Should it then be:
$data = get_object_vars($master);

Instead of:
$data = get_object_vars($original);

 Read through the second and third lines slowly and carefully. Look at  
 each variable that is being set and each variable that is being read.  
 (Variables to the left of the = are being set.) Ask yourself what it's  
 supposed to be carrying, and see if you can spot what it really is  
 instead.

 Here's a hint: In line two, I assigned a value to a variable, but on  
 line 3, I forgot to use it and used something else instead.

 Walter

 On Jul 2, 2009, at 6:09 AM, WLQ wrote:



  This is as far as I've been able to go, please tell what's wrong.

  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('widgets',$original)){
        $data = get_object_vars($original);
            if ( is_array($data) )
                array_shift($data);
         $new = MyActiveRecord::Create('clones',$data);
         $new-save();
         if(false === $new-get_errors()){
                 header('Content-type: text/html; charset=utf-8');
                 //this is the part you need:
                 print 'item_' .  $new-id;
         }else{
                 header('HTTP/1.0 500 Server Error',true,500);
                 exit;
         }
  }else{

         header('HTTP/1.0 404 Missing',true,404);

  }

  You're solving the wrong problem, then. Keep looking, it's right  
  there
  in front of you.

  Walter

  On Jul 1, 2009, at 1:36 PM, WLQ wrote:

  I understand I should put this:
  if(is_array($data)) {
     array_shift($data);
  }

  Instead of:
  array_shift($data);

  Or just do 

  if(is_array($data)) {
      array_shift($data);

  }

  HTH Alex

  - Original Message -
  From: Walter Lee Davis wa...@wdstudio.com
  To: prototype-scriptaculous@googlegroups.com
  Sent: Wednesday, July 01, 2009 5:56 PM
  Subject: [Proto-Scripty] Re: MySQL - order ID

  Which means it's not getting an array. So look and see what it IS
  getting. What is the value of $data at that point? (Use echo(),
  print_r(), something like that to output the value.)

  I can see the error right away, looking back over the code. It's a
  fairly stupid error on my part introduced while refactoring the
  working code into an example you could pick apart and learn from.

  I want you to find it, because otherwise you will never stand on
  your
  own here.

  Walter

  On Jul 1, 2009, at 10:31 AM, WLQ wrote:

  But here's what I get in error:
  array_shift() [function.array-shift]: The argument should be an
  array

  On this line:
  array_shift($data);

  Yes. Like any example that you will ever find on the Web, this  
  one
  needs to be adjusted to match your environment. Some basic
  fluency in
  PHP is a requirement to use the MAR system, it can't divine
  everything
  for you.

  Walter

  On Jul 1, 2009, at 5:57 AM, WLQ wrote:

  Right, shouldn't then that be 'widgets'? Because the table of  
  our
  original sortable list were controlled by the widgets table. So
  like:
  if($master = MyActiveRecord::FindById('widgets',$original)){

  Originals is a table in the database, it contains one of each
  type of
  thing you wish to be able to clone into the clones table.
  MyActiveRecord creates a PHP class for each table you wrap  
  it
  around, and each row of the table becomes an object of that
  class
  when
  you request it through MAR.

  In short, this line:

  if($master = MyActiveRecord::FindById('originals',$original)){

  ...if it finds a table called 'originals' in your database,  
  will
  return the row with the ID matching $original (or false).

  Walter

  On Jun 29, 2009, at 12:25 PM, WLQ wrote:

  It says - Class originals does not exist
  Where does the originals class comes from? What is the
  originals
  from
  the code above?

  If this is the code you are using (and I've added the  
  missing
  close
  parenthesis), then the fact that you are getting a 200 back
  (and a
  new
  ID) means that you have successfully created a new clone.
  Otherwise,
  you should be getting a 500 or 404 back.

  //create_clone.php
  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('originals',
  $original)){
          $data = get_object_vars($original);
          array_shift($data); //get rid of the ID
          $new = MyActiveRecord::Create('clones',$data);
          $new-save();
          if(false === $new-get_errors()){
                  header('Content-type: text/html;
  charset=utf-8');
                  //this is the part you need:
                  print 'item_' .  $new-id;
          }else{
                  header('HTTP/1.0 500 Server Error',true,
  500);
                  exit;
          }}else{

          header('HTTP/1.0 404 Missing',true,404);

  }

  Visit your test page with Firefox and with the Console tab  
  of
  Firebug
  open. Make sure Firebug is set to show XHR transactions. You
  should
  be
  able to observe the request to create_clone, and see the  
  reply
  from

[Proto-Scripty] Re: MySQL - order ID

2009-07-03 Thread WLQ

Unfortunately it's not them who create a problem.

THis is the code I use:

$original = $_POST['original'];
if($master = MyActiveRecord::FindById('widgets',$original)){
$data = get_object_vars($master);
array_shift($data);
$new = MyActiveRecord::Create('clones',$data);
$new-save();
if(false === $new-get_errors()){
header('Content-type: text/html; charset=utf-8');

print 'item_' .  $new-id;
}else{
header('HTTP/1.0 500 Server Error',true,500);
exit;
}
}else{

header('HTTP/1.0 404 Missing',true,404);

}

 Those errors wont occur when you remove the echo / print_r statements
 ... they are just moaning about the web server detecting content and
 expressing its own headers...

 If you remove the lines i asked u to add it will be fine

 Alex

 - Original Message -
 From: WLQ maybe...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Friday, July 03, 2009 1:53 PM
 Subject: [Proto-Scripty] Re: MySQL - order


 Well

 widgets Object ( [id] = 3 [name] = 3.00 [description] = 3
  [position] = 3 [updated_at] = 2009-06-05 14:39:07 )

  And the second one ($original) returned an id of 3. So the answer is
  you should write $master instead of $original.

  So this problem is solved, but the errors won't stop. You solve one
  problem and here you go another one:
  Cannot modify header information - headers already sent by (output
  started at:1) LOCATION: line 8

  If anything it should be $master as thats what is most likely to be an
  array I dont know MAR at all but unless it parses the  I do into a
  loop
  then t is inal is moe likt into be an id/string/int thaMAR  array...

  To test

  er {

ray. p
t_r($master); // shto d return .. {


  eay
 an array or
  object)

  - Original Message -
  From:/ shQ maybe...@gmail.com
 (noTo: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Friday, July 03, 2009 12:51 PM
  Subject: [Proto-Scripty] Re: MySQL - order ID
  orde
  ID

  d it then be:
  $data = get_object_vars($master);

  Instead of:
  $data = get_object_var ordei ID

 be:
a $datgh the s the  and third line;
 owly and carefully. Look at
   each variable that is being set and each variable that is being read.
   (Variables ly. Le left of the = are being set.) Ask yourself what it's
   supposed to be carrying, and see if you can spot what it really is
   instead.

   Here's a hint: In line two, I assigned a value to a variable, but on
   line 3, I forgot to use it and used something else instead.

   Walter

   On Jul 2, 2009, at 6:09 AM, WLQ wrote:

This is as far as I've been able to go, please tell what's wrong.

$original = $_POST['original'];
if($master = MyActiveRecord::FindById('widgets',$original)){
$dat $data = get__vject_varginal);
if ( is_array($data) )
array_shift($data);
$new = MyA  $data = gereobject_vnes',   if ( is
rray($da$new-save();
== $ntw-gors()){
header('ContA  ydata = g/html; charset=utf-8');
//tve();
ift you need:
print 'rirs('i.em_ew-id header('C
ntense{
he r('HTTP/1.0 500 Server Error',true,50 
  ft  eu ne
}
  print itese{

header(}else{
. 04 Missing',true,41.0;

ror

ht
there
in fro  of you.

Walter

On Jul 1, 2009, at 1:36 PM, WLQ wrote:

I understand I should plem, is:
if(is_array($data)) {
array_shift($data);
}

Instead of:
array_shift($data);

Or just do 

if(is_array($data)) {
array_shift($data);

}

HTH Alex

- Original Message -
From: Walter Lee Davis wa...@wdstudio.com
To: prototype-scriptaculous@googlegroups.com
Sent: Wednesday, July 01, 2009 5:56 PM
Subject: [Proto-Scripty] Re: MySQL - order ID

Which means it's not getting an array. So look and see whate whaS
  it IS
  getting. What is the value of $data at that point? (Use echo(),
print_r(), see that it ke that to output the value.)

I can see the error right away, looking back over thhat ie the va
a
 s   fairly stupid error on my part introduced while refactoring the
 he vaue.)working code into an example you could pick apart and learn from.

I want you to find it, because otherwisidyou will never stand on
your
own here.

Walter

On Jul 1, 2009, at 10:31 AM, WLQ wrote:

But here's what I get in error:
array_shift() [function.array-shift]: The argument should be an
array

On this line:
array_shift($data);

Yes. Like any example that you will ever find on the Web, this
one
needs to be adjusted to match your environment. Some basic
fluency in
PHP is a requirement to use the MAR system, it can't divine
everything
for you.

Walter

On Jul 1, 2009, at 5:57 AM, WLQ wrote:

Right, shouldn't then that be 'widgets'? Because the table of
our
original sortable list

[Proto-Scripty] Re: MySQL - order ID

2009-07-03 Thread WLQ

Could the require_once do something? Because this is the only
outside content I have. In particularly it's the index.php - so this
way the database and everything else is configured.


 Check your script for any whitespace (spaces, newlines, anything at  
 all) outside of the ?php ? delimiters. Something is printing some  
 content to the page buffer before the header is being sent, and that's  
 the problem. It doesn't need to be anything you wrote, it could be an  
 extra space at the top of your script, or if your text editor likes to  
 put a BOM at the top of the file, it could be that.

 Walter

 On Jul 3, 2009, at 9:54 AM, WLQ wrote:



  Unfortunately it's not them who create a problem.

  THis is the code I use:

  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('widgets',$original)){
         $data = get_object_vars($master);
         array_shift($data);
         $new = MyActiveRecord::Create('clones',$data);
         $new-save();
         if(false === $new-get_errors()){
                 header('Content-type: text/html; charset=utf-8');

                 print 'item_' .  $new-id;
         }else{
                 header('HTTP/1.0 500 Server Error',true,500);
                 exit;
         }
  }else{

         header('HTTP/1.0 404 Missing',true,404);

  }

  Those errors wont occur when you remove the echo / print_r  
  statements
  ... they are just moaning about the web server detecting content and
  expressing its own headers...

  If you remove the lines i asked u to add it will be fine

  Alex

  - Original Message -
  From: WLQ maybe...@gmail.com
  To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com

  Sent: Friday, July 03, 2009 1:53 PM
  Subject: [Proto-Scripty] Re: MySQL - order

  Well

  widgets Object ( [id] = 3 [name] = 3.00 [description] = 3
  [position] = 3 [updated_at] = 2009-06-05 14:39:07 )

  And the second one ($original) returned an id of 3. So the answer is
  you should write $master instead of $original.

  So this problem is solved, but the errors won't stop. You solve one
  problem and here you go another one:
  Cannot modify header information - headers already sent by (output
  started at:1) LOCATION: line 8

  If anything it should be $master as thats what is most likely to  
  be an
  array I dont know MAR at all but unless it parses the  I do  
  into a
  loop
  then t is inal is moe likt into be an id/string/int thaMAR  
  array...

  To test



  er {

 ray.y. p
  t_r($master); // shto d return .. {

  eay
  an array or
  object)

  - igininal Message -
  Fm:/:/ shQ maybe...@gmail.com
  (noTo: Prototype  script.aculo.us
  prototype-siptptacul...@googlegroups.com
  S Sent: Friday, July 03, 2009 12:51 PM
  Subject: [Proto-Scripty] Re: MySQL - order ID
  orde
  ID

  d it then be:
  $data get_tbject_v_vars($master);

  Instd ofof:
  $data = get_object_var ordei ID

  be:
  a $datgh the s the  and third line;
  owly and carefully. Look at
 each variable that is being t andnd each variable that is being  
 read.
  (Variables ly. Le left of the = are being set.) Ask yourself  
  what it's
  supposed to be carrying, andee if f you can spot what it really is
  instead.

  Here's a hint: In line two, I assigned a value to a variable,  
  but on
  line 3, I forgot to use it and used something else instead.

  Walter

  On Jul 2, 2009, at 6:09 AM, WLQ wrote:

  This is as far as I've been able to go, please tell what's wrong.

  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('widgets',$original)){
  $dat $data = get__vject_varginal);
  if ( is_array($data)
  arra
rshift($d($data);
  $new = MyA  $da= g= gereobject_vn,  if ( i( is
  rray($da$new-save();
  == $ntw-gors()){
  header('ContA  yda= g= g/html; chet=utf-8')8
 
  //tve();
  ift iou you need:
  pririr'r'i.e'i.em_ew-id header('C
ntenstens 
 heHTTP/1.T 50.0 500 Server Erroue,true,50 
 t   ft  eu ne
  }
   itet itese

se{
  . 04 M
  .',true,41.0;

  ror

  ht
  there
  in fr f you.

  Walter

  On Jul 1, 2009, at 1:36 PM, WLQ wrote:

  I understand unshould plem, is:
  if(is_array($data)) {
  array_shift($data);
  }

  Instead of:
  array_shift($data);

  Or jus 

  if(is_array($data)) {
  array_shift($data);

  }

  HTH Alex

  - Original Message -
  From: Walter Lee Davis wa...@wdstudio.com
  To: prototype-scriptaculous@googlegroups.com
  Sent: Wednesday, July 01, 2009 5:56 PM
  Subject: [Proto-Scripty] Re: MySQL - order ID

  Which means it's not getting an array. So look and see  
  whate whaS
  it IS
  getting. What is the value of $dvaluetof $datoint? (Use echo(),
  print_r(), see that it ke that to output the value.)

  I can see tI canrsee ight away, looking back over thhat ie  
  the va
  a
  s   fairly stupid error on my part intmyduced while  
  refactoring the
  he vaue.)working code into an example you could pick coult pnd  
  learn from l

r  
  stand on
  your
  own here.

  Walter

  On Jul 1

[Proto-Scripty] Re: MySQL - order ID

2009-07-03 Thread WLQ

Well it is something wrong with index.php but strangely it's saying
that it occurs on this line:
script src=itanu_files/prototype.js/script

... but why do you really need to change the header:
 header('Content-type: text/html; charset=utf-8');

if in my index.php that's included in the create_clone one is
allready:
meta http-equiv=Content-type content=text/html; charset=UTF-8


 Yes, it could be something inside the code it's requiring that is  
 issuing a header. But it could still be an error in the code inside  
 your index.php page. Im nnot aware of anything in MAR itself that can  
 cause this error.

 Try this (it's a good general debugging trick): inside the index.php,  
 commet oout all of the header() calls, and then access the page using  
 Firebug. Look at the response (in Firebug's Console tab) to see what,  
 if anything, is being printed to the browser. You may have an error in  
 there that isn't being properly trapped, although I'm not seeing it if  
 that's the case.

 Walter

 On Jul 3, 2009, at 11:31 AM, WLQ wrote:



  Could the require_once do something? Because this is the only
  outside content I have. In particularly it's the index.php - so this
  way the daabaase and everything else is configured.

  Check your script for any whitespace (spaces, newlines, aything at


  all) outside ofthe ?pphp ? delimiters. Something is printing
some
  content to the page buffer before the header is being sent, and  
  that's
  the problem. It doesn't need to be anything you wrote, it could be an
  extra space at the top of your script, or if your text editor likes  
  to
  put a BOM at the top of the file, it could be that.

  Walter

  On Jul 3, 2009, at 9:54 AM, WLQ wrote:

  Unfortunately it's not them who create a problem.

  THis is the code I use:

  $original = $POTT[''original'];
  if($master = MyActiveRecord::FindById('widgets',$original)){
        $daat  =get_oobjject_vars($master);
         arrayshifft(data);
     
     $new = MyActiveRecord::Create('clones',$data);
        $w-save();


         if(false === $new-get_errors()){
                 header('Content-type: text/html; charset=utf-8');

                 print 'item_'  ew--id;i

         }else{
                 header('HTTP/1.0 500 Server Error',true,500);
                 exit;
         }
  }else{

         header('HTTP/1.0 404 Missing',true,404);

  }

  Those errors wont occur when you remove the echo / print_r
  statements
  ... they are just moaning about the web server detecting content  
  and
  expressing its own headers...

  If you remove the lines i asked u to add it will be fine

  Alex

  - Original Message -
  From: WLQ maybe...@gmail.com
  To: Prototype  script.aculo.us 
  prototype-scriptaculous@googlegroups.com

  Sent: Friday, July 03, 2009 1:53 PM
  Subject: [Proto-Scripty] Re: MySQL - order

  Well

  widgets Object ( [id] =  mm] =] 3..00 00 [description] = 3
  [position] = 3 [updated_at] = 2009-06-05 14:07 )7 )

  And the second one ($original) returned an id of 3. So the  
  answer is
  you should write $master instead of $original.

  So this problem is solved, but the errors won't stop. You solve  
  one
  problem and here you go another one:
  Cannot modify header information - headers already sent by (output
  started at:1) LOCATION: line 8

  If anything it should be $master as thats what is most likely to
  be an
  array I dont know MAR at all but unless it ass th the  I do
  into a
  loop
  then t is iais ms moe likt into be an id/stringt thaMhaMAR
  array...

  To test

  er. .


 
  r ray.y. p
  t_r($me /; // // shto d return .. {

  eay
  an array or
  object)

  - igininal Messag---
 Fm Fm:/:/ shQ maybe...@gm.co.

  (noTo: Prototype  script.aculo.us
 rotoeype-sipsiptptacul...@googlegroups.c

 S Sent: Friday, July 03,09 12:51:51 PM
  Subject: [Proto-Scripty] Re: MySQL - order ID
  orde
  ID

  d it then be:
  $data get_tbject_v_vars($mas);

 In
 Instd ofof:
  $dataet_bjecobject_var ordei ID

  be:
  a $datgh thehe and thnd third line;
  owly anrefuly. Loyk atok at
 ach vaciabariablet is eing eing t andnd each variable tha bein
 
 read.
  (Vales l. Leyleft of t of the = are being set.) Ask ylf
 
  wht's

  suppobe  arrying, rying, andee if f you can spot what i
 
 really is
  instead.

 two, I assignue tovalue to a variable,
  but on
ablne 3, line 3, I forgot to use it and used something else instead.

  Walter

  On Jul 2, 2009, at 6:09 AM, WLQ wrote:

  This is as far as I've been able to go, please tell what's  
  wrong.

  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('widgets',$original)){
  $dat $data = get__vject_varginal);
  if ( is_array($data)
  arra
  rshift($d(  $ne
  $ne=data);
i( is
  rray($if ne issave();
 rray(f newesave();){
  header('ContA  yda= g= g/htr('CcA u ydag= g/h
g= g/h
  //tve();
 t iou /ou ne);
 ou
ft pririr'r'i.e'i.em_ew-'i.eirider''C
  ntensteC
 nt
nt s ntenHTTP/1.T 50.0 500  50.0rTTP See,t0.0,/1u
t0.0, r
f,treu

[Proto-Scripty] Re: MySQL - order ID

2009-07-03 Thread WLQ

Well it is something wrong with index.php but strangely it's saying
that it occurs on this line:
script src=itanu_files/prototype.js/script

... but why do you really need to change the header:
 header('Content-type: text/html; charset=utf-8');

if in my index.php that's included in the create_clone one is
allready:
meta http-equiv=Content-type content=text/html; charset=UTF-8
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-03 Thread WLQ

I haven't really done anything there, it's just the test page. I've
just combined everything:
http://www.pastie.org/533394
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-03 Thread WLQ

index.php
http://www.pastie.org/533394

create_clone.php
http://www.pastie.org/533425
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-03 Thread WLQ

Right, also line number 34.

Now here is how its outputting in html:
li class=clone id=item_92span class=remove(x)/spanclone3/
li

When it should output it like:
li id=item_92clone3span class=remove(x)/span

Why does it give it a class of clone? And switching the places of
remove class and the id (line:117+).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-02 Thread WLQ

This is as far as I've been able to go, please tell what's wrong.

$original = $_POST['original'];
if($master = MyActiveRecord::FindById('widgets',$original)){
   $data = get_object_vars($original);
   if ( is_array($data) )
   array_shift($data);
$new = MyActiveRecord::Create('clones',$data);
$new-save();
if(false === $new-get_errors()){
header('Content-type: text/html; charset=utf-8');
//this is the part you need:
print 'item_' .  $new-id;
}else{
header('HTTP/1.0 500 Server Error',true,500);
exit;
}
}else{

header('HTTP/1.0 404 Missing',true,404);

}

 You're solving the wrong problem, then. Keep looking, it's right there  
 in front of you.

 Walter

 On Jul 1, 2009, at 1:36 PM, WLQ wrote:



  I understand I should put this:
  if(is_array($data)) {
     array_shift($data);
  }

  Instead of:
  array_shift($data);

  Or just do 

  if(is_array($data)) {
      array_shift($data);

  }

  HTH Alex

  - Original Message -
  From: Walter Lee Davis wa...@wdstudio.com
  To: prototype-scriptaculous@googlegroups.com
  Sent: Wednesday, July 01, 2009 5:56 PM
  Subject: [Proto-Scripty] Re: MySQL - order ID

  Which means it's not getting an array. So look and see what it IS
  getting. What is the value of $data at that point? (Use echo(),
  print_r(), something like that to output the value.)

  I can see the error right away, looking back over the code. It's a
  fairly stupid error on my part introduced while refactoring the
  working code into an example you could pick apart and learn from.

  I want you to find it, because otherwise you will never stand on  
  your
  own here.

  Walter

  On Jul 1, 2009, at 10:31 AM, WLQ wrote:

  But here's what I get in error:
  array_shift() [function.array-shift]: The argument should be an  
  array

  On this line:
  array_shift($data);

  Yes. Like any example that you will ever find on the Web, this one
  needs to be adjusted to match your environment. Some basic  
  fluency in
  PHP is a requirement to use the MAR system, it can't divine
  everything
  for you.

  Walter

  On Jul 1, 2009, at 5:57 AM, WLQ wrote:

  Right, shouldn't then that be 'widgets'? Because the table of our
  original sortable list were controlled by the widgets table. So
  like:
  if($master = MyActiveRecord::FindById('widgets',$original)){

  Originals is a table in the database, it contains one of each
  type of
  thing you wish to be able to clone into the clones table.
  MyActiveRecord creates a PHP class for each table you wrap it
  around, and each row of the table becomes an object of that  
  class
  when
  you request it through MAR.

  In short, this line:

  if($master = MyActiveRecord::FindById('originals',$original)){

  ...if it finds a table called 'originals' in your database, will
  return the row with the ID matching $original (or false).

  Walter

  On Jun 29, 2009, at 12:25 PM, WLQ wrote:

  It says - Class originals does not exist
  Where does the originals class comes from? What is the  
  originals
  from
  the code above?

  If this is the code you are using (and I've added the missing
  close
  parenthesis), then the fact that you are getting a 200 back
  (and a
  new
  ID) means that you have successfully created a new clone.
  Otherwise,
  you should be getting a 500 or 404 back.

  //create_clone.php
  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('originals',$original)){
          $data = get_object_vars($original);
          array_shift($data); //get rid of the ID
          $new = MyActiveRecord::Create('clones',$data);
          $new-save();
          if(false === $new-get_errors()){
                  header('Content-type: text/html;  
  charset=utf-8');
                  //this is the part you need:
                  print 'item_' .  $new-id;
          }else{
                  header('HTTP/1.0 500 Server Error',true,500);
                  exit;
          }}else{

          header('HTTP/1.0 404 Missing',true,404);

  }

  Visit your test page with Firefox and with the Console tab of
  Firebug
  open. Make sure Firebug is set to show XHR transactions. You
  should
  be
  able to observe the request to create_clone, and see the reply
  from
  the server. The reply should be the new ID of your clone. If  
  it
  isn't,
  then you have more debugging to do.

  Things to check here:

  * Have you included/required the library (MyActiveRecord) in  
  this
  script, and have you defined the constants it needs (MySQL
  address
  and
  credentials, also known as a DSN).
  * Have you got a MySQL table called clones?
  * Have you enabled error reporting on your server for your  
  test
  pages,
  so you can see the PHP errors as they whiz by?
  * Have you ordered that fat book I recommended?

  Debugging PHP is like playing Whack-a-Mole. You fix one thing,
  and
  another pops up. You

[Proto-Scripty] Re: MySQL - order ID

2009-07-01 Thread WLQ

Right, shouldn't then that be 'widgets'? Because the table of our
original sortable list were controlled by the widgets table. So like:
if($master = MyActiveRecord::FindById('widgets',$original)){


 Originals is a table in the database, it contains one of each type of  
 thing you wish to be able to clone into the clones table.  
 MyActiveRecord creates a PHP class for each table you wrap it  
 around, and each row of the table becomes an object of that class when  
 you request it through MAR.

 In short, this line:

 if($master = MyActiveRecord::FindById('originals',$original)){

 ...if it finds a table called 'originals' in your database, will  
 return the row with the ID matching $original (or false).

 Walter

 On Jun 29, 2009, at 12:25 PM, WLQ wrote:



  It says - Class originals does not exist
  Where does the originals class comes from? What is the originals from
  the code above?

  If this is the code you are using (and I've added the missing close
  parenthesis), then the fact that you are getting a 200 back (and a  
  new
  ID) means that you have successfully created a new clone. Otherwise,
  you should be getting a 500 or 404 back.

  //create_clone.php
  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('originals',$original)){
          $data = get_object_vars($original);
          array_shift($data); //get rid of the ID
          $new = MyActiveRecord::Create('clones',$data);
          $new-save();
          if(false === $new-get_errors()){
                  header('Content-type: text/html; charset=utf-8');
                  //this is the part you need:
                  print 'item_' .  $new-id;
          }else{
                  header('HTTP/1.0 500 Server Error',true,500);
                  exit;
          }}else{

          header('HTTP/1.0 404 Missing',true,404);

  }

  Visit your test page with Firefox and with the Console tab of Firebug
  open. Make sure Firebug is set to show XHR transactions. You should  
  be
  able to observe the request to create_clone, and see the reply from
  the server. The reply should be the new ID of your clone. If it  
  isn't,
  then you have more debugging to do.

  Things to check here:

  * Have you included/required the library (MyActiveRecord) in this
  script, and have you defined the constants it needs (MySQL address  
  and
  credentials, also known as a DSN).
  * Have you got a MySQL table called clones?
  * Have you enabled error reporting on your server for your test  
  pages,
  so you can see the PHP errors as they whiz by?
  * Have you ordered that fat book I recommended?

  Debugging PHP is like playing Whack-a-Mole. You fix one thing, and
  another pops up. You iterate, in other, more dainty words.

  Walter

  On Jun 28, 2009, at 12:04 PM, WLQ wrote:

  Also I've used that clone.php you gave, the only thing it doesn't do
  is change the MySQL table itself.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-01 Thread WLQ

But here's what I get in error:
array_shift() [function.array-shift]: The argument should be an array

On this line:
array_shift($data);


 Yes. Like any example that you will ever find on the Web, this one  
 needs to be adjusted to match your environment. Some basic fluency in  
 PHP is a requirement to use the MAR system, it can't divine everything  
 for you.

 Walter

 On Jul 1, 2009, at 5:57 AM, WLQ wrote:



  Right, shouldn't then that be 'widgets'? Because the table of our
  original sortable list were controlled by the widgets table. So like:
  if($master = MyActiveRecord::FindById('widgets',$original)){

  Originals is a table in the database, it contains one of each type of
  thing you wish to be able to clone into the clones table.
  MyActiveRecord creates a PHP class for each table you wrap it
  around, and each row of the table becomes an object of that class  
  when
  you request it through MAR.

  In short, this line:

  if($master = MyActiveRecord::FindById('originals',$original)){

  ...if it finds a table called 'originals' in your database, will
  return the row with the ID matching $original (or false).

  Walter

  On Jun 29, 2009, at 12:25 PM, WLQ wrote:

  It says - Class originals does not exist
  Where does the originals class comes from? What is the originals  
  from
  the code above?

  If this is the code you are using (and I've added the missing close
  parenthesis), then the fact that you are getting a 200 back (and a
  new
  ID) means that you have successfully created a new clone.  
  Otherwise,
  you should be getting a 500 or 404 back.

  //create_clone.php
  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('originals',$original)){
          $data = get_object_vars($original);
          array_shift($data); //get rid of the ID
          $new = MyActiveRecord::Create('clones',$data);
          $new-save();
          if(false === $new-get_errors()){
                  header('Content-type: text/html; charset=utf-8');
                  //this is the part you need:
                  print 'item_' .  $new-id;
          }else{
                  header('HTTP/1.0 500 Server Error',true,500);
                  exit;
          }}else{

          header('HTTP/1.0 404 Missing',true,404);

  }

  Visit your test page with Firefox and with the Console tab of  
  Firebug
  open. Make sure Firebug is set to show XHR transactions. You should
  be
  able to observe the request to create_clone, and see the reply from
  the server. The reply should be the new ID of your clone. If it
  isn't,
  then you have more debugging to do.

  Things to check here:

  * Have you included/required the library (MyActiveRecord) in this
  script, and have you defined the constants it needs (MySQL address
  and
  credentials, also known as a DSN).
  * Have you got a MySQL table called clones?
  * Have you enabled error reporting on your server for your test
  pages,
  so you can see the PHP errors as they whiz by?
  * Have you ordered that fat book I recommended?

  Debugging PHP is like playing Whack-a-Mole. You fix one thing, and
  another pops up. You iterate, in other, more dainty words.

  Walter

  On Jun 28, 2009, at 12:04 PM, WLQ wrote:

  Also I've used that clone.php you gave, the only thing it  
  doesn't do
  is change the MySQL table itself.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-01 Thread WLQ

But here's what I get in error:
array_shift() [function.array-shift]: The argument should be an array

On this line:
array_shift($data);


 Yes. Like any example that you will ever find on the Web, this one  
 needs to be adjusted to match your environment. Some basic fluency in  
 PHP is a requirement to use the MAR system, it can't divine everything  
 for you.

 Walter

 On Jul 1, 2009, at 5:57 AM, WLQ wrote:



  Right, shouldn't then that be 'widgets'? Because the table of our
  original sortable list were controlled by the widgets table. So like:
  if($master = MyActiveRecord::FindById('widgets',$original)){

  Originals is a table in the database, it contains one of each type of
  thing you wish to be able to clone into the clones table.
  MyActiveRecord creates a PHP class for each table you wrap it
  around, and each row of the table becomes an object of that class  
  when
  you request it through MAR.

  In short, this line:

  if($master = MyActiveRecord::FindById('originals',$original)){

  ...if it finds a table called 'originals' in your database, will
  return the row with the ID matching $original (or false).

  Walter

  On Jun 29, 2009, at 12:25 PM, WLQ wrote:

  It says - Class originals does not exist
  Where does the originals class comes from? What is the originals  
  from
  the code above?

  If this is the code you are using (and I've added the missing close
  parenthesis), then the fact that you are getting a 200 back (and a
  new
  ID) means that you have successfully created a new clone.  
  Otherwise,
  you should be getting a 500 or 404 back.

  //create_clone.php
  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('originals',$original)){
          $data = get_object_vars($original);
          array_shift($data); //get rid of the ID
          $new = MyActiveRecord::Create('clones',$data);
          $new-save();
          if(false === $new-get_errors()){
                  header('Content-type: text/html; charset=utf-8');
                  //this is the part you need:
                  print 'item_' .  $new-id;
          }else{
                  header('HTTP/1.0 500 Server Error',true,500);
                  exit;
          }}else{

          header('HTTP/1.0 404 Missing',true,404);

  }

  Visit your test page with Firefox and with the Console tab of  
  Firebug
  open. Make sure Firebug is set to show XHR transactions. You should
  be
  able to observe the request to create_clone, and see the reply from
  the server. The reply should be the new ID of your clone. If it
  isn't,
  then you have more debugging to do.

  Things to check here:

  * Have you included/required the library (MyActiveRecord) in this
  script, and have you defined the constants it needs (MySQL address
  and
  credentials, also known as a DSN).
  * Have you got a MySQL table called clones?
  * Have you enabled error reporting on your server for your test
  pages,
  so you can see the PHP errors as they whiz by?
  * Have you ordered that fat book I recommended?

  Debugging PHP is like playing Whack-a-Mole. You fix one thing, and
  another pops up. You iterate, in other, more dainty words.

  Walter

  On Jun 28, 2009, at 12:04 PM, WLQ wrote:

  Also I've used that clone.php you gave, the only thing it  
  doesn't do
  is change the MySQL table itself.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-01 Thread WLQ

But here's what I get in error:
array_shift() [function.array-shift]: The argument should be an array

On this line:
array_shift($data);


 Yes. Like any example that you will ever find on the Web, this one  
 needs to be adjusted to match your environment. Some basic fluency in  
 PHP is a requirement to use the MAR system, it can't divine everything  
 for you.

 Walter

 On Jul 1, 2009, at 5:57 AM, WLQ wrote:



  Right, shouldn't then that be 'widgets'? Because the table of our
  original sortable list were controlled by the widgets table. So like:
  if($master = MyActiveRecord::FindById('widgets',$original)){

  Originals is a table in the database, it contains one of each type of
  thing you wish to be able to clone into the clones table.
  MyActiveRecord creates a PHP class for each table you wrap it
  around, and each row of the table becomes an object of that class  
  when
  you request it through MAR.

  In short, this line:

  if($master = MyActiveRecord::FindById('originals',$original)){

  ...if it finds a table called 'originals' in your database, will
  return the row with the ID matching $original (or false).

  Walter

  On Jun 29, 2009, at 12:25 PM, WLQ wrote:

  It says - Class originals does not exist
  Where does the originals class comes from? What is the originals  
  from
  the code above?

  If this is the code you are using (and I've added the missing close
  parenthesis), then the fact that you are getting a 200 back (and a
  new
  ID) means that you have successfully created a new clone.  
  Otherwise,
  you should be getting a 500 or 404 back.

  //create_clone.php
  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('originals',$original)){
          $data = get_object_vars($original);
          array_shift($data); //get rid of the ID
          $new = MyActiveRecord::Create('clones',$data);
          $new-save();
          if(false === $new-get_errors()){
                  header('Content-type: text/html; charset=utf-8');
                  //this is the part you need:
                  print 'item_' .  $new-id;
          }else{
                  header('HTTP/1.0 500 Server Error',true,500);
                  exit;
          }}else{

          header('HTTP/1.0 404 Missing',true,404);

  }

  Visit your test page with Firefox and with the Console tab of  
  Firebug
  open. Make sure Firebug is set to show XHR transactions. You should
  be
  able to observe the request to create_clone, and see the reply from
  the server. The reply should be the new ID of your clone. If it
  isn't,
  then you have more debugging to do.

  Things to check here:

  * Have you included/required the library (MyActiveRecord) in this
  script, and have you defined the constants it needs (MySQL address
  and
  credentials, also known as a DSN).
  * Have you got a MySQL table called clones?
  * Have you enabled error reporting on your server for your test
  pages,
  so you can see the PHP errors as they whiz by?
  * Have you ordered that fat book I recommended?

  Debugging PHP is like playing Whack-a-Mole. You fix one thing, and
  another pops up. You iterate, in other, more dainty words.

  Walter

  On Jun 28, 2009, at 12:04 PM, WLQ wrote:

  Also I've used that clone.php you gave, the only thing it  
  doesn't do
  is change the MySQL table itself.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-01 Thread WLQ

But here's what I get in error:
array_shift() [function.array-shift]: The argument should be an array

On this line:
array_shift($data);


 Yes. Like any example that you will ever find on the Web, this one  
 needs to be adjusted to match your environment. Some basic fluency in  
 PHP is a requirement to use the MAR system, it can't divine everything  
 for you.

 Walter

 On Jul 1, 2009, at 5:57 AM, WLQ wrote:



  Right, shouldn't then that be 'widgets'? Because the table of our
  original sortable list were controlled by the widgets table. So like:
  if($master = MyActiveRecord::FindById('widgets',$original)){

  Originals is a table in the database, it contains one of each type of
  thing you wish to be able to clone into the clones table.
  MyActiveRecord creates a PHP class for each table you wrap it
  around, and each row of the table becomes an object of that class  
  when
  you request it through MAR.

  In short, this line:

  if($master = MyActiveRecord::FindById('originals',$original)){

  ...if it finds a table called 'originals' in your database, will
  return the row with the ID matching $original (or false).

  Walter

  On Jun 29, 2009, at 12:25 PM, WLQ wrote:

  It says - Class originals does not exist
  Where does the originals class comes from? What is the originals  
  from
  the code above?

  If this is the code you are using (and I've added the missing close
  parenthesis), then the fact that you are getting a 200 back (and a
  new
  ID) means that you have successfully created a new clone.  
  Otherwise,
  you should be getting a 500 or 404 back.

  //create_clone.php
  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('originals',$original)){
          $data = get_object_vars($original);
          array_shift($data); //get rid of the ID
          $new = MyActiveRecord::Create('clones',$data);
          $new-save();
          if(false === $new-get_errors()){
                  header('Content-type: text/html; charset=utf-8');
                  //this is the part you need:
                  print 'item_' .  $new-id;
          }else{
                  header('HTTP/1.0 500 Server Error',true,500);
                  exit;
          }}else{

          header('HTTP/1.0 404 Missing',true,404);

  }

  Visit your test page with Firefox and with the Console tab of  
  Firebug
  open. Make sure Firebug is set to show XHR transactions. You should
  be
  able to observe the request to create_clone, and see the reply from
  the server. The reply should be the new ID of your clone. If it
  isn't,
  then you have more debugging to do.

  Things to check here:

  * Have you included/required the library (MyActiveRecord) in this
  script, and have you defined the constants it needs (MySQL address
  and
  credentials, also known as a DSN).
  * Have you got a MySQL table called clones?
  * Have you enabled error reporting on your server for your test
  pages,
  so you can see the PHP errors as they whiz by?
  * Have you ordered that fat book I recommended?

  Debugging PHP is like playing Whack-a-Mole. You fix one thing, and
  another pops up. You iterate, in other, more dainty words.

  Walter

  On Jun 28, 2009, at 12:04 PM, WLQ wrote:

  Also I've used that clone.php you gave, the only thing it  
  doesn't do
  is change the MySQL table itself.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-07-01 Thread WLQ

I understand I should put this:
if(is_array($data)) {
array_shift($data);
}

Instead of:
array_shift($data);

 Or just do 

 if(is_array($data)) {
     array_shift($data);

 }

 HTH Alex

 - Original Message -
 From: Walter Lee Davis wa...@wdstudio.com
 To: prototype-scriptaculous@googlegroups.com
 Sent: Wednesday, July 01, 2009 5:56 PM
 Subject: [Proto-Scripty] Re: MySQL - order ID

  Which means it's not getting an array. So look and see what it IS
  getting. What is the value of $data at that point? (Use echo(),
  print_r(), something like that to output the value.)

  I can see the error right away, looking back over the code. It's a
  fairly stupid error on my part introduced while refactoring the
  working code into an example you could pick apart and learn from.

  I want you to find it, because otherwise you will never stand on your
  own here.

  Walter

  On Jul 1, 2009, at 10:31 AM, WLQ wrote:

  But here's what I get in error:
  array_shift() [function.array-shift]: The argument should be an array

  On this line:
  array_shift($data);

  Yes. Like any example that you will ever find on the Web, this one
  needs to be adjusted to match your environment. Some basic fluency in
  PHP is a requirement to use the MAR system, it can't divine
  everything
  for you.

  Walter

  On Jul 1, 2009, at 5:57 AM, WLQ wrote:

  Right, shouldn't then that be 'widgets'? Because the table of our
  original sortable list were controlled by the widgets table. So
  like:
  if($master = MyActiveRecord::FindById('widgets',$original)){

  Originals is a table in the database, it contains one of each
  type of
  thing you wish to be able to clone into the clones table.
  MyActiveRecord creates a PHP class for each table you wrap it
  around, and each row of the table becomes an object of that class
  when
  you request it through MAR.

  In short, this line:

  if($master = MyActiveRecord::FindById('originals',$original)){

  ...if it finds a table called 'originals' in your database, will
  return the row with the ID matching $original (or false).

  Walter

  On Jun 29, 2009, at 12:25 PM, WLQ wrote:

  It says - Class originals does not exist
  Where does the originals class comes from? What is the originals
  from
  the code above?

  If this is the code you are using (and I've added the missing
  close
  parenthesis), then the fact that you are getting a 200 back
  (and a
  new
  ID) means that you have successfully created a new clone.
  Otherwise,
  you should be getting a 500 or 404 back.

  //create_clone.php
  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('originals',$original)){
          $data = get_object_vars($original);
          array_shift($data); //get rid of the ID
          $new = MyActiveRecord::Create('clones',$data);
          $new-save();
          if(false === $new-get_errors()){
                  header('Content-type: text/html; charset=utf-8');
                  //this is the part you need:
                  print 'item_' .  $new-id;
          }else{
                  header('HTTP/1.0 500 Server Error',true,500);
                  exit;
          }}else{

          header('HTTP/1.0 404 Missing',true,404);

  }

  Visit your test page with Firefox and with the Console tab of
  Firebug
  open. Make sure Firebug is set to show XHR transactions. You
  should
  be
  able to observe the request to create_clone, and see the reply
  from
  the server. The reply should be the new ID of your clone. If it
  isn't,
  then you have more debugging to do.

  Things to check here:

  * Have you included/required the library (MyActiveRecord) in this
  script, and have you defined the constants it needs (MySQL
  address
  and
  credentials, also known as a DSN).
  * Have you got a MySQL table called clones?
  * Have you enabled error reporting on your server for your test
  pages,
  so you can see the PHP errors as they whiz by?
  * Have you ordered that fat book I recommended?

  Debugging PHP is like playing Whack-a-Mole. You fix one thing,
  and
  another pops up. You iterate, in other, more dainty words.

  Walter

  On Jun 28, 2009, at 12:04 PM, WLQ wrote:

  Also I've used that clone.php you gave, the only thing it
  doesn't do
  is change the MySQL table itself.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-06-29 Thread WLQ

It says - Class originals does not exist
Where does the originals class comes from? What is the originals from
the code above?


 If this is the code you are using (and I've added the missing close  
 parenthesis), then the fact that you are getting a 200 back (and a new  
 ID) means that you have successfully created a new clone. Otherwise,  
 you should be getting a 500 or 404 back.

 //create_clone.php
 $original = $_POST['original'];
 if($master = MyActiveRecord::FindById('originals',$original)){
         $data = get_object_vars($original);
         array_shift($data); //get rid of the ID
         $new = MyActiveRecord::Create('clones',$data);
         $new-save();
         if(false === $new-get_errors()){
                 header('Content-type: text/html; charset=utf-8');
                 //this is the part you need:
                 print 'item_' .  $new-id;
         }else{
                 header('HTTP/1.0 500 Server Error',true,500);
                 exit;
         }}else{

         header('HTTP/1.0 404 Missing',true,404);

 }

 Visit your test page with Firefox and with the Console tab of Firebug  
 open. Make sure Firebug is set to show XHR transactions. You should be  
 able to observe the request to create_clone, and see the reply from  
 the server. The reply should be the new ID of your clone. If it isn't,  
 then you have more debugging to do.

 Things to check here:

 * Have you included/required the library (MyActiveRecord) in this  
 script, and have you defined the constants it needs (MySQL address and  
 credentials, also known as a DSN).
 * Have you got a MySQL table called clones?
 * Have you enabled error reporting on your server for your test pages,  
 so you can see the PHP errors as they whiz by?
 * Have you ordered that fat book I recommended?

 Debugging PHP is like playing Whack-a-Mole. You fix one thing, and  
 another pops up. You iterate, in other, more dainty words.

 Walter

 On Jun 28, 2009, at 12:04 PM, WLQ wrote:

  Also I've used that clone.php you gave, the only thing it doesn't do
  is change the MySQL table itself.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-06-28 Thread WLQ

Parse error between:

$original = $_POST['original'];
if($master = MyActiveRecord::FindById('originals',$original){


 We're not getting this done by pasting little bits of code back and  
 forth. You're missing something  in here, the server process that does  
 the clone in the database has to return the new ID -- that's the only  
 place it can come from. If you go back to my example, I had the last  
 line of the onSuccess method update the clone's ID with the  
 responseText from the server. So in your PHP clone code, make sure  
 that the last thing it does is print 'item_someNumber' (where  
 someNumber is in fact the most recently added element ID. In MAR, this  
 would look like this:

 //create_clone.php
 $original = $_POST['original'];
 if($master = MyActiveRecord::FindById('originals',$original){
         $data = get_object_vars($original);
         array_shift($data); //get rid of the ID
         $new = MyActiveRecord::Create('clones',$data);
         $new-save();
         if(false === $new-get_errors()){
                 header('Content-type: text/html; charset=utf-8');
                 //this is the part you need:
                 print 'item_' .  $new-id;
         }else{
                 header('HTTP/1.0 500 Server Error',true,500);
                 exit;
         }}else{

         header('HTTP/1.0 404 Missing',true,404);

 }

 Walter

 On Jun 17, 2009, at 12:57 PM, WLQ wrote:



  I'm quite positive that it's something wrong with your script, because
  on drop (clone) this gets inserted in html:
  li class=clone id=span class=remove(x)/spanDescription/
  li

  Instead of being:
  li class=clone id=Item_someNumberDescriptionspan  
  class=remove
  (x)/span/li

  For some reason it creates 2 instances instead of one (both of the
  above). If you drag out items in ascending order by the id (1,2,3).

  Right! There wasn't any _ just the id, now everything is fine.

  The problem I'm seeing now is that when I clone an item, it's  
  becoming
  undraggable until you drop on more item.
  Basically last dropped item won't move, previous items will start
  moving. It will also create a space [0] = 

  You'll understand what I'm talking about when you'll look at the
  examplehttp://scriptaculous.host22.com/

  What does your HTML look like? Are your list element IDs in the form
  that Sortable requires?

  ul id=my_sortable_list
  li id=someString_1The visible draggable part/li
  li id=someString_3The visible draggable part/li
  li id=someString_4The visible draggable part/li
  /ul

  Unless your LIs have an ID and that IDegigins with one or more
  letters

  a-z, has exactly one underscore in it followed by a unique number
  (which should be the ID column value from your database, just to  
  tie a
  bow on things here) then you won't get anything out of
  Sortable.serialize() -- not even an error.

  Walter

  On Jun 13, 2009, at 12:29 PM, WLQ wrote:

  As you've noted the post should give you some feedback like this:

  whatever_your_list_ID_is = Array(
         0 = 12,
         1 = 13,
         2 = 24,
         3 = 2,
         4 = 42
  )

  But it does not return any number on the other side:

  Array
  (
     [whatever_your_list_ID_is] = Array
         (
             [0] =
             [1] =
             [2] =
             [3] =
         )

  )

  Yes, mysql_query doesn't return a list, it returns a resource
  iedenttifier. You have to create the list yourself using a loop nd
  my
  y
  sql_fetch_object or mysql_fetch_array or one of theotther
  fetchers.

   efoefefore we go much furthe I need t to remind you that this is not
  a  P

  PHP
  he
  uag
  uages on earth.

  The example I posted was working code ripped out obusy usy site.
  However it relies on the MyActiveRecord ORM to do anything.

  define('MYACTIVERECORD_CONCTN_STR''mysyql://use/user::pa  
  'm'mysysql://
  databasename')R', 'm'mysysql
  re_once('MyActiveRecord.0.5.php');
  claswiets eendnd MyActyActivvetendns Mds My

  $lisecord{}
  iveRecordextetendnds getulu,'osipn nSCC),nul,,,po
  ion nSC');

  ;

  s'  ts',',
  poon nts',nulu,

  ulu,

  nSC'n 'n

  w
  w
     w       h//prin-w  / /tioc ctiti

  ipn
  tn
  tionitt
  itt th
  Th alis all there is to that. Anything else, I really rethihthis
  is
  that bn:0-312-3178617-31S -3 n-ISn6IS -32-d17't17't knoway be -he  
  curr784-2 (
  is). PHP s). and Mnd s). pm. pmens).ntmeny  by Luke Welling and
  Laura
  homson Thomso
  )
  )

  Waltealter

  AMS)
  *Where  I best  meanmean eanst.
  t.

  On Jun 13, 2009 9:04 :04 AM, WLQ wrote:

  I've followed your link and tried to buihe listlist as you  
  suggested
  there. But it gives me.

  ERRNO: 2 TEXT: Invalid argument supplied for foreach()
  LOCATION: ...,
  line 7
 http://jsbin.com/elocu/edit

  re' a list list ofs. (I ums. (I uatabasebaseoblems.ve the st of p
  sortable too).
  clones any item but not
  the
  first, it wil nde nd ertverted.vd. But you wout ont be able to
  move
  it (inside of cloned sortable), when you drag

[Proto-Scripty] Re: MySQL - order ID

2009-06-28 Thread WLQ

Right, now it works. Even though it copies and item and outputting it
in the sortable list. It's not reverting back (you can only make one
copy as the item you've dragged and dropped will be erased from the
original list).
Also I've used that clone.php you gave, the only thing it doesn't do
is change the MySQL table itself.

 You need a second parenthesis at the end of the second line. Do you  
 see it?

 Walter

 On Jun 28, 2009, at 7:19 AM, WLQ wrote:

  Parse error between:

  $original = $_POST['original'];
  if($master = MyActiveRecord::FindById('originals',$original){

  We're not getting this done by pasting little bits of code back and
  forth. You're missing something  in here, the server process that  
  does
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-06-17 Thread WLQ

I'm quite positive that it's something wrong with your script, because
on drop (clone) this gets inserted in html:
li class=clone id=span class=remove(x)/spanDescription/
li

Instead of being:
li class=clone id=Item_someNumberDescriptionspan class=remove
(x)/span/li

For some reason it creates 2 instances instead of one (both of the
above). If you drag out items in ascending order by the id (1,2,3).


 Right! There wasn't any _ just the id, now everything is fine.

 The problem I'm seeing now is that when I clone an item, it's becoming
 undraggable until you drop on more item.
 Basically last dropped item won't move, previous items will start
 moving. It will also create a space [0] = 

 You'll understand what I'm talking about when you'll look at the
 examplehttp://scriptaculous.host22.com/

  What does your HTML look like? Are your list element IDs in the form  
  that Sortable requires?

  ul id=my_sortable_list
  li id=someString_1The visible draggable part/li
  li id=someString_3The visible draggable part/li
  li id=someString_4The visible draggable part/li
  /ul



  Unless your LIs have an ID and that IDegigins with one or more
letters  

 a-z, has exactly one underscore in it followed by a unique number  
  (which should be the ID column value from your database, just to tie a  
  bow on things here) then you won't get anything out of  
  Sortable.serialize() -- not even an error.

  Walter

  On Jun 13, 2009, at 12:29 PM, WLQ wrote:

   As you've noted the post should give you some feedback like this:

   whatever_your_list_ID_is = Array(
          0 = 12,
          1 = 13,
          2 = 24,
          3 = 2,
          4 = 42
   )

   But it does not return any number on the other side:

   Array
   (
      [whatever_your_list_ID_is] = Array
          (
              [0] =
              [1] =
              [2] =
              [3] =
          )

   )

   Yes, mysql_query doesn't return a list, it returns a resource
  iedenttifier. You have to create the list yourself using a loop nd
   my
y
sql_fetch_object or mysql_fetch_array or one of theotther  
   fetchers.





  efoefefore we go much furthe I need t to remind you that this is not
a  P
  
 
   PHP
he
uag
uages on earth.

   The example I posted was working code ripped out obusy usy site.
   However it relies on the MyActiveRecord ORM to do anything.

 
  define('MYACTIVERECORD_CONCTN_STR''mysyql://use/user::pa 'm'mysysql://
   databasename')R', 'm'mysysql
re_once('MyActiveRecord.0.5.php');
   claswiets eendnd MyActyActivvetendns Mds My

 $lisecord{}
iveRecordextetendnds getulu,'osipn nSCC),nul,,,po
ion nSC');
 
;
  
  s'  ts',',
poon nts',nulu,

ulu,

nSC'n 'n
 
 



   
 w
w
   w       h//prin-w  / /tioc ctiti



ipn
tn
tionitt
itt th
  Th alis all there is to that. Anything else, I really rethihthis
is
that bn:0-312-3178617-31S -3 n-ISn6IS -32-d17't17't knoway be -he curr784-2 (
  is). PHP s). and Mnd s). pm. pmens).ntmeny  by Luke Welling and
Laura
homson Thomso
 )
 )

 Waltealter

AMS)
  *Where  I best  meanmean eanst.
t.

   On Jun 13, 2009 9:04 :04 AM, WLQ wrote:

   I've followed your link and tried to buihe listlist as you suggested
   there. But it gives me.

   ERRNO: 2 TEXT: Invalid argument supplied for foreach()  
   LOCATION: ...,
   line 7
  http://jsbin.com/elocu/edit

  re' a list list ofs. (I ums. (I uatabasebaseoblems.ve the st of p
   sortable too).
 clones any item but not
   the
   first, it wil nde nd ertverted.vd. But you wout ont be able to  
   move
   it (inside of cloned sortable), when you drag and drop one more  
   it 
 apparently
   receives the ability of being dragged. What is extremely weir.  
   Here's
   one more weirdness, if you drag items from originals in order they
   appear, then they will be cloned but won't be reverted. I've also
   added your print_r($_POST) to the update_order.php but it's giving
   some unfair results.
   I've uploaded the whole pack to a some website. 
   Checkoutttpthttp://scris.hculous.host22.com/

cul On Jun 8, 1:00 pm, Walter Lee Davis wam/
@wdstudio.com/scote:

   Gaa! I always get this backward. As Mr. Wonka w,  d say,  
   Strike
   that; reverse it!

 er_yoatv your_your_lv = Arrtv = Array(
  _ID_is 2   12 = 0  
 r_lv          13 =
        our_lis2,
      2  13 ,= = 0     42 =  
 = 0     42 =   = 0     42 = 4



   
 = 0     42

O   8, 2009, a,= 3,
ote:         42 wrote:

  wrote data generated by Sortablewrotialize looks like this after  
   PHP
   grabs it from the POST:

   whatever_your_list_ID_is = Array(
      0 = 1tev
      1 = 13,
      2 = 24,
      3 = 2,
      4 = 42
   )

   The keys of the array give the position, the values give the
   numerical
   part of the list item ID. So in this case, the list looked like
   this
   in the DOM when serialize() wrapped it up:
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post

[Proto-Scripty] Re: MySQL - order ID

2009-06-13 Thread WLQ

I've followed your link and tried to build the list as you suggested
there. But it gives me.

ERRNO: 2 TEXT: Invalid argument supplied for foreach() LOCATION: ...,
line 7
http://jsbin.com/elocu/edit


 Here's a list of problems. (I use database to drive the second
 sortable too).
 Now, if you drag an item from originals to clones any item but not the
 first, it will be cloned and reverted. But you wont be able to move
 it (inside of cloned sortable), when you drag and drop one more item,
 that item wont move ass well, but previous dropped item apparently
 receives the ability of being dragged. What is extremely weir. Here's
 one more weirdness, if you drag items from originals in order they
 appear, then they will be cloned but won't be reverted. I've also
 added your print_r($_POST) to the update_order.php but it's giving
 some unfair results.
 I've uploaded the whole pack to a some website. Check it 
 outhttp://scriptaculous.host22.com/

 On Jun 8, 1:00 pm, Walter Lee Davis wa...@wdstudio.com wrote:

  Gaa! I always get this backward. As Mr. Wonka would say, Strike  
  that; reverse it!

  whatever_your_list_ID_is = Array(
          12 = 0,
          13 = 1,
          24 = 2,
          2 = 3,
          42 = 4
  )

  Walter

  On Jun 8, 2009, at 6:56 AM, Walter Lee Davis wrote:

   The data generated by Sortable.serialize looks like this after PHP
   grabs it from the POST:

   whatever_your_list_ID_is = Array(
      0 = 12,
      1 = 13,
      2 = 24,
      3 = 2,
      4 = 42
   )

   The keys of the array give the position, the values give the numerical
   part of the list item ID. So in this case, the list looked like this
   in the DOM when serialize() wrapped it up:
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-06-13 Thread WLQ

Right! There wasn't any _ just the id, now everything is fine.

The problem I'm seeing now is that when I clone an item, it's becoming
undraggable until you drop on more item.
Basically last dropped item won't move, previous items will start
moving. It will also create a space [0] = 

You'll understand what I'm talking about when you'll look at the
example
http://scriptaculous.host22.com/

 What does your HTML look like? Are your list element IDs in the form  
 that Sortable requires?

 ul id=my_sortable_list
 li id=someString_1The visible draggable part/li
 li id=someString_3The visible draggable part/li
 li id=someString_4The visible draggable part/li
 /ul

 Unless your LIs have an ID and that ID begins with one or more letters  
 a-z, has exactly one underscore in it followed by a unique number  
 (which should be the ID column value from your database, just to tie a  
 bow on things here) then you won't get anything out of  
 Sortable.serialize() -- not even an error.

 Walter

 On Jun 13, 2009, at 12:29 PM, WLQ wrote:



  As you've noted the post should give you some feedback like this:

  whatever_your_list_ID_is = Array(
         0 = 12,
         1 = 13,
         2 = 24,
         3 = 2,
         4 = 42
  )

  But it does not return any number on the other side:

  Array
  (
     [whatever_your_list_ID_is] = Array
         (
             [0] =
             [1] =
             [2] =
             [3] =
         )

  )

  Yes, mysql_query doesn't return a list, it returns a resource
  identifier. You have to create the list yourself using a loop and
  mysql_fetch_object or mysql_fetch_array or one of the other  
  fetchers.

  Before we go much further, I need to remind you that this is not a  
  PHP
  list, and that those things do exist -- that's got to be one of the
  best* explained languages on earth.

  The example I posted was working code ripped out of a busy site.
  However it relies on the MyActiveRecord ORM to do anything.

  define('MYACTIVERECORD_CONNECTION_STR', 'mysql://user:p...@localhost/
  databasename');
  require_once('MyActiveRecord.0.5.php');
  class widgets extends MyActiveRecord{}
  $list = MyActiveRecord::FindAll('widgets',null,'position ASC');
  foreach($list as $item){
          //print_r($item);
          //do what you want with $item-name, $item-description...

  }

  That is all there is to that. Anything else, I really recommend this
  book: ISBN:0-672-31784-2 (may be -3 now, don't know what the current
  version is). PHP and MySQL Web Development, by Luke Welling and Laura
  Thomson. (SAMS)

  Walter

  *Where by best I simply mean most.

  On Jun 13, 2009, at 9:04 AM, WLQ wrote:

  I've followed your link and tried to build the list as you suggested
  there. But it gives me.

  ERRNO: 2 TEXT: Invalid argument supplied for foreach()  
  LOCATION: ...,
  line 7
 http://jsbin.com/elocu/edit

  Here's a list of problems. (I use database to drive the second
  sortable too).
  Now, if you drag an item from originals to clones any item but not
  the
  first, it will be cloned and reverted. But you wont be able to  
  move
  it (inside of cloned sortable), when you drag and drop one more  
  item,
  that item wont move ass well, but previous dropped item apparently
  receives the ability of being dragged. What is extremely weir.  
  Here's
  one more weirdness, if you drag items from originals in order they
  appear, then they will be cloned but won't be reverted. I've also
  added your print_r($_POST) to the update_order.php but it's giving
  some unfair results.
  I've uploaded the whole pack to a some website. Check it 
  outhttp://scriptaculous.host22.com/

  On Jun 8, 1:00 pm, Walter Lee Davis wa...@wdstudio.com wrote:

  Gaa! I always get this backward. As Mr. Wonka would say,  
  Strike
  that; reverse it!

  whatever_your_list_ID_is = Array(
          12 = 0,
          13 = 1,
          24 = 2,
          2 = 3,
          42 = 4
  )

  Walter

  On Jun 8, 2009, at 6:56 AM, Walter Lee Davis wrote:

  The data generated by Sortable.serialize looks like this after  
  PHP
  grabs it from the POST:

  whatever_your_list_ID_is = Array(
     0 = 12,
     1 = 13,
     2 = 24,
     3 = 2,
     4 = 42
  )

  The keys of the array give the position, the values give the
  numerical
  part of the list item ID. So in this case, the list looked like
  this
  in the DOM when serialize() wrapped it up:
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-06-08 Thread WLQ

It helped :)

Here I've created an update_order.php
Can you please troubleshoot it?
http://jsbin.com/apono

 Add a closing parenthesis and a semicolon after the closing brace at  
 the end of line 77 of the code on jsbin.

 Here it is in context:

                 //this replaces the call to Prototype's identify() function
                 clone.id = transport.responseText;
         }}); -- right here

 //re-build the list to include the new cloned element
 setupSortable.defer();

 Walter

 On Jun 6, 2009, at 2:55 PM, WLQ wrote:



  missing ) after argument list
  setupSortable.defer();\n

  That's by your
 http://jsbin.com/emuya/edit
  JS script.

  Please post a link and I'll take a look. What does Firebug say when
  you run it?

  Walter

  On Jun 6, 2009, at 6:48 AM, WLQ wrote:

  Walter, why ain't the script you've post working. I mean no drag and
  drop is working now. When I've connected it to my local server.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-06-08 Thread WLQ

Here's a list of problems. (I use database to drive the second
sortable too).
Now, if you drag an item from originals to clones any item but not the
first, it will be cloned and reverted. But you wont be able to move
it (inside of cloned sortable), when you drag and drop one more item,
that item wont move ass well, but previous dropped item apparently
receives the ability of being dragged. What is extremely weir. Here's
one more weirdness, if you drag items from originals in order they
appear, then they will be cloned but won't be reverted. I've also
added your print_r($_POST) to the update_order.php but it's giving
some unfair results.
I've uploaded the whole pack to a some website. Check it out
http://scriptaculous.host22.com/

On Jun 8, 1:00 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 Gaa! I always get this backward. As Mr. Wonka would say, Strike  
 that; reverse it!

 whatever_your_list_ID_is = Array(
         12 = 0,
         13 = 1,
         24 = 2,
         2 = 3,
         42 = 4
 )

 Walter

 On Jun 8, 2009, at 6:56 AM, Walter Lee Davis wrote:

  The data generated by Sortable.serialize looks like this after PHP
  grabs it from the POST:

  whatever_your_list_ID_is = Array(
     0 = 12,
     1 = 13,
     2 = 24,
     3 = 2,
     4 = 42
  )

  The keys of the array give the position, the values give the numerical
  part of the list item ID. So in this case, the list looked like this
  in the DOM when serialize() wrapped it up:
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-06-06 Thread WLQ

You're not right Jeff, I do try to find the answers on my own. But
when I can't figure it out myself, I ask a question about it. It's not
like a read an answer and then immediately post a new question, I
first take the response and try to manage it. Each time you have an
answer new questions pop up. This is just how it works. I know that
I've frastruated many people here. But this is what it's all about,
asking and answering. I'm VERY GRATFULL to all the people who help!

--

Walter, why ain't the script you've post working. I mean no drag and
drop is working now. When I've connected it to my local server.


 WLQ,

 You really have received **GREAT** advice along with ample code to get
 this working (with a bit of work on your end). It is not an overly
 complicated request where no mere mortal can figure out/implement.
 Especially with all the code that has already been shared. You may
 need to learn a bit more about each technology that you will need to
 use to put together all the pieces. And that will help you in the long
 run anyway. These great people won't be here to do your homework for
 you every time you need a completed new feature added. And it seems
 like since no one has given you a 100% complete, soup to nuts solution
 specific to your server/framework/flow, you just keep asking for more.
 These contributors are really awesome people, and want to help guide
 others to their own solution. They don't want to be your personal
 contractor. Especially if you are not willing to go out and learn
 things on your own.

 Sorry if I am sounding like an jerk here. This whole thread has
 frustrated me for some reason.

 And of course, thank you for all the good people that have already
 shared so much great information... here and all across the group.

 - Jeff

 On Fri, Jun 5, 2009 at 3:57 PM, WLQmaybe...@gmail.com wrote:

  What I've meant is what kind of code should be in those update,
  create, remove php.

  P.S The page is freezing.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-06-06 Thread WLQ

missing ) after argument list
setupSortable.defer();\n

That's by your
http://jsbin.com/emuya/edit
JS script.


 Please post a link and I'll take a look. What does Firebug say when  
 you run it?

 Walter

 On Jun 6, 2009, at 6:48 AM, WLQ wrote:

  Walter, why ain't the script you've post working. I mean no drag and
  drop is working now. When I've connected it to my local server.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-06-05 Thread WLQ

I have a hard time connecting your js with a database. Could you give
an example of what I should write there?

On May 31, 8:22 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 I took another run up this hill, and got quite a bit further than the  
 last time.

 http://jsbin.com/itanu

 This is quite a lot of extra code to overcome what Sortable believes  
 you mean by dragging from one list to another in the same containment  
 group. In order to make it possible to duplicate the same original  
 element into the cloned list over and over, I had to figure out a  
 way to put that dragged element back in the originals list so it could  
 be used again. Revert doesn't seem to work the way it does with  
 Draggables, and in order to show the place where the dragged  
 original would land in the cloned list, I had to turn ghosting off.

 I would welcome any pimping this code could get, and also would love  
 to know how to get rid of the global variables I ended up using to  
 pass a message from onChange to onUpdate within one Sortable. You  
 would think that you could add an internal variable to the object, but  
 I couldn't figure out how to do that.

 Walter

 On May 28, 2009, at 12:58 PM, Walter Lee Davis wrote:

  n my work, I found that while you could drop a draggable onto a
  sortable, you couldn't get the dropped element to join the sortable
  explicitly. I took a run up this mountain a couple of months ago, and
  the best I was able to do was to make a set of draggables, wrap the
  sortable in a parent which I made droppable, and set revert to true on
  those draggables. On a successful drop, I would generate a new
  element, insert it into the sortable, re-initialize the sortable, and
  then the user would need to drag the new element into position within
  the list.

  What WLQ would like (what I would like, too) is something more direct.
  A set of draggable options that can be dragged into a sortable, revert
  back to their parent, and leave a clone behind in the position within
  the list where they were dropped. This is not possible as far as I've
  been able to do it.

  Getting the unique ID either from Prototype or MySQL is trivial, and
  not really the actual problem here.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-06-05 Thread WLQ

What I've meant is what kind of code should be in those update,
create, remove php.

P.S The page is freezing.

On Jun 5, 3:46 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 Naturally this won't run in jsbin, because it's trying to connect to a  
 non-existent server. Each of these Ajax calls will send a POST request  
 to your server. Have a search of this list, I've posted a simple  
 script to handle the update of sortable order in PHP before.

 http://jsbin.com/emuya/edit

 The above link should show you the JS code directly, and while it's  
 written off the top of my head (untested), it is a complete example of  
 how you would insert the database calls into the basic event framework  
 imposed by Sortable and its callbacks.

 Walter

 On Jun 5, 2009, at 8:50 AM, WLQ wrote:

  I have a hard time connecting your js with a database. Could you give
  an example of what I should write there?

  On May 31, 8:22 pm, Walter Lee Davis wa...@wdstudio.com wrote:
  I took another run up this hill, and got quite a bit further than the
  last time.

 http://jsbin.com/itanu

  This is quite a lot of extra code to overcome what Sortable believes
  you mean by dragging from one list to another in the same containment
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-29 Thread WLQ

What I can't understand Walter is why have we written 27 messages
about anything which is not related to the question. And have spend on
that nearly a month not getting even closer to the answer. See
misunderstanding lead us to write answers that we don't need.

But what I think now is: if we can't do that in scriptaculous or
prototype alone, maybe we can try to find some workaround. Like for
example some kind of javascript grid, or point tracker. I don't know,
just so we can say that if you drop an item on line 2, then ID must be
that, on line 4 then ID must be that. That's the only workaround I
think can be found. So maybe we should focus to find something like
that, instead of looking inside of scriptaculous, that does not do
such a thing?

On May 28, 7:25 pm, WLQ maybe...@gmail.com wrote:
 Seems like it's too complicated to be done. lol

 On May 28, 6:58 pm, Walter Lee Davis wa...@wdstudio.com wrote:

  A Sortable is a special case combination of a Draggable and a  
  Droppable. A Sortable may be dragged into another Sortable as long as  
  both lists include the other in their containment property. But  
  there is no equivalent to Draggable's revert in a Sortable.

  In my work, I found that while you could drop a draggable onto a  
  sortable, you couldn't get the dropped element to join the sortable  
  explicitly. I took a run up this mountain a couple of months ago, and  
  the best I was able to do was to make a set of draggables, wrap the  
  sortable in a parent which I made droppable, and set revert to true on  
  those draggables. On a successful drop, I would generate a new  
  element, insert it into the sortable, re-initialize the sortable, and  
  then the user would need to drag the new element into position within  
  the list.

  What WLQ would like (what I would like, too) is something more direct.  
  A set of draggable options that can be dragged into a sortable, revert  
  back to their parent, and leave a clone behind in the position within  
  the list where they were dropped. This is not possible as far as I've  
  been able to do it.

  Getting the unique ID either from Prototype or MySQL is trivial, and  
  not really the actual problem here.

  Walter

  On May 28, 2009, at 12:11 PM, Alex McAuley wrote:

   Also .. isnt there ghosting or revert on droppables to make the  
   elements
   go back into the container of which they were dragged from  If  
   so - this
   removes half of the problem .. the only problem left is ordering the  
   second
   list which is done on dropend or whatever the syntax is ...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-29 Thread WLQ

Yes, but also both of the sortables lists are driven by MySQL
database, by different tables. Basically the question is how can it
know between which items the item is dropped. And when it's done that
it must copy an item (MySQL row) from one MySQL table to another, and
also change it's ID's to the necessary ones.


 To be honest i dont understand what Walter is trying to say...

 for example drag an unlimited number of
 copies from the first list into the second list, and have the
 dropped
 elements keep their place in the second list while the first list
 remains exactly the same... means the same to me

 Let me see if i can break it down and you tell me if i am right.. then we
 can get moving..

 You have 2 or more lists lets call them containers with
 draggable,sortable,droppable items from 1 to another 
 !-- DRAG FROM HERE --
 div id=template
     liItem/li
     liItem/li
 /div
 !--DROP IN HERE --
 div id=template-dropzone
     liItem/li
     liItem/li
 /div

 When an item is dragged from $('template') and dropped into
 $('template-dropzone') .. you want it to revert back to $('template') (i.e
 just a copy of it to land in the dropzone) and for that new item in the
 dropzone to have a new ID based on its order  for example if you had 2
 items in drop zone (id's 12) and you dropped an item in between then then
 the new item would be ID#2 and the other 2 would be ID#1  ID#3
 respectivley... or if you dropped on the end of the list the new item would
 become ID#3  and so on. am i on the ball so far ?

 If i am then i maintain that its not as hard as you think it is

 If not please point out where i am missing

 Thanks
 Alex

 - Original Message -
 From: WLQ maybe...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Friday, May 29, 2009 1:25 PM
 Subject: [Proto-Scripty] Re: MySQL - order ID

 I think Walter has given a very nice explanation on what I want.

 What WLQ is trying to do is
 have two lists of things, be able to drag an unlimited number of
 copies from the first list into the second list, and have the
 dropped
 elements keep their place in the second list while the first list
 remains exactly the same. 

 What WLQ would like (what I would like, too) is something more
 direct.
 A set of draggable options that can be dragged into a sortable,
 revert
 back to their parent, and leave a clone behind in the position
 within
 the list where they were dropped.

 do you get it Alex?
 If so try to give some more explanation on how it can be done.

 On May 29, 2:15 pm, Alex McAuley webmas...@thecarmarketplace.com
 wrote:
  you dont need a grid... you can the id is that of the ones above plus 1
  ...

  This will not work properly due to ID's conflicting 

  Each time an element is dropped you will need to re-assign id's to each
  element.. something like this ...

  div id=container-1 !-- Droppable --
  liItem/li
  liItem/li
  liItem/li
  liItem/li
  liItem/li
  liItem/li
  /div

  onDrop: { // not sure of the syntax as its been a while!!
  var i=1;
  $$('.someclass').each(function(e) {
  var parent_id=$(e).up(1); // get the parent container
  $(e).id=parent_id+'_'+i; // gives the new id with using above example
  the id's of the Items would be container-1_1, container-1_2 and so
  on...
  then on the php end you can easily parse the id's with explode()/split()
  and
  force mysql t use those id's should you need to
  i++;

  });
  }

  If this is still not what you are looking for .. then please explain
  exactly
  what it is you are trying to do as the original question seems to be
  missing
  from this thread

  Alex

  - Original Message -
  From: WLQ maybe...@gmail.com
  To: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Friday, May 29, 2009 12:32 PM
  Subject: [Proto-Scripty] Re: MySQL - order ID

  What I can't understand Walter is why have we written 27 messages
  about anything which is not related to the question. And have spend on
  that nearly a month not getting even closer to the answer. See
  misunderstanding lead us to write answers that we don't need.

  But what I think now is: if we can't do that in scriptaculous or
  prototype alone, maybe we can try to find some workaround. Like for
  example some kind of javascript grid, or point tracker. I don't know,
  just so we can say that if you drop an item on line 2, then ID must be
  that, on line 4 then ID must be that. That's the only workaround I
  think can be found. So maybe we should focus to find something like
  that, instead of looking inside of scriptaculous, that does not do
  such a thing?

  On May 28, 7:25 pm, WLQ maybe...@gmail.com wrote:
   Seems like it's too complicated to be done. lol

   On May 28, 6:58 pm, Walter Lee Davis wa...@wdstudio.com wrote:

A Sortable is a special case combination of a Draggable and a
Droppable. A Sortable may be dragged into another Sortable as long as
both

[Proto-Scripty] Re: MySQL - order ID

2009-05-29 Thread WLQ

Of course then it must update and rebuild the list using the order
defined by the item ID.

 Yes, but also both of the sortables lists are driven by MySQL
 database, by different tables. Basically the question is how can it
 know between which items the item is dropped. And when it's done that
 it must copy an item (MySQL row) from one MySQL table to another, and
 also change it's ID's to the necessary ones.

  To be honest i dont understand what Walter is trying to say...

  for example drag an unlimited number of
  copies from the first list into the second list, and have the
  dropped
  elements keep their place in the second list while the first list
  remains exactly the same... means the same to me

  Let me see if i can break it down and you tell me if i am right.. then we
  can get moving..

  You have 2 or more lists lets call them containers with
  draggable,sortable,droppable items from 1 to another 
  !-- DRAG FROM HERE --
  div id=template
      liItem/li
      liItem/li
  /div
  !--DROP IN HERE --
  div id=template-dropzone
      liItem/li
      liItem/li
  /div

  When an item is dragged from $('template') and dropped into
  $('template-dropzone') .. you want it to revert back to $('template') (i.e
  just a copy of it to land in the dropzone) and for that new item in the
  dropzone to have a new ID based on its order  for example if you had 2
  items in drop zone (id's 12) and you dropped an item in between then then
  the new item would be ID#2 and the other 2 would be ID#1  ID#3
  respectivley... or if you dropped on the end of the list the new item would
  become ID#3  and so on. am i on the ball so far ?

  If i am then i maintain that its not as hard as you think it is

  If not please point out where i am missing

  Thanks
  Alex

  - Original Message -
  From: WLQ maybe...@gmail.com
  To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
  Sent: Friday, May 29, 2009 1:25 PM
  Subject: [Proto-Scripty] Re: MySQL - order ID

  I think Walter has given a very nice explanation on what I want.

  What WLQ is trying to do is
  have two lists of things, be able to drag an unlimited number of
  copies from the first list into the second list, and have the
  dropped
  elements keep their place in the second list while the first list
  remains exactly the same. 

  What WLQ would like (what I would like, too) is something more
  direct.
  A set of draggable options that can be dragged into a sortable,
  revert
  back to their parent, and leave a clone behind in the position
  within
  the list where they were dropped.

  do you get it Alex?
  If so try to give some more explanation on how it can be done.

  On May 29, 2:15 pm, Alex McAuley webmas...@thecarmarketplace.com
  wrote:
   you dont need a grid... you can the id is that of the ones above plus 1
   ...

   This will not work properly due to ID's conflicting 

   Each time an element is dropped you will need to re-assign id's to each
   element.. something like this ...

   div id=container-1 !-- Droppable --
   liItem/li
   liItem/li
   liItem/li
   liItem/li
   liItem/li
   liItem/li
   /div

   onDrop: { // not sure of the syntax as its been a while!!
   var i=1;
   $$('.someclass').each(function(e) {
   var parent_id=$(e).up(1); // get the parent container
   $(e).id=parent_id+'_'+i; // gives the new id with using above example
   the id's of the Items would be container-1_1, container-1_2 and so
   on...
   then on the php end you can easily parse the id's with explode()/split()
   and
   force mysql t use those id's should you need to
   i++;

   });
   }

   If this is still not what you are looking for .. then please explain
   exactly
   what it is you are trying to do as the original question seems to be
   missing
   from this thread

   Alex

   - Original Message -
   From: WLQ maybe...@gmail.com
   To: Prototype  script.aculo.us
   prototype-scriptaculous@googlegroups.com
   Sent: Friday, May 29, 2009 12:32 PM
   Subject: [Proto-Scripty] Re: MySQL - order ID

   What I can't understand Walter is why have we written 27 messages
   about anything which is not related to the question. And have spend on
   that nearly a month not getting even closer to the answer. See
   misunderstanding lead us to write answers that we don't need.

   But what I think now is: if we can't do that in scriptaculous or
   prototype alone, maybe we can try to find some workaround. Like for
   example some kind of javascript grid, or point tracker. I don't know,
   just so we can say that if you drop an item on line 2, then ID must be
   that, on line 4 then ID must be that. That's the only workaround I
   think can be found. So maybe we should focus to find something like
   that, instead of looking inside of scriptaculous, that does not do
   such a thing?

   On May 28, 7:25 pm, WLQ maybe...@gmail.com wrote:
Seems like it's too complicated to be done. lol

On May 28, 6

[Proto-Scripty] Re: MySQL - order ID

2009-05-29 Thread WLQ

It would be very best of you if you just maid an example. 'Couse it's
kind of confusing ))

Thanks, Yan

 Well thats the easy part believe it or not

 the container should have the table name in the id or classname somewhere
 then that can be pushed to the request.. (problem one taken care
 of)!!

 Problem 2 - copying rows 

 I would arrange my database something like this.

 id | parent_id | order | content

 then the rows perhaps look like this .

 id = '1' , parent_id='abcdefg', order=1, content='The item text / content'
 id = '2' , parent_id='abcdefg', order=2, content='The item text / content'
 id = '3' , parent_id='abcdefg', order=3, content='The item text / content'
 id = '4' , parent_id='abcdefg', order=4, content='The item text / content'
 id = '5' , parent_id='abcdefg', order=5, content='The item text / content'

 this is 5 items in the dropzone.

 So you dont need to worry about unique ID as parent ID is unique and takes
 care of it (they sit in the database as unique rows anyway due to the
 content placement order)...

 On the php backend  you should recieve from the Ajax Request

 parent_id, element_id- (json array), content...

 parent_id gives u the table name and the parent_id ... example
 parent_id=table_name-abcdefg... exploded on - .. tablename is [0],
 parents_id=[1]...

 then MYSQL - DELETE FROM $tablename WHERE parent_id=$parents_id 
 (removes all of the elements)

 then 

 Loop the Json array to get the order and the content and

 MYSQL - INSERT INTO $tablename (`parent_id`,`order`,`content`) VALUES
 ('$parents_id','$the_ID_part_of_the_json_array','$the_CONTENT_part_of_the_json_array');

 Now your thinking of how to send the Json Array to the php with all of the
 info needed to insert !!!...

 Well thats just done in a loop on classnames of the items in the list as
 explained in a previous post

 onDrop: { // not sure of the syntax as its been a while!!
 var i=1;
 var data={};
 $$('.someclass').each(function(e) {
  var parent_id=$(e).up(1); // get the parent container
  $(e).id=parent_id+'-'+i; //
 data[i]=parent_id+'-'+i+$(e).innerHTML // can be changed

 var jsonarray=Object.toJSON(data);
 // do the ajax request and send jsonarray to php to decode as normal ... on
 the php end you will have parent_id-element_id-element_contents
 ([0],[1],[2]).. after exploding on - .. so you foreach the json array on
 the php end and explode each itteration

 // now everything is stored in a json array parsable on the php end.
 // as the ID is set add things to array
 i++;

 });
 }

 If this makes no sense i will write it for you if you give me the table
 names and the schema .. or i can write an example for you 2morrow and give
 you the sourcecode

 HTH

 ALex

 - Original Message -
 From: WLQ maybe...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Friday, May 29, 2009 1:48 PM
 Subject: [Proto-Scripty] Re: MySQL - order ID

 Yes, but also both of the sortables lists are driven by MySQL
 database, by different tables. Basically the question is how can it
 know between which items the item is dropped. And when it's done that
 it must copy an item (MySQL row) from one MySQL table to another, and
 also change it's ID's to the necessary ones.

  To be honest i dont understand what Walter is trying to say...

  for example drag an unlimited number of
  copies from the first list into the second list, and have the
  dropped
  elements keep their place in the second list while the first list
  remains exactly the same... means the same to me

  Let me see if i can break it down and you tell me if i am right.. then we
  can get moving..

  You have 2 or more lists lets call them containers with
  draggable,sortable,droppable items from 1 to another 
  !-- DRAG FROM HERE --
  div id=template
  liItem/li
  liItem/li
  /div
  !--DROP IN HERE --
  div id=template-dropzone
  liItem/li
  liItem/li
  /div

  When an item is dragged from $('template') and dropped into
  $('template-dropzone') .. you want it to revert back to $('template') (i.e
  just a copy of it to land in the dropzone) and for that new item in the
  dropzone to have a new ID based on its order  for example if you had 2
  items in drop zone (id's 12) and you dropped an item in between then then
  the new item would be ID#2 and the other 2 would be ID#1  ID#3
  respectivley... or if you dropped on the end of the list the new item
  would
  become ID#3  and so on. am i on the ball so far ?

  If i am then i maintain that its not as hard as you think it is

  If not please point out where i am missing

  Thanks
  Alex

  - Original Message -
  From: WLQ maybe...@gmail.com
  To: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Friday, May 29, 2009 1:25 PM
  Subject: [Proto-Scripty] Re: MySQL - order ID

  I think Walter has given a very nice explanation on what I want

[Proto-Scripty] Re: MySQL - order ID

2009-05-28 Thread WLQ

Because I spend a lot of time trying to figure out your code, maybe I
just give you mine, you will faster understand how to do what I want.
Two sortable lists (#1 and #2). Both of them are driven by MySQL
database, but each are driven by different MySQL tables. The
sortable #1 is where I want that Auto-ID (as I call it) function to
work. Right now here is my onDrop function (everything is stored in a
different .js file):

Droppables.add(#1,
  {
onDrop: function(element)
{
process(element.id, addItem);
}
  });

The self function of addItem is (in a different .class file):

case 'addItem':
$content = trim($this-mMysqli-real_escape_string($content));
$result = $this-mMysqli-query('INSERT INTO tasks SELECT *
FROM channels WHERE id=' .
$content . '');
$updatedList = $this-BuildPlaylist();
return $updatedList;

After it clones a row from one table to another, the list updates. But
I want not only to clone an item, but also give it a corret Id, so
it's not somewhere inside of a sortable but exactly where you've
dropped it.


On May 25, 8:37 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 The script contacts the database through the Ajax.Request system in  
 Prototype. I can't find the code I posted to you, but all that part  
 was in there, I think. It sends a POST to the server with the type of  
 item that was dropped, and the server replies by first making a new  
 item of that type and then returning the database ID generated in the  
 process.

 What I'd like you to do is post what you have tried on Pastie or jsbin  
 (if the latter, you can mock up the Ajax.Request part and see it  
 running, but changing the POST to GET and requesting another jsbin  
 page that just returns text).

 I need to see what you're trying before I can suggest another route  
 for you to take.

 Walter

 On May 25, 2009, at 12:04 PM, WLQ wrote:



  Yeah, but what I don't understand is how your script connects with a
  database, I mean what are the cart, timeline, cart-active... are? I've
  noticed we have some trouble understanding one another, can we talk
  somewhere like msn?- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-28 Thread WLQ

Ok this onDrop function does the following:

$result = $this-mMysqli-query('INSERT INTO #1sortable SELECT * FROM
#2sortable WHERE id=' .
   $content . '');
   $updatedList = $this-Build#1();
   return $updatedList;

onDrop it's cloning a row from one table to another. It's doing a
MySQl query:

INSERT INTO #1sortable (inserts a row of the dropped item (my sortable
is driven by MySLQ database, so each sortable item has it's own row
in the table) inside of a #1 sortable table).

SELECT * FROM #2sortable (it selects the row from #2 table (the #2
table is the second sortable list which is driven by MySQL
database)).

WHERE id=' . $content . (it's what it's copying).

$updatedList = $this-Build#1();
return $updatedList;  After cloning is done, the sortable list
updates (rebuilding the list).

On May 28, 3:40 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 I have not been able to get this to work the way you describe. What I  
 had to do was set up my factory elements as Draggable (with revert)  
 and then set a separate Droppable container around my sortable. When I  
 drop, the onDrop function fires, which does the Ajax call to create a  
 new element, then that element is appended to the end of the sortable  
 and the sortable is re-initialized so that it recognizes the new member.

 I understand what you want to do, but I wasn't able to make it work  
 precisely the way you describe it here.

 One thing for you to think over as you work on this is to do less. For  
 example:

         $result = $this-mMysqli-query('INSERT INTO tasks SELECT *
  FROM channels WHERE id=' .
                                         $content . '');
         $updatedList = $this-BuildPlaylist();
         return $updatedList;

 I can't see what's going on in here, but if you are returning (and re-
 populating) the entire list, maybe you can simply return the one new  
 list element (with its newly generated ID) and insert that into your  
 Sortable where you are dropping (which is the part I couldn't figure  
 out myself, hence my punt). You do know the new ID after your insert  
 -- just get the value from your $result:

 $row = mysql_fetch_object($result);
 $id = $row-id;

 Build up your element as HTML, and insert it into the outer list with  
 Element.insert('theElementYouDroppedAfter',{after:yourHTML});

 then just re-run Sortable.create with the same arguments as previous,  
 and it will tear down the old Sortable (in memory) and replace it with  
 a new one that knows what order these things are currently in.

 Walter

 On May 28, 2009, at 7:13 AM, WLQ wrote:

  After it clones a row from one table to another, the list updates. But
  I want not only to clone an item, but also give it a corret Id, so
  it's not somewhere inside of a sortable but exactly where you've
  dropped it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-28 Thread WLQ

An because it clones also the Id of a row it will be placed based on
the Id, but not where it was dropped. I can easily tell it to append
the biggest or the lowest id number, because I'm doing a MySQL query,
but I need to paste an item not in the beginning, neither at the end,
but there where it was dropped.

On May 28, 4:03 pm, WLQ maybe...@gmail.com wrote:
 Ok this onDrop function does the following:

 $result = $this-mMysqli-query('INSERT INTO #1sortable SELECT * FROM
 #2sortable WHERE id=' .
            $content . '');
    $updatedList = $this-Build#1();
    return $updatedList;

 onDrop it's cloning a row from one table to another. It's doing a
 MySQl query:

 INSERT INTO #1sortable (inserts a row of the dropped item (my sortable
 is driven by MySLQ database, so each sortable item has it's own row
 in the table) inside of a #1 sortable table).

 SELECT * FROM #2sortable (it selects the row from #2 table (the #2
 table is the second sortable list which is driven by MySQL
 database)).

 WHERE id=' . $content . (it's what it's copying).

 $updatedList = $this-Build#1();
 return $updatedList;      After cloning is done, the sortable list
 updates (rebuilding the list).

 On May 28, 3:40 pm, Walter Lee Davis wa...@wdstudio.com wrote:

  I have not been able to get this to work the way you describe. What I  
  had to do was set up my factory elements as Draggable (with revert)  
  and then set a separate Droppable container around my sortable. When I  
  drop, the onDrop function fires, which does the Ajax call to create a  
  new element, then that element is appended to the end of the sortable  
  and the sortable is re-initialized so that it recognizes the new member.

  I understand what you want to do, but I wasn't able to make it work  
  precisely the way you describe it here.

  One thing for you to think over as you work on this is to do less. For  
  example:

          $result = $this-mMysqli-query('INSERT INTO tasks SELECT *
   FROM channels WHERE id=' .
                                          $content . '');
          $updatedList = $this-BuildPlaylist();
          return $updatedList;

  I can't see what's going on in here, but if you are returning (and re-
  populating) the entire list, maybe you can simply return the one new  
  list element (with its newly generated ID) and insert that into your  
  Sortable where you are dropping (which is the part I couldn't figure  
  out myself, hence my punt). You do know the new ID after your insert  
  -- just get the value from your $result:

  $row = mysql_fetch_object($result);
  $id = $row-id;

  Build up your element as HTML, and insert it into the outer list with  
  Element.insert('theElementYouDroppedAfter',{after:yourHTML});

  then just re-run Sortable.create with the same arguments as previous,  
  and it will tear down the old Sortable (in memory) and replace it with  
  a new one that knows what order these things are currently in.

  Walter

  On May 28, 2009, at 7:13 AM, WLQ wrote:

   After it clones a row from one table to another, the list updates. But
   I want not only to clone an item, but also give it a corret Id, so
   it's not somewhere inside of a sortable but exactly where you've
   dropped it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-28 Thread WLQ

Dear Alex, can you give some more explanation on what you think is the
answer? An what kind of onDrop event should be?

On May 28, 6:07 pm, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 In the mysql table create a unique index and use INSERT IGNORE INTO .. the
 rest can be achieved with array_unqiue() on the php end

 Prototype can create a unique id on the page if i recall correctly so that
 can be used as a sub id for the elements with a parent id (the element
 container if you like) can make sure things end up in the right place on
 page load.
 I still believe this has been very over complicated but i missed half the
 threads so perhaps i am still missing somehting .. but from what you just
 replied it is not complicated to do.

 Alex

 - Original Message -
 From: Walter Lee Davis wa...@wdstudio.com
 To: prototype-scriptaculous@googlegroups.com
 Sent: Thursday, May 28, 2009 5:01 PM
 Subject: [Proto-Scripty] Re: MySQL - order ID

  Yes, that very limited case is simple. What WLQ is trying to do is
  have two lists of things, be able to drag an unlimited number of
  copies from the first list into the second list, and have the dropped
  elements keep their place in the second list while the first list
  remains exactly the same.

  Dragging an element out of the first list will not reduce the number
  of template elements in that list, each time you drag one out, it
  goes back for the next time. A copy (with a new unique ID) of that
  template will be inserted into the second list, where it will join the
  sortable, remember where it was dropped, and so forth.

  It's quite difficult to pull off when you cover all of those bases. I
  do know those three lines you refer to -- but they don't cover
  everything that the OP wants to do.

  Walter

  On May 28, 2009, at 11:24 AM, Alex McAuley wrote:

  If all you are trying to do is update a table on a droppable to
  remeber the
  order then its so simple you can do it in about 3 lines .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-28 Thread WLQ

Seems like it's too complicated to be done. lol

On May 28, 6:58 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 A Sortable is a special case combination of a Draggable and a  
 Droppable. A Sortable may be dragged into another Sortable as long as  
 both lists include the other in their containment property. But  
 there is no equivalent to Draggable's revert in a Sortable.

 In my work, I found that while you could drop a draggable onto a  
 sortable, you couldn't get the dropped element to join the sortable  
 explicitly. I took a run up this mountain a couple of months ago, and  
 the best I was able to do was to make a set of draggables, wrap the  
 sortable in a parent which I made droppable, and set revert to true on  
 those draggables. On a successful drop, I would generate a new  
 element, insert it into the sortable, re-initialize the sortable, and  
 then the user would need to drag the new element into position within  
 the list.

 What WLQ would like (what I would like, too) is something more direct.  
 A set of draggable options that can be dragged into a sortable, revert  
 back to their parent, and leave a clone behind in the position within  
 the list where they were dropped. This is not possible as far as I've  
 been able to do it.

 Getting the unique ID either from Prototype or MySQL is trivial, and  
 not really the actual problem here.

 Walter

 On May 28, 2009, at 12:11 PM, Alex McAuley wrote:



  Also .. isnt there ghosting or revert on droppables to make the  
  elements
  go back into the container of which they were dragged from  If  
  so - this
  removes half of the problem .. the only problem left is ordering the  
  second
  list which is done on dropend or whatever the syntax is ...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-25 Thread WLQ

Seems like I can't connect your script, I made to divs with cart and
timeline. But nothing happens, can you tell me what else to create
apart of javascript?

On 24 Maj, 18:45, Walter Lee Davis wa...@wdstudio.com wrote:
 Could you post an example of what you're trying to run on Pastie or  
 jsbin and indicate what errors you're seeing in Firebug? I extracted  
 the code I posted from a working page, but I may have messed some  
 things up in trying to simplify it as an example (removing locally  
 important things that would only be confusing for your use-case).

 Walter

 On May 24, 2009, at 11:56 AM, WLQ wrote:



  I can't get your script to work, don't know why...

  On 5 Maj, 20:21, Walter Lee Davis wa...@wdstudio.com wrote:
  You have to ask the database for the next ID by creating a new record
  and reading its response. That's what the Ajax Request bit was in my
  example. When you drop, it asks the database for a new widget, and
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-25 Thread WLQ

Seems like I can't connect your script, I made to divs with cart and
timeline. But nothing happens, can you tell me what else to create
apart of javascript?

On 24 Maj, 18:45, Walter Lee Davis wa...@wdstudio.com wrote:
 Could you post an example of what you're trying to run on Pastie or  
 jsbin and indicate what errors you're seeing in Firebug? I extracted  
 the code I posted from a working page, but I may have messed some  
 things up in trying to simplify it as an example (removing locally  
 important things that would only be confusing for your use-case).

 Walter

 On May 24, 2009, at 11:56 AM, WLQ wrote:



  I can't get your script to work, don't know why...

  On 5 Maj, 20:21, Walter Lee Davis wa...@wdstudio.com wrote:
  You have to ask the database for the next ID by creating a new record
  and reading its response. That's what the Ajax Request bit was in my
  example. When you drop, it asks the database for a new widget, and
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-25 Thread WLQ

Yeah, but what I don't understand is how your script connects with a
database, I mean what are the cart, timeline, cart-active... are? I've
noticed we have some trouble understanding one another, can we talk
somewhere like msn?

On 25 Maj, 16:05, Walter Lee Davis wa...@wdstudio.com wrote:
 You need to have an application set up on your server to receive a  
 request from the page, process it, and return a value. The example I  
 gave was extracted from a working application. There is a server side  
 component to my solution that would not make any sense to you because  
 it has nothing to do with your application. Your application surely  
 must have some local equivalent, otherwise how are you getting the  
 rest of the list of elements to show on the page in the first place?

 In pseudocode, here's what my server-side application does:

 On page load:

 Query the database, get a list of the elements in the table foo, in  
 the order of their position column. Turn that into HTML, and inject  
 into the page template.

 On receipt of a POST from the page asking for a new ID:

 Insert into the database, creating a new row in the table foo, get the  
 auto-number ID column value, and return that as ResponseText to the  
 requesting browser.

 On receipt of a POST from the page containing a new sort order:

 Iterate over the POST['sort_order'] in order, updating the foo table  
 with the new order by setting the position column to match the key of  
 that array.

 All three of these things are done by one script in my application,  
 your mileage will necessarily vary.

 Walter

 On May 25, 2009, at 7:23 AM, WLQ wrote:



  Seems like I can't connect your script, I made to divs with cart and
  timeline. But nothing happens, can you tell me what else to create
  apart of javascript?

  On 24 Maj, 18:45, Walter Lee Davis wa...@wdstudio.com wrote:
  Could you post an example of what you're trying to run on Pastie or
  jsbin and indicate what errors you're seeing in Firebug? I extracted
  the code I posted from a working page, but I may have messed some
  things up in trying to simplify it as an example (removing locally
  important things that would only be confusing for your use-case).

  Walter

  On May 24, 2009, at 11:56 AM, WLQ wrote:

  I can't get your script to work, don't know why...

  On 5 Maj, 20:21, Walter Lee Davis wa...@wdstudio.com wrote:
  You have to ask the database for the next ID by creating a new  
  record
  and reading its response. That's what the Ajax Request bit was in  
  my
  example. When you drop, it asks the database for a new widget, and
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-24 Thread WLQ

I can't get your script to work, don't know why...

On 5 Maj, 20:21, Walter Lee Davis wa...@wdstudio.com wrote:
 You have to ask the database for the next ID by creating a new record  
 and reading its response. That's what the Ajax Request bit was in my  
 example. When you drop, it asks the database for a new widget, and  
 returns the numerical ID of that new widget, then creates a cloned  
 object in the Sortable with that ID and returns the original to its  
 place (revert: true).

 Walter

 On May 5, 2009, at 2:11 PM, WLQ wrote:

  But how
  can it know on drop, what id to give.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-05 Thread WLQ

Does it have anything to do with auto Idi-ing? I mean if you have
sortable and you change the order of items, that will auto change the
Id's to the necessary ones. And so if you drag and item and on the
drop (without ghosting=true) drop between item 2 and 3, that will
change the droppable items id to 3, and all others after original 2
plus 1.

On May 5, 7:10 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 On May 5, 2009, at 12:54 PM, WLQ wrote:

  Well that's what I've done already, but how to clone an item, and at
  the same time change it ID to the necessary one. That's what's the
  question.

  On May 4, 4:27 pm, Walter Lee Davis wa...@wdstudio.com wrote:
  What I would do is get the new ID from the database on drop. So you
  would create your list of prototype widgets that you drag from,  
  then
  make a Sortable list to drag into. Set the first list to be Draggable
  with revert: true and ghosting:true, then add an onDrop method to the
  Sortable list.

 Here's a snip of what I'm doing here:

 // #cart is a div wrapped around #timeline,
 // it snags the drop event and then we add a clone of
 // the dragged element into #timeline and re-initialize #timeline
 // to resuscitate the Sortable.

         Droppables.add(cart, {
                 greedy:false,
                 accept:['box','photo'],
                 onHover:function(element){
                         $('cart').addClassName('cart-active');
                 },
                 onDrop:function(element){
                         var id = element.id.replace(/[^\d]/g,'');
                         var contents = 'p class=removeimg 
 src=icns/delete_gray.png  
 class=remove width=16 height=16 alt=[x] //p' +  
 element.innerHTML + 'p class=detailsimg src=icns/gear.png  
 class=details width=16 height=16 alt=(i) //p';
                         var d =  new 
 Element('div',{'class':'clone'}).update(contents);
                         $('timeline').insert(d);
                         new 
 Ajax.Request('/widgets/create',{onComplete:function(transport){
                                 d.id = 'clone_' + transport.responseText;
                         }});
                         $('cart').removeClassName('cart-active');
                         Sortable.create('timeline',
 {tag:'div',overlap:'horizontal',constraint:false,  
 scroll:window,dropOnEmpty:true, onUpdate:function(elm){$
 ('cart').removeClassName('cart-active');}});
                 }
         })

 There may be some copy-and-paste errors above, but it should give you  
 the basic idea. (I tried to strip out as much of the locally-specific  
 stuff so it might be less bound to my situation here.)

 Walter
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-05 Thread WLQ

If you use the onUpdate callback to the
Sortable, you can update the database with the result of the sort
operation

That exactly what I was talking about, I have that. And when you drag
items in sortable it creates new ids and sends to a database. But how
can it know on drop, what id to give. 'Couse I only been able to add
and item on drop. And then use this serialized feauture.

On May 5, 8:02 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 No, if you drag things between lists on a page, you are moving the  
 actual DOM object out of one list and into another, and the ID remains  
 the same, just the parent object changes.

 Likewise, when you sort elements on the page, their order changes, but  
 their ID remains the same. If you use the onUpdate callback to the  
 Sortable, you can update the database with the result of the sort  
 operation, as seen in the Sortable.serialize Wiki 
 page:http://wiki.github.com/madrobby/scriptaculous/sortable-serialize

 In my cut-down example, I have an Ajax call to go out to the database  
 and get a new ID. That's the only place new IDs can come from in my  
 model.

 Walter

 On May 5, 2009, at 1:49 PM, WLQ wrote:



  Does it have anything to do with auto Idi-ing? I mean if you have
  sortable and you change the order of items, that will auto change the
  Id's to the necessary ones. And so if you drag and item and on the
  drop (without ghosting=true) drop between item 2 and 3, that will
  change the droppable items id to 3, and all others after original 2
  plus 1.- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: MySQL - order ID

2009-05-04 Thread WLQ

Yeah, I kind of knew that, but how to do that? By the way I am copying
and pasting a row from one table to another.

On May 3, 5:11 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 If you are dragging an item from one list into another list, then by  
 W3C fiat, they will have unique IDs.

 If you are cloning an object from one list into another (the list of  
 ingredients and the pot pattern) then you are responsible for creating  
 a unique ID for your newly added cloned object.

 Either way, the sort order is managed by each element having a unique  
 ID that follows Sortable's rules for ID making: one or more alpha  
 characters, followed by one and only one underscore, followed by a  
 numeral, and entirely unique. Due to Scripty's parentage in the Rails  
 framework, these numerical ID segments are the id auto-number key for  
 the object they represent, and all elements within a list should  
 (must?) be instances of the same Model.

 Walter

 On May 3, 2009, at 10:06 AM, WLQ wrote:





  So I've made all the fancy stuff, now the hardest one. I have made the
  order Id change in the sortable and it works. But what about when you
  drag an item from other sortable? How to program it so it sees between
  which Ids it pasts an item, and change ids for items as necessary?

  Thanks, Yan- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] MySQL - order ID

2009-05-03 Thread WLQ

So I've made all the fancy stuff, now the hardest one. I have made the
order Id change in the sortable and it works. But what about when you
drag an item from other sortable? How to program it so it sees between
which Ids it pasts an item, and change ids for items as necessary?

Thanks, Yan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Scriptaculous - Sortable list MySQL Ajax PHP

2009-05-02 Thread WLQ

So here's what I need:
I need a sortable list which is driven of MySQL database (with
autoupdate when order of items changes). And then I need a second
sortable list (or anything that can be dropped on the first list).

So if you drag and drop an item from the second list to the first.
This item gets added to the first list, which means inside of that
MySQL database with correct ordering.

Hope you'll help.
Thanks, Yan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Scriptaculous - Sortable list MySQL Ajax PHP

2009-05-02 Thread WLQ

Strangly but when i did this:
http://www.ruby-forum.com/topic/158430'

Drop don't work. I placed the code in different js file.

 Sortable.create(fList, {constraint:false});
 new Draggable('fish',{revert:true,ghosting:true});
 new Draggable('chicken',{revert:true,ghosting:true});
 Droppables.add('fList',
 {accept:'meat',onDrop:function(dragName,dropName)
 {placeFood(dragName,dropName)}})
 var added = 0;
 function placeFood(dragName,dropName) {
   added ++;
   $(fList).insert(new Element(li, { id: $(dragName).id
+added }))
   $($(dragName).id+added).innerHTML = $(dragName).innerHTML
   Sortable.destroy(fList);
   Sortable.create(fList, {constraint:false});
  }

I think there might be a syntax error.

On May 2, 4:25 pm, WLQ maybe...@gmail.com wrote:
 Yeah well, I'm working on it for a week now, still can't get what I
 want :)

 Cheers, Yan

 On May 2, 4:16 pm, Alexander Bock alex.b...@gmail.com wrote:



  I'm afraid I don't have the time to do that. You can find everything  
  you need to know by looking at the links I provided and using your  
  favorite search engine.
  And look on the bright side, you'll learn something new by doing it  
  yourself :-)

  Alex

  Am 02.05.2009 um 16:03 schrieb WLQ:

   I don't really understand the syntax. Can you help me with creating
   it?

   Thanks, Yan

   On May 2, 3:58 pm, Alexander Bock alex.b...@gmail.com wrote:
   You can use the onUpdate callback function 
   (http://wiki.github.com/madrobby/scriptaculous/sortable-create
   ) to serialize your data 
   (http://wiki.github.com/madrobby/scriptaculous/sortable-serialize
   ) and send an Ajax call to your server.

   Alex

   Am 02.05.2009 um 15:32 schrieb WLQ:

   But how can I make so it ads information to a database on drop?

   On May 2, 1:55 pm, Alexander Bock alex.b...@gmail.com wrote:
   Take a look at this:http://www.ruby-forum.com/topic/158430(Can you
   make a Sortable also Droppable?)

   Alex

   Am 02.05.2009 um 12:44 schrieb WLQ:

   So here's what I need:
   I need a sortable list which is driven of MySQL database (with
   autoupdate when order of items changes). And then I need a second
   sortable list (or anything that can be dropped on the first list).

   So if you drag and drop an item from the second list to the first.
   This item gets added to the first list, which means inside of that
   MySQL database with correct ordering.

   Hope you'll help.
   Thanks, Yan

    PGP.sig
1KViewDownload- Hide quoted text -

   - Show quoted text -

   PGP.sig
   1KViewDownload- Hide quoted text -

  - Show quoted text -- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] OnDrop grab the item row and paste

2009-05-02 Thread WLQ

So I have to sortable lists, each controlled by MySQL database. Now
what I want to do is when I drop an item from one list to another.
This items row will be added to that table.

So I need a somewhat script that will add a new row based on the
droppable item row.

Thanks, Yan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Sortable lists

2009-04-26 Thread WLQ

So I've got a sortable list. Now what I want to do is to have ability
to drop items on it.
Like: being able to drop other items from other lists.

Here's to create a sortable list: Sortable.create(tasksList,
{tag:li});

So how can I drop other elements into it?

Thanks, Yan

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---