Commit e8fe8839 authored by Rebecca Blundell's avatar Rebecca Blundell

Bug 1731807 - remove unused blockinstance code

I've removed some more things that don't seem to be needed.

behatnotneeded

Change-Id: I811aff5ac64e0d4178f61d39e19541f7b5e45cea
parent 845b0d3b
......@@ -1852,21 +1852,6 @@ class View {
$action = substr($key, 7);
break;
}
else if (substr($key, 0, 37) == 'cancel_action_configureblockinstance_'
&& param_integer('removeoncancel', 0)) {
$action = 'removeblockinstance_' . substr($key, 37);
break;
}
}
// TODO Scan GET for an action. The only action that is GETted is
// confirming deletion of a blockinstance. It _should_ be a POST, but
// that can be fixed later.
if (!$action) {
foreach ($_GET as $key => $value) {
if (substr($key, 0, 7) == 'action_') {
$action = substr($key, 7);
}
}
}
$viewtheme = param_variable('viewtheme', '');
......@@ -1903,31 +1888,9 @@ class View {
$values['blocktype'] = param_alpha('blocktype', null);
break;
case 'removeblockinstance': // requires action_removeblockinstance_id_\d
if (!defined('JSON')) {
if (!$sure = param_boolean('sure')) {
$yesform = '<form action="' . get_config('wwwroot') . '/view/blocks.php" class="text-inline">'
. '<input type="hidden" name="id" value="' . $this->get('id') . '">'
. '<input type="hidden" name="c" value="file">'
. '<input type="hidden" name="action_' . $action . '_' . $actionstring . '" value="1">'
. '<input type="hidden" name="sure" value="1">'
. '<input type="hidden" name="sesskey" value="' . $USER->get('sesskey') . '">'
. '<input class="submit btn btn-primary" type="submit" name="removeblock_submit" value="' . get_string('yes') . '">'
. '</form>';
$baselink = get_config('wwwroot') . 'view/blocks.php?id=' . $this->get('id') . '&c=' . $category . '&new=' . $new;
$SESSION->add_info_msg(get_string('confirmdeleteblockinstance', 'view')
. '&nbsp;' . $yesform . ' <a href="' . $baselink . '">' . get_string('no') . '</a>', false);
redirect($baselink);
exit;
}
}
break;
case 'configureblockinstance': // requires action_configureblockinstance_id_\d_column_\d_order_\d
case 'acsearch': // requires action_acsearch_id_\d
if (!defined('JSON')) {
$this->blockinstance_currently_being_configured = $values['id'];
// And we're done here for now
return;
}
case 'moveblockinstance': // requires action_moveblockinstance_id_\d_row_\d_column_\d_order_\d
case 'addcolumn': // requires action_addcolumn_\d_row_\d_before_\d
case 'removecolumn': // requires action_removecolumn_\d_row_\d_column_\d
......@@ -1950,8 +1913,10 @@ class View {
'view' => $this->get('id'),
);
//is json ever not defined? When would this be?
if (!defined('JSON')) {
$message = get_string('success.' . $action, 'view');
log_debug("message: " . $message);
}
$success = true;
}
......@@ -1963,6 +1928,7 @@ class View {
}
$message = get_string('err.' . $action, 'view');
}
//and what about here?
if (!defined('JSON')) {
// set stuff in the session and redirect
$fun = 'add_ok_msg';
......@@ -2518,20 +2484,6 @@ class View {
return array_unique($javascript);
}
private $blockinstance_currently_being_configured = 0;
/**
* Sets what blockinstance is currently being edited
* TODO: use get()
*/
public function set_blockinstance_currently_being_configured($id) {
$this->blockinstance_currently_being_configured = $id;
}
public function get_blockinstance_currently_being_configured() {
return $this->blockinstance_currently_being_configured;
}
/**
* Configures a blockinstance
*
......
<div class="js-blockinstance blockinstance panel panel-secondary clearfix {if $configure} configure{elseif $retractable} retractable{/if}" data-id="{$id}" id="blockinstance_{$id}{if $configure}_configure{/if}">
<h3 class="panel-heading js-heading drag-handle {if !$title}panel-heading-placeholder{/if}">
<span class="icon icon-arrows move-indicator" role="presentation" aria-hidden="true"></span>
<span class="blockinstance-header">
{if $configure}{$configtitle}: {str tag=Configure section=view}{else}{$title|default:"[$strnotitle]"}{/if}
{if $retractable && !$configure}
<span class="icon icon-chevron-down text-watermark icon-sm" role="presentation" aria-hidden="true"></span>
<span class="sr-only">{str tag=retractable section=view}</span>
{/if}
</span>
<span class="blockinstance-controls">
<button class="keyboardmovebutton btn btn-default hidden sr-only" name="action_moveblockinstance_id_{$id}" alt="{$strmovetitletext}" data-id="{$id}">
{$strmovetitletext}
</button>
{foreach from=$movecontrols item=item}
<button class="movebutton hidden" name="action_moveblockinstance_id_{$id}_row_{$row}_column_{$item.column}_order_{$item.order}" data-id="{$id}">
{$item.title}
</button>
{/foreach}
<span class="pull-right btn-group btn-group-top">
{if $configurable && !$configure}
<button class="configurebutton btn btn-inverse btn-xs" name="action_configureblockinstance_id_{$id}" alt="{$strconfigtitletext}" data-id="{$id}">
<span class="icon icon-cog icon-lg" role="presentation" aria-hidden="true"></span>
</button>
{/if}
{if $configure}
<button class="deletebutton btn btn-inverse btn-xs" name="action_removeblockinstance_id_{$id}" alt="{str tag=Close}" data-id="{$id}">
<span class="icon icon-trash text-danger icon-lg" role="presentation" aria-hidden="true"></span>
</button>
{else}
<button class="deletebutton btn btn-inverse btn-xs" name="action_removeblockinstance_id_{$id}" alt="{$strremovetitletext}" data-id="{$id}">
<span class="icon icon-trash text-danger icon-lg" role="presentation" aria-hidden="true"></span>
</button>
{/if}
</span>
</span>
</h3>
<div class="block blockinstance-content js-blockinstance-content">
{$content|safe}
</div>
<h3 class="panel-heading js-heading drag-handle {if !$title}panel-heading-placeholder{/if}">
<span class="icon icon-arrows move-indicator" role="presentation" aria-hidden="true"></span>
<span class="blockinstance-header">
{if $configure}{$configtitle}: {str tag=Configure section=view}{else}{$title|default:"[$strnotitle]"}{/if}
{if $retractable && !$configure}
<span class="icon icon-chevron-down text-watermark icon-sm" role="presentation" aria-hidden="true"></span>
<span class="sr-only">{str tag=retractable section=view}</span>
{/if}
</span>
<span class="blockinstance-controls">
<button class="keyboardmovebutton btn btn-default hidden sr-only" name="action_moveblockinstance_id_{$id}" alt="{$strmovetitletext}" data-id="{$id}">
{$strmovetitletext}
</button>
{foreach from=$movecontrols item=item}
<button class="movebutton hidden" name="action_moveblockinstance_id_{$id}_row_{$row}_column_{$item.column}_order_{$item.order}" data-id="{$id}">
{$item.title}
</button>
{/foreach}
<span class="pull-right btn-group btn-group-top">
{if $configurable && !$configure}
<button class="configurebutton btn btn-inverse btn-xs" name="action_configureblockinstance_id_{$id}" alt="{$strconfigtitletext}" data-id="{$id}">
<span class="icon icon-cog icon-lg" role="presentation" aria-hidden="true"></span>
</button>
{/if}
<button class="deletebutton btn btn-inverse btn-xs" name="action_removeblockinstance_id_{$id}" alt="{$strremovetitletext}" data-id="{$id}">
<span class="icon icon-trash text-danger icon-lg" role="presentation" aria-hidden="true"></span>
</button>
</span>
</span>
</h3>
<div class="block blockinstance-content js-blockinstance-content">
{$content|safe}
</div>
</div>
......@@ -187,14 +187,8 @@ $addform = pieform(array(
),
));
$blockid = $view->get_blockinstance_currently_being_configured();
if (!$blockid) {
$blockid = param_integer('block', 0);
if (!$blockid) {
// Build content before initialising smarty in case pieform elements define headers.
$viewcontent = $view->build_rows(true);
}
}
// Build content before initialising smarty in case pieform elements define headers.
$viewcontent = $view->build_rows(true);
$smarty = smarty($javascript, $stylesheets, array(
'view' => array(
......
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