Index: /branches/2.2/expressoMail1_2/stylesheet/news_add.xsl
===================================================================
--- /branches/2.2/expressoMail1_2/stylesheet/news_add.xsl	(revision 3178)
+++ /branches/2.2/expressoMail1_2/stylesheet/news_add.xsl	(revision 3178)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:template match="rss/channel">
+	<span><xsl:value-of select = "title" /></span><span> - <xsl:value-of select="count(item)"/> news</span>
+	<img src='../phpgwapi/templates/default/images/foldertree_trash.png'>
+		<xsl:attribute name="onclick">
+			news_edit.unsubscribe('<xsl:value-of select="link"/>',this);
+		</xsl:attribute>
+	</img>
+</xsl:template>
+</xsl:stylesheet>
Index: /branches/2.2/expressoMail1_2/stylesheet/news_read.xsl
===================================================================
--- /branches/2.2/expressoMail1_2/stylesheet/news_read.xsl	(revision 3178)
+++ /branches/2.2/expressoMail1_2/stylesheet/news_read.xsl	(revision 3178)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	<xsl:template match="rss/channel">
+	<div id="divScrollMain_0" style="overflow-y: scroll; overflow-x: hidden; width: 99.3%;">
+	<table id="table_box" class="table_box" cellspacing="0" cellpadding="0">
+		<tbody id="tbody_box">
+	<xsl:for-each select="item">
+		<xsl:variable name="itens" select='position()' />
+		<tr class="tr_msg_read">
+			<xsl:attribute name="onclick">
+				news_edit.read_item('<xsl:value-of select="$itens"/>');
+			</xsl:attribute>
+			<td width="1%" class="td_msg"><input type="checkbox" class="checkbox"/></td>
+			<td width="1%" class="td_msg"/>
+			<td width="1%" class="td_msg"><img title="Lida" src="templates/default/images/seen.gif"/></td>
+			<td width="16%" class="td_msg"><span style="text-decoration: none;"><xsl:value-of select="owner"/></span></td>
+			<td width="50%" class="td_msg"><xsl:value-of select="title"/></td>
+			<td width="17%" align="center" class="td_msg" title="14/08/2010"><xsl:value-of select="pubDate"/></td>
+			<td width="14%" nowrap="true" align="center" class="td_msg"><xsl:value-of select="string-length(description)"/></td>
+		</tr>
+	</xsl:for-each>
+	</tbody>
+	</table>
+	</div>
+</xsl:template>
+</xsl:stylesheet>
Index: /branches/2.2/expressoMail1_2/setup/phpgw_pt-br.lang
===================================================================
--- /branches/2.2/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 3165)
+++ /branches/2.2/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 3178)
@@ -2,4 +2,5 @@
 View Quota Usage in Folders	expressoMail1_2	pt-br	Visualizar quota utilizada por cada pasta
 You are currently using %1Mb (%2%).	expressoMail1_2	pt-br	Você está usando atualmente %1Mb (%2%).
+News	expressoMail1_2	pt-br	Notícias
 1 Day	expressoMail1_2	pt-br	1 Dia
 2 Days	expressoMail1_2	pt-br	2 Dias
Index: /branches/2.2/expressoMail1_2/inc/class.rss.inc.php
===================================================================
--- /branches/2.2/expressoMail1_2/inc/class.rss.inc.php	(revision 3178)
+++ /branches/2.2/expressoMail1_2/inc/class.rss.inc.php	(revision 3178)
@@ -0,0 +1,65 @@
+<?php
+
+class rss
+{
+
+	function rss (){
+	}
+	// BEGIN of functions.
+	function getContent($param){
+		$daurl=$param['url'];
+		if (preg_match('/http(s)?:\/\//i',$daurl,$matches) == 0)
+			$daurl = 'http://'.$daurl;
+
+		// Set your return content type
+		header('Content-type: application/xml');
+
+		// Get that website's content
+		$handle = fopen($daurl, "r");
+
+		// If there is something, read and return
+		if ($handle) {
+			$buffer = fgets($handle, 4096);
+			$pattern = '/<\?xml version=".\.0"( encoding="[A-Z\-0-9]+")?\ *\?>/i';
+			if (preg_match($pattern,$buffer,$matches) == 0)
+				exit;
+			echo $buffer;
+			while (!feof($handle)) {
+				$buffer = fgets($handle, 4096);
+				echo $buffer;
+			}
+			fclose($handle);
+		}
+		exit;
+	}
+	function getChannels(){
+		include('../header.inc.php');
+		$GLOBALS['phpgw']->db->query('SELECT rss_url,name FROM phpgw_userrss WHERE uid = '.$_SESSION['phpgw_session']['account_id']);
+		while($GLOBALS['phpgw']->db->next_record())
+			$return[]=$GLOBALS['phpgw']->db->row();
+		return $return;
+	}
+	function addChannel($param){
+		include('../header.inc.php');
+		$name = $GLOBALS['phpgw']->db->db_addslashes(htmlentities($param['name']));
+		$url = $GLOBALS['phpgw']->db->db_addslashes($param['url']);
+		$GLOBALS['phpgw']->db->query('INSERT INTO phpgw_userrss values('.$_SESSION['phpgw_session']['account_id'].',\''.$url.'\',\''.$name.'\');',__LINE__,__FILE__);
+		if ($GLOBALS['phpgw']->db->Error)
+			    return "Error";
+		else
+			    return "Success";
+
+	}
+
+	function removeChannel($param){
+		include('../header.inc.php');
+		$url = $GLOBALS['phpgw']->db->db_addslashes($param['url']);
+		$GLOBALS['phpgw']->db->query('DELETE FROM phpgw_userrss where rss_url = \''.$url.'\';',__LINE__,__FILE__);
+		if ($GLOBALS['phpgw']->db->Error)
+			    return "Error";
+		else
+			    return "Success";
+	}
+
+}
+?>
Index: /branches/2.2/expressoMail1_2/js/common_functions.js
===================================================================
--- /branches/2.2/expressoMail1_2/js/common_functions.js	(revision 3068)
+++ /branches/2.2/expressoMail1_2/js/common_functions.js	(revision 3178)
@@ -593,4 +593,28 @@
 }
 
+function open_rss(param){
+	connector.loadScript("news_edit");
+	if (typeof(news_edit) == 'undefined')
+	{
+		setTimeout('open_rss(\''+param+'\')',500);
+		return false;
+	}
+	news_edit.read_rss(param);
+	return true;
+}
+
+function editrss(){
+	connector.loadScript("news_edit");
+	if (typeof(news_edit) == 'undefined')
+	{
+		setTimeout('editrss()',500);
+		return false;
+	}
+	news_edit.makeWindow();
+}
+
+
+
+
 function preferences_mail(){
 	location.href="../preferences/preferences.php?appname=expressoMail1_2";
Index: /branches/2.2/expressoMail1_2/js/news_edit.js
===================================================================
--- /branches/2.2/expressoMail1_2/js/news_edit.js	(revision 3178)
+++ /branches/2.2/expressoMail1_2/js/news_edit.js	(revision 3178)
@@ -0,0 +1,243 @@
+function loadXMLDoc(fname)
+{
+	var xmlDoc;
+	// code for IE
+	if (window.ActiveXObject)
+	{
+		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
+	}
+	// code for Mozilla, Firefox, Opera, etc.
+	else if (document.implementation 
+			&& document.implementation.createDocument)
+	{
+		xmlDoc=document.implementation.createDocument("","",null);
+	}
+	else
+	{
+		alert('Your browser cannot handle this script');
+	}
+	xmlDoc.async=false;
+	xmlDoc.load(fname);
+	return(xmlDoc);
+}
+
+
+function cnews_edit()
+{
+	this.arrayWin = new Array();
+	this.rssXml;
+}
+
+cnews_edit.prototype.read_rss = function(val)
+{
+	Element("border_id_0").innerHTML = get_lang('News')+'&nbsp;&nbsp;<font face="Verdana" size="1" color="#505050">[<span id="new_m">&nbsp;</span> / <span id="tot_m"></span>]</font>';
+
+	Element("tot_m").innerHTML = 0;
+	Element('content_id_0').innerHTML = '';
+	current_folder = "NEWS/"+val;
+	openTab.imapBox[0] = "NEWS/"+val;
+	this.rssXml = loadXMLDoc('controller.php?action=$this.rss.getContent&url='+escape(val));
+	var xsl = loadXMLDoc('stylesheet/news_read.xsl');
+
+	document.getElementById("content_id_0").innerHTML= '<tr class="message_header">'+
+		'<td width="1%"><input type="checkbox" id="chk_box_select_all_messages" class="checkbox"/></td>'+
+		'<td width="2%"/><td>   </td><td>   </td><td>  </td>'+
+		'<td width="16%" align="left">'+get_lang('Who')+'</td>'+
+		'<td width="50%" align="left">'+get_lang('subject')+'</td>'+
+		'<td width="17%" align="center">'+get_lang('date')+'</td>'+
+		'<td width="14%" align="center">'+get_lang('size')+'</td></tr>';
+	// code for IE
+	if (window.ActiveXObject)
+	{
+		ex=this.rssXml.transformNode(xsl);
+		document.getElementById("content_id_0").innerHTML=ex;
+	}
+	// code for Mozilla, Firefox, Opera, etc.
+	else if (document.implementation && document.implementation.createDocument)
+	{
+		xsltProcessor=new XSLTProcessor();
+		xsltProcessor.importStylesheet(xsl);
+		resultDocument = xsltProcessor.transformToFragment(this.rssXml,document);
+		document.getElementById("content_id_0").appendChild(resultDocument);
+		resizeWindow();
+	}
+
+	update_menu();
+	var box = Element("tbody_box");
+        if(box.childNodes.length > 1)
+		updateBoxBgColor(box.childNodes);
+}
+
+cnews_edit.prototype.read_item = function(item_number){
+	try {
+		var description = this.rssXml.getElementsByTagName('item')[item_number-1].getElementsByTagName('description')[0].firstChild.nodeValue;
+	}catch(e){
+		return;
+	}
+	var title = this.rssXml.getElementsByTagName('item')[item_number-1].getElementsByTagName('title')[0].firstChild.nodeValue;
+	var pubDate = this.rssXml.getElementsByTagName('item')[item_number-1].getElementsByTagName('pubDate')[0].firstChild.nodeValue;
+	var link = this.rssXml.getElementsByTagName('item')[item_number-1].getElementsByTagName('link')[0].firstChild.nodeValue;
+	var owner = this.rssXml.getElementsByTagName('item')[item_number-1].getElementsByTagName('owner')[0];
+	if (currentTab.toString().indexOf('news_') != -1)
+		delete_border(currentTab);
+	var border_id = create_border(title, 'news_'+item_number);
+	if(!border_id)
+		return false;
+
+	  openTab.type[border_id] = 2;
+
+	var toolbarCode = "<div style='background-color: #FFF; font-size: larger;'>"+
+	"<table class='table_message' style='width:100%;'><tr><td>"+(owner != undefined?owner.firstChild.nodeValue:get_lang('nobody'))+", "+pubDate+"</td>"+
+	'<td width="30%" align="left">Marcar como: <span class="message_options">'+get_lang('unseen')+'</span></td>'+
+	'<td nowrap="true" width="30%" align="right"><a target="_blank" href="'+link+'" style class="message_options">'+get_lang('Complete news')+'</a>';
+	if (owner != undefined)
+		toolbarCode += '<span>&nbsp;|&nbsp;</span><span class="message_options">'+get_lang('forward')+'</span><span>&nbsp;|&nbsp;</span>'+
+				'<span class="message_options">Responder</span></td>';
+	toolbarCode += '<td nowrap="true" width="40px" align="right">'+
+	( item_number == 1 ?  '<img style="cursor: default;" src="./templates/default/images/up.gray.button.png">' :
+	'<img onclick="news_edit.read_item('+(parseInt(item_number)-1)+')" style="cursor: default;" src="./templates/default/images/up.button.png">')+
+	'<span>&nbsp;</span>'+
+	(this.rssXml.getElementsByTagName('item')[parseInt(item_number)] == undefined ? '<img style="cursor: default;" src="./templates/default/images/down.gray.button.png">' :
+	'<img onclick="news_edit.read_item('+(parseInt(item_number)+1)+')" style="cursor: pointer;" src="./templates/default/images/down.button.png">')+
+	"</td></tr></table><h2>"+title+"</h2><br>"+description+"</div>";
+	Element('content_id_'+border_id).innerHTML = toolbarCode;
+	resizeWindow();
+}
+
+
+cnews_edit.prototype.makeWindow = function(options)
+{
+	_this = this;
+
+	var el = document.createElement("DIV");
+	el.style.visibility = "hidden";
+	el.style.position = "absolute";
+	el.style.left = "0px";
+	el.style.top = "0px";
+	el.style.width = "0px";
+	el.style.height = "0px";
+	el.id = 'dJSWin_newswin';
+	document.body.appendChild(el);
+	el.innerHTML = "<table border=0><tbody><tr>"+
+		'<td valign="bottom"><input type="text" id="rssEnter" size="40"><input value="'+get_lang('subscribe')+
+		'" onclick="news_edit.subscribe();" type="button">'+
+		'<br>Enter de url of RSS service<br>'+
+		'</td></tr>'+
+		'<tr><td id="serv_table"></td></tr>'+
+		"</tbody></table><br>";
+
+
+	var butt = Element('dJSWin_wfolders_bok')
+		if (!butt){
+			butt = document.createElement('INPUT');
+			butt.id = 'dJSWin_wfolders_bok';
+			butt.type = 'button';
+			butt.value = get_lang('Close');
+			el.appendChild(butt);
+		}
+	butt.onclick = function ()
+	{
+		news_edit.arrayWin[el.id].close();
+	}
+
+
+		_this.showWindow(el);
+	}
+
+	cnews_edit.prototype.showWindow = function (div)
+	{
+		if(! div) {
+			alert(get_lang('This list has no participants'));
+			return;
+		}
+
+		if(! this.arrayWin[div.id])
+		{
+			div.style.height = "280px";
+			div.style.width = "340px";
+			var title = ":: "+get_lang("News edit")+" ::";
+			var wHeight = div.offsetHeight + "px";
+			var wWidth =  div.offsetWidth   + "px";
+			div.style.width = div.offsetWidth - 5;
+
+			win = new dJSWin({
+				id: 'win_'+div.id,
+				content_id: div.id,
+				width: wWidth,
+				height: wHeight,
+				title_color: '#3978d6',
+				bg_color: '#eee',
+				title: title,
+				title_text_color: 'white',
+				button_x_img: '../phpgwapi/images/winclose.gif',
+				border: true });
+			this.arrayWin[div.id] = win;
+			win.draw();
+		}
+		else {
+			win = this.arrayWin[div.id];
+		}
+		win.open();
+		var handlerChannel = function(data){
+			document.getElementById("serv_table").innerHTML = '';
+			for(i=0; i < data.length; i++)
+				document.getElementById("serv_table").innerHTML += "<div><span>"+data[i].name+
+				"</span><span></span><img onclick='news_edit.unsubscribe(\""+data[i].rss_url+"\",this)' src='../phpgwapi/templates/default/images/foldertree_trash.png'/></div>";
+		}
+		cExecute('$this.rss.getChannels',handlerChannel);
+	}
+	cnews_edit.prototype.unsubscribe = function(url,el){
+		var rem_handler = function (data){
+			if (data != "Success")
+				if (data == "Error")
+					alert(get_lang("Database Error"));
+				else
+					alert(get_lang("Invalid entry"));
+			else
+			{
+				var pnode = el.parentNode;
+				pnode.parentNode.removeChild(pnode);
+			}
+		};
+
+		cExecute('$this.rss.removeChannel&url='+escape(url),rem_handler);
+	}
+	cnews_edit.prototype.subscribe = function(){
+		var val = Element('rssEnter').value;
+		var rssXml = loadXMLDoc('controller.php?action=$this.rss.getContent&url='+escape(val));
+		var xsl = loadXMLDoc('stylesheet/news_add.xsl');
+		newTableEl = document.getElementById("serv_table");
+		// code for IE
+		if (window.ActiveXObject)
+		{
+			ex=rssXml.transformNode(xsl);
+			newTableEl.innerHTML='<div id="'+escape(val)+'">'+ex+'</div>';
+		}
+		// code for Mozilla, Firefox, Opera, etc.
+		else if (document.implementation && document.implementation.createDocument)
+		{
+			xsltProcessor=new XSLTProcessor();
+				xsltProcessor.importStylesheet(xsl);
+			resultDocument = xsltProcessor.transformToFragment(rssXml,document);
+			var ndiv = document.createElement('DIV');
+			ndiv.id = escape(val);
+			ndiv.appendChild(resultDocument);
+			newTableEl.appendChild(ndiv);
+		}
+		var add_handler = function (data){
+			if (data != "Success")
+				if (data == "Error")
+					alert(get_lang("Database Error"));
+				else
+					alert(get_lang("Invalid entry"));
+		};
+		if(!ndiv)
+			var ndiv = document.getElementById(escape(val));
+		var name = ndiv.childNodes[1].innerHTML;
+		cExecute('$this.rss.addChannel&url='+escape(val)+'&name='+name,add_handler);
+
+	};
+
+/* Build the Object */
+var news_edit;
+news_edit = new cnews_edit();
Index: /branches/2.2/expressoMail1_2/js/draw_api.js
===================================================================
--- /branches/2.2/expressoMail1_2/js/draw_api.js	(revision 3168)
+++ /branches/2.2/expressoMail1_2/js/draw_api.js	(revision 3178)
@@ -155,4 +155,34 @@
 			}
 		}
+
+
+
+		var handlerChannel = function(data){
+			if (data == null)
+				return;
+			/*
+			*  RSS NEWS
+			*/
+			var root_rss = new dNode({
+				id: "news_root",
+				caption: get_lang('News')
+			});
+			tree_folders.add(root_rss, "root");
+			for(i=0; i < data.length; i++)
+			{
+				var nodeNews = new dNode({
+					id: "NEWS/"+data[i].name,
+					caption: data[i].name,
+					onClick: "open_rss('"+data[i].rss_url+"')",
+					plusSign: 0
+				});
+				tree_folders.add(nodeNews,"news_root");
+			}
+			var noden=document.getElementById('lnews_roottree_folders');
+			noden.style.backgroundImage="url(templates/"+template+"/images/menu/rss.png)";
+		}
+		cExecute('$this.rss.getChannels',handlerChannel);
+
+
 		/**
 		 * Pastas locais
@@ -321,4 +351,5 @@
 		}
 	}
+
 }
 
@@ -584,4 +615,5 @@
 
 	openTab.content_id[numBox] = document.getElementById("content_id_"+numBox);
+	openTab.content_id[numBox].innerHTML = "";
 	openTab.imapBox[numBox] = msg_folder;
 	openTab.type[numBox] = 0;
Index: /branches/2.2/expressoMail1_2/js/doiMenuData.js
===================================================================
--- /branches/2.2/expressoMail1_2/js/doiMenuData.js	(revision 1615)
+++ /branches/2.2/expressoMail1_2/js/doiMenuData.js	(revision 3178)
@@ -14,4 +14,5 @@
 				"folderbox()|" + get_lang("Edit folders") + "|editfolders.png",
 				"sharebox()|" + get_lang("Share mailbox") + "|usersfolders.png",
+				"editrss()|" + get_lang("Edit my news") + "|rss.png",
 				"empty_trash_imap()|" + get_lang("Empty trash") + "|trash.png");
 		if(preferences.use_local_messages==1) {
