strecke.js 3.01 KB
if (typeof (nBildertool) === 'undefined')
	nBildertool = {};

if (typeof (FRONT_URL) === 'undefined')
	FRONT_URL = 'http://foto.westfaelische-nachrichten.de/';

// strecke wird ausschliesslich ueber einen entsprechenden xml Datensatz
// gefuellt.
nBildertool.strecke = function (data)
{
	this.streckeId = null;
	this.date = null;
	this.showDate = null;
	this.titel = null;
	this.prio = null;
	this.sektionen = null;
	this.template = null;
	this.ordnerId = null;
	this.connectionId = null;
	this.flags = null;
	this.l0Id = null;
	this.l1Id = null;
	this.l2Id = null;
	this.l3Id = null;
	this.ordnerName = null;
	this.viewFoto = null;
	this.viewIndex = null;
	this.downloads = null;
	this.ffId = null;
	this.ffBildzeile = null;
	this.ffCopy = null;
	this.ffSId = null;
	this.ffSBildzeile = null;
	this.ffSCopy = null;
	this.fotoCount = null;
	this.path = null;

	SPECIAL_CHARS = Array (
			/ /g, /ä/g, /ü/g, /ö/g, /Ä/g, /Ü/g, /Ö/g, /ß/g,
			/\./g, /:/g, /\!/g, /\?/g, /\,/g,
			/`/g, /"/g, /\'/g,
			/é/g, /è/g, /á/g, /à/g, /ó/g, 
			/É/g, /Á/g, /Ó/g, /È/g, /À/g, /Ò/g,
			/EUR/g, /¢/g, /\$/g,
			/@/g, /%/g, /&/g, /\+/g, /§/g, /\(/g, /\)/g);

	SPECIAL_CHARS_MAP = Array (
			'_', 'ae', 'ue', 'oe', 'Ae', 'Ue', 'Oe', 'ss',
			'', '', '', '', '',
			'', '', '',
			'e', 'e', 'a', 'a', 'o',
			'E', 'A', 'O', 'E', 'A', 'O',
			'_euro_', '_cent_', '_dollar_',
			'_at_', '_prozent_', '_und_', '_und_', '_paragraph_', '', '');

	function getOrdnerInfo (value, idx)
	{
		var val = value.split ('|%|');
		if (typeof (idx) === 'undefined') return val;
		return val[idx];
	}

	this.getOrdnerId = function (idx)
	{
		return getOrdnerInfo (this.ordnerId, idx);
	}
	this.getConnectionId = function (idx)
	{
		return getOrdnerInfo (this.connectionId, idx);
	}
	this.getFlags = function (idx)
	{
		return getOrdnerInfo (this.flags, idx);
	}
	this.getL0Id = function (idx)
	{
		return getOrdnerInfo (this.l0Id, idx);
	}
	this.getL1Id = function (idx)
	{
		return getOrdnerInfo (this.l1Id, idx);
	}
	this.getL2Id = function (idx)
	{
		return getOrdnerInfo (this.l2Id, idx);
	}
	this.getL3Id = function (idx)
	{
		return getOrdnerInfo (this.l3Id, idx);
	}
	this.getOrdnerName = function (idx)
	{
		return getOrdnerInfo (this.ordnerName, idx);
	}

	this.getTeaserUrl = function ()
	{
		var teaserPath =
			escape (this.titel) + '/' + 
			this.streckeId.substr (this.streckeId.length-2) + '/' +
			this.streckeId;

		return FRONT_URL + teaserPath + '.jpeg';
	}

	this.getPath = function ()
	{
		var path = this.path;

		for (i in SPECIAL_CHARS)
			path = path.replace (SPECIAL_CHARS[i], SPECIAL_CHARS_MAP[i]);

		return path;
	}

	this.getThumbUrl = function ()
	{
		return FRONT_URL + this.getPath () + 'T.jpeg';
	}

	this.getScreenUrl = function ()
	{
		return FRONT_URL + this.getPath () + 'S.jpeg';
	}

	this.getDownlUrl = function ()
	{
		return FRONT_URL + this.getPath () + '.jpeg';
	}

	this.getShowUrl = function ()
	{
		return FRONT_URL + this.getPath () + '.html';
	}

	nBildertool.strecke.baseConstructor.call (this, data);
}

nBildertool.extend (nBildertool.strecke, nBildertool.c_xmlify);