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.

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 16:28:26
Script start
Timing: Jan 18 2025 16:28:26
Module start 'layout'
Timing: Jan 18 2025 16:28:26
Module start 'content'
Timing: Jan 18 2025 16:28:26
Module end 'content'
Timing: Jan 18 2025 16:28:26
Script end

Main resources:

Total runtime0.5682 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.0064 588.0469152.6406
Module start 'layout' 0.00640.0038 740.687539.4766
Module start 'content' 0.01010.5566 780.1641463.6484
Module end 'content' 0.56670.0015 1,243.812512.7500
Script end 0.5682  1,256.5625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.6364160.0002
Check MTime0.00140.2491160.0001
Mysql Total
Database connection0.00090.159410.0009
Mysqli_queries0.499187.8274520.0096
Looping result0.00050.0848500.0000
Template Total0.531193.520.2655
Template load0.00190.334120.0009
Template processing0.529293.126320.2646
Template load and register function0.00010.021110.0001
states
state_id_array0.00100.171910.0010
state_identifier_array0.00120.219320.0006
Override
Cache load0.00180.31821240.0000
Sytem overhead
Fetch class attribute can translate value0.00060.101910.0006
Fetch class attribute name0.00130.220020.0006
XML
Image XML parsing0.00010.018110.0001
class_abstraction
Instantiating content class attribute0.00000.001020.0000
General
dbfile0.00080.1410100.0001
String conversion0.00000.002140.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/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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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