Commit 2dce460b6d47d42be46cf73988462cbe743cbd60

Authored by Georg Hopp
1 parent debc7ec4

--no commit message

  1 +// Daten zu einem einzelnen Teaser
1 2 function c_GalleryThumb (thu, cat, tit, tex, u)
2 3 {
3 4 var thumb = thu;
... ... @@ -13,30 +14,19 @@ function c_GalleryThumb (thu, cat, tit, tex, u)
13 14 this.getUrl = function () { return url; }
14 15 }
15 16
16   -function c_GalleryThumbs (_id, data, pos, _count)
  17 +// Container fuer alle Teaser wird via ajax ueber den picToolService
  18 +// gefuellt.
  19 +function c_GalleryThumbs (_id, pos, _count)
17 20 {
18 21 var thumbs = new Array ();
19 22 var startIdx = pos;
20 23 var id = _id;
21 24 var count = _count;
22 25
23   - for (var d in data)
24   - {
25   - var expr = /(.*) [^ ]*$/;
26   - thumbs.push (
27   - new c_GalleryThumb (
28   - d.getThumbUrl (),
29   - d.getOrdnerName (0).toUpperCase (),
30   - d.titel,
31   - d.ffBildzeile+' '.substr (0, 100).replace (expr, '$1...'),
32   - d.getShowUrl ()));
33   - }
34   -
35 26 // Dies kann warscheinlich auch raus aus c_GalleryThumbs
36 27 this.popup = function (i)
37 28 {
38 29 url = document.getElementById (id+'_BG_URL1_'+i).href;
39   - thumbs = eval ();
40 30
41 31 if (url.match (/javascript:ftvlaunch\(/))
42 32 {
... ... @@ -89,6 +79,16 @@ function c_GalleryThumbs (_id, data, pos, _count)
89 79
90 80 changeDisplay (client);
91 81
  82 + if (thumbs.length - (startIdx + count) === 4)
  83 + {
  84 + nBildertool.callback = this.callback;
  85 + var url = 'http://georgs_test/_module/bildertool/' +
  86 + 'fakeFotoService.php?' +
  87 + 'action=latest&cnt=3&limit=10&lfrom=' + thumbs.length +
  88 + '&omit=3,7';
  89 + nBildertool.service (url);
  90 + }
  91 +
92 92 return false;
93 93 }
94 94
... ... @@ -100,4 +100,40 @@ function c_GalleryThumbs (_id, data, pos, _count)
100 100
101 101 return false;
102 102 }
  103 +
  104 + this.callback = function ()
  105 + {
  106 + switch (nBildertool.req.readyState)
  107 + {
  108 + case 4:
  109 + if (nBildertool.req.status != 200)
  110 + alert ("Fehler:" + nBildertool.req.status);
  111 + else
  112 + {
  113 + var data = nBildertool.deXmlify (nBildertool.req.responseXML);
  114 + for (d in data['data'])
  115 + {
  116 + var expr = /(.*) [^ ]*$/;
  117 + thumbs.push (
  118 + new c_GalleryThumb (
  119 + data['data'][d].getThumbUrl (),
  120 + data['data'][d].getOrdnerName (0).toUpperCase (),
  121 + data['data'][d].titel,
  122 + data['data'][d].ffBildzeile+
  123 + ' '.substr (0, 100).replace (expr, '$1...'),
  124 + data['data'][d].getShowUrl ()));
  125 + }
  126 + }
  127 + return true;
  128 +
  129 + default:
  130 + return false;
  131 + }
  132 + }
  133 +
  134 + nBildertool.callback = this.callback;
  135 + var url = 'http://georgs_test/_module/bildertool/fakeFotoService.php?' +
  136 + 'action=latest&cnt=3&limit=' + (startIdx+count+5) + '&lfrom=0' +
  137 + '&omit=3,7';
  138 + nBildertool.service (url);
103 139 }
... ...
... ... @@ -2,6 +2,7 @@ if (typeof (nBildertool) === 'undefined')
2 2 nBildertool = {};
3 3
4 4 nBildertool.req = null;
  5 +nBildertool.callback = undefined;
5 6
6 7 nBildertool.service = function (url, callback)
7 8 {
... ... @@ -36,10 +37,10 @@ nBildertool.service = function (url, callback)
36 37 nBildertool.req.open("GET", url, true);
37 38
38 39 // Beim abschliessen des request wird diese Funktion ausgeführt
39   - if (typeof (callback) === 'undefined')
  40 + if (typeof (nBildertool.callback) === 'undefined')
40 41 nBildertool.req.onreadystatechange = nBildertool.cbCommon;
41 42 else
42   - nBildertool.req.onreadystatechange = callback;
  43 + nBildertool.req.onreadystatechange = nBildertool.callback;
43 44
44 45 nBildertool.req.setRequestHeader("Content-Type",
45 46 "application/x-www-form-urlencoded");
... ...
... ... @@ -35,6 +35,24 @@ nBildertool.strecke = function (data)
35 35 this.fotoCount = null;
36 36 this.path = null;
37 37
  38 + SPECIAL_CHARS = Array (
  39 + / /g, /ä/g, /ü/g, /ö/g, /Ä/g, /Ü/g, /Ö/g, /ß/g,
  40 + /\./g, /:/g, /\!/g, /\?/g, /\,/g,
  41 + /`/g, /"/g, /\'/g,
  42 + /é/g, /è/g, /á/g, /à/g, /ó/g,
  43 + /É/g, /Á/g, /Ó/g, /È/g, /À/g, /Ò/g,
  44 + /EUR/g, /¢/g, /\$/g,
  45 + /@/g, /%/g, /&/g, /\+/g, /§/g, /\(/g, /\)/g);
  46 +
  47 + SPECIAL_CHARS_MAP = Array (
  48 + '_', 'ae', 'ue', 'oe', 'Ae', 'Ue', 'Oe', 'ss',
  49 + '', '', '', '', '',
  50 + '', '', '',
  51 + 'e', 'e', 'a', 'a', 'o',
  52 + 'E', 'A', 'O', 'E', 'A', 'O',
  53 + '_euro_', '_cent_', '_dollar_',
  54 + '_at_', '_prozent_', '_und_', '_und_', '_paragraph_', '', '');
  55 +
38 56 function getOrdnerInfo (value, idx)
39 57 {
40 58 var val = value.split ('|%|');
... ... @@ -42,35 +60,35 @@ nBildertool.strecke = function (data)
42 60 return val[idx];
43 61 }
44 62
45   - function getOrdnerId (idx)
  63 + this.getOrdnerId = function (idx)
46 64 {
47 65 return getOrdnerInfo (this.ordnerId, idx);
48 66 }
49   - function getConnectionId (idx)
  67 + this.getConnectionId = function (idx)
50 68 {
51 69 return getOrdnerInfo (this.connectionId, idx);
52 70 }
53   - function getFlags (idx)
  71 + this.getFlags = function (idx)
54 72 {
55 73 return getOrdnerInfo (this.flags, idx);
56 74 }
57   - function getL0Id (idx)
  75 + this.getL0Id = function (idx)
58 76 {
59 77 return getOrdnerInfo (this.l0Id, idx);
60 78 }
61   - function getL1Id (idx)
  79 + this.getL1Id = function (idx)
62 80 {
63 81 return getOrdnerInfo (this.l1Id, idx);
64 82 }
65   - function getL2Id (idx)
  83 + this.getL2Id = function (idx)
66 84 {
67 85 return getOrdnerInfo (this.l2Id, idx);
68 86 }
69   - function getL3Id (idx)
  87 + this.getL3Id = function (idx)
70 88 {
71 89 return getOrdnerInfo (this.l3Id, idx);
72 90 }
73   - function getOrdnerName (idx)
  91 + this.getOrdnerName = function (idx)
74 92 {
75 93 return getOrdnerInfo (this.ordnerName, idx);
76 94 }
... ... @@ -85,24 +103,34 @@ nBildertool.strecke = function (data)
85 103 return FRONT_URL + teaserPath + '.jpeg';
86 104 }
87 105
  106 + this.getPath = function ()
  107 + {
  108 + var path = this.path;
  109 +
  110 + for (i in SPECIAL_CHARS)
  111 + path = path.replace (SPECIAL_CHARS[i], SPECIAL_CHARS_MAP[i]);
  112 +
  113 + return path;
  114 + }
  115 +
88 116 this.getThumbUrl = function ()
89 117 {
90   - return FRONT_URL + this.path + 'T.jpeg';
  118 + return FRONT_URL + this.getPath () + 'T.jpeg';
91 119 }
92 120
93 121 this.getScreenUrl = function ()
94 122 {
95   - return FRONT_URL + this.path + 'S.jpeg';
  123 + return FRONT_URL + this.getPath () + 'S.jpeg';
96 124 }
97 125
98 126 this.getDownlUrl = function ()
99 127 {
100   - return FRONT_URL + this.path + '.jpeg';
  128 + return FRONT_URL + this.getPath () + '.jpeg';
101 129 }
102 130
103 131 this.getShowUrl = function ()
104 132 {
105   - return FRONT_URL + this.path + '.html';
  133 + return FRONT_URL + this.getPath () + '.html';
106 134 }
107 135
108 136 nBildertool.strecke.baseConstructor.call (this, data);
... ...
... ... @@ -96,7 +96,7 @@ nBildertool.xmlToArray = function (data)
96 96 case 'array':
97 97 ret[key] = nBildertool.xmlToArray (_child); break;
98 98 case 'class':
99   - var cName = child.getAttribute ('class');
  99 + var cName = _child.getAttribute ('class');
100 100
101 101 switch (cName)
102 102 {
... ...
Please register or login to post a comment