mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Bugtracker #4221 - handle 'open in new window' for leaf and kubrick
This commit is contained in:
parent
3ff7cfbc9a
commit
b39fff6e45
@ -1,34 +1,43 @@
|
||||
global $sql, $page, $link_class, $tp;
|
||||
$sql -> db_Select('links', '*', "link_category = 1 and link_name NOT REGEXP('submenu') and link_name NOT REGEXP('child') and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC");
|
||||
$ulmenu = "<ul id='navigation'>";
|
||||
$r="1";
|
||||
while($row = $sql -> db_Fetch()){
|
||||
if(!$link_class || check_class($link_class) || ($link_class==254 && USER)){
|
||||
if($r <= "8"){
|
||||
extract($row);
|
||||
$ltest = (e_QUERY ? e_PAGE."?".e_QUERY : e_PAGE);
|
||||
$rtest=substr(strrchr($link_url, "/"), 1);
|
||||
$link_url = $tp->replaceConstants($link_url,TRUE);
|
||||
if (strpos($link_url, '://') === FALSE) { $link_url = e_BASE.$link_url; }
|
||||
if($ltest == $link_url || $rtest == e_PAGE){ $ulclass = '_onpage'; } else { $ulclass = ''; }
|
||||
switch ($link_open) {
|
||||
case 1:
|
||||
$link_append = " onclick=\"window.open('$link_url'); return false;\"";
|
||||
break;
|
||||
case 2:
|
||||
$link_append = " target=\"_parent\"";
|
||||
break;
|
||||
case 3:
|
||||
$link_append = " target=\"_top\"";
|
||||
break;
|
||||
default:
|
||||
unset($link_append);
|
||||
}
|
||||
$ulmenu .= "<li class='nav".$r."$ulclass'><a".($link_description ? " title = '$link_description' " : "")." href='".$link_url."'".$link_append.">".($r !="0" ? "".LINKSTART."" : "" )."$link_name</a></li>";
|
||||
}
|
||||
$r++;
|
||||
}
|
||||
}
|
||||
$ulmenu .= "</ul>";
|
||||
return $ulmenu;
|
||||
global $sql, $link_class, $page,$tp;
|
||||
|
||||
$sql -> db_Select('links', '*', "link_category = 1 and link_parent =0 and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC");
|
||||
//$ulmenu = PRELINK."<ul>"; // Leaf
|
||||
$ulmenu = "<ul id='navigation'>"; // Kubrick
|
||||
$r='1'; // Needs to be a character - used for access key
|
||||
while (($row = $sql -> db_Fetch()) && ($r <= "8"))
|
||||
{
|
||||
extract($row);
|
||||
$link_url = $tp->replaceConstants($link_url,TRUE);
|
||||
// Check if current page is one of the links - Test from kubrick is better
|
||||
$ltest = (e_QUERY ? e_PAGE."?".e_QUERY : e_PAGE);
|
||||
$rtest=substr(strrchr($link_url, "/"), 1);
|
||||
if (strpos($link_url, '://') === FALSE) { $link_url = e_BASE.$link_url; }
|
||||
if($ltest == $link_url || $rtest == e_PAGE){ $ulclass = '_onpage'; } else { $ulclass = ''; }
|
||||
|
||||
$link_append = '';
|
||||
switch ($link_open)
|
||||
{
|
||||
case 0: // Open in same window
|
||||
break;
|
||||
case 1: // Simple open in new window
|
||||
$link_append = " rel='external'";
|
||||
break;
|
||||
case 4: // 600 x 400 window
|
||||
$link_append = " onclick=\"javascript:open_window('{$link_url}',600,400); return false;\"";
|
||||
break;
|
||||
case 5: // 800 x 600 window
|
||||
$link_append = " onclick=\"javascript:open_window('{$link_url}',800,600); return false;\"";
|
||||
break;
|
||||
}
|
||||
$lname = (defined(trim($link_name))) ? constant(trim($link_name)) : $link_name;
|
||||
$ulmenu .= "<li class='nav".$r."$ulclass'><a title='".varsettrue($link_description,'add a text description to this link')."' ";
|
||||
// if ($ulclass) $ulmenu .= " class='$ulclass' "; // Not for kubrick
|
||||
$ulmenu .= " href='{$link_url}'".$link_append." accesskey='".$r."' >".LINKSTART.$lname."</a></li>"; // For Kubrick
|
||||
// $ulmenu .= " href='{$link_url}'".$link_append." accesskey='".$r."' >".LINKSTART."$lname".LINKEND."</a></li>"; // For leaf
|
||||
|
||||
|
||||
$r++;
|
||||
}
|
||||
//$ulmenu .= "</ul>\n".POSTLINK; // Leaf
|
||||
$ulmenu .= "</ul>"; // Kubrick
|
||||
return $ulmenu;
|
@ -1,34 +1,43 @@
|
||||
global $sql, $link_class, $page,$tp;
|
||||
|
||||
$sql -> db_Select('links', '*', "link_category = 1 and link_parent =0 and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC");
|
||||
$ulmenu = PRELINK."<ul>";
|
||||
$r="1";
|
||||
while($row = $sql -> db_Fetch()){
|
||||
if($r <= "8"){
|
||||
extract($row);
|
||||
$link_url = $tp->replaceConstants($link_url,TRUE);
|
||||
if(!preg_match("#(http:|mailto:|ftp:|https:)#",$link_url)){
|
||||
$link_url = e_HTTP.$link_url;
|
||||
}
|
||||
if(strpos($link_url, e_PAGE) !== FALSE){ $ulclass = '_onpage'; } else { $ulclass = ''; }
|
||||
switch ($link_open) {
|
||||
case 1:
|
||||
$link_append = " onclick=\"window.open('$link_url'); return false;\"";
|
||||
break;
|
||||
case 2:
|
||||
$link_append = " target=\"_parent\"";
|
||||
break;
|
||||
case 3:
|
||||
$link_append = " target=\"_top\"";
|
||||
break;
|
||||
default:
|
||||
unset($link_append);
|
||||
}
|
||||
$lname = (defined(trim($link_name))) ? constant(trim($link_name)) : $link_name;
|
||||
$ulmenu .= "<li class='nav".$r."$ulclass'><a class='$ulclass' ".($link_description ? " title = '$link_description' " : "title = 'add a text description to this link' ")." href='".$link_url."' accesskey='".$r."' ".$link_append.">".LINKSTART."$lname".LINKEND."</a></li>";
|
||||
}
|
||||
$r++;
|
||||
$ulmenu = PRELINK."<ul>"; // Leaf
|
||||
//$ulmenu = "<ul id='navigation'>"; // Kubrick
|
||||
$r='1'; // Needs to be a character - used for access key
|
||||
while (($row = $sql -> db_Fetch()) && ($r <= "8"))
|
||||
{
|
||||
extract($row);
|
||||
$link_url = $tp->replaceConstants($link_url,TRUE);
|
||||
// Check if current page is one of the links - Test from kubrick is better
|
||||
$ltest = (e_QUERY ? e_PAGE."?".e_QUERY : e_PAGE);
|
||||
$rtest=substr(strrchr($link_url, "/"), 1);
|
||||
if (strpos($link_url, '://') === FALSE) { $link_url = e_BASE.$link_url; }
|
||||
if($ltest == $link_url || $rtest == e_PAGE){ $ulclass = '_onpage'; } else { $ulclass = ''; }
|
||||
|
||||
$link_append = '';
|
||||
switch ($link_open)
|
||||
{
|
||||
case 0: // Open in same window
|
||||
break;
|
||||
case 1: // Simple open in new window
|
||||
$link_append = " rel='external'";
|
||||
break;
|
||||
case 4: // 600 x 400 window
|
||||
$link_append = " onclick=\"javascript:open_window('{$link_url}',600,400); return false;\"";
|
||||
break;
|
||||
case 5: // 800 x 600 window
|
||||
$link_append = " onclick=\"javascript:open_window('{$link_url}',800,600); return false;\"";
|
||||
break;
|
||||
}
|
||||
$lname = (defined(trim($link_name))) ? constant(trim($link_name)) : $link_name;
|
||||
$ulmenu .= "<li class='nav".$r."$ulclass'><a title='".varsettrue($link_description,'add a text description to this link')."' ";
|
||||
if ($ulclass) $ulmenu .= " class='$ulclass' "; // Not for kubrick
|
||||
// $ulmenu .= " href='{$link_url}'".$link_append." accesskey='".$r."' >".LINKSTART.$lname."</a></li>"; // For Kubrick
|
||||
$ulmenu .= " href='{$link_url}'".$link_append." accesskey='".$r."' >".LINKSTART."$lname".LINKEND."</a></li>"; // For leaf
|
||||
|
||||
|
||||
$r++;
|
||||
}
|
||||
$ulmenu .= "</ul>\n".POSTLINK;
|
||||
$ulmenu .= "</ul>\n".POSTLINK; // Leaf
|
||||
//$ulmenu .= "</ul>"; // Kubrick
|
||||
return $ulmenu;
|
Loading…
x
Reference in New Issue
Block a user