Skip to content
Snippets Groups Projects
Commit 09cc10cd authored by Demian Katz's avatar Demian Katz
Browse files

Added mechanism for rendering tabs via AJAX.

parent 0ee1d3f0
No related merge requests found
......@@ -222,6 +222,19 @@ class AbstractRecord extends AbstractBase
return $this->showTab($this->params()->fromRoute('tab', $this->defaultTab));
}
/**
* AJAX tab action -- render a tab without surrounding context.
*
* @return mixed
*/
public function ajaxtabAction()
{
$this->loadRecord();
return $this->showTab(
$this->params()->fromPost('tab', $this->defaultTab), true
);
}
/**
* ProcessSave -- store the results of the Save action.
*
......@@ -529,11 +542,12 @@ class AbstractRecord extends AbstractBase
/**
* Display a particular tab.
*
* @param string $tab Name of tab to display
* @param string $tab Name of tab to display
* @param bool $ajax Are we in AJAX mode?
*
* @return mixed
*/
protected function showTab($tab)
protected function showTab($tab, $ajax = false)
{
// Special case -- handle login request (currently needed for holdings
// tab when driver-based holds mode is enabled, but may also be useful
......@@ -559,7 +573,7 @@ class AbstractRecord extends AbstractBase
$view->scrollData = $this->resultScroller()->getScrollData($driver);
}
$view->setTemplate('record/view');
$view->setTemplate($ajax ? 'record/ajaxtab' : 'record/view');
return $view;
}
}
\ No newline at end of file
<?
foreach ($this->tabs as $tab => $obj) {
if (strtolower($this->activeTab) == strtolower($tab)) {
echo $this->record($this->driver)->getTab($obj);
}
}
?>
\ No newline at end of file
<?
foreach ($this->tabs as $tab => $obj) {
if (strtolower($this->activeTab) == strtolower($tab)) {
echo $this->record($this->driver)->getTab($obj);
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment