Modifying Webobject Directly - w/o Republishing

I have about 47 1 hour long courses that we are now migrating to another server using a different domain address.  Each of the courses uses a webobject to call a program which updates the user database for passing the quiz.

I need to change the reference to the program ie.

  from:   http://www.domain.com/pass.asp

  to:        http://www.newdomain/pass.asp

I would like to avoid re-publishing all the courses. 

Is there a way to manually edit the reference?  Does anyone know where to find it?

5 Replies
Steve Flowers

Hi Ramon,

You'd need to edit the Web Object in the published directory. Each published output contains published Web Objects under story_content, each within its own folder. Unfortunately, this would need to be done each time the course is republished unless a new Web Object is reimported.

Hand editing these files is a drag. Fortunately, you can use a program to sweep through all of your files and make the replacement. Dreamweaver can search and replace within directories. But the software I LOVE to use for this is called Grepwin.

http://tools.tortoisesvn.net/grepWin.html

After installing this tool you can search within all kinds of files and replace a specific string across multiple files within a folder or set of folders. It's super-handy!

Steve Flowers

Ah, I assumed you meant a file linked to from within a Web Object (a package of files attached instead of a link). That link might be embedded within the SWF. Fortunately, it calls out to a JavaScript function that could be "bent" to catch the address call and redirect it somewhere else.

If you're only worried about the Flash output, under story.js, look for this function:

function OpenWebObject...

inside of the first open curly bracket, add this bit:

if(strURL=="http://www.domain.com/pass.asp"){

strURL="http://www.newdomain/pass.asp";

}

This'll catch your existing value and substitute only the new value when that function is called. HTML5 uses a different mechanism, unfortunately and there isn't a way to update this within the iOS output without republishing (as far as I can tell).

Once you get a search and replace running you could run a replace on your whole folder structures to replace in one shot using this:

Replace:

var oWebObject = g_oWebObjects[strId];

if (!oWebObject)

With:

if(strURL=="http://www.domain.com/pass.asp"){

strURL="http://www.newdomain/pass.asp";

}

var oWebObject = g_oWebObjects[strId];

if (!oWebObject)

Ramon Smitherman

Thanks Steve,

That looks promising.  THe GrepWin did not find anything.  I will need to look at your idea list above.

This may be for a future project.  I will need to do lots of testing and for now that will take more time than republishing.

What would make this whole problem go away would be if we could use relative links versus absolute links.

As a result of the use of absolute links using webobjects will always be a hassle when developing for clients.

Steve Flowers

Agree about relative Web Objects, though this method could be one better. This is a strange workaround but should work.

Creating a folder with a single index.html file, create a function that changes the window location to your relative address. The embedded Web Object feature will grab everything in the folder if you pack more that you want to carry-on.

This would also make the link editable within the output folder if you needed to change it in the future.