From 2dce460b6d47d42be46cf73988462cbe743cbd60 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Wed, 7 Nov 2007 21:33:19 +0000 Subject: [PATCH] --- js/bildertool/galleryThumbs.js | 64 ++++++++++++++++++++++++++-------- js/bildertool/service.js | 5 +-- js/bildertool/strecke.js | 52 ++++++++++++++++++++------- js/bildertool/xmlify.js | 2 +- 4 files changed, 94 insertions(+), 29 deletions(-) diff --git a/js/bildertool/galleryThumbs.js b/js/bildertool/galleryThumbs.js index ae53c93..cc203ea 100644 --- a/js/bildertool/galleryThumbs.js +++ b/js/bildertool/galleryThumbs.js @@ -1,3 +1,4 @@ +// Daten zu einem einzelnen Teaser function c_GalleryThumb (thu, cat, tit, tex, u) { var thumb = thu; @@ -13,30 +14,19 @@ function c_GalleryThumb (thu, cat, tit, tex, u) this.getUrl = function () { return url; } } -function c_GalleryThumbs (_id, data, pos, _count) +// Container fuer alle Teaser wird via ajax ueber den picToolService +// gefuellt. +function c_GalleryThumbs (_id, pos, _count) { var thumbs = new Array (); var startIdx = pos; var id = _id; var count = _count; - for (var d in data) - { - var expr = /(.*) [^ ]*$/; - thumbs.push ( - new c_GalleryThumb ( - d.getThumbUrl (), - d.getOrdnerName (0).toUpperCase (), - d.titel, - d.ffBildzeile+' '.substr (0, 100).replace (expr, '$1...'), - d.getShowUrl ())); - } - // Dies kann warscheinlich auch raus aus c_GalleryThumbs this.popup = function (i) { url = document.getElementById (id+'_BG_URL1_'+i).href; - thumbs = eval (); if (url.match (/javascript:ftvlaunch\(/)) { @@ -89,6 +79,16 @@ function c_GalleryThumbs (_id, data, pos, _count) changeDisplay (client); + if (thumbs.length - (startIdx + count) === 4) + { + nBildertool.callback = this.callback; + var url = 'http://georgs_test/_module/bildertool/' + + 'fakeFotoService.php?' + + 'action=latest&cnt=3&limit=10&lfrom=' + thumbs.length + + '&omit=3,7'; + nBildertool.service (url); + } + return false; } @@ -100,4 +100,40 @@ function c_GalleryThumbs (_id, data, pos, _count) return false; } + + this.callback = function () + { + switch (nBildertool.req.readyState) + { + case 4: + if (nBildertool.req.status != 200) + alert ("Fehler:" + nBildertool.req.status); + else + { + var data = nBildertool.deXmlify (nBildertool.req.responseXML); + for (d in data['data']) + { + var expr = /(.*) [^ ]*$/; + thumbs.push ( + new c_GalleryThumb ( + data['data'][d].getThumbUrl (), + data['data'][d].getOrdnerName (0).toUpperCase (), + data['data'][d].titel, + data['data'][d].ffBildzeile+ + ' '.substr (0, 100).replace (expr, '$1...'), + data['data'][d].getShowUrl ())); + } + } + return true; + + default: + return false; + } + } + + nBildertool.callback = this.callback; + var url = 'http://georgs_test/_module/bildertool/fakeFotoService.php?' + + 'action=latest&cnt=3&limit=' + (startIdx+count+5) + '&lfrom=0' + + '&omit=3,7'; + nBildertool.service (url); } diff --git a/js/bildertool/service.js b/js/bildertool/service.js index bfcbca1..a42bf6c 100644 --- a/js/bildertool/service.js +++ b/js/bildertool/service.js @@ -2,6 +2,7 @@ if (typeof (nBildertool) === 'undefined') nBildertool = {}; nBildertool.req = null; +nBildertool.callback = undefined; nBildertool.service = function (url, callback) { @@ -36,10 +37,10 @@ nBildertool.service = function (url, callback) nBildertool.req.open("GET", url, true); // Beim abschliessen des request wird diese Funktion ausgeführt - if (typeof (callback) === 'undefined') + if (typeof (nBildertool.callback) === 'undefined') nBildertool.req.onreadystatechange = nBildertool.cbCommon; else - nBildertool.req.onreadystatechange = callback; + nBildertool.req.onreadystatechange = nBildertool.callback; nBildertool.req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); diff --git a/js/bildertool/strecke.js b/js/bildertool/strecke.js index c6cc706..eb5d1a6 100644 --- a/js/bildertool/strecke.js +++ b/js/bildertool/strecke.js @@ -35,6 +35,24 @@ nBildertool.strecke = function (data) 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 ('|%|'); @@ -42,35 +60,35 @@ nBildertool.strecke = function (data) return val[idx]; } - function getOrdnerId (idx) + this.getOrdnerId = function (idx) { return getOrdnerInfo (this.ordnerId, idx); } - function getConnectionId (idx) + this.getConnectionId = function (idx) { return getOrdnerInfo (this.connectionId, idx); } - function getFlags (idx) + this.getFlags = function (idx) { return getOrdnerInfo (this.flags, idx); } - function getL0Id (idx) + this.getL0Id = function (idx) { return getOrdnerInfo (this.l0Id, idx); } - function getL1Id (idx) + this.getL1Id = function (idx) { return getOrdnerInfo (this.l1Id, idx); } - function getL2Id (idx) + this.getL2Id = function (idx) { return getOrdnerInfo (this.l2Id, idx); } - function getL3Id (idx) + this.getL3Id = function (idx) { return getOrdnerInfo (this.l3Id, idx); } - function getOrdnerName (idx) + this.getOrdnerName = function (idx) { return getOrdnerInfo (this.ordnerName, idx); } @@ -85,24 +103,34 @@ nBildertool.strecke = function (data) 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.path + 'T.jpeg'; + return FRONT_URL + this.getPath () + 'T.jpeg'; } this.getScreenUrl = function () { - return FRONT_URL + this.path + 'S.jpeg'; + return FRONT_URL + this.getPath () + 'S.jpeg'; } this.getDownlUrl = function () { - return FRONT_URL + this.path + '.jpeg'; + return FRONT_URL + this.getPath () + '.jpeg'; } this.getShowUrl = function () { - return FRONT_URL + this.path + '.html'; + return FRONT_URL + this.getPath () + '.html'; } nBildertool.strecke.baseConstructor.call (this, data); diff --git a/js/bildertool/xmlify.js b/js/bildertool/xmlify.js index 5a8ec65..4f18483 100644 --- a/js/bildertool/xmlify.js +++ b/js/bildertool/xmlify.js @@ -96,7 +96,7 @@ nBildertool.xmlToArray = function (data) case 'array': ret[key] = nBildertool.xmlToArray (_child); break; case 'class': - var cName = child.getAttribute ('class'); + var cName = _child.getAttribute ('class'); switch (cName) {