[Vtigercrm-commits] [vtiger-commits] r5068 - in /vtigercrm/trunk/modules/Rss: Delete.php Forms.php ListView.php Popup.php Rss.js Rss.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Wed Apr 12 05:22:59 EDT 2006
Author: don
Date: Wed Apr 12 03:22:52 2006
New Revision: 5068
Log:
NEW RSS integrated
Modified:
vtigercrm/trunk/modules/Rss/Delete.php
vtigercrm/trunk/modules/Rss/Forms.php
vtigercrm/trunk/modules/Rss/ListView.php
vtigercrm/trunk/modules/Rss/Popup.php
vtigercrm/trunk/modules/Rss/Rss.js
vtigercrm/trunk/modules/Rss/Rss.php
Modified: vtigercrm/trunk/modules/Rss/Delete.php
==============================================================================
--- vtigercrm/trunk/modules/Rss/Delete.php (original)
+++ vtigercrm/trunk/modules/Rss/Delete.php Wed Apr 12 03:22:52 2006
@@ -25,5 +25,5 @@
DeleteEntity($_REQUEST['module'],$_REQUEST['return_module'],'',$_REQUEST['record'],'');
//code added for returning back to the current view after delete from list view
-header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']);
+header("Location: index.php?module=".$_REQUEST['return_module']."&action=RssAjax&vtigerfile=ListView&directmode=ajax");
?>
Modified: vtigercrm/trunk/modules/Rss/Forms.php
==============================================================================
--- vtigercrm/trunk/modules/Rss/Forms.php (original)
+++ vtigercrm/trunk/modules/Rss/Forms.php Wed Apr 12 03:22:52 2006
@@ -20,37 +20,6 @@
* Contributor(s): ______________________________________..
********************************************************************************/
-/**
- * Create javascript to validate the data entered into a record.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________..
-*/
-function get_validate_record_js () {
-global $mod_strings;
-global $app_strings;
-global $image_path;
-
-$the_script='
-<script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
-<script type="text/javascript" language="Javascript">
-function toggleRSSFolder(id) {
- if (document.getElementById(id+"_feeds").style.display=="none") {
- document.getElementById(id+"_feeds").style.display="block"
- document.getElementById(id+"_folder").src="'.$image_path.'rss_folder_opn.gif"
- document.getElementById(id+"_toggle").src="'.$image_path.'minus.gif"
- } else {
- document.getElementById(id+"_feeds").style.display="none"
- document.getElementById(id+"_folder").src="'.$image_path.'rss_folder_cls.gif"
- document.getElementById(id+"_toggle").src="'.$image_path.'plus.gif"
- }
-
-}
-</script>';
-return $the_script;
-}
-
-
require_once("modules/Rss/Rss.php");
$oRss = new vtigerRSS();
@@ -63,25 +32,13 @@
$oRss = new vtigerRSS();
$allrsshtml = $oRss->getRSSCategoryHTML();
-$starred_rss_html = $oRss->getStarredRssFolder();
+//$starred_rss_html = $oRss->getStarredRssFolder();
-$the_form .= '<form name="rssfolder"><table width="100%" border="0" cellspacing="2" cellpadding="0" style="margin-top:10px">
- <tr>
- <td width="15"><div align="center"><a href="javascript:;" onClick="toggleRSSFolder('."'S'".')"><img id="S_toggle"
-src="'.$image_path.'plus.gif" border="0"></a></div></td>
- <td width="20"><div align="center"><img id="S_folder" src="'.$image_path.'rss_folder_cls.gif"></div></td>
- <td nowrap><a href="javascript:;" onClick="toggleRSSFolder('."'S'".')" class="rssFolder">Starred Feeds</a></td>
- </tr>
- <tr>
- <td colspan="3"><div id="S_feeds" style="display:none"><table width="100%" border="0" cellspacing="2" cellpadding=
-"2" style="margin:5 0 0 35">'.$starred_rss_html.'</table></div></td>
- </tr>';
+$the_form .= '<table width="100%" border="0" cellspacing="2" cellpadding="0" style="margin-top:10px">';
$the_form .= $allrsshtml;
$the_form .= "</table>";
-$the_form .= get_validate_record_js();
-$this_form .= "</form>";
return $the_form;
}
Modified: vtigercrm/trunk/modules/Rss/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Rss/ListView.php (original)
+++ vtigercrm/trunk/modules/Rss/ListView.php Wed Apr 12 03:22:52 2006
@@ -29,7 +29,15 @@
global $cache_dir;
// focus_list is the means of passing data to a ListView.
global $focus_list;
+global $adb;
+$oRss = new vtigerRSS();
+if(isset($_REQUEST[folders]) && $_REQUEST[folders] == 'true')
+{
+ require_once("modules/".$currentModule."/Forms.php");
+ echo get_rssfeeds_form();
+ die;
+}
if(isset($_REQUEST[record]))
{
$recordid = $_REQUEST[record];
@@ -43,7 +51,6 @@
//<<<<<<<<<<<<<<lastrss>>>>>>>>>>>>>>>>>>//
//$url = 'http://forums/rss.php?name=forums&file=rss';
//$url = 'http://forums/weblog_rss.php?w=202';
-$oRss = new vtigerRSS();
if(isset($_REQUEST[record]))
{
$recordid = $_REQUEST[record];
@@ -56,32 +63,30 @@
$rss_html = "<strong>No RSS Feeds are selected</strong>";
}
$rss_form->assign("TITLE",gerRssTitle($recordid));
+ $rss_form->assign("ID",$recordid);
}else
{
+ $rss_form->assign("TITLE",gerRssTitle());
$rss_html = $oRss->getStarredRssHTML();
+ $query = "select rssid from rss where starred=1";
+ $result = $adb->query($query);
+ $recordid = $adb->query_result($result,0,'rssid');
+ $rss_form->assign("ID",$recordid);
+ $rss_form->assign("DEFAULT",'yes');
}
if($currentModule == "Rss")
{
require_once("modules/".$currentModule."/Forms.php");
if (function_exists('get_rssfeeds_form'))
{
- $rss_form->assign("RSSFEEDS_TITLE","<img src='".$image_path."rssroot.gif' align='absmiddle'/> <a href='javascript:openPopUp(\"addRssFeedIns\",this,\"index.php?action=Popup&module=Rss\",\"addRssFeedWin\",350,150,\"menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes\");' title='".$app_strings['LBL_ADD_RSS_FEEDS']."'>Add RSS Feed</a>");
+ $rss_form->assign("RSSCATEG", $oRss->getRsscategory_html());
$rss_form->assign("RSSFEEDS", get_rssfeeds_form());
}
}
-
-
$rss_form->assign("RSSDETAILS",$rss_html);
//<<<<<<<<<<<<<<lastrss>>>>>>>>>>>>>>>>>>//
-
-$rss_form->display("Rss.tpl");
-function gerRssTitle($id)
-{
- global $adb;
- $query = 'select * from rss where rssid ='.$id;
- $result = $adb->query($query);
- $title = $adb->query_result($result,0,'rsstitle');
- return $title;
-
-}
+if(isset($_REQUEST['directmode']) && $_REQUEST['directmode'] == 'ajax')
+ $rss_form->display("RssFeeds.tpl");
+else
+ $rss_form->display("Rss.tpl");
?>
Modified: vtigercrm/trunk/modules/Rss/Popup.php
==============================================================================
--- vtigercrm/trunk/modules/Rss/Popup.php (original)
+++ vtigercrm/trunk/modules/Rss/Popup.php Wed Apr 12 03:22:52 2006
@@ -8,77 +8,45 @@
* All Rights Reserved.
*
********************************************************************************/
-require_once('XTemplate/xtpl.php');
require_once("data/Tracker.php");
require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/logging.php');
require_once('include/utils/utils.php');
require_once('modules/Rss/Rss.php');
-global $app_strings;
-global $app_list_strings;
-global $mod_strings;
-$current_module_strings = return_module_language($current_language, 'Rss');
-global $urlPrefix;
$log = LoggerManager::getLogger('rss_save');
-global $currentModule;
-global $image_path;
-global $theme;
-$theme_path="themes/".$theme."/";
-$image_path=$theme_path."images/";
-
-// focus_list is the means of passing data to a ListView.
-global $focus_list;
-
-if(isset($_REQUEST["rssurl"]))
+if(isset($_REQUEST["record"]))
+{
+ global $adb;
+ $query = 'update rss set starred=0';
+ $adb->query($query);
+ $query = 'update rss set starred=1 where rssid ='.$_REQUEST["record"];
+ $adb->query($query);
+ echo $_REQUEST["record"];
+}
+elseif(isset($_REQUEST["rssurl"]))
{
$newRssUrl = $_REQUEST["rssurl"];
$rsscategory = $_REQUEST["rsscategory"];
- $setstarred = $_REQUEST["setstarred"];
- if($setstarred != 1)
- {
- $setstarred = 0;
- }
+ $setstarred = 0;
$oRss = new vtigerRSS();
if($oRss->setRSSUrl($newRssUrl))
{
- if($oRss->saveRSSUrl($newRssUrl,$setstarred,$rsscategory) == false)
+ $result = $oRss->saveRSSUrl($newRssUrl,$setstarred,$rsscategory);
+ if($result == false)
{
- echo "<font color='red'><b>Unable to save the RSS Feed URL</b></font><br>" ;
+ echo "Unable to save the RSS Feed URL" ;
}else
{
- $jscript = "window.opener.location.href=window.opener.location.href;
- window.self.close();";
+ echo $result;
}
}else
{
- echo "<font color='red'><b>Not a valid RSS Feed URL</b></font><br>" ;
+ echo "Not a valid RSS Feed URL" ;
}
}
-function getRsscategory_html()
-{
- $oRss = new vtigerRSS();
- $rsscategory = $oRss->getRsscategory();
- //print_r($rsscategory);
- if(isset($rsscategory))
- {
- for($i=0;$i<count($rsscategory);$i++)
- {
- $shtml .= "<option value=\"$rsscategory[$i]\">$rsscategory[$i]</option>";
- }
- }
- return $shtml;
-}
-$save_rss_form=new XTemplate ("modules/Rss/Popup.html");
-$save_rss_form->assign("MOD", $mod_strings);
-$save_rss_form->assign("APP", $app_strings);
-$save_rss_form->assign("IMAGE_PATH",$image_path);
-$save_rss_form->assign("THEME_PATH",$theme_path);
-$save_rss_form->assign("JAVASCRIPT",$jscript);
-$save_rss_form->assign("RSS_CATEGORY",getRsscategory_html());
-$save_rss_form->parse("main");
-$save_rss_form->out("main");
+
?>
Modified: vtigercrm/trunk/modules/Rss/Rss.js
==============================================================================
--- vtigercrm/trunk/modules/Rss/Rss.js (original)
+++ vtigercrm/trunk/modules/Rss/Rss.js Wed Apr 12 03:22:52 2006
@@ -53,8 +53,8 @@
}
return true;
}
-function display(url,list)
+function display(url,id)
{
- document.getElementById('rsstitle').innerHTML = list;
+ document.getElementById('rsstitle').innerHTML = document.getElementById(id).innerHTML;
document.getElementById('mysite').src = url;
}
Modified: vtigercrm/trunk/modules/Rss/Rss.php
==============================================================================
--- vtigercrm/trunk/modules/Rss/Rss.php (original)
+++ vtigercrm/trunk/modules/Rss/Rss.php Wed Apr 12 03:22:52 2006
@@ -31,23 +31,14 @@
var $rss_title;
var $rss_link;
+
+ /** Function to get the Rss Feeds from the Given URL
+ * This Function accepts the url string as the argument
+ * and assign the value for the class variables correspondingly
+ */
function setRSSUrl($url)
{
global $cache_dir;
- //print_r($url);
- /*$this->rss = new lastRSS();
- $this->rss->cache_dir = $cache_dir;
- $this->cache_time = $this->rsscache_time;
- if($this->rss_object = $this->rss->get($url))
- {
- $this->rss_title = $this->rss_object["title"];
- $this->rss_link = $this->rss_object["link"];
- return true;
- }else
- {
- return false;
- }*/
-
$this->rss = new feedParser();
// Read in our sample feed file
$data = @implode("", at file($url));
@@ -64,62 +55,53 @@
if(isset($this->rss_object))
{
$this->rss_title = $this->rss_object["title"];
- $this->rss_link = $this->rss_object["link"];
+ $this->rss_link = $this->rss_object["link"];
$this->rss_object = $info["item"];
- return true;
+ return true;
}else
{
return false;
}
-
+
}
- /*function getRSSHeadings()
- {
- global $image_path;
-
- if($this->rss_object)
- {
- $shtml = "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"4\">
- <tr>
- <td class=\"rssPgTitle\"><img src=\"".$image_path."starred.gif\" align=\"absmiddle\">
- <a href=\"".$this->rss_object[link]."\">".$this->rss_object[title]."</a>
- </td>
- </tr>
- </table>";
+ /** Function to get the List of Rss feeds
+ * This Function accepts no arguments and returns the listview contents on Sucess
+ * returns "Sorry: It's not possible to reach RSS URL" if fails
+ */
+
+ function getListViewRSSHtml()
+ {
+ if(isset($this->rss_object))
+ {
+ $i = 0;
+ foreach($this->rss_object as $key=>$item)
+ {
+ $i = $i + 1;
+ $shtml .= "<tr class='prvPrfHoverOff' onmouseover=\"this.className='prvPrfHoverOn'\" onmouseout=\"this.className='prvPrfHoverOff'\"><td><a href=\"javascript:display('".$item[link]."','feedlist_".$i."')\"; id='feedlist_".$i."' class=\"rssNews\">".$item[title]."</a></td><td>".$this->rss_title."</td><td> </td></tr>";
+ if($i == 10)
+ {
+ return $shtml;
+ }
+ }
+
return $shtml;
- }
- }*/
-
- function getListViewRSSHtml()
- {
- if(isset($this->rss_object))
- {
- $i = 0;
- foreach($this->rss_object as $key=>$item)
- {
- $i = $i + 1;
- $shtml .= "<li><a href=\"javascript:display('".$item[link]."','".$item[title]."')\"; class=\"rssNews\">$item[title]</a></li>";
- if($i == 10)
- {
- return $shtml;
- }
- }
-
- return $shtml;
-
- }else
- {
- $shtml = "Sorry: It's not possible to reach RSS URL";
- }
-
- //return $shtml;
- }
-
+
+ }else
+ {
+ $shtml = "Sorry: It's not possible to reach RSS URL";
+ }
+ }
+
+ /** Function to save the Rss Feeds
+ * This Function accepts the RssURl,RssCategory,Starred Status as arguments and
+ * returns true on sucess
+ * returns false if fails
+ */
function saveRSSUrl($url,$makestarred,$rsscategory)
{
global $adb;
-
+
if ($url != "")
{
$rsstitle = $this->rss_title;
@@ -127,67 +109,66 @@
{
$rsstitle = $url;
}
- $genRssId = $adb->getUniqueID("rss");
+ $genRssId = $adb->getUniqueID("rss");
$sSQL = "insert into rss (RSSID,RSSURL,RSSTITLE,RSSTYPE,STARRED,RSSCATEGORY) values (".$genRssId.",'".addslashes($url);
$sSQL .= "','".addslashes($rsstitle)."',0,".$makestarred.",'".addslashes($rsscategory)."')";
$result = $adb->query($sSQL);
if($result)
{
- return true;
+ return $genRssId;
}else
{
- return false;
- }
- }
- }
-
+ return false;
+ }
+ }
+ }
+/*
function getStarredRssFolder()
{
-
- global $adb;
- global $image_path;
-
- $sSQL = "select * from rss where starred=1";
- $result = $adb->query($sSQL);
- while($allrssrow = $adb->fetch_array($result))
- {
- $shtml .= "<tr>";
- $shtml .= "<td width=\"15\">
- <img src=\"".$image_path."onstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','0')\"></td>";
- $shtml .= "<td class=\"rssTitle\" width=\"10%\"><a href=\"index.php?module=Rss&action=index&record=$allrssrow[rssid]
-\" class=\"rssTitle\">".substr($allrssrow['rsstitle'],0,15)."...</a></td><td><a href=\"index.php?module=Rss&action=Delete&return_module=Rss&return_action=index&record=$allrssrow[rssid]\"><img src=\"".$image_path."del.gif\" border=\"0\" align=\"absmiddle\"></a></td>";
- $shtml .= "</tr>";
- }
- return $shtml;
-
- }
+
+ global $adb;
+ global $image_path;
+
+ $sSQL = "select * from rss where starred=1";
+ $result = $adb->query($sSQL);
+ while($allrssrow = $adb->fetch_array($result))
+ {
+ $shtml .= "<tr id='feed_".$allrssrow[rssid]."'>";
+ $shtml .= "<td width=\"15\">
+ <img src=\"".$image_path."onstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','0')\"></td>";
+ $shtml .= "<td class=\"rssTitle\" width=\"10%\" nowrap><a href=\"javascript:GetRssFeedList('$allrssrow[rssid]')\" class=\"rssTitle\">".substr($allrssrow['rsstitle'],0,15)."...</a></td><td><a href=\"javascript:DeleteRssFeeds('$allrssrow[rssid]');\"><img src=\"".$image_path."del.gif\" border=\"0\" align=\"absmiddle\"></a></td>";
+ $shtml .= "</tr>";
+ }
+ return $shtml;
+
+ }
+*/
function getCRMRssFeeds()
{
global $adb;
- global $image_path;
-
- $sSQL = "select * from rss where rsstype=1";
- $result = $adb->query($sSQL);
- //$allrssrow = $adb->fetch_array($result);
- while($allrssrow = $adb->fetch_array($result))
- {
- $shtml .= "<tr>";
- if($allrssrow["starred"] == 1)
- {
- $shtml .= "<td width=\"15\">
- <img src=\"".$image_path."onstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','0')\"></td>";
- }else
- {
- $shtml .= "<td width=\"15\">
- <img src=\"".$image_path."offstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','1')\"></td>";
- }
- $shtml .= "<td class=\"rssTitle\"><a href=\"index.php?module=Rss&action=ListView&record=$allrssrow[rssid]
-\" class=\"rssTitle\">".$allrssrow[rsstitle]."</a></td>";
- $shtml .= "<td><a href=\"index.php?module=Rss&action=Delete&return_module=Rss&return_action=index&record=$allrssrow[rssid]\"><img src=\"".$image_path."del.gif\" border=\"0\" align=\"absmiddle\"></a></td></tr>";
-
- }
- return $shtml;
+ global $image_path;
+
+ $sSQL = "select * from rss where rsstype=1";
+ $result = $adb->query($sSQL);
+ while($allrssrow = $adb->fetch_array($result))
+ {
+ $shtml .= "<tr>";
+ if($allrssrow["starred"] == 1)
+ {
+ $shtml .= "<td width=\"15\">
+ <img src=\"".$image_path."onstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','0')\"></td>";
+ }else
+ {
+ $shtml .= "<td width=\"15\">
+ <img src=\"".$image_path."offstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','1')\"></td>";
+ }
+ $shtml .= "<td class=\"rssTitle\"><a href=\"index.php?module=Rss&action=ListView&record=$allrssrow[rssid]
+ \" class=\"rssTitle\">".$allrssrow[rsstitle]."</a></td>";
+ $shtml .= "<td><a href=\"index.php?module=Rss&action=Delete&return_module=Rss&return_action=index&record=$allrssrow[rssid]\"><img src=\"".$image_path."del.gif\" border=\"0\" align=\"absmiddle\"></a></td></tr>";
+
+ }
+ return $shtml;
}
@@ -200,34 +181,37 @@
$result = $adb->query($sSQL);
while($allrssrow = $adb->fetch_array($result))
{
- $shtml .= "<tr>";
+ $shtml .= "<tr>";
if($allrssrow["starred"] == 1)
{
- $shtml .= "<td width=\"15\">
- <img src=\"".$image_path."onstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','0')\"></td>";
+ $shtml .= "<td width=\"15\">
+ <img src=\"".$image_path."onstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','0')\"></td>";
}else
{
- $shtml .= "<td width=\"15\">
- <img src=\"".$image_path."offstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','1')\"></td>";
- }
- $shtml .= "<td class=\"rssTitle\"><a href=\"index.php?module=Rss&action=ListView&record=$allrssrow[rssid]\" class=\"rssTitle\">".$allrssrow[rsstitle]."</a></td><td><a href=\"index.php?module=Rss&action=Delete&return_module=Rss&return_action=index&record=$allrssrow[rssid]\"><img src=\"".$image_path."del.gif\" border=\"0\" align=\"absmiddle\"></a></td>";
- $shtml .= "</tr>";
-
- }
-
- return $shtml;
- }
-
+ $shtml .= "<td width=\"15\">
+ <img src=\"".$image_path."offstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','1')\"></td>";
+ }
+ $shtml .= "<td class=\"rssTitle\"><a href=\"index.php?module=Rss&action=ListView&record=$allrssrow[rssid]\" class=\"rssTitle\">".$allrssrow[rsstitle]."</a></td><td><a href=\"index.php?module=Rss&action=Delete&return_module=Rss&return_action=index&record=$allrssrow[rssid]\"><img src=\"".$image_path."del.gif\" border=\"0\" align=\"absmiddle\"></a></td>";
+ $shtml .= "</tr>";
+
+ }
+
+ return $shtml;
+ }
+
+ /** Function to get the rssurl for the given id
+ * This Function accepts the rssid as argument and returns the rssurl for that id
+ */
function getRssUrlfromId($rssid)
{
global $adb;
-
+
if($rssid != "")
{
$sSQL = "select * from rss where rssid=".$rssid;
$result = $adb->query($sSQL);
$rssrow = $adb->fetch_array($result);
-
+
if(count($rssrow) > 0)
{
$rssurl = $rssrow[rssurl];
@@ -237,218 +221,266 @@
}
function getRSSHeadings($rssid)
- {
- global $image_path;
- global $adb;
-
- if($rssid != "")
- {
- $sSQL = "select * from rss where rssid=".$rssid;
- $result = $adb->query($sSQL);
- $rssrow = $adb->fetch_array($result);
-
- if(count($rssrow) > 0)
- {
- $shtml = "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"4\">
- <tr>
- <td class=\"rssPgTitle\">";
- if($rssrow[starred] == 1)
- {
- $shtml .= "<img src=\"".$image_path."starred.gif\" align=\"absmiddle\">";
- }else
- {
- $shtml .= "<img src=\"".$image_path."unstarred.gif\" align=\"absmiddle\">";
- }
- $shtml .= "<a href=\"".$this->rss_object[link]."\"> ".$rssrow[rsstitle]."</a>
- </td>
- </tr>
- </table>";
-
- }
- }
- return $shtml;
-
-
- /*if($this->rss_object)
- {
- $shtml = "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"4\">
- <tr>
- <td class=\"rssPgTitle\"><img src=\"".$image_path."starred.gif\" align=\"absmiddle\">
- <a href=\"".$this->rss_object[link]."\">".$this->rss_object[title]."</a>
- </td>
- </tr>
- </table>";
- return $shtml;
- }*/
- }
+ {
+ global $image_path;
+ global $adb;
+
+ if($rssid != "")
+ {
+ $sSQL = "select * from rss where rssid=".$rssid;
+ $result = $adb->query($sSQL);
+ $rssrow = $adb->fetch_array($result);
+
+ if(count($rssrow) > 0)
+ {
+ $shtml = "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"4\">
+ <tr>
+ <td class=\"rssPgTitle\">";
+ if($rssrow[starred] == 1)
+ {
+ $shtml .= "<img src=\"".$image_path."starred.gif\" align=\"absmiddle\">";
+ }else
+ {
+ $shtml .= "<img src=\"".$image_path."unstarred.gif\" align=\"absmiddle\">";
+ }
+ $shtml .= "<a href=\"".$this->rss_object[link]."\"> ".$rssrow[rsstitle]."</a>
+ </td>
+ </tr>
+ </table>";
+
+ }
+ }
+ return $shtml;
+ }
function getTopStarredRSSFeeds()
{
global $adb;
- global $image_path;
-
- $sSQL = "select * from rss where starred=1";
- $result = $adb->query($sSQL);
+ global $image_path;
+
+ $sSQL = "select * from rss where starred=1";
+ $result = $adb->query($sSQL);
$shtml .= "<img src=\"".$image_path."rss.gif\" border=\"0\" align=\"absmiddle\" hspace=\"2\"><a href=\"#\" onclick='window.open(\"index.php?module=Rss&action=Popup\",\"new\",\"width=500,height=300,resizable=1,scrollbars=1\");'>Add New Rss</a>";
- while($allrssrow = $adb->fetch_array($result))
- {
- $shtml .= "<img src=\"".$image_path."rss.gif\" border=\"0\" align=\"absmiddle\" hspace=\"2\">";
- $shtml .= "<a href=\"index.php?module=Rss&action=ListView&record=$allrssrow[rssid]\" class=\"rssFavLink\"> ".substr($allrssrow['rsstitle'],0,10)."...</a></img>";
- }
- return $shtml;
- }
-
+ while($allrssrow = $adb->fetch_array($result))
+ {
+ $shtml .= "<img src=\"".$image_path."rss.gif\" border=\"0\" align=\"absmiddle\" hspace=\"2\">";
+ $shtml .= "<a href=\"index.php?module=Rss&action=ListView&record=$allrssrow[rssid]\" class=\"rssFavLink\"> ".substr($allrssrow['rsstitle'],0,10)."...</a></img>";
+ }
+ return $shtml;
+ }
+
+ /** Function to get the rssfeed lists for the starred Rss feeds
+ * This Function accepts no argument and returns the rss feeds of
+ * the starred Feeds as HTML strings
+ */
function getStarredRssHTML()
{
global $adb;
- global $image_path;
-
- $sSQL = "select * from rss where starred=1";
- $result = $adb->query($sSQL);
- //$shtml = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>";
-
- while($allrssrow = $adb->fetch_array($result))
- {
- //$allrssrow["rssurl"];
-
- if($this->setRSSUrl($allrssrow["rssurl"]))
- {
- $rss_html = $this->getListViewRSSHtml();
- }
- $shtml .= "<td width=\"50%\" valign=\"top\">
- <table class=\"formOuterBorder\" width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\"> <tr><td class=\"formSecHeader\">";
- $shtml .= "<img src=\"".$image_path."onstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','0')\">
- <span style=\"font-weight:normal\">Today at</span>";
- $shtml .= " <a href=\"javascript:display('".$this->rss_link."',this)\";>".$allrssrow['rsstitle']."</a>";
- $shtml .= "</td></tr>";
- $shtml .= "<tr><td style=\"padding-top:10\"><ul>".$rss_html."</ul></td></tr>";
- if(isset($this->rss_object))
- {
- if(count($this->rss_object) > 10)
- {
- $shtml .= "<tr><td align=\"right\">
- <a href=\"javascript:display('".$this->rss_link."',this)\";>More...</a>
- </td></tr>";
- }
- }
- $shtml .= "</table></td><td style=\"width:20;\"> </td>";
- $sreturnhtml[] = $shtml;
- $shtml = "";
- }
-
+ global $image_path;
+
+ $sSQL = "select * from rss where starred=1";
+ $result = $adb->query($sSQL);
+ while($allrssrow = $adb->fetch_array($result))
+ {
+ if($this->setRSSUrl($allrssrow["rssurl"]))
+ {
+ $rss_html = $this->getListViewRSSHtml();
+ }
+ $shtml .= $rss_html;
+ if(isset($this->rss_object))
+ {
+ if(count($this->rss_object) > 10)
+ {
+ $shtml .= "<tr><td colspan='3' align=\"right\">
+ <a target=\"_BLANK\" href=\"$this->rss_link\">More...</a>
+ </td></tr>";
+ }
+ }
+ $sreturnhtml[] = $shtml;
+ $shtml = "";
+ }
+
$recordcount = round((count($sreturnhtml))/2);
$j = $recordcount;
- for($i=0;$i<$recordcount;$i++)
- {
- $starredhtml .= "<tr>".$sreturnhtml[$i].$sreturnhtml[$j]."</tr>";
+ for($i=0;$i<$recordcount;$i++)
+ {
+ $starredhtml .= $sreturnhtml[$i].$sreturnhtml[$j];
$j = $j + 1;
}
- $starredhtml = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">".$starredhtml."</table>";
-
+ $starredhtml = "<table class='rssTable' cellspacing='0' cellpadding='0'>
+ <tr>
+ <th width='65%'>Subject</th>
+ <th width='20%'>Sender</th>
+ <th width='15%'>Date</th>
+ </tr>".$starredhtml."</table>";
+
return $starredhtml;
}
+
+ /** Function to get the rssfeed lists for the given rssid
+ * This Function accepts the rssid as argument and returns the rss feeds as HTML strings
+ */
+ function getSelectedRssHTML($rssid)
+ {
+ global $adb;
+ global $image_path;
+
+ $sSQL = "select * from rss where rssid=".$rssid;
+ $result = $adb->query($sSQL);
+ while($allrssrow = $adb->fetch_array($result))
+ {
+ if($this->setRSSUrl($allrssrow["rssurl"]))
+ {
+ $rss_html = $this->getListViewRSSHtml();
+ }
+ $shtml .= $rss_html;
+ if(isset($this->rss_object))
+ {
+ if(count($this->rss_object) > 10)
+ {
+ $shtml .= "<tr><td colspan='3' align=\"right\">
+ <a target=\"_BLANK\" href=\"$this->rss_link\">More...</a>
+ </td></tr>";
+ }
+ }
+ $sreturnhtml[] = $shtml;
+ $shtml = "";
+ }
+
+ $recordcount = round((count($sreturnhtml))/2);
+ $j = $recordcount;
+ for($i=0;$i<$recordcount;$i++)
+ {
+ $starredhtml .= $sreturnhtml[$i].$sreturnhtml[$j];
+ $j = $j + 1;
+ }
+ $starredhtml = "<table class='rssTable' cellspacing='0' cellpadding='0'>
+ <tr>
+ <th width='65%'>Subject</th>
+ <th width='20%'>Sender</th>
+ <th width='15%'>Date</th>
+ </tr>".$starredhtml."</table>";
+
+ return $starredhtml;
+
+ }
+
+ /** Function to get the Rss Feeds by Category
+ * This Function accepts the RssCategory as argument
+ * and returns the html string for the Rss feeds lists
+ */
+ function getRSSCategoryHTML()
+ {
+ global $adb;
+ global $image_path;
+ $sSQL = "select * from rsscategory where presence = 1 order by sortorderid";
+ $result = $adb->query($sSQL);
+
+ while($categoryrow = $adb->fetch_array($result))
+ {
+ $shtml .= "<tr>
+ <td width=\"15\">
+ <div align=\"center\"><a href=\"javascript:;\" onClick=\"toggleRSSFolder('".$categoryrow["sortorderid"]."')\"><img id=\"".$categoryrow["sortorderid"]."_toggle\" src=\"".$image_path."plus.gif\" border=\"0\"></a></div>
+ </td>
+ <td width=\"20\">
+ <div align=\"center\"><img id=\"".$categoryrow["sortorderid"]."_folder\" src=\"".$image_path."rss_folder_cls.gif\"></div>
+ </td>
+ <td nowrap><a href=\"javascript:;\" onClick=\"toggleRSSFolder('".$categoryrow["sortorderid"]."')\" class=\"rssFolder\">".$categoryrow["rsscategory"]."</a>
+ </td>
+ </tr>
+ <tr>
+ <td colspan=\"3\">
+ <div id=\"".$categoryrow["sortorderid"]."_feeds\" style=\"display:none\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\" style=\"margin:5 0 0 35\">".$this->getRssFeedsbyCategory($categoryrow["rsscategory"])."</table></div>
+ </td>
+ </tr>";
+ }
+
+ return $shtml;
+ }
+
+ /** Function to get the Rss Feeds for the Given Category
+ * This Function accepts the RssCategory as argument
+ * and returns the html string for the Rss feeds lists
+ */
+ function getRssFeedsbyCategory($rsscategory)
+ {
+
+ global $adb;
+ global $image_path;
+
+ $sSQL = "select * from rss where rsscategory='".$rsscategory."'";
+ $result = $adb->query($sSQL);
+ while($allrssrow = $adb->fetch_array($result))
+ {
+ $shtml .= "<tr id='feed_".$allrssrow[rssid]."'>";
+ $shtml .= "<td width=\"15\">";
+ if($allrssrow["starred"] == 1)
+ {
+ $shtml .= "<img src=\"".$image_path."onstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','1')\">";
+ }else
+ {
+ $shtml .= "<img src=\"".$image_path."offstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','1')\">";
+ }
+ $shtml .= "</td>";
+ $shtml .= "<td class=\"rssTitle\" width=\"10%\" nowrap><a href=\"javascript:GetRssFeedList('$allrssrow[rssid]')\" class=\"rssTitle\">".$allrssrow[rsstitle]."</a></td><td><a href=\"javascript:DeleteRssFeeds('$allrssrow[rssid]');\"><img src=\"".$image_path."del.gif\" border=\"0\" align=\"absmiddle\"></a></td>";
+ $shtml .= "</tr>";
+ }
+ return $shtml;
+
+ }
+
+ /** Function to get the rsscategories
+ * This Function accepts no argument and returns the categorylist as an array
+ */
+
+ function getRsscategory()
+ {
+ global $adb;
+ global $image_path;
+ $sSQL = "select * from rsscategory where presence = 1 order by sortorderid";
+ $result = $adb->query($sSQL);
+
+ while($categoryrow = $adb->fetch_array($result))
+ {
+ $rsscategories[] = $categoryrow["rsscategory"];
+ }
+
+ return $rsscategories;
+ }
- function getSelectedRssHTML($rssid)
- {
- global $adb;
- global $image_path;
-
- $sSQL = "select * from rss where rssid=".$rssid;
- $result = $adb->query($sSQL);
- // $shtml = "<table width=\"100%\" border=\"0\" cellspacing=\"4\" cellpadding=\"0\">";
-
- while($allrssrow = $adb->fetch_array($result))
- {
- //$allrssrow["rssurl"];
-
- if($this->setRSSUrl($allrssrow["rssurl"]))
- {
- $rss_html = $this->getListViewRSSHtml();
- }
- $shtml = "<table class=\"formOuterBorder\" width=\"80%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\"><tr><td class=\"formSecHeader\">";
- if($allrssrow["starred"] == 1)
- {
- $shtml .= "<img src=\"".$image_path."onstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','0')\"> <span style=\"font-weight:normal\">Today at</span> "; }else
- {
- $shtml .= "<img src=\"".$image_path."offstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','1')\"> <span style=\"font-weight:normal\">Today at</span> ";
- }
- $shtml .= " <a href=\"javascript:display('".$this->rss_link."',this)\";>".$allrssrow['rsstitle']."</a>";
- $shtml .= "</td></tr>";
- $shtml .= "<tr><td style=\"padding-top:10\"><ul>".$rss_html."</ul></td></tr>";
- }
- if(isset($this->rss_object))
- {
- if(count($this->rss_object) > 10)
- {
- $shtml .= "<tr><td align=\"right\">
- <a href=\"javascript:display('".$this->rss_link."',this)\";>More...</a>
- </td></tr>";
- }
- }
- $shtml .= "</table>";
- return $shtml;
- }
-
- function getRSSCategoryHTML()
- {
+ function getRsscategory_html()
+ {
+ $rsscategory = $this->getRsscategory();
+ if(isset($rsscategory))
+ {
+ for($i=0;$i<count($rsscategory);$i++)
+ {
+ $shtml .= "<option value=\"$rsscategory[$i]\">$rsscategory[$i]</option>";
+ }
+ }
+ return $shtml;
+ }
+}
+
+/** Function to get the rsstitle for the given rssid
+ * This Function accepts the rssid as an optional argument and returns the title
+ * if no id is passed it will return the tittle of the starred rss
+ */
+function gerRssTitle($id='')
+{
global $adb;
- global $image_path;
- $sSQL = "select * from rsscategory where presence = 1 order by sortorderid";
- $result = $adb->query($sSQL);
-// $categoryrow = $adb->fetch_array($result);
+ if($id == '')
+ $query = 'select * from rss where starred=1';
+ else
+ $query = 'select * from rss where rssid ='.$id;
+ $result = $adb->query($query);
+ $title = $adb->query_result($result,0,'rsstitle');
+ return $title;
- while($categoryrow = $adb->fetch_array($result))
- {
- $shtml .= "<tr>
- <td width=\"15\">
- <div align=\"center\"><a href=\"javascript:;\" onClick=\"toggleRSSFolder('".$categoryrow["sortorderid"]."')\"><img id=\"".$categoryrow["sortorderid"]."_toggle\" src=\"".$image_path."plus.gif\" border=\"0\"></a></div></td>
- <td width=\"20\"><div align=\"center\"><img id=\"".$categoryrow["sortorderid"]."_folder\" src=\"".$image_path."rss_folder_cls.gif\"></div></td>
- <td nowrap><a href=\"javascript:;\" onClick=\"toggleRSSFolder('".$categoryrow["sortorderid"]."')\" class=\"rssFolder\">".$categoryrow["rsscategory"]."</a></td>
- </tr>
- <tr>
- <td colspan=\"3\"><div id=\"".$categoryrow["sortorderid"]."_feeds\" style=\"display:none\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\" style=\"margin:5 0 0 35\">".$this->getRssFeedsbyCategory($categoryrow["rsscategory"])."</table></div></td>
- </tr>";
- }
-
- return $shtml;
- }
-
- function getRssFeedsbyCategory($rsscategory)
- {
-
- global $adb;
- global $image_path;
-
- $sSQL = "select * from rss where starred <> 1 and rsscategory='".$rsscategory."'";
- $result = $adb->query($sSQL);
- while($allrssrow = $adb->fetch_array($result))
- {
- $shtml .= "<tr>";
- $shtml .= "<td width=\"15\">
- <img src=\"".$image_path."offstar.gif\" align=\"absmiddle\" onMouseOver=\"this.style.cursor='pointer'\" id=\"star-$allrssrow[rssid]\" onclick=\"star('$allrssrow[rssid]','1')\"></td>";
- $shtml .= "<td class=\"rssTitle\" width=\"10%\"><a href=\"index.php?module=Rss&action=index&record=$allrssrow[rssid]\" class=\"rssTitle\">".$allrssrow[rsstitle]."</a></td><td><a href=\"index.php?module=Rss&action=Delete&return_module=Rss&return_action=index&record=$allrssrow[rssid]\"><img src=\"".$image_path."del.gif\" border=\"0\" align=\"absmiddle\"></a></td>";
- $shtml .= "</tr>";
- }
- return $shtml;
-
- }
-
-
- function getRsscategory()
- {
- global $adb;
- global $image_path;
- $sSQL = "select * from rsscategory where presence = 1 order by sortorderid";
- $result = $adb->query($sSQL);
-
- while($categoryrow = $adb->fetch_array($result))
- {
- $rsscategories[] = $categoryrow["rsscategory"];
- }
-
- return $rsscategories;
- }
}
+
+
+
?>
More information about the vtigercrm-commits
mailing list