diff --git a/e107_plugins/download/admin_download.php b/e107_plugins/download/admin_download.php index 5a1abc17b..cd7657c47 100644 --- a/e107_plugins/download/admin_download.php +++ b/e107_plugins/download/admin_download.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/download/admin_download.php,v $ -| $Revision: 1.6 $ -| $Date: 2009-07-23 09:02:10 $ -| $Author: secretr $ +| $Revision: 1.7 $ +| $Date: 2009-07-23 15:23:18 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -84,12 +84,20 @@ if (e_QUERY) $adminDownload->observer(); +$emessage = eMessage::getInstance(); + + if(isset($_POST['download_filter_list'])) { echo $adminDownload->show_existing_items($action, $subAction, $id, 0, 10); exit; } +if(isset($_POST['execute_batch'])) +{ + $adminDownload->_observe_processBatch(); +} + if (isset($_POST['delete'])) { $tmp = array_keys($_POST['delete']); @@ -311,7 +319,8 @@ if ($from === "maint" && isset($_POST['submit_download'])) if (!e_QUERY || $action == "main") { - $text = $adminDownload->show_filter_form($action, $subAction, $id, $from, $amount); + $text = $emessage->render(); + $text .= $adminDownload->show_filter_form($action, $subAction, $id, $from, $amount); $text .= $adminDownload->show_existing_items($action, $subAction, $id, $from, $amount); $ns->tablerender(DOWLAN_7, $text); } diff --git a/e107_plugins/download/handlers/adminDownload_class.php b/e107_plugins/download/handlers/adminDownload_class.php index aa2e7c998..feefc4498 100644 --- a/e107_plugins/download/handlers/adminDownload_class.php +++ b/e107_plugins/download/handlers/adminDownload_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/download/handlers/adminDownload_class.php,v $ -| $Revision: 1.11 $ -| $Date: 2009-07-21 16:05:11 $ +| $Revision: 1.12 $ +| $Date: 2009-07-23 15:23:19 $ | $Author: e107coders $ | +----------------------------------------------------------------------------+ @@ -443,7 +443,7 @@ class adminDownload extends download "; } $text .= ""; - $text .= ""; + // $text .= ""; } else { // 'No downloads yet' @@ -459,29 +459,78 @@ class adminDownload extends download $tp->parseTemplate("{NEXTPREV={$parms}}").""; } - $text .= ""; + $text .= ""; + return $text; } // --------------------------------------------------------------------------- function batch_options() { - $text = " - "; + $text = " +  "; return $text; } + + function _observe_processBatch() + { + list($type,$tmp,$uclass) = explode("_",$_POST['execute_batch']); + $method = "batch_".$type; + if ((method_exists($this,$method) || $type='visibility') && isset ($_POST['dl_selected'])) + { + if($type=='userclass' || $type=='visibility') + { + $mode = ($type=='userclass') ? 'download_class' : 'download_visible'; + $this->batch_userclass($_POST['dl_selected'],$uclass,$mode); + } + else + { + $this->$method($_POST['dl_selected']); + } + } + } + + function batch_userclass($download_ids,$uclass,$mode='download_class') + { + $emessage = &eMessage::getInstance(); + + if(e107::getDb() -> db_Update("download", $mode." ='{$uclass}' WHERE download_id IN (".implode(",",$download_ids).") ")) + { + $emessage->add("It Worked", E_MESSAGE_SUCCESS); + } + else + { + $emessage->add("It Failed", E_MESSAGE_ERROR); + } + } + // Given the string which is stored in the DB, turns it into an array of mirror entries // If $byID is true, the array index is the mirror ID. Otherwise its a simple array function makeMirrorArray($source, $byID = FALSE)