1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-28 18:30:53 +02:00

little more work on the drop-down batch menu.

This commit is contained in:
CaMer0n
2009-07-23 15:23:19 +00:00
parent f48cdb5e39
commit 27c85b32f9
2 changed files with 78 additions and 20 deletions

View File

@@ -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);
}

View File

@@ -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
</tr>";
}
$text .= "</tbody></table>";
$text .= "</form>";
// $text .= "";
}
else
{ // 'No downloads yet'
@@ -459,29 +459,78 @@ class adminDownload extends download
$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
}
$text .= "</fieldset>";
$text .= "</form></fieldset>";
return $text;
}
// ---------------------------------------------------------------------------
function batch_options()
{
$text = "<span class='f-left' style='padding-left:15px'><img src='".e_IMAGE."generic/branchbottom.gif' alt='' />
<select class='tbox'>
<option value='delete'>".LAN_DELETE."</option>
<optgroup label='Move to..'>
<option value='cat_1'>Category 1</option>
<option value='cat_2'>Category 2</option>
<option value='cat_3'>Category 3</option>
</optgroup>
<optgroup label='Change Userclass to..'>
<option value='0'>Everyone</option>
</optgroup>
</select></span>";
$text = "<span class='f-left' style='padding-left:15px'><img src='".e_IMAGE."generic/branchbottom.gif' alt='' />
<select class='tbox' name='execute_batch' onchange='this.form.submit()'>
<option value=''>With selected...</option>";
$text .= "<option value='delete_selected'>".LAN_DELETE."</option>";
$text .= "
<optgroup label='Assign Userclass..'>
";
$classes = get_userclass_list();
foreach ($classes as $key => $val)
{
$text .= "<option value='userclass_selected_".$val['userclass_name']['userclass_id']."'>".$val['userclass_name']['userclass_name']."</option>\n";
}
$text .= "
</optgroup>
<optgroup label='Assign Visibility..'>
";
$classes = get_userclass_list();
foreach ($classes as $key => $val)
{
$text .= "<option value='visibility_selected_".$val['userclass_name']['userclass_id']."'>".$val['userclass_name']['userclass_name']."</option>\n";
}
$text .= "
</optgroup>
</select></span><span class='clear'>&nbsp;</span>";
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)