Hi,
By default we can select multiple categories for an entry.
but now i want to enforce only single category selection per entry.
for this i have just commented the (+) sign in functions_entries_admin.inc.php file. the line i have commented is 157 line. <a style="border:0; text-decoration: none" href="#" onclick="showItem('categoryselector'); return false" title="<?php echo TOGGLE_OPTION; ?>"><img src="<?php echo serendipity_getTemplateFile('img/plus.png') ?>" id="option_categoryselector" style="border: 20px" alt="" border="0" /></a>.
Also i have commented document.getElementById('option_' + id).src = '<?php echo serendipity_getTemplateFile('img/plus.png') ?>'; in line numbers 236 and 278 in showitem(id) function because i was getting javascript errors.
Now its working fine. now for categories combo box is shown and only one category can be selected.(+) sign is not shown now before the combo box.
Is this correct way of doing this task? will it give problems else where?
is there any better solution for this?
Thanks.
manoj.
Enforcing Single category selection only
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Enforcing Single category selection only
Hi!
I advise to not patch serendipity code, because you make upgrades harder.
Instead I suggest you to use the entrycheck plugin and modify it so that only the first selected category is assigned, and all other selections are removed?
This would still display all the entry editing interface, but there is currently no way to get rid of that...
Best regards,
Garvin
I advise to not patch serendipity code, because you make upgrades harder.
Instead I suggest you to use the entrycheck plugin and modify it so that only the first selected category is assigned, and all other selections are removed?
This would still display all the entry editing interface, but there is currently no way to get rid of that...
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Hi garvin,
once again thanks for the support you have been providing.
We are customising the code to such an extent that we cannot directly use the next versions of serendipity. it would have been good if we could externalise the changes in code so that we could use future versions of serendipity but our requirements were so....
also we are new to PHP and smarty and so its not easy to customise plugins.
anyway is it easy to customise the entrycheck plugin to achieve the desired result.
thanks.
manoj.
once again thanks for the support you have been providing.
We are customising the code to such an extent that we cannot directly use the next versions of serendipity. it would have been good if we could externalise the changes in code so that we could use future versions of serendipity but our requirements were so....
also we are new to PHP and smarty and so its not easy to customise plugins.
anyway is it easy to customise the entrycheck plugin to achieve the desired result.
thanks.
manoj.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Editing the entrycheck plugin should be easy, yes. It already contains a check for category, which you can just enahnce with some PHP to check how many elements in the categorie are, and cut off all extra ones...
HTH,
Garvin
Editing the entrycheck plugin should be easy, yes. It already contains a check for category, which you can just enahnce with some PHP to check how many elements in the categorie are, and cut off all extra ones...
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/