Commit 25b914df authored by Nigel McNie's avatar Nigel McNie
Browse files

A few changes made as part of the graphic design work:

 * Make the last tab on the top pane have the class of 'last'. Not used by the design now but might be by other designs later.
 * Don't return nothing when building a blocktype list and none can be found. This allows the template to output an informational message in this case instead.
 * Search $_POST only for the first action sent through (small optimisation rather than g&d work)
 * Because a lot of the buttons are now <input type="image">, the action is checked to see if it ends with _x or _y, and that part is stripped if it is found.
parent 23996740
......@@ -467,6 +467,9 @@ class View {
}
}
// Because of the reference in the above loop, $cat refers to the last item
$cat['class'] = (isset($cat['class'])) ? $cat['class'] . ' last' : 'last';
$smarty = smarty_core();
$smarty->assign('categories', $categories);
$smarty->assign('viewid', $view->get('id'));
......@@ -484,9 +487,7 @@ class View {
*/
public static function build_blocktype_list($category, $javascript=false) {
require_once(get_config('docroot') . 'blocktype/lib.php');
if (!$blocktypes = PluginBlockType::get_blocktypes_for_category($category)) {
return '';
}
$blocktypes = PluginBlockType::get_blocktypes_for_category($category);
$smarty = smarty_core();
$smarty->assign_by_ref('blocktypes', $blocktypes);
......@@ -516,6 +517,7 @@ class View {
foreach ($_POST as $key => $value) {
if (substr($key, 0, 7) == 'action_') {
$action = substr($key, 7);
break;
}
}
// TODO Scan GET for an action. The only action that is GETted is
......@@ -537,6 +539,11 @@ class View {
$action = substr($action, 0, strpos($action, '_'));
$actionstring = substr($actionstring, strlen($action) + 1);
// Actions from <input type="image"> buttons send an _x and _y
if (substr($actionstring, -2) == '_x' || substr($actionstring, -2) == '_y') {
$actionstring = substr($actionstring, 0, -2);
}
$values = self::get_values_for_action($actionstring);
$result = null;
......
Markdown is supported
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