24.10.2013 Views

FotoWeb 6.0 User Guide - Customization - FotoWare

FotoWeb 6.0 User Guide - Customization - FotoWare

FotoWeb 6.0 User Guide - Customization - FotoWare

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.

Customizing <strong>FotoWeb</strong> 3.0<br />

<br />

// Enumerate history events and pick the last <strong>FotoWeb</strong> Workflow event<br />

var lastFwEvent = "";<br />

<br />

var currEvent = "";<br />

// "FWW" represents a Workflow event<br />

if(currEvent.indexOf("E=FWW") > -1)<br />

{<br />

lastFwEvent = currEvent;<br />

}<br />

<br />

// Check if an event was retrieved<br />

if (lastFwEvent != "" )<br />

{<br />

// Extract date from the event<br />

var dateIndex = lastFwEvent.indexOf("D=");<br />

// Cannot be -1 ! But we check any way<br />

if (dateIndex != -1)<br />

{<br />

// Create date object for event date. Parameters are Year, Month, day where<br />

month is 0-indexed.<br />

var eventDate = new Date(eval(lastFwEvent.substr(dateIndex + 2, 4)),<br />

eval(lastFwEvent.substr(dateIndex + 7, 2)) - 1, eval(lastFwEvent.substr(dateIndex + 10,<br />

2)));<br />

// Get difference with today's date. The difference is in milliseconds.<br />

var difference = Math.abs(new Date() - eventDate);<br />

// Convert to number of days<br />

var days = Math.round(difference / (1000 * 60 * 60 * 24));<br />

document.write('');<br />

if (days == 0)<br />

{<br />

document.write('Recently used');<br />

}<br />

else if (days == 1)<br />

{<br />

document.write('Last used ' + days + ' day ago');<br />

}<br />

else<br />

{<br />

document.write('Last used ' + days + ' days ago');<br />

}<br />

}<br />

}<br />

<br />

Example 49: Marking used images.<br />

Using this example, we can display a string along with the images on when they were last used in a workflow<br />

process. Other events that are written by <strong>FotoWeb</strong> are download events (FWD) and soft crop events (SCRP).<br />

4.4 Creating loops<br />

Repeating a section of code for a certain number of times is also possible in <strong>FotoWeb</strong>. This is done by using the<br />

‘Repeat’ tag as follows:<br />

<br />

Current loop value: <br />

<br />

In this example we are creating a loop with a start value of 1. The loop will count up to a value of 10 and display its<br />

current count during each iteration.<br />

42 / 47 <strong>FotoWare</strong>

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

Saved successfully!

Ooh no, something went wrong!