Survey editor now keeps survye objedts in a scrollable panel to keep buttons always in view.

This commit is contained in:
Kaleb Murphy 2009-04-15 19:10:41 +00:00
parent 5bf3614d10
commit 2f5fc2f4e1
4 changed files with 37 additions and 6 deletions

View file

@ -20,6 +20,7 @@
- fixed #9039: Synopsis not output as a meta field
- fixed #9939: checkout error with any payment method
- fixed #10162: Inbox Failing (Eric Kennedy)
- Survey editor now keeps survye objedts in a scrollable panel to keep buttons always in view.
7.7.3
- fixed #10094: double explanation in thread help

View file

@ -6,6 +6,7 @@ var Event = YAHOO.util.Event;
var DDM = YAHOO.util.DragDropMgr;
var currentDest;
var started = 0;
Survey.DDList = function(id, sGroup, config) {
@ -20,8 +21,9 @@ Survey.DDList = function(id, sGroup, config) {
};
YAHOO.extend(Survey.DDList, YAHOO.util.DDProxy, {
startDrag: function(x, y) {
started +=2;
this.logger.log(this.id + " startDrag");
// make the proxy look like the source element
@ -65,8 +67,11 @@ YAHOO.extend(Survey.DDList, YAHOO.util.DDProxy, {
onInvalidDrop: function(e, id) {
Survey.Data.dragDrop(this.getEl());
started += -2;
},
onDragDrop: function(e, id) {
started--;
if(started != 1){return;}
Survey.Data.dragDrop(this.getEl());
},
@ -74,7 +79,15 @@ YAHOO.extend(Survey.DDList, YAHOO.util.DDProxy, {
// Keep track of the direction of the drag for use during onDragOver
var y = Event.getPageY(e);
var temp = Survey.Data.ddContainer.body;
var dy = YAHOO.util.Dom.getY(temp);
var scrollOffset = 30;
if((y - scrollOffset) < dy){
Survey.Data.ddContainer.body.scrollTop -= 20;
}
else if((y + scrollOffset) > (dy + temp.offsetHeight)){
Survey.Data.ddContainer.body.scrollTop += 20;
}
if (y < this.lastY) {
this.goingUp = true;
} else if (y > this.lastY) {
@ -92,12 +105,13 @@ YAHOO.extend(Survey.DDList, YAHOO.util.DDProxy, {
// We are only concerned with list items, we ignore the dragover
// notifications for the list.
if (destEl.nodeName.toLowerCase() == "li") {
currentDest = destEl;
YAHOO.log(destEl);
currentDest = destEl;
YAHOO.log(destEl);
var orig_p = srcEl.parentNode;
var p = destEl.parentNode;
if (this.goingUp) {
Survey.Data.ddContainer
p.insertBefore(srcEl, destEl); // insert above
} else {
p.insertBefore(srcEl, destEl.nextSibling); // insert below

View file

@ -15,8 +15,8 @@ Survey.Data = (function(){
var sButton, qButton, aButton;
return {
ddContainer:null,
dragDrop: function(did){
YAHOO.log('In drag drop');
var type = did.className.match("section") ? 'section'
: did.className.match("question") ? 'question'
@ -80,7 +80,23 @@ Survey.Data = (function(){
YAHOO.util.Event.purgeElement('sections', true);
// Now we can re-write its innerHTML without fear of memory leaks
document.getElementById('sections').innerHTML = d.ddhtml;
// document.getElementById('sections').innerHTML = d.ddhtml;
if(! Survey.Data.ddContainer){
Survey.Data.ddContainer =
new YAHOO.widget.Panel("sections",
{ width:"440px",
height: "420px",
draggable:true,
visible:true
}
);
}
Survey.Data.ddContainer.setHeader("Survey Objects...");
Survey.Data.ddContainer.setBody(d.ddhtml);
Survey.Data.ddContainer.setFooter(document.getElementById("buttons"));
Survey.Data.ddContainer.render();//document.body);
//add event handlers for if a tag is clicked
for (var x in d.ids) {