diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index 5d32adee0..fce59e322 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -3096,13 +3096,23 @@ class e_admin_controller_ui extends e_admin_controller $selected[$i] = preg_replace('/[^\w-:.]/', '', $_sel); } } - + + if(substr($batch_trigger, 0, 6) === 'batch_') + { + list($tmp,$plugin,$command) = explode("_",$batch_trigger,3); + $this->setPosted(array()); + $this->getRequest()->setAction('batch'); + $cls = e107::getAddon($plugin,'e_admin',true); + e107::callMethod($cls,'process',$this,array('cmd'=>$command,'ids'=>$selected)); + return $this; + } + $this->setTriggersEnabled(false); //disable further triggering switch($trigger[0]) { - case 'delete': //FIXME - confirmation screen + case 'delete': //FIXME - confirmation popup //method handleListDeleteBatch(); for custom handling of 'delete' batch // if(empty($selected)) return $this; // don't check selected data - subclass need to check additional post variables(confirm screen) diff --git a/e107_plugins/_blank/e_admin.php b/e107_plugins/_blank/e_admin.php index 3b71da17b..ff000183f 100644 --- a/e107_plugins/_blank/e_admin.php +++ b/e107_plugins/_blank/e_admin.php @@ -23,7 +23,9 @@ class _blank_admin switch($type) { case "news": // hook into the news admin form. - $config['fields']['url'] = array ( 'title' =>"CUstom Field", 'type' => 'url', 'tab'=>1, 'writeParms'=> array('size'=>'xxlarge', 'placeholder'=>'', 'default'=>$defaultValue), 'width' => 'auto', 'help' => '', 'readParms' => '', 'class' => 'left', 'thclass' => 'left', ); + $config['fields']['url'] = array ( 'title' =>"Custom Field", 'type' => 'url', 'tab'=>1, 'writeParms'=> array('size'=>'xxlarge', 'placeholder'=>'', 'default'=>$defaultValue), 'width' => 'auto', 'help' => '', 'readParms' => '', 'class' => 'left', 'thclass' => 'left', ); + + $config['batchOptions'] = array('custom' => 'Custom Batch Command'); break; } @@ -37,20 +39,28 @@ class _blank_admin /** * Process Posted Data. * @param object $ui admin-ui - * @param int $id - Primary ID of the record being created/edited/deleted + * @param int|array $id - Primary ID of the record being created/edited/deleted or array data of a batch process. */ public function process($ui, $id=0) { $data = $ui->getPosted(); $type = $ui->getEventName(); - $action = $ui->getAction(); // current mode: create, edit, list + $action = $ui->getAction(); // current mode: create, edit, list, batch if($action == 'delete') { return; } + if($action == 'batch') + { + $arrayOfRecordIds = $id['ids']; + $command = $id['cmd']; + + return; + } + if(!empty($id) ) {