Multiple select field, displaying not-selected values

More
11 years 1 week ago #34587 by brandonking
My hero, That is pretty nice!!

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

More
11 years 3 days ago #34963 by brandonking
Installed r1657 but seems no implementation for this.
I have fegured it out for selectmultiple.php.

From:
Code:
Line 192 for($n=0, $c=count($values); $n<$c; $n++) { $element = @$elements[ $values[$n] ]; if ( $element ) { if ($text_or_value == 0) $fe_display = $element->value; else $fe_display =JText::_($element->text); $display[] = $pretext . $fe_display . $posttext; $display_index[] = $element->value; } }

To:
Code:
if ($display_all){ for($m=0, $cc=count(@$elements); $m<$cc; $m++) { $check_val=0; for($n=0, $c=count($values); $n<$c; $n++) { if ($m == $values[$n]){ $element = @$elements[ $values[$n] ]; if ( $element ) { if ($text_or_value == 0) $fe_display = $element->value; else $fe_display =JText::_($element->text); $display[] = $pretext . $fe_display . $posttext; $display_index[] = $element->value; $check_val=1; } } } if($check_val == 0){ $element = @$elements[ $m ]; if ( $element ) { if ($text_or_value == 0) $fe_display = $element->value; else $fe_display =JText::_($element->text); $display[] = $ns_pretext . $fe_display . $ns_posttext; $display_index[] = $element->value; $check_val=1; } } } }else{ for($n=0, $c=count($values); $n<$c; $n++) { $element = @$elements[ $values[$n] ]; if ( $element ) { if ($text_or_value == 0) $fe_display = $element->value; else $fe_display =JText::_($element->text); $display[] = $pretext . $fe_display . $posttext; $display_index[] = $element->value; } } }
Initailizing Variables:
Code:
$display_all = $field->parameters->get( 'display_all', 0 ) ; $ns_pretext = FlexicontentFields::replaceFieldValue( $field, $item, $field->parameters->get( 'ns_pretext', '' ), 'ns_pretext' ); $ns_posttext = FlexicontentFields::replaceFieldValue( $field, $item, $field->parameters->get( 'ns_posttext', '' ), 'ns_posttext' ); if($ns_pretext) { $ns_pretext = $remove_space ? $ns_pretext : $ns_pretext . ' '; } if($ns_posttext) { $ns_posttext = $remove_space ? $ns_posttext : ' ' . $ns_posttext; }

selectmultiple.xml
Code:
<field name="display_all" type="radio" default="0" label="FLEXI_DISPLY_ALL_ITEMS_MULTI_SELECT" description="FLEXI_DISPLY_ALL_ITEMS_MULTI_SELECT_DESC"> <option value="0">FLEXI_NO</option> <option value="1">FLEXI_YES</option> </field> <field name="ns_pretext" type="text" default="" label="FLEXI_FIELD_VALUE_PREFIX_TEXT_NONSELECTED" description="FLEXI_FIELD_VALUE_PREFIX_TEXT_NONSELECTED_DESC" /> <field name="ns_posttext" type="text" default="" label="FLEXI_FIELD_VALUE_SUFFIX_TEXT_NONSELECTED" description="FLEXI_FIELD_VALUE_SUFFIX_TEXT_NONSELECTED_DESC" />

It is working without any problem so please use these codes(Maybe some changes needed for better performance) if you don't mind.

Best wishes,
Brandon

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

More
11 years 2 days ago #34967 by ggppdk
Your code has performance O(n*n)

(although you may only have a small performance issue in category view with many items and big n)

i have added code with performance O(n) and with default classes for making it appeared as disabled (text as strike-through (you can change to make use color instead) and image with lower opacity)

I have added it in select,selectmultiple, radio, radioimage, checkbox, checkboximage

I hope it broke nothing , i tested it,

v2.0.1 is available for download :
code.google.com/p/flexicontent/downloads/list

announcement in our frontpage will follow later today

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
11 years 2 days ago #34970 by brandonking
Thank you very much and I will test it right away.. :D

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

More
11 years 2 days ago #34971 by ggppdk
This feature gives the fields a more powerful view, i think quite a few people will find this useful

check the class that is being added
for non-selected field ,
this is always added:

<span class="fc_field_unsused_val"> ... </span>

which is works, but it is orthographically wrong
it should be :

fc_field_unused_val

... i will change this for next update ...


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
11 years 2 days ago #34972 by brandonking
:) What a beautiful coding.. only a few lines.. mine was too childish.. :D By the way, works like a charm.
Thank you George

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.391 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline