diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 7027d0aa1..cbbfcc923 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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 diff --git a/docs/upgrades/packages-7.7.4/root_import_survey_default-survey-edit.wgpkg b/docs/upgrades/packages-7.7.4/root_import_survey_default-survey-edit.wgpkg new file mode 100644 index 000000000..be9e8f2c6 Binary files /dev/null and b/docs/upgrades/packages-7.7.4/root_import_survey_default-survey-edit.wgpkg differ diff --git a/www/extras/wobject/Survey/dd.js b/www/extras/wobject/Survey/dd.js index 9275c45a4..f6d914c5b 100644 --- a/www/extras/wobject/Survey/dd.js +++ b/www/extras/wobject/Survey/dd.js @@ -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 diff --git a/www/extras/wobject/Survey/editsurvey.js b/www/extras/wobject/Survey/editsurvey.js index 509e231f6..4425d5d59 100644 --- a/www/extras/wobject/Survey/editsurvey.js +++ b/www/extras/wobject/Survey/editsurvey.js @@ -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) {