beautypg.com

Adobe Extending Dreamweaver CS4 User Manual

Page 301

background image

295

EXTENDING DREAMWEAVER CS4

Data sources

var paramObj = new Object();
paramObj.bindingName = bindingName;
var retStr = extPart.getInsertString("", "MyDatasource_DataRef", paramObj);

// We need to strip the cfoutput tags if we are inserting into a CFOUTPUT tag
// or binding to the attributes of a ColdFusion tag. So, we use the
// dwscripts.canStripCfOutputTags() function from dwscriptsServer.js

if (dwscripts.canStripCfOutputTags(dropObject, true))
{

retStr = dwscripts.stripCFOutputTags(retStr, true);

}
return retStr;

}

function inspectDynamicDataRef(expression)
{

var retArray = new Array();

if(expression.length)
{

var params = extPart.findInString("MyDatasource_DataRef", expression);
if (params)
{

retArray[0] = params.sourceName;
retArray[1] = params.bindingName;

}

}

return retArray;

}

function deleteDynamicSource(sourceName, bindingName)

{

var siteURL = dw.getSiteRoot();

if (siteURL.length)
{

//For localized object name
if (sourceName != "MyDatasource")
{

sourceName = "MyDatasource";

}

dwscripts.deleteListValueFromNote(siteURL, sourceName, bindingName);

}

}

3

Save the file as MyDatasource.js in the Configuration/DataSources/ColdFusion folder.

Creating the supporting command files for user input

The

addDynamicSource()

function contains the command

dw.popupCommand("MyDatasource_Variable")

,

which opens a dialog box for the user to enter a specific variable name. However, you must create the dialog box for
MyDatasource Variable.

This manual is related to the following products: