1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Issue #90 - Newsfeed plugin (also #6 and GUI styling)

This commit is contained in:
Tijn Kuyper 2013-02-07 12:34:37 +01:00
parent a50848f6d7
commit 31e52b7d78
2 changed files with 75 additions and 79 deletions

View File

@ -57,10 +57,12 @@ if (isset($_POST['createFeed']) || isset($_POST['updateFeed']))
{ {
$admin_log->logArrayAll('NEWSFD_01', $feed); $admin_log->logArrayAll('NEWSFD_01', $feed);
$message = NFLAN_23; $message = NFLAN_23;
$mes->addSuccess(LAN_CREATED);
} }
else else
{ {
$message = NFLAN_50.$sql->mySQLerror; //$message = NFLAN_50.$sql->mySQLerror;
$mes->addError(LAN_CREATED_FAILED.': '.$sql->mySQLerror);
} }
} }
elseif (isset($_POST['updateFeed'])) elseif (isset($_POST['updateFeed']))
@ -68,34 +70,42 @@ if (isset($_POST['createFeed']) || isset($_POST['updateFeed']))
if ($sql->db_UpdateArray('newsfeed',$feed, " WHERE newsfeed_id=".intval($_POST['newsfeed_id']))) if ($sql->db_UpdateArray('newsfeed',$feed, " WHERE newsfeed_id=".intval($_POST['newsfeed_id'])))
{ {
$admin_log->logArrayAll('NEWSFD_02', $feed); $admin_log->logArrayAll('NEWSFD_02', $feed);
$message = NFLAN_25; //$message = NFLAN_25;
$mes->addSuccess(LAN_UPDATED);
} }
else else
{ {
$message = NFLAN_50.$sql->mySQLerror; //$message = NFLAN_50.$sql->mySQLerror;
$mes->addInfo(LAN_NO_CHANGE.': '.$sql->mySQLerror);
} }
} }
$e107->ecache->clear(NEWSFEED_LIST_CACHE_TAG); // This should actually clear all the newsfeed data in one go $e107->ecache->clear(NEWSFEED_LIST_CACHE_TAG); // This should actually clear all the newsfeed data in one go
} }
else else
{ {
$message = NFLAN_24; //$message = NFLAN_24;
$mes->addError(LAN_REQUIRED_BLANK);
} }
} }
$ns->tablerender($caption, $mes->render() . $text);
if($action == "delete") if($action == "delete")
{ {
$sql->db_Delete('newsfeed', 'newsfeed_id='.$id); $sql->db_Delete('newsfeed', 'newsfeed_id='.$id);
$admin_log->log_event('NEWSFD_03','ID: '.$id,E_LOG_INFORMATIVE,''); $admin_log->log_event('NEWSFD_03','ID: '.$id,E_LOG_INFORMATIVE,'');
$message = NFLAN_40; //$message = NFLAN_40;
$mes->addSuccess(LAN_DELETED);
} }
/*
if (isset($message)) if (isset($message))
{ {
$mes->addInfo($message); $mes->addInfo($message);
// $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>"); // $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
} }
*/
$ns->tablerender($caption, $mes->render() . $text);
if($headline_total = $sql->db_Select("newsfeed")) if($headline_total = $sql->db_Select("newsfeed"))
@ -103,7 +113,7 @@ if($headline_total = $sql->db_Select("newsfeed"))
$nfArray = $sql -> db_getList(); $nfArray = $sql -> db_getList();
$text = " $text = "
<table class='table adminform'> <table class='table adminlist'>
<colgroup> <colgroup>
<col style='width: 5%; text-align: center;' /> <col style='width: 5%; text-align: center;' />
<col style='width: 50%;' /> <col style='width: 50%;' />
@ -113,11 +123,11 @@ if($headline_total = $sql->db_Select("newsfeed"))
</colgroup> </colgroup>
<tr> <tr>
<td>ID</td> <td>".LAN_ID."</td>
<td>".NFLAN_30."</td> <td>".LAN_NAME."</td>
<td>".NFLAN_26."</td> <td>".NFLAN_26."</td>
<td>".NFLAN_12."</td> <td>".NFLAN_12."</td>
<td>".NFLAN_27."</td> <td>".LAN_OPTIONS."</td>
</tr>\n"; </tr>\n";
$active = array(NFLAN_13,NFLAN_14,NFLAN_20,NFLAN_21); $active = array(NFLAN_13,NFLAN_14,NFLAN_20,NFLAN_21);
@ -126,11 +136,13 @@ if($headline_total = $sql->db_Select("newsfeed"))
{ {
extract($newsfeed); extract($newsfeed);
$text .= "<tr><td>$newsfeed_id</td> $text .= "
<td><a href='$newsfeed_url' rel='external'>$newsfeed_name</a></td> <tr>
<td>".($newsfeed_updateint ? $newsfeed_updateint : "3600")."</td> <td>$newsfeed_id</td>
<td>".$active[$newsfeed_active]."</td> <td><a href='$newsfeed_url' rel='external'>$newsfeed_name</a></td>
<td><a href='".e_SELF."?edit.".$newsfeed_id."'>".ADMIN_EDIT_ICON."</a>&nbsp;<a href='".e_SELF."?delete.".$newsfeed_id."'>".ADMIN_DELETE_ICON."</a></td> <td>".($newsfeed_updateint ? $newsfeed_updateint : "3600")."</td>
<td>".$active[$newsfeed_active]."</td>
<td><a href='".e_SELF."?edit.".$newsfeed_id."'>".ADMIN_EDIT_ICON."</a>&nbsp;<a href='".e_SELF."?delete.".$newsfeed_id."'>".ADMIN_DELETE_ICON."</a></td>
</tr>\n"; </tr>\n";
} }
@ -148,7 +160,7 @@ if($action == "edit")
if($sql->db_Select("newsfeed", "*", "newsfeed_id=$id")) if($sql->db_Select("newsfeed", "*", "newsfeed_id=$id"))
{ {
$row = $sql->db_Fetch(); $row = $sql->db_Fetch();
extract($row); extract($row); // FIX
list($newsfeed_image, $newsfeed_showmenu, $newsfeed_showmain) = explode("::", $newsfeed_image); list($newsfeed_image, $newsfeed_showmenu, $newsfeed_showmain) = explode("::", $newsfeed_image);
} }
} }
@ -166,77 +178,60 @@ $text = "
</colgroup> </colgroup>
<tr> <tr>
<td>".NFLAN_30."</td> <td>".LAN_NAME."</td>
<td> <td><input class='tbox' type='text' name='newsfeed_name' size='80' value='$newsfeed_name' maxlength='200' /></td>
<input class='tbox' type='text' name='newsfeed_name' size='80' value='$newsfeed_name' maxlength='200' />
</td>
</tr> </tr>
<tr> <tr>
<td>".NFLAN_10."</td> <td>".LAN_URL."</td>
<td> <td><input class='tbox' type='text' name='newsfeed_url' size='80' value='$newsfeed_url' maxlength='250' /><span class='field-help'>".NFLAN_10."</span></td>
<input class='tbox' type='text' name='newsfeed_url' size='80' value='$newsfeed_url' maxlength='250' />
</td>
</tr> </tr>
<tr> <tr>
<td>".NFLAN_11."</td> <td>".NFLAN_11."</td>
<td> <td><input class='tbox' type='text' name='newsfeed_image' size='80' value='$newsfeed_image' maxlength='200' /><span class='field-help'>".NFLAN_17."</span></td>
<input class='tbox' type='text' name='newsfeed_image' size='80' value='$newsfeed_image' maxlength='200' />
<span class='field-help'>".NFLAN_17."</span>
</td>
</tr> </tr>
<tr> <tr>
<td>".NFLAN_36."</td> <td>".LAN_DESCRIPTION."</td>
<td> <td><input class='tbox' type='text' name='newsfeed_description' size='80' value='$newsfeed_description' maxlength='200' /><span class='field-help'>".NFLAN_37."</span></td>
<input class='tbox' type='text' name='newsfeed_description' size='80' value='$newsfeed_description' maxlength='200' />
<span class='field-help'>".NFLAN_37."</span>
</td>
</tr> </tr>
<tr> <tr>
<td>".NFLAN_18."</td> <td>".NFLAN_18."</td>
<td>". <td>".$frm->number('newsfeed_updateint',($newsfeed_updateint ? $newsfeed_updateint : 3600),5)."<span class='field-help'>".NFLAN_19."</span></td>
$frm->number('newsfeed_updateint',($newsfeed_updateint ? $newsfeed_updateint : 3600),5)."
<span class='field-help'>".NFLAN_19."</span>
</td>
</tr> </tr>
<tr> <tr>
<td>".NFLAN_12."</td> <td>".NFLAN_12."</td>
<td>"; <td>";
$array = array(NFLAN_13,NFLAN_14,NFLAN_20,NFLAN_21);
$array = array(NFLAN_13,NFLAN_14,NFLAN_20,NFLAN_21); $text .=
$frm->radio_multi('newsfeed_active', $array, ($newsfeeed_active ? $newsfeeed_active : 0), true, NFLAN_22)."
$text .= </td>
$frm->radio_multi('newsfeed_active', $array, ($newsfeeed_active ? $newsfeeed_active : 0), true, NFLAN_22)."
</td>
</tr> </tr>
<tr> <tr>
<td>".NFLAN_45."</td> <td>".NFLAN_45."</td>
<td>". <td>".$frm->number('newsfeed_showmenu', $newsfeed_showmenu ,5)."<span class='field-help'>".NFLAN_47."</span></td>
$frm->number('newsfeed_showmenu', $newsfeed_showmenu ,5)."
<span class='field-help'>".NFLAN_47."</span></td>
</tr> </tr>
<tr> <tr>
<td>".NFLAN_46."</td> <td>".NFLAN_46."</td>
<td>". <td>".$frm->number('newsfeed_showmain', $newsfeed_showmain ,5)."<span class='field-help'>".NFLAN_47."</span></td>
$frm->number('newsfeed_showmain', $newsfeed_showmain ,5)."
<span class='field-help'>".NFLAN_47."</span></td>
</tr> </tr>
</table> </table>
<div class='buttons-bar center'> <div class='buttons-bar center'>
".$frm->admin_button(($action == "edit" ? "updateFeed" : "createFeed"),($action == "edit" ? NFLAN_16 : NFLAN_15),'update')." ".$frm->admin_button(($action == "edit" ? "updateFeed" : "createFeed"),($action == "edit" ? LAN_UPDATE : LAN_CREATE),'update')."
</div> </div>
".($action == "edit" ? "<input type='hidden' name='newsfeed_id' value='$newsfeed_id' />" : "")." ".($action == "edit" ? "<input type='hidden' name='newsfeed_id' value='$newsfeed_id' />" : "")."
</form> </form>
"; ";
$ns->tablerender(NFLAN_09, $mes->render(). $text); $ns->tablerender(NFLAN_09, $mes->render() . $text);
require_once(e_ADMIN."footer.php"); require_once(e_ADMIN."footer.php");
?> ?>

View File

@ -16,44 +16,45 @@
//define("NFLAN_01", "Newsfeeds"); //define("NFLAN_01", "Newsfeeds");
//define("NFLAN_02", "This plugin will retrieve rss feeds from other websites and display them according to your preferences"); //define("NFLAN_02", "This plugin will retrieve rss feeds from other websites and display them according to your preferences");
define("NFLAN_03", "Configure newsfeeds"); define("NFLAN_03", "Configure newsfeeds"); // FIX USE GENERIC
define("NFLAN_04", "Newsfeeds plugin has been successfully installed. To add newsfeeds and configure, return to the main admin page and click on the newsfeeds icon in the plugin section."); define("NFLAN_04", "Newsfeeds plugin has been successfully installed. To add newsfeeds and configure, return to the main admin page and click on the newsfeeds icon in the plugin section."); // FIX USE GENERIC
define("NFLAN_05", "Edit"); //define("NFLAN_05", "Edit");
define("NFLAN_06", "Delete"); //define("NFLAN_06", "Delete");
define("NFLAN_07", "Existing Newsfeeds"); define("NFLAN_07", "Existing Newsfeeds");
define("NFLAN_08", "Newsfeeds front page"); define("NFLAN_08", "Newsfeeds front page");
define("NFLAN_09", "Create newsfeed"); define("NFLAN_09", "Create newsfeed");
define("NFLAN_10", "URL to rss feed"); //define("NFLAN_10", "URL to rss feed");
define("NFLAN_10", "URL to the RSS feed.");
define("NFLAN_11", "Path to image"); define("NFLAN_11", "Path to image");
define("NFLAN_12", "Activation"); define("NFLAN_12", "Activation");
define("NFLAN_13", "Nowhere (inactive)"); define("NFLAN_13", "Nowhere (inactive)");
define("NFLAN_14", "In menu only"); define("NFLAN_14", "In menu only");
define("NFLAN_15", "Create Newsfeed"); //define("NFLAN_15", "Create Newsfeed");
define("NFLAN_16", "Update Newsfeed"); //define("NFLAN_16", "Update Newsfeed");
define("NFLAN_17", "enter 'default' in box to use the image defined in the feed, to use your own image enter full path, leave blank for no image."); define("NFLAN_17", "Enter 'default' to use the image defined in the feed. To use your own image, enter full path. Leave blank for no image.");
define("NFLAN_18", "Update interval in seconds"); define("NFLAN_18", "Update interval in seconds");
define("NFLAN_19", "e.g. 3600: newsfeed will update every hour"); define("NFLAN_19", "e.g. 3600: newsfeed will update every hour");
define("NFLAN_20", "On newsfeed main page only"); define("NFLAN_20", "On newsfeed main page only");
define("NFLAN_21", "In both menu and newsfeed page"); define("NFLAN_21", "In both menu and newsfeed page");
define("NFLAN_22", "choose where you want the newsfeed displayed"); define("NFLAN_22", "Choose where you want the newsfeed displayed.");
define("NFLAN_23", "Newsfeed added to database."); //define("NFLAN_23", "Newsfeed added to database.");
define("NFLAN_24", "Required field(s) left blank."); //define("NFLAN_24", "Required field(s) left blank.");
define("NFLAN_25", "Newsfeed updated in database."); //define("NFLAN_25", "Newsfeed updated in database.");
define("NFLAN_26", "Update Interval"); define("NFLAN_26", "Update Interval");
define("NFLAN_27", "Options"); //define("NFLAN_27", "Options");
define("NFLAN_28", "URL"); //define("NFLAN_28", "URL");
//define("NFLAN_29", "Available newsfeeds"); //define("NFLAN_29", "Available newsfeeds");
define("NFLAN_30", "Feed name"); //define("NFLAN_30", "Feed name");
//define("NFLAN_31", "Back to newsfeed list"); //define("NFLAN_31", "Back to newsfeed list");
define("NFLAN_32", "No feed with that identification number can be found."); //define("NFLAN_32", "No feed with that identification number can be found.");
//define("NFLAN_33", "Date published: "); //define("NFLAN_33", "Date published: ");
//define("NFLAN_34", "not known"); //define("NFLAN_34", "not known");
define("NFLAN_35", "posted by "); //define("NFLAN_35", "posted by ");
define("NFLAN_36", "Description"); //define("NFLAN_36", "Description");
define("NFLAN_37", "short description of feed, enter 'default' to use the description defined in the feed"); define("NFLAN_37", "Short description of feed. Enter 'default' to use the description defined in the feed");
//define("NFLAN_38", "Headlines"); //define("NFLAN_38", "Headlines");
//define("NFLAN_39", "Details"); //define("NFLAN_39", "Details");
define("NFLAN_40", "Newsfeed deleted"); //define("NFLAN_40", "Newsfeed deleted");
define("NFLAN_41", "No newsfeeds defined yet"); define("NFLAN_41", "No newsfeeds defined yet");
define("NFLAN_42", "<b>&raquo;</b> <u>Feed Name:</u> define("NFLAN_42", "<b>&raquo;</b> <u>Feed Name:</u>
@ -83,7 +84,7 @@ define("NFLAN_47", "0 or blank to show all");
//define("NFLAN_48", "Unable to save raw data in database."); //define("NFLAN_48", "Unable to save raw data in database.");
define("NFLAN_49", "Unable to unserialize rss data - uses non-standard syntax"); define("NFLAN_49", "Unable to unserialize rss data - uses non-standard syntax");
define('NFLAN_50', 'Write to database failed: '); //define('NFLAN_50', 'Write to database failed: ');
// Admin log messages // Admin log messages
//=================== //===================