From 31e52b7d78dbd462e88f191eaed08627663eff5d Mon Sep 17 00:00:00 2001 From: Tijn Kuyper Date: Thu, 7 Feb 2013 12:34:37 +0100 Subject: [PATCH] Issue #90 - Newsfeed plugin (also #6 and GUI styling) --- e107_plugins/newsfeed/admin_config.php | 111 +++++++++--------- .../languages/English_admin_newsfeed.php | 43 +++---- 2 files changed, 75 insertions(+), 79 deletions(-) diff --git a/e107_plugins/newsfeed/admin_config.php b/e107_plugins/newsfeed/admin_config.php index fe6595417..5c4b93d2e 100644 --- a/e107_plugins/newsfeed/admin_config.php +++ b/e107_plugins/newsfeed/admin_config.php @@ -57,10 +57,12 @@ if (isset($_POST['createFeed']) || isset($_POST['updateFeed'])) { $admin_log->logArrayAll('NEWSFD_01', $feed); $message = NFLAN_23; + $mes->addSuccess(LAN_CREATED); } else { - $message = NFLAN_50.$sql->mySQLerror; + //$message = NFLAN_50.$sql->mySQLerror; + $mes->addError(LAN_CREATED_FAILED.': '.$sql->mySQLerror); } } 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']))) { $admin_log->logArrayAll('NEWSFD_02', $feed); - $message = NFLAN_25; + //$message = NFLAN_25; + $mes->addSuccess(LAN_UPDATED); } 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 } else { - $message = NFLAN_24; + //$message = NFLAN_24; + $mes->addError(LAN_REQUIRED_BLANK); } } +$ns->tablerender($caption, $mes->render() . $text); if($action == "delete") { $sql->db_Delete('newsfeed', 'newsfeed_id='.$id); $admin_log->log_event('NEWSFD_03','ID: '.$id,E_LOG_INFORMATIVE,''); - $message = NFLAN_40; + //$message = NFLAN_40; + $mes->addSuccess(LAN_DELETED); } +/* if (isset($message)) { $mes->addInfo($message); // $ns->tablerender("", "
".$message."
"); } +*/ +$ns->tablerender($caption, $mes->render() . $text); if($headline_total = $sql->db_Select("newsfeed")) @@ -103,7 +113,7 @@ if($headline_total = $sql->db_Select("newsfeed")) $nfArray = $sql -> db_getList(); $text = " - +
@@ -113,11 +123,11 @@ if($headline_total = $sql->db_Select("newsfeed")) - - - - - + + + + + \n"; $active = array(NFLAN_13,NFLAN_14,NFLAN_20,NFLAN_21); @@ -126,11 +136,13 @@ if($headline_total = $sql->db_Select("newsfeed")) { extract($newsfeed); - $text .= " - - - - + $text .= " + + + + + + \n"; } @@ -148,7 +160,7 @@ if($action == "edit") if($sql->db_Select("newsfeed", "*", "newsfeed_id=$id")) { $row = $sql->db_Fetch(); - extract($row); + extract($row); // FIX list($newsfeed_image, $newsfeed_showmenu, $newsfeed_showmain) = explode("::", $newsfeed_image); } } @@ -166,77 +178,60 @@ $text = " - - + + - - + + - - + + - - + + - - + + - - + + $text .= + $frm->radio_multi('newsfeed_active', $array, ($newsfeeed_active ? $newsfeeed_active : 0), true, NFLAN_22)." + - - + + - - + +
ID".NFLAN_30."".NFLAN_26."".NFLAN_12."".NFLAN_27."".LAN_ID."".LAN_NAME."".NFLAN_26."".NFLAN_12."".LAN_OPTIONS."
$newsfeed_id$newsfeed_name".($newsfeed_updateint ? $newsfeed_updateint : "3600")."".$active[$newsfeed_active]."".ADMIN_EDIT_ICON." ".ADMIN_DELETE_ICON."
$newsfeed_id$newsfeed_name".($newsfeed_updateint ? $newsfeed_updateint : "3600")."".$active[$newsfeed_active]."".ADMIN_EDIT_ICON." ".ADMIN_DELETE_ICON."
".NFLAN_30." - -".LAN_NAME."
".NFLAN_10." - -".LAN_URL."".NFLAN_10."
".NFLAN_11." - -".NFLAN_17." -".NFLAN_11."".NFLAN_17."
".NFLAN_36." - -".NFLAN_37." -".LAN_DESCRIPTION."".NFLAN_37."
".NFLAN_18."". -$frm->number('newsfeed_updateint',($newsfeed_updateint ? $newsfeed_updateint : 3600),5)." -".NFLAN_19." -".NFLAN_18."".$frm->number('newsfeed_updateint',($newsfeed_updateint ? $newsfeed_updateint : 3600),5)."".NFLAN_19."
".NFLAN_12.""; + ".NFLAN_12.""; + $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)." -
".NFLAN_45."". -$frm->number('newsfeed_showmenu', $newsfeed_showmenu ,5)." -".NFLAN_47."".NFLAN_45."".$frm->number('newsfeed_showmenu', $newsfeed_showmenu ,5)."".NFLAN_47."
".NFLAN_46."". -$frm->number('newsfeed_showmain', $newsfeed_showmain ,5)." -".NFLAN_47."".NFLAN_46."".$frm->number('newsfeed_showmain', $newsfeed_showmain ,5)."".NFLAN_47."
+
-".$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')."
-".($action == "edit" ? "" : "")." + ".($action == "edit" ? "" : "")." "; -$ns->tablerender(NFLAN_09, $mes->render(). $text); +$ns->tablerender(NFLAN_09, $mes->render() . $text); require_once(e_ADMIN."footer.php"); ?> \ No newline at end of file diff --git a/e107_plugins/newsfeed/languages/English_admin_newsfeed.php b/e107_plugins/newsfeed/languages/English_admin_newsfeed.php index 59ea6b857..1660e868c 100644 --- a/e107_plugins/newsfeed/languages/English_admin_newsfeed.php +++ b/e107_plugins/newsfeed/languages/English_admin_newsfeed.php @@ -16,44 +16,45 @@ //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_03", "Configure newsfeeds"); -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_05", "Edit"); -define("NFLAN_06", "Delete"); +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."); // FIX USE GENERIC +//define("NFLAN_05", "Edit"); +//define("NFLAN_06", "Delete"); define("NFLAN_07", "Existing Newsfeeds"); define("NFLAN_08", "Newsfeeds front page"); 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_12", "Activation"); define("NFLAN_13", "Nowhere (inactive)"); define("NFLAN_14", "In menu only"); -define("NFLAN_15", "Create 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_15", "Create Newsfeed"); +//define("NFLAN_16", "Update Newsfeed"); +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_19", "e.g. 3600: newsfeed will update every hour"); define("NFLAN_20", "On newsfeed main page only"); define("NFLAN_21", "In both menu and newsfeed page"); -define("NFLAN_22", "choose where you want the newsfeed displayed"); -define("NFLAN_23", "Newsfeed added to database."); -define("NFLAN_24", "Required field(s) left blank."); -define("NFLAN_25", "Newsfeed updated in database."); +define("NFLAN_22", "Choose where you want the newsfeed displayed."); +//define("NFLAN_23", "Newsfeed added to database."); +//define("NFLAN_24", "Required field(s) left blank."); +//define("NFLAN_25", "Newsfeed updated in database."); define("NFLAN_26", "Update Interval"); -define("NFLAN_27", "Options"); -define("NFLAN_28", "URL"); +//define("NFLAN_27", "Options"); +//define("NFLAN_28", "URL"); //define("NFLAN_29", "Available newsfeeds"); -define("NFLAN_30", "Feed name"); +//define("NFLAN_30", "Feed name"); //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_34", "not known"); -define("NFLAN_35", "posted by "); -define("NFLAN_36", "Description"); -define("NFLAN_37", "short description of feed, enter 'default' to use the description defined in the feed"); +//define("NFLAN_35", "posted by "); +//define("NFLAN_36", "Description"); +define("NFLAN_37", "Short description of feed. Enter 'default' to use the description defined in the feed"); //define("NFLAN_38", "Headlines"); //define("NFLAN_39", "Details"); -define("NFLAN_40", "Newsfeed deleted"); +//define("NFLAN_40", "Newsfeed deleted"); define("NFLAN_41", "No newsfeeds defined yet"); define("NFLAN_42", "» Feed Name: @@ -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_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 //===================