Some problems with forms for selection multiple categories

2 views
Skip to first unread message

Chris Croome

unread,
Jun 19, 2009, 5:06:21 PM6/19/09
to semanti...@googlegroups.com
Hi

I have used the Semantic Forms extension to allow people to pick
multiple categories for pages using a form interface.

There are a few problems I have and I wonder if anyone has an answer for
any of these.

- Editing pages that haven't previously been edited with the 'edit with
form' interface -- is there any way to populate the CategoryTree with
the Categories that the page is already in?

- Is it possible to add the CategoryTree for selecting categories to the
Special:Upload page?

- Is it possible to omit some tickboxes from the CategoryTreei? In order
to have a tree structure for the categories I had to create some
meta-categories, is it possible to hide / remove the tickboxes for
these as they are only for structuring categories and not for pages to
be placed in. I did look at hiding the tick boxes for these specific
categories using CSS but they don't have a unique id.

- I have hidden the "no sub-categories" text from the CategoryTree with
a CSS hack, is there a more elegant way to do this?

i.CategoryTreeNotice {
display: none;
}

- The code I have used for the Template:Categories generates unneeded
comers, which I have hidden by using this code:

<span style="display: none;">{{#arraymap:{{{Category}}}|,|x|[[Category:x]]}}</span>

Is there a more elegant to remove all the unneeded comers?

Thanks

Chris

Yaron Koren

unread,
Jun 21, 2009, 12:16:35 PM6/21/09
to semanti...@googlegroups.com
Hi, to answer your questions:

1) No - you'd need some script to convert bare category tags into field values within template calls (which is the only type of data that Semantic Forms can edit).

2) No - another possibility, though, is to make the Image: (or File:) namespace editable by a form, so people can afterwards add categories to the uploaded file.

3) No. (I see a trend here. :) ) It might make sense to have a "hide this category from Semantic Forms" indicator for categories; the Semantic Drilldown extension somewhat has need for a similar feature.

4) That seems like a fairly elegant way to do it. Another option is probably to find the name of that language value, then turn it blank, by editing that value's MediaWiki page. (I hope that made sense.)

5) By "comers", did you mean "corners"? In any case, I can't think of another way to do it.

-Yaron

Dan Bolser

unread,
Jun 21, 2009, 6:27:14 PM6/21/09
to semanti...@googlegroups.com
2009/6/21 Yaron Koren <yar...@gmail.com>:
I guess you mean 'commas'. Indeed, the above code will generate a
string of commas because the comma is the default delimiter for the
output of the arraymap function.

Just do it like this... "{{#arraymap:{{{Category}}}|,|x|[[Category:x]] | }}

Which specifies a blank output delimiter.


BTW, it is possible to use the MW API to list the categories a page is
in, therefore it should be possible to build a 'category adder form'
independently of SF. I haven't played with these features, so I'm not
sure how easy it would be to integrate. Where is a good example of how
to use SF to categorize pages?

Cheers,
Dan.


>> Thanks
>>
>> Chris
>>
>>
>
>
> >
>

Chris Croome

unread,
Jun 21, 2009, 6:57:56 PM6/21/09
to semanti...@googlegroups.com
Hi

On Sun 21-Jun-2009 at 11:27:14PM +0100, Dan Bolser wrote:
>
> 2009/6/21 Yaron Koren <yar...@gmail.com>:


> >
> > 1) No - you'd need some script to convert bare category tags into
> > field values within template calls (which is the only type of data
> > that Semantic Forms can edit).

Ah, OK, thanks.

> > 2) No - another possibility, though, is to make the Image: (or
> > File:) namespace editable by a form, so people can afterwards add
> > categories to the uploaded file.

Great, I'll have a play with that.

> > 3) No. (I see a trend here. :) ) It might make sense to have a "hide
> > this category from Semantic Forms" indicator for categories; the
> > Semantic Drilldown extension somewhat has need for a similar
> > feature.

OK, that feature would help me out, in the meantime I'll see if I can
bodge it somehow...

> > 4) That seems like a fairly elegant way to do it. Another option is
> > probably to find the name of that language value, then turn it
> > blank, by editing that value's MediaWiki page. (I hope that made
> > sense.)

It didn't make sense, but don't worry about it :-)

> > 5) By "comers", did you mean "corners"? In any case, I can't think
> > of another way to do it.

Sorry I can't spell 'commas'...

> I guess you mean 'commas'. Indeed, the above code will generate a
> string of commas because the comma is the default delimiter for the
> output of the arraymap function.

Right.

> Just do it like this... "{{#arraymap:{{{Category}}}|,|x|[[Category:x]]
> | }}
>
> Which specifies a blank output delimiter.

Ah, great that solves it, I had tried adding newlines and that dodn't
work, I don't know why I didn't try a space.

It might be worth documenting how to use an arraymap for multiple
categories on the Semantic Forms page on mediawiki.org -- it took me
quite a few hours to work this out...

> BTW, it is possible to use the MW API to list the categories a page is
> in, therefore it should be possible to build a 'category adder form'
> independently of SF. I haven't played with these features, so I'm not
> sure how easy it would be to integrate. Where is a good example of how
> to use SF to categorize pages?

Ah, that sounds good, I'll do some more investigation...

Thanks again for all the help.

Chris

Dan Bolser

unread,
Jun 22, 2009, 4:09:54 AM6/22/09
to semanti...@googlegroups.com
2009/6/21 Chris Croome <ch...@webarchitects.co.uk>:
I was wondering if you would write a new 'tip' on the
http://smw.referata.com page? As I said, I haven't been looking at SF
for categorization, so it would be really useful for me if you created
something like a quick start 'tip' :-)

All the best,
Dan.

http://smw.referata.com/wiki/Special:BrowseData/Tips

Yaron Koren

unread,
Jun 22, 2009, 10:20:26 AM6/22/09
to semanti...@googlegroups.com
Okay, I see that you added a tip about it. I also added something short to the SF documentation, here:

http://www.mediawiki.org/wiki/Extension:Semantic_Forms#Category_inputs

The longer tip is still useful, though, especially for people who are just starting out.

-Yaron

Chris Croome

unread,
Jun 22, 2009, 1:15:46 PM6/22/09
to semanti...@googlegroups.com
Hi

On Mon 22-Jun-2009 at 10:20:26AM -0400, Yaron Koren wrote:
> Okay, I see that you added a tip about it. I also added something
> short to the SF documentation, here:
>
> http://www.mediawiki.org/wiki/Extension:Semantic_Forms#Category_inputs

Nice one, this could save someone like me many hours!

All the best

Chris

Reply all
Reply to author
Forward
0 new messages