CMS module for Phprojekt

CMS module for Phprojekt
Tasklist

FS#61 - Syndication news in summary page.

Attached to Project: CMS module for Phprojekt
Opened by Mario A. Valdez-Ramirez (mvaldez) - Wednesday, 14 July 2004, 14:12 GMT-6
Last edited by Mario A. Valdez-Ramirez (mvaldez) - Wednesday, 14 July 2004, 14:18 GMT-6
Task Type New feature
Category Backend / Core
Status Assigned
Assigned To Mario A. Valdez-Ramirez (mvaldez)
Operating System All
Severity Medium
Priority Low
Reported Version any
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

An user asked in the forums for a way to display the syndication news in the summary page. I remember thinking about that feature back in 0.6.0beta but never implemented because the summary page seemed not the right place. (Early inductive inference about the purpose of the summary page led me to conclude that it was a place for a preview of the content, not as THE main content source of information). However, our case is not the case of everybody.

This is the question asked by the user:

> Is there a way to have the RSS news
> feeds show up on the Summary page
> along with the list of recent documents
> from the articles page? As it is now, you
> can only read the headlines from the
> feeds if you go to the articles page but
> it seems it would be a good idea to have
> them right there on the summary page
> along with all the other info when people log in.
> Thanks for any suggestions!
This task depends upon

Comment by Mario A. Valdez-Ramirez (mvaldez) - Wednesday, 14 July 2004, 14:13 GMT-6
And this was my answer:

First, edit the file cm/cm_lib.inc.php and look for the function fcm_display_txtrdfbox around line 1557. You need to modify that little function (which currently is unused, by the way) and change line 1562:

...a href=\"../cm/redir.php?cm...

The only change was to add the "../cm/" string to the link, so the RSS links are correctly referenced.

Then, after that function, around line 1568, add the following function:

function fcm_display_txtsynd ($cm_autodl, $cm_homepage, $cm_displayall) {
$cm_where = "";
if ($cm_autodl) {
$cm_where = "(cmdb_autodl > 0)";
}
if ($cm_homepage) {
if ($cm_where != "") {
$cm_where .= " and (cmdb_inhome > 0)";
}
else {
$cm_where = "(cmdb_inhome > 0)";
}
}
if ($cm_where != "") {
$cm_where = " where " . $cm_where;
}
$result1 = db_query("select cmdb_title, cmdb_visitems, cmdb_autodl, cmdb_inhome from " . CM_DB_PREFIX . "cmsynd3" . $cm_where . " order by upper(cmdb_title)") or db_die();
while ($row1 = db_fetch_row($result1)) {
if ($cm_displayall) {
fcm_display_txtrdfbox ($row1[0], fcm_readrdf ($row1[0], 100, CM_MAX_SYNDLEN));
}
else {
fcm_display_txtrdfbox ($row1[0], fcm_readrdf ($row1[0], $row1[1], CM_MAX_SYNDLEN));
}
}
};


This is really a copy of the fcm_display_synd function, with the difference that this calls the fcm_display_txtrdfbox function we modified before.

Now that the supporting functions are in place, let's edit the cm/cm_summary.inc.php file to call them. Around line 68 (near the end of the file) add the following code:

echo "<table width=\"$cm_tdwidth\" cellspacing=\"1\" border=\"1\"><tr><td>";
fcm_load_synd (false, true, false);
fcm_display_txtsynd (false, true, false);
echo "</td></tr></table>";


That code just add a table below the documents list with the RSS listings. Of course this is a quick hack.
Comment by Mario A. Valdez-Ramirez (mvaldez) - Wednesday, 14 July 2004, 14:18 GMT-6
That was a hack.

A global setting or a per-user setting is needed to enable or disable this. We need a new function to render all the newsfeeds. We could reuse the fcm_display_txtrdfbox which is not used now.

Need to check final rendering code.

Loading...