Forums / Developer / EZenhanceObject Relation - are class and node filters mutually exclusive?

EZenhanceObject Relation - are class and node filters mutually exclusive?

Author Message

rudy demo

Friday 01 April 2005 1:02:28 am

Hello.
I use last version of EZenhanceObject Relation on latest 3.4 version.
I notice the following behaviour:
1) class and node filtering
- I create an attribute and set <b>default selection node</b> AND <b>class</b> filters
- under the node specified I have objects from several classes and I see also these objects(i.e. users and user groups).
I was wondering if this is the normal behaviour of the extension?
2) I got an Error when using DropDown presentation
In the datatype/edit template(line 29)

$node.node_id

is accessed.
I got an error message there which is (I believe) correct because at that place, no access to a local var

$node

and not even to the global

$node

(because we're in edit mode so no access to global $node).
Is that correct?
Thank you.

Xavier Dutoit

Friday 01 April 2005 3:37:31 am

Hello,

I'm afraid we never needed to put both the node id and the class. For what I remembern that an OR.

If you know the template language and willing to try to modify the behavior, yo that's this template : extension/enhancedobjectrelation/design/standard/
templates/content/datatype/edit/ezenhancedobjectrelation.tpl

I'd be delighted to add your enhancement.

http://www.sydesy.com

rudy demo

Monday 04 April 2005 3:25:37 am

OK, Xavier, here's my pick then:
1. We should now have 3 filter options (Node), (class) , and (node and class).
2. I supposed the following(also deducing from your code :-)
2.1 if (Node) => All objects below that node(LIST fetch)
2.2 if (Class) => All objects of (Class) below the root node (2)(TREE fetch)
2.3 if (Node and Class) => All objects of (Class) below (Node)(LIST fetch)

Even, implemented like this for the time being, I would recommend the followings:
1. Let the user choose if he wants a list of tree by recording this in the datatype
2. Allow to select multiple nodes

I would really pleased to update the TPL script part for you, if you implement these two features in the PHP part.
These two extra-features really open up the possibilities of your datatype.

Back to the code, I added a new dadatype presentation too.
<b>1. the class edit datatype</b>
Please, note that I changed slightly the names of presentations so that they are technically more accurate(in my humble opinion, Xavier). So here are the changes...

<div class="element">
<label>{'Selection method'|i18n( 'design/standard/class/datatype' )}</label><div class="labelbreak"></div>

<select name="ContentClass_ezobjectrelation_selection_type_{$class_attribute.id}">
    <option value="4" {eq( $content.selection_type, 4 )|choose( '', 'selected="selected"' )}>{'Multiple select box'|i18n( 'design/standard/class/datatype' )}</option>
    <option value="3" {eq( $content.selection_type, 3 )|choose( '', 'selected="selected"' )}>{'Check boxes list'|i18n( 'design/standard/class/datatype' )}</option>
    <option value="1" {eq( $content.selection_type, 1 )|choose( '', 'selected="selected"' )}>{'Dropdown list'|i18n( 'design/standard/class/datatype' )}</option>
    <option value="2" {eq( $content.selection_type, 2 )|choose( '', 'selected="selected"' )}>{'Radio buttons list'|i18n( 'design/standard/class/datatype' )}</option>
{*    <option value="0" {eq( $content.selection_type, 0 )|choose( '', 'selected="selected"' )}>{'Browse'|i18n( 'design/standard/class/datatype' )}</option>*}
</select>
</div>

<b>2. content edit template</b>

<fieldset>
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{default attribute_base=ContentObjectAttribute}
{let class_content=$attribute.contentclass_attribute.content}

{switch match=$class_content.selection_type}

{case match=0} {* Browse *}
This choice shouldn't show up. Please select another selection method, and inform me (xavier) on the forum about this message.
    {section show=$attribute.content}
        <p class="box">{content_view_gui view=text_linked content_object=$attribute.content}</p>
    {section-else}
        <p class="box">{"No relation"|i18n("design/standard/content/datatype")}</p>
    {/section}

    <input type="hidden" name="{$attribute_base}_data_object_relation_id_{$attribute.id}" value="{$attribute.data_int}" />
    {section show=$attribute.content}
        <input class="button" type="submit" name="BrowseObjectButton_{$attribute.id}" value="{'Replace object'|i18n('design/standard/content/datatype')}" />
        <input class="button" type="submit" name="RemoveObjectButton_{$attribute.id}" value="{'Remove object'|i18n('design/standard/content/datatype')}" />
    {section-else}
        <input class="button" type="submit" name="BrowseObjectButton_{$attribute.id}" value="{'Find object'|i18n('design/standard/content/datatype')}" />
    {/section}
    <input type="hidden" name="CustomActionButton[{$attribute.id}_set_object_relation]" value="{$attribute.id}" />

{/case}

{case match=1} {* Dropdown list *}
    <div class="buttonblock">
    <select name="{$attribute_base}_data_object_relation_id_list_{$attribute.id}[{cond(is_set($node.node_id),$node.node_id}]">
        {section show=$attribute.contentclass_attribute.is_required|not}
            <option value="" {section show=eq( $attribute.data_int, '' )}selected="selected"{/section}>{'No relation'|i18n( 'design/standard/content/datatype' )}</option>
        {/section}
        {let parent_node=fetch( content, node, hash( node_id, $class_content.default_selection_node ) )}
        {section var=node loop=fetch( content, list,
                                      hash( parent_node_id, $parent_node.node_id,
                                            sort_by, $parent_node.sort_array ) )}
            <option value="{$node.contentobject_id}" {$attribute.content.id_list|contains($node.contentobject_id)|choose( '', 'selected="selected"' )}>{$node.name|wash}</option>
        {/section}
        {/let}
    </select>

    </div>
{/case}

{case match=2} {* radio button *}
        {section show=$attribute.contentclass_attribute.is_required|not}
            <input type="radio" name="{$attribute_base}_data_object_relation_id_list_{$attribute.id}[single]" {section show=eq( $attribute.data_int, '' )}selected="selected"{/section}>{'No relation'|i18n( 'design/standard/content/datatype' )}</input><br />
        {/section}
        {let parent_node=fetch( content, node, hash( node_id, $class_content.default_selection_node ) )}
        {section var=node loop=fetch( content, list,
                                      hash( parent_node_id, $parent_node.node_id,
                                            sort_by, $parent_node.sort_array ) )}
           <input type="radio" name="{$attribute_base}_data_object_relation_id_list_{$attribute.id}[single]" value="{$node.contentobject_id}" {$attribute.content.id_list|contains($node.contentobject_id)|choose( '', 'checked="checked"' )}>{$node.name|wash}</input>  <br/>
        {/section}
        {/let}
{/case}


{case match=3} {* check box *}
{section show=$class_content.default_selection_node}
        {let parent_node=fetch( content, node, hash( node_id, $class_content.default_selection_node ) )}
        {section var=node loop=fetch( content, list,
                                      hash( parent_node_id, $parent_node.node_id,
                                            sort_by, $parent_node.sort_array ) )}
           <input type="checkbox" name="{$attribute_base}_data_object_relation_id_list_{$attribute.id}[{$node.node_id}]" value="{$node.contentobject_id}" {$attribute.content.id_list|contains($node.contentobject_id)|choose( '','checked="checked"' )}>{$node.name|wash}</input>  <br/>
        {/section}
        {/let}
{/section}

{section show=$class_content.filter_class}
{section var=node loop=fetch( 'content', 
        'tree', 
        hash( 'parent_node_id',     2,
              'class_filter_type',  'include',
              'class_filter_array', array( $class_content.filter_class ) ) )}
           <input type="checkbox" name="{$attribute_base}_data_object_relation_id_list_{$attribute.id}[{$node.node_id}]" value="{$node.contentobject_id}" {$attribute.content.id_list|contains($node.contentobject_id)|choose( '','checked="checked"' )}>{$node.name|wash}</input>  <br/>
        {/section}
{/section}

{*{$attribute.content|attribute(show)}*}


{/case}
{case match=4} {* list box*}
    <div class="buttonblock">
    <select name="{$attribute_base}_data_object_relation_id_list_{$attribute.id}[{cond(is_set($node.node_id),$node.node_id}]" size="$10" multiple>
        {section show=$attribute.contentclass_attribute.is_required|not}
            <option value="" {section show=eq( $attribute.data_int, '' )}selected="selected"{/section}>{'No relation'|i18n( 'design/standard/content/datatype' )}</option>
        {/section}
        {* parent_node is default_selection_node or root(2) *}
        {let parent_node=cond(is_set($class_content.default_selection_node),fetch( content, node, hash( node_id, $class_content.default_selection_node ) ),2)
        		 nodesList=cond(is_set($class_content.filter_class),
        		 					fetch( content, list,
                                      hash( parent_node_id, $parent_node.node_id,
                                            sort_by, $parent_node.sort_array ,
                                            class_filer_type,'include',
                                            class_filter_array, array($class_content.filter_class)) ),
                           fetch( content, list,
                                      hash( parent_node_id, $parent_node.node_id,
                                            sort_by, $parent_node.sort_array ) )
                           )
        }
        {section var=node loop=$nodesList}
            <option value="{$node.contentobject_id}" {$attribute.content.id_list|contains($node.contentobject_id)|choose( '', 'selected="selected"' )}>{$node.name|wash}</option>
        {/section}
        {/let}  
    </select>
    </div>  
{/case}
{/switch} 
{*Display objects marked for editing *}
<fieldset>
{section loop=$attribute.content.edit_id_list}
	ID: {$:item}
	{let object=fetch( content, object, hash( object_id, $:item) )}
	{section name=Attribute loop=$object.contentobject_attributes}
		<div class="block">
		{section show=$:item.display_info.edit.grouped_input}
				<fieldset>
				<legend>
					{$:item.contentclass_attribute.name}
				</legend>
					{attribute_edit_gui attribute_base=concat( $attribute_base, '_ezorl_edit_object_', $:item.contentobject_id ) html_class='half' attribute=$:item}
				</fieldset>
		{section-else}
				<label>
					{$:item.contentclass_attribute.name}:
				</label>
				{attribute_edit_gui attribute_base=concat( $attribute_base, '_ezorl_edit_object_', $:item.contentobject_id ) html_class='half' attribute=$:item}
		{/section}
	{/section}
	{/let}
{/section}
</fieldset>
{*End displaying objects marked for editing*}
<input class="button" type="submit" value="Create New" name="CustomActionButton[{$attribute.id}_new_object]" />
{/let}
{/default}
</fieldset>

Keep me posted about what you think of my suggestions please.

Xavier Dutoit

Monday 04 April 2005 5:18:03 am

Lots of very good suggestions.

Could you contact me by email to discuss about how to make things move (eg, you use pubsvn to commit your patches).

ez .at. sydesy .dot. com

Talk to you soon

P.S. I'm going to add a suggestion for ez: let the authenticated users see other users email.

http://www.sydesy.com

eZ debug

Timing: Jan 31 2025 01:20:42
Script start
Timing: Jan 31 2025 01:20:42
Module start 'content'
Timing: Jan 31 2025 01:20:42
Module end 'content'
Timing: Jan 31 2025 01:20:43
Script end

Main resources:

Total runtime0.1937 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0079 588.2813370.2578
Module start 'content' 0.00790.0149 958.53911,013.7813
Module end 'content' 0.02280.1708 1,972.32033,903.6641
Script end 0.1936  5,875.9844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00482.5002200.0002
Check MTime0.00140.7075200.0001
Mysql Total
Database connection0.00080.398610.0008
Mysqli_queries0.088945.88531410.0006
Looping result0.00110.58661390.0000
Template Total0.170488.010.1704
Template load0.00080.422410.0008
Template processing0.169587.544310.1695
Override
Cache load0.00050.280310.0005
Sytem overhead
Fetch class attribute can translate value0.00221.118410.0022
XML
Image XML parsing0.00030.151910.0003
General
dbfile0.00743.8242200.0004
String conversion0.00000.003230.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs