Nao gera PDF no IE7

Dúvidas referentes a instalação, Upgrade ou Migração do Joomla!
saulolima
Novato
Mensagens: 6
Registrado em: 05 Out 2008, 11:42

Nao gera PDF no IE7

Mensagem por saulolima »

Pessoal, seguinte: no IE 7 quando clicamos (em qualquer artigo) no botão PDF a página aparece em branco (ele pergunta se quer salvar, etc). No Firefox apararece normal.
Alguma coisa que possa ser feita ? Tenho dois sites ocm o mesmo problema - Versao 1.5.6 e 1.5.7. Um outro que ainda está na versão 1.5.3 funciona (servidore diferente).

Desde já agradecendo a atenção
wally
Novato
Mensagens: 1
Registrado em: 20 Jan 2009, 10:07

Re: Nao gera PDF no IE7

Mensagem por wally »

Você deve criar um arquivo para detectar o browser... exemplo browser_detection.php com o codigo seguinte

Código: Selecionar todos


<?php
 
/*
Script Name: Simple 'if' PHP Browser detection
Author: Harald Hope, Website: http://TechPatterns.com/
Script Source URI: http://TechPatterns.com/downloads/php_browser_detection.php
Version 2.0.2
Copyright (C) 29 June 2007
 
Modified 22 April 2008 by Jon Czerwinski
Added IE 7 version detection
 
This program is free software; you can redistribute it and/or modify it under 
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later version.
 
This program is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 
Get the full text of the GPL here: http://www.gnu.org/licenses/gpl.txt
 
Coding conventions:
http://cvs.sourceforge.net/viewcvs.py/phpbb/phpBB2/docs/codingstandards.htm?rev=1.3
*/
 
/*
the order is important, because opera must be tested first, and ie4 tested for before ie general
same for konqueror, then safari, then gecko, since safari navigator user agent id's with 'gecko' in string.
note that $dom_browser is set for all  modern dom browsers, this gives you a default to use, unfortunately we
haven't figured out a way to do this with actual method testing, which would be much better and reliable.
 
Please note: you have to call the function in order to get access to the variables, you call it by this:
 
browser_detection('browser');
 
then put you code that you want to use the variables with after that.
 
*/
 
function browser_detection( $which_test ) {
 
        // initialize the variables
        $browser = '';
        $dom_browser = '';
 
        // set to lower case to avoid errors, check to see if http_user_agent is set
        $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
 
        // run through the main browser possibilities, assign them to the main $browser variable
        if (stristr($navigator_user_agent, "opera")) 
        {
                $browser = 'opera';
                $dom_browser = true;
        }
 
/*
Test for IE 7 added
April 22, 2008
Jon Czerwinski
*/
        elseif (stristr($navigator_user_agent, "msie 7")) 
        {
                $browser = 'msie7'; 
                $dom_browser = false;
        }
 
        elseif (stristr($navigator_user_agent, "msie 4")) 
        {
                $browser = 'msie4'; 
                $dom_browser = false;
        }
 
        elseif (stristr($navigator_user_agent, "msie")) 
        {
                $browser = 'msie'; 
                $dom_browser = true;
        }
 
        elseif ((stristr($navigator_user_agent, "konqueror")) || (stristr($navigator_user_agent, "safari"))) 
        {
                $browser = 'safari'; 
                $dom_browser = true;
        }
 
        elseif (stristr($navigator_user_agent, "gecko")) 
        {
                $browser = 'mozilla';
                $dom_browser = true;
        }
 
        elseif (stristr($navigator_user_agent, "mozilla/4")) 
        {
                $browser = 'ns4';
                $dom_browser = false;
        }
 
        else 
        {
                $dom_browser = false;
                $browser = false;
        }
 
        // return the test result you want
        if ( $which_test == 'browser' )
        {
                return $browser;
        }
        elseif ( $which_test == 'dom' )
        {
                return $dom_browser;
                //  note: $dom_browser is a boolean value, true/false, so you can just test if
                // it's true or not.
        }
}
 
/*
you would call it like this:
 
$user_browser = browser_detection('browser');
 
if ( $user_browser == 'opera' )
{
        do something;
}
 
or like this:
 
if ( browser_detection('dom') )
{
        execute the code for dom browsers
}
else
{
        execute the code for non DOM browsers
}
 
and so on.......
 
 
*/
?>
Salve ele e coloque no seguinte caminho

Código: Selecionar todos

libraries/joomla/utilities/
depois você vai ter que ir até o arquivo icon.php que esta na pasta >>>

Código: Selecionar todos

components/com_content/helpers/
e colocar na primeira linha após a declaração do <?php o codigo abaixo:

Código: Selecionar todos

require_once("libraries/joomla/utilities/browser_detection.php"); // o caminho do arquivo que detecta o browser.
Após alterar, você tem que ir até a linha 62 do mesmo arquivo e lá vc irá encontrar um codigo como o abaixo:

Código: Selecionar todos

$attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";
Substitua ele com o seguinte codigo:

Código: Selecionar todos

$user_browser = browser_detection('browser');
          if ($user_browser == 'msie7') {
             $attribs['target'] = '_blank';
          } else {                     
             $attribs['onclick'] =
    "window.open(this.href,'win2','".$status."'); return
    false;";
          }

Salve o arquivo.

Fonte: http://docs.joomla.org/PDF_Display_Fix_in_IE7
faribeiro
Novato
Mensagens: 7
Registrado em: 23 Jun 2009, 12:39

Re: Nao gera PDF no IE7

Mensagem por faribeiro »

Olá, membro deste fórum.

Também estava com este mesmo problema. Então, realizei os procedimentos que você disse, mas não tive êxito.

Desta vez a janela do PDF abriu, mas com uma subjanela com o seguinte erro: "There was one error opening this document. This file cannot be found"
A mensagem diz que não está conseguindo encontrar o arquivo. Este arquivo trata-se de um artigo com texto e uma fotografia.

Minha função PDF, que está dentro do arquivo "icon.php", no diretório components/con_content/helpers/icon.php ficou assim:

function pdf($article, $params, $access, $attribs = array())
{
$url = 'index.php?view=article';
$url .= @$article->catslug ? '&catid='.$article->catslug : '';
$url .= '&id='.$article->slug.'&format=pdf';

$status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';

// checks template image directory for image, if non found default are loaded
if ($params->get('show_icons')) {
$text = JHTML::_('image.site', 'pdf_button.png', '/images/M_images/', NULL, NULL, JText::_('PDF'));
} else {
$text = JText::_('PDF').'&nbsp;';
}

$attribs['title'] = JText::_( 'PDF' );
$user_browser = browser_detection('browser');
if ($user_browser == 'msie7') {
$attribs['target'] = '_blank';
}
else {
$attribs['onclick'] =
"window.open(this.href,'win2','".$status."'); return
false;";
}
$attribs['rel'] = 'nofollow';

return JHTML::_('link', JRoute::_($url), $text, $attribs);
}




Aguardo retorno,
Flávio
Avatar do usuário
Manoel
Super Joomleiro
Mensagens: 1606
Registrado em: 21 Ago 2008, 09:04
Localização: Londrina - Paraná
Contato:

Re: Nao gera PDF no IE7

Mensagem por Manoel »

faribeiro, nosso amigo wally só postou 1 vez aqui no Forum.

Faço votos que ele volte a postar pra te ajudar.

Enquanto isso, talvez essa resposta neste link possa te ajudar: http://docs.joomla.org/PDF_Display_Fix_in_IE7

;)
http://www.tutoriais.iikozen.com.br/
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
http://www.molajo.org
Responder