trying getting note through pdf
This commit is contained in:
23
inc/note.php
Normal file → Executable file
23
inc/note.php
Normal file → Executable file
@@ -19,6 +19,19 @@ class Note extends PhpObject
|
|||||||
$sContent = '';
|
$sContent = '';
|
||||||
if($this->sNote!='')
|
if($this->sNote!='')
|
||||||
{
|
{
|
||||||
|
$this->sUrl = 'http://service.sap.com/sap/support/notes/convert2pdf/000'.$this->sNote.'?sap-language=EN';
|
||||||
|
$sContent = $this->getPageRecursive();
|
||||||
|
|
||||||
|
header('Content-Description: File Transfer');
|
||||||
|
header('Content-type: application/pdf');
|
||||||
|
header('Content-Disposition: inline; filename="note_'.$this->sNote.'.pdf"');
|
||||||
|
header('Content-Transfer-Encoding: binary');
|
||||||
|
header('Expires: 0');
|
||||||
|
header('Content-Length: '.strlen($sContent));
|
||||||
|
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||||
|
header('Pragma: public');
|
||||||
|
|
||||||
|
/*
|
||||||
$this->sUrl = 'http://service.sap.com/sap/support/notes/'.$this->sNote;
|
$this->sUrl = 'http://service.sap.com/sap/support/notes/'.$this->sNote;
|
||||||
$this->getPageRecursive();
|
$this->getPageRecursive();
|
||||||
$sSapPath = substr($this->sUrl, 0, strpos($this->sUrl, '/bc/bsp/sno/ui_entry/entry.htm'));
|
$sSapPath = substr($this->sUrl, 0, strpos($this->sUrl, '/bc/bsp/sno/ui_entry/entry.htm'));
|
||||||
@@ -47,7 +60,7 @@ class Note extends PhpObject
|
|||||||
//Deleting auto resize
|
//Deleting auto resize
|
||||||
//$sContent = str_replace('lv_diff = 210','lv_diff = 0', $sContent);
|
//$sContent = str_replace('lv_diff = 210','lv_diff = 0', $sContent);
|
||||||
$sContent = str_replace(array('setHeight();', 'window.onresize = setHeight; '), '', $sContent);
|
$sContent = str_replace(array('setHeight();', 'window.onresize = setHeight; '), '', $sContent);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
else $this->addError('Empty note number');
|
else $this->addError('Empty note number');
|
||||||
|
|
||||||
@@ -71,8 +84,8 @@ class Note extends PhpObject
|
|||||||
|
|
||||||
private function getPageRecursive()
|
private function getPageRecursive()
|
||||||
{
|
{
|
||||||
$sheader = $this->getPage(true);
|
$sHeader = $this->getPage(true);
|
||||||
$asLines = explode("\n", $sheader);
|
$asLines = array_filter(explode("\n", $sHeader));
|
||||||
foreach($asLines as $sLine) $asInfo[strtolower(strstr($sLine, ':', true))] = trim(substr(strstr($sLine, ':'), 1));
|
foreach($asLines as $sLine) $asInfo[strtolower(strstr($sLine, ':', true))] = trim(substr(strstr($sLine, ':'), 1));
|
||||||
|
|
||||||
if(array_key_exists('set-cookie', $asInfo)) $this->parseSetCookie($asInfo['set-cookie']);
|
if(array_key_exists('set-cookie', $asInfo)) $this->parseSetCookie($asInfo['set-cookie']);
|
||||||
@@ -83,7 +96,7 @@ class Note extends PhpObject
|
|||||||
$this->sUrl = ((substr($asInfo['location'], 0, 4)!='http')?self::getDomain($this->sUrl):'').$asInfo['location'];
|
$this->sUrl = ((substr($asInfo['location'], 0, 4)!='http')?self::getDomain($this->sUrl):'').$asInfo['location'];
|
||||||
return $this->getPageRecursive();
|
return $this->getPageRecursive();
|
||||||
}
|
}
|
||||||
else return substr($sheader, strpos($sheader, '<html>'));
|
else return implode("\n", $asLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function parseSetCookie($sCookie)
|
private function parseSetCookie($sCookie)
|
||||||
@@ -94,7 +107,7 @@ class Note extends PhpObject
|
|||||||
//Parse FIXME
|
//Parse FIXME
|
||||||
$asCookieInfo = explode('; ', $sCookie);
|
$asCookieInfo = explode('; ', $sCookie);
|
||||||
foreach($asCookieInfo as $sCookieInfo) $asCookie[strstr($sCookieInfo, '=', true)] = substr(strstr($sCookieInfo, '='), 1);
|
foreach($asCookieInfo as $sCookieInfo) $asCookie[strstr($sCookieInfo, '=', true)] = substr(strstr($sCookieInfo, '='), 1);
|
||||||
setcookie('sap-appcontext', $asCookie['sap-appcontext'], time()+3600, $asCookie['path']);
|
if(array_key_exists('sap-appcontext', $asCookie)) setcookie('sap-appcontext', $asCookie['sap-appcontext'], time()+3600, $asCookie['path']);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCredentials()
|
private function getCredentials()
|
||||||
|
|||||||
2
masks/note.html
Normal file → Executable file
2
masks/note.html
Normal file → Executable file
@@ -23,7 +23,7 @@ databap.pageInit = function()
|
|||||||
if(isNumeric(iNote) && iNote > 0 && iNote!=databap.tmp('note'))
|
if(isNumeric(iNote) && iNote > 0 && iNote!=databap.tmp('note'))
|
||||||
{
|
{
|
||||||
$('#note_id').val(iNote).focus();
|
$('#note_id').val(iNote).focus();
|
||||||
self.addBufferIcon();
|
//self.addBufferIcon();
|
||||||
$('#note_frame').attr('src', 'index.php?a=note&id='+iNote);
|
$('#note_frame').attr('src', 'index.php?a=note&id='+iNote);
|
||||||
databap.tmp('note', iNote);
|
databap.tmp('note', iNote);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user