Commit debc7ec4c2484563470d802552befc20a4714d34

Authored by Georg Hopp
1 parent 62e6b75f

--no commit message

  1 +if (typeof (nBildertool) === 'undefined')
  2 + nBildertool = {};
  3 +
  4 +nBildertool.cbCommon = function ()
  5 +{
  6 + switch (nBildertool.req.readyState)
  7 + {
  8 + case 4:
  9 + if (nBildertool.req.status != 200)
  10 + alert ("Fehler:" + nBildertool.req.status);
  11 + else
  12 + data = nBildertool.deXmlify (nBildertool.req.responseXML);
  13 +
  14 + return true;
  15 +
  16 + default:
  17 + return false;
  18 + }
  19 +}
... ...
  1 +function c_GalleryThumb (thu, cat, tit, tex, u)
  2 +{
  3 + var thumb = thu;
  4 + var cat = cat;
  5 + var title = tit;
  6 + var text = tex;
  7 + var url = u;
  8 +
  9 + this.getThumb = function () { return thumb; }
  10 + this.getCat = function () { return cat; }
  11 + this.getTitle = function () { return title; }
  12 + this.getText = function () { return text; }
  13 + this.getUrl = function () { return url; }
  14 +}
  15 +
  16 +function c_GalleryThumbs (_id, data, pos, _count)
  17 +{
  18 + var thumbs = new Array ();
  19 + var startIdx = pos;
  20 + var id = _id;
  21 + var count = _count;
  22 +
  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 + // Dies kann warscheinlich auch raus aus c_GalleryThumbs
  36 + this.popup = function (i)
  37 + {
  38 + url = document.getElementById (id+'_BG_URL1_'+i).href;
  39 + thumbs = eval ();
  40 +
  41 + if (url.match (/javascript:ftvlaunch\(/))
  42 + {
  43 + expr = /\(([0-9]+),\s*([0-9]+),\s*'(.+)'\)/;
  44 + expr.exec (url);
  45 +
  46 + ftvlaunch (RegExp.$1, RegExp.$2, RegExp.$3);
  47 + return false;
  48 + }
  49 +
  50 + return popup (document.getElementById (id+'_BG_URL1_'+i).href);
  51 + }
  52 + // -----
  53 +
  54 + function changeDisplay (client)
  55 + {
  56 + for (i = 0; i < count; i++)
  57 + {
  58 + idx = i + startIdx;
  59 +
  60 + if (idx > (thumbs.length - 1))
  61 + idx -= thumbs.length;
  62 +
  63 + thumb = thumbs[idx].getThumb ();
  64 + cat = thumbs[idx].getCat ();
  65 + title = thumbs[idx].getTitle ();
  66 + text = thumbs[idx].getText ();
  67 + url = thumbs[idx].getUrl ();
  68 +
  69 + document.getElementById (id+'_BG_THUMB'+i).src = thumb;
  70 +
  71 + node = document.getElementById (id+'_BG_CAT'+i);
  72 + node.firstChild.data = cat;
  73 + node = document.getElementById (id+'_BG_TITLE'+i);
  74 + node.firstChild.data = title;
  75 + node = document.getElementById (id+'_BG_TEXT'+i);
  76 + node.firstChild.data = text;
  77 +
  78 + document.getElementById (id+'_BG_URL1_'+i).href =
  79 + url + '?em_client=' + client;
  80 + document.getElementById (id+'_BG_URL2_'+i).href =
  81 + url + '?em_client=' + client;
  82 + }
  83 + }
  84 +
  85 + this.incGallery = function (client)
  86 + {
  87 + startIdx = (startIdx == (thumbs.length - count)) ?
  88 + thumbs.length - count : startIdx + 1;
  89 +
  90 + changeDisplay (client);
  91 +
  92 + return false;
  93 + }
  94 +
  95 + this.decGallery = function (client)
  96 + {
  97 + startIdx = (startIdx == 0) ? 0 : startIdx - 1;
  98 +
  99 + changeDisplay (client);
  100 +
  101 + return false;
  102 + }
  103 +}
... ...
  1 +if (typeof (nBildertool) === 'undefined')
  2 + nBildertool = {};
  3 +
  4 +nBildertool.extend = function (subClass, baseClass)
  5 +{
  6 + function inheritance() {}
  7 + inheritance.prototype = baseClass.prototype;
  8 +
  9 + subClass.prototype = new inheritance();
  10 + subClass.prototype.constructor = subClass;
  11 + subClass.baseConstructor = baseClass;
  12 + subClass.superClass = baseClass.prototype;
  13 +}
  14 +
... ...
  1 +if (typeof (nBildertool) === 'undefined')
  2 + nBildertool = {};
  3 +
  4 +nBildertool.req = null;
  5 +
  6 +nBildertool.service = function (url, callback)
  7 +{
  8 + // erstellen des requests
  9 +
  10 + try
  11 + {
  12 + nBildertool.req = new XMLHttpRequest();
  13 + }
  14 + catch (e)
  15 + {
  16 + try
  17 + {
  18 + nBildertool.req = new ActiveXObject("Msxml2.XMLHTTP");
  19 + }
  20 + catch (e)
  21 + {
  22 + try
  23 + {
  24 + nBildertool.req = new ActiveXObject("Microsoft.XMLHTTP");
  25 + }
  26 + catch (failed)
  27 + {
  28 + nBildertool.req = null;
  29 + }
  30 + }
  31 + }
  32 +
  33 + if (nBildertool.req == null)
  34 + alert("Error creating request object!");
  35 +
  36 + nBildertool.req.open("GET", url, true);
  37 +
  38 + // Beim abschliessen des request wird diese Funktion ausgeführt
  39 + if (typeof (callback) === 'undefined')
  40 + nBildertool.req.onreadystatechange = nBildertool.cbCommon;
  41 + else
  42 + nBildertool.req.onreadystatechange = callback;
  43 +
  44 + nBildertool.req.setRequestHeader("Content-Type",
  45 + "application/x-www-form-urlencoded");
  46 +
  47 + nBildertool.req.send(null);
  48 +}
... ...
  1 +if (typeof (nBildertool) === 'undefined')
  2 + nBildertool = {};
  3 +
  4 +if (typeof (FRONT_URL) === 'undefined')
  5 + FRONT_URL = 'http://foto.westfaelische-nachrichten.de/';
  6 +
  7 +// strecke wird ausschliesslich ueber einen entsprechenden xml Datensatz
  8 +// gefuellt.
  9 +nBildertool.strecke = function (data)
  10 +{
  11 + this.streckeId = null;
  12 + this.date = null;
  13 + this.showDate = null;
  14 + this.titel = null;
  15 + this.prio = null;
  16 + this.sektionen = null;
  17 + this.template = null;
  18 + this.ordnerId = null;
  19 + this.connectionId = null;
  20 + this.flags = null;
  21 + this.l0Id = null;
  22 + this.l1Id = null;
  23 + this.l2Id = null;
  24 + this.l3Id = null;
  25 + this.ordnerName = null;
  26 + this.viewFoto = null;
  27 + this.viewIndex = null;
  28 + this.downloads = null;
  29 + this.ffId = null;
  30 + this.ffBildzeile = null;
  31 + this.ffCopy = null;
  32 + this.ffSId = null;
  33 + this.ffSBildzeile = null;
  34 + this.ffSCopy = null;
  35 + this.fotoCount = null;
  36 + this.path = null;
  37 +
  38 + function getOrdnerInfo (value, idx)
  39 + {
  40 + var val = value.split ('|%|');
  41 + if (typeof (idx) === 'undefined') return val;
  42 + return val[idx];
  43 + }
  44 +
  45 + function getOrdnerId (idx)
  46 + {
  47 + return getOrdnerInfo (this.ordnerId, idx);
  48 + }
  49 + function getConnectionId (idx)
  50 + {
  51 + return getOrdnerInfo (this.connectionId, idx);
  52 + }
  53 + function getFlags (idx)
  54 + {
  55 + return getOrdnerInfo (this.flags, idx);
  56 + }
  57 + function getL0Id (idx)
  58 + {
  59 + return getOrdnerInfo (this.l0Id, idx);
  60 + }
  61 + function getL1Id (idx)
  62 + {
  63 + return getOrdnerInfo (this.l1Id, idx);
  64 + }
  65 + function getL2Id (idx)
  66 + {
  67 + return getOrdnerInfo (this.l2Id, idx);
  68 + }
  69 + function getL3Id (idx)
  70 + {
  71 + return getOrdnerInfo (this.l3Id, idx);
  72 + }
  73 + function getOrdnerName (idx)
  74 + {
  75 + return getOrdnerInfo (this.ordnerName, idx);
  76 + }
  77 +
  78 + this.getTeaserUrl = function ()
  79 + {
  80 + var teaserPath =
  81 + escape (this.titel) + '/' +
  82 + this.streckeId.substr (this.streckeId.length-2) + '/' +
  83 + this.streckeId;
  84 +
  85 + return FRONT_URL + teaserPath + '.jpeg';
  86 + }
  87 +
  88 + this.getThumbUrl = function ()
  89 + {
  90 + return FRONT_URL + this.path + 'T.jpeg';
  91 + }
  92 +
  93 + this.getScreenUrl = function ()
  94 + {
  95 + return FRONT_URL + this.path + 'S.jpeg';
  96 + }
  97 +
  98 + this.getDownlUrl = function ()
  99 + {
  100 + return FRONT_URL + this.path + '.jpeg';
  101 + }
  102 +
  103 + this.getShowUrl = function ()
  104 + {
  105 + return FRONT_URL + this.path + '.html';
  106 + }
  107 +
  108 + nBildertool.strecke.baseConstructor.call (this, data);
  109 +}
  110 +
  111 +nBildertool.extend (nBildertool.strecke, nBildertool.c_xmlify);
... ...
  1 +if (typeof (nBildertool) === 'undefined')
  2 + nBildertool = {};
  3 +
  4 +nBildertool.xmlToVar = function (data)
  5 +{
  6 + if (!data.hasChildNodes ())
  7 + return null;
  8 +
  9 + var ret = null;
  10 +
  11 + for (var node in data.childNodes)
  12 + {
  13 + var child = data.childNodes[node];
  14 +
  15 + if (child.nodeType === 3 && child.nodeValue !== null)
  16 + {
  17 + ret = data.childNodes[node].nodeValue;
  18 + break;
  19 + }
  20 + }
  21 +
  22 + switch (data.getAttribute ('type'))
  23 + {
  24 + case 'integer': ret = parseInt (ret, 10); break;
  25 + case 'double': ret = parseFloat (ret);
  26 + }
  27 +
  28 + return ret;
  29 +}
  30 +
  31 +nBildertool.xmlToObjectArray = function (data)
  32 +{
  33 + var ret = new Array ();
  34 +
  35 + if (! data.hasChildNodes ())
  36 + return ret;
  37 +
  38 + for (var node in data.childNodes)
  39 + {
  40 + var child = data.childNodes[node];
  41 +
  42 + if (child.nodeType === 1)
  43 + {
  44 + name = child.getAttribute ('name');
  45 +
  46 + switch (child.nodeName)
  47 + {
  48 + case 'variable':
  49 + ret[name] = nBildertool.xmlToVar (child); break;
  50 + case 'array':
  51 + ret[name] = nBildertool.xmlToArray (child); break;
  52 + case 'class':
  53 + var cName = child.getAttribute ('class');
  54 +
  55 + switch (cName)
  56 + {
  57 + case 'c_picToolStrecke_new3':
  58 + ret[name] = new nBildertool.strecke (child);
  59 + break;
  60 +
  61 + default:
  62 + ret[name] = nBildertool.xmlToObjectArray (child);
  63 + }
  64 + }
  65 + }
  66 + }
  67 +
  68 + return ret;
  69 +}
  70 +
  71 +nBildertool.xmlToArray = function (data)
  72 +{
  73 + var ret = new Array ();
  74 +
  75 + if (! data.hasChildNodes ())
  76 + return ret;
  77 +
  78 + for (var node in data.childNodes)
  79 + {
  80 + var child = data.childNodes[node];
  81 +
  82 + if (child.nodeType === 1 && child.nodeName === 'item')
  83 + {
  84 + var key = child.getAttribute ('key');
  85 +
  86 + for (var _node in child.childNodes)
  87 + {
  88 + var _child = child.childNodes[_node];
  89 +
  90 + if (_child.nodeType === 1)
  91 + {
  92 + switch (_child.nodeName)
  93 + {
  94 + case 'variable':
  95 + ret[key] = nBildertool.xmlToVar (_child); break;
  96 + case 'array':
  97 + ret[key] = nBildertool.xmlToArray (_child); break;
  98 + case 'class':
  99 + var cName = child.getAttribute ('class');
  100 +
  101 + switch (cName)
  102 + {
  103 + case 'c_picToolStrecke_new3':
  104 + ret[key] = new nBildertool.strecke (_child);
  105 + break;
  106 +
  107 + default:
  108 + ret[key] = nBildertool.xmlToObjectArray (_child);
  109 + }
  110 + }
  111 + }
  112 + }
  113 + }
  114 + }
  115 +
  116 + return ret;
  117 +}
  118 +
  119 +nBildertool.c_xmlify = function (data)
  120 +{
  121 + if (! data.hasChildNodes ())
  122 + return;
  123 +
  124 + for (var node in data.childNodes)
  125 + {
  126 + var child = data.childNodes[node];
  127 +
  128 + if (child.nodeType === 1)
  129 + {
  130 + var name = child.getAttribute ('name');
  131 +
  132 + if (typeof (this[name]) !== 'undefined')
  133 + {
  134 + switch (child.nodeName)
  135 + {
  136 + case 'variable':
  137 + this[name] = nBildertool.xmlToVar (child); break;
  138 + case 'array':
  139 + this[name] = nBildertool.xmlToArray (child); break;
  140 + case 'class':
  141 + var cName = child.getAttribute ('class');
  142 +
  143 + switch (cName)
  144 + {
  145 + case 'c_picToolStrecke_new3':
  146 + this[name] = new nBildertool.strecke (child);
  147 + break;
  148 +
  149 + default:
  150 + this[name] = nBildertool.xmlToObjectArray (child);
  151 + }
  152 + }
  153 + }
  154 + }
  155 + }
  156 +}
  157 +
  158 +nBildertool.deXmlify = function (data)
  159 +{
  160 + var ret = null;
  161 + var child = data.firstChild;
  162 +
  163 + switch (child.nodeName)
  164 + {
  165 + case 'variable':
  166 + ret = nBildertool.xmlToVar (child); break;
  167 + case 'array':
  168 + ret = nBildertool.xmlToArray (child); break;
  169 + case 'class':
  170 + var cName = child.getAttribute ('class');
  171 +
  172 + switch (cName)
  173 + {
  174 + case 'c_picToolStrecke_new3':
  175 + ret = new nBildertool.strecke (child);
  176 + break;
  177 +
  178 + default:
  179 + ret = nBildertool.xmlToObjectArray (child);
  180 + }
  181 + }
  182 +
  183 + return ret;
  184 +}
... ...
Please register or login to post a comment