syncrule/property: improve usability
This commit is contained in:
parent
68215da96c
commit
c1c9c849ba
|
@ -56,18 +56,21 @@ class SyncruleController extends ActionController
|
||||||
public function propertyAction()
|
public function propertyAction()
|
||||||
{
|
{
|
||||||
$this->view->stayHere = true;
|
$this->view->stayHere = true;
|
||||||
|
|
||||||
|
$db = $this->db();
|
||||||
$id = $this->params->get('rule_id');
|
$id = $this->params->get('rule_id');
|
||||||
|
$rule = SyncRule::load($id, $db);
|
||||||
|
|
||||||
$this->prepareRuleTabs($id)->activate('property');
|
$this->prepareRuleTabs($id)->activate('property');
|
||||||
|
|
||||||
$this->view->addLink = $this->view->icon('plus')
|
$this->view->addLink = $this->view->qlink(
|
||||||
. ' '
|
|
||||||
. $this->view->qlink(
|
|
||||||
$this->translate('Add sync property rule'),
|
$this->translate('Add sync property rule'),
|
||||||
'director/syncrule/addproperty',
|
'director/syncrule/addproperty',
|
||||||
array('rule_id' => $id)
|
array('rule_id' => $id),
|
||||||
|
array('class' => 'icon-plus')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->view->title = $this->translate('Sync properties');
|
$this->view->title = $this->translate('Sync properties') . ': ' . $rule->rule_name;
|
||||||
$this->view->table = $this->loadTable('syncproperty')
|
$this->view->table = $this->loadTable('syncproperty')
|
||||||
->enforceFilter(Filter::where('rule_id', $id))
|
->enforceFilter(Filter::where('rule_id', $id))
|
||||||
->setConnection($this->db());
|
->setConnection($this->db());
|
||||||
|
@ -84,26 +87,49 @@ class SyncruleController extends ActionController
|
||||||
$this->view->stayHere = true;
|
$this->view->stayHere = true;
|
||||||
$edit = false;
|
$edit = false;
|
||||||
|
|
||||||
|
$db = $this->db();
|
||||||
|
$ruleId = $this->params->get('rule_id');
|
||||||
|
$rule = SyncRule::load($ruleId, $db);
|
||||||
|
|
||||||
if ($id = $this->params->get('id')) {
|
if ($id = $this->params->get('id')) {
|
||||||
$edit = true;
|
$edit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$form = $this->view->form = $this->loadForm('syncProperty')->setDb($this->db());
|
$this->view->addLink = $this->view->qlink(
|
||||||
|
$this->translate('back'),
|
||||||
|
'director/syncrule/property',
|
||||||
|
array('rule_id' => $ruleId),
|
||||||
|
array('class' => 'icon-left-big')
|
||||||
|
);
|
||||||
|
|
||||||
|
$form = $this->view->form = $this->loadForm('syncProperty')->setDb($db);
|
||||||
|
|
||||||
if ($edit) {
|
if ($edit) {
|
||||||
$form->loadObject($id);
|
$form->loadObject($id);
|
||||||
$rule_id = $form->getObject()->rule_id;
|
$rule_id = $form->getObject()->rule_id;
|
||||||
$form->setRule(SyncRule::load($rule_id, $this->db()));
|
$form->setRule(SyncRule::load($rule_id, $db));
|
||||||
} elseif ($rule_id = $this->params->get('rule_id')) {
|
} elseif ($rule_id = $this->params->get('rule_id')) {
|
||||||
$form->setRule(SyncRule::load($rule_id, $this->db()));
|
$form->setRule(SyncRule::load($rule_id, $db));
|
||||||
}
|
}
|
||||||
$form->setSuccessUrl('director/syncrule/property', array('rule_id' => $rule_id));
|
|
||||||
|
|
||||||
|
$form->setSuccessUrl('director/syncrule/property', array('rule_id' => $rule_id));
|
||||||
$form->handleRequest();
|
$form->handleRequest();
|
||||||
|
|
||||||
$this->prepareRuleTabs($rule_id)->activate('property');
|
$this->prepareRuleTabs($rule_id)->activate('property');
|
||||||
|
|
||||||
$this->view->title = $this->translate('Sync property'); // add/edit
|
if ($edit) {
|
||||||
|
$this->view->title = sprintf(
|
||||||
|
$this->translate('Sync "%s": %s'),
|
||||||
|
$form->getObject()->destination_field,
|
||||||
|
$rule->rule_name
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->view->title = sprintf(
|
||||||
|
$this->translate('Add sync property: %s'),
|
||||||
|
$rule->rule_name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$this->view->table = $this->loadTable('syncproperty')
|
$this->view->table = $this->loadTable('syncproperty')
|
||||||
->enforceFilter(Filter::where('rule_id', $rule_id))
|
->enforceFilter(Filter::where('rule_id', $rule_id))
|
||||||
->setConnection($this->db());
|
->setConnection($this->db());
|
||||||
|
@ -114,15 +140,17 @@ class SyncruleController extends ActionController
|
||||||
{
|
{
|
||||||
$this->view->stayHere = true;
|
$this->view->stayHere = true;
|
||||||
|
|
||||||
|
$db = $this->db();
|
||||||
$id = $this->params->get('id');
|
$id = $this->params->get('id');
|
||||||
|
$rule = SyncRule::load($id, $db);
|
||||||
|
|
||||||
$this->prepareRuleTabs($id)->activate('history');
|
$this->prepareRuleTabs($id)->activate('history');
|
||||||
$this->view->title = $this->translate('Sync history');
|
$this->view->title = $this->translate('Sync history') . ': ' . $rule->rule_name;
|
||||||
$this->view->table = $this->loadTable('syncRun')
|
$this->view->table = $this->loadTable('syncRun')
|
||||||
->enforceFilter(Filter::where('rule_id', $id))
|
->enforceFilter(Filter::where('rule_id', $id))
|
||||||
->setConnection($this->db());
|
->setConnection($this->db());
|
||||||
|
|
||||||
if ($runId = $this->params->get('run_id')) {
|
if ($runId = $this->params->get('run_id')) {
|
||||||
$db = $this->db();
|
|
||||||
$this->view->run = SyncRun::load($runId, $db);
|
$this->view->run = SyncRun::load($runId, $db);
|
||||||
$this->view->formerId = $db->fetchActivityLogIdByChecksum(
|
$this->view->formerId = $db->fetchActivityLogIdByChecksum(
|
||||||
$this->view->run->last_former_activity
|
$this->view->run->last_former_activity
|
||||||
|
|
|
@ -25,7 +25,6 @@ class SyncPropertyForm extends DirectorObjectForm
|
||||||
|
|
||||||
public function setup()
|
public function setup()
|
||||||
{
|
{
|
||||||
$this->addHtml(sprintf('<h3>%s</h3>', $this->getView()->escape($this->rule->rule_name)));
|
|
||||||
$this->addHidden('rule_id', $this->rule_id);
|
$this->addHidden('rule_id', $this->rule_id);
|
||||||
|
|
||||||
$this->addElement('select', 'source_id', array(
|
$this->addElement('select', 'source_id', array(
|
||||||
|
|
Loading…
Reference in New Issue