Cannot add image to template pages

Bug #1397110 reported by Kristina Hoeppner on 2014-11-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
High
Son Nguyen
16.04
High
Son Nguyen
16.10
High
Unassigned

Bug Description

Mahara 1.10+

When you change the template in Admin -> Config site -> Pages, you cannot add an image to either of the three templates. You can put the block there and select an image, but it is not going to be displayed.

The file that you upload does not sit in the site files, but somewhere that is not accessible. They seem to be stored under the "System user" (also for group homepage), but you don't have access to those on the front-end.

The only image that you can display is the default user profile icon.

Aaron Wells (u-aaronw) wrote :

Functionally, the outcome we want is this:

1. You should be able to add files from the Site Files area into blocks for these templates.

2. Those files should get copied to the user or group files area when the templates are copied. (And ideally, it should retain the underlying link to the same physical file, in order to reduce disk usage. I think the copy logic does this already?)

3. You should be able to place the same blocktypes in these templates, as in a normal page of that page type. I.e. the same blocks in the "Group Home Page" template, as you could place in any group home page. I think we're already fine on that front, because it's based on Blocktype::allowed_in_view(), and the page's page type, and the template pages have the right page type.

I understand that probably the reason why you can't put any images in these pages currently, is because they technically have the root user (id 0) as their page author. Changing them to be site pages may be the solution. It doesn't really matter, so long as the above stuff remains true.

It's also worth noting, that these pages *don't* necessarily need to have the "view.template" flag set to 1 in the database. That flag indicates whether they should show up in the list of pages users can manually make copies of. Users will not be manually making copies of these.

Cheers,
Aaron

Son Nguyen (ngson2000) wrote :

Thank Aaron,

1. I will change the ownership of these templates to site templates
2. Implement allowed_in_view() for each blocktype to make sure which one can be added into which template
3. Make sure all blocktypes which have file picker can select site files only
4. Update the method default_copy_type() for each blocktype

Cheers,
Son Nguyen

Aaron Wells (u-aaronw) wrote :

Hi Son,

I think #2 & #4 are unnecessary. The existing settings for allowed_in_view() and default_copy_type() are probably fine. In particular I don't think we need any special logic in there just for these site template pages.

Cheers,
Aaron

Son Nguyen (ngson2000) wrote :

Hi Aaron,

Ok, I will do #1 and #3 for fixing this bug
We will fix other issues later if it practically happens

Cheers,
Son

As we discussed in our meeting this morning, since this one's going to require a rather large code change and database refactoring, we're not going to fix it in the way described, for 1.10.

Son Nguyen (ngson2000) on 2015-02-19
no longer affects: mahara/1.10
Aaron Wells (u-aaronw) on 2015-04-29
no longer affects: mahara/15.04
no longer affects: mahara/15.10
Changed in mahara:
milestone: 16.04.0 → 16.10.0
Aaron Wells (u-aaronw) wrote :

The change for this one is finally ready! But since it's a big change, and hard to test all the edge-cases, I'm going to hold off on backporting it into stable until the 16.04.1 release.

Reviewed: https://reviews.mahara.org/4064
Committed: https://git.mahara.org/mahara/mahara/commit/b73b5e70b94a1afee19a1245a651a5bd020d58c2
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit b73b5e70b94a1afee19a1245a651a5bd020d58c2
Author: Son Nguyen <email address hidden>
Date: Mon Dec 8 15:20:45 2014 +1300

Refactor site templates (Bug 1397110)

- Change ownership of default system templates
from user 0 to institution 'mahara'
and set template to 2
- Enable to add site files into site templates

behatnotneeded - existing tests for system templates are ok

Change-Id: Idfd5fca423e6f6a5f66d6cf944f7c5f88112584c
Signed-off-by: Son Nguyen <email address hidden>

Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/6545

Reviewed: https://reviews.mahara.org/6545
Committed: https://git.mahara.org/mahara/mahara/commit/e174049ba89ecf48247f32544c56d77e60f65e36
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit e174049ba89ecf48247f32544c56d77e60f65e36
Author: Robert Lyon <email address hidden>
Date: Fri Jun 3 16:48:10 2016 +1200

Bug 1588606: Properly checking for site templates

An oversite when Bug 1397110 was tested

behatnotneeded

Change-Id: I1772d27bb1ec099a26149551f82cf6ea365bb780
Signed-off-by: Robert Lyon <email address hidden>

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6509
Committed: https://git.mahara.org/mahara/mahara/commit/a253ba9c23df87b2180aa2218a26134f5a33ef0c
Submitter: Aaron Wells (<email address hidden>)
Branch: 16.04_STABLE

commit a253ba9c23df87b2180aa2218a26134f5a33ef0c
Author: Son Nguyen <email address hidden>
Date: Mon Dec 8 15:20:45 2014 +1300

Refactor site templates (Bug 1397110)

- Change ownership of default system templates
from user 0 to institution 'mahara'
and set template to 2
- Enable to add site files into site templates

behatnotneeded - existing tests for system templates are ok

Change-Id: Idfd5fca423e6f6a5f66d6cf944f7c5f88112584c
Signed-off-by: Son Nguyen <email address hidden>

Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/6568

Reviewed: https://reviews.mahara.org/6567
Committed: https://git.mahara.org/mahara/mahara/commit/fce3ece8edb988169ef7d748e2722107a5c362b3
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.04_STABLE

commit fce3ece8edb988169ef7d748e2722107a5c362b3
Author: Robert Lyon <email address hidden>
Date: Fri Jun 3 16:48:10 2016 +1200

Bug 1588606: Properly checking for site templates

An oversite when Bug 1397110 was tested

behatnotneeded

Change-Id: I1772d27bb1ec099a26149551f82cf6ea365bb780
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit e174049ba89ecf48247f32544c56d77e60f65e36)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6568
Committed: https://git.mahara.org/mahara/mahara/commit/ac9a33a679ff26621324560984446c86e8a8430a
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit ac9a33a679ff26621324560984446c86e8a8430a
Author: Aaron Wells <email address hidden>
Date: Wed Jun 8 19:53:07 2016 +1200

Bug 1590300: Typo in smarty variable

Regression from Bug 1397110

Change-Id: I6f98131dd61e06d0bc9d268bbe3eee1c4d4fbcb0
behatnotneeded: covered by existing tests

Reviewed: https://reviews.mahara.org/6569
Committed: https://git.mahara.org/mahara/mahara/commit/af2780deba838e531c1a61318be59b5eb40589e3
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.04_STABLE

commit af2780deba838e531c1a61318be59b5eb40589e3
Author: Aaron Wells <email address hidden>
Date: Wed Jun 8 19:53:07 2016 +1200

Bug 1590300: Typo in smarty variable

Regression from Bug 1397110

Change-Id: I6f98131dd61e06d0bc9d268bbe3eee1c4d4fbcb0
behatnotneeded: covered by existing tests
(cherry picked from commit ac9a33a679ff26621324560984446c86e8a8430a)

Has this fix been made?

We have version 16.04.3 and we are still unable to add images to a text block.

summary: - Cannot add image to template files
+ Cannot add image to template pages

Phil, can you please provide the steps that you are taking? I can't replicate what I think your problem is. The following two scenarios work for me:

A) Image block
1. Add an image block to the "Page template" page at /admin/site/views.php
2. Upload an image to the "Site files" area, i.e. the only one available.
3. Select the image and display it.
4. Create a new page in the user's personal portfolio area.
5. Correct result: See the image block with the image that I had uploaded.

B) Text block
1. Add a "Text" block to the "Page template" page at /admin/site/views.php
2. In TinyMCE, click the "Image" icon and upload an image to the "Site files" area.
3. Select the image and display it.
4. Create a new page in the user's personal portfolio area.
5. Correct result: See the image block with the image that I had uploaded.

Robert Lyon (robertl-9) on 2016-10-21
Changed in mahara:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers