From 1b9251e75f4b1a33169f5dad5e06b8d8fc849c3a Mon Sep 17 00:00:00 2001 From: Tijn Kuyper Date: Sun, 27 Oct 2019 21:40:59 +0100 Subject: [PATCH] Fixes #3622 - Reported broken downloads reworked - Moved away from e107_admin/message.php to its own place in the Downloads admin area. - Notification of broken downloads now controlled by e_notify (see Admin Area > Settings > Notify) - Updated notification message - Added e_dashboard addon to show latest status on broken download reports --- e107_admin/message.php | 2 +- .../shortcodes/batch/admin_shortcodes.php | 2 +- e107_plugins/download/e_dashboard.php | 29 ++++++ e107_plugins/download/e_notify.php | 8 +- .../download/handlers/download_class.php | 2 +- e107_plugins/download/includes/admin.php | 97 ++++++++++++++++--- .../languages/English/English_admin.php | 6 +- .../languages/English/English_global.php | 4 + 8 files changed, 133 insertions(+), 17 deletions(-) create mode 100644 e107_plugins/download/e_dashboard.php diff --git a/e107_admin/message.php b/e107_admin/message.php index d381fc2a0..2be9b4039 100644 --- a/e107_admin/message.php +++ b/e107_admin/message.php @@ -16,7 +16,7 @@ $e_sub_cat = 'message'; require_once("auth.php"); $gen = new convert; -$messageTypes = array("Broken Download", "Dev Team Message"); +$messageTypes = array(/*"Broken Download",*/ "Dev Team Message"); $queryString = ""; foreach($messageTypes as $types) { $queryString .= " gen_type='$types' OR"; diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index cc31b8477..7ea91d7e4 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -467,7 +467,7 @@ class admin_shortcodes $oldconfigs['e-upload'][0] = array('icon'=>E_16_UPLOADS, 'title'=>ADLAN_LAT_7, 'url'=> e_ADMIN."upload.php", 'total'=>$active_uploads); - $messageTypes = array('Broken Download', 'Dev Team Message'); + $messageTypes = array(/*'Broken Download',*/ 'Dev Team Message'); $queryString = ''; foreach($messageTypes as $types) { diff --git a/e107_plugins/download/e_dashboard.php b/e107_plugins/download/e_dashboard.php new file mode 100644 index 000000000..c95f589e6 --- /dev/null +++ b/e107_plugins/download/e_dashboard.php @@ -0,0 +1,29 @@ +count('generic', '(*)', "WHERE gen_type='Broken Download'"); + + $var[0]['icon'] = "download plugin icon "; + $var[0]['title'] = LAN_DL_LATEST_01; + $var[0]['url'] = e_PLUGIN."download/admin_download.php?mode=broken&action=list"; + $var[0]['total'] = $reported_downloads; + + return $var; + } +} \ No newline at end of file diff --git a/e107_plugins/download/e_notify.php b/e107_plugins/download/e_notify.php index 3472dedff..861eba8e3 100644 --- a/e107_plugins/download/e_notify.php +++ b/e107_plugins/download/e_notify.php @@ -39,7 +39,13 @@ class download_notify extends notify // plugin-folder + '_notify' $message = LAN_DL_NT_02; $message .= " ".$data['download_name']."
"; $message .= str_replace("[x]", $data['user'], LAN_DL_NT_03)."
"; - $message .= $data['report_add']; + $message .= $data['report_add']."

"; + + $admin_url = SITEURLBASE.e_PLUGIN_ABS."download/admin_download.php?mode=broken&action=list"; + $find = array('[', ']'); + $replace = array('', ''); + + $message .= str_replace($find, $replace, LAN_DL_NT_04); } $this->send('user_download_brokendownload_reported', LAN_DL_NT_01, $message); diff --git a/e107_plugins/download/handlers/download_class.php b/e107_plugins/download/handlers/download_class.php index 8ae0b1e00..b78f941d2 100644 --- a/e107_plugins/download/handlers/download_class.php +++ b/e107_plugins/download/handlers/download_class.php @@ -927,7 +927,7 @@ class download $user = USER ? USERNAME : LAN_GUEST; $ip = e107::getIPHandler()->getIP(false); - // Replaced with e_notify + // Replaced by e_notify /* if ($pref['download_email']) { // this needs to be moved into the NOTIFY, with an event. diff --git a/e107_plugins/download/includes/admin.php b/e107_plugins/download/includes/admin.php index 2c0c8a86d..0a36712bd 100644 --- a/e107_plugins/download/includes/admin.php +++ b/e107_plugins/download/includes/admin.php @@ -8,8 +8,6 @@ * * Download Plugin Administration UI * - * $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.8/e107_plugins/release/includes/admin.php $ - * $Id: admin.php 12212 2011-05-11 22:25:02Z e107coders $ */ if (!defined('e107_INIT')){ exit; } @@ -26,22 +24,28 @@ class plugin_download_admin extends e_admin_dispatcher */ protected $modes = array ( 'main' => array ( - 'controller' => 'download_main_admin_ui', - 'path' => null, - 'ui' => 'download_main_admin_form_ui', - 'uipath' => null + 'controller' => 'download_main_admin_ui', + 'path' => null, + 'ui' => 'download_main_admin_form_ui', + 'uipath' => null ), 'cat' => array ( - 'controller' => 'download_cat_ui', - 'path' => null, - 'ui' => 'download_cat_form_ui', - 'uipath' => null + 'controller' => 'download_cat_ui', + 'path' => null, + 'ui' => 'download_cat_form_ui', + 'uipath' => null ), 'mirror' => array( 'controller' => 'download_mirror_ui', 'path' => null, 'ui' => 'download_mirror_form_ui', 'uipath' => null + ), + 'broken' => array( + 'controller' => 'download_broken_ui', + 'path' => null, + 'ui' => 'download_broken_form_ui', + 'uipath' => null ), ); @@ -70,6 +74,10 @@ class plugin_download_admin extends e_admin_dispatcher 'mirror/create' => array('caption'=> DOWLAN_143, 'perm' => 'P'), 'other2' => array('divider'=> true), + + 'broken/list' => array('caption'=> "Broken dowloads", 'perm' => 'P'), + + 'other3' => array('divider'=> true), 'main/settings' => array('caption'=> LAN_PREFS, 'perm' => 'P'), // 'main/maint' => array('caption'=> DOWLAN_165, 'perm' => 'P'), @@ -2580,4 +2588,71 @@ class download_mirror_ui extends e_admin_ui class download_mirror_form_ui extends e_admin_form_ui { -} +} + +class download_broken_ui extends e_admin_ui +{ + + protected $pluginTitle = LAN_PLUGIN_DOWNLOAD_NAME; + protected $pluginName = 'broken_download'; + protected $table = 'generic'; + protected $pid = 'gen_id'; + protected $perPage = 10; + protected $listQry = "SELECT g.*,u.user_name FROM `#generic` AS g LEFT JOIN `#user` AS u ON g.gen_user_id = u.user_id WHERE g.gen_type='Broken Download' ORDER BY g.gen_datestamp DESC"; + + protected $fields = array ( + 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ), + 'gen_id' => array ( 'title' => LAN_ID, 'nolist'=>true, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'gen_datestamp' => array ( 'title' => LAN_DATESTAMP, 'type' => 'datestamp', 'data' => 'int', 'width' => '10%', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + //'gen_intdata' => array ( 'title' => LAN_ID, 'type' => 'number', 'batch'=>false, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), + 'gen_ip' => array ( 'title' => LAN_TITLE, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'gen_chardata' => array ( 'title' => LAN_DESCRIPTION, 'type' => 'text', 'data' => 'str', 'width' => '40%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'gen_user_id' => array ( 'title' => DOWLAN_199, 'type' => 'user', 'batch'=>false, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left nowrap', ), + 'options' => array ( 'title' => LAN_OPTIONS, 'type' => 'method', 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', 'readParms'=>'edit=0' ), + ); + + protected $fieldpref = array('gen_datestamp', 'gen_ip', 'gen_chardata', 'gen_user_id'); + + protected $batchOptions = array(); + + // optional + public function init() + { + + } + + public function afterDelete($data) + { + + } + + public function renderHelp() + { + $help_text = str_replace("[br]", "
", DOWLAN_HELP_11); + $help_text = str_replace(array("[", "]"), array(""), $help_text); + + return array('caption' => LAN_HELP, 'text' => $help_text); + } + +} + + + +class download_broken_form_ui extends e_admin_form_ui +{ + + function options($att, $value, $id, $attributes) + { + if($attributes['mode'] == 'read') + { + $download_id = $this->getController()->getListModel()->get('gen_intdata'); + + $text = "
"; + $text .= "".ADMIN_VIEW_ICON.""; + $text .= $this->renderValue('options', $value, array('readParms' => 'edit=0')); + $text .= "
"; + + return $text; + } + } +} \ No newline at end of file diff --git a/e107_plugins/download/languages/English/English_admin.php b/e107_plugins/download/languages/English/English_admin.php index 2899192d9..098f65685 100644 --- a/e107_plugins/download/languages/English/English_admin.php +++ b/e107_plugins/download/languages/English/English_admin.php @@ -160,7 +160,7 @@ define("DOWLAN_146", "Custom Download-denial message or URL"); // define("DOWLAN_147", "Icon for empty category"); define("DOWLAN_148", "Check to update date stamp to current time"); define("DOWLAN_149", "URL"); //FIXME Use Generic -define("DOWLAN_150", "Email admin when broken download reported"); +//define("DOWLAN_150", "Email admin when broken download reported"); define("DOWLAN_151", "Broken-download reporting available to"); define("DOWLAN_152", "Couldn't move file"); define("DOWLAN_153", "Move file into download folder"); @@ -209,7 +209,7 @@ define("DOWLAN_195", "Mirror type"); define("DOWLAN_196", "list"); //FIXME Use Generic define("DOWLAN_197", "random"); // define("DOWLAN_198", "Filter"); //FIXME Use Generic - +define("DOWLAN_199", "Submitted by"); // define('DOWLAN_FP_01', 'Front page'); // define('DOWLAN_FP_02', 'Category list'); @@ -226,6 +226,8 @@ define("DOWLAN_HELP_8", "Help for upload list"); define("DOWLAN_HELP_9", "Help for upload types"); define("DOWLAN_HELP_10", "Help for upload options"); +define("DOWLAN_HELP_11", "Click the 'delete' button to delete the report.[br][br]Click the 'view' button to manage the download.[br][br]To be notified of any new reports, please see to the [notify settings]."); + // define("DOWLAN_INSTALL_DONE", "Your download plugin is now installed"); // define("DOWLAN_DESCRIPTION", "This plugin is a fully featured Download system"); // define("DOWLAN_CAPTION", "Configure Download"); diff --git a/e107_plugins/download/languages/English/English_global.php b/e107_plugins/download/languages/English/English_global.php index 6a6bb7115..669053c9f 100644 --- a/e107_plugins/download/languages/English/English_global.php +++ b/e107_plugins/download/languages/English/English_global.php @@ -7,3 +7,7 @@ define("LAN_PLUGIN_DOWNLOAD_DIZ", "This plugin is a fully featured File-downlo define("LAN_DL_NT_01", "Broken download reported"); define("LAN_DL_NT_02", "The following download has been reported as broken:"); define("LAN_DL_NT_03", "It was reported by [x] with the following comments:"); +define("LAN_DL_NT_04", "Click [here] to view the broken download reports."); + +// Latest (e_dashboard) +define("LAN_DL_LATEST_01", "Reported broken downloads"); \ No newline at end of file