1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-30 19:30:25 +02:00

Admin-ui: Grid improvements.

This commit is contained in:
Cameron
2017-04-04 09:53:48 -07:00
parent a8931d663b
commit 8ce9eb32c6
3 changed files with 48 additions and 28 deletions

View File

@@ -2789,11 +2789,23 @@ class e_admin_controller_ui extends e_admin_controller
public function getPerPage() public function getPerPage()
{ {
if($this->getAction() === 'grid')
{
return $this->getGrid('perPage');
}
return $this->perPage; return $this->perPage;
} }
public function getGrid() public function getGrid($key=null)
{ {
if($key !== null)
{
return $this->grid[$key];
}
return $this->grid; return $this->grid;
} }
@@ -5352,7 +5364,7 @@ class e_admin_ui extends e_admin_controller_ui
return; return;
} }
$this->getTreeModel()->setParam('db_query', $this->_modifyListQry(false, false, false, false, $this->listQry))->load(); $this->getTreeModel()->setParam('db_query', $this->_modifyListQry(false, false, false, false, $this->listQry))->load();
$this->addTitle(); $this->addTitle();
} }
/** /**
@@ -5360,8 +5372,13 @@ class e_admin_ui extends e_admin_controller_ui
*/ */
public function GridObserver() public function GridObserver()
{ {
$this->action = 'list';
$this->ListObserver(); $table = $this->getTableName();
if(empty($table))
{
return;
}
$this->getTreeModel()->setParam('db_query', $this->_modifyListQry(false, false, false, false, $this->listQry))->load();
} }
/** /**
@@ -6415,38 +6432,35 @@ class e_admin_form_ui extends e_form
'featurebox' => $controller->getBatchFeaturebox(), 'featurebox' => $controller->getBatchFeaturebox(),
'export' => $controller->getBatchExport(), 'export' => $controller->getBatchExport(),
); );
$options[$id] = array( $options[$id] = array(
'id' => $this->getElementId(), // unique string used for building element ids, REQUIRED 'id' => $this->getElementId(), // unique string used for building element ids, REQUIRED
'pid' => $controller->getPrimaryName(), // primary field name, REQUIRED 'pid' => $controller->getPrimaryName(), // primary field name, REQUIRED
//'url' => e_SELF, default 'query' => $controller->getFormQuery(), // work around - see form in newspost.php (submitted news)
'query' => $controller->getFormQuery(), // work around - see form in newspost.php (submitted news) 'head_query' => $request->buildQueryString('field=[FIELD]&asc=[ASC]&from=[FROM]', false), // without field, asc and from vars, REQUIRED
//'query' => $request->buildQueryString(array(), true, 'ajax_used'), - ajax_used is now removed from QUERY_STRING - class2 'np_query' => $request->buildQueryString(array(), false, 'from'), // without from var, REQUIRED for next/prev functionality
'head_query' => $request->buildQueryString('field=[FIELD]&asc=[ASC]&from=[FROM]', false), // without field, asc and from vars, REQUIRED 'legend' => $controller->getPluginTitle(), // hidden by default
'np_query' => $request->buildQueryString(array(), false, 'from'), // without from var, REQUIRED for next/prev functionality 'form_pre' => !$ajax ? $this->renderFilter($tp->post_toForm(array($controller->getQuery('searchquery'), $controller->getQuery('filter_options'))), $controller->getMode().'/'.$controller->getAction()) : '', // needs to be visible when a search returns nothing
'legend' => $controller->getPluginTitle(), // hidden by default 'form_post' => '', // markup to be added after closing form element
'form_pre' => !$ajax ? $this->renderFilter($tp->post_toForm(array($controller->getQuery('searchquery'), $controller->getQuery('filter_options'))), $controller->getMode().'/'.$controller->getAction()) : '', // needs to be visible when a search returns nothing 'fields' => $fields, // see e_admin_ui::$fields
'form_post' => '', // markup to be added after closing form element 'fieldpref' => $controller->getFieldPref(), // see e_admin_ui::$fieldpref
'fields' => $fields, // see e_admin_ui::$fields 'table_pre' => '', // markup to be added before opening table element
'fieldpref' => $controller->getFieldPref(), // see e_admin_ui::$fieldpref
'table_pre' => '', // markup to be added before opening table element
// 'table_post' => !$tree[$id]->isEmpty() ? $this->renderBatch($controller->getBatchDelete(),$controller->getBatchCopy(),$controller->getBatchLink(),$controller->getBatchFeaturebox()) : '', // 'table_post' => !$tree[$id]->isEmpty() ? $this->renderBatch($controller->getBatchDelete(),$controller->getBatchCopy(),$controller->getBatchLink(),$controller->getBatchFeaturebox()) : '',
'table_post' => $this->renderBatch($coreBatchOptions, $controller->getBatchOptions()),
'table_post' => $this->renderBatch($coreBatchOptions, $controller->getBatchOptions()), 'fieldset_pre' => '', // markup to be added before opening fieldset element
'fieldset_pre' => '', // markup to be added before opening fieldset element
'fieldset_post' => '', // markup to be added after closing fieldset element 'fieldset_post' => '', // markup to be added after closing fieldset element
'perPage' => $controller->getPerPage(), // if 0 - no next/prev navigation 'grid' => $controller->getGrid(),
'grid' => $controller->getGrid(), 'perPage' => $controller->getPerPage(), // if 0 - no next/prev navigation
'from' => $controller->getQuery('from', 0), // current page, default 0 'from' => $controller->getQuery('from', 0), // current page, default 0
'field' => $controller->getQuery('field'), //current order field name, default - primary field 'field' => $controller->getQuery('field'), //current order field name, default - primary field
'asc' => $controller->getQuery('asc', 'desc'), //current 'order by' rule, default 'asc' 'asc' => $controller->getQuery('asc', 'desc'), //current 'order by' rule, default 'asc'
); );
if($view === 'grid') if($view === 'grid')
{ {
return $this->renderGridForm($options, $tree, $ajax); return $this->renderGridForm($options, $tree, $ajax);

View File

@@ -50,6 +50,11 @@ function varset(&$val, $default='')
*/ */
function defset($str, $default='') function defset($str, $default='')
{ {
if(!is_string($str))
{
return false;
}
if (defined($str)) { return constant($str); } if (defined($str)) { return constant($str); }
return $default; return $default;
} }

View File

@@ -16,7 +16,8 @@ if(!defined('e107_INIT'))
exit(); exit();
} }
define("SEP", " <span class='fa fa-play e-breadcrumb'></span> "); //define("SEP", " <span class='fa fa-play e-breadcrumb'></span> ");
define("SEP", " <span class='fa fa-angle-double-right e-breadcrumb'></span> ");
define("BOOTSTRAP", 3); define("BOOTSTRAP", 3);
define('FONTAWESOME', 4); define('FONTAWESOME', 4);