Forums / Developer / creating an internal link and OE improvement

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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.