Mailing List Archive

Patch: Copy and Paste elements
Hi,

I just finished up writing the code for WHO to copy and paste elements
between stories (or within itself). I have attached the patch (diff
against trunk) and the copy icon (put it in comp/media/images). The
icon is from a free icon set:

http://famfamfam.com/lab/icons/mini/

Not sure if you guys have another source for icons.

Some notes about things I'm not 100% about:

- Copy data is stored in the session (get_state_data('copy_buffer',
'buffer')) - this should be okay right?
- It shows the copy action on items like the Deck on a story. However,
since you can't remove or add more than one deck element, copying it is
useless. Is there any way to know when copying doesn't make any sense?
- I found a bug with the way elements are added or removed. When you do
so, the container's delete/copy icon is lost because it's coded not to
show up on the top level container. This is fine on the first page
load, but on delete/add, it thinks it's the top level element when
drawing that container, so those buttons are lost.
- There's a bit of overlap on the icons when you have a field that only
takes up one line of space.
- I had to change Bric::App::Callback::ContainerProf::_locate_subelement
to also be able to search for fields rather than just containers.

Let me know what you think.

Adrian
Re: Patch: Copy and Paste elements [ In reply to ]
On Feb 12, 2009, at 5:36 PM, Adrian Yee wrote:

> I just finished up writing the code for WHO to copy and paste
> elements between stories (or within itself). I have attached the
> patch (diff against trunk) and the copy icon (put it in comp/media/
> images). The icon is from a free icon set:
>
> http://famfamfam.com/lab/icons/mini/
>
> Not sure if you guys have another source for icons.

We use the Nuvola icon set. See http://bricolage.cc/about/colophon/.

> Some notes about things I'm not 100% about:


I'm going to be working on a big Bricolage project over the next 4-6
weeks, so I expect that I'll have a bit more time to look at Bricolage
itself, fix bugs, review patches, etc. Do please be patient, though,
as I am still pretty slammed.

Of course, if anyone else could review this patch, too, and try it
out, Id' be very grateful.

Best,

David
Re: Patch: Copy and Paste elements [ In reply to ]
> - I found a bug with the way elements are added or removed. When you do
> so, the container's delete/copy icon is lost because it's coded not to
> show up on the top level container. This is fine on the first page
> load, but on delete/add, it thinks it's the top level element when
> drawing that container, so those buttons are lost.

Oh, I see this was already reported here:

http://bugs.bricolage.cc/show_bug.cgi?id=1392

Adrian
Re: Patch: Copy and Paste elements [ In reply to ]
Noticed that the copy icon was showing up for the media fields as well. Added a
is_autopopulated check, though I'm not 100% sure if this is the best solution.
New patch attached.

Adrian

On Thu, 12 Feb 2009 17:36:17 -0800
Adrian Yee <adrian@gossamer-threads.com> wrote:
> Hi,
>
> I just finished up writing the code for WHO to copy and paste elements
> between stories (or within itself). I have attached the patch (diff
> against trunk) and the copy icon (put it in comp/media/images). The
> icon is from a free icon set:
>
> http://famfamfam.com/lab/icons/mini/
>
> Not sure if you guys have another source for icons.
>
> Some notes about things I'm not 100% about:
>
> - Copy data is stored in the session (get_state_data('copy_buffer',
> 'buffer')) - this should be okay right?
> - It shows the copy action on items like the Deck on a story. However,
> since you can't remove or add more than one deck element, copying it is
> useless. Is there any way to know when copying doesn't make any sense?
> - I found a bug with the way elements are added or removed. When you do
> so, the container's delete/copy icon is lost because it's coded not to
> show up on the top level container. This is fine on the first page
> load, but on delete/add, it thinks it's the top level element when
> drawing that container, so those buttons are lost.
> - There's a bit of overlap on the icons when you have a field that only
> takes up one line of space.
> - I had to change Bric::App::Callback::ContainerProf::_locate_subelement
> to also be able to search for fields rather than just containers.
>
> Let me know what you think.
>
> Adrian
Re: Patch: Copy and Paste elements [ In reply to ]
On Feb 17, 2009, at 11:01 PM, Adrian Yee wrote:

> Noticed that the copy icon was showing up for the media fields as
> well. Added a
> is_autopopulated check, though I'm not 100% sure if this is the best
> solution.
> New patch attached.

Yep, that's the field.

That patch didn't come through, though; please make sure it's attached
as text/plain.

Best,

David
Re: Patch: Copy and Paste elements [ In reply to ]
David E. Wheeler wrote:
> That patch didn't come through, though; please make sure it's attached
> as text/plain.

Oops, here it is again.

Adrian
Re: Patch: Copy and Paste elements [ In reply to ]
On Feb 18, 2009, at 11:17 AM, Adrian Yee wrote:

>> That patch didn't come through, though; please make sure it's
>> attached as text/plain.
>
> Oops, here it is again.

Thanks. It looks pretty good to me. I fixed the bug where the delete
button didn't show up, so now the copy button should show up, too.

Would you mind making any necessary adjustments and applying this to
trunk, along with credit in Changes?

Thanks!

David