Skip to content

Commit

Permalink
clear cache when ajax inline edit saves or list model stores a row
Browse files Browse the repository at this point in the history
  • Loading branch information
pollen8 committed Aug 25, 2011
1 parent 57f471f commit 71af612
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public function display($tpl = null)
$plugin =& $pluginManager->getPlugIn($className, 'element');
$plugin->setId($elementid);
$plugin->inLineEdit();

$task = JRequest::getVar('task');
if ($task !== 'element.save' && $task !== 'save') {
JFactory::getCache('com_fabrik')->clean();
}
}

}
2 changes: 1 addition & 1 deletion administrator/modules/mod_fabrik_list/mod_fabrik_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
$post = JRequest::get('post');
//build unique cache id on url, post and user id
$user = JFactory::getUser();
$cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', 0));
$cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $listId));
$cache = JFactory::getCache('com_fabrik', 'view');
// f3 cache with raw view gives error
if (in_array(JRequest::getCmd('format'), array('raw', 'csv'))) {
Expand Down
2 changes: 1 addition & 1 deletion components/com_fabrik/models/element.php
Original file line number Diff line number Diff line change
Expand Up @@ -3818,7 +3818,7 @@ public function inLineEdit()
$key = $this->getFullName();

$template = JFactory::getApplication()->getTemplate();
FabrikHelperHTML::addPath(JPATH_SITE."/administrator/templates/$template/images/", 'image', 'list');
FabrikHelperHTML::addPath(JPATH_SITE."/administrator/templates/$template/images/", 'image', 'list');

//@TODO add acl checks here
$task = JRequest::getVar('task');
Expand Down
2 changes: 2 additions & 0 deletions components/com_fabrik/models/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -4446,6 +4446,8 @@ function storeRow($data, $rowId, $isJoin = false, $joinGroupTable = null)
$q = JDEBUG ? $fabrikDb->getQuery() : '';
return JError::raiseWarning(500, 'Store row failed: ' . $q . "<br>" . $fabrikDb->getErrorMsg());
} else {
// Clean the cache.
JFactory::getCache('com_fabrik')->clean();
// $$$ rob new as if you update a record the insertid() returns 0
$this->lastInsertId = ($rowId == '' || $rowId == 0) ?$fabrikDb->insertid() : $rowId;
return true;
Expand Down

0 comments on commit 71af612

Please sign in to comment.