Arrayedit: add duplicate option?
I'm finding myself adding a "Duplicate" option to arrayedits in siteprofiles a lot lately. It's making managing long lists of content a lot faster. Even made an object for it:
PUBLIC STATIC OBJECTTYPE WWPublisherRowEditScreenBase EXTEND TolliumRowEditScreenBase
<
PUBLIC STRING ARRAY arrayedits_add_duplicate;
UPDATE PUBLIC MACRO Init(RECORD data)
{
TolliumRowEditScreenBase::Init(data);
FOREVERY (STRING arrayeditname FROM this->arrayedits_add_duplicate)
{
OBJECT arrayedit := GetMember(this, arrayeditname);
arrayedit->AddAction("Dupliceren", PTR this->DuplicateArrayEditMember(arrayedit), [ max := -1 ]);
}
}
MACRO DuplicateArrayEditMember(OBJECT arrayedit)
{
//FIXME: take maxrows into account
arrayedit->value := arrayedit->value CONCAT arrayedit->selection;
}
>;
PUBLIC OBJECTTYPE type_cards EXTEND WWPublisherRowEditScreenBase
<
MACRO NEW()
{
this->arrayedits_add_duplicate := ["cards"];
}
>;
(it's not the cleanest code in the world, but that's not the point, it's just to give an idea)
Wouldn't it be nice to add such an option to arrayedit, eg <arrayedit allowduplicate="true" />
or something?