1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Admin-ui: URL fixes and prevent looping when no fields set.

This commit is contained in:
Cameron
2017-02-09 10:19:55 -08:00
parent 23b8c5d050
commit 3271b04087

View File

@@ -1410,7 +1410,7 @@ class e_admin_dispatcher
$this->_current_controller = $this->getDefaultController(); $this->_current_controller = $this->getDefaultController();
// add messages // add messages
e107::getMessage()->add('Can\'t find class <strong>&quot;'.($class_name ? $class_name : 'n/a').'&quot;</strong> for controller <strong>&quot;'.ucfirst($request->getModeName()).'&quot;</strong>', E_MESSAGE_ERROR) e107::getMessage()->add('Can\'t find class <strong>&quot;'.($class_name ? $class_name : 'n/a').'&quot;</strong> for controller <strong>&quot;'.ucfirst($request->getModeName()).'&quot;</strong>', E_MESSAGE_ERROR)
->add('Requested: '.e_SELF.'?'.$request->buildQueryString(), E_MESSAGE_DEBUG); ->add('Requested: '.e_REQUEST_SELF.'?'.$request->buildQueryString(), E_MESSAGE_DEBUG);
// //
$request->setMode($this->getDefaultControllerName())->setAction('e404'); $request->setMode($this->getDefaultControllerName())->setAction('e404');
$this->_current_controller->setRequest($request)->init(); $this->_current_controller->setRequest($request)->init();
@@ -1439,7 +1439,7 @@ class e_admin_dispatcher
$this->_current_controller = $this->getDefaultController(); $this->_current_controller = $this->getDefaultController();
// add messages // add messages
e107::getMessage()->add('Can\'t find class for controller <strong>&quot;'.ucfirst($request->getModeName()).'&quot;</strong>', E_MESSAGE_ERROR) e107::getMessage()->add('Can\'t find class for controller <strong>&quot;'.ucfirst($request->getModeName()).'&quot;</strong>', E_MESSAGE_ERROR)
->add('Requested: '.e_SELF.'?'.$request->buildQueryString(), E_MESSAGE_DEBUG); ->add('Requested: '.e_REQUEST_SELF.'?'.$request->buildQueryString(), E_MESSAGE_DEBUG);
// go to not found page // go to not found page
$request->setMode($this->getDefaultControllerName())->setAction('e404'); $request->setMode($this->getDefaultControllerName())->setAction('e404');
$this->_current_controller->setRequest($request)->init(); $this->_current_controller->setRequest($request)->init();
@@ -1545,7 +1545,7 @@ class e_admin_dispatcher
// TODO slide down menu options? // TODO slide down menu options?
if(!vartrue($var[$key]['link'])) if(!vartrue($var[$key]['link']))
{ {
$var[$key]['link'] = e_SELF.'?mode='.$tmp[0].'&amp;action='.$tmp[1]; // FIXME - URL based on $modes, remove url key $var[$key]['link'] = e_REQUEST_SELF.'?mode='.$tmp[0].'&amp;action='.$tmp[1]; // FIXME - URL based on $modes, remove url key
} }
@@ -2209,7 +2209,7 @@ class e_admin_controller
if($mode) $request->setMode($mode); if($mode) $request->setMode($mode);
if($action) $request->setAction($action); if($action) $request->setAction($action);
if(!$path) $path = e_SELF; if(!$path) $path = e_REQUEST_SELF;
//prevent cache //prevent cache
header('Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
@@ -3610,6 +3610,13 @@ class e_admin_controller_ui extends e_admin_controller
} }
if(empty($this->fields))
{
$this->_alias_parsed = true;
return $this;
}
// check for table & field aliases // check for table & field aliases
$fields = array(); // preserve order $fields = array(); // preserve order
foreach ($this->fields as $field => $att) foreach ($this->fields as $field => $att)
@@ -5832,6 +5839,12 @@ class e_admin_form_ui extends e_form
{ {
$err = false; $err = false;
$fields = $this->getController()->getFields(); $fields = $this->getController()->getFields();
if(empty($fields))
{
return null;
}
foreach($fields as $field => $foptions) foreach($fields as $field => $foptions)
{ {
// check form custom methods // check form custom methods
@@ -6104,7 +6117,7 @@ class e_admin_form_ui extends e_form
$forms[$id] = array( $forms[$id] = array(
'id' => $this->getElementId(), // unique string used for building element ids, REQUIRED 'id' => $this->getElementId(), // unique string used for building element ids, REQUIRED
'url' => e_SELF, // default 'url' => e_REQUEST_SELF, // default
'query' => $request->buildQueryString(array(), true, 'ajax_used'), // - ajax_used is now removed from QUERY_STRING - class2 'query' => $request->buildQueryString(array(), true, 'ajax_used'), // - ajax_used is now removed from QUERY_STRING - class2
'legend' => $controller->addTitle(LAN_UI_DELETE_LABEL), // hidden by default 'legend' => $controller->addTitle(LAN_UI_DELETE_LABEL), // hidden by default
'form_pre' => '', // markup to be added before opening form element 'form_pre' => '', // markup to be added before opening form element
@@ -6171,7 +6184,7 @@ class e_admin_form_ui extends e_form
$text = " $text = "
<form method='get' action='".e_SELF."'> <form method='get' action='".e_REQUEST_SELF."'>
<fieldset id='admin-ui-list-filter' class='e-filter'> <fieldset id='admin-ui-list-filter' class='e-filter'>
<legend class='e-hideme'>".LAN_LABEL_LABEL_SELECTED."</legend> <legend class='e-hideme'>".LAN_LABEL_LABEL_SELECTED."</legend>
".$filter_pre." ".$filter_pre."
@@ -6217,7 +6230,7 @@ class e_admin_form_ui extends e_form
\$\$('input[name=searchquery]').each(function(el, cnt) { \$\$('input[name=searchquery]').each(function(el, cnt) {
if(!cnt) el.activate(); if(!cnt) el.activate();
else return; else return;
new Ajax.Autocompleter(el, el.next('div.e-autocomplete'), '".e_SELF."?mode=".$l[0]."&action=filter', { new Ajax.Autocompleter(el, el.next('div.e-autocomplete'), '".e_REQUEST_SELF."?mode=".$l[0]."&action=filter', {
paramName: 'searchquery', paramName: 'searchquery',
minChars: 2, minChars: 2,
frequency: 0.5, frequency: 0.5,