Forums / Developer / creating an internal link and OE improvement

creating an internal link and OE improvement

Author Message

andreas spahr

Wednesday 28 January 2004 4:54:57 am

Hi togehter,

here is an improvmenet of the Online Editor OE to create links with the self-evident "Insert Link" Buttons instead of object relation. This is for users a big advantage.
I would appreciate it, if it will be taken into the new OE version - if there are no problems.

The installation is very easy, only copy the code in the two files in the extension/ezdhtml (editor-1.3).
Because of the copyright of the ezdhtml product, I post only some lines of each file. But it should be quite easy to find the correct lines where to put in the code.

regards,
andreas

extension/ezdhtml/modules/ezdhtml/insertlink.php:
-----------------------------------------------------
from Line 25: $classList =& $ini->variable( 'link', 'AvailableClasses' );

// start modification
$showClasses =& $ini->variable( 'link', 'ShowClasses' );
$startNode =& $ini->variable( 'link', 'StartNode' );
// end modification

$Module =& $Params["Module"];

$http =& eZHttpTool::instance();

$Module->setTitle( "Insert Link" );

$tpl =& templateInit();

$tpl->setVariable( "class_list", $classList );
$tpl->setVariable( "module", $Module );

// start modification
$tpl->setVariable("startNode", $startNode);
$tpl->setVariable("showClasses", $showClasses);
// end modification

$Result = array();
-----------------------------------------------------

extension/ezdhtml/design/standard/templates/ezdhtml/insertlink.tpl
-----------------------------------------------------

Comment from line 34 the following code:
<!--
// to prevent a global onchange event I moved this to the select box.
// <select name ="linkType" onChange="linkUrl.value=this.value">
script language="javascript" for="linkType" event="onchange"
linkUrl.value = linkType.value;
/script
// -->
....

Copy the following e.g. between the input types "Text" and "Type":

<!-- start modification -->
<tr>
<td>Internal Links
</td>
<td>

{let translation=ezini('URLTranslator','Translation')}

<!-- Level 1 -->

{let children=fetch('content','list',hash(parent_node_id,$startNode,
class_filter_type, include,
class_filter_array, $showClasses ) )}

<select name ="linkType" align="left" onChange="linkUrl.value=this.value">
<option value="">- - - - - - - - - - - - </option>
{section name=Child loop=$children}


{section show=eq($translation,'enabled')}
<option value="{$Child:item.url_alias}"> -- {$Child:item.name}</option>
{section-else}
<option value="{concat('/content/view/full/',$Child:item.node_id)}"> -- {$Child:item.name}</option>
{/section}

<!-- Level 2 -->

{let sub_children=fetch('content','list', hash(parent_node_id, $Child:item.node_id,
class_filter_type, include,
class_filter_array, $showClasses ) )}

{section name=SubChild loop=$:sub_children}

{section show=eq($translation,'enabled')}
<option value="{$Child:SubChild:item.url_alias}"> ---- {$Child:SubChild:item.name}</option>
{section-else}
<option value="{concat('/content/view/full/',$Child:SubChild:item.node_id)}"> ---- {$Child:SubChild:item.name}</option>
{/section}
<!-- Level 3 -->
{let sub_sub_children=fetch('content','list', hash(parent_node_id, $Child:SubChild:item.node_id,
class_filter_type, include,
class_filter_array, $showClasses ) )}

{section name=SubSubChild loop=$Child:SubChild:sub_sub_children}

{section show=eq($translation,'enabled')}
<option value="{$Child:SubChild:SubSubChild:item.url_alias}"> ------ {$Child:SubChild:SubSubChild:item.name}</option>
{section-else}
<option value="{concat('/content/view/full/',$Child:SubChild:SubSubChild:item.node_id)}"> ------ {$Child:SubChild:SubSubChild:item.name}</option>
{/section}

{/section}

{/let}
{/section}


{/let}

{delimiter modulo=$col_count}
{/delimiter}
{/section}
</select>
{/let}
{/let}
</td>
</tr>
<!-- end modification -->
-----------------------------------------------------

To configure which classes can be listed for linking, configure the content.ini.
Set the StartNode to your appropriate Node ID.

settings/override/content.ini.append.php
-----------------------------------------------------
[link]
StartNode=2
ShowClasses[]=folder
ShowClasses[]=info_page
-----------------------------------------------------

andreas spahr

Wednesday 28 January 2004 5:16:44 am

I forget in the first posting the information, where to extend the window size for the Insert Link popup:
extension/ezdhtml/design/standard/javascripts/ezdhtml/ezeditor.js
In line 192 set dialogHeight to 25.

eZ debug

Timing: Jan 18 2025 11:41:26
Script start
Timing: Jan 18 2025 11:41:26
Module start 'content'
Timing: Jan 18 2025 11:41:27
Module end 'content'
Timing: Jan 18 2025 11:41:27
Script end

Main resources:

Total runtime0.9239 sec
Peak memory usage4,096.0000 KB
Database Queries189

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 588.9609180.8125
Module start 'content' 0.00710.7704 769.7734468.7422
Module end 'content' 0.77760.1463 1,238.5156338.4063
Script end 0.9238  1,576.9219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.4713210.0002
Check MTime0.00160.1773210.0001
Mysql Total
Database connection0.00060.065810.0006
Mysqli_queries0.829789.80981890.0044
Looping result0.00240.26451870.0000
Template Total0.885495.820.4427
Template load0.00250.265620.0012
Template processing0.883095.570120.4415
Template load and register function0.00020.023010.0002
states
state_id_array0.00170.181310.0017
state_identifier_array0.00240.257620.0012
Override
Cache load0.00220.23301240.0000
Sytem overhead
Fetch class attribute can translate value0.00170.178920.0008
Fetch class attribute name0.00180.197320.0009
XML
Image XML parsing0.00040.041620.0002
class_abstraction
Instantiating content class attribute0.00000.000720.0000
General
dbfile0.00170.1874210.0001
String conversion0.00000.000930.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
14content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 33
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs