Keyword

Category dropdown list in front-end content editor is too large because display unused categories

More
15 years 2 months ago #80378 by Vasyl
K2 2.2
Usergrop "A" assigned to add content in one category of 50.
User (included to "A") just click "Add content" on front-end and seen page to add item. On this page is placing dropdown list to select category of content. So, in this dropdown list user can see all categories, but categories not assigned to access user are not active (disabled). If you have a lot of categories, this list is looking dead. I like to hide disabled categories from this list, but this require to change K2 code. Also, this feature is possible to make customazible.

Best regards,
Vasyl

Please Log in or Create an account to join the conversation.

More
15 years 2 months ago #80379 by Lefteris
Hi. We chose to display all the category tree so the user can see the structure. Also, not showing the whole category structure may confuse when there are categories with same name.

Please Log in or Create an account to join the conversation.

More
15 years 2 months ago #80380 by Vasyl
Ok, you are right. But sometimes (and on my project in particular) is necessary to hide unused categories to inprove user comfortableness. Can I choose this by myself, optionally, in categories settings for example?
This question most like Feature requests, please move topic to this section, if it is necessary.
Thanks.

Please Log in or Create an account to join the conversation.

More
15 years 1 week ago #80381 by datshay
GOod question Vasyl,
I also have got the same problem. I just wanna display only the sub categories if active category as in Joomla default. It really creates my site look awkward and is difficult for the users to chose the menu...

Thanks,
Datshay

Vasyl said:Ok, you are right. But sometimes (and on my project in particular) is necessary to hide unused categories to inprove user comfortableness. Can I choose this by myself, optionally, in categories settings for example?This question most like Feature requests, please move topic to this section, if it is necessary.Thanks.

Please Log in or Create an account to join the conversation.

More
15 years 3 days ago #80382 by scyllar
I need this HIDE DISABLED CATEGORIES thing urgently because I have got a very large list most of which the end users are not accessible. I wouldn't mind giving it a hack but for days I just can't find any clues. Can anyone give me some tips? thanks :)

Please Log in or Create an account to join the conversation.

More
15 years 3 days ago #80383 by datshay
Hay please anyone ! i really need it.... urgently.....

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #80384 by Marios Katsis
I find a solution to your problem, but for now you can see it only at Firefox.

You must go at http://yoursite/components/com_k2/views/item/tmpl/form.php and add this

var disabledOptions=$$('#catid option[disabled]');
$each(disabledOptions, function(option){
option.setStyle('visibility', 'hidden');
option.setStyle('font-size', '0px');
});

before (or after, it does not matter) the code

if(window.ie){
var disabledOptions=$$('#catid option[disabled]');
$each(disabledOptions, function(option){
option.setStyle('height', '0px');
});
}

I am looking to give a solution for IE, Opera, Chrome

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #80385 by Marios Katsis
The solution is to add the following code to the page http://yoursite/components/com_k2/views/item/tmpl/form.php

var disabledOptions=$$('#catid option[disabled]');
option.remove(option.selectedIndex);
});

This works for all browsers

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #80386 by Jakub Jedynak
Where add to the page ? I added and no change happen :(

IMO it shouldn't work this way.

When you are in category and click New Article button, category should be already choosen (without dropdown at all).


Marios Katsis said:The solution is to add the following code to the page http://yoursite/components/com_k2/views/item/tmpl/form.php var disabledOptions=$$('#catid option[disabled]'); option.remove(option.selectedIndex);
});

This works for all browsers

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #80387 by Marios Katsis
You have to add it, before the code

if(window.ie){
var disabledOptions=$$('#catid option[disabled]');
$each(disabledOptions, function(option){
option.setStyle('height', '0px');
});
}



Qbin2001 said:Where add to the page ? I added and no change happen :(
IMO it shouldn't work this way.

When you are in category and click New Article button, category should be already choosen (without dropdown at all).


Marios Katsis said:The solution is to add the following code to the page http://yoursite/components/com_k2/views/item/tmpl/form.php var disabledOptions=$$('#catid option[disabled]'); option.remove(option.selectedIndex); });

This works for all browsers

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #80388 by Jakub Jedynak
Code for all browsers dosn't work for me at all.
Code for Firefox only works (in Firefox only).

How can I change forms.php to show only cuurent category (for both Add and Edit links).

I've changeed the code in forms.php (using changed k2 function getCategoryPath) which works in Edit mode, but in Add mode there is no category assigned so I get an error:

FROM

echo $this->lists;

TO

function getCategoryName($catid) {
static $array = array();
$db = &JFactory::getDBO();
$query = "SELECT * FROM #__k2_categories WHERE id={$catid}";
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row) {
array_push($array, $row->name);
}
return array_reverse($array);
}
$categories = getCategoryName($this->row->catid);
foreach($categories as $catName) {
echo $catName;
}



Marios Katsis said:The solution is to add the following code to the page http://yoursite/components/com_k2/views/item/tmpl/form.php var disabledOptions=$$('#catid option[disabled]');
option.remove(option.selectedIndex);
});

This works for all browsers

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #80389 by Vasyl
Marios Katsis, this code is work:

var disabledOptions=$$('#catid option[disabled]');
$each(disabledOptions, function(option){
option.remove(option.selectedIndex);
});

if it replacing the code

if(window.ie){
var disabledOptions=$$('#catid option[disabled]');
$each(disabledOptions, function(option){
option.setStyle('height', '0px');
});
}

in http://yoursite/components/com_k2/views/item/tmpl/form.php.

But I like adding this changes in new build...

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum