Forums / General / Cancel edit

Cancel edit

Author Message

Alejandro Serrano

Saturday 23 September 2006 9:06:00 am

Hi,
Is there any way I could cancel an edit due to some conditions?
I'm planning using a spam filter which work under PHP. My idea was implementing an operator, and, if it returns false(), just cancel the edit, I mean, continue as if the edit had been successful, but not adding/editing the node.
Is it possible?

Thanks in advance.

Claudia Kosny

Saturday 23 September 2006 12:16:42 pm

Hello Alejandro

Here my thoughts on this:
Editing something consists of two major parts.
First you have the html page consisting out of the form elements where you enter the new information. Once this page is visible in the browser there is nothing you can do to to change the page (except with Javascript and Ajax). So the best your operator could do on this part is the adapt the edit page depending on some condition you know before the page is sent to browser.
But if the condition depends on whatever the user put into the edit form a template operator will not help you much. Most of the times the form is posted to some php script which then has to call and check the return value of your operator. Depending on the outcome the script either cancels the operation or continues. As most forms have a cancel option anyway you just need to look what happens if a customer clicks on this button to cancel the edit.
I am not sure how I would implement something like this. Most likely I would write my own extension to which all forms are posted. All forms would need to include the original form action in a hidden form field. My extension then would check the condition to see whether the data should be further processed or not. If yes the received data would be posted to the original form action.

Pretending the edit was successfull might be problem as sometimes the forms redirect to the view of the just edited object. To fake this might be cumbersome.

No matter how you do it, if you get your spamfilter to work please post you experiences here - it might be useful for others as well.

Greetings from Luxembourg

Claudia

Alejandro Serrano

Monday 25 September 2006 10:43:03 am

I've been thinking a bit more. Maybe I could do it in the same way that datatypes are checked. Is this possible? If yes, could you point me into some direction?

Thanks again

Claudia Kosny

Monday 25 September 2006 11:44:15 am

Hi Alejandro

Good idea. Maybe you should have a look at the EZcaptcha extension. I have not tried it and I don't know whether it works with newer versions of EZ but it should give you some hints on how to do this.

Claudia

eZ debug

Timing: Jan 18 2025 18:35:06
Script start
Timing: Jan 18 2025 18:35:06
Module start 'content'
Timing: Jan 18 2025 18:35:07
Module end 'content'
Timing: Jan 18 2025 18:35:08
Script end

Main resources:

Total runtime1.4498 sec
Peak memory usage4,096.0000 KB
Database Queries197

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0076 587.5313180.8594
Module start 'content' 0.00761.3217 768.3906484.3125
Module end 'content' 1.32930.1204 1,252.7031333.5078
Script end 1.4497  1,586.2109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.2715210.0002
Check MTime0.00150.1012210.0001
Mysql Total
Database connection0.00100.069010.0010
Mysqli_queries1.382595.35931970.0070
Looping result0.00190.12771950.0000
Template Total1.407797.120.7038
Template load0.00220.149420.0011
Template processing1.405596.945920.7027
Template load and register function0.00020.014310.0002
states
state_id_array0.00150.100710.0015
state_identifier_array0.00140.099720.0007
Override
Cache load0.00180.1236260.0001
Sytem overhead
Fetch class attribute can translate value0.00120.085730.0004
Fetch class attribute name0.00130.086840.0003
XML
Image XML parsing0.00060.043530.0002
class_abstraction
Instantiating content class attribute0.00000.000640.0000
General
dbfile0.00500.3460210.0002
String conversion0.00000.000430.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/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
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs