Help : Private comments implementation

Author Message

Roberto Frascarelli

Friday 28 January 2005 1:29:48 am

I extended the default Comment content class adding a checkbox "private" so that, if checked, only admin and owner of that comment can see it.
I fastly made working visualization changes in templates, but now I have the problem that if one user that can't see a private comment searches for words appearing in the same comment contents, the search matches.
I need Comments contents be searchable but I want to inhibit search matches of
content in comments that a user can't see.
Any suggestions ?
Do I have to leave my first simple solution and loose my head into workflow customization?

Roberto Frascarelli

Friday 28 January 2005 6:19:08 am

I found a simple but not elegant solution overriding visualization
of search result template, filtering results:

{let $filtered_search_result=array()}
...
{section loop=$search_result}
  {section show=or( 
    ne($:item.class_identifier,'extcomment'),
    $:item.data_map.private.content|not())}
      
       {set filtered_search_result = $filtered_search_result|append($:item)}
  {/section}
{/section}
{set search_result=$filtered_search_result}
{set search_count=$filtered_search_result|count}
...
{/let}

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 20 2025 14:36:37
Script start
Timing: Jan 20 2025 14:36:37
Module start 'layout'
Timing: Jan 20 2025 14:36:37
Module start 'content'
Timing: Jan 20 2025 14:36:38
Module end 'content'
Timing: Jan 20 2025 14:36:38
Script end

Main resources:

Total runtime1.2183 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 589.2734152.6406
Module start 'layout' 0.00460.0028 741.914139.4766
Module start 'content' 0.00741.2095 781.3906460.6094
Module end 'content' 1.21690.0014 1,242.00008.1406
Script end 1.2183  1,250.1406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00290.2342160.0002
Check MTime0.00130.1072160.0001
Mysql Total
Database connection0.00050.041410.0005
Mysqli_queries1.177296.6276520.0226
Looping result0.00040.0328500.0000
Template Total1.186897.420.5934
Template load0.00170.139420.0008
Template processing1.185197.272120.5925
Template load and register function0.00020.012610.0002
states
state_id_array0.00120.095210.0012
state_identifier_array0.00140.115020.0007
Override
Cache load0.00130.1088160.0001
Sytem overhead
Fetch class attribute can translate value0.00060.045910.0006
Fetch class attribute name0.00100.085730.0003
XML
Image XML parsing0.00200.164610.0020
class_abstraction
Instantiating content class attribute0.00000.000940.0000
General
dbfile0.00220.1810160.0001
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 11
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs