15.08.2013 Views

Ektron® eWebEditPro Developer's Reference Guide

Ektron® eWebEditPro Developer's Reference Guide

Ektron® eWebEditPro Developer's Reference Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Initialization<br />

Dynamically Selecting Upload Destinations<br />

Notice a call to the UseSelectedLocation function -- this is explained in ”User<br />

Selection – Changing the Upload Location” on page 453.<br />

When the page loads, an external upload mechanism is assigned. The code also<br />

reflects to the user the current upload path from the Media File Object.<br />

<br />

var g_strConfiguredPath = "";<br />

function <strong>eWebEditPro</strong>Ready(sEditorName)<br />

{<br />

var objMedia = <strong>eWebEditPro</strong>.instances[sEditorName].editor.MediaFile();<br />

objMedia.setProperty("TransferMethod", "samples/asp/database/mediamanager.asp");<br />

g_strConfiguredPath = objMedia.getPropertyString("DefDestinationDir");<br />

document.selectpath.CurUploadLocation.value = g_strConfiguredPath;<br />

}<br />

<br />

The current path (the default path defined in the configuration file) is stored for<br />

later use. In our example, this allows the user to re-select it.<br />

Note on the Missing <strong>eWebEditPro</strong>Ready<br />

To the core JavaScript files installed with <strong>eWebEditPro</strong>, <strong>eWebEditPro</strong>Ready is<br />

a reserved function name. This function does not exist in the core JavaScript files.<br />

Instead, a developer must define the function either in his/her own JavaScript files<br />

or in the HTML file.<br />

The function can be defined in any file brought in by the page. In the example<br />

below, this function is defined in the HTML file.<br />

When the editor control sends the "ready" notification, the core JavaScript checks<br />

to see if <strong>eWebEditPro</strong>Ready is defined. If it is, the core JavaScript calls the<br />

function to notify the scripts that the editor is ready.<br />

User Selection – Changing the Upload Location<br />

In this example, the user can select one of three image upload locations. Here is<br />

the JavaScript to handle the selection:<br />

function AssignUploadLocation(sEditorName, sLocation)<br />

{<br />

var objMedia = <strong>eWebEditPro</strong>.instances[sEditorName].editor.MediaFile();<br />

objMedia.setProperty("DefDestinationDir", sLocation);<br />

document.selectpath.CurUploadLocation.value =<br />

objMedia.getPropertyString("DefDestinationDir");<br />

}<br />

function UseSelectedLocation(iIndex)<br />

{<br />

var UploadLoc = new Array(g_strConfiguredPath, <strong>eWebEditPro</strong>Path + "samples/common/database",<br />

"/publish/images");<br />

AssignUploadLocation(g_strUserEditorName, UploadLoc[iIndex]);<br />

}<br />

The UserSelectedLocation function uses the index passed down from the<br />

LocationSelection item to specify the user's selection.<br />

<strong>Ektron®</strong> <strong>eWebEditPro</strong> Developer’s <strong>Reference</strong> <strong>Guide</strong>, Release 5.1, Revision 1 453

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!