Call custom javascript function as link in online editor

Author Message

Patrick Kaiser

Friday 28 October 2005 2:54:18 am

hi all,

does anybody know how a custom javascript-function could be called via a link inserted by the online editor? I basically just want to open a link in a new window having special attributes and a given size.

so the link would look like:
<a href="javascript:popup('http://somedomain.com', 300, 300)">popup</a>

in pagelayout i defined the javascript-function 'popup'.

but when i insert the link via the 'insert-link'-dialoge of the online editor (link-type: other) i get the following error message after publishing: 'Tag a has wrong format (removed).'

Any ideas? I search through all the forums, but nobody seems to have wanted calling popups from within ezxmltext-fields..

thanks,

patrick


Best regards,

Patrick

Mazen Alsibai

Sunday 30 October 2005 1:37:48 am

Hi:
you donot have to use javascript to do that,
just write<a href="http://somedomain.com" target="_blank">popup</a>

Patrick Kaiser

Sunday 30 October 2005 2:50:59 am

Thanks for your answer, but that is not what i want to archieve. of course i know that i can open the page in a new window, but my client wants to have a new window without title-, navigation- and scroll-bar opening in a fixed, non resizable size. and this can only be done via javascript.

this is the script:

<script language="JavaScript" type="text/javascript">
	<!--
	function popup(url, popupwidth, popupheight)
	{
		popup = window.open(url, "popup", "dependent=yes,resizable=no,width=" + popupwidth + ",height=" + popupheight + ",scrollbars=no,locationbar=no,menubar=no,status=no,screenX=" + ((screen.availWidth - popupwidth) / 2) + ",screenY=" + ((screen.availHeight - popupheight) / 2) + ",left=" + ((screen.availWidth - popupwidth) / 2) + ",top=" + ((screen.availHeight - popupheight) / 2));
		popup.focus();
	}
	//-->
</script>

i know that this script and the way i'm calling it is working. the problem is that ez is removing the 'javascript:...' after publishing :-(


Best regards,

Patrick

William Steenbergh

Wednesday 07 June 2006 8:07:13 am

try using the {literal} and {/literal} statements around the code for the link. EZ Publish will probably avoid it for parsing.

Marcin Drozd

Wednesday 07 June 2006 11:44:13 am

Hi
I think U should use
<literal class='html'> and </literal>

http://ez-publish.pl

tom stovall

Friday 18 May 2007 11:38:10 am

as of 3.8,

[literal]
AvailableClasses=html

has to be in content.ini.append.php of either siteaccess or override.

Markus Bader

Saturday 19 May 2007 1:10:44 pm

I think it was not mentioned in eZ for the editors that they could use code, because the online editor is for content management and not for template coding.

However - removing this "validation" from the php file in the kernel would be a solution.

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 18 2025 19:14:04
Script start
Timing: Jan 18 2025 19:14:04
Module start 'layout'
Timing: Jan 18 2025 19:14:04
Module start 'content'
Timing: Jan 18 2025 19:14:06
Module end 'content'
Timing: Jan 18 2025 19:14:06
Script end

Main resources:

Total runtime1.5989 sec
Peak memory usage4,096.0000 KB
Database Queries77

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.1719152.6563
Module start 'layout' 0.00570.0108 740.828139.5078
Module start 'content' 0.01641.5807 780.3359724.6484
Module end 'content' 1.59710.0017 1,504.984416.0938
Script end 1.5989  1,521.0781 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2203160.0002
Check MTime0.00140.0854160.0001
Mysql Total
Database connection0.00080.047610.0008
Mysqli_queries1.510894.4884770.0196
Looping result0.00110.0713750.0000
Template Total1.516694.920.7583
Template load0.00250.158820.0013
Template processing1.514094.691620.7570
Template load and register function0.00010.006110.0001
states
state_id_array0.00170.107610.0017
state_identifier_array0.00140.088720.0007
Override
Cache load0.00190.1192380.0001
Sytem overhead
Fetch class attribute can translate value0.00100.062260.0002
Fetch class attribute name0.00150.096690.0002
XML
Image XML parsing0.00280.173960.0005
class_abstraction
Instantiating content class attribute0.00000.0010100.0000
General
dbfile0.00220.1347230.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.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: 27
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs