Commit d0240d3c authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1685041: Getting new templates to save layout



A regression problem created when trying to fix existing layouts
in Bug 1672737

Also getting site template heading link in panel go to the edit screen
as that is the only logical place for it to go

behatnotneeded

Change-Id: Id6de8a9430bfecc23a6cdb573102fbeac7a6cd42
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit bb0ea76c)
parent b40b7346
...@@ -745,8 +745,9 @@ class View { ...@@ -745,8 +745,9 @@ class View {
} }
db_begin(); db_begin();
$creating = false;
if (empty($this->id)) { if (empty($this->id)) {
$creating = true;
// users are only allowed one profile view // users are only allowed one profile view
if (!$this->template && $this->type == 'profile' && record_exists('view', 'owner', $this->owner, 'type', 'profile')) { if (!$this->template && $this->type == 'profile' && record_exists('view', 'owner', $this->owner, 'type', 'profile')) {
throw new SystemException(get_string('onlonlyyoneprofileviewallowed', 'error')); throw new SystemException(get_string('onlonlyyoneprofileviewallowed', 'error'));
...@@ -786,7 +787,7 @@ class View { ...@@ -786,7 +787,7 @@ class View {
return 0; return 0;
}) : false; }) : false;
if (isset($this->columnsperrow) && $columnsperrowchanged) { if (isset($this->columnsperrow) && (!empty($columnsperrowchanged) || $creating)) {
delete_records('view_rows_columns', 'view', $this->get('id')); delete_records('view_rows_columns', 'view', $this->get('id'));
foreach ($this->get_columnsperrow() as $viewrow) { foreach ($this->get_columnsperrow() as $viewrow) {
insert_record('view_rows_columns', (object)array( 'view' => $this->get('id'), 'row' => $viewrow->row, 'columns' => $viewrow->columns)); insert_record('view_rows_columns', (object)array( 'view' => $this->get('id'), 'row' => $viewrow->row, 'columns' => $viewrow->columns));
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{if $view.template == $sitetemplate} site-template{/if}"> {if $view.template == $sitetemplate} site-template{/if}">
{if $view.collid}<div class="panel panel-default panel-stack{if $view.submittedto} panel-warning{/if}"><div class="panel panel-default panel-stack{if $view.submittedto} panel-warning{/if}">{/if} {if $view.collid}<div class="panel panel-default panel-stack{if $view.submittedto} panel-warning{/if}"><div class="panel panel-default panel-stack{if $view.submittedto} panel-warning{/if}">{/if}
<h3 class="panel-heading has-link"> <h3 class="panel-heading has-link">
<a class="title-link title" href="{if $view.numviews > 0}{$view.fullurl}{else}{$WWWROOT}collection/views.php?id={$view.collid}{/if}" title="{$view.displaytitle}"> <a class="title-link title" href="{if $view.template == $sitetemplate}{$WWWROOT}view/blocks.php?id={$view.id}{elseif $view.numviews > 0}{$view.fullurl}{else}{$WWWROOT}collection/views.php?id={$view.collid}{/if}" title="{$view.displaytitle}">
{$view.displaytitle} {$view.displaytitle}
</a> </a>
</h3> </h3>
......
Supports Markdown
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