/*
@@@BUILDINFO@@@ st18HTMLUtil.jsx 466 16-March-2007
*/
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
* Copyright 2005 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
**************************************************************************/
if( ( stockphoto.timeKeeperOn != undefined )&&( stockphoto.timeKeeperOn ) )
{
stockphoto.timeKeeper.st18HTMLUtil = {};
stockphoto.timeKeeper.st18HTMLUtil.StTime = new Date();
}
// %_function...%_ : function to be called
// %_Comp%_ : "Transaction Complete"
// %_Can%_ : "Cancel the order"
stockphoto.HTMLUtil ={};
stockphoto.HTMLUtil.Isw =true;
stockphoto.HTMLUtil.LineOnOff=true;
stockphoto.HTMLUtil.ConvertToInteger=function( str )
{
// strictly use only '0'-'9' characters
var i, v=0, Bt;
for( i=0; i= '0' )&&( Bt <= '9' ) ) v = ( 10*v ) + ( Bt-'0' );
}
return( v );
}
stockphoto.HTMLUtil.ConvertToIEAddress=function( iBf )
{
var i, oBf="";
oBf = "file:///";
for( i=0; i 8)
{
m = Math.floor((e+b)/2);
if( iRec.substr( i+2, kv[m].l ) < kv[m].k )
{
e = m;
}
else
{
b = m;
}
}
for( j=b; j= kv4 )
{
if( iRec.substr( i+2, kv0 ) == kv[j].k )
{
if( ( iRec.charAt( i+kv2 ) == "%" )&&
( iRec.charAt(i+kv2+1) == "_" ) )
{
if( kv[j].t != 0 )
{
// eval( ( kv[j].v )+"("+(doc_id)+");\n" );
var funcOut = eval( ( kv[j].v )+"("+(doc_id)+");\n" );
if( funcOut != undefined )
return( funcOut );
return( "" );
}
oRec += kv[j].v;
i += kv4; Rem -= kv4;
bContinue = true;
break;
}
}
}
}
if( bContinue )
{
continue;
}
}
oRec += iRec.charAt( i ); i++; Rem--;
}
return( oRec );
}
stockphoto.HTMLUtil.LocalHTMLmain=function( TemplatePath, ConvTable, OutputName, folder, bSpecial, doc_id )
{
function kwSort(a, b)
{
a1 = a.k;
b1 = b.k;
if (a1 < b1)
return -1;
if (a1 > b1)
return 1;
return 0;
}
var keyval, t, key, fsIn, js, ks, i, cc, cdst, csrc;
if( stockphoto.HTMLUtil.Isw )
{
stockphoto.HTMLUtil.Initialize();
}
keyval = "var kv=[";
for( key in ConvTable )
{
cdst = "";
csrc = ( ConvTable[key] ).toString();
for( i=0; i 7 )&&( key.substring(0,8) == "function" ) )
{
t = 1;
}
else
{
t = 0;
}
keyval = keyval+"{k:\""+key+"\",l:"+key.length+",v:\""+cdst+"\",t:"+t+"},\n";
}
for( i=0; i nKey )
{
s = line.substr( 1, nKey );
}
else
{
s = "xxx";
}
if( s.toUpperCase() == szKey )
{
k1 = line.indexOf('"');
if( k1 > 0 )
{
s = line.substring( k1+1, nL );
k2 = s.indexOf( '"' );
if( k2 > 0 )
{
key = s.substr( 0, k2 );
fsIn.close();
return( key );
}
}
fsIn.close();
return( "" );
}
line = fsIn.readln();
}
fsIn.close();
}
return( "" );
}
stockphoto.HTMLUtil.DecodeXMLStringTable=[ { n:""", l:6, v:'"' }, { n:"'", l:6, v:"'" }, { n:"&", l:5, v:"&" }, { n:">", l:4, v:">" }, { n:"<", l:4, v:"<" } ];
stockphoto.HTMLUtil.DecodeXMLString=function( tIn ) {
var bDoIt=true, i, iMax, iMax2, s, k, ky, nky, v, m, mm, Bt, t;
t = tIn;
while( t != "" )
{
m = 0;
for( k=0; k<5; k++ )
{
s = t;
t = "";
ky = stockphoto.HTMLUtil.DecodeXMLStringTable[k].n;
nky = stockphoto.HTMLUtil.DecodeXMLStringTable[k].l;
v = stockphoto.HTMLUtil.DecodeXMLStringTable[k].v;
iMax = s.length;
if( iMax <= 0 )
{
return( "" );
}
iMax2 = iMax - nky;
mm = 0;
for( i=0; i 0 )
{
Ret.str = str4.substr( 4, k )
}
else
{
Ret.str = "";
}
return( Ret );
}
stockphoto.HTMLUtil.ConvertToPriceStringObj=undefined;
stockphoto.HTMLUtil.ChangeSymbol=function( str, ind )
{
var p, s, v, n;
if( str != undefined )
{
p = ( unescape( str ) ).split( "?" );
if( ind < p.length )
{
s = p[ ind ];
if( s.length > 2 )
{
if( ( s.charAt( 0 ) == "0" )&&
( s.charAt( 1 ) == "x" ) )
{
v = "n = String.fromCharCode( "+s+" );\n";
eval( v );
return( n );
}
}
return( s );
}
}
return( "US$" );
}
stockphoto.HTMLUtil.ConvertToPriceString=function( priceStr, bForScript )
{
var r=["",""], o, i, currencyType, ret={};
// --- Internal -----
this.initialize=function()
{
var currencyType, dt, Script, CurrStr
try
{
if( stockphoto.core.BoxCar.AnalyzeXmlFileObj == undefined )
{
if( stockphoto.core.init.partnersXMLfsObj == undefined )
{
stockphoto.core.init.checkPartnersXML();
}
if( stockphoto.core.init.partnersXMLfsObj != undefined )
{
stockphoto.core.BoxCar.AnalyzeXmlFileObj = new stockphoto.core.BoxCar.AnalyzeXmlFile( stockphoto.core.init.partnersXMLfsObj, stockphoto.core.BoxCar.HTMLUtil.CheckKeys );
}
}
if( stockphoto.core.BoxCar.AnalyzeXmlFileObj == undefined )
{
throw( "1" );
}
currencyType = ( stockphoto.DL.getCurrencyType() ).toUpperCase(); // "USD","GBP","JPY" or "EUR"
Script = "dt="+ "stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].AdobeSupports[0].PriceList[0]."+(currencyType.toUpperCase()) +";";
eval( Script );
if( dt == undefined )
{
throw( "2" );
}
this.p0 = parseInt( dt.p0 ); // index of CurrStr table
this.p1 = dt.p1; // '0" place sysbol before digits, "1" after
this.p2 = parseInt( dt.p2 ); // # of spaces between symbol and digits
this.p3 = parseInt( dt.p3 ); // # of decimal places
this.p4 = dt.p4; // '0' decimal point = '.', '1'=','
this.p5 = dt.p5; // 3 digits symbol: '0'='.', '1'=',' and '2'=' '
this.justify = dt.justify; // "right, "left", "both"
CurrStr = stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].AdobeSupports[0].PriceList[0].PriceSymbolsForScript.Value;
this.ScriptSymbol = stockphoto.HTMLUtil.ChangeSymbol( CurrStr, this.p0 );
CurrStr = stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].AdobeSupports[0].PriceList[0].PriceSymbolsForHtml.Value;
this.HtmlSymbol = stockphoto.HTMLUtil.ChangeSymbol( CurrStr, this.p0 );
this.initialized = true;
this.currencyType = currencyType;
} catch(e) {
this.initialized = false;
}
}
// --- Internal -----
this.formatPrice=function( priceStr, nOfDecPnt, DecPntType, ThousandType )
{
var s, p, imax, ch, out, k, i, imax, v = parseFloat( priceStr );
switch( nOfDecPnt )
{
case 0: v += 0.5; break;
case 1: v += 0.05; break;
default: v += 0.005;
}
if( v <= 0 )
v = 0;
s = v.toString();
p = s.indexOf( "." );
if( p < 0 )
{
s += ".";
p = s.indexOf( "." );
};
s += "000";
switch( nOfDecPnt )
{
case 0: imax = p; break;
default: imax = p + 1 + nOfDecPnt;
}
switch( ThousandType )
{
case '2': ch = ' '; break;
case '1': ch = ','; break;
default: ch = '.';
}
out = "";
k = p % 3;
for( i=0; i