routes for training

This commit is contained in:
Evan Prodromou 2012-03-07 09:08:05 -06:00
parent 0b87e76945
commit 55a18f1d17
3 changed files with 19 additions and 4 deletions

View File

@ -194,6 +194,23 @@ class ActivitySpamPlugin extends Plugin
return true; return true;
} }
/**
* Map URLs to actions
*
* @param Net_URL_Mapper $m path-to-action mapper
*
* @return boolean hook value; true means continue processing, false means stop.
*/
function onRouterInitialized($m)
{
$m->connect('main/train/spam',
array('action' => 'train', 'category' => 'spam'));
$m->connect('main/train/ham',
array('action' => 'train', 'category' => 'ham'));
return true;
}
function onPluginVersion(&$versions) function onPluginVersion(&$versions)
{ {
$versions[] = array('name' => 'ActivitySpam', $versions[] = array('name' => 'ActivitySpam',

View File

@ -78,7 +78,6 @@ class TrainHamForm extends Form {
function formData() function formData()
{ {
$this->hidden('category', SpamFilter::HAM);
$this->hidden('notice', $this->notice->id); $this->hidden('notice', $this->notice->id);
} }
@ -125,7 +124,7 @@ class TrainHamForm extends Form {
function action() function action()
{ {
return common_local_url('train'); return common_local_url('train', array('category' => 'ham'));
} }
/** /**

View File

@ -78,7 +78,6 @@ class TrainSpamForm extends Form {
function formData() function formData()
{ {
$this->hidden('category', SpamFilter::SPAM);
$this->hidden('notice', $this->notice->id); $this->hidden('notice', $this->notice->id);
} }
@ -125,7 +124,7 @@ class TrainSpamForm extends Form {
function action() function action()
{ {
return common_local_url('train'); return common_local_url('train', array('category' => 'spam'));
} }
/** /**