Importsource: some more branch-related hints
This commit is contained in:
parent
bfdcafca52
commit
68cf42490f
|
@ -104,12 +104,16 @@ class ImportsourceController extends ActionController
|
|||
|
||||
public function addAction()
|
||||
{
|
||||
$this->addTitle($this->translate('Add import source'))
|
||||
->content()->add(
|
||||
ImportSourceForm::load()->setDb($this->db())
|
||||
->setSuccessUrl('director/importsources')
|
||||
->handleRequest()
|
||||
);
|
||||
$this->addTitle($this->translate('Add import source'));
|
||||
if ($this->showNotInBranch($this->translate('Creating Import Sources'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->content()->add(
|
||||
ImportSourceForm::load()->setDb($this->db())
|
||||
->setSuccessUrl('director/importsources')
|
||||
->handleRequest()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,6 +123,9 @@ class ImportsourceController extends ActionController
|
|||
{
|
||||
$this->addMainActions();
|
||||
$this->activateTabWithPostfix($this->translate('Modify'));
|
||||
if ($this->showNotInBranch($this->translate('Modifying Import Sources'))) {
|
||||
return;
|
||||
}
|
||||
$form = ImportSourceForm::load()
|
||||
->setObject($this->getImportSource())
|
||||
->setListUrl('director/importsources')
|
||||
|
@ -138,6 +145,9 @@ class ImportsourceController extends ActionController
|
|||
{
|
||||
$this->addMainActions();
|
||||
$this->activateTabWithPostfix($this->translate('Clone'));
|
||||
if ($this->showNotInBranch($this->translate('Cloning Import Sources'))) {
|
||||
return;
|
||||
}
|
||||
$source = $this->getImportSource();
|
||||
$this->addTitle('Clone: %s', $source->get('source_name'));
|
||||
$form = new CloneImportSourceForm($source);
|
||||
|
@ -220,9 +230,13 @@ class ImportsourceController extends ActionController
|
|||
protected function requireImportSourceAndAddModifierTable()
|
||||
{
|
||||
$source = $this->getImportSource();
|
||||
PropertymodifierTable::load($source, $this->url())
|
||||
->handleSortPriorityActions($this->getRequest(), $this->getResponse())
|
||||
->renderTo($this);
|
||||
$table = PropertymodifierTable::load($source, $this->url());
|
||||
if ($this->getBranch()->isBranch()) {
|
||||
$table->setReadOnly();
|
||||
} else {
|
||||
$table->handleSortPriorityActions($this->getRequest(), $this->getResponse());
|
||||
}
|
||||
$table->renderTo($this);
|
||||
|
||||
return $source;
|
||||
}
|
||||
|
@ -267,6 +281,10 @@ class ImportsourceController extends ActionController
|
|||
)->addBackToModifiersLink($source);
|
||||
$this->tabs()->activate('modifier');
|
||||
|
||||
if ($this->showNotInBranch($this->translate('Modifying Import Sources'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->content()->prepend(
|
||||
ImportRowModifierForm::load()->setDb($this->db())
|
||||
->setSource($source)
|
||||
|
@ -293,6 +311,9 @@ class ImportsourceController extends ActionController
|
|||
)->addBackToModifiersLink($source);
|
||||
$source = $this->requireImportSourceAndAddModifierTable();
|
||||
$this->tabs()->activate('modifier');
|
||||
if ($this->showNotInBranch($this->translate('Modifying Import Sources'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$listUrl = 'director/importsource/modifier?source_id='
|
||||
. (int) $source->get('id');
|
||||
|
|
|
@ -30,6 +30,8 @@ class PropertymodifierTable extends ZfQueryBasedTable
|
|||
|
||||
protected $priorityColumn = 'priority';
|
||||
|
||||
protected $readOnly = false;
|
||||
|
||||
public static function load(ImportSource $source, Url $url)
|
||||
{
|
||||
$table = new static($source->getConnection());
|
||||
|
@ -38,8 +40,17 @@ class PropertymodifierTable extends ZfQueryBasedTable
|
|||
return $table;
|
||||
}
|
||||
|
||||
public function setReadOnly($readOnly = true)
|
||||
{
|
||||
$this->readOnly = $readOnly;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
if ($this->readOnly) {
|
||||
return parent::render();
|
||||
}
|
||||
return $this->renderWithSortableForm();
|
||||
}
|
||||
|
||||
|
@ -82,13 +93,18 @@ class PropertymodifierTable extends ZfQueryBasedTable
|
|||
$caption .= ': ' . $row->description;
|
||||
}
|
||||
|
||||
return $this->addSortPriorityButtons(
|
||||
$this::row([
|
||||
Link::create($caption, 'director/importsource/editmodifier', [
|
||||
'id' => $row->id,
|
||||
'source_id' => $row->source_id,
|
||||
]),
|
||||
$renderedRow = $this::row([
|
||||
Link::create($caption, 'director/importsource/editmodifier', [
|
||||
'id' => $row->id,
|
||||
'source_id' => $row->source_id,
|
||||
]),
|
||||
]);
|
||||
if ($this->readOnly) {
|
||||
return $renderedRow;
|
||||
}
|
||||
|
||||
return $this->addSortPriorityButtons(
|
||||
$renderedRow,
|
||||
$row
|
||||
);
|
||||
}
|
||||
|
@ -109,6 +125,9 @@ class PropertymodifierTable extends ZfQueryBasedTable
|
|||
|
||||
public function getColumnsToBeRendered()
|
||||
{
|
||||
if ($this->readOnly) {
|
||||
return [$this->translate('Property')];
|
||||
}
|
||||
return [
|
||||
$this->translate('Property'),
|
||||
$this->getSortPriorityTitle()
|
||||
|
|
Loading…
Reference in New Issue