[Proto-Scripty] Drag and Drop problems

2009-06-30 Thread Mike

I am making a drag-and-drop editor thing using scriptaculous. However,
when I dynamically add an element, it takes the size of the div it is
being placed into. Then, when I drag it, I don't have access to any
other elements that are already in the div.

Here is the javascript functions I created:

   function createCanvas(){
Droppables.add('sigImage', {
accept: 'draggable',
hoverclass: 'hover'
});
}
function createNewDraggable(elementId){
new Draggable(elementId, {
handle: 'sigImage',
ghosting: true
});
}
function newElementMenu(){
document.getElementById('newElementName').value = '';
Effect.Appear('createNewElementMenu', {duration: .3});
}
function newElement(elementName){
Effect.Fade('createNewElementMenu', {duration: .3});
document.getElementById('sigImage').innerHTML += 'div 
id=' +
elementName + 'The next element!/div';
createNewDraggable(elementName);
}

Here is the nesting:

div id=sigImage style=width: 500px; height: 100px;
background-color: gray; color: black; border: 1px black; overflow:
none;
div id=dragmeDrag me!/div
/div

Another not so important thing is how can I get the elements to remain
in the div and not be dragged outside of 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] What is function(transport) means ?

2009-06-30 Thread Nakata Kokuyo

Good day All,

I normally found prototype sample like following :-

[code]
onComplete: function(transport) {
console.log('done');
console.log
(transport);
}
[/code]

but i have no idea what is 'Transport' means in function(transport) ,
what are the other common parameters used in function ?

Thank you !
--~--~-~--~~~---~--~~
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] How to call custom action in Ajax.Updater() ?

2009-06-30 Thread Nakata Kokuyo

Good day All,

I would like to know how we can call the custom controller action in
java or asp.net (i'm using salesforce environment in fact)?

what i intend to do is to have one dropdown list , when the value get
change, it will fire a custom action to return string and it able to
give me update value of specific DIV section

Thank you !
--~--~-~--~~~---~--~~
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: What is function(transport) means ?

2009-06-30 Thread Richard Quadling
2009/6/30 Nakata Kokuyo alvincks...@gmail.com


 Good day All,

 I normally found prototype sample like following :-

 [code]
 onComplete: function(transport) {
console.log('done');
console.log
 (transport);
}
 [/code]

 but i have no idea what is 'Transport' means in function(transport) ,
 what are the other common parameters used in function ?

 Thank you !
 

Transport gives you access to the response part of the request that the
onComplete relates to.
http://prototypejs.org/api/ajax/options

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!
I need a car : http://snipurl.com/l4pih
ZOPA : http://uk.zopa.com/member/RQuadling

--~--~-~--~~~---~--~~
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: What is function(transport) means ?

2009-06-30 Thread david

Hi Nakata,

when you send an AJAX request, you want to return something from the
server. This is what is TRANSPORT:It is the result of the request, it
could be JSON, text/HTML, XML ...

Have more detailled in http://prototypejs.org/api/ajax/request and the
complete AJAX API: http://prototypejs.org/api/ajax

--
david

On 30 juin, 10:33, Nakata Kokuyo alvincks...@gmail.com wrote:
 Good day All,

 I normally found prototype sample like following :-

 [code]
 onComplete    : function(transport) {
                                                 console.log('done');
                                                 console.log
 (transport);
                                         }
 [/code]

 but i have no idea what is 'Transport' means in function(transport) ,
 what are the other common parameters used in function ?

 Thank you !
--~--~-~--~~~---~--~~
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: Drag and Drop problems

2009-06-30 Thread david

Hi Mike,

for the first question, I think that you should style the inserted
element or use a SPAN tagb instead of a DIV tag:
the DIV expand its width by default to it's contener width,
the SPAN just enclose inside content.

for the second question, there is no siimple way, scriptaculous don't
handle that, but I remember that some projects have modify default
scriptaculous behaviour == Have a look at http://scripteka.com/

--
david

On 30 juin, 07:58, Mike thej...@gmail.com wrote:
 I am making a drag-and-drop editor thing using scriptaculous. However,
 when I dynamically add an element, it takes the size of the div it is
 being placed into. Then, when I drag it, I don't have access to any
 other elements that are already in the div.

 Here is the javascript functions I created:

                function createCanvas(){
                         Droppables.add('sigImage', {
                                 accept: 'draggable',
                                 hoverclass: 'hover'
                         });
                 }
                 function createNewDraggable(elementId){
                         new Draggable(elementId, {
                                 handle: 'sigImage',
                                 ghosting: true
                         });
                 }
                 function newElementMenu(){
                         document.getElementById('newElementName').value = '';
                         Effect.Appear('createNewElementMenu', {duration: .3});
                 }
                 function newElement(elementName){
                         Effect.Fade('createNewElementMenu', {duration: .3});
                         document.getElementById('sigImage').innerHTML += 
 'div id=' +
 elementName + 'The next element!/div';
                         createNewDraggable(elementName);
                 }

 Here is the nesting:

                 div id=sigImage style=width: 500px; height: 100px;
 background-color: gray; color: black; border: 1px black; overflow:
 none;
                         div id=dragmeDrag me!/div
                 /div

 Another not so important thing is how can I get the elements to remain
 in the div and not be dragged outside of 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: How to call custom action in Ajax.Updater() ?

2009-06-30 Thread david

Hi Nataka,

I did not see any Updater in your question :))
btw, have a look to the event API: http://prototypejs.org/api/event
and OBSERVE the SELECT tag to get called when a change ocuurs. You
juust need to verify that you update the select and not delete/define
a new one.

--
david

On 30 juin, 10:45, Nakata Kokuyo alvincks...@gmail.com wrote:
 Good day All,

 I would like to know how we can call the custom controller action in
 java or asp.net (i'm using salesforce environment in fact)?

 what i intend to do is to have one dropdown list , when the value get
 change, it will fire a custom action to return string and it able to
 give me update value of specific DIV section

 Thank you !
--~--~-~--~~~---~--~~
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: Drag and Drop problems

2009-06-30 Thread Alex McAuley

For the second question you have to work out its positioning on the page and 
relative to its parent... enclosing is not easy but its also not difficult 
...

Here is some code i wrote to enclose draggable windows in my windowing 
system to make sure they dont go outsode the page...

http://pastie.org/529198

HTH

Alex



- Original Message - 
From: david david.brill...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Tuesday, June 30, 2009 11:29 AM
Subject: [Proto-Scripty] Re: Drag and Drop problems



Hi Mike,

for the first question, I think that you should style the inserted
element or use a SPAN tagb instead of a DIV tag:
the DIV expand its width by default to it's contener width,
the SPAN just enclose inside content.

for the second question, there is no siimple way, scriptaculous don't
handle that, but I remember that some projects have modify default
scriptaculous behaviour == Have a look at http://scripteka.com/

--
david

On 30 juin, 07:58, Mike thej...@gmail.com wrote:
 I am making a drag-and-drop editor thing using scriptaculous. However,
 when I dynamically add an element, it takes the size of the div it is
 being placed into. Then, when I drag it, I don't have access to any
 other elements that are already in the div.

 Here is the javascript functions I created:

 function createCanvas(){
 Droppables.add('sigImage', {
 accept: 'draggable',
 hoverclass: 'hover'
 });
 }
 function createNewDraggable(elementId){
 new Draggable(elementId, {
 handle: 'sigImage',
 ghosting: true
 });
 }
 function newElementMenu(){
 document.getElementById('newElementName').value = '';
 Effect.Appear('createNewElementMenu', {duration: .3});
 }
 function newElement(elementName){
 Effect.Fade('createNewElementMenu', {duration: .3});
 document.getElementById('sigImage').innerHTML += 'div id=' +
 elementName + 'The next element!/div';
 createNewDraggable(elementName);
 }

 Here is the nesting:

 div id=sigImage style=width: 500px; height: 100px;
 background-color: gray; color: black; border: 1px black; overflow:
 none;
 div id=dragmeDrag me!/div
 /div

 Another not so important thing is how can I get the elements to remain
 in the div and not be dragged outside of 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] Ajax.Updater - relative positioning - a footer - and IE7

2009-06-30 Thread mtm81

In IE7, the following page loads some content in two areas of the page
using an AJAX.Updater call.

All very simple.

However, at the bottom of the page a footer with a negative margin to
get it into position.

On all the other non ajax pages of the site, this CSS layout works
without issue, however on the page causing a problem, when the main
content is reloaded (and therefore the overall height of the page is
changed), the footer does not re-position.

this is IE7 only..

can anyone shed any light on how I can stop this happening?

http://www.flex-ability.co.uk/markets.asp

then click any of the options within the pie chart...

cheers


--~--~-~--~~~---~--~~
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-30 Thread Walter Lee Davis

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: Drag and Drop problems

2009-06-30 Thread Mike

Thank you all for the fast responses. That really helps my project
along :)

On Jun 30, 9:10 am, Rick Waldron waldron.r...@gmail.com wrote:
 Alex,

 Thats super rad.

 Rick

 On Tue, Jun 30, 2009 at 7:16 AM, Alex McAuley 



 webmas...@thecarmarketplace.com wrote:

  For the second question you have to work out its positioning on the page
  and
  relative to its parent... enclosing is not easy but its also not difficult
  ...

  Here is some code i wrote to enclose draggable windows in my windowing
  system to make sure they dont go outsode the page...

 http://pastie.org/529198

  HTH

  Alex

  - Original Message -
  From: david david.brill...@gmail.com
  To: Prototype  script.aculo.us 
  prototype-scriptaculous@googlegroups.com
  Sent: Tuesday, June 30, 2009 11:29 AM
  Subject: [Proto-Scripty] Re: Drag and Drop problems

  Hi Mike,

  for the first question, I think that you should style the inserted
  element or use a SPAN tagb instead of a DIV tag:
  the DIV expand its width by default to it's contener width,
  the SPAN just enclose inside content.

  for the second question, there is no siimple way, scriptaculous don't
  handle that, but I remember that some projects have modify default
  scriptaculous behaviour == Have a look athttp://scripteka.com/

  --
  david

  On 30 juin, 07:58, Mike thej...@gmail.com wrote:
   I am making a drag-and-drop editor thing using scriptaculous. However,
   when I dynamically add an element, it takes the size of the div it is
   being placed into. Then, when I drag it, I don't have access to any
   other elements that are already in the div.

   Here is the javascript functions I created:

   function createCanvas(){
   Droppables.add('sigImage', {
   accept: 'draggable',
   hoverclass: 'hover'
   });
   }
   function createNewDraggable(elementId){
   new Draggable(elementId, {
   handle: 'sigImage',
   ghosting: true
   });
   }
   function newElementMenu(){
   document.getElementById('newElementName').value = '';
   Effect.Appear('createNewElementMenu', {duration: .3});
   }
   function newElement(elementName){
   Effect.Fade('createNewElementMenu', {duration: .3});
   document.getElementById('sigImage').innerHTML += 'div id=' +
   elementName + 'The next element!/div';
   createNewDraggable(elementName);
   }

   Here is the nesting:

   div id=sigImage style=width: 500px; height: 100px;
   background-color: gray; color: black; border: 1px black; overflow:
   none;
   div id=dragmeDrag me!/div
   /div

   Another not so important thing is how can I get the elements to remain
   in the div and not be dragged outside of 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: Drag and Drop problems

2009-06-30 Thread Alex McAuley
Seriously ? ... lol

It needs everything to be in a container div with width and height set to the 
viewport but it works perfectly  i wrote one for resizzables too to stop 
someone resizing something outside of a given container!.
  - Original Message - 
  From: Rick Waldron 
  To: prototype-scriptaculous@googlegroups.com 
  Sent: Tuesday, June 30, 2009 5:10 PM
  Subject: [Proto-Scripty] Re: Drag and Drop problems


  Alex,

  Thats super rad.

  Rick




  On Tue, Jun 30, 2009 at 7:16 AM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:


For the second question you have to work out its positioning on the page and
relative to its parent... enclosing is not easy but its also not difficult
...

Here is some code i wrote to enclose draggable windows in my windowing
system to make sure they dont go outsode the page...

http://pastie.org/529198

HTH

Alex




- Original Message -
From: david david.brill...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Tuesday, June 30, 2009 11:29 AM
Subject: [Proto-Scripty] Re: Drag and Drop problems



Hi Mike,

for the first question, I think that you should style the inserted
element or use a SPAN tagb instead of a DIV tag:
the DIV expand its width by default to it's contener width,
the SPAN just enclose inside content.

for the second question, there is no siimple way, scriptaculous don't
handle that, but I remember that some projects have modify default
scriptaculous behaviour == Have a look at http://scripteka.com/

--
david

On 30 juin, 07:58, Mike thej...@gmail.com wrote:
 I am making a drag-and-drop editor thing using scriptaculous. However,
 when I dynamically add an element, it takes the size of the div it is
 being placed into. Then, when I drag it, I don't have access to any
 other elements that are already in the div.

 Here is the javascript functions I created:

 function createCanvas(){
 Droppables.add('sigImage', {
 accept: 'draggable',
 hoverclass: 'hover'
 });
 }
 function createNewDraggable(elementId){
 new Draggable(elementId, {
 handle: 'sigImage',
 ghosting: true
 });
 }
 function newElementMenu(){
 document.getElementById('newElementName').value = '';
 Effect.Appear('createNewElementMenu', {duration: .3});
 }
 function newElement(elementName){
 Effect.Fade('createNewElementMenu', {duration: .3});
 document.getElementById('sigImage').innerHTML += 'div id=' +
 elementName + 'The next element!/div';
 createNewDraggable(elementName);
 }

 Here is the nesting:

 div id=sigImage style=width: 500px; height: 100px;
 background-color: gray; color: black; border: 1px black; overflow:
 none;
 div id=dragmeDrag me!/div
 /div

 Another not so important thing is how can I get the elements to remain
 in the div and not be dragged outside of 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: Events in own Class

2009-06-30 Thread Matt Foster

This will work, but remember that the instance isn't going to actually
fire an event, its just really acting as liaison to the document
object to fire off events via document.  You've somewhat namespaced
the event with your reference ID which is going to make things
difficult for anything attempting to observe an event from an
instance.

document.observe(observable_ + myInstance._refID + :onFoo);

Prototype's custom events are events that can fire from a DOM
instance, which will bubble to parents and can be caught at the top or
wherever along the propagation chain.  What I believe you are looking
for is events fired from a function/class instance.  You can get the
function instance to throw an event by using the scripts i posted
above.

--

http://positionabsolute.net




On Jun 29, 5:07 pm, Sven stuebe...@googlemail.com wrote:
 ok

 i tryed something...

 var Observable = Class.create({
     initialize : function(){
         this._refID = Observable.prototype.refCount++;
     },

     observe : function(name, handler){
         document.observe('observable_' + this._refID + ':' + name,
 handler);
     },

     fire    : function(name){
         document.fire('observable_' + this._refID + ':' + name);
     }

 });

 Object.extend(Observable.prototype, {refCount : 0});

 var Test = Class.create(Observable, {
     initialize : function($super){
         $super();
     },

     foo : function(){
         this.fire('onFoo');
     }

 });

 is only a prototype for testing. Is it the right way or not?

 thanks,

 rgds sven

 On 29 Jun., 20:17, Matt Foster mattfoste...@gmail.com wrote:

  I ran into this same issue and made a class to extend others from to
  inherit this sort of functionality.

  This is the article but the JS itself is a bit 
  outdatedhttp://positionabsolute.net/blog/2007/06/event-dispatcher.php

  To get the freshest 
  JS...http://positionabsolute.net/includes/javascripts/EventDispatcher.js

  On Jun 29, 12:56 pm, Sven stuebe...@googlemail.com wrote:

   hmm but wait

   this is a global event...
   i want a instance-based event.

   xyz.foo(); //alert(barbarbar);
   abc.foo(); // alert(1234); and second $('bla').hide();

   rgds sven

   On 29 Jun., 18:41, Sven stuebe...@googlemail.com wrote:

wow thank you ;)

On 29 Jun., 18:38, Rick Waldron waldron.r...@gmail.com wrote:

 Dig it:

http://jsbin.com/uhogi

 (view the source)

 Rick

 On Mon, Jun 29, 2009 at 12:19 PM, Sven stuebe...@googlemail.com 
 wrote:

  Hi,

  is it possible to add Events to own classes?

  something like this:

  var myClass = Class.create({
         foo : function(){
                 this.fire('bar');
         }
  });

  var xyz = new MyClass();
  xyz.observe('bar', function(){alert(barbarbar);});

  rgds sven
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---