Created
September 26, 2009 01:14
-
-
Save davglass/193955 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$formIds = array("VisitDate","Status","VisitType","CurrentDate_MMMM_DDDD_YYYY","CurrentDate_M_D_YYYY","DOB_MMMM_DDDD_YYYY","DOB_M_D_YYYY","CustomerName","NameFirst", "NameMiddle", "NameLast", "NameSuffix", "NamePrefix", "DealerPersonnelName", "DealerName", "CustomerAddress", "CustomerAddressContinued", "City", "State", "ZIP", "DriversLicense", "CityStateZip", "PhoneMobile", "PhoneHome", "PhoneWork", "EmailAddress", "Gender", "TimeFrameEarliestLatest","TimeFrameDescription","CustomerComments","CoBuyerDOB_MMMM_DDDD_YYYY","CoBuyerName","CoBuyerNameFirst","CoBuyerNameMiddle","CoBuyerNameLast","CoBuyerNameSuffix","CoBuyerNamePrefix","CoBuyerAddress","CoBuyerAddressContinued","CoBuyerCity","CoBuyerState","CoBuyerZIP","CoBuyerDriversLicense","CoBuyerCityStateZip","CoBuyerPhoneMobile","CoBuyerPhoneHome","CoBuyerPhoneWork","CoBuyerEmailAddress","CoBuyerGender","CoBuyerComments","VIN","Stock","VehicleDescription","VehicleNewUsed","YearManufactured", "Make", "Model", "BodyStyle","Trim","Odometer","Interest","PricingComments","InteriorColor","ExteriorColor","Price","DesiredVehicleQuotePrice","DesiredVehicleOfferPrice","DesiredVehicleMSRP","DesiredVehicleInvoicePrice","DesiredVehicleCallPrice","DesiredVehicleAppraisalPrice","AskingPrice","TradeInQuotePrice","TradeInOfferPrice","TradeInMSRP","TradeInInvoicePrice","TradeInCallPrice","TradeInAppraisalPrice","TradeInAskingPrice","FinancingAmount","TotalFinancingAmount","DownPayment","MonthlyPayment","MinMaxLimit","FinanceMethod","VehicleComments","TradeInVIN","TradeInVehicleDescription","TradeInOdometer", "TradeInYear", "TradeInMake", "TradeInModel", "TradeInInteriorColor","TradeInExteriorColor", "TradeInVehicleComments","TradeInFinanceBalance","TradeInCondition","CFMContactDate","CustomerFeedbackComments","AdSources"); | |
$coords = array(); | |
//load dealerships | |
//$dealerQuery = "SELECT ID, Name FROM Dealers WHERE Active = 1 ORDER BY Name"; | |
//$dealers = a_adodb_query_rows($dealerQuery); | |
?> | |
<style> | |
body { | |
font-family:verdana,arial; | |
font-size:9px; | |
} | |
#dropfields { | |
padding:0px; | |
margin:0px; | |
} | |
#dropfields li { | |
font-size:11px; | |
font-weight:bold; | |
color:black; | |
cursor:move; | |
list-style:none; | |
border:1px solid black; | |
background-color:orange; | |
width:"100%"; | |
height:15px; | |
opacity:.70; | |
margin-top:2px; | |
} | |
</style> | |
<script type="text/javascript" language="javascript"> | |
var DDApp = function () { | |
var Dom = YAHOO.util.Dom; | |
//Set all dd instances to use the shim so we can drag over the Div Tags | |
//YAHOO.util.DDM.useShim = false; | |
var textBoxes = new Array(25); | |
return { | |
init: function() { | |
YAHOO.widget.Logger.enableBrowserConsole(); | |
var ddIds = new Array(<?php echo '"dd_' . implode('","dd_',$formIds) . '"'; ?>); | |
var ddNames = new Array(<?php echo '"' . implode('","',$formIds) . '"'; ?>); | |
var ddTargets = new Array(<?php echo '"tar_' . implode('","tar_',$formIds) . '"'; ?>); | |
var img = new DDTargetImage("target_image"); | |
var list = Dom.get("dropfields"); | |
for(var i = 0, tLen = ddTargets.length; i < tLen; i++) { | |
//create text boxes | |
var box = document.createElement("li"); | |
box.id = ddIds[i]; | |
box.innerHTML = ddNames[i]; | |
list.appendChild(box); | |
//console.log(ddIds[i], YAHOO.util.Dom.get(ddIds[i])); | |
textBoxes[i] = new DDTextBox(ddIds[i]); | |
textBoxes[i].targetInput = ddTargets[i]; | |
textBoxes[i].name = ddNames[i]; | |
//textBoxes[i].useShim = false; | |
} | |
} | |
}; | |
} (); | |
(function () { | |
var Dom = YAHOO.util.Dom; | |
var Event = YAHOO.util.Event; | |
var DDM = YAHOO.util.DragDropMgr; | |
//Set all dd instances to use the shim so we can drag over the Div Tags | |
//YAHOO.util.DDM.useShim = false; | |
DDTargetImage = function(id, targetInput) { | |
if(id) { | |
this.init(id); | |
} | |
}; | |
YAHOO.extend(DDTargetImage, YAHOO.util.DDTarget); | |
DDTextBox = function(id, sGroup, config) { | |
if(id) { | |
this.init(id, sGroup, config); | |
this.initFrame(); | |
this.isTarget = false; | |
} | |
}; | |
YAHOO.extend(DDTextBox, YAHOO.util.DDProxy, { | |
targetInput: null, | |
name: null, | |
offsetY: 20, | |
//useShim: true, | |
startDrag: function(x, y) { | |
this.logger.log(this.id + " startDrag"); | |
// make the proxy look like the source element | |
var dragEl = this.getDragEl(); | |
var clickEl = this.getEl(); | |
Dom.setStyle(clickEl, "visibility", "hidden"); | |
dragEl.innerHTML = clickEl.innerHTML; | |
Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color")); | |
Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor")); | |
Dom.setStyle(dragEl, "border", "2px solid gray"); | |
}, | |
endDrag: function(e) { | |
//the height offset is set here based on the height of the fields we are draggin around | |
//if we change the style, this needs to change also | |
var imgOffsetX = Dom.getX("target_image"); | |
var imgOffsetY = Dom.getY("target_image"); | |
var tInput = Dom.get(this.targetInput); | |
var locX = Dom.getX(this.getEl());// - imgOffsetX; | |
var locY = Dom.getY(this.getEl());// - imgOffsetY; | |
if(locX < 0 || locY < 0) { | |
tInput.value = ''; | |
YAHOO.log("Here are the x an y: X:" + locX + " Y:" + locY) | |
YAHOO.log("zero'd drop"); | |
} else { | |
tInput.value = locX + ',' + locY; | |
YAHOO.log(this.targetInput + ' moved to:' + locX + ','+ (parseInt(locY))); | |
YAHOO.log(Dom.get(this.targetInput).value); | |
} | |
}, | |
onInvalidDrop: function(e) { | |
// animate the proxy element to the src elements location | |
var a = new YAHOO.util.Motion(this.getEl(), { points: { to: [this.initPageX, this.initPageY] } }, 0.3, YAHOO.util.Easing.easeOut) | |
a.animate();; | |
}, | |
onAvailable: function() { | |
//move all the boxes where they should be | |
//Set all dd instances to use the shim so we can drag over the Div Tags | |
// YAHOO.util.DDM.useShim = true; | |
var tInput = Dom.get(this.targetInput); | |
var imgOffsetX = Dom.getX("target_image"); | |
var imgOffsetY = Dom.getY("target_image"); | |
if(tInput.value != '') { | |
//split the coordinates | |
var xy = (tInput.value).split(",",3); | |
var x = imgOffsetX + parseInt(xy[0]); | |
var y = imgOffsetY + parseInt(xy[1]); | |
var a = new YAHOO.util.Motion(this.getEl(), {points: { to: [x, y] } }, .1, YAHOO.util.Easing.easeOut); | |
a.animate(); | |
YAHOO.log('moving ' + this.targetInput + ' to:' + xy[0] + "," + xy[1]); | |
} | |
} | |
}); | |
})(); | |
YAHOO.util.Event.addListener(window, "load", DDApp.init); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment