/** *

Title: eflactumrss.js

*

Description: Widget EFL ACtum

*

Copyright: Copyright (c) 2008

*

Company: ARioN32

* @author Kiko Fdez * @version 1.0 - 03/12/2008 */ var sCapaActualizar11 var sUrlApp11 = 'http://individual.es.efl.fr/ActumPublic/ActumRss'; var sUrlFeed11 = sUrlApp11 + 'feedActum.jsp?id_materias=11'; // Backend url //var sUrlFeed = 'http://estest1.efl.fr/ActumPublic/ActumRss/feedActum.jsp?id_materias=11'; // Backend url window.setInterval("update_timer11()", 1200000); // update the data every 20 mins function getDomAdapter() { var adapter = ''; if ('undefined' != typeof ActiveXObject) { adapter = 'MS'; } else if ('undefined' != typeof document && document.implementation && document.implementation.createDocument && 'undefined' != typeof DOMParser) { adapter = 'default'; } switch (adapter) { case 'MS': return new (function () { this.createDocument = function () { var names = ["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]; for (var key in names) { try { return new ActiveXObject(names[key]); } catch (e) {} } throw new Error('Unable to create DOMDocument'); }; this.serialize = function (doc) { return doc.xml; }; this.parseXml = function (xml) { var doc = this.createDocument(); if (!doc.loadXML(xml)) { throw new Error('Parse error'); } return doc; }; })(); case 'default': return new (function () { this.createDocument = function () { return document.implementation.createDocument("", "", null); }; this.serialize = function (doc) { return new XMLSerializer().serializeToString(doc); }; this.parseXml = function (xml) { var doc = new DOMParser().parseFromString(xml, "text/xml"); if ("parsererror" == doc.documentElement.nodeName) { throw new Error('Parse error'); } return doc; }; })(); default: throw new Error('Unable to select the DOM adapter'); } }; var oDocXml11; function iniciaCarga11(capa, url) { sCapaActualizar11 = capa; document.getElementById(sCapaActualizar11).innerHTML = "Accediendo a datos ..."; try { oDocXml11 = getDomAdapter().parseXml(sDocXmlEFL11); //alert(doc); stateChanged11(); } catch(e) { document.getElementById(sCapaActualizar11).innerHTML = "Error al acceder a los datos. " + sUrlFeed11 + e; } } function stateChanged11() { var content; var node = oDocXml11.documentElement; // Get Channel information var channels = node.getElementsByTagName('channel'); if (channels == null) { // Error content = "
Error en los datos. (channel)
"; } else { content = '
'; for (var i=0; i < channels.length; i++) { var title = channels[i].getElementsByTagName('title').item(0).firstChild.data; var area = ""; // Si empieza por ACTUM - Actualidad Mementos, se le quita var sTituloCanal = "ACTUM - Actualidad Mementos "; if (title.substring(0,sTituloCanal.length) == sTituloCanal) { area = title.substring(sTituloCanal.length, title.length); } var link = channels[i].getElementsByTagName('link').item(0).firstChild.data; var description = channels[i].getElementsByTagName('description').item(0).firstChild.data; var id_materia = channels[i].getElementsByTagName('guid').item(0).firstChild.data; //if (i>0){content += '
';} if (i>0){content += '
';} var sTitulo = sTituloCanal; if (area=="FISCAL") sTitulo += "Fiscal"; else if (area=="SOCIAL") sTitulo += "Social"; else if (area=="CONTABLE") sTitulo += "Contable"; else if (area=="MERCANTIL") sTitulo += "Mercantil"; else if (area.indexOf("INMOBILIARI")>-1) sTitulo += "Inmobiliario-Urbanismo"; else sTitulo += "Lefebvre"; content += '
'; content += '
 ' + sTitulo + '
'; content += '
Ver Todas 
'; content += "
" + cargaContenidoCanal11(channels[i].getElementsByTagName('item'), 0, i, 'mat_'+i+'_11') + "
"; //content += cargaContenidoCanal11(channels[i].getElementsByTagName('item'), 0, ); } content += '
'; // caja } document.getElementById(sCapaActualizar11).innerHTML = content; } function scrollContenido11 (nCanal, nItemInicial, sNombreCapaContenido) { var content; var textotiposactum = ""; // Parsing RSS var node = oDocXml11.documentElement; // Get Channel information var channels = node.getElementsByTagName('channel'); if (channels == null) { // Error content = "
Error en los datos. (channel)
"; } else { //content = '
Ver Todas
'; if (nCanal < channels.length) { content = cargaContenidoCanal11(channels[nCanal].getElementsByTagName('item'), nItemInicial, nCanal, 'mat_'+nCanal+'_11'); } else { content = "
Error en los datos. (Id.Canal no válido)
"; } } document.getElementById(sNombreCapaContenido).innerHTML = content; } function cargaContenidoCanal11(items, nItemInicial, nCanal , sNombreCapaContenido) { var sContenido = ""; // Browse items if (items == null) { // Error, el div se cierra al final sContenido = "
Error en los datos. (item)
"; } else { var nCont = 0; var nInicio = nItemInicial; if (nInicio < 0) nInicio = 0; // Valores erróneos var nFin = items.length; if (nFin > ( nItemInicial + nTamanoPagina11)) { nFin = nItemInicial + nTamanoPagina11; } for (var n=nInicio; n < nFin; n++) { var itemTitle = items[n].getElementsByTagName('title').item(0).firstChild.data; var itemLink = items[n].getElementsByTagName('link').item(0).firstChild.data; try { var itemPubDate = items[n].getElementsByTagName('pubDate').item(0).firstChild.data; var myDate = new Date(itemPubDate); //itemPubDate = myDate.toLocaleString(); // Se presupone q todas las horas vienen como 0:00:00 //itemPubDate = itemPubDate.slice(0,-8); ////itemPubDate = myDate.toString(); itemPubDate = ""; if (myDate.getDate() < 9) { itemPubDate += "0"; } itemPubDate += myDate.getDate() + "/"; if ((myDate.getMonth()+1) < 9) { itemPubDate += "0"; } itemPubDate += (myDate.getMonth()+1) + "/" + myDate.getFullYear(); } catch (e) { var itemPubDate = ''; } sContenido += '
 '+itemTitle+' - '+itemPubDate+'
'; //sContenido += '
'; nCont++; } if (n==0) {sContenido = '
No existen novedades para esta materia.
';} else { if ((nItemInicial > 0) || (nFin < items.length)) { sContenido += '
'; if (nItemInicial > 0) { // enlace a anteriores sContenido += '
 Ant.
'; } if (nFin < items.length) { // enlace a siguientes sContenido += '
Sig. 
'; } sContenido += '
'; } } } return sContenido; } function update_timer11() { iniciaCarga11('eflactumrss11', sUrlFeed11); } document.write("
"); iniciaCarga11('eflactumrss11', sUrlFeed11);