Copy block config of tagged journal entries block

Bug #1027739 reported by Chris Wharton
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Wishlist
Robert Lyon

Bug Description

This is a follow-up from https://reviews.mahara.org/#/c/1072/ for milestone 1.6

Add block copy permission selector

tags: added: newfeature1.6
Chris Wharton (y-chrisw)
Changed in mahara:
status: New → In Progress
Changed in mahara:
milestone: 1.6.0 → 1.7.0
tags: added: newfeature1.7
removed: newfeature1.6
tags: added: journal
removed: newfeature1.7
Revision history for this message
Aaron Wells (u-aaronw) wrote :

Hi Kristina,

Can you expand on what this bug is about?

Cheers,
Aaron

Changed in mahara:
milestone: 1.7.0 → 1.8.0
Chris Wharton (y-chrisw)
Changed in mahara:
assignee: Chris Wharton (y-chrisw) → nobody
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 1.8rc1 → 1.8.0
Revision history for this message
Aaron Wells (u-aaronw) wrote :

Hi Robert,

I think you're working on something like this for a client already, right? Making it so the "tagged posts" journal block has options saying what happens to the underlying journals when it is copied by another user?

Cheers,
Aaron

Changed in mahara:
assignee: nobody → Robert Lyon (robertl-9)
milestone: 1.8.0 → 1.9.0
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Aaron, we are not working on this. The client decided not to go forward with this at the moment.

Changed in mahara:
milestone: 1.9.0 → none
assignee: Robert Lyon (robertl-9) → nobody
status: In Progress → Confirmed
tags: added: block
Revision history for this message
Aaron Wells (u-aaronw) wrote :

See also this forum post on the topic: https://mahara.org/interaction/forum/topic.php?id=7448

This block is not copyable, because copy functionality for it would be non-trivial. This is also true of the journal blocks, but even more so for this one, because it combines journal entries from multiple journals.

It's not insurmountable; we probably could figure out a reasonable set of strategies for copying it and add a menu to let the user decide about it, as we've done with the other journal blocks. But it'll require some effort.

Revision history for this message
Stéphanie Lanthier (lanthier-stephanie) wrote :

Hello,
The piece of code included is brought as a solution to the Mahara Community Developers Forum conversation « Copy "tagged journal entry" bloc », which is found at the URL https://mahara.org/interaction/forum/topic.php?id=7448.

Our will was to be able to copy a page from a model user containing a "tagged journal entry" block , while keeping the block presence and its configuration, i.e., it's tag.

As the tag must exist in the destination user portfolio, we ensure the tags presence by first copy a page from the model user containing a journal in which only one article is written and is marked as draft. This draft article is tagged by all the wished tags.

Moreover, in htdocs/artefact,blog/blocktype/taggedposts/lib.php file, we change the return value of the default_copy_type function, from 'nocopy' to 'shallow'

Once those prerequisites in place, we modified the htdocs/blocktype/lib.php file. Those following lines has been inserted under the line 1525 (on which we can see a newblock -> commit )
(The complete file is found attached)

        //Change - BEGIN - By Helene Bouley
        $viewid=$template->get('id');
        $bid=get_record('block_instance', 'view', $viewid,'blocktype','taggedposts');
        if ($this -> id == $bid -> id ) {
            $tagrecords = get_records_array('blocktype_taggedposts_tags', 'block_instance', $bid-> id, 'tagtype desc, tag', 'tag, tagtype');
            $newid=$newblock -> get('id');
            foreach ($tagrecords as $k => $v) {
                $o=new stdClass();
                $o -> block_instance= $newid;
                $o -> tag=$v -> tag;
                $o -> tagtype=1;
                insert_record('blocktype_taggedposts_tags', $o);
            }
        } //Change - END - By Helene Bouley

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

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

Revision history for this message
Mahara Bot (dev-mahara) wrote :

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

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

What to test:

1. Have tagged journal entries block in portfolios on a Mahara 15.10 or 16.04 and then upgrade and change the block config.
2. Have a user without any journal entries copy a page with the block and check that once journal entries are created that the proper tags show up. The tags themselves will not be created automatically, but the ones configured will become visible as soon as a journal entry is tagged.
3. Test with tags and also tags to exclude. When a user doesn't have a post tagged yet, but the block config includes an excluded tag, only the included tag is shown. We decided to leave that as is for the time being so as not to overcomplicate the language string. The excluded tag shows up as soon as a post is tagged.

summary: - Enhance tagged posts block - copy block
+ Copy block config of tagged journal entries block
Changed in mahara:
status: Confirmed → In Progress
milestone: none → 16.10.0
assignee: nobody → Robert Lyon (robertl-9)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6494
Committed: https://git.mahara.org/mahara/mahara/commit/61ad4da828353ba85064752add5fa1249f56d059
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 61ad4da828353ba85064752add5fa1249f56d059
Author: St��phanie Lanthier <email address hidden>
Date: Wed May 18 11:58:29 2016 +1200

Bug 1027739: Allow tagged post blocks to be copied

Initial changes as suggested by St��phanie Lanthier

behatnotneeded

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

Son Nguyen (ngson2000)
Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6145
Committed: https://git.mahara.org/mahara/mahara/commit/e2efafbef747ea707fb846ccfe9578cab4af1e34
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit e2efafbef747ea707fb846ccfe9578cab4af1e34
Author: Robert Lyon <email address hidden>
Date: Wed Mar 16 12:48:24 2016 +1300

Bug 1027739: Adjustments to allow tagged post blocks to be copied

Note unlike copying journal blocks there is a special option for
taggedposts block that allows for copying of tags only.

This means copying the tags used in the block across to the new block
instance only.

So if you copy your own page the new taggedposts block should display
the same content as the old one

If you are another user it should display either nothing or the
journals you have with the same tags

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

tags: added: nominatedfeature
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.