Open preview in new window

Help with installation and general calendar setttings

Open preview in new window

Postby JohN » Tue Jan 22, 2013 1:30 am

I'm trying to open the preview calendar from within the admin menu in a new browser window.

It seems I've located the code in the file: admin-menu.inc.php

The code line seems to be:
$menu[1]["common"]["see_web"] = array('href'=>''.AC_CALENDAR_PUBLIC.'','txt'=>''.$lang["see_web"].'','icon'=>'<img src="icons/icon_calendar.png" alt="web">');

And now I have to include the piece / target="_blank" /

Tried 'trial and error' but was left with only error :-)

How would I do that?

Thanks
JohN
User avatar
JohN
 
Posts: 14
Joined: Fri Sep 30, 2011 1:42 am

Re: Open preview in new window

Postby chris » Mon Feb 04, 2013 5:54 pm

Hmm, it should already be opening it in a new window, there appears to be something wrong. I will take a look and get back to you.

Chris
User avatar
chris
Site Admin
 
Posts: 1088
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Open preview in new window

Postby chris » Mon Feb 04, 2013 9:00 pm

OK, there are actually 2 problems here that need to be fixed.
Firstly the code simply isn't adding the "target="_blank" to the link and secondly, even if it was, the JavaScript code is modifying the navigation links events. I really need to push out a new version of this calendar code as some of the code is now quite old and not optimized.

You need to do to things:

1.
File: ac-admin > menu.admin.php
Find these lines (from ln 70):

$admin_menu.='
Code: Select all
<li ';
if(ADMIN_PAGE=="".$type."") $admin_menu.='class="active"';
$admin_menu.='><a href="'.$href.'" title="'.$data["txt"].'" >'.$the_link.'</a></li>';

and modify them with this code:
Code: Select all
$target = "";
if($type=="see_web") $target='target="_blank"';

$admin_menu.='
<li ';
if(ADMIN_PAGE=="".$type."") $admin_menu.='class="active"';
$admin_menu.='><a href="'.$href.'" title="'.$data["txt"].'" '.$target.'>'.$the_link.'</a></li>';


2.
File: ac-admin > index.php
Find this lines (ln 125):
Code: Select all
document.location.href=this.getChildren().get('href');

and change to this:
Code: Select all
var elLnk=this.getChildren('a');
if(elLnk.get("target")=="") document.location.href=elLnk.get('href');


If you make those 2 changes, the calendar view "should" open in a new window.

Chris
User avatar
chris
Site Admin
 
Posts: 1088
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Open preview in new window

Postby JohN » Sat Feb 09, 2013 12:37 am

That worked well, only also replace the $admin_menu.=' that was left out you're code.
Thank you for this solution Chris.
User avatar
JohN
 
Posts: 14
Joined: Fri Sep 30, 2011 1:42 am


Return to Support

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron